@almadar/ui 5.25.1 → 5.26.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.
Files changed (48) hide show
  1. package/dist/avl/index.cjs +2001 -2178
  2. package/dist/avl/index.js +950 -1127
  3. package/dist/components/core/atoms/FlipContainer.d.ts +4 -4
  4. package/dist/components/core/atoms/Icon.d.ts +4 -2
  5. package/dist/components/core/atoms/ProgressBar.d.ts +1 -1
  6. package/dist/components/core/atoms/types.d.ts +6 -0
  7. package/dist/components/core/molecules/ArrayEditor.d.ts +15 -0
  8. package/dist/components/core/molecules/Carousel.d.ts +8 -2
  9. package/dist/components/core/molecules/Container.d.ts +4 -4
  10. package/dist/components/core/molecules/DateRangeSelector.d.ts +3 -4
  11. package/dist/components/core/molecules/DocSidebar.d.ts +4 -4
  12. package/dist/components/core/molecules/EdgeDecoration.d.ts +3 -2
  13. package/dist/components/core/molecules/Flex.d.ts +4 -4
  14. package/dist/components/core/molecules/FlipCard.d.ts +3 -4
  15. package/dist/components/core/molecules/GradientDivider.d.ts +3 -2
  16. package/dist/components/core/molecules/MapEditor.d.ts +16 -0
  17. package/dist/components/core/molecules/ObjectEditor.d.ts +15 -0
  18. package/dist/components/core/molecules/SidePanel.d.ts +4 -4
  19. package/dist/components/core/molecules/SortableList.d.ts +4 -5
  20. package/dist/components/core/molecules/ViolationAlert.d.ts +4 -9
  21. package/dist/components/core/molecules/index.d.ts +4 -3
  22. package/dist/components/core/molecules/markdown/CodeBlock.d.ts +44 -2
  23. package/dist/components/game/atoms/ResourceCounter.d.ts +3 -2
  24. package/dist/components/game/atoms/StateIndicator.d.ts +4 -5
  25. package/dist/components/game/atoms/StatusEffect.d.ts +2 -3
  26. package/dist/components/game/molecules/ActionButtons.d.ts +6 -0
  27. package/dist/components/game/molecules/GameHud.d.ts +2 -3
  28. package/dist/components/game/molecules/StatBadge.d.ts +6 -0
  29. package/dist/components/game/organisms/puzzles/state-architect/StateJsonView.d.ts +16 -0
  30. package/dist/components/game/organisms/puzzles/state-architect/index.d.ts +2 -2
  31. package/dist/components/index.cjs +2249 -1975
  32. package/dist/components/index.js +1349 -1075
  33. package/dist/docs/index.cjs +6014 -4606
  34. package/dist/docs/index.css +1252 -0
  35. package/dist/docs/index.d.cts +108 -16
  36. package/dist/docs/index.d.ts +2 -2
  37. package/dist/docs/index.js +5970 -4567
  38. package/dist/marketing/index.cjs +32 -9
  39. package/dist/marketing/index.d.cts +30 -20
  40. package/dist/marketing/index.js +32 -9
  41. package/dist/providers/index.cjs +1826 -2003
  42. package/dist/providers/index.js +925 -1102
  43. package/dist/runtime/index.cjs +1866 -2043
  44. package/dist/runtime/index.js +929 -1106
  45. package/package.json +1 -1
  46. package/dist/components/core/molecules/CodeViewer.d.ts +0 -70
  47. package/dist/components/core/molecules/DocCodeBlock.d.ts +0 -14
  48. package/dist/components/game/organisms/puzzles/state-architect/CodeView.d.ts +0 -24
package/dist/avl/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import * as React95 from 'react';
3
- import React95__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
2
+ import * as React93 from 'react';
3
+ import React93__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
4
4
  import { OrbitalProvider, EventBusContext, useTraitScope, VerificationProvider, TraitScopeProvider } from '@almadar/ui/providers';
5
5
  import { createLogger, isLogLevelEnabled } from '@almadar/logger';
6
6
  import ELK from 'elkjs/lib/elk.bundled.js';
7
7
  import { MarkerType, useReactFlow, Handle, Position, getBezierPath, EdgeLabelRenderer, useNodeId, ReactFlowProvider, BaseEdge, useNodesState, useEdgesState, ReactFlow, Controls, Background, BackgroundVariant } from '@xyflow/react';
8
8
  import { useTranslate, useEventBus as useEventBus$1 } from '@almadar/ui/hooks';
9
9
  import * as LucideIcons2 from 'lucide-react';
10
- import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, Code, FileText, WrapText, Check, Copy, AlertTriangle, Trash2, ZoomOut, ZoomIn, Download, RotateCcw, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, CheckCircle, XCircle, Play, Pause, SkipForward, Bug, Send, ChevronUp, ChevronDown, Wrench, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
10
+ import { Loader2, X, Code, FileText, WrapText, Check, Copy, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, AlertTriangle, Trash2, ZoomOut, ZoomIn, Download, RotateCcw, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, CheckCircle, XCircle, Play, Pause, SkipForward, Bug, Send, ChevronUp, ChevronDown, Wrench, Tag, User, DollarSign, Zap, Sword, Move, Heart, Shield } from 'lucide-react';
11
11
  import * as PhosphorIcons from '@phosphor-icons/react';
12
12
  import * as TablerIcons from '@tabler/icons-react';
13
13
  import * as FaIcons from 'react-icons/fa';
@@ -3467,7 +3467,7 @@ var init_Box = __esm({
3467
3467
  fixed: "fixed",
3468
3468
  sticky: "sticky"
3469
3469
  };
3470
- Box = React95__default.forwardRef(
3470
+ Box = React93__default.forwardRef(
3471
3471
  ({
3472
3472
  padding,
3473
3473
  paddingX,
@@ -3517,7 +3517,7 @@ var init_Box = __esm({
3517
3517
  onMouseLeave?.(e);
3518
3518
  }, [hoverEvent, eventBus, onMouseLeave]);
3519
3519
  const isClickable = action || onClick;
3520
- return React95__default.createElement(
3520
+ return React93__default.createElement(
3521
3521
  Component,
3522
3522
  {
3523
3523
  ref,
@@ -4107,7 +4107,7 @@ var init_MiniStateMachine = __esm({
4107
4107
  const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
4108
4108
  const tc = transitionCounts[s.name] ?? 0;
4109
4109
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
4110
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
4110
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
4111
4111
  /* @__PURE__ */ jsx(
4112
4112
  AvlState,
4113
4113
  {
@@ -5126,12 +5126,20 @@ function doResolve(name) {
5126
5126
  if (asIs && typeof asIs === "object") return asIs;
5127
5127
  return LucideIcons2.HelpCircle;
5128
5128
  }
5129
- var iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
5129
+ var colorTokenClasses, iconAliases, resolvedCache, sizeClasses, animationClasses, Icon;
5130
5130
  var init_Icon = __esm({
5131
5131
  "components/core/atoms/Icon.tsx"() {
5132
5132
  "use client";
5133
5133
  init_cn();
5134
5134
  init_iconFamily();
5135
+ colorTokenClasses = {
5136
+ primary: "text-primary",
5137
+ secondary: "text-secondary",
5138
+ success: "text-success",
5139
+ warning: "text-warning",
5140
+ error: "text-error",
5141
+ muted: "text-muted-foreground"
5142
+ };
5135
5143
  iconAliases = {
5136
5144
  "close": LucideIcons2.X,
5137
5145
  "trash": LucideIcons2.Trash2,
@@ -5170,7 +5178,7 @@ var init_Icon = __esm({
5170
5178
  const directIcon = typeof icon === "string" ? void 0 : icon;
5171
5179
  const effectiveName = typeof icon === "string" ? icon : name;
5172
5180
  const family = useIconFamily();
5173
- const RenderedComponent = React95__default.useMemo(() => {
5181
+ const RenderedComponent = React93__default.useMemo(() => {
5174
5182
  if (directIcon) return null;
5175
5183
  return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
5176
5184
  }, [directIcon, effectiveName, family]);
@@ -5179,10 +5187,11 @@ var init_Icon = __esm({
5179
5187
  ...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
5180
5188
  ...style
5181
5189
  };
5190
+ const resolvedColor = color ? color in colorTokenClasses ? colorTokenClasses[color] : color : "text-current";
5182
5191
  const composedClassName = cn(
5183
5192
  sizeClasses[size],
5184
5193
  animationClasses[animation],
5185
- color ? color : "text-current",
5194
+ resolvedColor,
5186
5195
  className
5187
5196
  );
5188
5197
  if (directIcon) {
@@ -5228,7 +5237,7 @@ function resolveIconProp(value, sizeClass) {
5228
5237
  const IconComp = value;
5229
5238
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
5230
5239
  }
5231
- if (React95__default.isValidElement(value)) {
5240
+ if (React93__default.isValidElement(value)) {
5232
5241
  return value;
5233
5242
  }
5234
5243
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -5304,7 +5313,7 @@ var init_Button = __esm({
5304
5313
  md: "h-icon-default w-icon-default",
5305
5314
  lg: "h-icon-default w-icon-default"
5306
5315
  };
5307
- Button = React95__default.forwardRef(
5316
+ Button = React93__default.forwardRef(
5308
5317
  ({
5309
5318
  className,
5310
5319
  variant = "primary",
@@ -5369,7 +5378,7 @@ var Dialog;
5369
5378
  var init_Dialog = __esm({
5370
5379
  "components/core/atoms/Dialog.tsx"() {
5371
5380
  init_cn();
5372
- Dialog = React95__default.forwardRef(
5381
+ Dialog = React93__default.forwardRef(
5373
5382
  ({
5374
5383
  role = "dialog",
5375
5384
  "aria-modal": ariaModal = true,
@@ -5391,43 +5400,6 @@ var init_Dialog = __esm({
5391
5400
  Dialog.displayName = "Dialog";
5392
5401
  }
5393
5402
  });
5394
- var Overlay;
5395
- var init_Overlay = __esm({
5396
- "components/core/atoms/Overlay.tsx"() {
5397
- "use client";
5398
- init_cn();
5399
- init_useEventBus();
5400
- Overlay = ({
5401
- isVisible = true,
5402
- onClick,
5403
- className,
5404
- blur = false,
5405
- action
5406
- }) => {
5407
- const eventBus = useEventBus();
5408
- if (!isVisible) return null;
5409
- const handleClick = (e) => {
5410
- if (action) {
5411
- eventBus.emit(`UI:${action}`, {});
5412
- }
5413
- onClick?.(e);
5414
- };
5415
- return /* @__PURE__ */ jsx(
5416
- "div",
5417
- {
5418
- className: cn(
5419
- "fixed inset-0 z-40",
5420
- blur && "backdrop-blur-sm",
5421
- className
5422
- ),
5423
- style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
5424
- onClick: action || onClick ? handleClick : void 0,
5425
- "aria-hidden": "true"
5426
- }
5427
- );
5428
- };
5429
- }
5430
- });
5431
5403
  var sizeClasses2, minWidthClasses, lookStyles, Modal;
5432
5404
  var init_Modal = __esm({
5433
5405
  "components/core/molecules/Modal.tsx"() {
@@ -5436,7 +5408,6 @@ var init_Modal = __esm({
5436
5408
  init_Button();
5437
5409
  init_Dialog();
5438
5410
  init_Typography();
5439
- init_Overlay();
5440
5411
  init_cn();
5441
5412
  init_useEventBus();
5442
5413
  sizeClasses2 = {
@@ -5526,130 +5497,160 @@ var init_Modal = __esm({
5526
5497
  }
5527
5498
  };
5528
5499
  return createPortal(
5529
- /* @__PURE__ */ jsxs(Fragment, { children: [
5530
- /* @__PURE__ */ jsx(
5531
- Overlay,
5532
- {
5533
- isVisible: isOpen,
5534
- onClick: handleOverlayClick,
5535
- className: "z-[1000]"
5536
- }
5537
- ),
5538
- /* @__PURE__ */ jsx(
5539
- Box,
5540
- {
5541
- className: cn(
5542
- "fixed inset-0 z-[1001] pointer-events-none",
5543
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
5544
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
5545
- ),
5546
- children: /* @__PURE__ */ jsxs(
5547
- Dialog,
5548
- {
5549
- ref: modalRef,
5550
- open: true,
5551
- className: cn(
5552
- // Reset browser-default dialog chrome — we own styling. `static`
5553
- // overrides the user-agent `position: absolute` so the parent
5554
- // flex container's `justify-center` actually centers the dialog
5555
- // (without this, the dialog drops out of flex flow and `m-0`
5556
- // kills the user-agent's `margin: auto` centering, pinning the
5557
- // dialog to top-left).
5558
- "static m-0 p-0 border-0 bg-transparent",
5559
- // Pre-existing dialog frame
5560
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
5561
- // Desktop sizing + viewport-aware floor.
5562
- sizeClasses2[size],
5563
- minWidthClasses[size],
5564
- "max-h-[80vh]",
5565
- // Mobile: take the entire screen. Override desktop max-w cap,
5566
- // full height, no rounded corners, no min-width.
5567
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
5568
- lookStyles[look],
5569
- className
5500
+ /* @__PURE__ */ jsx(
5501
+ "div",
5502
+ {
5503
+ className: cn(
5504
+ "fixed inset-0 z-[1000]",
5505
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
5506
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
5507
+ ),
5508
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
5509
+ onClick: handleOverlayClick,
5510
+ "aria-hidden": "true",
5511
+ children: /* @__PURE__ */ jsxs(
5512
+ Dialog,
5513
+ {
5514
+ ref: modalRef,
5515
+ open: true,
5516
+ className: cn(
5517
+ // Reset browser-default dialog chrome — we own styling. `static`
5518
+ // overrides the user-agent `position: absolute` so the parent
5519
+ // flex container's `justify-center` actually centers the dialog
5520
+ // (without this, the dialog drops out of flex flow and `m-0`
5521
+ // kills the user-agent's `margin: auto` centering, pinning the
5522
+ // dialog to top-left).
5523
+ "static m-0 p-0 border-0 bg-transparent",
5524
+ // Pre-existing dialog frame
5525
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
5526
+ // Desktop sizing + viewport-aware floor.
5527
+ sizeClasses2[size],
5528
+ minWidthClasses[size],
5529
+ "max-h-[80vh]",
5530
+ // Mobile: take the entire screen. Override desktop max-w cap,
5531
+ // full height, no rounded corners, no min-width.
5532
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
5533
+ lookStyles[look],
5534
+ className
5535
+ ),
5536
+ style: dragY > 0 ? {
5537
+ transform: `translateY(${dragY}px)`,
5538
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
5539
+ } : void 0,
5540
+ ...title && { "aria-labelledby": "modal-title" },
5541
+ children: [
5542
+ /* @__PURE__ */ jsx(
5543
+ Box,
5544
+ {
5545
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
5546
+ onPointerDown: (e) => {
5547
+ if (!swipeDownToClose) return;
5548
+ dragStartY.current = e.clientY;
5549
+ isDragging.current = true;
5550
+ e.target.setPointerCapture(e.pointerId);
5551
+ },
5552
+ onPointerMove: (e) => {
5553
+ if (!isDragging.current) return;
5554
+ const dy = Math.max(0, e.clientY - dragStartY.current);
5555
+ setDragY(dy);
5556
+ },
5557
+ onPointerUp: () => {
5558
+ if (!isDragging.current) return;
5559
+ isDragging.current = false;
5560
+ if (dragY > 100) {
5561
+ handleClose();
5562
+ }
5563
+ setDragY(0);
5564
+ },
5565
+ onPointerCancel: () => {
5566
+ isDragging.current = false;
5567
+ setDragY(0);
5568
+ },
5569
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
5570
+ }
5570
5571
  ),
5571
- style: dragY > 0 ? {
5572
- transform: `translateY(${dragY}px)`,
5573
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
5574
- } : void 0,
5575
- ...title && { "aria-labelledby": "modal-title" },
5576
- children: [
5577
- /* @__PURE__ */ jsx(
5578
- Box,
5579
- {
5580
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
5581
- onPointerDown: (e) => {
5582
- if (!swipeDownToClose) return;
5583
- dragStartY.current = e.clientY;
5584
- isDragging.current = true;
5585
- e.target.setPointerCapture(e.pointerId);
5586
- },
5587
- onPointerMove: (e) => {
5588
- if (!isDragging.current) return;
5589
- const dy = Math.max(0, e.clientY - dragStartY.current);
5590
- setDragY(dy);
5591
- },
5592
- onPointerUp: () => {
5593
- if (!isDragging.current) return;
5594
- isDragging.current = false;
5595
- if (dragY > 100) {
5596
- handleClose();
5572
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
5573
+ Box,
5574
+ {
5575
+ className: cn(
5576
+ "px-6 py-4 flex items-center justify-between",
5577
+ "border-b-[length:var(--border-width)] border-border"
5578
+ ),
5579
+ children: [
5580
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
5581
+ showCloseButton && /* @__PURE__ */ jsx(
5582
+ Button,
5583
+ {
5584
+ variant: "ghost",
5585
+ size: "sm",
5586
+ icon: "x",
5587
+ onClick: handleClose,
5588
+ "data-event": "CLOSE",
5589
+ "aria-label": t("aria.closeModal")
5597
5590
  }
5598
- setDragY(0);
5599
- },
5600
- onPointerCancel: () => {
5601
- isDragging.current = false;
5602
- setDragY(0);
5603
- },
5604
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
5605
- }
5606
- ),
5607
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
5608
- Box,
5609
- {
5610
- className: cn(
5611
- "px-6 py-4 flex items-center justify-between",
5612
- "border-b-[length:var(--border-width)] border-border"
5613
- ),
5614
- children: [
5615
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
5616
- showCloseButton && /* @__PURE__ */ jsx(
5617
- Button,
5618
- {
5619
- variant: "ghost",
5620
- size: "sm",
5621
- icon: "x",
5622
- onClick: handleClose,
5623
- "data-event": "CLOSE",
5624
- "aria-label": t("aria.closeModal")
5625
- }
5626
- )
5627
- ]
5628
- }
5629
- ),
5630
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
5631
- footer && /* @__PURE__ */ jsx(
5632
- Box,
5633
- {
5634
- className: cn(
5635
- "px-6 py-4 bg-muted",
5636
- "border-t-[length:var(--border-width)] border-border"
5637
- ),
5638
- children: footer
5639
- }
5640
- )
5641
- ]
5642
- }
5643
- )
5644
- }
5645
- )
5646
- ] }),
5591
+ )
5592
+ ]
5593
+ }
5594
+ ),
5595
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
5596
+ footer && /* @__PURE__ */ jsx(
5597
+ Box,
5598
+ {
5599
+ className: cn(
5600
+ "px-6 py-4 bg-muted",
5601
+ "border-t-[length:var(--border-width)] border-border"
5602
+ ),
5603
+ children: footer
5604
+ }
5605
+ )
5606
+ ]
5607
+ }
5608
+ )
5609
+ }
5610
+ ),
5647
5611
  document.body
5648
5612
  );
5649
5613
  };
5650
5614
  Modal.displayName = "Modal";
5651
5615
  }
5652
5616
  });
5617
+ var Overlay;
5618
+ var init_Overlay = __esm({
5619
+ "components/core/atoms/Overlay.tsx"() {
5620
+ "use client";
5621
+ init_cn();
5622
+ init_useEventBus();
5623
+ Overlay = ({
5624
+ isVisible = true,
5625
+ onClick,
5626
+ className,
5627
+ blur = false,
5628
+ action
5629
+ }) => {
5630
+ const eventBus = useEventBus();
5631
+ if (!isVisible) return null;
5632
+ const handleClick = (e) => {
5633
+ if (action) {
5634
+ eventBus.emit(`UI:${action}`, {});
5635
+ }
5636
+ onClick?.(e);
5637
+ };
5638
+ return /* @__PURE__ */ jsx(
5639
+ "div",
5640
+ {
5641
+ className: cn(
5642
+ "fixed inset-0 z-40",
5643
+ blur && "backdrop-blur-sm",
5644
+ className
5645
+ ),
5646
+ style: { backgroundColor: "rgba(0, 0, 0, 0.6)" },
5647
+ onClick: action || onClick ? handleClick : void 0,
5648
+ "aria-hidden": "true"
5649
+ }
5650
+ );
5651
+ };
5652
+ }
5653
+ });
5653
5654
  var sizeWidths, Drawer;
5654
5655
  var init_Drawer = __esm({
5655
5656
  "components/core/molecules/Drawer.tsx"() {
@@ -5872,7 +5873,7 @@ var init_Badge = __esm({
5872
5873
  md: "px-2.5 py-1 text-sm",
5873
5874
  lg: "px-3 py-1.5 text-base"
5874
5875
  };
5875
- Badge = React95__default.forwardRef(
5876
+ Badge = React93__default.forwardRef(
5876
5877
  ({ className, variant = "default", size = "sm", amount, label, icon, children, onRemove, removeLabel, ...props }, ref) => {
5877
5878
  const iconSizes3 = {
5878
5879
  sm: "h-icon-default w-icon-default",
@@ -6188,7 +6189,7 @@ var init_SvgFlow = __esm({
6188
6189
  opacity = 1,
6189
6190
  className
6190
6191
  }) => {
6191
- const markerId = React95__default.useMemo(() => {
6192
+ const markerId = React93__default.useMemo(() => {
6192
6193
  flowIdCounter += 1;
6193
6194
  return `almadar-flow-arrow-${flowIdCounter}`;
6194
6195
  }, []);
@@ -6731,7 +6732,7 @@ var init_SvgRing = __esm({
6731
6732
  className,
6732
6733
  label
6733
6734
  }) => {
6734
- const gradientId = React95__default.useMemo(() => {
6735
+ const gradientId = React93__default.useMemo(() => {
6735
6736
  ringIdCounter += 1;
6736
6737
  return `almadar-ring-glow-${ringIdCounter}`;
6737
6738
  }, []);
@@ -6893,7 +6894,7 @@ var init_Input = __esm({
6893
6894
  "components/core/atoms/Input.tsx"() {
6894
6895
  init_cn();
6895
6896
  init_Icon();
6896
- Input = React95__default.forwardRef(
6897
+ Input = React93__default.forwardRef(
6897
6898
  ({
6898
6899
  className,
6899
6900
  inputType,
@@ -7014,7 +7015,7 @@ var Label;
7014
7015
  var init_Label = __esm({
7015
7016
  "components/core/atoms/Label.tsx"() {
7016
7017
  init_cn();
7017
- Label = React95__default.forwardRef(
7018
+ Label = React93__default.forwardRef(
7018
7019
  ({ className, required, children, ...props }, ref) => {
7019
7020
  return /* @__PURE__ */ jsxs(
7020
7021
  "label",
@@ -7040,7 +7041,7 @@ var Textarea;
7040
7041
  var init_Textarea = __esm({
7041
7042
  "components/core/atoms/Textarea.tsx"() {
7042
7043
  init_cn();
7043
- Textarea = React95__default.forwardRef(
7044
+ Textarea = React93__default.forwardRef(
7044
7045
  ({ className, error, ...props }, ref) => {
7045
7046
  return /* @__PURE__ */ jsx(
7046
7047
  "textarea",
@@ -7070,7 +7071,7 @@ var init_Select = __esm({
7070
7071
  "components/core/atoms/Select.tsx"() {
7071
7072
  init_cn();
7072
7073
  init_Icon();
7073
- Select = React95__default.forwardRef(
7074
+ Select = React93__default.forwardRef(
7074
7075
  ({ className, options, placeholder, error, ...props }, ref) => {
7075
7076
  return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
7076
7077
  /* @__PURE__ */ jsxs(
@@ -7112,7 +7113,7 @@ var Checkbox;
7112
7113
  var init_Checkbox = __esm({
7113
7114
  "components/core/atoms/Checkbox.tsx"() {
7114
7115
  init_cn();
7115
- Checkbox = React95__default.forwardRef(
7116
+ Checkbox = React93__default.forwardRef(
7116
7117
  ({ className, label, id, ...props }, ref) => {
7117
7118
  const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
7118
7119
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
@@ -7203,7 +7204,7 @@ var init_Card = __esm({
7203
7204
  chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
7204
7205
  "tile-image-first": "p-0 overflow-hidden"
7205
7206
  };
7206
- Card = React95__default.forwardRef(
7207
+ Card = React93__default.forwardRef(
7207
7208
  ({
7208
7209
  className,
7209
7210
  variant = "bordered",
@@ -7241,9 +7242,9 @@ var init_Card = __esm({
7241
7242
  }
7242
7243
  );
7243
7244
  Card.displayName = "Card";
7244
- CardHeader = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7245
+ CardHeader = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
7245
7246
  CardHeader.displayName = "CardHeader";
7246
- CardTitle = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7247
+ CardTitle = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7247
7248
  "h3",
7248
7249
  {
7249
7250
  ref,
@@ -7256,11 +7257,11 @@ var init_Card = __esm({
7256
7257
  }
7257
7258
  ));
7258
7259
  CardTitle.displayName = "CardTitle";
7259
- CardContent = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7260
+ CardContent = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
7260
7261
  CardContent.displayName = "CardContent";
7261
7262
  CardBody = CardContent;
7262
7263
  CardBody.displayName = "CardBody";
7263
- CardFooter = React95__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7264
+ CardFooter = React93__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
7264
7265
  "div",
7265
7266
  {
7266
7267
  ref,
@@ -7315,7 +7316,7 @@ var init_FilterPill = __esm({
7315
7316
  md: "w-3.5 h-3.5",
7316
7317
  lg: "w-4 h-4"
7317
7318
  };
7318
- FilterPill = React95__default.forwardRef(
7319
+ FilterPill = React93__default.forwardRef(
7319
7320
  ({
7320
7321
  className,
7321
7322
  variant = "default",
@@ -7392,7 +7393,7 @@ var init_Spinner = __esm({
7392
7393
  md: "h-6 w-6",
7393
7394
  lg: "h-8 w-8"
7394
7395
  };
7395
- Spinner = React95__default.forwardRef(
7396
+ Spinner = React93__default.forwardRef(
7396
7397
  ({ className, size = "md", ...props }, ref) => {
7397
7398
  return /* @__PURE__ */ jsx(
7398
7399
  "div",
@@ -7471,13 +7472,12 @@ var init_Avatar = __esm({
7471
7472
  actionPayload
7472
7473
  }) => {
7473
7474
  const eventBus = useEventBus();
7474
- const [imgFailed, setImgFailed] = React95__default.useState(false);
7475
- React95__default.useEffect(() => {
7475
+ const [imgFailed, setImgFailed] = React93__default.useState(false);
7476
+ React93__default.useEffect(() => {
7476
7477
  setImgFailed(false);
7477
7478
  }, [src]);
7478
7479
  const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
7479
7480
  const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
7480
- const hasImage = !!src && !imgFailed;
7481
7481
  const hasIcon = !!IconComponent;
7482
7482
  const hasInitials = !!initials && !(hasIcon && !providedInitials);
7483
7483
  const getInitialsBackground = () => "bg-primary text-primary-foreground";
@@ -7503,15 +7503,13 @@ var init_Avatar = __esm({
7503
7503
  onClick: isClickable ? handleClick : void 0,
7504
7504
  role: isClickable ? "button" : void 0,
7505
7505
  tabIndex: isClickable ? 0 : void 0,
7506
- children: hasImage ? /* @__PURE__ */ jsx(
7506
+ children: src && !imgFailed ? /* @__PURE__ */ jsx(
7507
7507
  "img",
7508
7508
  {
7509
7509
  src,
7510
7510
  alt: alt || "Avatar",
7511
7511
  className: "w-full h-full object-cover",
7512
- onError: () => {
7513
- setImgFailed(true);
7514
- }
7512
+ onError: () => setImgFailed(true)
7515
7513
  }
7516
7514
  ) : hasInitials ? /* @__PURE__ */ jsx(
7517
7515
  "div",
@@ -7692,6 +7690,7 @@ var init_ProgressBar = __esm({
7692
7690
  primary: "bg-primary",
7693
7691
  success: "bg-success",
7694
7692
  warning: "bg-warning",
7693
+ error: "bg-error",
7695
7694
  danger: "bg-error"
7696
7695
  };
7697
7696
  circularSizeClasses = {
@@ -7857,7 +7856,7 @@ var init_Radio = __esm({
7857
7856
  md: "w-2.5 h-2.5",
7858
7857
  lg: "w-3 h-3"
7859
7858
  };
7860
- Radio = React95__default.forwardRef(
7859
+ Radio = React93__default.forwardRef(
7861
7860
  ({
7862
7861
  label,
7863
7862
  helperText,
@@ -7874,12 +7873,12 @@ var init_Radio = __esm({
7874
7873
  onChange,
7875
7874
  ...props
7876
7875
  }, ref) => {
7877
- const reactId = React95__default.useId();
7876
+ const reactId = React93__default.useId();
7878
7877
  const baseId = id || `radio-${reactId}`;
7879
7878
  const hasError = !!error;
7880
7879
  const eventBus = useEventBus();
7881
- const [selected, setSelected] = React95__default.useState(value);
7882
- React95__default.useEffect(() => {
7880
+ const [selected, setSelected] = React93__default.useState(value);
7881
+ React93__default.useEffect(() => {
7883
7882
  if (value !== void 0) setSelected(value);
7884
7883
  }, [value]);
7885
7884
  const pick = (next, e) => {
@@ -8061,7 +8060,7 @@ var init_Switch = __esm({
8061
8060
  "components/core/atoms/Switch.tsx"() {
8062
8061
  "use client";
8063
8062
  init_cn();
8064
- Switch = React95.forwardRef(
8063
+ Switch = React93.forwardRef(
8065
8064
  ({
8066
8065
  checked,
8067
8066
  defaultChecked = false,
@@ -8072,10 +8071,10 @@ var init_Switch = __esm({
8072
8071
  name,
8073
8072
  className
8074
8073
  }, ref) => {
8075
- const [isChecked, setIsChecked] = React95.useState(
8074
+ const [isChecked, setIsChecked] = React93.useState(
8076
8075
  checked !== void 0 ? checked : defaultChecked
8077
8076
  );
8078
- React95.useEffect(() => {
8077
+ React93.useEffect(() => {
8079
8078
  if (checked !== void 0) {
8080
8079
  setIsChecked(checked);
8081
8080
  }
@@ -8520,7 +8519,7 @@ var Aside;
8520
8519
  var init_Aside = __esm({
8521
8520
  "components/core/atoms/Aside.tsx"() {
8522
8521
  init_cn();
8523
- Aside = React95__default.forwardRef(
8522
+ Aside = React93__default.forwardRef(
8524
8523
  ({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
8525
8524
  );
8526
8525
  Aside.displayName = "Aside";
@@ -8598,8 +8597,8 @@ var init_LawReferenceTooltip = __esm({
8598
8597
  className
8599
8598
  }) => {
8600
8599
  const { t } = useTranslate();
8601
- const [isVisible, setIsVisible] = React95__default.useState(false);
8602
- const timeoutRef = React95__default.useRef(null);
8600
+ const [isVisible, setIsVisible] = React93__default.useState(false);
8601
+ const timeoutRef = React93__default.useRef(null);
8603
8602
  const handleMouseEnter = () => {
8604
8603
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8605
8604
  timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
@@ -8608,7 +8607,7 @@ var init_LawReferenceTooltip = __esm({
8608
8607
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8609
8608
  setIsVisible(false);
8610
8609
  };
8611
- React95__default.useEffect(() => {
8610
+ React93__default.useEffect(() => {
8612
8611
  return () => {
8613
8612
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
8614
8613
  };
@@ -8818,7 +8817,7 @@ var init_StatusDot = __esm({
8818
8817
  md: "w-2.5 h-2.5",
8819
8818
  lg: "w-3 h-3"
8820
8819
  };
8821
- StatusDot = React95__default.forwardRef(
8820
+ StatusDot = React93__default.forwardRef(
8822
8821
  ({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
8823
8822
  return /* @__PURE__ */ jsx(
8824
8823
  "span",
@@ -8872,7 +8871,7 @@ var init_TrendIndicator = __esm({
8872
8871
  down: "trending-down",
8873
8872
  flat: "arrow-right"
8874
8873
  };
8875
- TrendIndicator = React95__default.forwardRef(
8874
+ TrendIndicator = React93__default.forwardRef(
8876
8875
  ({
8877
8876
  className,
8878
8877
  value,
@@ -8939,7 +8938,7 @@ var init_RangeSlider = __esm({
8939
8938
  md: "w-4 h-4",
8940
8939
  lg: "w-5 h-5"
8941
8940
  };
8942
- RangeSlider = React95__default.forwardRef(
8941
+ RangeSlider = React93__default.forwardRef(
8943
8942
  ({
8944
8943
  className,
8945
8944
  min = 0,
@@ -9447,7 +9446,7 @@ var init_ContentSection = __esm({
9447
9446
  md: "py-16",
9448
9447
  lg: "py-24"
9449
9448
  };
9450
- ContentSection = React95__default.forwardRef(
9449
+ ContentSection = React93__default.forwardRef(
9451
9450
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
9452
9451
  return /* @__PURE__ */ jsx(
9453
9452
  Box,
@@ -9981,7 +9980,7 @@ var init_AnimatedReveal = __esm({
9981
9980
  "scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
9982
9981
  "none": {}
9983
9982
  };
9984
- AnimatedReveal = React95__default.forwardRef(
9983
+ AnimatedReveal = React93__default.forwardRef(
9985
9984
  ({
9986
9985
  trigger = "scroll",
9987
9986
  animation = "fade-up",
@@ -10141,7 +10140,7 @@ var init_AnimatedGraphic = __esm({
10141
10140
  "components/marketing/atoms/AnimatedGraphic.tsx"() {
10142
10141
  "use client";
10143
10142
  init_cn();
10144
- AnimatedGraphic = React95__default.forwardRef(
10143
+ AnimatedGraphic = React93__default.forwardRef(
10145
10144
  ({
10146
10145
  src,
10147
10146
  svgContent,
@@ -10164,7 +10163,7 @@ var init_AnimatedGraphic = __esm({
10164
10163
  const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
10165
10164
  const resolvedSvg = svgContent ?? fetchedSvg;
10166
10165
  const prevAnimateRef = useRef(animate);
10167
- const setRef = React95__default.useCallback(
10166
+ const setRef = React93__default.useCallback(
10168
10167
  (node) => {
10169
10168
  containerRef.current = node;
10170
10169
  if (typeof ref === "function") ref(node);
@@ -10389,9 +10388,9 @@ function ScoreDisplay({
10389
10388
  ...rest
10390
10389
  }) {
10391
10390
  const resolvedValue = typeof value === "number" && !Number.isNaN(value) ? value : typeof rest.score === "number" && !Number.isNaN(rest.score) ? rest.score : 0;
10392
- const [displayValue, setDisplayValue] = React95.useState(resolvedValue);
10393
- const [isAnimating, setIsAnimating] = React95.useState(false);
10394
- React95.useEffect(() => {
10391
+ const [displayValue, setDisplayValue] = React93.useState(resolvedValue);
10392
+ const [isAnimating, setIsAnimating] = React93.useState(false);
10393
+ React93.useEffect(() => {
10395
10394
  if (!animated || displayValue === resolvedValue) {
10396
10395
  setDisplayValue(resolvedValue);
10397
10396
  return;
@@ -10461,9 +10460,9 @@ function ControlButton({
10461
10460
  className
10462
10461
  }) {
10463
10462
  const eventBus = useEventBus();
10464
- const [isPressed, setIsPressed] = React95.useState(false);
10463
+ const [isPressed, setIsPressed] = React93.useState(false);
10465
10464
  const actualPressed = pressed ?? isPressed;
10466
- const handlePointerDown = React95.useCallback(
10465
+ const handlePointerDown = React93.useCallback(
10467
10466
  (e) => {
10468
10467
  e.preventDefault();
10469
10468
  if (disabled) return;
@@ -10473,7 +10472,7 @@ function ControlButton({
10473
10472
  },
10474
10473
  [disabled, pressEvent, eventBus, onPress]
10475
10474
  );
10476
- const handlePointerUp = React95.useCallback(
10475
+ const handlePointerUp = React93.useCallback(
10477
10476
  (e) => {
10478
10477
  e.preventDefault();
10479
10478
  if (disabled) return;
@@ -10483,7 +10482,7 @@ function ControlButton({
10483
10482
  },
10484
10483
  [disabled, releaseEvent, eventBus, onRelease]
10485
10484
  );
10486
- const handlePointerLeave = React95.useCallback(
10485
+ const handlePointerLeave = React93.useCallback(
10487
10486
  (e) => {
10488
10487
  if (isPressed) {
10489
10488
  setIsPressed(false);
@@ -10754,7 +10753,7 @@ function ResourceCounter({
10754
10753
  children: [
10755
10754
  icon && /* @__PURE__ */ jsx("span", { className: cn("flex-shrink-0", sizes.icon), children: icon }),
10756
10755
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: label }),
10757
- /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color), children: [
10756
+ /* @__PURE__ */ jsxs("span", { className: cn("font-bold tabular-nums", color && (color in colorTokenClasses2 ? colorTokenClasses2[color] : color)), children: [
10758
10757
  value,
10759
10758
  max != null && /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
10760
10759
  "/",
@@ -10765,10 +10764,18 @@ function ResourceCounter({
10765
10764
  }
10766
10765
  );
10767
10766
  }
10768
- var sizeMap5;
10767
+ var colorTokenClasses2, sizeMap5;
10769
10768
  var init_ResourceCounter = __esm({
10770
10769
  "components/game/atoms/ResourceCounter.tsx"() {
10771
10770
  init_cn();
10771
+ colorTokenClasses2 = {
10772
+ primary: "text-primary",
10773
+ secondary: "text-secondary",
10774
+ success: "text-success",
10775
+ warning: "text-warning",
10776
+ error: "text-error",
10777
+ muted: "text-muted-foreground"
10778
+ };
10772
10779
  sizeMap5 = {
10773
10780
  sm: { wrapper: "text-xs gap-1 px-1.5 py-0.5", icon: "text-sm" },
10774
10781
  md: { wrapper: "text-sm gap-1.5 px-2 py-1", icon: "text-base" },
@@ -10972,14 +10979,20 @@ function XPBar({
10972
10979
  }) {
10973
10980
  const sizes = sizeMap9[size];
10974
10981
  const percentage = max > 0 ? Math.max(0, Math.min(100, current / max * 100)) : 0;
10975
- const [fillWidth, setFillWidth] = React95.useState(animated ? 0 : percentage);
10976
- React95.useEffect(() => {
10982
+ const [fillWidth, setFillWidth] = React93.useState(animated ? 0 : percentage);
10983
+ React93.useEffect(() => {
10977
10984
  if (!animated) {
10978
10985
  setFillWidth(percentage);
10979
10986
  return;
10980
10987
  }
10981
- const frame = requestAnimationFrame(() => setFillWidth(percentage));
10982
- return () => cancelAnimationFrame(frame);
10988
+ let frame2;
10989
+ const frame1 = requestAnimationFrame(() => {
10990
+ frame2 = requestAnimationFrame(() => setFillWidth(percentage));
10991
+ });
10992
+ return () => {
10993
+ cancelAnimationFrame(frame1);
10994
+ cancelAnimationFrame(frame2);
10995
+ };
10983
10996
  }, [animated, percentage]);
10984
10997
  return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-2", className), children: [
10985
10998
  level != null && /* @__PURE__ */ jsxs(
@@ -11017,7 +11030,7 @@ function XPBar({
11017
11030
  )
11018
11031
  }
11019
11032
  ),
11020
- showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-muted-foreground tabular-nums", sizes.text), children: [
11033
+ showLabel && /* @__PURE__ */ jsxs("span", { className: cn("text-foreground/70 tabular-nums", sizes.text), children: [
11021
11034
  current,
11022
11035
  " / ",
11023
11036
  max,
@@ -11135,7 +11148,7 @@ function StatusEffect({
11135
11148
  ),
11136
11149
  title: label,
11137
11150
  children: [
11138
- /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: icon }),
11151
+ /* @__PURE__ */ jsx("span", { className: cn("flex items-center justify-center", sizes.icon), children: /* @__PURE__ */ jsx(Icon, { name: icon, size: "sm" }) }),
11139
11152
  duration !== void 0 && /* @__PURE__ */ jsx(
11140
11153
  "span",
11141
11154
  {
@@ -11166,6 +11179,7 @@ var sizeMap11, variantStyles7;
11166
11179
  var init_StatusEffect = __esm({
11167
11180
  "components/game/atoms/StatusEffect.tsx"() {
11168
11181
  init_cn();
11182
+ init_Icon();
11169
11183
  sizeMap11 = {
11170
11184
  sm: { container: "w-8 h-8", icon: "text-sm", badge: "text-xs -top-1 -right-1 w-4 h-4", timer: "text-[9px]" },
11171
11185
  md: { container: "w-10 h-10", icon: "text-base", badge: "text-xs -top-1 -right-1 w-5 h-5", timer: "text-xs" },
@@ -11399,9 +11413,9 @@ function MiniMap({
11399
11413
  viewportRect,
11400
11414
  className
11401
11415
  }) {
11402
- const canvasRef = React95.useRef(null);
11403
- const frameRef = React95.useRef(0);
11404
- React95.useEffect(() => {
11416
+ const canvasRef = React93.useRef(null);
11417
+ const frameRef = React93.useRef(0);
11418
+ React93.useEffect(() => {
11405
11419
  const canvas = canvasRef.current;
11406
11420
  if (!canvas) return;
11407
11421
  const ctx = canvas.getContext("2d");
@@ -11575,7 +11589,7 @@ var init_ErrorBoundary = __esm({
11575
11589
  }
11576
11590
  );
11577
11591
  };
11578
- ErrorBoundary = class extends React95__default.Component {
11592
+ ErrorBoundary = class extends React93__default.Component {
11579
11593
  constructor(props) {
11580
11594
  super(props);
11581
11595
  __publicField(this, "reset", () => {
@@ -12654,7 +12668,7 @@ var init_Tooltip = __esm({
12654
12668
  setIsVisible(false);
12655
12669
  }, hideDelay);
12656
12670
  };
12657
- useEffect(() => {
12671
+ useLayoutEffect(() => {
12658
12672
  if (isVisible) {
12659
12673
  updatePosition();
12660
12674
  }
@@ -12665,8 +12679,8 @@ var init_Tooltip = __esm({
12665
12679
  if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
12666
12680
  };
12667
12681
  }, []);
12668
- const triggerElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12669
- const trigger = React95__default.cloneElement(triggerElement, {
12682
+ const triggerElement = React93__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12683
+ const trigger = React93__default.cloneElement(triggerElement, {
12670
12684
  ref: triggerRef,
12671
12685
  onMouseEnter: handleMouseEnter,
12672
12686
  onMouseLeave: handleMouseLeave,
@@ -12813,8 +12827,8 @@ var init_Popover = __esm({
12813
12827
  onMouseEnter: handleOpen,
12814
12828
  onMouseLeave: handleClose
12815
12829
  };
12816
- const childElement = React95__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12817
- const triggerElement = React95__default.cloneElement(
12830
+ const childElement = React93__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
12831
+ const triggerElement = React93__default.cloneElement(
12818
12832
  childElement,
12819
12833
  {
12820
12834
  ref: triggerRef,
@@ -12830,7 +12844,10 @@ var init_Popover = __esm({
12830
12844
  "bg-card border-2 border-border shadow-elevation-popover",
12831
12845
  className
12832
12846
  ),
12833
- style: computePopoverStyle(position, triggerRect, popoverWidth),
12847
+ style: {
12848
+ ...computePopoverStyle(position, triggerRect, popoverWidth),
12849
+ ...popoverWidth === 0 ? { visibility: "hidden" } : void 0
12850
+ },
12834
12851
  role: "dialog",
12835
12852
  onMouseEnter: trigger === "hover" ? handleOpen : void 0,
12836
12853
  onMouseLeave: trigger === "hover" ? handleClose : void 0,
@@ -12940,8 +12957,8 @@ var init_Menu = __esm({
12940
12957
  };
12941
12958
  const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
12942
12959
  const subMenuSideClass = direction === "rtl" ? "right-full mr-2" : "left-full ml-2";
12943
- const triggerChild = React95__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
12944
- const triggerElement = React95__default.cloneElement(
12960
+ const triggerChild = React93__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
12961
+ const triggerElement = React93__default.cloneElement(
12945
12962
  triggerChild,
12946
12963
  {
12947
12964
  ref: triggerRef,
@@ -13348,7 +13365,7 @@ var init_MapView = __esm({
13348
13365
  shadowSize: [41, 41]
13349
13366
  });
13350
13367
  L.Marker.prototype.options.icon = defaultIcon;
13351
- const { useEffect: useEffect76, useRef: useRef68, useCallback: useCallback120, useState: useState112 } = React95__default;
13368
+ const { useEffect: useEffect76, useRef: useRef68, useCallback: useCallback118, useState: useState110 } = React93__default;
13352
13369
  const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
13353
13370
  const { useEventBus: useEventBus3 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
13354
13371
  function MapUpdater({ centerLat, centerLng, zoom }) {
@@ -13393,8 +13410,8 @@ var init_MapView = __esm({
13393
13410
  showAttribution = true
13394
13411
  }) {
13395
13412
  const eventBus = useEventBus3();
13396
- const [clickedPosition, setClickedPosition] = useState112(null);
13397
- const handleMapClick = useCallback120((lat, lng) => {
13413
+ const [clickedPosition, setClickedPosition] = useState110(null);
13414
+ const handleMapClick = useCallback118((lat, lng) => {
13398
13415
  if (showClickedPin) {
13399
13416
  setClickedPosition({ lat, lng });
13400
13417
  }
@@ -13403,7 +13420,7 @@ var init_MapView = __esm({
13403
13420
  eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
13404
13421
  }
13405
13422
  }, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
13406
- const handleMarkerClick = useCallback120((marker) => {
13423
+ const handleMarkerClick = useCallback118((marker) => {
13407
13424
  onMarkerClick?.(marker);
13408
13425
  if (markerClickEvent) {
13409
13426
  eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
@@ -13412,7 +13429,7 @@ var init_MapView = __esm({
13412
13429
  return /* @__PURE__ */ jsx(
13413
13430
  Box,
13414
13431
  {
13415
- className: cn("relative isolate w-full overflow-hidden rounded-lg", className),
13432
+ className: cn("relative isolate z-0 w-full overflow-hidden rounded-lg", className),
13416
13433
  style: { height },
13417
13434
  "data-testid": "map-view",
13418
13435
  children: /* @__PURE__ */ jsxs(
@@ -13594,7 +13611,7 @@ function InputPattern({
13594
13611
  fieldName
13595
13612
  }) {
13596
13613
  const { emit } = useEventBus();
13597
- const [localValue, setLocalValue] = React95__default.useState(value);
13614
+ const [localValue, setLocalValue] = React93__default.useState(value);
13598
13615
  const handleChange = (e) => {
13599
13616
  setLocalValue(e.target.value);
13600
13617
  if (onChange) {
@@ -13632,7 +13649,7 @@ function TextareaPattern({
13632
13649
  fieldName
13633
13650
  }) {
13634
13651
  const { emit } = useEventBus();
13635
- const [localValue, setLocalValue] = React95__default.useState(value);
13652
+ const [localValue, setLocalValue] = React93__default.useState(value);
13636
13653
  const handleChange = (e) => {
13637
13654
  setLocalValue(e.target.value);
13638
13655
  if (onChange) {
@@ -13664,7 +13681,7 @@ function SelectPattern({
13664
13681
  fieldName
13665
13682
  }) {
13666
13683
  const { emit } = useEventBus();
13667
- const [localValue, setLocalValue] = React95__default.useState(value);
13684
+ const [localValue, setLocalValue] = React93__default.useState(value);
13668
13685
  const handleChange = (e) => {
13669
13686
  setLocalValue(e.target.value);
13670
13687
  if (onChange) {
@@ -13693,7 +13710,7 @@ function CheckboxPattern({
13693
13710
  className
13694
13711
  }) {
13695
13712
  const { emit } = useEventBus();
13696
- const [localChecked, setLocalChecked] = React95__default.useState(checked);
13713
+ const [localChecked, setLocalChecked] = React93__default.useState(checked);
13697
13714
  const handleChange = (e) => {
13698
13715
  setLocalChecked(e.target.checked);
13699
13716
  if (onChange) {
@@ -13925,8 +13942,8 @@ function ActionButtons({
13925
13942
  disabled
13926
13943
  }) {
13927
13944
  const eventBus = useEventBus();
13928
- const [activeButtons, setActiveButtons] = React95.useState(/* @__PURE__ */ new Set());
13929
- const handlePress = React95.useCallback(
13945
+ const [activeButtons, setActiveButtons] = React93.useState(/* @__PURE__ */ new Set());
13946
+ const handlePress = React93.useCallback(
13930
13947
  (id) => {
13931
13948
  setActiveButtons((prev) => new Set(prev).add(id));
13932
13949
  if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
@@ -13934,7 +13951,7 @@ function ActionButtons({
13934
13951
  },
13935
13952
  [actionEvent, eventBus, onAction]
13936
13953
  );
13937
- const handleRelease = React95.useCallback(
13954
+ const handleRelease = React93.useCallback(
13938
13955
  (id) => {
13939
13956
  setActiveButtons((prev) => {
13940
13957
  const next = new Set(prev);
@@ -16098,6 +16115,263 @@ var init_katex_min = __esm({
16098
16115
  "node_modules/katex/dist/katex.min.css"() {
16099
16116
  }
16100
16117
  });
16118
+ var Tabs;
16119
+ var init_Tabs = __esm({
16120
+ "components/core/molecules/Tabs.tsx"() {
16121
+ "use client";
16122
+ init_Icon();
16123
+ init_Badge();
16124
+ init_Typography();
16125
+ init_Box();
16126
+ init_cn();
16127
+ init_useEventBus();
16128
+ Tabs = ({
16129
+ items,
16130
+ tabs,
16131
+ defaultActiveTab,
16132
+ activeTab: controlledActiveTab,
16133
+ onTabChange,
16134
+ tabChangeEvent,
16135
+ variant = "default",
16136
+ orientation = "horizontal",
16137
+ className
16138
+ }) => {
16139
+ const rawItems = items ?? tabs ?? [];
16140
+ const safeItems = rawItems.map(({ id, value, ...rest }) => ({
16141
+ ...rest,
16142
+ id: id || value || ""
16143
+ }));
16144
+ const eventBus = useEventBus();
16145
+ const { t } = useTranslate();
16146
+ const initialActive = safeItems.find((item) => item.active)?.id;
16147
+ const [internalActiveTab, setInternalActiveTab] = useState(
16148
+ defaultActiveTab || initialActive || safeItems[0]?.id || ""
16149
+ );
16150
+ const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
16151
+ const tabRefs = useRef({});
16152
+ const handleTabChange = (tabId, tabEvent) => {
16153
+ if (controlledActiveTab === void 0) {
16154
+ setInternalActiveTab(tabId);
16155
+ }
16156
+ onTabChange?.(tabId);
16157
+ if (tabChangeEvent) {
16158
+ eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
16159
+ }
16160
+ if (tabEvent) {
16161
+ eventBus.emit(`UI:${tabEvent}`, { tabId });
16162
+ }
16163
+ };
16164
+ const handleKeyDown = (e, index) => {
16165
+ if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
16166
+ e.preventDefault();
16167
+ const direction = e.key === "ArrowLeft" ? -1 : 1;
16168
+ const nextIndex = (index + direction + safeItems.length) % safeItems.length;
16169
+ const nextTab = safeItems[nextIndex];
16170
+ if (nextTab && !nextTab.disabled) {
16171
+ handleTabChange(nextTab.id);
16172
+ tabRefs.current[nextTab.id]?.focus();
16173
+ }
16174
+ } else if (e.key === "Home" || e.key === "End") {
16175
+ e.preventDefault();
16176
+ const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
16177
+ const targetTab = safeItems[targetIndex];
16178
+ if (targetTab && !targetTab.disabled) {
16179
+ handleTabChange(targetTab.id);
16180
+ tabRefs.current[targetTab.id]?.focus();
16181
+ }
16182
+ }
16183
+ };
16184
+ const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
16185
+ if (safeItems.length === 0) {
16186
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
16187
+ }
16188
+ const variantClasses2 = {
16189
+ default: [
16190
+ "border-b-[length:var(--border-width)] border-transparent",
16191
+ "hover:border-muted-foreground",
16192
+ "data-[active=true]:border-primary"
16193
+ ].join(" "),
16194
+ pills: [
16195
+ "rounded-sm",
16196
+ "data-[active=true]:bg-primary",
16197
+ "data-[active=true]:text-primary-foreground"
16198
+ ].join(" "),
16199
+ underline: [
16200
+ "border-b-[length:var(--border-width)] border-transparent",
16201
+ "data-[active=true]:border-primary"
16202
+ ].join(" ")
16203
+ };
16204
+ return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
16205
+ /* @__PURE__ */ jsx(
16206
+ Box,
16207
+ {
16208
+ role: "tablist",
16209
+ className: cn(
16210
+ "flex",
16211
+ // Horizontal tab strip becomes a horizontally-scrollable lane
16212
+ // below its container width — phones with many tabs scroll
16213
+ // instead of clipping. `snap-x` snaps to each tab; the
16214
+ // scrollbar is hidden for a cleaner affordance (the swipe
16215
+ // gesture is the discoverability cue).
16216
+ orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
16217
+ variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
16218
+ variant === "underline" && orientation === "vertical" && "border-b-0"
16219
+ ),
16220
+ children: safeItems.map((item, index) => {
16221
+ const isActive = item.id === activeTab;
16222
+ const isDisabled = item.disabled;
16223
+ return /* @__PURE__ */ jsxs(
16224
+ Box,
16225
+ {
16226
+ as: "button",
16227
+ ref: (el) => {
16228
+ tabRefs.current[item.id] = el;
16229
+ },
16230
+ role: "tab",
16231
+ "aria-selected": isActive,
16232
+ "aria-controls": `tabpanel-${item.id}`,
16233
+ "aria-disabled": isDisabled,
16234
+ onClick: () => !isDisabled && handleTabChange(item.id, item.event),
16235
+ onKeyDown: (e) => handleKeyDown(e, index),
16236
+ "data-active": isActive,
16237
+ className: cn(
16238
+ "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
16239
+ orientation === "horizontal" && "snap-start shrink-0",
16240
+ "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
16241
+ isDisabled && "opacity-50 cursor-not-allowed",
16242
+ variantClasses2[variant],
16243
+ isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
16244
+ ),
16245
+ children: [
16246
+ item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
16247
+ /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
16248
+ item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
16249
+ ]
16250
+ },
16251
+ item.id
16252
+ );
16253
+ })
16254
+ }
16255
+ ),
16256
+ activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
16257
+ Box,
16258
+ {
16259
+ role: "tabpanel",
16260
+ id: `tabpanel-${activeTab}`,
16261
+ "aria-labelledby": `tab-${activeTab}`,
16262
+ className: "mt-4",
16263
+ children: activeTabContent
16264
+ }
16265
+ )
16266
+ ] });
16267
+ };
16268
+ Tabs.displayName = "Tabs";
16269
+ }
16270
+ });
16271
+ var ICON_NAME_ALIASES, lookStyles3, EmptyState;
16272
+ var init_EmptyState = __esm({
16273
+ "components/core/molecules/EmptyState.tsx"() {
16274
+ "use client";
16275
+ init_cn();
16276
+ init_atoms2();
16277
+ init_Box();
16278
+ init_Icon();
16279
+ init_Stack();
16280
+ init_Typography();
16281
+ init_useEventBus();
16282
+ ICON_NAME_ALIASES = {
16283
+ check: "check-circle",
16284
+ error: "x-circle",
16285
+ warning: "alert-circle"
16286
+ };
16287
+ lookStyles3 = {
16288
+ "icon-only": "",
16289
+ illustrated: "[&_svg]:w-32 [&_svg]:h-32",
16290
+ "text-only": "[&_svg]:hidden",
16291
+ mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
16292
+ };
16293
+ EmptyState = ({
16294
+ icon,
16295
+ title,
16296
+ message,
16297
+ description,
16298
+ actionLabel,
16299
+ onAction,
16300
+ className,
16301
+ destructive,
16302
+ variant,
16303
+ actionEvent,
16304
+ look = "icon-only"
16305
+ }) => {
16306
+ const eventBus = useEventBus();
16307
+ const { t } = useTranslate();
16308
+ const handleAction = () => {
16309
+ if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
16310
+ onAction?.();
16311
+ };
16312
+ const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
16313
+ const iconComponent = typeof icon === "function" ? icon : void 0;
16314
+ const hasIcon = Boolean(iconName || iconComponent);
16315
+ const isDestructive = destructive || variant === "error";
16316
+ const isSuccess = variant === "success";
16317
+ const displayText = title || message || t("empty.noItems");
16318
+ return /* @__PURE__ */ jsxs(
16319
+ VStack,
16320
+ {
16321
+ align: "center",
16322
+ className: cn(
16323
+ "justify-center py-12 text-center",
16324
+ lookStyles3[look],
16325
+ className
16326
+ ),
16327
+ children: [
16328
+ hasIcon && /* @__PURE__ */ jsx(
16329
+ Box,
16330
+ {
16331
+ className: cn(
16332
+ "mb-4 rounded-full p-3",
16333
+ isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
16334
+ ),
16335
+ children: /* @__PURE__ */ jsx(
16336
+ Icon,
16337
+ {
16338
+ ...iconName ? { name: iconName } : { icon: iconComponent },
16339
+ className: cn(
16340
+ "h-8 w-8",
16341
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
16342
+ )
16343
+ }
16344
+ )
16345
+ }
16346
+ ),
16347
+ /* @__PURE__ */ jsx(
16348
+ Typography,
16349
+ {
16350
+ variant: "h3",
16351
+ className: cn(
16352
+ "text-lg font-medium",
16353
+ isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
16354
+ ),
16355
+ children: displayText
16356
+ }
16357
+ ),
16358
+ description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
16359
+ actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
16360
+ Button,
16361
+ {
16362
+ className: "mt-4",
16363
+ variant: isDestructive ? "danger" : "primary",
16364
+ onClick: handleAction,
16365
+ children: actionLabel
16366
+ }
16367
+ )
16368
+ ]
16369
+ }
16370
+ );
16371
+ };
16372
+ EmptyState.displayName = "EmptyState";
16373
+ }
16374
+ });
16101
16375
  function computeFoldRegions(code) {
16102
16376
  const lines = code.split("\n");
16103
16377
  const regions = [];
@@ -16135,9 +16409,32 @@ function computeFoldRegions(code) {
16135
16409
  function toCodeLanguage(value) {
16136
16410
  return value && CODE_LANGUAGE_SET.has(value) ? value : "text";
16137
16411
  }
16138
- var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log6, CODE_LANGUAGES, CODE_LANGUAGE_SET, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16412
+ function generateDiff(oldVal, newVal) {
16413
+ const oldLines = oldVal.split("\n");
16414
+ const newLines = newVal.split("\n");
16415
+ const diff = [];
16416
+ const maxLen = Math.max(oldLines.length, newLines.length);
16417
+ for (let i = 0; i < maxLen; i++) {
16418
+ const oldLine = oldLines[i];
16419
+ const newLine = newLines[i];
16420
+ if (oldLine === newLine) {
16421
+ diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
16422
+ } else {
16423
+ if (oldLine !== void 0) diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
16424
+ if (newLine !== void 0) diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
16425
+ }
16426
+ }
16427
+ return diff;
16428
+ }
16429
+ var orbStyleOverrides, orbStyle, loloStyleOverrides, loloStyle, log6, CODE_LANGUAGES, CODE_LANGUAGE_SET, DIFF_STYLES, LINE_PROPS_FN, HIDDEN_LINE_NUMBERS, CodeBlock;
16139
16430
  var init_CodeBlock = __esm({
16140
16431
  "components/core/molecules/markdown/CodeBlock.tsx"() {
16432
+ init_cn();
16433
+ init_atoms2();
16434
+ init_Tabs();
16435
+ init_LoadingState();
16436
+ init_ErrorState();
16437
+ init_EmptyState();
16141
16438
  init_Box();
16142
16439
  init_Button();
16143
16440
  init_Badge();
@@ -16244,9 +16541,14 @@ var init_CodeBlock = __esm({
16244
16541
  "lolo"
16245
16542
  ];
16246
16543
  CODE_LANGUAGE_SET = new Set(CODE_LANGUAGES);
16544
+ DIFF_STYLES = {
16545
+ add: { bg: "bg-success/10", prefix: "+", text: "text-success" },
16546
+ remove: { bg: "bg-error/10", prefix: "-", text: "text-error" },
16547
+ context: { bg: "", prefix: " ", text: "text-foreground" }
16548
+ };
16247
16549
  LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
16248
16550
  HIDDEN_LINE_NUMBERS = { display: "none" };
16249
- CodeBlock = React95__default.memo(
16551
+ CodeBlock = React93__default.memo(
16250
16552
  ({
16251
16553
  code: rawCode,
16252
16554
  language = "text",
@@ -16257,7 +16559,20 @@ var init_CodeBlock = __esm({
16257
16559
  className,
16258
16560
  editable = false,
16259
16561
  onChange,
16260
- errorLines
16562
+ errorLines,
16563
+ // viewer props
16564
+ title,
16565
+ mode = "code",
16566
+ diff: propDiff,
16567
+ oldValue,
16568
+ newValue,
16569
+ showLineNumbers = false,
16570
+ wordWrap = false,
16571
+ files,
16572
+ actions,
16573
+ isLoading = false,
16574
+ error,
16575
+ showCopy
16261
16576
  }) => {
16262
16577
  const code = typeof rawCode === "string" ? rawCode : String(rawCode ?? "");
16263
16578
  const isOrb = language === "orb";
@@ -16269,6 +16584,20 @@ var init_CodeBlock = __esm({
16269
16584
  const codeRef = useRef(null);
16270
16585
  const savedScrollLeftRef = useRef(0);
16271
16586
  const [copied, setCopied] = useState(false);
16587
+ const [wrap, setWrap] = useState(wordWrap);
16588
+ const [activeFileIndex, setActiveFileIndex] = useState(0);
16589
+ const activeFile = files?.[activeFileIndex];
16590
+ const activeCode = activeFile?.code ?? code;
16591
+ const activeLanguage = activeFile?.language ?? language;
16592
+ const diffLines = useMemo(() => {
16593
+ if (propDiff) return propDiff;
16594
+ if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
16595
+ return generateDiff(oldValue, newValue);
16596
+ }
16597
+ return null;
16598
+ }, [propDiff, mode, oldValue, newValue]);
16599
+ const isViewerMode = !!(title || files || showLineNumbers || diffLines || mode === "diff" || actions);
16600
+ const effectiveCopy = showCopy ?? showCopyButton;
16272
16601
  const [editableValue, setEditableValue] = useState(code);
16273
16602
  const [editableTextareaKey, setEditableTextareaKey] = useState(0);
16274
16603
  const lastPropCodeRef = useRef(code);
@@ -16439,13 +16768,13 @@ var init_CodeBlock = __esm({
16439
16768
  }, [language, code]);
16440
16769
  const handleCopy = async () => {
16441
16770
  try {
16442
- await navigator.clipboard.writeText(code);
16771
+ await navigator.clipboard.writeText(activeCode);
16443
16772
  setCopied(true);
16444
- eventBus.emit("UI:COPY_CODE", { language, success: true });
16773
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: true });
16445
16774
  setTimeout(() => setCopied(false), 2e3);
16446
16775
  } catch (err) {
16447
16776
  log6.error("Failed to copy code", { error: err instanceof Error ? err : String(err) });
16448
- eventBus.emit("UI:COPY_CODE", { language, success: false });
16777
+ eventBus.emit("UI:COPY_CODE", { language: activeLanguage, success: false });
16449
16778
  }
16450
16779
  };
16451
16780
  const handleSelectionCopy = useCallback((e) => {
@@ -16498,11 +16827,134 @@ var init_CodeBlock = __esm({
16498
16827
  }
16499
16828
  });
16500
16829
  }
16501
- const full = code.split("\n").slice(a, endLine + 1).join("\n");
16830
+ const full = activeCode.split("\n").slice(a, endLine + 1).join("\n");
16502
16831
  e.clipboardData.setData("text/plain", full);
16503
16832
  e.preventDefault();
16504
16833
  }, [code]);
16505
- const hasHeader = showLanguageBadge || showCopyButton;
16834
+ if (isLoading) {
16835
+ return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
16836
+ }
16837
+ if (error) {
16838
+ return /* @__PURE__ */ jsx(ErrorState, { title: t("display.codeViewerError"), message: error.message, className });
16839
+ }
16840
+ if (isViewerMode && !activeCode && !diffLines) {
16841
+ return /* @__PURE__ */ jsx(EmptyState, { icon: Code, title: t("display.noCode"), description: "No code to display.", className });
16842
+ }
16843
+ if (isViewerMode) {
16844
+ const tabItems = files?.map((file, idx) => ({
16845
+ id: `file-${idx}`,
16846
+ label: file.label,
16847
+ content: null
16848
+ }));
16849
+ const lines = activeCode.split("\n");
16850
+ return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
16851
+ tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
16852
+ Tabs,
16853
+ {
16854
+ tabs: tabItems,
16855
+ activeTab: `file-${activeFileIndex}`,
16856
+ onTabChange: (id) => {
16857
+ const idx = parseInt(id.replace("file-", ""), 10);
16858
+ setActiveFileIndex(idx);
16859
+ }
16860
+ }
16861
+ ) }),
16862
+ /* @__PURE__ */ jsxs(
16863
+ HStack,
16864
+ {
16865
+ gap: "sm",
16866
+ align: "center",
16867
+ justify: "between",
16868
+ className: "px-4 py-2 border-b border-border bg-muted/30",
16869
+ children: [
16870
+ /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
16871
+ /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
16872
+ title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
16873
+ activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
16874
+ ] }),
16875
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
16876
+ /* @__PURE__ */ jsx(
16877
+ Button,
16878
+ {
16879
+ variant: "ghost",
16880
+ size: "sm",
16881
+ icon: WrapText,
16882
+ onClick: () => setWrap(!wrap),
16883
+ className: cn(wrap && "text-primary")
16884
+ }
16885
+ ),
16886
+ effectiveCopy && /* @__PURE__ */ jsx(
16887
+ Button,
16888
+ {
16889
+ variant: "ghost",
16890
+ size: "sm",
16891
+ icon: copied ? Check : Copy,
16892
+ onClick: handleCopy,
16893
+ className: cn(copied && "text-success")
16894
+ }
16895
+ ),
16896
+ actions?.map((action, idx) => /* @__PURE__ */ jsx(
16897
+ Badge,
16898
+ {
16899
+ variant: "default",
16900
+ className: "cursor-pointer hover:opacity-80 transition-opacity",
16901
+ onClick: () => {
16902
+ if (action.event) eventBus.emit(`UI:${action.event}`, {});
16903
+ },
16904
+ children: action.label
16905
+ },
16906
+ idx
16907
+ ))
16908
+ ] })
16909
+ ]
16910
+ }
16911
+ ),
16912
+ /* @__PURE__ */ jsx(Box, { className: "overflow-auto bg-muted/20", style: { maxHeight }, children: diffLines ? /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: diffLines.map((line, idx) => {
16913
+ const style = DIFF_STYLES[line.type];
16914
+ return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
16915
+ showLineNumbers && /* @__PURE__ */ jsx(
16916
+ Typography,
16917
+ {
16918
+ variant: "caption",
16919
+ color: "secondary",
16920
+ className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
16921
+ children: line.lineNumber ?? ""
16922
+ }
16923
+ ),
16924
+ /* @__PURE__ */ jsxs(
16925
+ Typography,
16926
+ {
16927
+ variant: "caption",
16928
+ className: cn("font-mono flex-1 min-w-0", style.text, wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
16929
+ children: [
16930
+ /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
16931
+ line.content
16932
+ ]
16933
+ }
16934
+ )
16935
+ ] }, idx);
16936
+ }) }) : /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
16937
+ showLineNumbers && /* @__PURE__ */ jsx(
16938
+ Typography,
16939
+ {
16940
+ variant: "caption",
16941
+ color: "secondary",
16942
+ className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
16943
+ children: idx + 1
16944
+ }
16945
+ ),
16946
+ /* @__PURE__ */ jsx(
16947
+ Typography,
16948
+ {
16949
+ variant: "caption",
16950
+ className: cn("font-mono flex-1 min-w-0", wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"),
16951
+ children: line || " "
16952
+ }
16953
+ )
16954
+ ] }, idx)) }) })
16955
+ ] }) });
16956
+ }
16957
+ const hasHeader = showLanguageBadge || effectiveCopy;
16506
16958
  return /* @__PURE__ */ jsxs(Box, { className: `relative group ${className || ""}`, style: { display: "flex", flexDirection: "column", height: "100%" }, children: [
16507
16959
  hasHeader && /* @__PURE__ */ jsxs(
16508
16960
  HStack,
@@ -16512,7 +16964,7 @@ var init_CodeBlock = __esm({
16512
16964
  className: "px-3 py-2 bg-[var(--color-card)] rounded-t-lg border-b border-gray-700",
16513
16965
  children: [
16514
16966
  showLanguageBadge && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: language }),
16515
- showCopyButton && /* @__PURE__ */ jsx(
16967
+ effectiveCopy && /* @__PURE__ */ jsx(
16516
16968
  Button,
16517
16969
  {
16518
16970
  variant: "ghost",
@@ -16671,7 +17123,7 @@ var init_CodeBlock = __esm({
16671
17123
  )
16672
17124
  ] });
16673
17125
  },
16674
- (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines
17126
+ (prev, next) => prev.language === next.language && prev.code === next.code && prev.showCopyButton === next.showCopyButton && prev.showCopy === next.showCopy && prev.maxHeight === next.maxHeight && prev.foldable === next.foldable && prev.editable === next.editable && prev.onChange === next.onChange && prev.errorLines === next.errorLines && prev.mode === next.mode && prev.title === next.title && prev.diff === next.diff && prev.files === next.files && prev.actions === next.actions && prev.isLoading === next.isLoading && prev.error === next.error
16675
17127
  );
16676
17128
  CodeBlock.displayName = "CodeBlock";
16677
17129
  }
@@ -16683,7 +17135,7 @@ var init_MarkdownContent = __esm({
16683
17135
  init_Box();
16684
17136
  init_CodeBlock();
16685
17137
  init_cn();
16686
- MarkdownContent = React95__default.memo(
17138
+ MarkdownContent = React93__default.memo(
16687
17139
  ({ content, direction, className }) => {
16688
17140
  const { t: _t } = useTranslate();
16689
17141
  const safeContent = typeof content === "string" ? content : String(content ?? "");
@@ -17779,7 +18231,7 @@ var init_StateMachineView = __esm({
17779
18231
  style: { top: title ? 30 : 0 },
17780
18232
  children: [
17781
18233
  entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
17782
- states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React95__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
18234
+ states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React93__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
17783
18235
  StateNode,
17784
18236
  {
17785
18237
  state,
@@ -18928,110 +19380,6 @@ var init_BookTableOfContents = __esm({
18928
19380
  BookTableOfContents.displayName = "BookTableOfContents";
18929
19381
  }
18930
19382
  });
18931
- var ICON_NAME_ALIASES, lookStyles3, EmptyState;
18932
- var init_EmptyState = __esm({
18933
- "components/core/molecules/EmptyState.tsx"() {
18934
- "use client";
18935
- init_cn();
18936
- init_atoms2();
18937
- init_Box();
18938
- init_Icon();
18939
- init_Stack();
18940
- init_Typography();
18941
- init_useEventBus();
18942
- ICON_NAME_ALIASES = {
18943
- check: "check-circle",
18944
- error: "x-circle",
18945
- warning: "alert-circle"
18946
- };
18947
- lookStyles3 = {
18948
- "icon-only": "",
18949
- illustrated: "[&_svg]:w-32 [&_svg]:h-32",
18950
- "text-only": "[&_svg]:hidden",
18951
- mascot: "[&_svg]:w-24 [&_svg]:h-24 [&_svg]:rounded-pill"
18952
- };
18953
- EmptyState = ({
18954
- icon,
18955
- title,
18956
- message,
18957
- description,
18958
- actionLabel,
18959
- onAction,
18960
- className,
18961
- destructive,
18962
- variant,
18963
- actionEvent,
18964
- look = "icon-only"
18965
- }) => {
18966
- const eventBus = useEventBus();
18967
- const { t } = useTranslate();
18968
- const handleAction = () => {
18969
- if (actionEvent) eventBus.emit(`UI:${actionEvent}`, {});
18970
- onAction?.();
18971
- };
18972
- const iconName = typeof icon === "string" ? ICON_NAME_ALIASES[icon] ?? icon : void 0;
18973
- const iconComponent = typeof icon === "function" ? icon : void 0;
18974
- const hasIcon = Boolean(iconName || iconComponent);
18975
- const isDestructive = destructive || variant === "error";
18976
- const isSuccess = variant === "success";
18977
- const displayText = title || message || t("empty.noItems");
18978
- return /* @__PURE__ */ jsxs(
18979
- VStack,
18980
- {
18981
- align: "center",
18982
- className: cn(
18983
- "justify-center py-12 text-center",
18984
- lookStyles3[look],
18985
- className
18986
- ),
18987
- children: [
18988
- hasIcon && /* @__PURE__ */ jsx(
18989
- Box,
18990
- {
18991
- className: cn(
18992
- "mb-4 rounded-full p-3",
18993
- isDestructive ? "bg-error/10" : isSuccess ? "bg-success/10" : "bg-muted"
18994
- ),
18995
- children: /* @__PURE__ */ jsx(
18996
- Icon,
18997
- {
18998
- ...iconName ? { name: iconName } : { icon: iconComponent },
18999
- className: cn(
19000
- "h-8 w-8",
19001
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-muted-foreground"
19002
- )
19003
- }
19004
- )
19005
- }
19006
- ),
19007
- /* @__PURE__ */ jsx(
19008
- Typography,
19009
- {
19010
- variant: "h3",
19011
- className: cn(
19012
- "text-lg font-medium",
19013
- isDestructive ? "text-error" : isSuccess ? "text-success" : "text-foreground"
19014
- ),
19015
- children: displayText
19016
- }
19017
- ),
19018
- description && /* @__PURE__ */ jsx(Typography, { variant: "small", className: "mt-1 text-muted-foreground max-w-sm", children: description }),
19019
- actionLabel && (onAction || actionEvent) && /* @__PURE__ */ jsx(
19020
- Button,
19021
- {
19022
- className: "mt-4",
19023
- variant: isDestructive ? "danger" : "primary",
19024
- onClick: handleAction,
19025
- children: actionLabel
19026
- }
19027
- )
19028
- ]
19029
- }
19030
- );
19031
- };
19032
- EmptyState.displayName = "EmptyState";
19033
- }
19034
- });
19035
19383
 
19036
19384
  // components/core/organisms/book/types.ts
19037
19385
  function resolveFieldMap(fieldMap) {
@@ -19384,7 +19732,7 @@ var init_Grid = __esm({
19384
19732
  as: Component = "div"
19385
19733
  }) => {
19386
19734
  const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
19387
- return React95__default.createElement(
19735
+ return React93__default.createElement(
19388
19736
  Component,
19389
19737
  {
19390
19738
  className: cn(
@@ -23827,449 +24175,6 @@ var init_ClassifierBoard = __esm({
23827
24175
  ClassifierBoard.displayName = "ClassifierBoard";
23828
24176
  }
23829
24177
  });
23830
- function CodeView({
23831
- data,
23832
- label,
23833
- defaultExpanded = false,
23834
- className
23835
- }) {
23836
- const { t } = useTranslate();
23837
- const [expanded, setExpanded] = useState(defaultExpanded);
23838
- const jsonString = JSON.stringify(data, null, 2);
23839
- return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
23840
- /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
23841
- /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
23842
- /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
23843
- ] }),
23844
- expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
23845
- Typography,
23846
- {
23847
- variant: "caption",
23848
- className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
23849
- children: jsonString
23850
- }
23851
- ) })
23852
- ] });
23853
- }
23854
- var init_CodeView = __esm({
23855
- "components/game/organisms/puzzles/state-architect/CodeView.tsx"() {
23856
- init_atoms2();
23857
- init_cn();
23858
- CodeView.displayName = "CodeView";
23859
- }
23860
- });
23861
- var Tabs;
23862
- var init_Tabs = __esm({
23863
- "components/core/molecules/Tabs.tsx"() {
23864
- "use client";
23865
- init_Icon();
23866
- init_Badge();
23867
- init_Typography();
23868
- init_Box();
23869
- init_cn();
23870
- init_useEventBus();
23871
- Tabs = ({
23872
- items,
23873
- tabs,
23874
- defaultActiveTab,
23875
- activeTab: controlledActiveTab,
23876
- onTabChange,
23877
- tabChangeEvent,
23878
- variant = "default",
23879
- orientation = "horizontal",
23880
- className
23881
- }) => {
23882
- const rawItems = items ?? tabs ?? [];
23883
- const safeItems = rawItems.map(({ id, value, ...rest }) => ({
23884
- ...rest,
23885
- id: id || value || ""
23886
- }));
23887
- const eventBus = useEventBus();
23888
- const { t } = useTranslate();
23889
- const initialActive = safeItems.find((item) => item.active)?.id;
23890
- const [internalActiveTab, setInternalActiveTab] = useState(
23891
- defaultActiveTab || initialActive || safeItems[0]?.id || ""
23892
- );
23893
- const activeTab = controlledActiveTab !== void 0 ? controlledActiveTab : internalActiveTab;
23894
- const tabRefs = useRef({});
23895
- const handleTabChange = (tabId, tabEvent) => {
23896
- if (controlledActiveTab === void 0) {
23897
- setInternalActiveTab(tabId);
23898
- }
23899
- onTabChange?.(tabId);
23900
- if (tabChangeEvent) {
23901
- eventBus.emit(`UI:${tabChangeEvent}`, { tabId });
23902
- }
23903
- if (tabEvent) {
23904
- eventBus.emit(`UI:${tabEvent}`, { tabId });
23905
- }
23906
- };
23907
- const handleKeyDown = (e, index) => {
23908
- if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
23909
- e.preventDefault();
23910
- const direction = e.key === "ArrowLeft" ? -1 : 1;
23911
- const nextIndex = (index + direction + safeItems.length) % safeItems.length;
23912
- const nextTab = safeItems[nextIndex];
23913
- if (nextTab && !nextTab.disabled) {
23914
- handleTabChange(nextTab.id);
23915
- tabRefs.current[nextTab.id]?.focus();
23916
- }
23917
- } else if (e.key === "Home" || e.key === "End") {
23918
- e.preventDefault();
23919
- const targetIndex = e.key === "Home" ? 0 : safeItems.length - 1;
23920
- const targetTab = safeItems[targetIndex];
23921
- if (targetTab && !targetTab.disabled) {
23922
- handleTabChange(targetTab.id);
23923
- tabRefs.current[targetTab.id]?.focus();
23924
- }
23925
- }
23926
- };
23927
- const activeTabContent = safeItems.find((item) => item.id === activeTab)?.content;
23928
- if (safeItems.length === 0) {
23929
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full", className), children: /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", className: "py-4", children: t("empty.noItems") }) });
23930
- }
23931
- const variantClasses2 = {
23932
- default: [
23933
- "border-b-[length:var(--border-width)] border-transparent",
23934
- "hover:border-muted-foreground",
23935
- "data-[active=true]:border-primary"
23936
- ].join(" "),
23937
- pills: [
23938
- "rounded-sm",
23939
- "data-[active=true]:bg-primary",
23940
- "data-[active=true]:text-primary-foreground"
23941
- ].join(" "),
23942
- underline: [
23943
- "border-b-[length:var(--border-width)] border-transparent",
23944
- "data-[active=true]:border-primary"
23945
- ].join(" ")
23946
- };
23947
- return /* @__PURE__ */ jsxs(Box, { className: cn("w-full", className), children: [
23948
- /* @__PURE__ */ jsx(
23949
- Box,
23950
- {
23951
- role: "tablist",
23952
- className: cn(
23953
- "flex",
23954
- // Horizontal tab strip becomes a horizontally-scrollable lane
23955
- // below its container width — phones with many tabs scroll
23956
- // instead of clipping. `snap-x` snaps to each tab; the
23957
- // scrollbar is hidden for a cleaner affordance (the swipe
23958
- // gesture is the discoverability cue).
23959
- orientation === "horizontal" ? "flex-row border-b-[length:var(--border-width)] border-border overflow-x-auto snap-x snap-mandatory [&::-webkit-scrollbar]:hidden" : "flex-col border-r-[length:var(--border-width)] border-border",
23960
- variant === "pills" && "gap-1 p-1 bg-muted border-0 rounded-md",
23961
- variant === "underline" && orientation === "vertical" && "border-b-0"
23962
- ),
23963
- children: safeItems.map((item, index) => {
23964
- const isActive = item.id === activeTab;
23965
- const isDisabled = item.disabled;
23966
- return /* @__PURE__ */ jsxs(
23967
- Box,
23968
- {
23969
- as: "button",
23970
- ref: (el) => {
23971
- tabRefs.current[item.id] = el;
23972
- },
23973
- role: "tab",
23974
- "aria-selected": isActive,
23975
- "aria-controls": `tabpanel-${item.id}`,
23976
- "aria-disabled": isDisabled,
23977
- onClick: () => !isDisabled && handleTabChange(item.id, item.event),
23978
- onKeyDown: (e) => handleKeyDown(e, index),
23979
- "data-active": isActive,
23980
- className: cn(
23981
- "flex items-center gap-2 px-4 py-2 text-sm font-medium transition-all whitespace-nowrap",
23982
- orientation === "horizontal" && "snap-start shrink-0",
23983
- "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
23984
- isDisabled && "opacity-50 cursor-not-allowed",
23985
- variantClasses2[variant],
23986
- isActive ? variant === "pills" ? "text-primary-foreground font-bold" : "text-foreground font-bold" : "text-muted-foreground hover:text-foreground"
23987
- ),
23988
- children: [
23989
- item.icon && (typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, { name: item.icon, size: "sm" }) : /* @__PURE__ */ jsx(Icon, { icon: item.icon, size: "sm" })),
23990
- /* @__PURE__ */ jsx(Typography, { variant: "small", weight: isActive ? "semibold" : "normal", className: "!text-inherit", children: item.label }),
23991
- item.badge !== void 0 && /* @__PURE__ */ jsx(Badge, { variant: "default", size: "sm", children: item.badge })
23992
- ]
23993
- },
23994
- item.id
23995
- );
23996
- })
23997
- }
23998
- ),
23999
- activeTabContent !== void 0 && activeTabContent !== null && /* @__PURE__ */ jsx(
24000
- Box,
24001
- {
24002
- role: "tabpanel",
24003
- id: `tabpanel-${activeTab}`,
24004
- "aria-labelledby": `tab-${activeTab}`,
24005
- className: "mt-4",
24006
- children: activeTabContent
24007
- }
24008
- )
24009
- ] });
24010
- };
24011
- Tabs.displayName = "Tabs";
24012
- }
24013
- });
24014
- function generateDiff(oldVal, newVal) {
24015
- const oldLines = oldVal.split("\n");
24016
- const newLines = newVal.split("\n");
24017
- const diff = [];
24018
- const maxLen = Math.max(oldLines.length, newLines.length);
24019
- for (let i = 0; i < maxLen; i++) {
24020
- const oldLine = oldLines[i];
24021
- const newLine = newLines[i];
24022
- if (oldLine === newLine) {
24023
- diff.push({ type: "context", content: oldLine ?? "", lineNumber: i + 1 });
24024
- } else {
24025
- if (oldLine !== void 0) {
24026
- diff.push({ type: "remove", content: oldLine, lineNumber: i + 1 });
24027
- }
24028
- if (newLine !== void 0) {
24029
- diff.push({ type: "add", content: newLine, lineNumber: i + 1 });
24030
- }
24031
- }
24032
- }
24033
- return diff;
24034
- }
24035
- var DIFF_STYLES, CodeViewer;
24036
- var init_CodeViewer = __esm({
24037
- "components/core/molecules/CodeViewer.tsx"() {
24038
- "use client";
24039
- init_cn();
24040
- init_atoms2();
24041
- init_Stack();
24042
- init_LoadingState();
24043
- init_ErrorState();
24044
- init_EmptyState();
24045
- init_Tabs();
24046
- init_useEventBus();
24047
- DIFF_STYLES = {
24048
- add: {
24049
- bg: "bg-success/10",
24050
- prefix: "+",
24051
- text: "text-success"
24052
- },
24053
- remove: {
24054
- bg: "bg-error/10",
24055
- prefix: "-",
24056
- text: "text-error"
24057
- },
24058
- context: {
24059
- bg: "",
24060
- prefix: " ",
24061
- text: "text-foreground"
24062
- }
24063
- };
24064
- CodeViewer = ({
24065
- title,
24066
- code,
24067
- language,
24068
- diff: propDiff,
24069
- oldValue,
24070
- newValue,
24071
- mode = "code",
24072
- showLineNumbers = true,
24073
- showCopy = true,
24074
- wordWrap = false,
24075
- maxHeight = 500,
24076
- files,
24077
- actions,
24078
- entity,
24079
- isLoading = false,
24080
- error,
24081
- className
24082
- }) => {
24083
- const eventBus = useEventBus();
24084
- const { t } = useTranslate();
24085
- const [copied, setCopied] = useState(false);
24086
- const [wrap, setWrap] = useState(wordWrap);
24087
- const [activeFileIndex, setActiveFileIndex] = useState(0);
24088
- const handleAction = useCallback(
24089
- (action) => {
24090
- if (action.event) {
24091
- eventBus.emit(`UI:${action.event}`, {});
24092
- }
24093
- },
24094
- [eventBus]
24095
- );
24096
- const activeFile = files?.[activeFileIndex];
24097
- const activeCode = activeFile?.code ?? code ?? "";
24098
- const activeLanguage = activeFile?.language ?? language ?? "text";
24099
- const lines = useMemo(() => activeCode.split("\n"), [activeCode]);
24100
- const diffLines = useMemo(() => {
24101
- if (propDiff) return propDiff;
24102
- if (mode === "diff" && oldValue !== void 0 && newValue !== void 0) {
24103
- return generateDiff(oldValue, newValue);
24104
- }
24105
- return null;
24106
- }, [propDiff, mode, oldValue, newValue]);
24107
- const handleCopy = useCallback(async () => {
24108
- try {
24109
- await navigator.clipboard.writeText(activeCode);
24110
- setCopied(true);
24111
- eventBus.emit("UI:CODE_COPY", { language: activeLanguage });
24112
- setTimeout(() => setCopied(false), 2e3);
24113
- } catch {
24114
- }
24115
- }, [activeCode, eventBus, activeLanguage]);
24116
- const tabItems = files?.map((file, idx) => ({
24117
- id: `file-${idx}`,
24118
- label: file.label,
24119
- content: null
24120
- }));
24121
- if (isLoading) {
24122
- return /* @__PURE__ */ jsx(LoadingState, { message: t("common.loading"), className });
24123
- }
24124
- if (error) {
24125
- return /* @__PURE__ */ jsx(
24126
- ErrorState,
24127
- {
24128
- title: t("display.codeViewerError"),
24129
- message: error.message,
24130
- className
24131
- }
24132
- );
24133
- }
24134
- if (!activeCode && !diffLines) {
24135
- return /* @__PURE__ */ jsx(
24136
- EmptyState,
24137
- {
24138
- icon: Code,
24139
- title: t("display.noCode"),
24140
- description: "No code to display.",
24141
- className
24142
- }
24143
- );
24144
- }
24145
- return /* @__PURE__ */ jsx(Card, { className: cn("overflow-hidden", className), children: /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
24146
- tabItems && tabItems.length > 1 && /* @__PURE__ */ jsx(Box, { className: "border-b border-border", children: /* @__PURE__ */ jsx(
24147
- Tabs,
24148
- {
24149
- tabs: tabItems,
24150
- activeTab: `file-${activeFileIndex}`,
24151
- onTabChange: (id) => {
24152
- const idx = parseInt(id.replace("file-", ""), 10);
24153
- setActiveFileIndex(idx);
24154
- }
24155
- }
24156
- ) }),
24157
- /* @__PURE__ */ jsxs(
24158
- HStack,
24159
- {
24160
- gap: "sm",
24161
- align: "center",
24162
- justify: "between",
24163
- className: "px-4 py-2 border-b border-border bg-muted/30",
24164
- children: [
24165
- /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
24166
- /* @__PURE__ */ jsx(Icon, { icon: mode === "diff" ? FileText : Code, size: "sm", className: "text-muted-foreground" }),
24167
- title && /* @__PURE__ */ jsx(Typography, { variant: "small", weight: "medium", className: "truncate", children: title }),
24168
- activeLanguage && activeLanguage !== "text" && /* @__PURE__ */ jsx(Badge, { variant: "default", children: activeLanguage })
24169
- ] }),
24170
- /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
24171
- /* @__PURE__ */ jsx(
24172
- Button,
24173
- {
24174
- variant: "ghost",
24175
- size: "sm",
24176
- icon: WrapText,
24177
- onClick: () => setWrap(!wrap),
24178
- className: cn(wrap && "text-primary")
24179
- }
24180
- ),
24181
- showCopy && /* @__PURE__ */ jsx(
24182
- Button,
24183
- {
24184
- variant: "ghost",
24185
- size: "sm",
24186
- icon: copied ? Check : Copy,
24187
- onClick: handleCopy,
24188
- className: cn(copied && "text-success")
24189
- }
24190
- ),
24191
- actions?.map((action, idx) => /* @__PURE__ */ jsx(
24192
- Badge,
24193
- {
24194
- variant: "default",
24195
- className: "cursor-pointer hover:opacity-80 transition-opacity",
24196
- onClick: () => handleAction(action),
24197
- children: action.label
24198
- },
24199
- idx
24200
- ))
24201
- ] })
24202
- ]
24203
- }
24204
- ),
24205
- /* @__PURE__ */ jsx(
24206
- Box,
24207
- {
24208
- className: "overflow-auto bg-muted/20",
24209
- style: { maxHeight },
24210
- children: diffLines ? (
24211
- /* Diff mode */
24212
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: diffLines.map((line, idx) => {
24213
- const style = DIFF_STYLES[line.type];
24214
- return /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: cn(style.bg, "px-4 py-0.5"), children: [
24215
- showLineNumbers && /* @__PURE__ */ jsx(
24216
- Typography,
24217
- {
24218
- variant: "caption",
24219
- color: "secondary",
24220
- className: "w-8 text-right mr-3 select-none tabular-nums flex-shrink-0",
24221
- children: line.lineNumber ?? ""
24222
- }
24223
- ),
24224
- /* @__PURE__ */ jsxs(
24225
- Typography,
24226
- {
24227
- variant: "caption",
24228
- className: cn(
24229
- "font-mono flex-1 min-w-0",
24230
- style.text,
24231
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
24232
- ),
24233
- children: [
24234
- /* @__PURE__ */ jsx(Box, { as: "span", className: "select-none opacity-50 mr-2", children: style.prefix }),
24235
- line.content
24236
- ]
24237
- }
24238
- )
24239
- ] }, idx);
24240
- }) })
24241
- ) : (
24242
- /* Code mode */
24243
- /* @__PURE__ */ jsx(VStack, { gap: "none", className: "font-mono text-xs", children: lines.map((line, idx) => /* @__PURE__ */ jsxs(HStack, { gap: "none", align: "start", className: "px-4 py-0.5 hover:bg-muted/50", children: [
24244
- showLineNumbers && /* @__PURE__ */ jsx(
24245
- Typography,
24246
- {
24247
- variant: "caption",
24248
- color: "secondary",
24249
- className: "w-8 text-right mr-4 select-none tabular-nums flex-shrink-0",
24250
- children: idx + 1
24251
- }
24252
- ),
24253
- /* @__PURE__ */ jsx(
24254
- Typography,
24255
- {
24256
- variant: "caption",
24257
- className: cn(
24258
- "font-mono flex-1 min-w-0",
24259
- wrap ? "whitespace-pre-wrap break-all" : "whitespace-pre"
24260
- ),
24261
- children: line || " "
24262
- }
24263
- )
24264
- ] }, idx)) })
24265
- )
24266
- }
24267
- )
24268
- ] }) });
24269
- };
24270
- CodeViewer.displayName = "CodeViewer";
24271
- }
24272
- });
24273
24178
  function CombatLog({
24274
24179
  events: events2,
24275
24180
  maxVisible = 50,
@@ -24744,7 +24649,7 @@ function CraftingRecipe({
24744
24649
  className
24745
24650
  }) {
24746
24651
  const eventBus = useEventBus();
24747
- const handleCraft = React95.useCallback(() => {
24652
+ const handleCraft = React93.useCallback(() => {
24748
24653
  onCraft?.();
24749
24654
  if (craftEvent) {
24750
24655
  eventBus.emit(craftEvent, { output: output.label });
@@ -24761,7 +24666,7 @@ function CraftingRecipe({
24761
24666
  children: [
24762
24667
  /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap items-center", children: inputs.map((ingredient, index) => {
24763
24668
  const hasSufficient = ingredient.available >= ingredient.required;
24764
- return /* @__PURE__ */ jsxs(React95.Fragment, { children: [
24669
+ return /* @__PURE__ */ jsxs(React93.Fragment, { children: [
24765
24670
  /* @__PURE__ */ jsx(Box, { className: "relative", children: /* @__PURE__ */ jsx(
24766
24671
  ItemSlot,
24767
24672
  {
@@ -24824,8 +24729,8 @@ function DPad({
24824
24729
  }) {
24825
24730
  const eventBus = useEventBus();
24826
24731
  const sizes = sizeMap15[size];
24827
- const [activeDirections, setActiveDirections] = React95.useState(/* @__PURE__ */ new Set());
24828
- const handlePress = React95.useCallback(
24732
+ const [activeDirections, setActiveDirections] = React93.useState(/* @__PURE__ */ new Set());
24733
+ const handlePress = React93.useCallback(
24829
24734
  (direction) => {
24830
24735
  setActiveDirections((prev) => new Set(prev).add(direction));
24831
24736
  if (directionEvent) eventBus.emit(`UI:${directionEvent}`, { direction, pressed: true });
@@ -24833,7 +24738,7 @@ function DPad({
24833
24738
  },
24834
24739
  [directionEvent, eventBus, onDirection]
24835
24740
  );
24836
- const handleRelease = React95.useCallback(
24741
+ const handleRelease = React93.useCallback(
24837
24742
  (direction) => {
24838
24743
  setActiveDirections((prev) => {
24839
24744
  const next = new Set(prev);
@@ -25519,14 +25424,14 @@ function useDataDnd(args) {
25519
25424
  const isZone = Boolean(dragGroup || accepts || sortable);
25520
25425
  const enabled = isZone || Boolean(dndRoot);
25521
25426
  const eventBus = useEventBus();
25522
- const parentRoot = React95__default.useContext(RootCtx);
25427
+ const parentRoot = React93__default.useContext(RootCtx);
25523
25428
  const isRoot = enabled && parentRoot === null;
25524
- const zoneId = React95__default.useId();
25429
+ const zoneId = React93__default.useId();
25525
25430
  const ownGroup = dragGroup ?? accepts ?? zoneId;
25526
- const [optimisticOrders, setOptimisticOrders] = React95__default.useState(() => /* @__PURE__ */ new Map());
25527
- const optimisticOrdersRef = React95__default.useRef(optimisticOrders);
25431
+ const [optimisticOrders, setOptimisticOrders] = React93__default.useState(() => /* @__PURE__ */ new Map());
25432
+ const optimisticOrdersRef = React93__default.useRef(optimisticOrders);
25528
25433
  optimisticOrdersRef.current = optimisticOrders;
25529
- const clearOptimisticOrder = React95__default.useCallback((group) => {
25434
+ const clearOptimisticOrder = React93__default.useCallback((group) => {
25530
25435
  setOptimisticOrders((prev) => {
25531
25436
  if (!prev.has(group)) return prev;
25532
25437
  const next = new Map(prev);
@@ -25551,7 +25456,7 @@ function useDataDnd(args) {
25551
25456
  const raw = it[dndItemIdField];
25552
25457
  return String(raw ?? `__idx_${idx}`);
25553
25458
  }).join("|");
25554
- const itemIds = React95__default.useMemo(
25459
+ const itemIds = React93__default.useMemo(
25555
25460
  () => orderedItems.map((it, idx) => {
25556
25461
  const raw = it[dndItemIdField];
25557
25462
  return raw ?? `__idx_${idx}`;
@@ -25559,7 +25464,7 @@ function useDataDnd(args) {
25559
25464
  [itemIdsSignature]
25560
25465
  );
25561
25466
  const itemsContentSig = items.map((it, idx) => String(it[dndItemIdField] ?? `__${idx}`)).join("|");
25562
- React95__default.useEffect(() => {
25467
+ React93__default.useEffect(() => {
25563
25468
  const root = isRoot ? null : parentRoot;
25564
25469
  if (root) {
25565
25470
  root.clearOptimisticOrder(ownGroup);
@@ -25567,20 +25472,20 @@ function useDataDnd(args) {
25567
25472
  clearOptimisticOrder(ownGroup);
25568
25473
  }
25569
25474
  }, [itemsContentSig, ownGroup]);
25570
- const zonesRef = React95__default.useRef(/* @__PURE__ */ new Map());
25571
- const registerZone = React95__default.useCallback((zoneId2, meta2) => {
25475
+ const zonesRef = React93__default.useRef(/* @__PURE__ */ new Map());
25476
+ const registerZone = React93__default.useCallback((zoneId2, meta2) => {
25572
25477
  zonesRef.current.set(zoneId2, meta2);
25573
25478
  }, []);
25574
- const unregisterZone = React95__default.useCallback((zoneId2) => {
25479
+ const unregisterZone = React93__default.useCallback((zoneId2) => {
25575
25480
  zonesRef.current.delete(zoneId2);
25576
25481
  }, []);
25577
- const [activeDrag, setActiveDrag] = React95__default.useState(null);
25578
- const [overZoneGroup, setOverZoneGroup] = React95__default.useState(null);
25579
- const meta = React95__default.useMemo(
25482
+ const [activeDrag, setActiveDrag] = React93__default.useState(null);
25483
+ const [overZoneGroup, setOverZoneGroup] = React93__default.useState(null);
25484
+ const meta = React93__default.useMemo(
25580
25485
  () => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
25581
25486
  [ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
25582
25487
  );
25583
- React95__default.useEffect(() => {
25488
+ React93__default.useEffect(() => {
25584
25489
  const target = isRoot ? null : parentRoot;
25585
25490
  if (!target) {
25586
25491
  zonesRef.current.set(zoneId, meta);
@@ -25599,7 +25504,7 @@ function useDataDnd(args) {
25599
25504
  }, [parentRoot, isRoot, zoneId, meta]);
25600
25505
  const sensors = useAlmadarDndSensors(true);
25601
25506
  const collisionDetection = almadarDndCollisionDetection;
25602
- const findZoneByItem = React95__default.useCallback(
25507
+ const findZoneByItem = React93__default.useCallback(
25603
25508
  (id) => {
25604
25509
  for (const z of zonesRef.current.values()) {
25605
25510
  if (z.itemIds.includes(id)) return z;
@@ -25608,7 +25513,7 @@ function useDataDnd(args) {
25608
25513
  },
25609
25514
  []
25610
25515
  );
25611
- React95__default.useCallback(
25516
+ React93__default.useCallback(
25612
25517
  (group) => {
25613
25518
  for (const z of zonesRef.current.values()) {
25614
25519
  if (z.group === group) return z;
@@ -25617,7 +25522,7 @@ function useDataDnd(args) {
25617
25522
  },
25618
25523
  []
25619
25524
  );
25620
- const handleDragEnd = React95__default.useCallback(
25525
+ const handleDragEnd = React93__default.useCallback(
25621
25526
  (event) => {
25622
25527
  const { active, over } = event;
25623
25528
  const activeIdStr = String(active.id);
@@ -25708,8 +25613,8 @@ function useDataDnd(args) {
25708
25613
  },
25709
25614
  [eventBus]
25710
25615
  );
25711
- const sortableData = React95__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25712
- const SortableItem = React95__default.useCallback(
25616
+ const sortableData = React93__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
25617
+ const SortableItem = React93__default.useCallback(
25713
25618
  ({ id, children }) => {
25714
25619
  const {
25715
25620
  attributes,
@@ -25749,7 +25654,7 @@ function useDataDnd(args) {
25749
25654
  id: droppableId,
25750
25655
  data: sortableData
25751
25656
  });
25752
- const ctx = React95__default.useContext(RootCtx);
25657
+ const ctx = React93__default.useContext(RootCtx);
25753
25658
  const activeDrag2 = ctx?.activeDrag ?? null;
25754
25659
  const overZoneGroup2 = ctx?.overZoneGroup ?? null;
25755
25660
  const isThisZoneOver = overZoneGroup2 === ownGroup;
@@ -25764,7 +25669,7 @@ function useDataDnd(args) {
25764
25669
  showForeignPlaceholder,
25765
25670
  ctxAvailable: ctx != null
25766
25671
  });
25767
- React95__default.useEffect(() => {
25672
+ React93__default.useEffect(() => {
25768
25673
  dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
25769
25674
  }, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
25770
25675
  return /* @__PURE__ */ jsx(
@@ -25778,11 +25683,11 @@ function useDataDnd(args) {
25778
25683
  }
25779
25684
  );
25780
25685
  };
25781
- const rootContextValue = React95__default.useMemo(
25686
+ const rootContextValue = React93__default.useMemo(
25782
25687
  () => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
25783
25688
  [registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
25784
25689
  );
25785
- const handleDragStart = React95__default.useCallback((event) => {
25690
+ const handleDragStart = React93__default.useCallback((event) => {
25786
25691
  const sourceZone = findZoneByItem(event.active.id);
25787
25692
  const rect = event.active.rect.current.initial;
25788
25693
  const height = rect?.height && rect.height > 0 ? rect.height : 64;
@@ -25801,7 +25706,7 @@ function useDataDnd(args) {
25801
25706
  isRoot
25802
25707
  });
25803
25708
  }, [findZoneByItem, isRoot, zoneId]);
25804
- const handleDragOver = React95__default.useCallback((event) => {
25709
+ const handleDragOver = React93__default.useCallback((event) => {
25805
25710
  const { active, over } = event;
25806
25711
  const overData = over?.data?.current;
25807
25712
  const overGroup = overData?.dndGroup ?? null;
@@ -25871,7 +25776,7 @@ function useDataDnd(args) {
25871
25776
  return next;
25872
25777
  });
25873
25778
  }, []);
25874
- const handleDragCancel = React95__default.useCallback((event) => {
25779
+ const handleDragCancel = React93__default.useCallback((event) => {
25875
25780
  setActiveDrag(null);
25876
25781
  setOverZoneGroup(null);
25877
25782
  dndLog.warn("dragCancel", {
@@ -25879,12 +25784,12 @@ function useDataDnd(args) {
25879
25784
  reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
25880
25785
  });
25881
25786
  }, []);
25882
- const handleDragEndWithCleanup = React95__default.useCallback((event) => {
25787
+ const handleDragEndWithCleanup = React93__default.useCallback((event) => {
25883
25788
  handleDragEnd(event);
25884
25789
  setActiveDrag(null);
25885
25790
  setOverZoneGroup(null);
25886
25791
  }, [handleDragEnd]);
25887
- const wrapContainer = React95__default.useCallback(
25792
+ const wrapContainer = React93__default.useCallback(
25888
25793
  (children) => {
25889
25794
  if (!enabled) return children;
25890
25795
  const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
@@ -25938,7 +25843,7 @@ var init_useDataDnd = __esm({
25938
25843
  init_useAlmadarDndCollision();
25939
25844
  init_Box();
25940
25845
  dndLog = createLogger("almadar:ui:dnd");
25941
- RootCtx = React95__default.createContext(null);
25846
+ RootCtx = React93__default.createContext(null);
25942
25847
  }
25943
25848
  });
25944
25849
  function fieldLabel2(key) {
@@ -26458,7 +26363,7 @@ function DataList({
26458
26363
  }) {
26459
26364
  const eventBus = useEventBus();
26460
26365
  const { t } = useTranslate();
26461
- const [visibleCount, setVisibleCount] = React95__default.useState(pageSize || Infinity);
26366
+ const [visibleCount, setVisibleCount] = React93__default.useState(pageSize || Infinity);
26462
26367
  const fieldDefs = fields ?? columns ?? [];
26463
26368
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
26464
26369
  const dnd = useDataDnd({
@@ -26477,7 +26382,7 @@ function DataList({
26477
26382
  const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
26478
26383
  const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
26479
26384
  const hasRenderProp = typeof children === "function";
26480
- React95__default.useEffect(() => {
26385
+ React93__default.useEffect(() => {
26481
26386
  const renderItemTypeOf = typeof schemaRenderItem;
26482
26387
  const childrenTypeOf = typeof children;
26483
26388
  if (data.length > 0 && !hasRenderProp) {
@@ -26582,7 +26487,7 @@ function DataList({
26582
26487
  const items2 = data.map((item) => item);
26583
26488
  const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
26584
26489
  const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
26585
- return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
26490
+ return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
26586
26491
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
26587
26492
  group.items.map((itemData, index) => {
26588
26493
  const id = itemData.id || `${gi}-${index}`;
@@ -26730,7 +26635,7 @@ function DataList({
26730
26635
  className
26731
26636
  ),
26732
26637
  children: [
26733
- groups.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
26638
+ groups.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
26734
26639
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
26735
26640
  group.items.map(
26736
26641
  (itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
@@ -28104,7 +28009,7 @@ var init_WizardProgress = __esm({
28104
28009
  children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
28105
28010
  const isActive = index === currentStep;
28106
28011
  const isCompleted = index < currentStep;
28107
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
28012
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
28108
28013
  /* @__PURE__ */ jsx(
28109
28014
  "button",
28110
28015
  {
@@ -28621,8 +28526,9 @@ var init_FormSectionHeader = __esm({
28621
28526
  Box,
28622
28527
  {
28623
28528
  className: cn(
28624
- "px-4 py-3 bg-muted rounded-t-lg border-b-2 border-border border-l-4 border-l-primary",
28625
- isClickable && "cursor-pointer hover:bg-[var(--color-surface-hover)] transition-colors",
28529
+ "px-5 py-4 bg-muted/60 rounded-lg",
28530
+ "border border-border border-l-4 border-l-primary",
28531
+ isClickable && "cursor-pointer hover:bg-muted transition-colors",
28626
28532
  className
28627
28533
  ),
28628
28534
  onClick: isClickable ? onToggle : void 0,
@@ -28633,7 +28539,7 @@ var init_FormSectionHeader = __esm({
28633
28539
  {
28634
28540
  name: icon,
28635
28541
  size: "md",
28636
- className: "text-primary"
28542
+ className: "text-primary shrink-0"
28637
28543
  }
28638
28544
  ),
28639
28545
  statusIcon && /* @__PURE__ */ jsx(
@@ -28641,12 +28547,15 @@ var init_FormSectionHeader = __esm({
28641
28547
  {
28642
28548
  name: statusIcon,
28643
28549
  size: "md",
28644
- className: hasErrors ? "text-error" : "text-success"
28550
+ className: cn(
28551
+ "shrink-0",
28552
+ hasErrors ? "text-error" : "text-success"
28553
+ )
28645
28554
  }
28646
28555
  ),
28647
28556
  /* @__PURE__ */ jsxs(Box, { className: "space-y-0.5", children: [
28648
- /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", children: title }),
28649
- subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: subtitle })
28557
+ /* @__PURE__ */ jsx(Typography, { variant: "subheading", weight: "semibold", className: "text-foreground", children: title }),
28558
+ subtitle && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", className: "leading-snug", children: subtitle })
28650
28559
  ] })
28651
28560
  ] }),
28652
28561
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", children: [
@@ -28655,9 +28564,9 @@ var init_FormSectionHeader = __esm({
28655
28564
  Icon,
28656
28565
  {
28657
28566
  name: "chevron-down",
28658
- size: "md",
28567
+ size: "sm",
28659
28568
  className: cn(
28660
- "text-muted-foreground transition-transform",
28569
+ "text-muted-foreground transition-transform duration-200 shrink-0",
28661
28570
  isCollapsed && "-rotate-90"
28662
28571
  )
28663
28572
  }
@@ -29159,7 +29068,7 @@ function InventoryGrid({
29159
29068
  const eventBus = useEventBus();
29160
29069
  const slotCount = totalSlots ?? items.length;
29161
29070
  const emptySlotCount = Math.max(0, slotCount - items.length);
29162
- const handleSelect = React95.useCallback(
29071
+ const handleSelect = React93.useCallback(
29163
29072
  (id) => {
29164
29073
  onSelect?.(id);
29165
29074
  if (selectEvent) {
@@ -29376,31 +29285,31 @@ function GameCanvas2D({
29376
29285
  assetBaseUrl = "",
29377
29286
  className
29378
29287
  }) {
29379
- const canvasRef = React95.useRef(null);
29380
- const rafRef = React95.useRef(0);
29381
- const frameRef = React95.useRef(0);
29382
- const lastTimeRef = React95.useRef(0);
29383
- const imageCache = React95.useRef(/* @__PURE__ */ new Map());
29288
+ const canvasRef = React93.useRef(null);
29289
+ const rafRef = React93.useRef(0);
29290
+ const frameRef = React93.useRef(0);
29291
+ const lastTimeRef = React93.useRef(0);
29292
+ const imageCache = React93.useRef(/* @__PURE__ */ new Map());
29384
29293
  const emit = useEmitEvent();
29385
- const onDrawRef = React95.useRef(onDraw);
29294
+ const onDrawRef = React93.useRef(onDraw);
29386
29295
  onDrawRef.current = onDraw;
29387
- const onTickRef = React95.useRef(onTick);
29296
+ const onTickRef = React93.useRef(onTick);
29388
29297
  onTickRef.current = onTick;
29389
- const tickEventRef = React95.useRef(tickEvent);
29298
+ const tickEventRef = React93.useRef(tickEvent);
29390
29299
  tickEventRef.current = tickEvent;
29391
- const drawEventRef = React95.useRef(drawEvent);
29300
+ const drawEventRef = React93.useRef(drawEvent);
29392
29301
  drawEventRef.current = drawEvent;
29393
- const emitRef = React95.useRef(emit);
29302
+ const emitRef = React93.useRef(emit);
29394
29303
  emitRef.current = emit;
29395
- const assetBaseUrlRef = React95.useRef(assetBaseUrl);
29304
+ const assetBaseUrlRef = React93.useRef(assetBaseUrl);
29396
29305
  assetBaseUrlRef.current = assetBaseUrl;
29397
- const backgroundImageRef = React95.useRef(backgroundImage);
29306
+ const backgroundImageRef = React93.useRef(backgroundImage);
29398
29307
  backgroundImageRef.current = backgroundImage;
29399
- const widthRef = React95.useRef(width);
29308
+ const widthRef = React93.useRef(width);
29400
29309
  widthRef.current = width;
29401
- const heightRef = React95.useRef(height);
29310
+ const heightRef = React93.useRef(height);
29402
29311
  heightRef.current = height;
29403
- const loadImage = React95.useCallback((url) => {
29312
+ const loadImage = React93.useCallback((url) => {
29404
29313
  const fullUrl = url.startsWith("http") ? url : `${assetBaseUrlRef.current}${url}`;
29405
29314
  const cached = imageCache.current.get(fullUrl);
29406
29315
  if (cached?.complete && cached.naturalWidth > 0) return cached;
@@ -29412,7 +29321,7 @@ function GameCanvas2D({
29412
29321
  }
29413
29322
  return null;
29414
29323
  }, []);
29415
- React95.useEffect(() => {
29324
+ React93.useEffect(() => {
29416
29325
  const canvas = canvasRef.current;
29417
29326
  if (!canvas) return;
29418
29327
  const ctx = canvas.getContext("2d");
@@ -29715,7 +29624,7 @@ function TurnPanel({
29715
29624
  className
29716
29625
  }) {
29717
29626
  const eventBus = useEventBus();
29718
- const handleAction = React95.useCallback(
29627
+ const handleAction = React93.useCallback(
29719
29628
  (event) => {
29720
29629
  if (event) {
29721
29630
  eventBus.emit(event, { turn: currentTurn, phase, activeTeam });
@@ -29861,7 +29770,7 @@ function UnitCommandBar({
29861
29770
  className
29862
29771
  }) {
29863
29772
  const eventBus = useEventBus();
29864
- const handleCommand = React95.useCallback(
29773
+ const handleCommand = React93.useCallback(
29865
29774
  (event) => {
29866
29775
  if (event) {
29867
29776
  eventBus.emit(event, { unitId: selectedUnitId });
@@ -30346,7 +30255,7 @@ function GameMenu({
30346
30255
  } catch {
30347
30256
  }
30348
30257
  const eventBus = eventBusProp || eventBusFromHook;
30349
- const handleOptionClick = React95.useCallback(
30258
+ const handleOptionClick = React93.useCallback(
30350
30259
  (option) => {
30351
30260
  if (option.event && eventBus) {
30352
30261
  eventBus.emit(`UI:${option.event}`, { option });
@@ -30460,7 +30369,7 @@ function GameOverScreen({
30460
30369
  } catch {
30461
30370
  }
30462
30371
  const eventBus = eventBusProp || eventBusFromHook;
30463
- const handleActionClick = React95.useCallback(
30372
+ const handleActionClick = React93.useCallback(
30464
30373
  (action) => {
30465
30374
  if (action.event && eventBus) {
30466
30375
  eventBus.emit(`UI:${action.event}`, { action });
@@ -31454,7 +31363,7 @@ var init_StarRating = __esm({
31454
31363
  name: "star",
31455
31364
  className: cn(
31456
31365
  styles.star,
31457
- "text-muted-foreground",
31366
+ "text-foreground/30",
31458
31367
  "transition-colors duration-100"
31459
31368
  ),
31460
31369
  strokeWidth: 1.5
@@ -31937,8 +31846,8 @@ function TableView({
31937
31846
  }) {
31938
31847
  const eventBus = useEventBus();
31939
31848
  const { t } = useTranslate();
31940
- const [visibleCount, setVisibleCount] = React95__default.useState(pageSize > 0 ? pageSize : Infinity);
31941
- const [localSelected, setLocalSelected] = React95__default.useState(/* @__PURE__ */ new Set());
31849
+ const [visibleCount, setVisibleCount] = React93__default.useState(pageSize > 0 ? pageSize : Infinity);
31850
+ const [localSelected, setLocalSelected] = React93__default.useState(/* @__PURE__ */ new Set());
31942
31851
  const colDefs = columns ?? fields ?? [];
31943
31852
  const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
31944
31853
  const dnd = useDataDnd({
@@ -32133,12 +32042,12 @@ function TableView({
32133
32042
  ]
32134
32043
  }
32135
32044
  );
32136
- return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React95__default.Fragment, { children: rowInner }, id);
32045
+ return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React93__default.Fragment, { children: rowInner }, id);
32137
32046
  };
32138
32047
  const items = data.map((row) => row);
32139
32048
  const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
32140
32049
  let runningIndex = 0;
32141
- const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
32050
+ const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
32142
32051
  group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
32143
32052
  group.items.map((row) => renderRow(row, runningIndex++))
32144
32053
  ] }, gi)) });
@@ -33490,7 +33399,7 @@ var init_StepFlow = __esm({
33490
33399
  className
33491
33400
  }) => {
33492
33401
  if (orientation === "vertical") {
33493
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React95__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
33402
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React93__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
33494
33403
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
33495
33404
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
33496
33405
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
@@ -33501,7 +33410,7 @@ var init_StepFlow = __esm({
33501
33410
  ] })
33502
33411
  ] }) }, index)) });
33503
33412
  }
33504
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
33413
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
33505
33414
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
33506
33415
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
33507
33416
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -34256,11 +34165,19 @@ function LatticeSVG({
34256
34165
  function f2(n) {
34257
34166
  return n.toFixed(2);
34258
34167
  }
34259
- var VARIANT_MAP2, EdgeDecoration;
34168
+ var colorTokenVars, VARIANT_MAP2, EdgeDecoration;
34260
34169
  var init_EdgeDecoration = __esm({
34261
34170
  "components/core/molecules/EdgeDecoration.tsx"() {
34262
34171
  "use client";
34263
34172
  init_cn();
34173
+ colorTokenVars = {
34174
+ primary: "var(--color-primary)",
34175
+ secondary: "var(--color-secondary)",
34176
+ success: "var(--color-success)",
34177
+ warning: "var(--color-warning)",
34178
+ error: "var(--color-error)",
34179
+ muted: "var(--color-muted)"
34180
+ };
34264
34181
  VARIANT_MAP2 = {
34265
34182
  arch: ArchSVG,
34266
34183
  vine: VineSVG,
@@ -34270,13 +34187,14 @@ var init_EdgeDecoration = __esm({
34270
34187
  variant = "arch",
34271
34188
  side = "both",
34272
34189
  opacity = 0.15,
34273
- color = "var(--color-primary)",
34190
+ color = "primary",
34274
34191
  strokeWidth = 0.5,
34275
34192
  width = 15,
34276
34193
  className
34277
34194
  }) => {
34278
34195
  const id = useId();
34279
34196
  const Variant = VARIANT_MAP2[variant];
34197
+ const resolvedColor = color in colorTokenVars ? colorTokenVars[color] : color;
34280
34198
  const sides = side === "both" ? ["left", "right"] : [side];
34281
34199
  return /* @__PURE__ */ jsx(Fragment, { children: sides.map((s) => /* @__PURE__ */ jsx(
34282
34200
  "svg",
@@ -34299,7 +34217,7 @@ var init_EdgeDecoration = __esm({
34299
34217
  facing: s,
34300
34218
  w: 200,
34301
34219
  h: 600,
34302
- color,
34220
+ color: resolvedColor,
34303
34221
  strokeWidth
34304
34222
  }
34305
34223
  )
@@ -34477,7 +34395,7 @@ var init_LikertScale = __esm({
34477
34395
  md: "text-base",
34478
34396
  lg: "text-lg"
34479
34397
  };
34480
- LikertScale = React95__default.forwardRef(
34398
+ LikertScale = React93__default.forwardRef(
34481
34399
  ({
34482
34400
  question,
34483
34401
  options = DEFAULT_LIKERT_OPTIONS,
@@ -34489,7 +34407,7 @@ var init_LikertScale = __esm({
34489
34407
  variant = "radios",
34490
34408
  className
34491
34409
  }, ref) => {
34492
- const groupId = React95__default.useId();
34410
+ const groupId = React93__default.useId();
34493
34411
  const eventBus = useEventBus();
34494
34412
  const handleSelect = useCallback(
34495
34413
  (next) => {
@@ -35639,7 +35557,6 @@ function BlockRow({
35639
35557
  onUpdate,
35640
35558
  onDelete,
35641
35559
  onDuplicate,
35642
- onInsertAfter,
35643
35560
  onChangeType
35644
35561
  }) {
35645
35562
  const { t } = useTranslate();
@@ -35915,34 +35832,16 @@ function BlockRow({
35915
35832
  "data-block-id": block.id,
35916
35833
  "data-block-type": block.type,
35917
35834
  children: [
35918
- !readOnly && showAffordances && /* @__PURE__ */ jsxs(Box, { className: "flex w-12 shrink-0 items-center gap-0.5 pt-1", children: [
35919
- /* @__PURE__ */ jsx(
35920
- Button,
35921
- {
35922
- type: "button",
35923
- variant: "ghost",
35924
- "aria-label": t("richBlockEditor.insertParagraphBelow"),
35925
- className: cn(
35926
- "inline-flex h-6 w-6 items-center justify-center rounded-sm p-0 gap-0",
35927
- "text-muted-foreground hover:bg-muted hover:text-foreground",
35928
- "opacity-0 group-hover:opacity-100 focus-visible:opacity-100",
35929
- "transition-opacity"
35930
- ),
35931
- onClick: () => onInsertAfter("paragraph"),
35932
- children: /* @__PURE__ */ jsx(Icon, { name: "plus", className: "w-3.5 h-3.5" })
35933
- }
35934
- ),
35935
- /* @__PURE__ */ jsx(
35936
- BlockMenu,
35937
- {
35938
- block,
35939
- readOnly,
35940
- onDelete,
35941
- onDuplicate,
35942
- onChangeType
35943
- }
35944
- )
35945
- ] }),
35835
+ !readOnly && showAffordances && /* @__PURE__ */ jsx(Box, { className: "flex w-8 shrink-0 items-center pt-1", children: /* @__PURE__ */ jsx(
35836
+ BlockMenu,
35837
+ {
35838
+ block,
35839
+ readOnly,
35840
+ onDelete,
35841
+ onDuplicate,
35842
+ onChangeType
35843
+ }
35844
+ ) }),
35946
35845
  /* @__PURE__ */ jsx(Box, { className: "min-w-0 flex-1", children: renderBody() })
35947
35846
  ]
35948
35847
  }
@@ -36065,12 +35964,6 @@ var init_RichBlockEditor = __esm({
36065
35964
  },
36066
35965
  [blocks, commit]
36067
35966
  );
36068
- const handleInsertAfter = useCallback(
36069
- (id, type) => {
36070
- commit(insertAfter(blocks, id, createBlock(type)));
36071
- },
36072
- [blocks, commit]
36073
- );
36074
35967
  const handleChangeType = useCallback(
36075
35968
  (id, type) => {
36076
35969
  commit(
@@ -36127,7 +36020,6 @@ var init_RichBlockEditor = __esm({
36127
36020
  onUpdate: (updater) => handleUpdate(block.id, updater),
36128
36021
  onDelete: () => handleDelete(block.id),
36129
36022
  onDuplicate: () => handleDuplicate(block.id),
36130
- onInsertAfter: (type) => handleInsertAfter(block.id, type),
36131
36023
  onChangeType: (type) => handleChangeType(block.id, type)
36132
36024
  },
36133
36025
  block.id
@@ -36797,7 +36689,7 @@ var init_DocBreadcrumb = __esm({
36797
36689
  "aria-label": t("aria.breadcrumb"),
36798
36690
  children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
36799
36691
  const isLast = idx === items.length - 1;
36800
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
36692
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
36801
36693
  idx > 0 && /* @__PURE__ */ jsx(
36802
36694
  Icon,
36803
36695
  {
@@ -36844,108 +36736,6 @@ var init_DocBreadcrumb = __esm({
36844
36736
  DocBreadcrumb.displayName = "DocBreadcrumb";
36845
36737
  }
36846
36738
  });
36847
- function DocCodeBlock({
36848
- code,
36849
- language,
36850
- title,
36851
- showLineNumbers = false,
36852
- className
36853
- }) {
36854
- const [copied, setCopied] = useState(false);
36855
- const handleCopy = useCallback(() => {
36856
- void navigator.clipboard.writeText(code).then(() => {
36857
- setCopied(true);
36858
- setTimeout(() => setCopied(false), 2e3);
36859
- });
36860
- }, [code]);
36861
- const lines = code.split("\n");
36862
- return /* @__PURE__ */ jsxs(
36863
- Box,
36864
- {
36865
- className: cn(
36866
- "rounded-container border border-border overflow-hidden",
36867
- className
36868
- ),
36869
- position: "relative",
36870
- children: [
36871
- title ? /* @__PURE__ */ jsxs(
36872
- HStack,
36873
- {
36874
- align: "center",
36875
- justify: "between",
36876
- className: "bg-muted px-4 py-2 border-b border-border",
36877
- children: [
36878
- /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "sm", children: [
36879
- /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: title }),
36880
- language ? /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "muted", children: language }) : null
36881
- ] }),
36882
- /* @__PURE__ */ jsx(
36883
- Button,
36884
- {
36885
- variant: "ghost",
36886
- size: "sm",
36887
- onClick: handleCopy,
36888
- leftIcon: copied ? "check" : "copy",
36889
- children: copied ? "Copied!" : "Copy"
36890
- }
36891
- )
36892
- ]
36893
- }
36894
- ) : null,
36895
- !title ? /* @__PURE__ */ jsx(Box, { position: "absolute", className: "top-2 right-2 z-10", children: /* @__PURE__ */ jsx(
36896
- Button,
36897
- {
36898
- variant: "ghost",
36899
- size: "sm",
36900
- onClick: handleCopy,
36901
- leftIcon: copied ? "check" : "copy",
36902
- children: copied ? "Copied!" : "Copy"
36903
- }
36904
- ) }) : null,
36905
- /* @__PURE__ */ jsxs(HStack, { gap: "none", className: "bg-foreground overflow-x-auto", children: [
36906
- showLineNumbers ? /* @__PURE__ */ jsx(
36907
- Box,
36908
- {
36909
- className: "py-4 pl-4 pr-3 select-none border-r border-border flex-shrink-0",
36910
- children: lines.map((_, i) => /* @__PURE__ */ jsx(
36911
- Typography,
36912
- {
36913
- variant: "caption",
36914
- color: "muted",
36915
- className: "block font-mono text-right leading-6",
36916
- as: "span",
36917
- children: i + 1
36918
- },
36919
- i
36920
- ))
36921
- }
36922
- ) : null,
36923
- /* @__PURE__ */ jsx(
36924
- Box,
36925
- {
36926
- as: "pre",
36927
- className: cn(
36928
- "p-4 font-mono text-sm text-background leading-6 flex-1 min-w-0",
36929
- !title && "pr-24"
36930
- ),
36931
- children: /* @__PURE__ */ jsx(Box, { as: "code", className: "whitespace-pre", children: code })
36932
- }
36933
- )
36934
- ] })
36935
- ]
36936
- }
36937
- );
36938
- }
36939
- var init_DocCodeBlock = __esm({
36940
- "components/core/molecules/DocCodeBlock.tsx"() {
36941
- "use client";
36942
- init_cn();
36943
- init_Box();
36944
- init_Stack();
36945
- init_Typography();
36946
- init_Button();
36947
- }
36948
- });
36949
36739
  function DocPagination({ prev, next, className }) {
36950
36740
  if (!prev && !next) return null;
36951
36741
  return /* @__PURE__ */ jsxs(
@@ -37382,17 +37172,25 @@ var init_DocTOC = __esm({
37382
37172
  DocTOC.displayName = "DocTOC";
37383
37173
  }
37384
37174
  });
37385
- var GradientDivider;
37175
+ var colorTokenVars2, GradientDivider;
37386
37176
  var init_GradientDivider = __esm({
37387
37177
  "components/core/molecules/GradientDivider.tsx"() {
37388
37178
  "use client";
37389
37179
  init_cn();
37390
37180
  init_Box();
37181
+ colorTokenVars2 = {
37182
+ primary: "var(--color-primary)",
37183
+ secondary: "var(--color-secondary)",
37184
+ success: "var(--color-success)",
37185
+ warning: "var(--color-warning)",
37186
+ error: "var(--color-error)",
37187
+ muted: "var(--color-muted)"
37188
+ };
37391
37189
  GradientDivider = ({
37392
37190
  color,
37393
37191
  className
37394
37192
  }) => {
37395
- const centerColor = color ?? "var(--color-primary)";
37193
+ const centerColor = color ? color in colorTokenVars2 ? colorTokenVars2[color] : color : "var(--color-primary)";
37396
37194
  return /* @__PURE__ */ jsx(
37397
37195
  Box,
37398
37196
  {
@@ -37556,7 +37354,7 @@ var init_PageHeader = __esm({
37556
37354
  info: "bg-info/10 text-info"
37557
37355
  };
37558
37356
  return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
37559
- breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
37357
+ breadcrumbs && breadcrumbs.length > 0 && /* @__PURE__ */ jsx(Box, { as: "nav", className: "mb-4", children: /* @__PURE__ */ jsx(Box, { as: "ol", className: "flex items-center gap-2 text-sm", children: breadcrumbs.map((crumb, idx) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
37560
37358
  idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
37561
37359
  crumb.href ? /* @__PURE__ */ jsx(
37562
37360
  "a",
@@ -38293,7 +38091,7 @@ var init_WizardContainer = __esm({
38293
38091
  const isCompleted = index < currentStep;
38294
38092
  const stepKey = step.id ?? step.tabId ?? `step-${index}`;
38295
38093
  const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
38296
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
38094
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
38297
38095
  /* @__PURE__ */ jsx(
38298
38096
  Button,
38299
38097
  {
@@ -40578,7 +40376,7 @@ var init_DetailPanel = __esm({
40578
40376
  }
40579
40377
  });
40580
40378
  function extractTitle(children) {
40581
- if (!React95__default.isValidElement(children)) return void 0;
40379
+ if (!React93__default.isValidElement(children)) return void 0;
40582
40380
  const props = children.props;
40583
40381
  if (typeof props.title === "string") {
40584
40382
  return props.title;
@@ -40633,7 +40431,7 @@ function LinearView({
40633
40431
  /* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
40634
40432
  const isDone = i < currentIdx;
40635
40433
  const isCurrent = i === currentIdx;
40636
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
40434
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
40637
40435
  i > 0 && /* @__PURE__ */ jsx(
40638
40436
  Typography,
40639
40437
  {
@@ -41591,12 +41389,12 @@ var init_Form = __esm({
41591
41389
  const isSchemaEntity = isOrbitalEntitySchema(entity);
41592
41390
  const resolvedEntity = isSchemaEntity ? entity : void 0;
41593
41391
  const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
41594
- const normalizedInitialData = React95__default.useMemo(() => {
41392
+ const normalizedInitialData = React93__default.useMemo(() => {
41595
41393
  const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
41596
41394
  const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
41597
41395
  return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
41598
41396
  }, [entity, initialData]);
41599
- const entityDerivedFields = React95__default.useMemo(() => {
41397
+ const entityDerivedFields = React93__default.useMemo(() => {
41600
41398
  if (fields && fields.length > 0) return void 0;
41601
41399
  if (!resolvedEntity) return void 0;
41602
41400
  return resolvedEntity.fields.map(
@@ -41616,16 +41414,16 @@ var init_Form = __esm({
41616
41414
  const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
41617
41415
  const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
41618
41416
  const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
41619
- const [formData, setFormData] = React95__default.useState(
41417
+ const [formData, setFormData] = React93__default.useState(
41620
41418
  normalizedInitialData
41621
41419
  );
41622
- const [collapsedSections, setCollapsedSections] = React95__default.useState(
41420
+ const [collapsedSections, setCollapsedSections] = React93__default.useState(
41623
41421
  /* @__PURE__ */ new Set()
41624
41422
  );
41625
- const [submitError, setSubmitError] = React95__default.useState(null);
41626
- const formRef = React95__default.useRef(null);
41423
+ const [submitError, setSubmitError] = React93__default.useState(null);
41424
+ const formRef = React93__default.useRef(null);
41627
41425
  const formMode = props.mode;
41628
- const mountedRef = React95__default.useRef(false);
41426
+ const mountedRef = React93__default.useRef(false);
41629
41427
  if (!mountedRef.current) {
41630
41428
  mountedRef.current = true;
41631
41429
  debug("forms", "mount", {
@@ -41638,7 +41436,7 @@ var init_Form = __esm({
41638
41436
  });
41639
41437
  }
41640
41438
  const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
41641
- const evalContext = React95__default.useMemo(
41439
+ const evalContext = React93__default.useMemo(
41642
41440
  () => ({
41643
41441
  formValues: formData,
41644
41442
  globalVariables: externalContext?.globalVariables ?? {},
@@ -41647,7 +41445,7 @@ var init_Form = __esm({
41647
41445
  }),
41648
41446
  [formData, externalContext]
41649
41447
  );
41650
- React95__default.useEffect(() => {
41448
+ React93__default.useEffect(() => {
41651
41449
  debug("forms", "initialData-sync", {
41652
41450
  mode: formMode,
41653
41451
  normalizedInitialData,
@@ -41658,7 +41456,7 @@ var init_Form = __esm({
41658
41456
  setFormData(normalizedInitialData);
41659
41457
  }
41660
41458
  }, [normalizedInitialData]);
41661
- const processCalculations = React95__default.useCallback(
41459
+ const processCalculations = React93__default.useCallback(
41662
41460
  (changedFieldId, newFormData) => {
41663
41461
  if (!hiddenCalculations.length) return;
41664
41462
  const context = {
@@ -41683,7 +41481,7 @@ var init_Form = __esm({
41683
41481
  },
41684
41482
  [hiddenCalculations, externalContext, eventBus]
41685
41483
  );
41686
- const checkViolations = React95__default.useCallback(
41484
+ const checkViolations = React93__default.useCallback(
41687
41485
  (changedFieldId, newFormData) => {
41688
41486
  if (!violationTriggers.length) return;
41689
41487
  const context = {
@@ -41721,7 +41519,7 @@ var init_Form = __esm({
41721
41519
  processCalculations(name, newFormData);
41722
41520
  checkViolations(name, newFormData);
41723
41521
  };
41724
- const isFieldVisible = React95__default.useCallback(
41522
+ const isFieldVisible = React93__default.useCallback(
41725
41523
  (fieldName) => {
41726
41524
  const condition = conditionalFields[fieldName];
41727
41525
  if (!condition) return true;
@@ -41729,7 +41527,7 @@ var init_Form = __esm({
41729
41527
  },
41730
41528
  [conditionalFields, evalContext]
41731
41529
  );
41732
- const isSectionVisible = React95__default.useCallback(
41530
+ const isSectionVisible = React93__default.useCallback(
41733
41531
  (section) => {
41734
41532
  if (!section.condition) return true;
41735
41533
  return Boolean(evaluateFormExpression(section.condition, evalContext));
@@ -41805,7 +41603,7 @@ var init_Form = __esm({
41805
41603
  eventBus.emit(`UI:${onCancel}`);
41806
41604
  }
41807
41605
  };
41808
- const renderField = React95__default.useCallback(
41606
+ const renderField = React93__default.useCallback(
41809
41607
  (field) => {
41810
41608
  const fieldName = field.name || field.field;
41811
41609
  if (!fieldName) return null;
@@ -41826,7 +41624,7 @@ var init_Form = __esm({
41826
41624
  [formData, isFieldVisible, relationsData, relationsLoading, isLoading]
41827
41625
  );
41828
41626
  const effectiveFields = entityDerivedFields ?? fields;
41829
- const normalizedFields = React95__default.useMemo(() => {
41627
+ const normalizedFields = React93__default.useMemo(() => {
41830
41628
  if (!effectiveFields || effectiveFields.length === 0) return [];
41831
41629
  return effectiveFields.map((field) => {
41832
41630
  if (typeof field === "string") {
@@ -41849,7 +41647,7 @@ var init_Form = __esm({
41849
41647
  return field;
41850
41648
  });
41851
41649
  }, [effectiveFields, resolvedEntity]);
41852
- const schemaFields = React95__default.useMemo(() => {
41650
+ const schemaFields = React93__default.useMemo(() => {
41853
41651
  if (normalizedFields.length === 0) return null;
41854
41652
  if (isDebugEnabled()) {
41855
41653
  debugGroup(`Form: ${entityName || "unknown"}`);
@@ -41859,7 +41657,7 @@ var init_Form = __esm({
41859
41657
  }
41860
41658
  return normalizedFields.map(renderField).filter(Boolean);
41861
41659
  }, [normalizedFields, renderField, entityName, conditionalFields]);
41862
- const sectionElements = React95__default.useMemo(() => {
41660
+ const sectionElements = React93__default.useMemo(() => {
41863
41661
  if (!sections || sections.length === 0) return null;
41864
41662
  return sections.map((section) => {
41865
41663
  if (!isSectionVisible(section)) {
@@ -43134,7 +42932,7 @@ var init_List = __esm({
43134
42932
  if (entity && typeof entity === "object" && "id" in entity) return [entity];
43135
42933
  return [];
43136
42934
  }, [entity]);
43137
- const getItemActions = React95__default.useCallback(
42935
+ const getItemActions = React93__default.useCallback(
43138
42936
  (item) => {
43139
42937
  if (!itemActions) return [];
43140
42938
  if (typeof itemActions === "function") {
@@ -43610,7 +43408,7 @@ var init_MediaGallery = __esm({
43610
43408
  [selectable, selectedItems, selectionEvent, eventBus]
43611
43409
  );
43612
43410
  const entityData = Array.isArray(entity) ? entity : [];
43613
- const items = React95__default.useMemo(() => {
43411
+ const items = React93__default.useMemo(() => {
43614
43412
  if (propItems) return propItems;
43615
43413
  if (entityData.length === 0) return [];
43616
43414
  return entityData.map((record, idx) => ({
@@ -43771,7 +43569,7 @@ var init_MediaGallery = __esm({
43771
43569
  }
43772
43570
  });
43773
43571
  function extractTitle2(children) {
43774
- if (!React95__default.isValidElement(children)) return void 0;
43572
+ if (!React93__default.isValidElement(children)) return void 0;
43775
43573
  const props = children.props;
43776
43574
  if (typeof props.title === "string") {
43777
43575
  return props.title;
@@ -44202,7 +44000,7 @@ var init_debugRegistry = __esm({
44202
44000
  }
44203
44001
  });
44204
44002
  function useDebugData() {
44205
- const [data, setData] = React95.useState(() => ({
44003
+ const [data, setData] = React93.useState(() => ({
44206
44004
  traits: [],
44207
44005
  ticks: [],
44208
44006
  guards: [],
@@ -44216,7 +44014,7 @@ function useDebugData() {
44216
44014
  },
44217
44015
  lastUpdate: Date.now()
44218
44016
  }));
44219
- React95.useEffect(() => {
44017
+ React93.useEffect(() => {
44220
44018
  const updateData = () => {
44221
44019
  setData({
44222
44020
  traits: getAllTraits(),
@@ -44325,12 +44123,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
44325
44123
  return positions;
44326
44124
  }
44327
44125
  function WalkMinimap() {
44328
- const [walkStep, setWalkStep] = React95.useState(null);
44329
- const [traits2, setTraits] = React95.useState([]);
44330
- const [coveredEdges, setCoveredEdges] = React95.useState([]);
44331
- const [completedTraits, setCompletedTraits] = React95.useState(/* @__PURE__ */ new Set());
44332
- const prevTraitRef = React95.useRef(null);
44333
- React95.useEffect(() => {
44126
+ const [walkStep, setWalkStep] = React93.useState(null);
44127
+ const [traits2, setTraits] = React93.useState([]);
44128
+ const [coveredEdges, setCoveredEdges] = React93.useState([]);
44129
+ const [completedTraits, setCompletedTraits] = React93.useState(/* @__PURE__ */ new Set());
44130
+ const prevTraitRef = React93.useRef(null);
44131
+ React93.useEffect(() => {
44334
44132
  const interval = setInterval(() => {
44335
44133
  const w = window;
44336
44134
  const step = w.__orbitalWalkStep;
@@ -44766,15 +44564,15 @@ var init_EntitiesTab = __esm({
44766
44564
  });
44767
44565
  function EventFlowTab({ events: events2 }) {
44768
44566
  const { t } = useTranslate();
44769
- const [filter, setFilter] = React95.useState("all");
44770
- const containerRef = React95.useRef(null);
44771
- const [autoScroll, setAutoScroll] = React95.useState(true);
44772
- React95.useEffect(() => {
44567
+ const [filter, setFilter] = React93.useState("all");
44568
+ const containerRef = React93.useRef(null);
44569
+ const [autoScroll, setAutoScroll] = React93.useState(true);
44570
+ React93.useEffect(() => {
44773
44571
  if (autoScroll && containerRef.current) {
44774
44572
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
44775
44573
  }
44776
44574
  }, [events2.length, autoScroll]);
44777
- const filteredEvents = React95.useMemo(() => {
44575
+ const filteredEvents = React93.useMemo(() => {
44778
44576
  if (filter === "all") return events2;
44779
44577
  return events2.filter((e) => e.type === filter);
44780
44578
  }, [events2, filter]);
@@ -44890,7 +44688,7 @@ var init_EventFlowTab = __esm({
44890
44688
  });
44891
44689
  function GuardsPanel({ guards }) {
44892
44690
  const { t } = useTranslate();
44893
- const [filter, setFilter] = React95.useState("all");
44691
+ const [filter, setFilter] = React93.useState("all");
44894
44692
  if (guards.length === 0) {
44895
44693
  return /* @__PURE__ */ jsx(
44896
44694
  EmptyState,
@@ -44903,7 +44701,7 @@ function GuardsPanel({ guards }) {
44903
44701
  }
44904
44702
  const passedCount = guards.filter((g) => g.result).length;
44905
44703
  const failedCount = guards.length - passedCount;
44906
- const filteredGuards = React95.useMemo(() => {
44704
+ const filteredGuards = React93.useMemo(() => {
44907
44705
  if (filter === "all") return guards;
44908
44706
  if (filter === "passed") return guards.filter((g) => g.result);
44909
44707
  return guards.filter((g) => !g.result);
@@ -45066,10 +44864,10 @@ function EffectBadge({ effect }) {
45066
44864
  }
45067
44865
  function TransitionTimeline({ transitions }) {
45068
44866
  const { t } = useTranslate();
45069
- const containerRef = React95.useRef(null);
45070
- const [autoScroll, setAutoScroll] = React95.useState(true);
45071
- const [expandedId, setExpandedId] = React95.useState(null);
45072
- React95.useEffect(() => {
44867
+ const containerRef = React93.useRef(null);
44868
+ const [autoScroll, setAutoScroll] = React93.useState(true);
44869
+ const [expandedId, setExpandedId] = React93.useState(null);
44870
+ React93.useEffect(() => {
45073
44871
  if (autoScroll && containerRef.current) {
45074
44872
  containerRef.current.scrollTop = containerRef.current.scrollHeight;
45075
44873
  }
@@ -45349,9 +45147,9 @@ function getAllEvents(traits2) {
45349
45147
  function EventDispatcherTab({ traits: traits2, schema }) {
45350
45148
  const eventBus = useEventBus();
45351
45149
  const { t } = useTranslate();
45352
- const [log13, setLog] = React95.useState([]);
45353
- const prevStatesRef = React95.useRef(/* @__PURE__ */ new Map());
45354
- React95.useEffect(() => {
45150
+ const [log13, setLog] = React93.useState([]);
45151
+ const prevStatesRef = React93.useRef(/* @__PURE__ */ new Map());
45152
+ React93.useEffect(() => {
45355
45153
  for (const trait of traits2) {
45356
45154
  const prev = prevStatesRef.current.get(trait.id);
45357
45155
  if (prev && prev !== trait.currentState) {
@@ -45520,10 +45318,10 @@ function VerifyModePanel({
45520
45318
  localCount
45521
45319
  }) {
45522
45320
  const { t } = useTranslate();
45523
- const [expanded, setExpanded] = React95.useState(true);
45524
- const scrollRef = React95.useRef(null);
45525
- const prevCountRef = React95.useRef(0);
45526
- React95.useEffect(() => {
45321
+ const [expanded, setExpanded] = React93.useState(true);
45322
+ const scrollRef = React93.useRef(null);
45323
+ const prevCountRef = React93.useRef(0);
45324
+ React93.useEffect(() => {
45527
45325
  if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
45528
45326
  scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
45529
45327
  }
@@ -45580,10 +45378,10 @@ function RuntimeDebugger({
45580
45378
  schema
45581
45379
  }) {
45582
45380
  const { t } = useTranslate();
45583
- const [isCollapsed, setIsCollapsed] = React95.useState(mode === "verify" ? true : defaultCollapsed);
45584
- const [isVisible, setIsVisible] = React95.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
45381
+ const [isCollapsed, setIsCollapsed] = React93.useState(mode === "verify" ? true : defaultCollapsed);
45382
+ const [isVisible, setIsVisible] = React93.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
45585
45383
  const debugData = useDebugData();
45586
- React95.useEffect(() => {
45384
+ React93.useEffect(() => {
45587
45385
  if (mode === "inline") return;
45588
45386
  return onDebugToggle((enabled) => {
45589
45387
  setIsVisible(enabled);
@@ -45592,7 +45390,7 @@ function RuntimeDebugger({
45592
45390
  }
45593
45391
  });
45594
45392
  }, [mode]);
45595
- React95.useEffect(() => {
45393
+ React93.useEffect(() => {
45596
45394
  if (mode === "inline") return;
45597
45395
  const handleKeyDown = (e) => {
45598
45396
  if (e.key === "`" && isVisible) {
@@ -46041,7 +45839,7 @@ function SequenceBar({
46041
45839
  onSlotRemove(index);
46042
45840
  }, [onSlotRemove, playing]);
46043
45841
  const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
46044
- return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
45842
+ return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
46045
45843
  i > 0 && /* @__PURE__ */ jsx(
46046
45844
  Typography,
46047
45845
  {
@@ -47020,7 +46818,7 @@ var init_StatCard = __esm({
47020
46818
  const labelToUse = propLabel ?? propTitle;
47021
46819
  const eventBus = useEventBus();
47022
46820
  const { t } = useTranslate();
47023
- const handleActionClick = React95__default.useCallback(() => {
46821
+ const handleActionClick = React93__default.useCallback(() => {
47024
46822
  if (action?.event) {
47025
46823
  eventBus.emit(`UI:${action.event}`, {});
47026
46824
  }
@@ -47031,7 +46829,7 @@ var init_StatCard = __esm({
47031
46829
  const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
47032
46830
  const isLoading = externalLoading ?? false;
47033
46831
  const error = externalError;
47034
- const computeMetricValue = React95__default.useCallback(
46832
+ const computeMetricValue = React93__default.useCallback(
47035
46833
  (metric, items) => {
47036
46834
  if (metric.value !== void 0) {
47037
46835
  return metric.value;
@@ -47070,7 +46868,7 @@ var init_StatCard = __esm({
47070
46868
  },
47071
46869
  []
47072
46870
  );
47073
- const schemaStats = React95__default.useMemo(() => {
46871
+ const schemaStats = React93__default.useMemo(() => {
47074
46872
  if (!metrics || metrics.length === 0) return null;
47075
46873
  return metrics.map((metric) => ({
47076
46874
  label: metric.label,
@@ -47078,7 +46876,7 @@ var init_StatCard = __esm({
47078
46876
  format: metric.format
47079
46877
  }));
47080
46878
  }, [metrics, data, computeMetricValue]);
47081
- const calculatedTrend = React95__default.useMemo(() => {
46879
+ const calculatedTrend = React93__default.useMemo(() => {
47082
46880
  if (manualTrend !== void 0) return manualTrend;
47083
46881
  if (previousValue === void 0 || currentValue === void 0)
47084
46882
  return void 0;
@@ -47359,6 +47157,37 @@ var init_VariablePanel = __esm({
47359
47157
  VariablePanel.displayName = "VariablePanel";
47360
47158
  }
47361
47159
  });
47160
+ function StateJsonView({
47161
+ data,
47162
+ label,
47163
+ defaultExpanded = false,
47164
+ className
47165
+ }) {
47166
+ const { t } = useTranslate();
47167
+ const [expanded, setExpanded] = useState(defaultExpanded);
47168
+ const jsonString = JSON.stringify(data, null, 2);
47169
+ return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
47170
+ /* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
47171
+ /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
47172
+ /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
47173
+ ] }),
47174
+ expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
47175
+ Typography,
47176
+ {
47177
+ variant: "caption",
47178
+ className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
47179
+ children: jsonString
47180
+ }
47181
+ ) })
47182
+ ] });
47183
+ }
47184
+ var init_StateJsonView = __esm({
47185
+ "components/game/organisms/puzzles/state-architect/StateJsonView.tsx"() {
47186
+ init_atoms2();
47187
+ init_cn();
47188
+ StateJsonView.displayName = "StateJsonView";
47189
+ }
47190
+ });
47362
47191
  function layoutStates(states, width, height) {
47363
47192
  const cx = width / 2;
47364
47193
  const cy = height / 2;
@@ -47650,7 +47479,7 @@ function StateArchitectBoard({
47650
47479
  !r2.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r2.actualState }) })
47651
47480
  ] }, i))
47652
47481
  ] }),
47653
- resolved.showCodeView !== false && /* @__PURE__ */ jsx(CodeView, { data: codeData, label: "View Code" })
47482
+ resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
47654
47483
  ] })
47655
47484
  ] }),
47656
47485
  playState === "success" && /* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-success/20 border border-success text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "h5", className: "text-success", children: str(resolved.successMessage) || t("stateArchitect.allPassed") }) }),
@@ -47687,7 +47516,7 @@ var init_StateArchitectBoard = __esm({
47687
47516
  init_StateNode();
47688
47517
  init_TransitionArrow();
47689
47518
  init_VariablePanel();
47690
- init_CodeView();
47519
+ init_StateJsonView();
47691
47520
  init_boardEntity();
47692
47521
  ENCOURAGEMENT_KEYS3 = [
47693
47522
  "puzzle.tryAgain1",
@@ -48012,7 +47841,7 @@ var init_Timeline = __esm({
48012
47841
  }) => {
48013
47842
  const { t } = useTranslate();
48014
47843
  const entityData = Array.isArray(entity) ? entity : [];
48015
- const items = React95__default.useMemo(() => {
47844
+ const items = React93__default.useMemo(() => {
48016
47845
  if (propItems) return propItems;
48017
47846
  if (entityData.length === 0) return [];
48018
47847
  return entityData.map((record, idx) => {
@@ -48119,7 +47948,7 @@ var init_Timeline = __esm({
48119
47948
  }
48120
47949
  });
48121
47950
  function extractToastProps(children) {
48122
- if (!React95__default.isValidElement(children)) {
47951
+ if (!React93__default.isValidElement(children)) {
48123
47952
  if (typeof children === "string") {
48124
47953
  return { message: children };
48125
47954
  }
@@ -48157,7 +47986,7 @@ var init_ToastSlot = __esm({
48157
47986
  eventBus.emit("UI:CLOSE");
48158
47987
  };
48159
47988
  if (!isVisible) return null;
48160
- const isCustomContent = React95__default.isValidElement(children) && !message;
47989
+ const isCustomContent = React93__default.isValidElement(children) && !message;
48161
47990
  return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
48162
47991
  Toast,
48163
47992
  {
@@ -48667,12 +48496,12 @@ var init_WorldMapTemplate = __esm({
48667
48496
  }
48668
48497
  });
48669
48498
  function lazyThree(name, loader) {
48670
- const Lazy = React95__default.lazy(() => loader().then((m) => ({ default: m[name] })));
48499
+ const Lazy = React93__default.lazy(() => loader().then((m) => ({ default: m[name] })));
48671
48500
  function ThreeWrapper(props) {
48672
- return React95__default.createElement(
48673
- React95__default.Suspense,
48501
+ return React93__default.createElement(
48502
+ React93__default.Suspense,
48674
48503
  { fallback: null },
48675
- React95__default.createElement(Lazy, props)
48504
+ React93__default.createElement(Lazy, props)
48676
48505
  );
48677
48506
  }
48678
48507
  ThreeWrapper.displayName = `Lazy(${name})`;
@@ -48720,8 +48549,6 @@ var init_component_registry_generated = __esm({
48720
48549
  init_ChoiceButton();
48721
48550
  init_ClassifierBoard();
48722
48551
  init_CodeBlock();
48723
- init_CodeView();
48724
- init_CodeViewer();
48725
48552
  init_CombatLog();
48726
48553
  init_ComboCounter();
48727
48554
  init_CommunityLinks();
@@ -48749,7 +48576,6 @@ var init_component_registry_generated = __esm({
48749
48576
  init_DialogueBox();
48750
48577
  init_DialogueBubble();
48751
48578
  init_DocBreadcrumb();
48752
- init_DocCodeBlock();
48753
48579
  init_DocPagination();
48754
48580
  init_DocSearch();
48755
48581
  init_DocSidebar();
@@ -49004,8 +48830,6 @@ var init_component_registry_generated = __esm({
49004
48830
  "ChoiceButton": ChoiceButton,
49005
48831
  "ClassifierBoard": ClassifierBoard,
49006
48832
  "CodeBlock": CodeBlock,
49007
- "CodeView": CodeView,
49008
- "CodeViewer": CodeViewer,
49009
48833
  "CombatLog": CombatLog,
49010
48834
  "ComboCounter": ComboCounter,
49011
48835
  "CommunityLinks": CommunityLinks,
@@ -49037,7 +48861,6 @@ var init_component_registry_generated = __esm({
49037
48861
  "Divider": DividerPattern,
49038
48862
  "DividerPattern": DividerPattern,
49039
48863
  "DocBreadcrumb": DocBreadcrumb,
49040
- "DocCodeBlock": DocCodeBlock,
49041
48864
  "DocPagination": DocPagination,
49042
48865
  "DocSearch": DocSearch,
49043
48866
  "DocSidebar": DocSidebar,
@@ -49288,7 +49111,7 @@ function SuspenseConfigProvider({
49288
49111
  config,
49289
49112
  children
49290
49113
  }) {
49291
- return React95__default.createElement(
49114
+ return React93__default.createElement(
49292
49115
  SuspenseConfigContext.Provider,
49293
49116
  { value: config },
49294
49117
  children
@@ -49778,7 +49601,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
49778
49601
  const key = `${parentId}-${index}-trait:${traitName}`;
49779
49602
  return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
49780
49603
  }
49781
- return /* @__PURE__ */ jsx(React95__default.Fragment, { children: child }, `${parentId}-${index}`);
49604
+ return /* @__PURE__ */ jsx(React93__default.Fragment, { children: child }, `${parentId}-${index}`);
49782
49605
  }
49783
49606
  if (!child || typeof child !== "object") return null;
49784
49607
  const childId = `${parentId}-${index}`;
@@ -49818,14 +49641,14 @@ function isPatternConfig(value) {
49818
49641
  if (value === null || value === void 0) return false;
49819
49642
  if (typeof value !== "object") return false;
49820
49643
  if (Array.isArray(value)) return false;
49821
- if (React95__default.isValidElement(value)) return false;
49644
+ if (React93__default.isValidElement(value)) return false;
49822
49645
  if (value instanceof Date) return false;
49823
49646
  if (typeof value === "function") return false;
49824
49647
  const record = value;
49825
49648
  return "type" in record && typeof record.type === "string";
49826
49649
  }
49827
49650
  function isPlainConfigObject(value) {
49828
- if (React95__default.isValidElement(value)) return false;
49651
+ if (React93__default.isValidElement(value)) return false;
49829
49652
  if (value instanceof Date) return false;
49830
49653
  const proto = Object.getPrototypeOf(value);
49831
49654
  return proto === Object.prototype || proto === null;
@@ -50314,7 +50137,7 @@ var AvlTransition = ({
50314
50137
  opacity = 1,
50315
50138
  className
50316
50139
  }) => {
50317
- const ids = React95__default.useMemo(() => {
50140
+ const ids = React93__default.useMemo(() => {
50318
50141
  avlTransitionId += 1;
50319
50142
  return { arrow: `avl-tr-${avlTransitionId}-arrow` };
50320
50143
  }, []);
@@ -50875,7 +50698,7 @@ var AvlStateMachine = ({
50875
50698
  color = "var(--color-primary)",
50876
50699
  animated = false
50877
50700
  }) => {
50878
- const ids = React95__default.useMemo(() => {
50701
+ const ids = React93__default.useMemo(() => {
50879
50702
  avlSmId += 1;
50880
50703
  const base = `avl-sm-${avlSmId}`;
50881
50704
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -51074,7 +50897,7 @@ var AvlOrbitalUnit = ({
51074
50897
  color = "var(--color-primary)",
51075
50898
  animated = false
51076
50899
  }) => {
51077
- const ids = React95__default.useMemo(() => {
50900
+ const ids = React93__default.useMemo(() => {
51078
50901
  avlOuId += 1;
51079
50902
  const base = `avl-ou-${avlOuId}`;
51080
50903
  return { glow: `${base}-glow`, grad: `${base}-grad` };
@@ -51170,7 +50993,7 @@ var AvlClosedCircuit = ({
51170
50993
  color = "var(--color-primary)",
51171
50994
  animated = false
51172
50995
  }) => {
51173
- const ids = React95__default.useMemo(() => {
50996
+ const ids = React93__default.useMemo(() => {
51174
50997
  avlCcId += 1;
51175
50998
  const base = `avl-cc-${avlCcId}`;
51176
50999
  return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
@@ -51325,7 +51148,7 @@ var AvlEmitListen = ({
51325
51148
  color = "var(--color-primary)",
51326
51149
  animated = false
51327
51150
  }) => {
51328
- const ids = React95__default.useMemo(() => {
51151
+ const ids = React93__default.useMemo(() => {
51329
51152
  avlElId += 1;
51330
51153
  const base = `avl-el-${avlElId}`;
51331
51154
  return { arrow: `${base}-arrow`, grad: `${base}-grad` };
@@ -51599,7 +51422,7 @@ function renderNode(node, color, glowId) {
51599
51422
  const baseR = node.type === "operator" ? 20 : 16;
51600
51423
  const r2 = Math.max(baseR, labelLen * 3.5 + 6);
51601
51424
  const nc = nodeColor(node.type, color);
51602
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
51425
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
51603
51426
  node.children.map((child, i) => {
51604
51427
  const childR = Math.max(
51605
51428
  child.type === "operator" ? 20 : 16,
@@ -51656,7 +51479,7 @@ var AvlExprTree = ({
51656
51479
  className,
51657
51480
  color = "var(--color-primary)"
51658
51481
  }) => {
51659
- const ids = React95__default.useMemo(() => {
51482
+ const ids = React93__default.useMemo(() => {
51660
51483
  avlEtId += 1;
51661
51484
  return { glow: `avl-et-${avlEtId}-glow` };
51662
51485
  }, []);
@@ -52480,7 +52303,7 @@ var SystemNode = ({ data }) => {
52480
52303
  stateChain.length > 0 && /* @__PURE__ */ jsx("svg", { width: stateChain.length * 14 + 2, height: 10, viewBox: `0 0 ${stateChain.length * 14 + 2} 10`, children: stateChain.map((s, i) => {
52481
52304
  const tc = transitionCounts[s.name] ?? 0;
52482
52305
  const role = getStateRole(s.name, s.isInitial, s.isTerminal, tc, maxTC);
52483
- return /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
52306
+ return /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
52484
52307
  /* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial, isTerminal: s.isTerminal }),
52485
52308
  i < stateChain.length - 1 && /* @__PURE__ */ jsx("line", { x1: i * 14 + 12, y1: 5, x2: i * 14 + 15, y2: 5, stroke: "var(--color-border)", strokeWidth: 0.5 })
52486
52309
  ] }, s.name);
@@ -53632,7 +53455,7 @@ function resolveLambdaBindings(body, params, item, index) {
53632
53455
  if (Array.isArray(body)) {
53633
53456
  return body.map((b) => recur(b));
53634
53457
  }
53635
- if (body !== null && typeof body === "object" && !React95__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
53458
+ if (body !== null && typeof body === "object" && !React93__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
53636
53459
  const out = {};
53637
53460
  for (const [k, v] of Object.entries(body)) {
53638
53461
  out[k] = recur(v);
@@ -53651,7 +53474,7 @@ function getSlotContentRenderer2() {
53651
53474
  function makeLambdaFn(params, lambdaBody, callerKey) {
53652
53475
  return (item, index) => {
53653
53476
  const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
53654
- if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React95__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
53477
+ if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React93__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
53655
53478
  return null;
53656
53479
  }
53657
53480
  const record = resolvedBody;
@@ -53670,7 +53493,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
53670
53493
  props: childProps,
53671
53494
  priority: 0
53672
53495
  };
53673
- return React95__default.createElement(SlotContentRenderer2, { content: childContent });
53496
+ return React93__default.createElement(SlotContentRenderer2, { content: childContent });
53674
53497
  };
53675
53498
  }
53676
53499
  function convertNode(node, callerKey) {
@@ -53689,7 +53512,7 @@ function convertNode(node, callerKey) {
53689
53512
  });
53690
53513
  return anyChanged ? mapped : node;
53691
53514
  }
53692
- if (typeof node === "object" && !React95__default.isValidElement(node) && !(node instanceof Date)) {
53515
+ if (typeof node === "object" && !React93__default.isValidElement(node) && !(node instanceof Date)) {
53693
53516
  return convertObjectProps(node);
53694
53517
  }
53695
53518
  return node;
@@ -55702,8 +55525,8 @@ function CanvasDndProvider({
55702
55525
  }) {
55703
55526
  const eventBus = useEventBus();
55704
55527
  const sensors = useAlmadarDndSensors(false);
55705
- const [activePayload, setActivePayload] = React95__default.useState(null);
55706
- const handleDragStart = React95__default.useCallback((e) => {
55528
+ const [activePayload, setActivePayload] = React93__default.useState(null);
55529
+ const handleDragStart = React93__default.useCallback((e) => {
55707
55530
  const data = e.active.data.current;
55708
55531
  const payload = data?.payload;
55709
55532
  if (payload) {
@@ -55714,7 +55537,7 @@ function CanvasDndProvider({
55714
55537
  log11.warn("dragStart:missing-payload", { id: e.active.id });
55715
55538
  }
55716
55539
  }, [eventBus]);
55717
- const handleDragEnd = React95__default.useCallback((e) => {
55540
+ const handleDragEnd = React93__default.useCallback((e) => {
55718
55541
  setActivePayload(null);
55719
55542
  const activeData = e.active.data.current;
55720
55543
  const payload = activeData?.payload;
@@ -55743,7 +55566,7 @@ function CanvasDndProvider({
55743
55566
  const suppressed = onDrop ? onDrop(drop) === true : false;
55744
55567
  if (!suppressed) defaultEmit(eventBus, drop);
55745
55568
  }, [eventBus, onDrop]);
55746
- const handleDragCancel = React95__default.useCallback(() => {
55569
+ const handleDragCancel = React93__default.useCallback(() => {
55747
55570
  setActivePayload(null);
55748
55571
  log11.info("dragCancel");
55749
55572
  }, []);
@@ -56497,7 +56320,7 @@ var OrbPreviewNodeInner = (props) => {
56497
56320
  }
56498
56321
  );
56499
56322
  };
56500
- var OrbPreviewNode = React95__default.memo(OrbPreviewNodeInner);
56323
+ var OrbPreviewNode = React93__default.memo(OrbPreviewNodeInner);
56501
56324
  OrbPreviewNode.displayName = "OrbPreviewNode";
56502
56325
  orbPreviewLog.debug("export-resolved", () => ({
56503
56326
  type: typeof OrbPreviewNode,
@@ -56602,7 +56425,7 @@ var EventFlowEdgeInner = (props) => {
56602
56425
  ) })
56603
56426
  ] });
56604
56427
  };
56605
- var EventFlowEdge = React95__default.memo(EventFlowEdgeInner);
56428
+ var EventFlowEdge = React93__default.memo(EventFlowEdgeInner);
56606
56429
  EventFlowEdge.displayName = "EventFlowEdge";
56607
56430
 
56608
56431
  // components/avl/molecules/BehaviorComposeNode.tsx
@@ -56749,7 +56572,7 @@ var BehaviorComposeNodeInner = (props) => {
56749
56572
  }
56750
56573
  );
56751
56574
  };
56752
- var BehaviorComposeNode = React95__default.memo(BehaviorComposeNodeInner);
56575
+ var BehaviorComposeNode = React93__default.memo(BehaviorComposeNodeInner);
56753
56576
  BehaviorComposeNode.displayName = "BehaviorComposeNode";
56754
56577
 
56755
56578
  // components/avl/molecules/avl-behavior-compose-converter.ts
@@ -57761,7 +57584,7 @@ var TraitCardNodeInner = (props) => {
57761
57584
  }
57762
57585
  );
57763
57586
  };
57764
- var TraitCardNode = React95__default.memo(TraitCardNodeInner);
57587
+ var TraitCardNode = React93__default.memo(TraitCardNodeInner);
57765
57588
  TraitCardNode.displayName = "TraitCardNode";
57766
57589
 
57767
57590
  // components/avl/organisms/FlowCanvas.tsx
@@ -57834,7 +57657,7 @@ function FlowCanvasInner({
57834
57657
  initialOrbital
57835
57658
  );
57836
57659
  const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
57837
- const screenSizeUserOverrideRef = React95__default.useRef(false);
57660
+ const screenSizeUserOverrideRef = React93__default.useRef(false);
57838
57661
  const [screenSize, setScreenSize] = useState(
57839
57662
  () => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
57840
57663
  );
@@ -58218,7 +58041,7 @@ var ZoomBreadcrumb = ({
58218
58041
  if (eventName && band === "detail") {
58219
58042
  segments.push({ icon: "\u26A1", label: eventName });
58220
58043
  }
58221
- return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
58044
+ return /* @__PURE__ */ jsx("div", { className: "absolute top-2 left-2 z-10 flex items-center gap-1 px-2 py-1 rounded-md bg-card/90 border border-border text-xs text-muted-foreground backdrop-blur-sm", children: segments.map((seg, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
58222
58045
  i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
58223
58046
  /* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
58224
58047
  /* @__PURE__ */ jsx("span", { children: seg.label })
@@ -58559,7 +58382,7 @@ var EventWireOverlay = ({
58559
58382
  containerW,
58560
58383
  containerH
58561
58384
  }) => {
58562
- const ids = React95__default.useMemo(() => {
58385
+ const ids = React93__default.useMemo(() => {
58563
58386
  avlOczWireId += 1;
58564
58387
  return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
58565
58388
  }, []);
@@ -58926,7 +58749,7 @@ var AvlOrbitalsCosmicZoom = ({
58926
58749
  borderRadius: 6,
58927
58750
  border: `1px solid ${color}`
58928
58751
  },
58929
- children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React95__default.Fragment, { children: [
58752
+ children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React93__default.Fragment, { children: [
58930
58753
  i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
58931
58754
  i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
58932
58755
  Box,