@almadar/ui 5.86.0 → 5.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +3435 -1250
- package/dist/avl/index.js +2485 -300
- package/dist/components/game/2d/molecules/StateGraph.d.ts +38 -0
- package/dist/components/game/2d/molecules/index.d.ts +24 -15
- package/dist/components/game/2d/organisms/BuilderBoard.d.ts +60 -0
- package/dist/components/game/2d/organisms/ClassifierBoard.d.ts +66 -0
- package/dist/components/game/2d/organisms/DebuggerBoard.d.ts +61 -0
- package/dist/components/game/2d/organisms/EventHandlerBoard.d.ts +42 -0
- package/dist/components/game/2d/organisms/NegotiatorBoard.d.ts +56 -0
- package/dist/components/game/2d/{molecules → organisms}/SequenceBar.d.ts +3 -8
- package/dist/components/game/2d/organisms/SequencerBoard.d.ts +69 -0
- package/dist/components/game/2d/organisms/SimulatorBoard.d.ts +58 -0
- package/dist/components/game/2d/organisms/StateArchitectBoard.d.ts +61 -0
- package/dist/components/game/shared/lib/puzzleObject.d.ts +1 -1
- package/dist/components/index.cjs +3168 -1351
- package/dist/components/index.js +2199 -391
- package/dist/providers/index.cjs +3295 -1110
- package/dist/providers/index.js +2454 -269
- package/dist/runtime/index.cjs +3291 -1106
- package/dist/runtime/index.js +2460 -275
- package/package.json +1 -1
- /package/dist/components/game/2d/{molecules → organisms}/ActionPalette.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ActionTile.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/EventLog.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/ObjectRulePanel.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/RuleEditor.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationCanvas.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationControls.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/SimulationGraph.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateJsonView.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/StateNode.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitSlot.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TraitStateViewer.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/TransitionArrow.d.ts +0 -0
- /package/dist/components/game/2d/{molecules → organisms}/VariablePanel.d.ts +0 -0
package/dist/avl/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as React105 from 'react';
|
|
3
|
+
import React105__default, { createContext, useState, useMemo, useRef, useEffect, useContext, useCallback, Suspense, useLayoutEffect, Profiler, useReducer, useSyncExternalStore, lazy, useId } from 'react';
|
|
4
4
|
import { getAllPages, OrbitalProvider, EventBusContext, useTraitScope, ServerBridgeProvider, VerificationProvider, EntitySchemaProvider, OrbitalThemeProvider, useServerBridge, useEntitySchema, useEntitySchemaOptional, TraitScopeProvider, useCurrentPagePath } 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 } from '@almadar/ui/hooks';
|
|
9
9
|
import * as LucideIcons2 from 'lucide-react';
|
|
10
|
-
import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, ChevronDown, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, ChevronUp, Tag, User, DollarSign } from 'lucide-react';
|
|
10
|
+
import { Loader2, X, Code, FileText, WrapText, Check, Copy, Lightbulb, CheckCircle, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil, Eye, Plus, ArrowRight, Trash, RotateCcw, Play, Terminal, XCircle, AlertTriangle, Trash2, Link2, ZoomOut, ZoomIn, Download, ChevronDown, Menu as Menu$1, Package, Calendar, MoreHorizontal, Image as Image$1, Upload, ArrowLeft, HelpCircle, PauseCircle, Search, Type, Heading1, Heading2, Heading3, ListOrdered, Quote, Minus, Eraser, TrendingUp, TrendingDown, AlertCircle, Circle, Clock, CheckCircle2, Bug, Send, ChevronUp, Wrench, Tag, User, DollarSign } from 'lucide-react';
|
|
11
11
|
import { createPortal } from 'react-dom';
|
|
12
12
|
import { UISlotProvider, useUISlots, useTheme } from '@almadar/ui/context';
|
|
13
13
|
import { evaluateGuard, evaluate, createMinimalContext } from '@almadar/evaluator';
|
|
@@ -3174,7 +3174,7 @@ var init_Typography = __esm({
|
|
|
3174
3174
|
}) => {
|
|
3175
3175
|
const variant = variantProp ?? (level ? `h${level}` : "body1");
|
|
3176
3176
|
const Component = as || defaultElements[variant];
|
|
3177
|
-
return
|
|
3177
|
+
return React105__default.createElement(
|
|
3178
3178
|
Component,
|
|
3179
3179
|
{
|
|
3180
3180
|
id,
|
|
@@ -3511,7 +3511,7 @@ var init_Box = __esm({
|
|
|
3511
3511
|
fixed: "fixed",
|
|
3512
3512
|
sticky: "sticky"
|
|
3513
3513
|
};
|
|
3514
|
-
Box =
|
|
3514
|
+
Box = React105__default.forwardRef(
|
|
3515
3515
|
({
|
|
3516
3516
|
padding,
|
|
3517
3517
|
paddingX,
|
|
@@ -3576,7 +3576,7 @@ var init_Box = __esm({
|
|
|
3576
3576
|
onPointerDown?.(e);
|
|
3577
3577
|
}, [hoverEvent, tapReveal, triggerProps, onPointerDown]);
|
|
3578
3578
|
const isClickable = action || onClick;
|
|
3579
|
-
return
|
|
3579
|
+
return React105__default.createElement(
|
|
3580
3580
|
Component,
|
|
3581
3581
|
{
|
|
3582
3582
|
ref,
|
|
@@ -3672,7 +3672,7 @@ var init_Stack = __esm({
|
|
|
3672
3672
|
};
|
|
3673
3673
|
const isHorizontal = direction === "horizontal";
|
|
3674
3674
|
const directionClass = responsive && isHorizontal ? reverse ? "flex-col-reverse md:flex-row-reverse" : "flex-col md:flex-row" : isHorizontal ? reverse ? "flex-row-reverse" : "flex-row" : reverse ? "flex-col-reverse" : "flex-col";
|
|
3675
|
-
return
|
|
3675
|
+
return React105__default.createElement(
|
|
3676
3676
|
Component,
|
|
3677
3677
|
{
|
|
3678
3678
|
className: cn(
|
|
@@ -4164,7 +4164,7 @@ var init_MiniStateMachine = __esm({
|
|
|
4164
4164
|
const x = 2 + i * (NODE_W + GAP + ARROW_W + GAP);
|
|
4165
4165
|
const tc = transitionCounts[s.name] ?? 0;
|
|
4166
4166
|
const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
|
|
4167
|
-
return /* @__PURE__ */ jsxs(
|
|
4167
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
4168
4168
|
/* @__PURE__ */ jsx(
|
|
4169
4169
|
AvlState,
|
|
4170
4170
|
{
|
|
@@ -4494,7 +4494,7 @@ function loadLib(key, importer) {
|
|
|
4494
4494
|
return p;
|
|
4495
4495
|
}
|
|
4496
4496
|
function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
4497
|
-
const Lazy =
|
|
4497
|
+
const Lazy = React105__default.lazy(async () => {
|
|
4498
4498
|
const lib = await loadLib(libKey, importer);
|
|
4499
4499
|
const Comp = pick(lib);
|
|
4500
4500
|
if (!Comp) {
|
|
@@ -4504,7 +4504,7 @@ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
|
|
|
4504
4504
|
return { default: Comp };
|
|
4505
4505
|
});
|
|
4506
4506
|
const Wrapped = (props) => /* @__PURE__ */ jsx(
|
|
4507
|
-
|
|
4507
|
+
React105__default.Suspense,
|
|
4508
4508
|
{
|
|
4509
4509
|
fallback: /* @__PURE__ */ jsx(
|
|
4510
4510
|
"span",
|
|
@@ -5235,7 +5235,7 @@ var init_Icon = __esm({
|
|
|
5235
5235
|
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
5236
5236
|
const effectiveName = typeof icon === "string" ? icon : name;
|
|
5237
5237
|
const family = useIconFamily();
|
|
5238
|
-
const RenderedComponent =
|
|
5238
|
+
const RenderedComponent = React105__default.useMemo(() => {
|
|
5239
5239
|
if (directIcon) return null;
|
|
5240
5240
|
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
5241
5241
|
}, [directIcon, effectiveName, family]);
|
|
@@ -5297,7 +5297,7 @@ function resolveIconProp(value, sizeClass) {
|
|
|
5297
5297
|
const IconComp = value;
|
|
5298
5298
|
return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
|
|
5299
5299
|
}
|
|
5300
|
-
if (
|
|
5300
|
+
if (React105__default.isValidElement(value)) {
|
|
5301
5301
|
return value;
|
|
5302
5302
|
}
|
|
5303
5303
|
if (typeof value === "object" && value !== null && isIconLike(value)) {
|
|
@@ -5373,7 +5373,7 @@ var init_Button = __esm({
|
|
|
5373
5373
|
md: "h-icon-default w-icon-default",
|
|
5374
5374
|
lg: "h-icon-default w-icon-default"
|
|
5375
5375
|
};
|
|
5376
|
-
Button =
|
|
5376
|
+
Button = React105__default.forwardRef(
|
|
5377
5377
|
({
|
|
5378
5378
|
className,
|
|
5379
5379
|
variant = "primary",
|
|
@@ -5441,7 +5441,7 @@ var Dialog;
|
|
|
5441
5441
|
var init_Dialog = __esm({
|
|
5442
5442
|
"components/core/atoms/Dialog.tsx"() {
|
|
5443
5443
|
init_cn();
|
|
5444
|
-
Dialog =
|
|
5444
|
+
Dialog = React105__default.forwardRef(
|
|
5445
5445
|
({
|
|
5446
5446
|
role = "dialog",
|
|
5447
5447
|
"aria-modal": ariaModal = true,
|
|
@@ -5936,7 +5936,7 @@ var init_Badge = __esm({
|
|
|
5936
5936
|
md: "px-2.5 py-1 text-sm",
|
|
5937
5937
|
lg: "px-3 py-1.5 text-base"
|
|
5938
5938
|
};
|
|
5939
|
-
Badge =
|
|
5939
|
+
Badge = React105__default.forwardRef(
|
|
5940
5940
|
({ className, variant = "default", size = "sm", amount, label, icon, iconAsset, children, onRemove, removeLabel, ...props }, ref) => {
|
|
5941
5941
|
const iconSizes3 = {
|
|
5942
5942
|
sm: "h-icon-default w-icon-default",
|
|
@@ -6273,7 +6273,7 @@ var init_SvgFlow = __esm({
|
|
|
6273
6273
|
width = 100,
|
|
6274
6274
|
height = 100
|
|
6275
6275
|
}) => {
|
|
6276
|
-
const markerId =
|
|
6276
|
+
const markerId = React105__default.useMemo(() => {
|
|
6277
6277
|
flowIdCounter += 1;
|
|
6278
6278
|
return `almadar-flow-arrow-${flowIdCounter}`;
|
|
6279
6279
|
}, []);
|
|
@@ -6326,7 +6326,7 @@ var init_SvgGrid = __esm({
|
|
|
6326
6326
|
x = 10,
|
|
6327
6327
|
y = 10,
|
|
6328
6328
|
cols = 4,
|
|
6329
|
-
rows = 3,
|
|
6329
|
+
rows: rows2 = 3,
|
|
6330
6330
|
spacing = 20,
|
|
6331
6331
|
nodeRadius = 3,
|
|
6332
6332
|
color = "var(--color-primary)",
|
|
@@ -6338,7 +6338,7 @@ var init_SvgGrid = __esm({
|
|
|
6338
6338
|
height = 100
|
|
6339
6339
|
}) => {
|
|
6340
6340
|
const highlightSet = new Set(highlights);
|
|
6341
|
-
const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length:
|
|
6341
|
+
const inner = /* @__PURE__ */ jsx("g", { className, opacity, children: Array.from({ length: rows2 }).map(
|
|
6342
6342
|
(_, row) => Array.from({ length: cols }).map((_2, col) => {
|
|
6343
6343
|
const index = row * cols + col;
|
|
6344
6344
|
const isHighlighted = highlightSet.has(index);
|
|
@@ -6866,7 +6866,7 @@ var init_SvgRing = __esm({
|
|
|
6866
6866
|
width = 100,
|
|
6867
6867
|
height = 100
|
|
6868
6868
|
}) => {
|
|
6869
|
-
const gradientId =
|
|
6869
|
+
const gradientId = React105__default.useMemo(() => {
|
|
6870
6870
|
ringIdCounter += 1;
|
|
6871
6871
|
return `almadar-ring-glow-${ringIdCounter}`;
|
|
6872
6872
|
}, []);
|
|
@@ -7047,7 +7047,7 @@ var init_Input = __esm({
|
|
|
7047
7047
|
init_cn();
|
|
7048
7048
|
init_Icon();
|
|
7049
7049
|
init_useEventBus();
|
|
7050
|
-
Input =
|
|
7050
|
+
Input = React105__default.forwardRef(
|
|
7051
7051
|
({
|
|
7052
7052
|
className,
|
|
7053
7053
|
inputType,
|
|
@@ -7062,7 +7062,7 @@ var init_Input = __esm({
|
|
|
7062
7062
|
onClear,
|
|
7063
7063
|
value,
|
|
7064
7064
|
options,
|
|
7065
|
-
rows = 3,
|
|
7065
|
+
rows: rows2 = 3,
|
|
7066
7066
|
onChange,
|
|
7067
7067
|
...props
|
|
7068
7068
|
}, ref) => {
|
|
@@ -7144,7 +7144,7 @@ var init_Input = __esm({
|
|
|
7144
7144
|
ref,
|
|
7145
7145
|
value,
|
|
7146
7146
|
onChange: handleChange,
|
|
7147
|
-
rows,
|
|
7147
|
+
rows: rows2,
|
|
7148
7148
|
className: baseClassName,
|
|
7149
7149
|
...props
|
|
7150
7150
|
}
|
|
@@ -7207,7 +7207,7 @@ var Label;
|
|
|
7207
7207
|
var init_Label = __esm({
|
|
7208
7208
|
"components/core/atoms/Label.tsx"() {
|
|
7209
7209
|
init_cn();
|
|
7210
|
-
Label =
|
|
7210
|
+
Label = React105__default.forwardRef(
|
|
7211
7211
|
({ className, required, children, ...props }, ref) => {
|
|
7212
7212
|
return /* @__PURE__ */ jsxs(
|
|
7213
7213
|
"label",
|
|
@@ -7234,7 +7234,7 @@ var init_Textarea = __esm({
|
|
|
7234
7234
|
"components/core/atoms/Textarea.tsx"() {
|
|
7235
7235
|
init_cn();
|
|
7236
7236
|
init_useEventBus();
|
|
7237
|
-
Textarea =
|
|
7237
|
+
Textarea = React105__default.forwardRef(
|
|
7238
7238
|
({ className, error, onChange, ...props }, ref) => {
|
|
7239
7239
|
const eventBus = useEventBus();
|
|
7240
7240
|
const handleChange = (e) => {
|
|
@@ -7473,7 +7473,7 @@ var init_Select = __esm({
|
|
|
7473
7473
|
init_cn();
|
|
7474
7474
|
init_Icon();
|
|
7475
7475
|
init_useEventBus();
|
|
7476
|
-
Select =
|
|
7476
|
+
Select = React105__default.forwardRef(
|
|
7477
7477
|
(props, _ref) => {
|
|
7478
7478
|
const { multiple, searchable, clearable } = props;
|
|
7479
7479
|
if (multiple || searchable || clearable) {
|
|
@@ -7490,7 +7490,7 @@ var init_Checkbox = __esm({
|
|
|
7490
7490
|
"components/core/atoms/Checkbox.tsx"() {
|
|
7491
7491
|
init_cn();
|
|
7492
7492
|
init_useEventBus();
|
|
7493
|
-
Checkbox =
|
|
7493
|
+
Checkbox = React105__default.forwardRef(
|
|
7494
7494
|
({ className, label, id, onChange, ...props }, ref) => {
|
|
7495
7495
|
const inputId = id || `checkbox-${Math.random().toString(36).substr(2, 9)}`;
|
|
7496
7496
|
const eventBus = useEventBus();
|
|
@@ -7544,7 +7544,7 @@ var init_Spinner = __esm({
|
|
|
7544
7544
|
md: "h-6 w-6",
|
|
7545
7545
|
lg: "h-8 w-8"
|
|
7546
7546
|
};
|
|
7547
|
-
Spinner =
|
|
7547
|
+
Spinner = React105__default.forwardRef(
|
|
7548
7548
|
({ className, size = "md", overlay, ...props }, ref) => {
|
|
7549
7549
|
if (overlay) {
|
|
7550
7550
|
return /* @__PURE__ */ jsx(
|
|
@@ -7634,7 +7634,7 @@ var init_Card = __esm({
|
|
|
7634
7634
|
chip: "shadow-none rounded-pill border-[length:var(--border-width)] border-border",
|
|
7635
7635
|
"tile-image-first": "p-0 overflow-hidden"
|
|
7636
7636
|
};
|
|
7637
|
-
Card =
|
|
7637
|
+
Card = React105__default.forwardRef(
|
|
7638
7638
|
({
|
|
7639
7639
|
className,
|
|
7640
7640
|
variant = "bordered",
|
|
@@ -7682,9 +7682,9 @@ var init_Card = __esm({
|
|
|
7682
7682
|
}
|
|
7683
7683
|
);
|
|
7684
7684
|
Card.displayName = "Card";
|
|
7685
|
-
CardHeader =
|
|
7685
|
+
CardHeader = React105__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
|
|
7686
7686
|
CardHeader.displayName = "CardHeader";
|
|
7687
|
-
CardTitle =
|
|
7687
|
+
CardTitle = React105__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7688
7688
|
"h3",
|
|
7689
7689
|
{
|
|
7690
7690
|
ref,
|
|
@@ -7697,11 +7697,11 @@ var init_Card = __esm({
|
|
|
7697
7697
|
}
|
|
7698
7698
|
));
|
|
7699
7699
|
CardTitle.displayName = "CardTitle";
|
|
7700
|
-
CardContent =
|
|
7700
|
+
CardContent = React105__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
|
|
7701
7701
|
CardContent.displayName = "CardContent";
|
|
7702
7702
|
CardBody = CardContent;
|
|
7703
7703
|
CardBody.displayName = "CardBody";
|
|
7704
|
-
CardFooter =
|
|
7704
|
+
CardFooter = React105__default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
7705
7705
|
"div",
|
|
7706
7706
|
{
|
|
7707
7707
|
ref,
|
|
@@ -7756,7 +7756,7 @@ var init_FilterPill = __esm({
|
|
|
7756
7756
|
md: "w-3.5 h-3.5",
|
|
7757
7757
|
lg: "w-4 h-4"
|
|
7758
7758
|
};
|
|
7759
|
-
FilterPill =
|
|
7759
|
+
FilterPill = React105__default.forwardRef(
|
|
7760
7760
|
({
|
|
7761
7761
|
className,
|
|
7762
7762
|
variant = "default",
|
|
@@ -7885,8 +7885,8 @@ var init_Avatar = __esm({
|
|
|
7885
7885
|
actionPayload
|
|
7886
7886
|
}) => {
|
|
7887
7887
|
const eventBus = useEventBus();
|
|
7888
|
-
const [imgFailed, setImgFailed] =
|
|
7889
|
-
|
|
7888
|
+
const [imgFailed, setImgFailed] = React105__default.useState(false);
|
|
7889
|
+
React105__default.useEffect(() => {
|
|
7890
7890
|
setImgFailed(false);
|
|
7891
7891
|
}, [src]);
|
|
7892
7892
|
const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
|
|
@@ -7999,7 +7999,7 @@ var init_Center = __esm({
|
|
|
7999
7999
|
as: Component = "div"
|
|
8000
8000
|
}) => {
|
|
8001
8001
|
const mergedStyle = minHeight ? { minHeight, ...style } : style;
|
|
8002
|
-
return
|
|
8002
|
+
return React105__default.createElement(Component, {
|
|
8003
8003
|
className: cn(
|
|
8004
8004
|
inline ? "inline-flex" : "flex",
|
|
8005
8005
|
horizontal && "justify-center",
|
|
@@ -8267,7 +8267,7 @@ var init_Radio = __esm({
|
|
|
8267
8267
|
md: "w-2.5 h-2.5",
|
|
8268
8268
|
lg: "w-3 h-3"
|
|
8269
8269
|
};
|
|
8270
|
-
Radio =
|
|
8270
|
+
Radio = React105__default.forwardRef(
|
|
8271
8271
|
({
|
|
8272
8272
|
label,
|
|
8273
8273
|
helperText,
|
|
@@ -8284,12 +8284,12 @@ var init_Radio = __esm({
|
|
|
8284
8284
|
onChange,
|
|
8285
8285
|
...props
|
|
8286
8286
|
}, ref) => {
|
|
8287
|
-
const reactId =
|
|
8287
|
+
const reactId = React105__default.useId();
|
|
8288
8288
|
const baseId = id || `radio-${reactId}`;
|
|
8289
8289
|
const hasError = !!error;
|
|
8290
8290
|
const eventBus = useEventBus();
|
|
8291
|
-
const [selected, setSelected] =
|
|
8292
|
-
|
|
8291
|
+
const [selected, setSelected] = React105__default.useState(value);
|
|
8292
|
+
React105__default.useEffect(() => {
|
|
8293
8293
|
if (value !== void 0) setSelected(value);
|
|
8294
8294
|
}, [value]);
|
|
8295
8295
|
const pick = (next, e) => {
|
|
@@ -8471,7 +8471,7 @@ var init_Switch = __esm({
|
|
|
8471
8471
|
"components/core/atoms/Switch.tsx"() {
|
|
8472
8472
|
"use client";
|
|
8473
8473
|
init_cn();
|
|
8474
|
-
Switch =
|
|
8474
|
+
Switch = React105.forwardRef(
|
|
8475
8475
|
({
|
|
8476
8476
|
checked,
|
|
8477
8477
|
defaultChecked = false,
|
|
@@ -8482,10 +8482,10 @@ var init_Switch = __esm({
|
|
|
8482
8482
|
name,
|
|
8483
8483
|
className
|
|
8484
8484
|
}, ref) => {
|
|
8485
|
-
const [isChecked, setIsChecked] =
|
|
8485
|
+
const [isChecked, setIsChecked] = React105.useState(
|
|
8486
8486
|
checked !== void 0 ? checked : defaultChecked
|
|
8487
8487
|
);
|
|
8488
|
-
|
|
8488
|
+
React105.useEffect(() => {
|
|
8489
8489
|
if (checked !== void 0) {
|
|
8490
8490
|
setIsChecked(checked);
|
|
8491
8491
|
}
|
|
@@ -8763,7 +8763,7 @@ var Aside;
|
|
|
8763
8763
|
var init_Aside = __esm({
|
|
8764
8764
|
"components/core/atoms/Aside.tsx"() {
|
|
8765
8765
|
init_cn();
|
|
8766
|
-
Aside =
|
|
8766
|
+
Aside = React105__default.forwardRef(
|
|
8767
8767
|
({ className, children, ...rest }, ref) => /* @__PURE__ */ jsx("aside", { ref, className: cn(className), ...rest, children })
|
|
8768
8768
|
);
|
|
8769
8769
|
Aside.displayName = "Aside";
|
|
@@ -8842,9 +8842,9 @@ var init_LawReferenceTooltip = __esm({
|
|
|
8842
8842
|
className
|
|
8843
8843
|
}) => {
|
|
8844
8844
|
const { t } = useTranslate();
|
|
8845
|
-
const [isVisible, setIsVisible] =
|
|
8846
|
-
const timeoutRef =
|
|
8847
|
-
const triggerRef =
|
|
8845
|
+
const [isVisible, setIsVisible] = React105__default.useState(false);
|
|
8846
|
+
const timeoutRef = React105__default.useRef(null);
|
|
8847
|
+
const triggerRef = React105__default.useRef(null);
|
|
8848
8848
|
const handleMouseEnter = () => {
|
|
8849
8849
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8850
8850
|
timeoutRef.current = setTimeout(() => setIsVisible(true), 200);
|
|
@@ -8855,7 +8855,7 @@ var init_LawReferenceTooltip = __esm({
|
|
|
8855
8855
|
};
|
|
8856
8856
|
const { revealed, triggerProps } = useTapReveal({ refs: [triggerRef] });
|
|
8857
8857
|
const open = isVisible || revealed;
|
|
8858
|
-
|
|
8858
|
+
React105__default.useEffect(() => {
|
|
8859
8859
|
return () => {
|
|
8860
8860
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
8861
8861
|
};
|
|
@@ -9065,7 +9065,7 @@ var init_StatusDot = __esm({
|
|
|
9065
9065
|
md: "w-2.5 h-2.5",
|
|
9066
9066
|
lg: "w-3 h-3"
|
|
9067
9067
|
};
|
|
9068
|
-
StatusDot =
|
|
9068
|
+
StatusDot = React105__default.forwardRef(
|
|
9069
9069
|
({ className, status = "offline", pulse = false, size = "md", label, ...props }, ref) => {
|
|
9070
9070
|
return /* @__PURE__ */ jsx(
|
|
9071
9071
|
"span",
|
|
@@ -9119,7 +9119,7 @@ var init_TrendIndicator = __esm({
|
|
|
9119
9119
|
down: "trending-down",
|
|
9120
9120
|
flat: "arrow-right"
|
|
9121
9121
|
};
|
|
9122
|
-
TrendIndicator =
|
|
9122
|
+
TrendIndicator = React105__default.forwardRef(
|
|
9123
9123
|
({
|
|
9124
9124
|
className,
|
|
9125
9125
|
value,
|
|
@@ -9186,7 +9186,7 @@ var init_RangeSlider = __esm({
|
|
|
9186
9186
|
md: "w-4 h-4",
|
|
9187
9187
|
lg: "w-5 h-5"
|
|
9188
9188
|
};
|
|
9189
|
-
RangeSlider =
|
|
9189
|
+
RangeSlider = React105__default.forwardRef(
|
|
9190
9190
|
({
|
|
9191
9191
|
className,
|
|
9192
9192
|
min = 0,
|
|
@@ -9780,7 +9780,7 @@ var init_ContentSection = __esm({
|
|
|
9780
9780
|
md: "py-16",
|
|
9781
9781
|
lg: "py-24"
|
|
9782
9782
|
};
|
|
9783
|
-
ContentSection =
|
|
9783
|
+
ContentSection = React105__default.forwardRef(
|
|
9784
9784
|
({ children, background = "default", padding = "lg", id, className }, ref) => {
|
|
9785
9785
|
return /* @__PURE__ */ jsx(
|
|
9786
9786
|
Box,
|
|
@@ -10314,7 +10314,7 @@ var init_AnimatedReveal = __esm({
|
|
|
10314
10314
|
"scale-up": { opacity: 1, transform: "scale(1) translateY(0)" },
|
|
10315
10315
|
"none": {}
|
|
10316
10316
|
};
|
|
10317
|
-
AnimatedReveal =
|
|
10317
|
+
AnimatedReveal = React105__default.forwardRef(
|
|
10318
10318
|
({
|
|
10319
10319
|
trigger = "scroll",
|
|
10320
10320
|
animation = "fade-up",
|
|
@@ -10474,7 +10474,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
10474
10474
|
"components/marketing/atoms/AnimatedGraphic.tsx"() {
|
|
10475
10475
|
"use client";
|
|
10476
10476
|
init_cn();
|
|
10477
|
-
AnimatedGraphic =
|
|
10477
|
+
AnimatedGraphic = React105__default.forwardRef(
|
|
10478
10478
|
({
|
|
10479
10479
|
src,
|
|
10480
10480
|
svgContent,
|
|
@@ -10497,7 +10497,7 @@ var init_AnimatedGraphic = __esm({
|
|
|
10497
10497
|
const fetchedSvg = useFetchedSvg(svgContent ? void 0 : src);
|
|
10498
10498
|
const resolvedSvg = svgContent ?? fetchedSvg;
|
|
10499
10499
|
const prevAnimateRef = useRef(animate);
|
|
10500
|
-
const setRef =
|
|
10500
|
+
const setRef = React105__default.useCallback(
|
|
10501
10501
|
(node) => {
|
|
10502
10502
|
containerRef.current = node;
|
|
10503
10503
|
if (typeof ref === "function") ref(node);
|
|
@@ -10645,6 +10645,20 @@ var init_effects = __esm({
|
|
|
10645
10645
|
});
|
|
10646
10646
|
|
|
10647
10647
|
// components/game/shared/boardEntity.ts
|
|
10648
|
+
function boardEntity(entity) {
|
|
10649
|
+
if (!entity) return void 0;
|
|
10650
|
+
return Array.isArray(entity) ? entity[0] : entity;
|
|
10651
|
+
}
|
|
10652
|
+
function str(v) {
|
|
10653
|
+
return v == null ? "" : String(v);
|
|
10654
|
+
}
|
|
10655
|
+
function num(v, fallback = 0) {
|
|
10656
|
+
const n = Number(v);
|
|
10657
|
+
return Number.isFinite(n) ? n : fallback;
|
|
10658
|
+
}
|
|
10659
|
+
function rows(v) {
|
|
10660
|
+
return Array.isArray(v) ? v : [];
|
|
10661
|
+
}
|
|
10648
10662
|
var init_boardEntity = __esm({
|
|
10649
10663
|
"components/game/shared/boardEntity.ts"() {
|
|
10650
10664
|
}
|
|
@@ -11090,7 +11104,7 @@ function GameCard({
|
|
|
11090
11104
|
className
|
|
11091
11105
|
}) {
|
|
11092
11106
|
const eventBus = useEventBus();
|
|
11093
|
-
const handleClick =
|
|
11107
|
+
const handleClick = React105.useCallback(() => {
|
|
11094
11108
|
if (disabled) return;
|
|
11095
11109
|
onClick?.(id);
|
|
11096
11110
|
if (clickEvent) eventBus.emit(`UI:${clickEvent}`, { cardId: id });
|
|
@@ -11372,9 +11386,9 @@ function ControlButton({
|
|
|
11372
11386
|
className
|
|
11373
11387
|
}) {
|
|
11374
11388
|
const eventBus = useEventBus();
|
|
11375
|
-
const [isPressed, setIsPressed] =
|
|
11389
|
+
const [isPressed, setIsPressed] = React105.useState(false);
|
|
11376
11390
|
const actualPressed = pressed ?? isPressed;
|
|
11377
|
-
const handlePointerDown =
|
|
11391
|
+
const handlePointerDown = React105.useCallback(
|
|
11378
11392
|
(e) => {
|
|
11379
11393
|
e.preventDefault();
|
|
11380
11394
|
if (disabled) return;
|
|
@@ -11384,7 +11398,7 @@ function ControlButton({
|
|
|
11384
11398
|
},
|
|
11385
11399
|
[disabled, pressEvent, eventBus, onPress]
|
|
11386
11400
|
);
|
|
11387
|
-
const handlePointerUp =
|
|
11401
|
+
const handlePointerUp = React105.useCallback(
|
|
11388
11402
|
(e) => {
|
|
11389
11403
|
e.preventDefault();
|
|
11390
11404
|
if (disabled) return;
|
|
@@ -11394,7 +11408,7 @@ function ControlButton({
|
|
|
11394
11408
|
},
|
|
11395
11409
|
[disabled, releaseEvent, eventBus, onRelease]
|
|
11396
11410
|
);
|
|
11397
|
-
const handlePointerLeave =
|
|
11411
|
+
const handlePointerLeave = React105.useCallback(
|
|
11398
11412
|
(e) => {
|
|
11399
11413
|
if (isPressed) {
|
|
11400
11414
|
setIsPressed(false);
|
|
@@ -12413,8 +12427,8 @@ function MiniMap({
|
|
|
12413
12427
|
tileAssets,
|
|
12414
12428
|
unitAssets
|
|
12415
12429
|
}) {
|
|
12416
|
-
const canvasRef =
|
|
12417
|
-
const imgCacheRef =
|
|
12430
|
+
const canvasRef = React105.useRef(null);
|
|
12431
|
+
const imgCacheRef = React105.useRef(/* @__PURE__ */ new Map());
|
|
12418
12432
|
function loadImg(url) {
|
|
12419
12433
|
const cached = imgCacheRef.current.get(url);
|
|
12420
12434
|
if (cached) return cached.complete ? cached : null;
|
|
@@ -12429,7 +12443,7 @@ function MiniMap({
|
|
|
12429
12443
|
imgCacheRef.current.set(url, img);
|
|
12430
12444
|
return null;
|
|
12431
12445
|
}
|
|
12432
|
-
|
|
12446
|
+
React105.useEffect(() => {
|
|
12433
12447
|
const canvas = canvasRef.current;
|
|
12434
12448
|
if (!canvas) return;
|
|
12435
12449
|
const ctx = canvas.getContext("2d");
|
|
@@ -12564,8 +12578,8 @@ function ControlGrid({
|
|
|
12564
12578
|
className
|
|
12565
12579
|
}) {
|
|
12566
12580
|
const eventBus = useEventBus();
|
|
12567
|
-
const [active, setActive] =
|
|
12568
|
-
const handlePress =
|
|
12581
|
+
const [active, setActive] = React105.useState(/* @__PURE__ */ new Set());
|
|
12582
|
+
const handlePress = React105.useCallback(
|
|
12569
12583
|
(id) => {
|
|
12570
12584
|
setActive((prev) => new Set(prev).add(id));
|
|
12571
12585
|
if (actionEvent) eventBus.emit(`UI:${actionEvent}`, { id, pressed: true });
|
|
@@ -12579,7 +12593,7 @@ function ControlGrid({
|
|
|
12579
12593
|
},
|
|
12580
12594
|
[kind, actionEvent, directionEvent, directionEvents, eventBus, onAction, onDirection]
|
|
12581
12595
|
);
|
|
12582
|
-
const handleRelease =
|
|
12596
|
+
const handleRelease = React105.useCallback(
|
|
12583
12597
|
(id) => {
|
|
12584
12598
|
setActive((prev) => {
|
|
12585
12599
|
const next = new Set(prev);
|
|
@@ -12837,7 +12851,7 @@ function InventoryGrid({
|
|
|
12837
12851
|
const eventBus = useEventBus();
|
|
12838
12852
|
const slotCount = totalSlots ?? items.length;
|
|
12839
12853
|
const emptySlotCount = Math.max(0, slotCount - items.length);
|
|
12840
|
-
const handleSelect =
|
|
12854
|
+
const handleSelect = React105.useCallback(
|
|
12841
12855
|
(id) => {
|
|
12842
12856
|
onSelect?.(id);
|
|
12843
12857
|
if (selectEvent) {
|
|
@@ -13054,7 +13068,7 @@ function GameMenu({
|
|
|
13054
13068
|
}) {
|
|
13055
13069
|
const resolvedOptions = options ?? menuItems ?? DEFAULT_MENU_OPTIONS;
|
|
13056
13070
|
const eventBus = useEventBus();
|
|
13057
|
-
const handleOptionClick =
|
|
13071
|
+
const handleOptionClick = React105.useCallback(
|
|
13058
13072
|
(option) => {
|
|
13059
13073
|
if (option.event) {
|
|
13060
13074
|
eventBus.emit(`UI:${option.event}`, { option });
|
|
@@ -13131,6 +13145,214 @@ var init_GameMenu = __esm({
|
|
|
13131
13145
|
GameMenu.displayName = "GameMenu";
|
|
13132
13146
|
}
|
|
13133
13147
|
});
|
|
13148
|
+
function StateNode({
|
|
13149
|
+
name,
|
|
13150
|
+
isCurrent = false,
|
|
13151
|
+
isSelected = false,
|
|
13152
|
+
isInitial = false,
|
|
13153
|
+
position,
|
|
13154
|
+
onClick,
|
|
13155
|
+
className
|
|
13156
|
+
}) {
|
|
13157
|
+
return /* @__PURE__ */ jsx(
|
|
13158
|
+
Box,
|
|
13159
|
+
{
|
|
13160
|
+
position: "absolute",
|
|
13161
|
+
display: "flex",
|
|
13162
|
+
className: cn(
|
|
13163
|
+
"items-center justify-center rounded-pill border-3 transition-all cursor-pointer select-none",
|
|
13164
|
+
"min-w-[80px] h-[80px] px-3",
|
|
13165
|
+
isCurrent && "bg-primary/20 border-primary shadow-lg shadow-primary/30 scale-110",
|
|
13166
|
+
isSelected && !isCurrent && "bg-accent/20 border-accent ring-2 ring-accent/50",
|
|
13167
|
+
!isCurrent && !isSelected && "bg-card border-border hover:border-muted-foreground hover:scale-105",
|
|
13168
|
+
className
|
|
13169
|
+
),
|
|
13170
|
+
style: {
|
|
13171
|
+
left: position.x,
|
|
13172
|
+
top: position.y,
|
|
13173
|
+
transform: "translate(-50%, -50%)"
|
|
13174
|
+
},
|
|
13175
|
+
onClick,
|
|
13176
|
+
children: /* @__PURE__ */ jsxs(Box, { className: "text-center", children: [
|
|
13177
|
+
isInitial && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground text-xs block", children: "\u25B6 start" }),
|
|
13178
|
+
/* @__PURE__ */ jsx(
|
|
13179
|
+
Typography,
|
|
13180
|
+
{
|
|
13181
|
+
variant: "body2",
|
|
13182
|
+
className: cn(
|
|
13183
|
+
"font-bold whitespace-nowrap",
|
|
13184
|
+
isCurrent ? "text-primary" : "text-foreground"
|
|
13185
|
+
),
|
|
13186
|
+
children: name
|
|
13187
|
+
}
|
|
13188
|
+
)
|
|
13189
|
+
] })
|
|
13190
|
+
}
|
|
13191
|
+
);
|
|
13192
|
+
}
|
|
13193
|
+
var init_StateNode = __esm({
|
|
13194
|
+
"components/game/2d/organisms/StateNode.tsx"() {
|
|
13195
|
+
init_atoms();
|
|
13196
|
+
init_cn();
|
|
13197
|
+
StateNode.displayName = "StateNode";
|
|
13198
|
+
}
|
|
13199
|
+
});
|
|
13200
|
+
function TransitionArrow({
|
|
13201
|
+
from,
|
|
13202
|
+
to,
|
|
13203
|
+
eventLabel,
|
|
13204
|
+
guardHint,
|
|
13205
|
+
isActive = false,
|
|
13206
|
+
onClick,
|
|
13207
|
+
className
|
|
13208
|
+
}) {
|
|
13209
|
+
const dx = to.x - from.x;
|
|
13210
|
+
const dy = to.y - from.y;
|
|
13211
|
+
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
13212
|
+
if (dist === 0) return /* @__PURE__ */ jsx(Fragment, {});
|
|
13213
|
+
const nx = dx / dist;
|
|
13214
|
+
const ny = dy / dist;
|
|
13215
|
+
const startX = from.x + nx * NODE_RADIUS;
|
|
13216
|
+
const startY = from.y + ny * NODE_RADIUS;
|
|
13217
|
+
const endX = to.x - nx * NODE_RADIUS;
|
|
13218
|
+
const endY = to.y - ny * NODE_RADIUS;
|
|
13219
|
+
const midX = (startX + endX) / 2;
|
|
13220
|
+
const midY = (startY + endY) / 2;
|
|
13221
|
+
const perpX = -ny * 20;
|
|
13222
|
+
const perpY = nx * 20;
|
|
13223
|
+
const ctrlX = midX + perpX;
|
|
13224
|
+
const ctrlY = midY + perpY;
|
|
13225
|
+
const path = `M ${startX} ${startY} Q ${ctrlX} ${ctrlY} ${endX} ${endY}`;
|
|
13226
|
+
return /* @__PURE__ */ jsxs("g", { className: cn("cursor-pointer", className), onClick, children: [
|
|
13227
|
+
/* @__PURE__ */ jsx(
|
|
13228
|
+
"path",
|
|
13229
|
+
{
|
|
13230
|
+
d: path,
|
|
13231
|
+
fill: "none",
|
|
13232
|
+
stroke: isActive ? "var(--color-primary)" : "var(--color-border)",
|
|
13233
|
+
strokeWidth: isActive ? 3 : 2,
|
|
13234
|
+
markerEnd: isActive ? "url(#arrowhead-active)" : "url(#arrowhead)"
|
|
13235
|
+
}
|
|
13236
|
+
),
|
|
13237
|
+
/* @__PURE__ */ jsx(
|
|
13238
|
+
"text",
|
|
13239
|
+
{
|
|
13240
|
+
x: ctrlX,
|
|
13241
|
+
y: ctrlY - 8,
|
|
13242
|
+
textAnchor: "middle",
|
|
13243
|
+
fill: isActive ? "var(--color-primary)" : "var(--color-foreground)",
|
|
13244
|
+
fontSize: 12,
|
|
13245
|
+
fontWeight: isActive ? "bold" : "normal",
|
|
13246
|
+
className: "select-none",
|
|
13247
|
+
children: eventLabel
|
|
13248
|
+
}
|
|
13249
|
+
),
|
|
13250
|
+
guardHint && /* @__PURE__ */ jsx(
|
|
13251
|
+
"text",
|
|
13252
|
+
{
|
|
13253
|
+
x: ctrlX,
|
|
13254
|
+
y: ctrlY + 6,
|
|
13255
|
+
textAnchor: "middle",
|
|
13256
|
+
fill: "var(--color-warning)",
|
|
13257
|
+
fontSize: 10,
|
|
13258
|
+
className: "select-none",
|
|
13259
|
+
children: "\u26A0 " + guardHint
|
|
13260
|
+
}
|
|
13261
|
+
)
|
|
13262
|
+
] });
|
|
13263
|
+
}
|
|
13264
|
+
var NODE_RADIUS;
|
|
13265
|
+
var init_TransitionArrow = __esm({
|
|
13266
|
+
"components/game/2d/organisms/TransitionArrow.tsx"() {
|
|
13267
|
+
init_cn();
|
|
13268
|
+
NODE_RADIUS = 40;
|
|
13269
|
+
TransitionArrow.displayName = "TransitionArrow";
|
|
13270
|
+
}
|
|
13271
|
+
});
|
|
13272
|
+
function layoutStates(states, width, height) {
|
|
13273
|
+
const cx = width / 2;
|
|
13274
|
+
const cy = height / 2;
|
|
13275
|
+
const radius = Math.min(cx, cy) - 60;
|
|
13276
|
+
const positions = {};
|
|
13277
|
+
states.forEach((state, i) => {
|
|
13278
|
+
const angle = 2 * Math.PI * i / Math.max(states.length, 1) - Math.PI / 2;
|
|
13279
|
+
positions[state] = { x: cx + radius * Math.cos(angle), y: cy + radius * Math.sin(angle) };
|
|
13280
|
+
});
|
|
13281
|
+
return positions;
|
|
13282
|
+
}
|
|
13283
|
+
function StateGraph({
|
|
13284
|
+
states,
|
|
13285
|
+
transitions = [],
|
|
13286
|
+
currentState,
|
|
13287
|
+
selectedState,
|
|
13288
|
+
addingFrom,
|
|
13289
|
+
initialState,
|
|
13290
|
+
width = 500,
|
|
13291
|
+
height = 400,
|
|
13292
|
+
nodeClickEvent,
|
|
13293
|
+
className
|
|
13294
|
+
}) {
|
|
13295
|
+
const eventBus = useEventBus();
|
|
13296
|
+
const nodes = states ?? [];
|
|
13297
|
+
const positions = React105.useMemo(() => layoutStates(nodes, width, height), [nodes, width, height]);
|
|
13298
|
+
return /* @__PURE__ */ jsxs(
|
|
13299
|
+
Box,
|
|
13300
|
+
{
|
|
13301
|
+
position: "relative",
|
|
13302
|
+
className: cn("rounded-container border border-border bg-background overflow-hidden", className),
|
|
13303
|
+
style: { width, height },
|
|
13304
|
+
children: [
|
|
13305
|
+
/* @__PURE__ */ jsxs("svg", { width, height, className: "absolute inset-0", style: { pointerEvents: "none" }, children: [
|
|
13306
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
13307
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-border)" }) }),
|
|
13308
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead-active", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-primary)" }) })
|
|
13309
|
+
] }),
|
|
13310
|
+
transitions.map((tr, i) => {
|
|
13311
|
+
const fromPos = positions[tr.from];
|
|
13312
|
+
const toPos = positions[tr.to];
|
|
13313
|
+
if (!fromPos || !toPos) return null;
|
|
13314
|
+
return /* @__PURE__ */ jsx(
|
|
13315
|
+
TransitionArrow,
|
|
13316
|
+
{
|
|
13317
|
+
from: fromPos,
|
|
13318
|
+
to: toPos,
|
|
13319
|
+
eventLabel: tr.event,
|
|
13320
|
+
guardHint: tr.guardHint,
|
|
13321
|
+
isActive: tr.from === currentState
|
|
13322
|
+
},
|
|
13323
|
+
`${tr.from}-${tr.event}-${tr.to}-${i}`
|
|
13324
|
+
);
|
|
13325
|
+
})
|
|
13326
|
+
] }),
|
|
13327
|
+
nodes.map((state) => {
|
|
13328
|
+
const pos = positions[state];
|
|
13329
|
+
if (!pos) return null;
|
|
13330
|
+
return /* @__PURE__ */ jsx(
|
|
13331
|
+
StateNode,
|
|
13332
|
+
{
|
|
13333
|
+
name: state,
|
|
13334
|
+
position: pos,
|
|
13335
|
+
isCurrent: state === currentState,
|
|
13336
|
+
isSelected: state === selectedState || state === addingFrom,
|
|
13337
|
+
isInitial: state === initialState,
|
|
13338
|
+
onClick: nodeClickEvent ? () => eventBus.emit(`UI:${nodeClickEvent}`, { stateId: state }) : void 0
|
|
13339
|
+
},
|
|
13340
|
+
state
|
|
13341
|
+
);
|
|
13342
|
+
})
|
|
13343
|
+
]
|
|
13344
|
+
}
|
|
13345
|
+
);
|
|
13346
|
+
}
|
|
13347
|
+
var init_StateGraph = __esm({
|
|
13348
|
+
"components/game/2d/molecules/StateGraph.tsx"() {
|
|
13349
|
+
init_atoms();
|
|
13350
|
+
init_cn();
|
|
13351
|
+
init_useEventBus();
|
|
13352
|
+
init_StateNode();
|
|
13353
|
+
init_TransitionArrow();
|
|
13354
|
+
}
|
|
13355
|
+
});
|
|
13134
13356
|
function useCamera() {
|
|
13135
13357
|
const cameraRef = useRef({ x: 0, y: 0, zoom: 1 });
|
|
13136
13358
|
const targetCameraRef = useRef(null);
|
|
@@ -14728,7 +14950,7 @@ function LinearView({
|
|
|
14728
14950
|
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap items-center", gap: "xs", children: trait.states.map((state, i) => {
|
|
14729
14951
|
const isDone = i < currentIdx;
|
|
14730
14952
|
const isCurrent = i === currentIdx;
|
|
14731
|
-
return /* @__PURE__ */ jsxs(
|
|
14953
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
14732
14954
|
i > 0 && /* @__PURE__ */ jsx(
|
|
14733
14955
|
Typography,
|
|
14734
14956
|
{
|
|
@@ -14925,7 +15147,7 @@ function TraitStateViewer({
|
|
|
14925
15147
|
}
|
|
14926
15148
|
var SIZE_CONFIG;
|
|
14927
15149
|
var init_TraitStateViewer = __esm({
|
|
14928
|
-
"components/game/2d/
|
|
15150
|
+
"components/game/2d/organisms/TraitStateViewer.tsx"() {
|
|
14929
15151
|
"use client";
|
|
14930
15152
|
init_cn();
|
|
14931
15153
|
init_Box();
|
|
@@ -15132,7 +15354,7 @@ function TraitSlot({
|
|
|
15132
15354
|
}
|
|
15133
15355
|
var SIZE_CONFIG2, DRAG_MIME;
|
|
15134
15356
|
var init_TraitSlot = __esm({
|
|
15135
|
-
"components/game/2d/
|
|
15357
|
+
"components/game/2d/organisms/TraitSlot.tsx"() {
|
|
15136
15358
|
"use client";
|
|
15137
15359
|
init_cn();
|
|
15138
15360
|
init_useEventBus();
|
|
@@ -15191,7 +15413,7 @@ function ActionTile({
|
|
|
15191
15413
|
}
|
|
15192
15414
|
var DRAG_MIME2, SIZE_CONFIG3;
|
|
15193
15415
|
var init_ActionTile = __esm({
|
|
15194
|
-
"components/game/2d/
|
|
15416
|
+
"components/game/2d/organisms/ActionTile.tsx"() {
|
|
15195
15417
|
init_atoms();
|
|
15196
15418
|
init_cn();
|
|
15197
15419
|
DRAG_MIME2 = "application/x-almadar-slot-item";
|
|
@@ -15228,7 +15450,7 @@ function ActionPalette({
|
|
|
15228
15450
|
] });
|
|
15229
15451
|
}
|
|
15230
15452
|
var init_ActionPalette = __esm({
|
|
15231
|
-
"components/game/2d/
|
|
15453
|
+
"components/game/2d/organisms/ActionPalette.tsx"() {
|
|
15232
15454
|
init_atoms();
|
|
15233
15455
|
init_cn();
|
|
15234
15456
|
init_ActionTile();
|
|
@@ -15240,8 +15462,6 @@ function SequenceBar({
|
|
|
15240
15462
|
maxSlots,
|
|
15241
15463
|
onSlotDrop,
|
|
15242
15464
|
onSlotRemove,
|
|
15243
|
-
slotDropEvent,
|
|
15244
|
-
slotRemoveEvent,
|
|
15245
15465
|
playing = false,
|
|
15246
15466
|
currentStep = -1,
|
|
15247
15467
|
categoryColors,
|
|
@@ -15249,19 +15469,16 @@ function SequenceBar({
|
|
|
15249
15469
|
size = "lg",
|
|
15250
15470
|
className
|
|
15251
15471
|
}) {
|
|
15252
|
-
const { emit } = useEventBus();
|
|
15253
15472
|
const handleDrop = useCallback((index) => (item) => {
|
|
15254
15473
|
if (playing) return;
|
|
15255
|
-
|
|
15256
|
-
|
|
15257
|
-
}, [onSlotDrop, slotDropEvent, emit, playing]);
|
|
15474
|
+
onSlotDrop(index, item);
|
|
15475
|
+
}, [onSlotDrop, playing]);
|
|
15258
15476
|
const handleRemove = useCallback((index) => () => {
|
|
15259
15477
|
if (playing) return;
|
|
15260
|
-
|
|
15261
|
-
|
|
15262
|
-
}, [onSlotRemove, slotRemoveEvent, emit, playing]);
|
|
15478
|
+
onSlotRemove(index);
|
|
15479
|
+
}, [onSlotRemove, playing]);
|
|
15263
15480
|
const paddedSlots = Array.from({ length: maxSlots }, (_, i) => slots[i]);
|
|
15264
|
-
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(
|
|
15481
|
+
return /* @__PURE__ */ jsx(HStack, { className: cn("items-center", className), gap: "sm", children: paddedSlots.map((slot, i) => /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
15265
15482
|
i > 0 && /* @__PURE__ */ jsx(
|
|
15266
15483
|
Typography,
|
|
15267
15484
|
{
|
|
@@ -15291,14 +15508,330 @@ function SequenceBar({
|
|
|
15291
15508
|
] }, i)) });
|
|
15292
15509
|
}
|
|
15293
15510
|
var init_SequenceBar = __esm({
|
|
15294
|
-
"components/game/2d/
|
|
15511
|
+
"components/game/2d/organisms/SequenceBar.tsx"() {
|
|
15295
15512
|
init_atoms();
|
|
15296
15513
|
init_cn();
|
|
15297
|
-
init_useEventBus();
|
|
15298
15514
|
init_TraitSlot();
|
|
15299
15515
|
SequenceBar.displayName = "SequenceBar";
|
|
15300
15516
|
}
|
|
15301
15517
|
});
|
|
15518
|
+
function computeSlotFeedback(playerSeq, solutions) {
|
|
15519
|
+
let bestSolution = solutions[0];
|
|
15520
|
+
let bestMatches = -1;
|
|
15521
|
+
for (const sol of solutions) {
|
|
15522
|
+
const matches = sol.filter((id, i) => id === playerSeq[i]).length;
|
|
15523
|
+
if (matches > bestMatches) {
|
|
15524
|
+
bestMatches = matches;
|
|
15525
|
+
bestSolution = sol;
|
|
15526
|
+
}
|
|
15527
|
+
}
|
|
15528
|
+
return playerSeq.map(
|
|
15529
|
+
(id, i) => id !== void 0 && id === bestSolution[i] ? "correct" : "wrong"
|
|
15530
|
+
);
|
|
15531
|
+
}
|
|
15532
|
+
function isFieldRecord(v) {
|
|
15533
|
+
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
15534
|
+
}
|
|
15535
|
+
function assetFromField(v) {
|
|
15536
|
+
if (!isFieldRecord(v)) return void 0;
|
|
15537
|
+
const url = typeof v.url === "string" ? v.url : void 0;
|
|
15538
|
+
const role = typeof v.role === "string" ? v.role : void 0;
|
|
15539
|
+
const category = typeof v.category === "string" ? v.category : "";
|
|
15540
|
+
if (!url || !role) return void 0;
|
|
15541
|
+
return {
|
|
15542
|
+
url,
|
|
15543
|
+
role,
|
|
15544
|
+
category,
|
|
15545
|
+
name: typeof v.name === "string" ? v.name : void 0,
|
|
15546
|
+
thumbnailUrl: typeof v.thumbnailUrl === "string" ? v.thumbnailUrl : void 0,
|
|
15547
|
+
style: typeof v.style === "string" ? v.style : void 0,
|
|
15548
|
+
variant: typeof v.variant === "string" ? v.variant : void 0,
|
|
15549
|
+
dimension: typeof v.dimension === "string" ? v.dimension : void 0,
|
|
15550
|
+
aspect: typeof v.aspect === "string" ? v.aspect : void 0
|
|
15551
|
+
};
|
|
15552
|
+
}
|
|
15553
|
+
function slotItemFromField(fv) {
|
|
15554
|
+
if (!isFieldRecord(fv)) return void 0;
|
|
15555
|
+
const id = typeof fv.id === "string" ? fv.id : void 0;
|
|
15556
|
+
const name = typeof fv.name === "string" ? fv.name : void 0;
|
|
15557
|
+
const category = typeof fv.category === "string" ? fv.category : void 0;
|
|
15558
|
+
if (!id || !name || !category) return void 0;
|
|
15559
|
+
return {
|
|
15560
|
+
id,
|
|
15561
|
+
name,
|
|
15562
|
+
category,
|
|
15563
|
+
description: typeof fv.description === "string" ? fv.description : void 0,
|
|
15564
|
+
iconEmoji: typeof fv.iconEmoji === "string" ? fv.iconEmoji : void 0,
|
|
15565
|
+
iconUrl: assetFromField(fv.iconUrl)
|
|
15566
|
+
};
|
|
15567
|
+
}
|
|
15568
|
+
function SequencerBoard({
|
|
15569
|
+
entity,
|
|
15570
|
+
categoryColors,
|
|
15571
|
+
stepDurationMs = 1e3,
|
|
15572
|
+
playEvent,
|
|
15573
|
+
completeEvent,
|
|
15574
|
+
placeEvent,
|
|
15575
|
+
removeEvent,
|
|
15576
|
+
checkEvent,
|
|
15577
|
+
playAgainEvent,
|
|
15578
|
+
stepEvent,
|
|
15579
|
+
className
|
|
15580
|
+
}) {
|
|
15581
|
+
const { emit } = useEventBus();
|
|
15582
|
+
const { t } = useTranslate();
|
|
15583
|
+
const resolved = boardEntity(entity);
|
|
15584
|
+
const maxSlots = num(resolved?.maxSlots) || 3;
|
|
15585
|
+
const solutions = Array.isArray(resolved?.solutions) ? resolved.solutions : [];
|
|
15586
|
+
const availableActions = (Array.isArray(resolved?.availableActions) ? resolved.availableActions : []).reduce((acc, fv) => {
|
|
15587
|
+
const item = slotItemFromField(fv);
|
|
15588
|
+
if (item) acc.push(item);
|
|
15589
|
+
return acc;
|
|
15590
|
+
}, []);
|
|
15591
|
+
const allowDuplicates = resolved?.allowDuplicates !== false;
|
|
15592
|
+
const entitySlots = Array.isArray(resolved?.slots) ? resolved.slots : [];
|
|
15593
|
+
const entityResult = str(resolved?.result);
|
|
15594
|
+
const entityAttempts = num(resolved?.attempts);
|
|
15595
|
+
const entityCurrentStep = typeof resolved?.currentStep === "number" ? resolved.currentStep : -1;
|
|
15596
|
+
const slots = Array.from({ length: maxSlots }, (_, i) => {
|
|
15597
|
+
const entitySlot = entitySlots.find((s) => s.index === i);
|
|
15598
|
+
if (!entitySlot?.placedActionId) return void 0;
|
|
15599
|
+
return availableActions.find((a) => a.id === entitySlot.placedActionId);
|
|
15600
|
+
});
|
|
15601
|
+
const isSuccess = entityResult === "win";
|
|
15602
|
+
const attempts = entityAttempts;
|
|
15603
|
+
const isPlayingBack = entityCurrentStep >= 0 && !isSuccess;
|
|
15604
|
+
const currentStep = entityCurrentStep;
|
|
15605
|
+
const [headerError, setHeaderError] = useState(false);
|
|
15606
|
+
const [slotFeedback, setSlotFeedback] = useState(
|
|
15607
|
+
() => Array.from({ length: maxSlots }, () => null)
|
|
15608
|
+
);
|
|
15609
|
+
const timerRef = useRef(null);
|
|
15610
|
+
useEffect(() => () => {
|
|
15611
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15612
|
+
}, []);
|
|
15613
|
+
const handleSlotDrop = useCallback((index, item) => {
|
|
15614
|
+
setSlotFeedback((prev) => {
|
|
15615
|
+
const next = [...prev];
|
|
15616
|
+
next[index] = null;
|
|
15617
|
+
return next;
|
|
15618
|
+
});
|
|
15619
|
+
emit("UI:PLAY_SOUND", { key: "drop_slot" });
|
|
15620
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotIndex: index, actionId: item.id });
|
|
15621
|
+
}, [emit, placeEvent]);
|
|
15622
|
+
const handleSlotRemove = useCallback((index) => {
|
|
15623
|
+
setSlotFeedback((prev) => {
|
|
15624
|
+
const next = [...prev];
|
|
15625
|
+
next[index] = null;
|
|
15626
|
+
return next;
|
|
15627
|
+
});
|
|
15628
|
+
emit("UI:PLAY_SOUND", { key: "back" });
|
|
15629
|
+
if (removeEvent) emit(`UI:${removeEvent}`, { slotIndex: index });
|
|
15630
|
+
}, [emit, removeEvent]);
|
|
15631
|
+
const handleReset = useCallback(() => {
|
|
15632
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
15633
|
+
setSlotFeedback(Array.from({ length: maxSlots }, () => null));
|
|
15634
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
15635
|
+
}, [maxSlots, playAgainEvent, emit]);
|
|
15636
|
+
const filledSlots = slots.filter((s) => !!s);
|
|
15637
|
+
const canPlay = filledSlots.length > 0 && !isPlayingBack && !isSuccess;
|
|
15638
|
+
const handlePlay = useCallback(() => {
|
|
15639
|
+
if (!canPlay) return;
|
|
15640
|
+
setSlotFeedback(Array.from({ length: maxSlots }, () => null));
|
|
15641
|
+
emit("UI:PLAY_SOUND", { key: "confirm" });
|
|
15642
|
+
const sequence = slots.map((s) => s?.id || "");
|
|
15643
|
+
const playerIds = slots.filter(Boolean).map((s) => s?.id || "");
|
|
15644
|
+
if (playEvent) emit(`UI:${playEvent}`, { sequence });
|
|
15645
|
+
let step = 0;
|
|
15646
|
+
const advance = () => {
|
|
15647
|
+
step++;
|
|
15648
|
+
if (stepEvent) emit(`UI:${stepEvent}`, { step });
|
|
15649
|
+
if (step >= maxSlots) {
|
|
15650
|
+
if (checkEvent) emit(`UI:${checkEvent}`, { sequence: playerIds });
|
|
15651
|
+
const playerSeq = slots.map((s) => s?.id);
|
|
15652
|
+
const success = solutions.some(
|
|
15653
|
+
(sol) => sol.length === playerIds.length && sol.every((id, i) => id === playerIds[i])
|
|
15654
|
+
);
|
|
15655
|
+
if (success) {
|
|
15656
|
+
emit("UI:PLAY_SOUND", { key: "levelComplete" });
|
|
15657
|
+
if (completeEvent) emit(`UI:${completeEvent}`, { success: true, sequence: playerIds });
|
|
15658
|
+
} else {
|
|
15659
|
+
const feedback = computeSlotFeedback(playerSeq, solutions);
|
|
15660
|
+
setSlotFeedback(feedback);
|
|
15661
|
+
emit("UI:PLAY_SOUND", { key: "fail" });
|
|
15662
|
+
const correctCount2 = feedback.filter((f3) => f3 === "correct").length;
|
|
15663
|
+
for (let ci = 0; ci < correctCount2; ci++) {
|
|
15664
|
+
setTimeout(() => {
|
|
15665
|
+
emit("UI:PLAY_SOUND", { key: "correctSlot" });
|
|
15666
|
+
}, 300 + ci * 150);
|
|
15667
|
+
}
|
|
15668
|
+
}
|
|
15669
|
+
} else {
|
|
15670
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
15671
|
+
}
|
|
15672
|
+
};
|
|
15673
|
+
timerRef.current = setTimeout(advance, stepDurationMs);
|
|
15674
|
+
}, [canPlay, slots, maxSlots, solutions, stepDurationMs, playEvent, completeEvent, checkEvent, emit]);
|
|
15675
|
+
const machine = {
|
|
15676
|
+
name: str(resolved?.title),
|
|
15677
|
+
description: str(resolved?.description),
|
|
15678
|
+
states: slots.map((s, i) => stepLabel(s, i)),
|
|
15679
|
+
currentState: currentStep >= 0 ? stepLabel(slots[currentStep], currentStep) : "__idle__",
|
|
15680
|
+
transitions: slots.slice(0, -1).map((s, i) => ({
|
|
15681
|
+
from: stepLabel(s, i),
|
|
15682
|
+
to: stepLabel(slots[i + 1], i + 1),
|
|
15683
|
+
event: "NEXT"
|
|
15684
|
+
}))
|
|
15685
|
+
};
|
|
15686
|
+
const usedIds = !allowDuplicates ? slots.filter(Boolean).map((s) => s?.id || "") : [];
|
|
15687
|
+
const hint = str(resolved?.hint);
|
|
15688
|
+
const showHint = attempts >= 3 && !!hint;
|
|
15689
|
+
const hasFeedback = slotFeedback.some((f3) => f3 !== null);
|
|
15690
|
+
const correctCount = slotFeedback.filter((f3) => f3 === "correct").length;
|
|
15691
|
+
const encourageKey = ENCOURAGEMENT_KEYS[Math.min(attempts - 1, ENCOURAGEMENT_KEYS.length - 1)] ?? ENCOURAGEMENT_KEYS[0];
|
|
15692
|
+
if (!resolved) return null;
|
|
15693
|
+
const theme = resolved.theme ?? void 0;
|
|
15694
|
+
const themeBackground = theme?.background;
|
|
15695
|
+
const headerImage = str(resolved.headerImage);
|
|
15696
|
+
return /* @__PURE__ */ jsxs(
|
|
15697
|
+
VStack,
|
|
15698
|
+
{
|
|
15699
|
+
className: cn("p-4 gap-6", className),
|
|
15700
|
+
style: {
|
|
15701
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
15702
|
+
backgroundSize: "cover",
|
|
15703
|
+
backgroundPosition: "center"
|
|
15704
|
+
},
|
|
15705
|
+
children: [
|
|
15706
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
15707
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15708
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
15709
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) })
|
|
15710
|
+
] }),
|
|
15711
|
+
showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
15712
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
15713
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
15714
|
+
] }) }),
|
|
15715
|
+
filledSlots.length > 0 && /* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "linear", size: "md" }),
|
|
15716
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15717
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
15718
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("sequencer.yourSequence") + ":" }),
|
|
15719
|
+
hasFeedback && !isPlayingBack && !isSuccess && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
15720
|
+
`${correctCount}/${maxSlots} `,
|
|
15721
|
+
"\u2705"
|
|
15722
|
+
] })
|
|
15723
|
+
] }),
|
|
15724
|
+
/* @__PURE__ */ jsx(
|
|
15725
|
+
SequenceBar,
|
|
15726
|
+
{
|
|
15727
|
+
slots,
|
|
15728
|
+
maxSlots,
|
|
15729
|
+
onSlotDrop: handleSlotDrop,
|
|
15730
|
+
onSlotRemove: handleSlotRemove,
|
|
15731
|
+
playing: isPlayingBack,
|
|
15732
|
+
currentStep,
|
|
15733
|
+
categoryColors,
|
|
15734
|
+
slotFeedback,
|
|
15735
|
+
size: "lg"
|
|
15736
|
+
}
|
|
15737
|
+
)
|
|
15738
|
+
] }),
|
|
15739
|
+
!isPlayingBack && /* @__PURE__ */ jsx(
|
|
15740
|
+
ActionPalette,
|
|
15741
|
+
{
|
|
15742
|
+
actions: availableActions,
|
|
15743
|
+
usedActionIds: usedIds,
|
|
15744
|
+
allowDuplicates,
|
|
15745
|
+
categoryColors,
|
|
15746
|
+
label: t("sequencer.dragActions")
|
|
15747
|
+
}
|
|
15748
|
+
),
|
|
15749
|
+
hasFeedback && !isPlayingBack && !isSuccess && attempts > 0 && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: t(encourageKey) }) }),
|
|
15750
|
+
isSuccess && /* @__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("sequencer.levelComplete") }) }),
|
|
15751
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
15752
|
+
/* @__PURE__ */ jsx(
|
|
15753
|
+
Button,
|
|
15754
|
+
{
|
|
15755
|
+
variant: "primary",
|
|
15756
|
+
onClick: handlePlay,
|
|
15757
|
+
disabled: !canPlay,
|
|
15758
|
+
children: "\u25B6 " + t("game.play")
|
|
15759
|
+
}
|
|
15760
|
+
),
|
|
15761
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
15762
|
+
] })
|
|
15763
|
+
]
|
|
15764
|
+
}
|
|
15765
|
+
);
|
|
15766
|
+
}
|
|
15767
|
+
var ENCOURAGEMENT_KEYS, stepLabel;
|
|
15768
|
+
var init_SequencerBoard = __esm({
|
|
15769
|
+
"components/game/2d/organisms/SequencerBoard.tsx"() {
|
|
15770
|
+
init_atoms();
|
|
15771
|
+
init_cn();
|
|
15772
|
+
init_useEventBus();
|
|
15773
|
+
init_TraitStateViewer();
|
|
15774
|
+
init_boardEntity();
|
|
15775
|
+
init_SequenceBar();
|
|
15776
|
+
init_ActionPalette();
|
|
15777
|
+
ENCOURAGEMENT_KEYS = [
|
|
15778
|
+
"puzzle.tryAgain1",
|
|
15779
|
+
"puzzle.tryAgain2",
|
|
15780
|
+
"puzzle.tryAgain3"
|
|
15781
|
+
];
|
|
15782
|
+
stepLabel = (slot, i) => slot ? `${i + 1}. ${slot.name}` : `Step ${i + 1}`;
|
|
15783
|
+
SequencerBoard.displayName = "SequencerBoard";
|
|
15784
|
+
}
|
|
15785
|
+
});
|
|
15786
|
+
function RuleEditor({
|
|
15787
|
+
rule,
|
|
15788
|
+
availableEvents,
|
|
15789
|
+
availableActions,
|
|
15790
|
+
onChange,
|
|
15791
|
+
onRemove,
|
|
15792
|
+
disabled = false,
|
|
15793
|
+
className
|
|
15794
|
+
}) {
|
|
15795
|
+
const { t } = useTranslate();
|
|
15796
|
+
const handleWhenChange = useCallback((v) => {
|
|
15797
|
+
onChange({ ...rule, whenEvent: v });
|
|
15798
|
+
}, [rule, onChange]);
|
|
15799
|
+
const handleThenChange = useCallback((v) => {
|
|
15800
|
+
onChange({ ...rule, thenAction: v });
|
|
15801
|
+
}, [rule, onChange]);
|
|
15802
|
+
return /* @__PURE__ */ jsxs(HStack, { className: cn("items-center p-2 rounded-lg bg-muted/50 border border-border", className), gap: "sm", children: [
|
|
15803
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold whitespace-nowrap", children: t("eventHandler.when") }),
|
|
15804
|
+
/* @__PURE__ */ jsx(
|
|
15805
|
+
Select,
|
|
15806
|
+
{
|
|
15807
|
+
value: rule.whenEvent,
|
|
15808
|
+
onValueChange: handleWhenChange,
|
|
15809
|
+
options: availableEvents,
|
|
15810
|
+
disabled,
|
|
15811
|
+
className: "flex-1 min-w-0"
|
|
15812
|
+
}
|
|
15813
|
+
),
|
|
15814
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-bold whitespace-nowrap", children: "\u2192 " + t("eventHandler.then") }),
|
|
15815
|
+
/* @__PURE__ */ jsx(
|
|
15816
|
+
Select,
|
|
15817
|
+
{
|
|
15818
|
+
value: rule.thenAction,
|
|
15819
|
+
onValueChange: handleThenChange,
|
|
15820
|
+
options: availableActions,
|
|
15821
|
+
disabled,
|
|
15822
|
+
className: "flex-1 min-w-0"
|
|
15823
|
+
}
|
|
15824
|
+
),
|
|
15825
|
+
onRemove && /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: onRemove, disabled, className: "shrink-0", children: "\xD7" })
|
|
15826
|
+
] });
|
|
15827
|
+
}
|
|
15828
|
+
var init_RuleEditor = __esm({
|
|
15829
|
+
"components/game/2d/organisms/RuleEditor.tsx"() {
|
|
15830
|
+
init_atoms();
|
|
15831
|
+
init_cn();
|
|
15832
|
+
RuleEditor.displayName = "RuleEditor";
|
|
15833
|
+
}
|
|
15834
|
+
});
|
|
15302
15835
|
function EventLog({
|
|
15303
15836
|
entries,
|
|
15304
15837
|
maxHeight = 200,
|
|
@@ -15334,7 +15867,7 @@ function EventLog({
|
|
|
15334
15867
|
}
|
|
15335
15868
|
var STATUS_STYLES, STATUS_DOTS;
|
|
15336
15869
|
var init_EventLog = __esm({
|
|
15337
|
-
"components/game/2d/
|
|
15870
|
+
"components/game/2d/organisms/EventLog.tsx"() {
|
|
15338
15871
|
init_atoms();
|
|
15339
15872
|
init_cn();
|
|
15340
15873
|
STATUS_STYLES = {
|
|
@@ -15354,10 +15887,1644 @@ var init_EventLog = __esm({
|
|
|
15354
15887
|
});
|
|
15355
15888
|
|
|
15356
15889
|
// components/game/shared/lib/puzzleObject.ts
|
|
15890
|
+
function objId(o) {
|
|
15891
|
+
return o.id == null ? "" : String(o.id);
|
|
15892
|
+
}
|
|
15893
|
+
function objName(o) {
|
|
15894
|
+
return o.name == null ? "" : String(o.name);
|
|
15895
|
+
}
|
|
15896
|
+
function objIcon(o) {
|
|
15897
|
+
return o.icon == null ? "" : String(o.icon);
|
|
15898
|
+
}
|
|
15899
|
+
function objStates(o) {
|
|
15900
|
+
return Array.isArray(o.states) ? o.states : [];
|
|
15901
|
+
}
|
|
15902
|
+
function objCurrentState(o) {
|
|
15903
|
+
return o.currentState == null ? "" : String(o.currentState);
|
|
15904
|
+
}
|
|
15905
|
+
function objAvailableEvents(o) {
|
|
15906
|
+
return Array.isArray(o.availableEvents) ? o.availableEvents : [];
|
|
15907
|
+
}
|
|
15908
|
+
function objAvailableActions(o) {
|
|
15909
|
+
return Array.isArray(o.availableActions) ? o.availableActions : [];
|
|
15910
|
+
}
|
|
15911
|
+
function objRules(o) {
|
|
15912
|
+
return Array.isArray(o.rules) ? o.rules : [];
|
|
15913
|
+
}
|
|
15914
|
+
function objMaxRules(o) {
|
|
15915
|
+
const n = Number(o.maxRules);
|
|
15916
|
+
return Number.isFinite(n) && n > 0 ? n : 3;
|
|
15917
|
+
}
|
|
15357
15918
|
var init_puzzleObject = __esm({
|
|
15358
15919
|
"components/game/shared/lib/puzzleObject.ts"() {
|
|
15359
15920
|
}
|
|
15360
15921
|
});
|
|
15922
|
+
function ObjectRulePanel({
|
|
15923
|
+
object,
|
|
15924
|
+
onRulesChange,
|
|
15925
|
+
disabled = false,
|
|
15926
|
+
className
|
|
15927
|
+
}) {
|
|
15928
|
+
const { t } = useTranslate();
|
|
15929
|
+
const id = objId(object);
|
|
15930
|
+
const name = objName(object);
|
|
15931
|
+
const icon = objIcon(object);
|
|
15932
|
+
const states = objStates(object);
|
|
15933
|
+
const currentState = objCurrentState(object);
|
|
15934
|
+
const availableEvents = objAvailableEvents(object);
|
|
15935
|
+
const availableActions = objAvailableActions(object);
|
|
15936
|
+
const rules = objRules(object);
|
|
15937
|
+
const maxRules = objMaxRules(object);
|
|
15938
|
+
const canAdd = rules.length < maxRules;
|
|
15939
|
+
const handleRuleChange = useCallback((index, updatedRule) => {
|
|
15940
|
+
const newRules = [...rules];
|
|
15941
|
+
newRules[index] = updatedRule;
|
|
15942
|
+
onRulesChange(id, newRules);
|
|
15943
|
+
}, [id, rules, onRulesChange]);
|
|
15944
|
+
const handleRuleRemove = useCallback((index) => {
|
|
15945
|
+
const newRules = rules.filter((_, i) => i !== index);
|
|
15946
|
+
onRulesChange(id, newRules);
|
|
15947
|
+
}, [id, rules, onRulesChange]);
|
|
15948
|
+
const handleAddRule = useCallback(() => {
|
|
15949
|
+
if (!canAdd || disabled) return;
|
|
15950
|
+
const firstEvent = availableEvents[0]?.value || "";
|
|
15951
|
+
const firstAction = availableActions[0]?.value || "";
|
|
15952
|
+
const newRule = {
|
|
15953
|
+
id: `rule-${nextRuleId++}`,
|
|
15954
|
+
whenEvent: firstEvent,
|
|
15955
|
+
thenAction: firstAction
|
|
15956
|
+
};
|
|
15957
|
+
onRulesChange(id, [...rules, newRule]);
|
|
15958
|
+
}, [canAdd, disabled, id, rules, availableEvents, availableActions, onRulesChange]);
|
|
15959
|
+
const machine = {
|
|
15960
|
+
name,
|
|
15961
|
+
states,
|
|
15962
|
+
currentState,
|
|
15963
|
+
transitions: rules.map((r2) => ({
|
|
15964
|
+
from: currentState,
|
|
15965
|
+
to: states.find((s) => s !== currentState) || currentState,
|
|
15966
|
+
event: r2.whenEvent
|
|
15967
|
+
}))
|
|
15968
|
+
};
|
|
15969
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("p-4 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
15970
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center", gap: "sm", children: [
|
|
15971
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: icon }),
|
|
15972
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
15973
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-bold", children: name }),
|
|
15974
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("eventHandler.state") + ": " + currentState })
|
|
15975
|
+
] })
|
|
15976
|
+
] }),
|
|
15977
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "compact", size: "sm" }),
|
|
15978
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
15979
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("eventHandler.rules", { count: rules.length, max: maxRules }) + ":" }),
|
|
15980
|
+
rules.map((rule, i) => /* @__PURE__ */ jsx(
|
|
15981
|
+
RuleEditor,
|
|
15982
|
+
{
|
|
15983
|
+
rule,
|
|
15984
|
+
availableEvents,
|
|
15985
|
+
availableActions,
|
|
15986
|
+
onChange: (r2) => handleRuleChange(i, r2),
|
|
15987
|
+
onRemove: () => handleRuleRemove(i),
|
|
15988
|
+
disabled
|
|
15989
|
+
},
|
|
15990
|
+
rule.id
|
|
15991
|
+
)),
|
|
15992
|
+
canAdd && !disabled && /* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleAddRule, className: "self-start", children: t("eventHandler.addRule") })
|
|
15993
|
+
] })
|
|
15994
|
+
] });
|
|
15995
|
+
}
|
|
15996
|
+
var nextRuleId;
|
|
15997
|
+
var init_ObjectRulePanel = __esm({
|
|
15998
|
+
"components/game/2d/organisms/ObjectRulePanel.tsx"() {
|
|
15999
|
+
init_atoms();
|
|
16000
|
+
init_cn();
|
|
16001
|
+
init_TraitStateViewer();
|
|
16002
|
+
init_RuleEditor();
|
|
16003
|
+
init_puzzleObject();
|
|
16004
|
+
nextRuleId = 1;
|
|
16005
|
+
ObjectRulePanel.displayName = "ObjectRulePanel";
|
|
16006
|
+
}
|
|
16007
|
+
});
|
|
16008
|
+
function EventHandlerBoard({
|
|
16009
|
+
entity,
|
|
16010
|
+
stepDurationMs = 800,
|
|
16011
|
+
playEvent,
|
|
16012
|
+
completeEvent,
|
|
16013
|
+
editRuleEvent,
|
|
16014
|
+
playAgainEvent,
|
|
16015
|
+
className
|
|
16016
|
+
}) {
|
|
16017
|
+
const { emit } = useEventBus();
|
|
16018
|
+
const { t } = useTranslate();
|
|
16019
|
+
const resolved = boardEntity(entity);
|
|
16020
|
+
const objects = rows(resolved?.objects);
|
|
16021
|
+
const entityResult = str(resolved?.result) || "none";
|
|
16022
|
+
const isSuccess = entityResult === "win";
|
|
16023
|
+
const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
|
|
16024
|
+
const [selectedObjectId, setSelectedObjectId] = useState(
|
|
16025
|
+
objects[0] ? objId(objects[0]) : null
|
|
16026
|
+
);
|
|
16027
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16028
|
+
const [isPlaying, setIsPlaying] = useState(false);
|
|
16029
|
+
const [eventLog, setEventLog] = useState([]);
|
|
16030
|
+
const timerRef = useRef(null);
|
|
16031
|
+
const logIdCounter = useRef(0);
|
|
16032
|
+
useEffect(() => () => {
|
|
16033
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16034
|
+
}, []);
|
|
16035
|
+
const selectedObject = objects.find((o) => objId(o) === selectedObjectId) ?? null;
|
|
16036
|
+
const handleRulesChange = useCallback((objectId, rules) => {
|
|
16037
|
+
if (editRuleEvent) emit(`UI:${editRuleEvent}`, { objectId, rules });
|
|
16038
|
+
}, [editRuleEvent, emit]);
|
|
16039
|
+
const addLogEntry = useCallback((icon, message, status = "done") => {
|
|
16040
|
+
const id = `log-${logIdCounter.current++}`;
|
|
16041
|
+
setEventLog((prev) => [...prev, { id, timestamp: Date.now(), icon, message, status }]);
|
|
16042
|
+
}, []);
|
|
16043
|
+
const handlePlay = useCallback(() => {
|
|
16044
|
+
if (isPlaying || isSuccess) return;
|
|
16045
|
+
if (playEvent) emit(`UI:${playEvent}`, {});
|
|
16046
|
+
setIsPlaying(true);
|
|
16047
|
+
setEventLog([]);
|
|
16048
|
+
const allRules = [];
|
|
16049
|
+
objects.forEach((obj) => {
|
|
16050
|
+
objRules(obj).forEach((rule) => {
|
|
16051
|
+
allRules.push({ object: obj, rule });
|
|
16052
|
+
});
|
|
16053
|
+
});
|
|
16054
|
+
const triggers = Array.isArray(resolved?.triggerEvents) ? resolved.triggerEvents : [];
|
|
16055
|
+
const goalEvent = str(resolved?.goalEvent);
|
|
16056
|
+
const eventQueue = [...triggers];
|
|
16057
|
+
const firedEvents = /* @__PURE__ */ new Set();
|
|
16058
|
+
let stepIdx = 0;
|
|
16059
|
+
let goalReached = false;
|
|
16060
|
+
const processNext = () => {
|
|
16061
|
+
if (eventQueue.length === 0 || stepIdx > 20) {
|
|
16062
|
+
setIsPlaying(false);
|
|
16063
|
+
if (goalReached && completeEvent) emit(`UI:${completeEvent}`, { success: true });
|
|
16064
|
+
return;
|
|
16065
|
+
}
|
|
16066
|
+
const currentEvent = eventQueue.shift();
|
|
16067
|
+
if (firedEvents.has(currentEvent)) {
|
|
16068
|
+
timerRef.current = setTimeout(processNext, 100);
|
|
16069
|
+
return;
|
|
16070
|
+
}
|
|
16071
|
+
firedEvents.add(currentEvent);
|
|
16072
|
+
const matching = allRules.filter((r2) => r2.rule.whenEvent === currentEvent);
|
|
16073
|
+
if (matching.length === 0) {
|
|
16074
|
+
addLogEntry("\u26A1", t("eventHandler.noListeners", { event: currentEvent }), "done");
|
|
16075
|
+
} else {
|
|
16076
|
+
matching.forEach(({ object, rule }) => {
|
|
16077
|
+
addLogEntry(objIcon(object), t("eventHandler.heardEvent", { object: objName(object), event: currentEvent, action: rule.thenAction }), "done");
|
|
16078
|
+
eventQueue.push(rule.thenAction);
|
|
16079
|
+
if (rule.thenAction === goalEvent) {
|
|
16080
|
+
goalReached = true;
|
|
16081
|
+
}
|
|
16082
|
+
});
|
|
16083
|
+
}
|
|
16084
|
+
if (currentEvent === goalEvent) {
|
|
16085
|
+
goalReached = true;
|
|
16086
|
+
}
|
|
16087
|
+
stepIdx++;
|
|
16088
|
+
timerRef.current = setTimeout(processNext, stepDurationMs);
|
|
16089
|
+
};
|
|
16090
|
+
if (triggers.length > 0) {
|
|
16091
|
+
addLogEntry("\u{1F3AC}", t("eventHandler.simulationStarted", { events: triggers.join(", ") }), "active");
|
|
16092
|
+
}
|
|
16093
|
+
timerRef.current = setTimeout(processNext, stepDurationMs);
|
|
16094
|
+
}, [isPlaying, isSuccess, objects, resolved, stepDurationMs, playEvent, completeEvent, emit, addLogEntry, t]);
|
|
16095
|
+
const handleTryAgain = useCallback(() => {
|
|
16096
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16097
|
+
setIsPlaying(false);
|
|
16098
|
+
setEventLog([]);
|
|
16099
|
+
}, []);
|
|
16100
|
+
const handleReset = useCallback(() => {
|
|
16101
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16102
|
+
setIsPlaying(false);
|
|
16103
|
+
setEventLog([]);
|
|
16104
|
+
setSelectedObjectId(objects[0] ? objId(objects[0]) : null);
|
|
16105
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16106
|
+
}, [objects, playAgainEvent, emit]);
|
|
16107
|
+
if (!resolved) return null;
|
|
16108
|
+
const objectViewers = objects.map((obj) => {
|
|
16109
|
+
const states = objStates(obj);
|
|
16110
|
+
const currentState = objCurrentState(obj);
|
|
16111
|
+
const machine = {
|
|
16112
|
+
name: objName(obj),
|
|
16113
|
+
states,
|
|
16114
|
+
currentState,
|
|
16115
|
+
transitions: objRules(obj).map((r2) => ({
|
|
16116
|
+
from: currentState,
|
|
16117
|
+
to: states.find((s) => s !== currentState) || currentState,
|
|
16118
|
+
event: r2.whenEvent
|
|
16119
|
+
}))
|
|
16120
|
+
};
|
|
16121
|
+
return { obj, machine };
|
|
16122
|
+
});
|
|
16123
|
+
const hint = str(resolved.hint);
|
|
16124
|
+
const showHint = attempts >= 3 && hint;
|
|
16125
|
+
const theme = resolved.theme ?? void 0;
|
|
16126
|
+
const themeBackground = theme?.background;
|
|
16127
|
+
const headerImage = str(resolved.headerImage);
|
|
16128
|
+
const encourageKey = ENCOURAGEMENT_KEYS2[Math.min(attempts - 1, ENCOURAGEMENT_KEYS2.length - 1)] ?? ENCOURAGEMENT_KEYS2[0];
|
|
16129
|
+
return /* @__PURE__ */ jsxs(
|
|
16130
|
+
VStack,
|
|
16131
|
+
{
|
|
16132
|
+
className: cn("p-4 gap-6", className),
|
|
16133
|
+
style: {
|
|
16134
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16135
|
+
backgroundSize: "cover",
|
|
16136
|
+
backgroundPosition: "center"
|
|
16137
|
+
},
|
|
16138
|
+
children: [
|
|
16139
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16140
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
16141
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
16142
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
|
|
16143
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-primary/10 border border-primary/30", gap: "xs", children: [
|
|
16144
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-primary font-bold", children: t("game.goal") + ":" }),
|
|
16145
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: str(resolved.goalCondition) })
|
|
16146
|
+
] })
|
|
16147
|
+
] }),
|
|
16148
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16149
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("eventHandler.clickObject") + ":" }),
|
|
16150
|
+
/* @__PURE__ */ jsx(HStack, { className: "flex-wrap", gap: "sm", children: objectViewers.map(({ obj, machine }) => {
|
|
16151
|
+
const oid = objId(obj);
|
|
16152
|
+
return /* @__PURE__ */ jsx(
|
|
16153
|
+
Box,
|
|
16154
|
+
{
|
|
16155
|
+
className: cn(
|
|
16156
|
+
"p-3 rounded-container border-2 cursor-pointer transition-all hover:scale-105",
|
|
16157
|
+
selectedObjectId === oid ? "border-primary bg-primary/10" : "border-border bg-card hover:border-muted-foreground"
|
|
16158
|
+
),
|
|
16159
|
+
onClick: () => setSelectedObjectId(oid),
|
|
16160
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "items-center min-w-[120px]", children: [
|
|
16161
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h5", children: objIcon(obj) }),
|
|
16162
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground font-medium", children: objName(obj) }),
|
|
16163
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "compact", size: "sm" })
|
|
16164
|
+
] })
|
|
16165
|
+
},
|
|
16166
|
+
oid
|
|
16167
|
+
);
|
|
16168
|
+
}) })
|
|
16169
|
+
] }),
|
|
16170
|
+
selectedObject && /* @__PURE__ */ jsx(
|
|
16171
|
+
ObjectRulePanel,
|
|
16172
|
+
{
|
|
16173
|
+
object: selectedObject,
|
|
16174
|
+
onRulesChange: handleRulesChange,
|
|
16175
|
+
disabled: isPlaying
|
|
16176
|
+
}
|
|
16177
|
+
),
|
|
16178
|
+
eventLog.length > 0 && /* @__PURE__ */ jsx(EventLog, { entries: eventLog }),
|
|
16179
|
+
isSuccess && /* @__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("eventHandler.chainComplete") }) }),
|
|
16180
|
+
!isPlaying && !isSuccess && attempts > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16181
|
+
/* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(encourageKey) }) }),
|
|
16182
|
+
showHint && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
16183
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
16184
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
16185
|
+
] }) })
|
|
16186
|
+
] }),
|
|
16187
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
16188
|
+
!isPlaying && !isSuccess && attempts > 0 ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
|
|
16189
|
+
Button,
|
|
16190
|
+
{
|
|
16191
|
+
variant: "primary",
|
|
16192
|
+
onClick: handlePlay,
|
|
16193
|
+
disabled: isPlaying || isSuccess,
|
|
16194
|
+
children: "\u25B6 " + t("game.play")
|
|
16195
|
+
}
|
|
16196
|
+
),
|
|
16197
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
16198
|
+
] })
|
|
16199
|
+
]
|
|
16200
|
+
}
|
|
16201
|
+
);
|
|
16202
|
+
}
|
|
16203
|
+
var ENCOURAGEMENT_KEYS2;
|
|
16204
|
+
var init_EventHandlerBoard = __esm({
|
|
16205
|
+
"components/game/2d/organisms/EventHandlerBoard.tsx"() {
|
|
16206
|
+
init_atoms();
|
|
16207
|
+
init_cn();
|
|
16208
|
+
init_useEventBus();
|
|
16209
|
+
init_TraitStateViewer();
|
|
16210
|
+
init_ObjectRulePanel();
|
|
16211
|
+
init_EventLog();
|
|
16212
|
+
init_puzzleObject();
|
|
16213
|
+
init_boardEntity();
|
|
16214
|
+
ENCOURAGEMENT_KEYS2 = [
|
|
16215
|
+
"puzzle.tryAgain1",
|
|
16216
|
+
"puzzle.tryAgain2",
|
|
16217
|
+
"puzzle.tryAgain3"
|
|
16218
|
+
];
|
|
16219
|
+
EventHandlerBoard.displayName = "EventHandlerBoard";
|
|
16220
|
+
}
|
|
16221
|
+
});
|
|
16222
|
+
function VariablePanel({
|
|
16223
|
+
entityName,
|
|
16224
|
+
variables,
|
|
16225
|
+
className
|
|
16226
|
+
}) {
|
|
16227
|
+
const { t } = useTranslate();
|
|
16228
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("p-3 rounded-lg bg-card border border-border", className), gap: "sm", children: [
|
|
16229
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.variables", { name: entityName }) }),
|
|
16230
|
+
variables.map((v) => {
|
|
16231
|
+
const name = v.name == null ? "" : String(v.name);
|
|
16232
|
+
const value = numField(v.value);
|
|
16233
|
+
const max = numField(v.max, 100);
|
|
16234
|
+
const min = numField(v.min, 0);
|
|
16235
|
+
const unit = v.unit == null ? "" : String(v.unit);
|
|
16236
|
+
const pct = Math.round((value - min) / (max - min) * 100);
|
|
16237
|
+
const isHigh = pct > 80;
|
|
16238
|
+
const isLow = pct < 20;
|
|
16239
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
16240
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
16241
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground font-medium", children: name }),
|
|
16242
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: cn(
|
|
16243
|
+
isHigh ? "text-error" : isLow ? "text-warning" : "text-foreground"
|
|
16244
|
+
), children: [
|
|
16245
|
+
value,
|
|
16246
|
+
unit,
|
|
16247
|
+
" / ",
|
|
16248
|
+
max,
|
|
16249
|
+
unit
|
|
16250
|
+
] })
|
|
16251
|
+
] }),
|
|
16252
|
+
/* @__PURE__ */ jsx(
|
|
16253
|
+
ProgressBar,
|
|
16254
|
+
{
|
|
16255
|
+
value: pct,
|
|
16256
|
+
color: isHigh ? "danger" : isLow ? "warning" : "primary",
|
|
16257
|
+
size: "sm"
|
|
16258
|
+
}
|
|
16259
|
+
)
|
|
16260
|
+
] }, name);
|
|
16261
|
+
})
|
|
16262
|
+
] });
|
|
16263
|
+
}
|
|
16264
|
+
var numField;
|
|
16265
|
+
var init_VariablePanel = __esm({
|
|
16266
|
+
"components/game/2d/organisms/VariablePanel.tsx"() {
|
|
16267
|
+
init_atoms();
|
|
16268
|
+
init_cn();
|
|
16269
|
+
numField = (v, fallback = 0) => {
|
|
16270
|
+
const n = Number(v);
|
|
16271
|
+
return Number.isFinite(n) ? n : fallback;
|
|
16272
|
+
};
|
|
16273
|
+
VariablePanel.displayName = "VariablePanel";
|
|
16274
|
+
}
|
|
16275
|
+
});
|
|
16276
|
+
function StateJsonView({
|
|
16277
|
+
data,
|
|
16278
|
+
label,
|
|
16279
|
+
defaultExpanded = false,
|
|
16280
|
+
className
|
|
16281
|
+
}) {
|
|
16282
|
+
const { t } = useTranslate();
|
|
16283
|
+
const [expanded, setExpanded] = useState(defaultExpanded);
|
|
16284
|
+
const jsonString = JSON.stringify(data, null, 2);
|
|
16285
|
+
return /* @__PURE__ */ jsxs(VStack, { className: cn("rounded-lg border border-border overflow-hidden", className), gap: "none", children: [
|
|
16286
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between p-2 bg-muted", gap: "sm", children: [
|
|
16287
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: label ?? t("stateArchitect.viewCode") }),
|
|
16288
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: () => setExpanded(!expanded), className: "text-xs", children: expanded ? t("stateArchitect.hideJson") : t("stateArchitect.showJson") })
|
|
16289
|
+
] }),
|
|
16290
|
+
expanded && /* @__PURE__ */ jsx(Box, { className: "p-3 bg-background overflow-x-auto", children: /* @__PURE__ */ jsx(
|
|
16291
|
+
Typography,
|
|
16292
|
+
{
|
|
16293
|
+
variant: "caption",
|
|
16294
|
+
className: "text-foreground font-mono whitespace-pre text-xs leading-relaxed block",
|
|
16295
|
+
children: jsonString
|
|
16296
|
+
}
|
|
16297
|
+
) })
|
|
16298
|
+
] });
|
|
16299
|
+
}
|
|
16300
|
+
var init_StateJsonView = __esm({
|
|
16301
|
+
"components/game/2d/organisms/StateJsonView.tsx"() {
|
|
16302
|
+
init_atoms();
|
|
16303
|
+
init_cn();
|
|
16304
|
+
StateJsonView.displayName = "StateJsonView";
|
|
16305
|
+
}
|
|
16306
|
+
});
|
|
16307
|
+
function layoutStates2(states, width, height) {
|
|
16308
|
+
const cx = width / 2;
|
|
16309
|
+
const cy = height / 2;
|
|
16310
|
+
const radius = Math.min(cx, cy) - 60;
|
|
16311
|
+
const positions = {};
|
|
16312
|
+
states.forEach((state, i) => {
|
|
16313
|
+
const angle = 2 * Math.PI * i / states.length - Math.PI / 2;
|
|
16314
|
+
positions[state] = {
|
|
16315
|
+
x: cx + radius * Math.cos(angle),
|
|
16316
|
+
y: cy + radius * Math.sin(angle)
|
|
16317
|
+
};
|
|
16318
|
+
});
|
|
16319
|
+
return positions;
|
|
16320
|
+
}
|
|
16321
|
+
function StateArchitectBoard({
|
|
16322
|
+
entity,
|
|
16323
|
+
stepDurationMs = 600,
|
|
16324
|
+
testEvent,
|
|
16325
|
+
completeEvent,
|
|
16326
|
+
addTransitionEvent,
|
|
16327
|
+
removeTransitionEvent,
|
|
16328
|
+
playAgainEvent,
|
|
16329
|
+
className
|
|
16330
|
+
}) {
|
|
16331
|
+
const { emit } = useEventBus();
|
|
16332
|
+
const { t } = useTranslate();
|
|
16333
|
+
const resolved = boardEntity(entity);
|
|
16334
|
+
const entityStates = Array.isArray(resolved?.states) ? resolved.states : [];
|
|
16335
|
+
const initialState = str(resolved?.initialState);
|
|
16336
|
+
const entityName = str(resolved?.entityName);
|
|
16337
|
+
const availableEvents = Array.isArray(resolved?.availableEvents) ? resolved.availableEvents : [];
|
|
16338
|
+
const testCases = (Array.isArray(resolved?.testCases) ? resolved.testCases : []).map((item) => {
|
|
16339
|
+
const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
|
|
16340
|
+
const eventsField = o["events"];
|
|
16341
|
+
return {
|
|
16342
|
+
events: Array.isArray(eventsField) ? eventsField : [],
|
|
16343
|
+
expectedState: str(o["expectedState"]),
|
|
16344
|
+
label: str(o["label"])
|
|
16345
|
+
};
|
|
16346
|
+
});
|
|
16347
|
+
const entityTransitions = (Array.isArray(resolved?.transitions) ? resolved.transitions : []).map((item) => {
|
|
16348
|
+
const o = typeof item === "object" && item !== null && !Array.isArray(item) ? item : {};
|
|
16349
|
+
return {
|
|
16350
|
+
id: str(o["id"]),
|
|
16351
|
+
from: str(o["from"]),
|
|
16352
|
+
to: str(o["to"]),
|
|
16353
|
+
event: str(o["event"]),
|
|
16354
|
+
...o["guardHint"] ? { guardHint: str(o["guardHint"]) } : {}
|
|
16355
|
+
};
|
|
16356
|
+
});
|
|
16357
|
+
const entityVariables = rows(resolved?.variables);
|
|
16358
|
+
const transitions = entityTransitions;
|
|
16359
|
+
const attempts = typeof resolved?.attempts === "number" ? resolved.attempts : 0;
|
|
16360
|
+
const entityResult = str(resolved?.result) || "none";
|
|
16361
|
+
const isSuccess = entityResult === "win";
|
|
16362
|
+
const [isTesting, setIsTesting] = useState(false);
|
|
16363
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16364
|
+
const [currentState, setCurrentState] = useState(initialState);
|
|
16365
|
+
const [selectedState, setSelectedState] = useState(null);
|
|
16366
|
+
const [testResults, setTestResults] = useState([]);
|
|
16367
|
+
const [variables, setVariables] = useState(() => [...entityVariables]);
|
|
16368
|
+
const timerRef = useRef(null);
|
|
16369
|
+
const [addingFrom, setAddingFrom] = useState(null);
|
|
16370
|
+
useEffect(() => () => {
|
|
16371
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16372
|
+
}, []);
|
|
16373
|
+
const GRAPH_W = 500;
|
|
16374
|
+
const GRAPH_H = 400;
|
|
16375
|
+
const positions = useMemo(() => layoutStates2(entityStates, GRAPH_W, GRAPH_H), [entityStates]);
|
|
16376
|
+
const handleStateClick = useCallback((state) => {
|
|
16377
|
+
if (isTesting) return;
|
|
16378
|
+
if (addingFrom) {
|
|
16379
|
+
if (addingFrom !== state) {
|
|
16380
|
+
const event = availableEvents[0] || "EVENT";
|
|
16381
|
+
const newTrans = {
|
|
16382
|
+
id: `t-${nextTransId++}`,
|
|
16383
|
+
from: addingFrom,
|
|
16384
|
+
to: state,
|
|
16385
|
+
event
|
|
16386
|
+
};
|
|
16387
|
+
if (addTransitionEvent) emit(`UI:${addTransitionEvent}`, { id: newTrans.id, from: newTrans.from, to: newTrans.to, event: newTrans.event });
|
|
16388
|
+
}
|
|
16389
|
+
setAddingFrom(null);
|
|
16390
|
+
} else {
|
|
16391
|
+
setSelectedState(state);
|
|
16392
|
+
}
|
|
16393
|
+
}, [isTesting, addingFrom, availableEvents, addTransitionEvent, emit]);
|
|
16394
|
+
const handleStartAddTransition = useCallback(() => {
|
|
16395
|
+
if (!selectedState) return;
|
|
16396
|
+
setAddingFrom(selectedState);
|
|
16397
|
+
}, [selectedState]);
|
|
16398
|
+
const handleRemoveTransition = useCallback((transId) => {
|
|
16399
|
+
if (removeTransitionEvent) emit(`UI:${removeTransitionEvent}`, { id: transId });
|
|
16400
|
+
}, [removeTransitionEvent, emit]);
|
|
16401
|
+
const machine = useMemo(() => ({
|
|
16402
|
+
name: entityName,
|
|
16403
|
+
description: str(resolved?.description),
|
|
16404
|
+
states: entityStates,
|
|
16405
|
+
currentState,
|
|
16406
|
+
transitions: transitions.map((t2) => ({
|
|
16407
|
+
from: t2.from,
|
|
16408
|
+
to: t2.to,
|
|
16409
|
+
event: t2.event,
|
|
16410
|
+
guardHint: t2.guardHint
|
|
16411
|
+
}))
|
|
16412
|
+
}), [entityName, resolved, entityStates, currentState, transitions]);
|
|
16413
|
+
const handleTest = useCallback(() => {
|
|
16414
|
+
if (isTesting) return;
|
|
16415
|
+
if (testEvent) emit(`UI:${testEvent}`, {});
|
|
16416
|
+
setIsTesting(true);
|
|
16417
|
+
setTestResults([]);
|
|
16418
|
+
const results = [];
|
|
16419
|
+
let testIdx = 0;
|
|
16420
|
+
const runNextTest = () => {
|
|
16421
|
+
if (testIdx >= testCases.length) {
|
|
16422
|
+
const allPassed = results.every((r2) => r2.passed);
|
|
16423
|
+
setIsTesting(false);
|
|
16424
|
+
setTestResults(results);
|
|
16425
|
+
if (allPassed && completeEvent) {
|
|
16426
|
+
emit(`UI:${completeEvent}`, {
|
|
16427
|
+
success: true,
|
|
16428
|
+
passedTests: results.filter((r2) => r2.passed).length
|
|
16429
|
+
});
|
|
16430
|
+
}
|
|
16431
|
+
return;
|
|
16432
|
+
}
|
|
16433
|
+
const testCase = testCases[testIdx];
|
|
16434
|
+
if (!testCase) return;
|
|
16435
|
+
let state = initialState;
|
|
16436
|
+
for (const event of testCase.events) {
|
|
16437
|
+
const trans = transitions.find((t2) => t2.from === state && t2.event === event);
|
|
16438
|
+
if (trans) {
|
|
16439
|
+
state = trans.to;
|
|
16440
|
+
}
|
|
16441
|
+
}
|
|
16442
|
+
setCurrentState(state);
|
|
16443
|
+
results.push({
|
|
16444
|
+
label: testCase.label,
|
|
16445
|
+
passed: state === testCase.expectedState,
|
|
16446
|
+
actualState: state,
|
|
16447
|
+
expectedState: testCase.expectedState
|
|
16448
|
+
});
|
|
16449
|
+
testIdx++;
|
|
16450
|
+
timerRef.current = setTimeout(runNextTest, stepDurationMs);
|
|
16451
|
+
};
|
|
16452
|
+
timerRef.current = setTimeout(runNextTest, stepDurationMs);
|
|
16453
|
+
}, [isTesting, transitions, testCases, initialState, stepDurationMs, testEvent, completeEvent, emit]);
|
|
16454
|
+
const handleTryAgain = useCallback(() => {
|
|
16455
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16456
|
+
setIsTesting(false);
|
|
16457
|
+
setCurrentState(initialState);
|
|
16458
|
+
setTestResults([]);
|
|
16459
|
+
}, [initialState]);
|
|
16460
|
+
const handleReset = useCallback(() => {
|
|
16461
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
16462
|
+
setIsTesting(false);
|
|
16463
|
+
setCurrentState(initialState);
|
|
16464
|
+
setTestResults([]);
|
|
16465
|
+
setVariables([...entityVariables]);
|
|
16466
|
+
setSelectedState(null);
|
|
16467
|
+
setAddingFrom(null);
|
|
16468
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16469
|
+
}, [initialState, entityVariables, playAgainEvent, emit]);
|
|
16470
|
+
const codeData = useMemo(() => ({
|
|
16471
|
+
name: entityName,
|
|
16472
|
+
states: entityStates,
|
|
16473
|
+
initialState,
|
|
16474
|
+
transitions: transitions.map((t2) => ({
|
|
16475
|
+
from: t2.from,
|
|
16476
|
+
to: t2.to,
|
|
16477
|
+
event: t2.event,
|
|
16478
|
+
...t2.guardHint ? { guard: t2.guardHint } : {}
|
|
16479
|
+
}))
|
|
16480
|
+
}), [entityName, entityStates, initialState, transitions]);
|
|
16481
|
+
if (!resolved) return null;
|
|
16482
|
+
const theme = resolved.theme ?? void 0;
|
|
16483
|
+
const themeBackground = theme?.background;
|
|
16484
|
+
const headerImage = str(resolved.headerImage);
|
|
16485
|
+
const hint = str(resolved.hint);
|
|
16486
|
+
return /* @__PURE__ */ jsxs(
|
|
16487
|
+
VStack,
|
|
16488
|
+
{
|
|
16489
|
+
className: cn("p-4 gap-6", className),
|
|
16490
|
+
style: {
|
|
16491
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16492
|
+
backgroundSize: "cover",
|
|
16493
|
+
backgroundPosition: "center"
|
|
16494
|
+
},
|
|
16495
|
+
children: [
|
|
16496
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16497
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
16498
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-foreground", children: str(resolved.title) }),
|
|
16499
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground", children: str(resolved.description) }),
|
|
16500
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center p-2 rounded bg-warning/10 border border-warning/30", gap: "xs", children: [
|
|
16501
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-warning font-bold", children: t("game.hint") + ":" }),
|
|
16502
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: hint })
|
|
16503
|
+
] })
|
|
16504
|
+
] }),
|
|
16505
|
+
/* @__PURE__ */ jsxs(HStack, { className: "flex-wrap items-start", gap: "lg", children: [
|
|
16506
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "flex-1 min-w-[300px]", children: [
|
|
16507
|
+
/* @__PURE__ */ jsxs(HStack, { className: "items-center justify-between", children: [
|
|
16508
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.graph") }),
|
|
16509
|
+
addingFrom && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent animate-pulse", children: t("stateArchitect.clickTarget", { state: addingFrom || "" }) })
|
|
16510
|
+
] }),
|
|
16511
|
+
/* @__PURE__ */ jsxs(
|
|
16512
|
+
Box,
|
|
16513
|
+
{
|
|
16514
|
+
position: "relative",
|
|
16515
|
+
className: "rounded-container border border-border bg-background overflow-hidden",
|
|
16516
|
+
style: { width: GRAPH_W, height: GRAPH_H },
|
|
16517
|
+
children: [
|
|
16518
|
+
/* @__PURE__ */ jsxs(
|
|
16519
|
+
"svg",
|
|
16520
|
+
{
|
|
16521
|
+
width: GRAPH_W,
|
|
16522
|
+
height: GRAPH_H,
|
|
16523
|
+
className: "absolute inset-0",
|
|
16524
|
+
style: { pointerEvents: "none" },
|
|
16525
|
+
children: [
|
|
16526
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
16527
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-border)" }) }),
|
|
16528
|
+
/* @__PURE__ */ jsx("marker", { id: "arrowhead-active", markerWidth: "10", markerHeight: "7", refX: "10", refY: "3.5", orient: "auto", children: /* @__PURE__ */ jsx("polygon", { points: "0 0, 10 3.5, 0 7", fill: "var(--color-primary)" }) })
|
|
16529
|
+
] }),
|
|
16530
|
+
transitions.map((t2) => {
|
|
16531
|
+
const fromPos = positions[t2.from];
|
|
16532
|
+
const toPos = positions[t2.to];
|
|
16533
|
+
if (!fromPos || !toPos) return null;
|
|
16534
|
+
const isActive = t2.from === currentState;
|
|
16535
|
+
return /* @__PURE__ */ jsx(
|
|
16536
|
+
TransitionArrow,
|
|
16537
|
+
{
|
|
16538
|
+
from: fromPos,
|
|
16539
|
+
to: toPos,
|
|
16540
|
+
eventLabel: t2.event,
|
|
16541
|
+
guardHint: t2.guardHint,
|
|
16542
|
+
isActive
|
|
16543
|
+
},
|
|
16544
|
+
t2.id
|
|
16545
|
+
);
|
|
16546
|
+
})
|
|
16547
|
+
]
|
|
16548
|
+
}
|
|
16549
|
+
),
|
|
16550
|
+
entityStates.map((state) => /* @__PURE__ */ jsx(
|
|
16551
|
+
StateNode,
|
|
16552
|
+
{
|
|
16553
|
+
name: state,
|
|
16554
|
+
position: positions[state],
|
|
16555
|
+
isCurrent: state === currentState,
|
|
16556
|
+
isSelected: state === selectedState,
|
|
16557
|
+
isInitial: state === initialState,
|
|
16558
|
+
onClick: () => handleStateClick(state)
|
|
16559
|
+
},
|
|
16560
|
+
state
|
|
16561
|
+
))
|
|
16562
|
+
]
|
|
16563
|
+
}
|
|
16564
|
+
),
|
|
16565
|
+
!isTesting && /* @__PURE__ */ jsx(HStack, { gap: "sm", children: /* @__PURE__ */ jsx(
|
|
16566
|
+
Button,
|
|
16567
|
+
{
|
|
16568
|
+
variant: "ghost",
|
|
16569
|
+
onClick: handleStartAddTransition,
|
|
16570
|
+
disabled: !selectedState,
|
|
16571
|
+
children: selectedState ? t("stateArchitect.addTransition", { state: selectedState }) : t("stateArchitect.addTransitionPrompt")
|
|
16572
|
+
}
|
|
16573
|
+
) }),
|
|
16574
|
+
transitions.length > 0 && /* @__PURE__ */ jsxs(VStack, { gap: "xs", className: "p-3 rounded-container bg-muted/50 border border-border", children: [
|
|
16575
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground font-medium", children: t("stateArchitect.transitions", { count: transitions.length }) + ":" }),
|
|
16576
|
+
transitions.map((t2) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
|
|
16577
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground", children: t2.from }),
|
|
16578
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "\u2014[" }),
|
|
16579
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-accent font-medium", children: t2.event }),
|
|
16580
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "]\u2192" }),
|
|
16581
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-success", children: t2.to }),
|
|
16582
|
+
t2.guardHint && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-warning", children: [
|
|
16583
|
+
"(",
|
|
16584
|
+
t2.guardHint,
|
|
16585
|
+
")"
|
|
16586
|
+
] }),
|
|
16587
|
+
!isTesting && /* @__PURE__ */ jsx(
|
|
16588
|
+
Button,
|
|
16589
|
+
{
|
|
16590
|
+
variant: "ghost",
|
|
16591
|
+
onClick: () => handleRemoveTransition(t2.id),
|
|
16592
|
+
className: "text-xs ml-auto",
|
|
16593
|
+
children: "\xD7"
|
|
16594
|
+
}
|
|
16595
|
+
)
|
|
16596
|
+
] }, t2.id))
|
|
16597
|
+
] })
|
|
16598
|
+
] }),
|
|
16599
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "sm", className: "w-[280px] shrink-0", children: [
|
|
16600
|
+
/* @__PURE__ */ jsx(TraitStateViewer, { trait: machine, variant: "full", size: "sm" }),
|
|
16601
|
+
/* @__PURE__ */ jsx(
|
|
16602
|
+
VariablePanel,
|
|
16603
|
+
{
|
|
16604
|
+
entityName,
|
|
16605
|
+
variables
|
|
16606
|
+
}
|
|
16607
|
+
),
|
|
16608
|
+
testResults.length > 0 && /* @__PURE__ */ jsxs(VStack, { className: "p-3 rounded-container bg-card border border-border", gap: "xs", children: [
|
|
16609
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-muted-foreground font-medium", children: t("stateArchitect.testResults") + ":" }),
|
|
16610
|
+
testResults.map((r2, i) => /* @__PURE__ */ jsxs(HStack, { className: "items-center text-xs", gap: "xs", children: [
|
|
16611
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: r2.passed ? "text-success" : "text-error", children: r2.passed ? "\u2714" : "\u2717" }),
|
|
16612
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-foreground flex-1", children: r2.label }),
|
|
16613
|
+
!r2.passed && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-error", children: t("stateArchitect.gotState", { state: r2.actualState }) })
|
|
16614
|
+
] }, i))
|
|
16615
|
+
] }),
|
|
16616
|
+
resolved.showCodeView !== false && /* @__PURE__ */ jsx(StateJsonView, { data: codeData, label: "View Code" })
|
|
16617
|
+
] })
|
|
16618
|
+
] }),
|
|
16619
|
+
isSuccess && /* @__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") }) }),
|
|
16620
|
+
!isTesting && !isSuccess && testResults.some((r2) => !r2.passed) && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16621
|
+
/* @__PURE__ */ jsx(Box, { className: "p-4 rounded-container bg-warning/10 border border-warning/30 text-center", children: /* @__PURE__ */ jsx(Typography, { variant: "body1", className: "text-foreground font-medium", children: t(ENCOURAGEMENT_KEYS3[Math.min(attempts - 1, ENCOURAGEMENT_KEYS3.length - 1)] ?? ENCOURAGEMENT_KEYS3[0]) }) }),
|
|
16622
|
+
!isSuccess && attempts >= 2 && Boolean(str(resolved?.hint)) && /* @__PURE__ */ jsx(Box, { className: "p-3 rounded-container bg-accent/10 border border-accent/30", children: /* @__PURE__ */ jsxs(HStack, { className: "items-start", gap: "xs", children: [
|
|
16623
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-accent font-bold shrink-0", children: "\u{1F4A1} " + t("game.hint") + ":" }),
|
|
16624
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body2", className: "text-foreground", children: hint })
|
|
16625
|
+
] }) })
|
|
16626
|
+
] }),
|
|
16627
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", children: [
|
|
16628
|
+
!isTesting && !isSuccess && testResults.some((r2) => !r2.passed) ? /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleTryAgain, children: "\u{1F504} " + t("puzzle.tryAgainButton") }) : /* @__PURE__ */ jsx(
|
|
16629
|
+
Button,
|
|
16630
|
+
{
|
|
16631
|
+
variant: "primary",
|
|
16632
|
+
onClick: handleTest,
|
|
16633
|
+
disabled: isTesting,
|
|
16634
|
+
children: "\u25B6 " + t("game.runTests")
|
|
16635
|
+
}
|
|
16636
|
+
),
|
|
16637
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", onClick: handleReset, children: "\u21BA " + t("game.reset") })
|
|
16638
|
+
] })
|
|
16639
|
+
]
|
|
16640
|
+
}
|
|
16641
|
+
);
|
|
16642
|
+
}
|
|
16643
|
+
var ENCOURAGEMENT_KEYS3, nextTransId;
|
|
16644
|
+
var init_StateArchitectBoard = __esm({
|
|
16645
|
+
"components/game/2d/organisms/StateArchitectBoard.tsx"() {
|
|
16646
|
+
init_atoms();
|
|
16647
|
+
init_cn();
|
|
16648
|
+
init_useEventBus();
|
|
16649
|
+
init_TraitStateViewer();
|
|
16650
|
+
init_StateNode();
|
|
16651
|
+
init_TransitionArrow();
|
|
16652
|
+
init_VariablePanel();
|
|
16653
|
+
init_StateJsonView();
|
|
16654
|
+
init_boardEntity();
|
|
16655
|
+
ENCOURAGEMENT_KEYS3 = [
|
|
16656
|
+
"puzzle.tryAgain1",
|
|
16657
|
+
"puzzle.tryAgain2",
|
|
16658
|
+
"puzzle.tryAgain3"
|
|
16659
|
+
];
|
|
16660
|
+
nextTransId = 100;
|
|
16661
|
+
StateArchitectBoard.displayName = "StateArchitectBoard";
|
|
16662
|
+
}
|
|
16663
|
+
});
|
|
16664
|
+
function readSimulatorParameters(v) {
|
|
16665
|
+
if (!Array.isArray(v)) return [];
|
|
16666
|
+
const result = [];
|
|
16667
|
+
for (const item of v) {
|
|
16668
|
+
if (typeof item === "object" && item !== null && !Array.isArray(item) && !(item instanceof Date)) {
|
|
16669
|
+
const param = item;
|
|
16670
|
+
if ("id" in item && "label" in item && "unit" in item && "min" in item && "max" in item && "step" in item) {
|
|
16671
|
+
result.push({
|
|
16672
|
+
id: str(param.id),
|
|
16673
|
+
label: str(param.label),
|
|
16674
|
+
unit: str(param.unit),
|
|
16675
|
+
min: num(param.min),
|
|
16676
|
+
max: num(param.max),
|
|
16677
|
+
step: num(param.step),
|
|
16678
|
+
initial: num(param.initial),
|
|
16679
|
+
correct: num(param.correct),
|
|
16680
|
+
tolerance: num(param.tolerance)
|
|
16681
|
+
});
|
|
16682
|
+
}
|
|
16683
|
+
}
|
|
16684
|
+
}
|
|
16685
|
+
return result;
|
|
16686
|
+
}
|
|
16687
|
+
function SimulatorBoard({
|
|
16688
|
+
entity,
|
|
16689
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
16690
|
+
setAEvent,
|
|
16691
|
+
setBEvent,
|
|
16692
|
+
checkEvent,
|
|
16693
|
+
playAgainEvent,
|
|
16694
|
+
assetManifest,
|
|
16695
|
+
className
|
|
16696
|
+
}) {
|
|
16697
|
+
const ui = assetManifest?.ui;
|
|
16698
|
+
const { emit } = useEventBus();
|
|
16699
|
+
const { t } = useTranslate();
|
|
16700
|
+
const resolved = boardEntity(entity);
|
|
16701
|
+
const parameters = readSimulatorParameters(resolved?.parameters);
|
|
16702
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16703
|
+
if (!resolved) return null;
|
|
16704
|
+
const paramA = num(resolved.paramA);
|
|
16705
|
+
const paramB = num(resolved.paramB);
|
|
16706
|
+
const output = num(resolved.output);
|
|
16707
|
+
const targetValue = num(resolved.target);
|
|
16708
|
+
const targetTolerance = num(resolved.tolerance);
|
|
16709
|
+
const attempts = num(resolved.attempts);
|
|
16710
|
+
const result = str(resolved.result);
|
|
16711
|
+
const isWin = result === "win";
|
|
16712
|
+
const isComplete = result !== "none" && result !== "";
|
|
16713
|
+
const paramAValue = parameters[0];
|
|
16714
|
+
const paramBValue = parameters[1];
|
|
16715
|
+
const sliderValues = [paramA, paramB];
|
|
16716
|
+
const sliderEvents = [setAEvent, setBEvent];
|
|
16717
|
+
const handleParameterChange = (index, value) => {
|
|
16718
|
+
if (isComplete) return;
|
|
16719
|
+
const ev = sliderEvents[index];
|
|
16720
|
+
if (ev) emit(`UI:${ev}`, { value });
|
|
16721
|
+
};
|
|
16722
|
+
const handleCheck = () => {
|
|
16723
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
16724
|
+
};
|
|
16725
|
+
const handlePlayAgain = () => {
|
|
16726
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16727
|
+
};
|
|
16728
|
+
const themeBackground = (() => {
|
|
16729
|
+
const t2 = resolved.theme;
|
|
16730
|
+
if (typeof t2 === "object" && t2 !== null && !Array.isArray(t2) && !(t2 instanceof Date)) {
|
|
16731
|
+
const bg = t2.background;
|
|
16732
|
+
return str(bg);
|
|
16733
|
+
}
|
|
16734
|
+
return "";
|
|
16735
|
+
})();
|
|
16736
|
+
const headerImage = str(resolved.headerImage);
|
|
16737
|
+
const hint = str(resolved.hint);
|
|
16738
|
+
const showHint = isComplete && !isWin && attempts >= 2 && Boolean(hint);
|
|
16739
|
+
const outputLabel = str(resolved.outputLabel);
|
|
16740
|
+
const outputUnit = str(resolved.outputUnit);
|
|
16741
|
+
return /* @__PURE__ */ jsx(
|
|
16742
|
+
Box,
|
|
16743
|
+
{
|
|
16744
|
+
className,
|
|
16745
|
+
style: {
|
|
16746
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16747
|
+
backgroundSize: "cover",
|
|
16748
|
+
backgroundPosition: "center"
|
|
16749
|
+
},
|
|
16750
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
16751
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16752
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16753
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
16754
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
16755
|
+
] }) }),
|
|
16756
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
|
|
16757
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("simulator.parameters") }),
|
|
16758
|
+
[paramAValue, paramBValue].map(
|
|
16759
|
+
(param, index) => param ? /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
16760
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
|
|
16761
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: param.label }),
|
|
16762
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
16763
|
+
sliderValues[index],
|
|
16764
|
+
" ",
|
|
16765
|
+
param.unit
|
|
16766
|
+
] })
|
|
16767
|
+
] }),
|
|
16768
|
+
/* @__PURE__ */ jsx(
|
|
16769
|
+
"input",
|
|
16770
|
+
{
|
|
16771
|
+
type: "range",
|
|
16772
|
+
min: param.min,
|
|
16773
|
+
max: param.max,
|
|
16774
|
+
step: param.step,
|
|
16775
|
+
value: sliderValues[index],
|
|
16776
|
+
onChange: (e) => handleParameterChange(index, Number(e.target.value)),
|
|
16777
|
+
disabled: isComplete,
|
|
16778
|
+
className: "w-full accent-foreground"
|
|
16779
|
+
}
|
|
16780
|
+
),
|
|
16781
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", children: [
|
|
16782
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16783
|
+
param.min,
|
|
16784
|
+
" ",
|
|
16785
|
+
param.unit
|
|
16786
|
+
] }),
|
|
16787
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16788
|
+
param.max,
|
|
16789
|
+
" ",
|
|
16790
|
+
param.unit
|
|
16791
|
+
] })
|
|
16792
|
+
] })
|
|
16793
|
+
] }, param.id ?? index) : null
|
|
16794
|
+
)
|
|
16795
|
+
] }) }),
|
|
16796
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
16797
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: outputLabel }),
|
|
16798
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "h3", weight: "bold", children: [
|
|
16799
|
+
output.toFixed(2),
|
|
16800
|
+
" ",
|
|
16801
|
+
outputUnit
|
|
16802
|
+
] }),
|
|
16803
|
+
isComplete && /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
16804
|
+
/* @__PURE__ */ jsx(
|
|
16805
|
+
GameIcon,
|
|
16806
|
+
{
|
|
16807
|
+
icon: isWin ? CheckCircle : XCircle,
|
|
16808
|
+
assetUrl: isWin ? ui?.["correct"] : ui?.["incorrect"],
|
|
16809
|
+
size: "sm",
|
|
16810
|
+
className: isWin ? "text-success" : "text-error"
|
|
16811
|
+
}
|
|
16812
|
+
),
|
|
16813
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", className: isWin ? "text-success" : "text-error", children: isWin ? str(resolved.successMessage) || t("simulator.correct") : str(resolved.failMessage) || t("simulator.incorrect") })
|
|
16814
|
+
] }),
|
|
16815
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
16816
|
+
t("simulator.target"),
|
|
16817
|
+
": ",
|
|
16818
|
+
targetValue,
|
|
16819
|
+
" ",
|
|
16820
|
+
outputUnit,
|
|
16821
|
+
" (\xB1",
|
|
16822
|
+
targetTolerance,
|
|
16823
|
+
")"
|
|
16824
|
+
] })
|
|
16825
|
+
] }) }),
|
|
16826
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
16827
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
16828
|
+
!isComplete ? /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleCheck, children: [
|
|
16829
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Play, assetUrl: ui?.["play"], size: "sm" }),
|
|
16830
|
+
t("simulator.simulate")
|
|
16831
|
+
] }) : null,
|
|
16832
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
|
|
16833
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
16834
|
+
t("simulator.reset")
|
|
16835
|
+
] })
|
|
16836
|
+
] })
|
|
16837
|
+
] })
|
|
16838
|
+
}
|
|
16839
|
+
);
|
|
16840
|
+
}
|
|
16841
|
+
var init_SimulatorBoard = __esm({
|
|
16842
|
+
"components/game/2d/organisms/SimulatorBoard.tsx"() {
|
|
16843
|
+
init_atoms();
|
|
16844
|
+
init_useEventBus();
|
|
16845
|
+
init_boardEntity();
|
|
16846
|
+
init_GameIcon();
|
|
16847
|
+
SimulatorBoard.displayName = "SimulatorBoard";
|
|
16848
|
+
}
|
|
16849
|
+
});
|
|
16850
|
+
function ClassifierBoard({
|
|
16851
|
+
entity,
|
|
16852
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
16853
|
+
assignEvent,
|
|
16854
|
+
checkEvent,
|
|
16855
|
+
playAgainEvent,
|
|
16856
|
+
assetManifest,
|
|
16857
|
+
className
|
|
16858
|
+
}) {
|
|
16859
|
+
const ui = assetManifest?.ui;
|
|
16860
|
+
const { emit } = useEventBus();
|
|
16861
|
+
const { t } = useTranslate();
|
|
16862
|
+
const resolved = boardEntity(entity);
|
|
16863
|
+
const [headerError, setHeaderError] = useState(false);
|
|
16864
|
+
const items = rows(resolved?.items);
|
|
16865
|
+
const categories = rows(resolved?.categories);
|
|
16866
|
+
const result = str(resolved?.result);
|
|
16867
|
+
const submitted = result === "win";
|
|
16868
|
+
const attempts = num(resolved?.attempts);
|
|
16869
|
+
const assignments = items.reduce((acc, item) => {
|
|
16870
|
+
if (item.assignedCategory != null && item.assignedCategory !== "") acc[item.id] = item.assignedCategory;
|
|
16871
|
+
return acc;
|
|
16872
|
+
}, {});
|
|
16873
|
+
const unassignedItems = items.filter((item) => !assignments[item.id]);
|
|
16874
|
+
const allAssigned = items.length > 0 && Object.keys(assignments).length === items.length;
|
|
16875
|
+
const results = submitted ? items.map((item) => ({
|
|
16876
|
+
item,
|
|
16877
|
+
assigned: assignments[item.id],
|
|
16878
|
+
correct: assignments[item.id] === item.correctCategory
|
|
16879
|
+
})) : [];
|
|
16880
|
+
const allCorrect = result === "win";
|
|
16881
|
+
const correctCount = results.filter((r2) => r2.correct).length;
|
|
16882
|
+
const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
|
|
16883
|
+
const handleAssign = (itemId, categoryId) => {
|
|
16884
|
+
if (submitted) return;
|
|
16885
|
+
if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId });
|
|
16886
|
+
};
|
|
16887
|
+
const handleUnassign = (itemId) => {
|
|
16888
|
+
if (submitted) return;
|
|
16889
|
+
if (assignEvent) emit(`UI:${assignEvent}`, { itemId, categoryId: "" });
|
|
16890
|
+
};
|
|
16891
|
+
const handleSubmit = () => {
|
|
16892
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
16893
|
+
if (allAssigned && items.every((item) => assignments[item.id] === item.correctCategory)) {
|
|
16894
|
+
emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
16895
|
+
}
|
|
16896
|
+
};
|
|
16897
|
+
const handleFullReset = () => {
|
|
16898
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
16899
|
+
};
|
|
16900
|
+
if (!resolved) return null;
|
|
16901
|
+
const theme = resolved.theme ?? void 0;
|
|
16902
|
+
const themeBackground = theme?.background;
|
|
16903
|
+
const headerImage = str(resolved.headerImage);
|
|
16904
|
+
const hint = str(resolved.hint);
|
|
16905
|
+
const failMessage = str(resolved.failMessage);
|
|
16906
|
+
return /* @__PURE__ */ jsx(
|
|
16907
|
+
Box,
|
|
16908
|
+
{
|
|
16909
|
+
className,
|
|
16910
|
+
style: {
|
|
16911
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
16912
|
+
backgroundSize: "cover",
|
|
16913
|
+
backgroundPosition: "center"
|
|
16914
|
+
},
|
|
16915
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
16916
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
16917
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16918
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
16919
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
16920
|
+
] }) }),
|
|
16921
|
+
unassignedItems.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16922
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("classifier.itemsToSort") }),
|
|
16923
|
+
/* @__PURE__ */ jsx(HStack, { gap: "sm", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(Badge, { size: "md", className: "cursor-pointer", children: [
|
|
16924
|
+
item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block" }),
|
|
16925
|
+
item.label
|
|
16926
|
+
] }, item.id)) })
|
|
16927
|
+
] }) }),
|
|
16928
|
+
/* @__PURE__ */ jsx(VStack, { gap: "md", children: categories.map((cat) => {
|
|
16929
|
+
const catItems = items.filter((item) => assignments[item.id] === cat.id);
|
|
16930
|
+
return /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
16931
|
+
cat.imageUrl && /* @__PURE__ */ jsx(Box, { className: "w-full h-16 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: cat.imageUrl, alt: "", className: "w-full h-full object-cover" }) }),
|
|
16932
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "between", align: "center", children: [
|
|
16933
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: cat.label }),
|
|
16934
|
+
/* @__PURE__ */ jsx(Badge, { size: "sm", children: catItems.length })
|
|
16935
|
+
] }),
|
|
16936
|
+
/* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap min-h-[2rem]", children: catItems.map((item) => {
|
|
16937
|
+
const result2 = results.find((r2) => r2.item.id === item.id);
|
|
16938
|
+
return /* @__PURE__ */ jsxs(
|
|
16939
|
+
Badge,
|
|
16940
|
+
{
|
|
16941
|
+
size: "sm",
|
|
16942
|
+
className: `cursor-pointer ${result2 ? result2.correct ? "border-success bg-success/10" : "border-error bg-error/10" : ""}`,
|
|
16943
|
+
onClick: () => handleUnassign(item.id),
|
|
16944
|
+
children: [
|
|
16945
|
+
item.iconUrl && /* @__PURE__ */ jsx("img", { src: item.iconUrl, alt: "", className: "w-3 h-3 object-contain inline-block" }),
|
|
16946
|
+
item.label,
|
|
16947
|
+
result2 && /* @__PURE__ */ jsx(
|
|
16948
|
+
GameIcon,
|
|
16949
|
+
{
|
|
16950
|
+
icon: result2.correct ? CheckCircle : XCircle,
|
|
16951
|
+
assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
|
|
16952
|
+
size: "sm",
|
|
16953
|
+
className: result2.correct ? "text-success" : "text-error"
|
|
16954
|
+
}
|
|
16955
|
+
)
|
|
16956
|
+
]
|
|
16957
|
+
},
|
|
16958
|
+
item.id
|
|
16959
|
+
);
|
|
16960
|
+
}) }),
|
|
16961
|
+
!submitted && unassignedItems.length > 0 && /* @__PURE__ */ jsx(HStack, { gap: "xs", className: "flex-wrap", children: unassignedItems.map((item) => /* @__PURE__ */ jsxs(
|
|
16962
|
+
Button,
|
|
16963
|
+
{
|
|
16964
|
+
size: "sm",
|
|
16965
|
+
variant: "ghost",
|
|
16966
|
+
onClick: () => handleAssign(item.id, cat.id),
|
|
16967
|
+
className: "text-xs opacity-50 hover:opacity-100",
|
|
16968
|
+
children: [
|
|
16969
|
+
"+ ",
|
|
16970
|
+
item.label
|
|
16971
|
+
]
|
|
16972
|
+
},
|
|
16973
|
+
item.id
|
|
16974
|
+
)) })
|
|
16975
|
+
] }) }, cat.id);
|
|
16976
|
+
}) }),
|
|
16977
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
16978
|
+
/* @__PURE__ */ jsx(
|
|
16979
|
+
GameIcon,
|
|
16980
|
+
{
|
|
16981
|
+
icon: allCorrect ? CheckCircle : XCircle,
|
|
16982
|
+
assetUrl: allCorrect ? ui?.["correct"] : ui?.["incorrect"],
|
|
16983
|
+
size: "lg",
|
|
16984
|
+
className: allCorrect ? "text-success" : "text-error"
|
|
16985
|
+
}
|
|
16986
|
+
),
|
|
16987
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("classifier.allCorrect") : `${correctCount}/${items.length} ${t("classifier.correct")}` }),
|
|
16988
|
+
!allCorrect && failMessage && /* @__PURE__ */ jsx(Typography, { variant: "body", className: "text-muted-foreground", children: failMessage })
|
|
16989
|
+
] }) }),
|
|
16990
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
16991
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
16992
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allAssigned, children: [
|
|
16993
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
|
|
16994
|
+
t("classifier.check")
|
|
16995
|
+
] }),
|
|
16996
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleFullReset, children: [
|
|
16997
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
16998
|
+
t("classifier.reset")
|
|
16999
|
+
] })
|
|
17000
|
+
] })
|
|
17001
|
+
] })
|
|
17002
|
+
}
|
|
17003
|
+
);
|
|
17004
|
+
}
|
|
17005
|
+
var init_ClassifierBoard = __esm({
|
|
17006
|
+
"components/game/2d/organisms/ClassifierBoard.tsx"() {
|
|
17007
|
+
init_atoms();
|
|
17008
|
+
init_useEventBus();
|
|
17009
|
+
init_boardEntity();
|
|
17010
|
+
init_GameIcon();
|
|
17011
|
+
ClassifierBoard.displayName = "ClassifierBoard";
|
|
17012
|
+
}
|
|
17013
|
+
});
|
|
17014
|
+
function BuilderBoard({
|
|
17015
|
+
entity,
|
|
17016
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
17017
|
+
placeEvent,
|
|
17018
|
+
checkEvent,
|
|
17019
|
+
playAgainEvent,
|
|
17020
|
+
assetManifest,
|
|
17021
|
+
className
|
|
17022
|
+
}) {
|
|
17023
|
+
const ui = assetManifest?.ui;
|
|
17024
|
+
const { emit } = useEventBus();
|
|
17025
|
+
const { t } = useTranslate();
|
|
17026
|
+
const resolved = boardEntity(entity);
|
|
17027
|
+
const [headerError, setHeaderError] = useState(false);
|
|
17028
|
+
const [selectedComponent, setSelectedComponent] = useState(null);
|
|
17029
|
+
const components = rows(resolved?.components).map((r2) => ({
|
|
17030
|
+
id: str(r2.id),
|
|
17031
|
+
label: str(r2.label),
|
|
17032
|
+
description: str(r2.description) || void 0,
|
|
17033
|
+
iconEmoji: str(r2.iconEmoji) || void 0,
|
|
17034
|
+
iconUrl: str(r2.iconUrl) || void 0,
|
|
17035
|
+
category: str(r2.category) || void 0
|
|
17036
|
+
}));
|
|
17037
|
+
const slots = rows(resolved?.slots).map((r2) => ({
|
|
17038
|
+
id: str(r2.id),
|
|
17039
|
+
label: str(r2.label) || void 0,
|
|
17040
|
+
description: str(r2.description) || void 0,
|
|
17041
|
+
requiredComponentId: str(r2.requiredComponentId),
|
|
17042
|
+
placedComponentId: str(r2.placedComponentId) || void 0
|
|
17043
|
+
}));
|
|
17044
|
+
const placements = {};
|
|
17045
|
+
for (const slot of slots) {
|
|
17046
|
+
if (slot.placedComponentId) placements[slot.id] = slot.placedComponentId;
|
|
17047
|
+
}
|
|
17048
|
+
const attempts = num(resolved?.attempts);
|
|
17049
|
+
const result = str(resolved?.result) || "none";
|
|
17050
|
+
const submitted = result === "win";
|
|
17051
|
+
const usedComponentIds = new Set(Object.values(placements));
|
|
17052
|
+
const availableComponents = components.filter((c) => !usedComponentIds.has(c.id));
|
|
17053
|
+
const allPlaced = slots.length > 0 && slots.every((s) => Boolean(placements[s.id]));
|
|
17054
|
+
const results = submitted ? slots.map((slot) => ({
|
|
17055
|
+
slot,
|
|
17056
|
+
placed: placements[slot.id],
|
|
17057
|
+
correct: placements[slot.id] === slot.requiredComponentId
|
|
17058
|
+
})) : [];
|
|
17059
|
+
const showHint = attempts >= 2 && Boolean(str(resolved?.hint));
|
|
17060
|
+
const handlePlaceComponent = (slotId) => {
|
|
17061
|
+
if (submitted || !selectedComponent) return;
|
|
17062
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: selectedComponent });
|
|
17063
|
+
setSelectedComponent(null);
|
|
17064
|
+
};
|
|
17065
|
+
const handleRemoveFromSlot = (slotId) => {
|
|
17066
|
+
if (submitted) return;
|
|
17067
|
+
if (placeEvent) emit(`UI:${placeEvent}`, { slotId, componentId: "" });
|
|
17068
|
+
};
|
|
17069
|
+
const handleSubmit = () => {
|
|
17070
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
17071
|
+
const solved = slots.length > 0 && slots.every((s) => placements[s.id] === s.requiredComponentId);
|
|
17072
|
+
if (solved && completeEvent) {
|
|
17073
|
+
emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
17074
|
+
}
|
|
17075
|
+
};
|
|
17076
|
+
const handlePlayAgain = () => {
|
|
17077
|
+
setSelectedComponent(null);
|
|
17078
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
17079
|
+
};
|
|
17080
|
+
const getComponentById = (id) => components.find((c) => c.id === id);
|
|
17081
|
+
if (!resolved) return null;
|
|
17082
|
+
const theme = resolved.theme ?? void 0;
|
|
17083
|
+
const themeBackground = theme?.background;
|
|
17084
|
+
const headerImage = str(resolved.headerImage);
|
|
17085
|
+
const hint = str(resolved.hint);
|
|
17086
|
+
return /* @__PURE__ */ jsx(
|
|
17087
|
+
Box,
|
|
17088
|
+
{
|
|
17089
|
+
className,
|
|
17090
|
+
style: {
|
|
17091
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17092
|
+
backgroundSize: "cover",
|
|
17093
|
+
backgroundPosition: "center"
|
|
17094
|
+
},
|
|
17095
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17096
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17097
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17098
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
17099
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) })
|
|
17100
|
+
] }) }),
|
|
17101
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17102
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.components") }),
|
|
17103
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "flex-wrap", children: [
|
|
17104
|
+
availableComponents.map((comp) => /* @__PURE__ */ jsxs(
|
|
17105
|
+
Button,
|
|
17106
|
+
{
|
|
17107
|
+
size: "sm",
|
|
17108
|
+
variant: selectedComponent === comp.id ? "primary" : "secondary",
|
|
17109
|
+
onClick: () => setSelectedComponent(selectedComponent === comp.id ? null : comp.id),
|
|
17110
|
+
disabled: submitted,
|
|
17111
|
+
children: [
|
|
17112
|
+
comp.iconUrl ? /* @__PURE__ */ jsx("img", { src: comp.iconUrl, alt: "", className: "w-5 h-5 object-contain inline-block mr-1" }) : comp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17113
|
+
comp.iconEmoji,
|
|
17114
|
+
" "
|
|
17115
|
+
] }) : null,
|
|
17116
|
+
comp.label
|
|
17117
|
+
]
|
|
17118
|
+
},
|
|
17119
|
+
comp.id
|
|
17120
|
+
)),
|
|
17121
|
+
availableComponents.length === 0 && !submitted && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.allPlaced") })
|
|
17122
|
+
] })
|
|
17123
|
+
] }) }),
|
|
17124
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17125
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("builder.blueprint") }),
|
|
17126
|
+
/* @__PURE__ */ jsx(VStack, { gap: "sm", children: slots.map((slot) => {
|
|
17127
|
+
const placedComp = placements[slot.id] ? getComponentById(placements[slot.id]) : null;
|
|
17128
|
+
const result2 = results.find((r2) => r2.slot.id === slot.id);
|
|
17129
|
+
return /* @__PURE__ */ jsxs(
|
|
17130
|
+
HStack,
|
|
17131
|
+
{
|
|
17132
|
+
gap: "sm",
|
|
17133
|
+
align: "center",
|
|
17134
|
+
className: `p-3 border-2 rounded ${result2 ? result2.correct ? "border-success" : "border-error" : selectedComponent ? "border-dashed border-foreground cursor-pointer" : "border-border"}`,
|
|
17135
|
+
onClick: () => handlePlaceComponent(slot.id),
|
|
17136
|
+
children: [
|
|
17137
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", className: "flex-1", children: [
|
|
17138
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "medium", children: slot.label }),
|
|
17139
|
+
slot.description && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: slot.description })
|
|
17140
|
+
] }),
|
|
17141
|
+
placedComp ? /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
17142
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", onClick: () => handleRemoveFromSlot(slot.id), children: [
|
|
17143
|
+
placedComp.iconUrl ? /* @__PURE__ */ jsx("img", { src: placedComp.iconUrl, alt: "", className: "w-4 h-4 object-contain inline-block mr-1" }) : placedComp.iconEmoji ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17144
|
+
placedComp.iconEmoji,
|
|
17145
|
+
" "
|
|
17146
|
+
] }) : null,
|
|
17147
|
+
placedComp.label
|
|
17148
|
+
] }),
|
|
17149
|
+
result2 && /* @__PURE__ */ jsx(
|
|
17150
|
+
GameIcon,
|
|
17151
|
+
{
|
|
17152
|
+
icon: result2.correct ? CheckCircle : XCircle,
|
|
17153
|
+
assetUrl: result2.correct ? ui?.["correct"] : ui?.["incorrect"],
|
|
17154
|
+
size: "sm",
|
|
17155
|
+
className: result2.correct ? "text-success" : "text-error"
|
|
17156
|
+
}
|
|
17157
|
+
)
|
|
17158
|
+
] }) : /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("builder.empty") })
|
|
17159
|
+
]
|
|
17160
|
+
},
|
|
17161
|
+
slot.id
|
|
17162
|
+
);
|
|
17163
|
+
}) })
|
|
17164
|
+
] }) }),
|
|
17165
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
17166
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: "text-success" }),
|
|
17167
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: str(resolved.successMessage) || t("builder.success") })
|
|
17168
|
+
] }) }),
|
|
17169
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17170
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
17171
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: !allPlaced, children: [
|
|
17172
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Wrench, assetUrl: ui?.["build"], size: "sm" }),
|
|
17173
|
+
t("builder.build")
|
|
17174
|
+
] }),
|
|
17175
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handlePlayAgain, children: [
|
|
17176
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
17177
|
+
t("builder.reset")
|
|
17178
|
+
] })
|
|
17179
|
+
] })
|
|
17180
|
+
] })
|
|
17181
|
+
}
|
|
17182
|
+
);
|
|
17183
|
+
}
|
|
17184
|
+
var init_BuilderBoard = __esm({
|
|
17185
|
+
"components/game/2d/organisms/BuilderBoard.tsx"() {
|
|
17186
|
+
init_atoms();
|
|
17187
|
+
init_useEventBus();
|
|
17188
|
+
init_boardEntity();
|
|
17189
|
+
init_GameIcon();
|
|
17190
|
+
BuilderBoard.displayName = "BuilderBoard";
|
|
17191
|
+
}
|
|
17192
|
+
});
|
|
17193
|
+
function toDebuggerLine(v) {
|
|
17194
|
+
if (v === null || typeof v !== "object" || Array.isArray(v) || v instanceof Date) return null;
|
|
17195
|
+
const id = v["id"];
|
|
17196
|
+
const content = v["content"];
|
|
17197
|
+
const isBug = v["isBug"];
|
|
17198
|
+
if (typeof id !== "string" || typeof content !== "string" || typeof isBug !== "boolean") return null;
|
|
17199
|
+
const isFlagged = v["isFlagged"];
|
|
17200
|
+
const explanation = v["explanation"];
|
|
17201
|
+
return {
|
|
17202
|
+
id,
|
|
17203
|
+
content,
|
|
17204
|
+
isBug,
|
|
17205
|
+
isFlagged: typeof isFlagged === "boolean" ? isFlagged : void 0,
|
|
17206
|
+
explanation: typeof explanation === "string" ? explanation : void 0
|
|
17207
|
+
};
|
|
17208
|
+
}
|
|
17209
|
+
function DebuggerBoard({
|
|
17210
|
+
entity,
|
|
17211
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
17212
|
+
toggleFlagEvent,
|
|
17213
|
+
checkEvent,
|
|
17214
|
+
playAgainEvent,
|
|
17215
|
+
assetManifest,
|
|
17216
|
+
className
|
|
17217
|
+
}) {
|
|
17218
|
+
const ui = assetManifest?.ui;
|
|
17219
|
+
const { emit } = useEventBus();
|
|
17220
|
+
const { t } = useTranslate();
|
|
17221
|
+
const resolved = boardEntity(entity);
|
|
17222
|
+
const [headerError, setHeaderError] = useState(false);
|
|
17223
|
+
const lines = Array.isArray(resolved?.lines) ? resolved.lines.flatMap((v) => {
|
|
17224
|
+
const l = toDebuggerLine(v);
|
|
17225
|
+
return l ? [l] : [];
|
|
17226
|
+
}) : [];
|
|
17227
|
+
const result = str(resolved?.result) || "none";
|
|
17228
|
+
const attempts = num(resolved?.attempts);
|
|
17229
|
+
const submitted = result === "win";
|
|
17230
|
+
const showHint = !submitted && attempts >= 2 && Boolean(str(resolved?.hint));
|
|
17231
|
+
const bugLines = lines.filter((l) => l.isBug);
|
|
17232
|
+
const flaggedLines = lines.filter((l) => l.isFlagged);
|
|
17233
|
+
const correctFlags = lines.filter((l) => l.isBug && l.isFlagged);
|
|
17234
|
+
const falseFlags = lines.filter((l) => !l.isBug && l.isFlagged);
|
|
17235
|
+
const allCorrect = submitted;
|
|
17236
|
+
const toggleLine = (lineId) => {
|
|
17237
|
+
if (submitted) return;
|
|
17238
|
+
if (toggleFlagEvent) emit(`UI:${toggleFlagEvent}`, { lineId });
|
|
17239
|
+
};
|
|
17240
|
+
const handleSubmit = useCallback(() => {
|
|
17241
|
+
if (checkEvent) emit(`UI:${checkEvent}`, {});
|
|
17242
|
+
const correct = correctFlags.length === bugLines.length && falseFlags.length === 0;
|
|
17243
|
+
if (correct) emit(`UI:${completeEvent}`, { success: true, attempts: attempts + 1 });
|
|
17244
|
+
}, [checkEvent, correctFlags.length, bugLines.length, falseFlags.length, attempts, completeEvent, emit]);
|
|
17245
|
+
const handleReset = () => {
|
|
17246
|
+
if (playAgainEvent) emit(`UI:${playAgainEvent}`, {});
|
|
17247
|
+
};
|
|
17248
|
+
if (!resolved) return null;
|
|
17249
|
+
const theme = resolved.theme ?? void 0;
|
|
17250
|
+
const themeBackground = theme?.background;
|
|
17251
|
+
const headerImage = str(resolved.headerImage);
|
|
17252
|
+
const hint = str(resolved.hint);
|
|
17253
|
+
return /* @__PURE__ */ jsx(
|
|
17254
|
+
Box,
|
|
17255
|
+
{
|
|
17256
|
+
className,
|
|
17257
|
+
style: {
|
|
17258
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17259
|
+
backgroundSize: "cover",
|
|
17260
|
+
backgroundPosition: "center"
|
|
17261
|
+
},
|
|
17262
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17263
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17264
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17265
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
17266
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm" }),
|
|
17267
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) })
|
|
17268
|
+
] }),
|
|
17269
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
|
|
17270
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("debugger.findBugs", { count: String(lines.filter((l) => l.isBug).length) }) })
|
|
17271
|
+
] }) }),
|
|
17272
|
+
/* @__PURE__ */ jsx(Card, { className: "p-0 overflow-hidden", children: /* @__PURE__ */ jsx(VStack, { gap: "none", children: lines.map((line, i) => {
|
|
17273
|
+
const isFlagged = !!line.isFlagged;
|
|
17274
|
+
let lineStyle = "";
|
|
17275
|
+
if (submitted) {
|
|
17276
|
+
if (line.isBug && isFlagged) lineStyle = "bg-success/10";
|
|
17277
|
+
else if (line.isBug && !isFlagged) lineStyle = "bg-warning/10";
|
|
17278
|
+
else if (!line.isBug && isFlagged) lineStyle = "bg-error/10";
|
|
17279
|
+
} else if (isFlagged) {
|
|
17280
|
+
lineStyle = "bg-error/10";
|
|
17281
|
+
}
|
|
17282
|
+
return /* @__PURE__ */ jsxs(
|
|
17283
|
+
HStack,
|
|
17284
|
+
{
|
|
17285
|
+
gap: "none",
|
|
17286
|
+
align: "stretch",
|
|
17287
|
+
className: `border-b border-border cursor-pointer hover:bg-muted ${lineStyle}`,
|
|
17288
|
+
onClick: () => toggleLine(line.id),
|
|
17289
|
+
children: [
|
|
17290
|
+
/* @__PURE__ */ jsx(Box, { className: "w-10 flex-shrink-0 flex items-center justify-center border-r border-border text-muted-foreground", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", children: i + 1 }) }),
|
|
17291
|
+
/* @__PURE__ */ jsx(Box, { className: "flex-1 px-3 py-1.5 font-mono text-sm whitespace-pre", children: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "font-mono text-sm", children: line.content }) }),
|
|
17292
|
+
/* @__PURE__ */ jsxs(Box, { className: "w-8 flex-shrink-0 flex items-center justify-center", children: [
|
|
17293
|
+
isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-error" }),
|
|
17294
|
+
submitted && line.isBug && !isFlagged && /* @__PURE__ */ jsx(GameIcon, { icon: Bug, assetUrl: ui?.["bug"], size: "sm", className: "text-warning" })
|
|
17295
|
+
] })
|
|
17296
|
+
]
|
|
17297
|
+
},
|
|
17298
|
+
line.id
|
|
17299
|
+
);
|
|
17300
|
+
}) }) }),
|
|
17301
|
+
submitted && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17302
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: allCorrect ? str(resolved.successMessage) || t("debugger.allFound") : `${correctFlags.length}/${bugLines.length} ${t("debugger.bugsFound")}` }),
|
|
17303
|
+
bugLines.map((line) => /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "start", children: [
|
|
17304
|
+
/* @__PURE__ */ jsx(
|
|
17305
|
+
GameIcon,
|
|
17306
|
+
{
|
|
17307
|
+
icon: line.isFlagged ? CheckCircle : XCircle,
|
|
17308
|
+
assetUrl: line.isFlagged ? ui?.["correct"] : ui?.["incorrect"],
|
|
17309
|
+
size: "sm",
|
|
17310
|
+
className: line.isFlagged ? "text-success mt-0.5" : "text-warning mt-0.5"
|
|
17311
|
+
}
|
|
17312
|
+
),
|
|
17313
|
+
/* @__PURE__ */ jsxs(VStack, { gap: "none", children: [
|
|
17314
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", weight: "bold", className: "font-mono", children: line.content.trim() }),
|
|
17315
|
+
line.explanation && /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: line.explanation })
|
|
17316
|
+
] })
|
|
17317
|
+
] }, line.id))
|
|
17318
|
+
] }) }),
|
|
17319
|
+
showHint && hint && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17320
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "center", children: [
|
|
17321
|
+
!submitted && /* @__PURE__ */ jsxs(Button, { variant: "primary", onClick: handleSubmit, disabled: flaggedLines.length === 0, children: [
|
|
17322
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: Send, assetUrl: ui?.["send"], size: "sm" }),
|
|
17323
|
+
t("debugger.submit")
|
|
17324
|
+
] }),
|
|
17325
|
+
/* @__PURE__ */ jsxs(Button, { variant: "secondary", onClick: handleReset, children: [
|
|
17326
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: RotateCcw, assetUrl: ui?.["reset"], size: "sm" }),
|
|
17327
|
+
t("debugger.reset")
|
|
17328
|
+
] })
|
|
17329
|
+
] })
|
|
17330
|
+
] })
|
|
17331
|
+
}
|
|
17332
|
+
);
|
|
17333
|
+
}
|
|
17334
|
+
var init_DebuggerBoard = __esm({
|
|
17335
|
+
"components/game/2d/organisms/DebuggerBoard.tsx"() {
|
|
17336
|
+
init_atoms();
|
|
17337
|
+
init_useEventBus();
|
|
17338
|
+
init_boardEntity();
|
|
17339
|
+
init_GameIcon();
|
|
17340
|
+
DebuggerBoard.displayName = "DebuggerBoard";
|
|
17341
|
+
}
|
|
17342
|
+
});
|
|
17343
|
+
function NegotiatorBoard({
|
|
17344
|
+
entity,
|
|
17345
|
+
completeEvent = "PUZZLE_COMPLETE",
|
|
17346
|
+
playRoundEvent,
|
|
17347
|
+
finishEvent,
|
|
17348
|
+
playAgainEvent,
|
|
17349
|
+
assetManifest,
|
|
17350
|
+
className
|
|
17351
|
+
}) {
|
|
17352
|
+
const ui = assetManifest?.ui;
|
|
17353
|
+
const { emit } = useEventBus();
|
|
17354
|
+
const { t } = useTranslate();
|
|
17355
|
+
const resolved = boardEntity(entity);
|
|
17356
|
+
const [history, setHistory] = useState([]);
|
|
17357
|
+
const [headerError, setHeaderError] = useState(false);
|
|
17358
|
+
const [showHint, setShowHint] = useState(false);
|
|
17359
|
+
const totalRounds = num(resolved?.maxRounds);
|
|
17360
|
+
const targetScore = num(resolved?.targetScore);
|
|
17361
|
+
const currentRound = num(resolved?.round);
|
|
17362
|
+
const result = str(resolved?.result) || "none";
|
|
17363
|
+
const playerTotal = num(resolved?.score);
|
|
17364
|
+
const isComplete = result !== "none" || totalRounds > 0 && currentRound >= totalRounds;
|
|
17365
|
+
const won = result === "win";
|
|
17366
|
+
const lastPlayerAction = str(resolved?.lastPlayerAction);
|
|
17367
|
+
const lastOpponentAction = str(resolved?.lastOpponentAction);
|
|
17368
|
+
const lastPayoff = num(resolved?.lastPayoff);
|
|
17369
|
+
const actions = Array.isArray(resolved?.actions) ? resolved.actions.flatMap((item) => {
|
|
17370
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.id === "string" && typeof item.label === "string")
|
|
17371
|
+
return [{ id: item.id, label: item.label, description: typeof item.description === "string" ? item.description : void 0 }];
|
|
17372
|
+
return [];
|
|
17373
|
+
}) : [];
|
|
17374
|
+
const payoffMatrix = Array.isArray(resolved?.payoffMatrix) ? resolved.payoffMatrix.flatMap((item) => {
|
|
17375
|
+
if (item !== null && typeof item === "object" && !Array.isArray(item) && !(item instanceof Date) && typeof item.playerAction === "string" && typeof item.opponentAction === "string")
|
|
17376
|
+
return [{ playerAction: item.playerAction, opponentAction: item.opponentAction, playerPayoff: typeof item.playerPayoff === "number" ? item.playerPayoff : 0, opponentPayoff: typeof item.opponentPayoff === "number" ? item.opponentPayoff : 0 }];
|
|
17377
|
+
return [];
|
|
17378
|
+
}) : [];
|
|
17379
|
+
const prevRoundRef = useRef(currentRound);
|
|
17380
|
+
useEffect(() => {
|
|
17381
|
+
if (currentRound > prevRoundRef.current && lastPlayerAction) {
|
|
17382
|
+
const opponentPayoffEntry = payoffMatrix.find(
|
|
17383
|
+
(p) => p.playerAction === lastPlayerAction && p.opponentAction === lastOpponentAction
|
|
17384
|
+
);
|
|
17385
|
+
setHistory((prev) => [
|
|
17386
|
+
...prev,
|
|
17387
|
+
{
|
|
17388
|
+
round: currentRound,
|
|
17389
|
+
playerAction: lastPlayerAction,
|
|
17390
|
+
opponentAction: lastOpponentAction,
|
|
17391
|
+
playerPayoff: lastPayoff,
|
|
17392
|
+
opponentPayoff: opponentPayoffEntry?.opponentPayoff ?? 0
|
|
17393
|
+
}
|
|
17394
|
+
]);
|
|
17395
|
+
}
|
|
17396
|
+
prevRoundRef.current = currentRound;
|
|
17397
|
+
}, [currentRound, lastPlayerAction, lastOpponentAction, lastPayoff, payoffMatrix]);
|
|
17398
|
+
const opponentTotal = useMemo(() => history.reduce((s, r2) => s + r2.opponentPayoff, 0), [history]);
|
|
17399
|
+
const handleAction = useCallback((actionId) => {
|
|
17400
|
+
if (isComplete) return;
|
|
17401
|
+
if (playRoundEvent) {
|
|
17402
|
+
emit(`UI:${playRoundEvent}`, { playerAction: actionId, payoff: 0 });
|
|
17403
|
+
}
|
|
17404
|
+
if (totalRounds > 0 && currentRound + 1 >= totalRounds) {
|
|
17405
|
+
if (finishEvent) {
|
|
17406
|
+
emit(`UI:${finishEvent}`, {});
|
|
17407
|
+
}
|
|
17408
|
+
if (str(resolved?.hint)) {
|
|
17409
|
+
setShowHint(true);
|
|
17410
|
+
}
|
|
17411
|
+
}
|
|
17412
|
+
}, [isComplete, resolved, totalRounds, currentRound, playRoundEvent, finishEvent, emit]);
|
|
17413
|
+
const handleReset = useCallback(() => {
|
|
17414
|
+
setHistory([]);
|
|
17415
|
+
setShowHint(false);
|
|
17416
|
+
prevRoundRef.current = 0;
|
|
17417
|
+
if (playAgainEvent) {
|
|
17418
|
+
emit(`UI:${playAgainEvent}`, {});
|
|
17419
|
+
}
|
|
17420
|
+
}, [playAgainEvent, emit]);
|
|
17421
|
+
const completedRef = useRef(false);
|
|
17422
|
+
useEffect(() => {
|
|
17423
|
+
if (result === "win" && !completedRef.current) {
|
|
17424
|
+
completedRef.current = true;
|
|
17425
|
+
emit(`UI:${completeEvent}`, { success: true, score: playerTotal });
|
|
17426
|
+
} else if (result === "none") {
|
|
17427
|
+
completedRef.current = false;
|
|
17428
|
+
}
|
|
17429
|
+
}, [result, playerTotal, completeEvent, emit]);
|
|
17430
|
+
const getActionLabel = (id) => actions.find((a) => a.id === id)?.label ?? id;
|
|
17431
|
+
if (!resolved) return null;
|
|
17432
|
+
const theme = resolved.theme ?? void 0;
|
|
17433
|
+
const themeBackground = theme?.background;
|
|
17434
|
+
const headerImage = str(resolved.headerImage);
|
|
17435
|
+
const hint = str(resolved.hint);
|
|
17436
|
+
return /* @__PURE__ */ jsx(
|
|
17437
|
+
Box,
|
|
17438
|
+
{
|
|
17439
|
+
className,
|
|
17440
|
+
style: {
|
|
17441
|
+
backgroundImage: themeBackground ? `url(${themeBackground})` : void 0,
|
|
17442
|
+
backgroundSize: "cover",
|
|
17443
|
+
backgroundPosition: "center"
|
|
17444
|
+
},
|
|
17445
|
+
children: /* @__PURE__ */ jsxs(VStack, { gap: "lg", className: "p-4", children: [
|
|
17446
|
+
headerImage && !headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 overflow-hidden rounded-container", children: /* @__PURE__ */ jsx("img", { src: headerImage, alt: "", onError: () => setHeaderError(true), className: "w-full h-full object-cover" }) }) : headerImage && headerError ? /* @__PURE__ */ jsx(Box, { className: "w-full h-32 rounded-container bg-gradient-to-br from-muted to-accent opacity-60" }) : null,
|
|
17447
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17448
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h4", weight: "bold", children: str(resolved.title) }),
|
|
17449
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: str(resolved.description) }),
|
|
17450
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
|
|
17451
|
+
/* @__PURE__ */ jsx(Badge, { size: "sm", children: t("negotiator.round", { current: String(currentRound), total: String(totalRounds) }) }),
|
|
17452
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
17453
|
+
t("negotiator.target"),
|
|
17454
|
+
": ",
|
|
17455
|
+
targetScore
|
|
17456
|
+
] })
|
|
17457
|
+
] })
|
|
17458
|
+
] }) }),
|
|
17459
|
+
/* @__PURE__ */ jsxs(HStack, { gap: "md", justify: "center", children: [
|
|
17460
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
|
|
17461
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.you") }),
|
|
17462
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: playerTotal })
|
|
17463
|
+
] }) }),
|
|
17464
|
+
/* @__PURE__ */ jsx(Card, { className: "p-4 flex-1 text-center", children: /* @__PURE__ */ jsxs(VStack, { gap: "xs", align: "center", children: [
|
|
17465
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: t("negotiator.opponent") }),
|
|
17466
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h3", weight: "bold", children: opponentTotal })
|
|
17467
|
+
] }) })
|
|
17468
|
+
] }),
|
|
17469
|
+
!isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17470
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.chooseAction") }),
|
|
17471
|
+
/* @__PURE__ */ jsx(HStack, { gap: "sm", justify: "center", className: "flex-wrap", children: actions.map((action) => /* @__PURE__ */ jsx(
|
|
17472
|
+
Button,
|
|
17473
|
+
{
|
|
17474
|
+
variant: "primary",
|
|
17475
|
+
onClick: () => handleAction(action.id),
|
|
17476
|
+
children: action.label
|
|
17477
|
+
},
|
|
17478
|
+
action.id
|
|
17479
|
+
)) })
|
|
17480
|
+
] }) }),
|
|
17481
|
+
history.length > 0 && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
|
|
17482
|
+
/* @__PURE__ */ jsx(Typography, { variant: "small", weight: "bold", className: "uppercase tracking-wider text-muted-foreground", children: t("negotiator.history") }),
|
|
17483
|
+
history.map((round) => /* @__PURE__ */ jsxs(HStack, { gap: "sm", align: "center", className: "text-sm", children: [
|
|
17484
|
+
/* @__PURE__ */ jsxs(Badge, { size: "sm", children: [
|
|
17485
|
+
"R",
|
|
17486
|
+
round.round
|
|
17487
|
+
] }),
|
|
17488
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.playerAction) }),
|
|
17489
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-muted-foreground", children: "vs" }),
|
|
17490
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", children: getActionLabel(round.opponentAction) }),
|
|
17491
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: ArrowRight, assetUrl: ui?.["arrow"], size: "sm" }),
|
|
17492
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", weight: "bold", className: "text-success", children: [
|
|
17493
|
+
"+",
|
|
17494
|
+
round.playerPayoff
|
|
17495
|
+
] }),
|
|
17496
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
17497
|
+
"/ +",
|
|
17498
|
+
round.opponentPayoff
|
|
17499
|
+
] })
|
|
17500
|
+
] }, round.round))
|
|
17501
|
+
] }) }),
|
|
17502
|
+
isComplete && /* @__PURE__ */ jsx(Card, { className: "p-4", children: /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", children: [
|
|
17503
|
+
/* @__PURE__ */ jsx(GameIcon, { icon: CheckCircle, assetUrl: ui?.["correct"], size: "lg", className: won ? "text-success" : "text-error" }),
|
|
17504
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", weight: "bold", children: won ? str(resolved.successMessage) || t("negotiator.success") : str(resolved.failMessage) || t("negotiator.failed") }),
|
|
17505
|
+
/* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "text-muted-foreground", children: [
|
|
17506
|
+
t("negotiator.finalScore"),
|
|
17507
|
+
": ",
|
|
17508
|
+
playerTotal,
|
|
17509
|
+
"/",
|
|
17510
|
+
targetScore
|
|
17511
|
+
] })
|
|
17512
|
+
] }) }),
|
|
17513
|
+
showHint && hint && !won && /* @__PURE__ */ jsx(Card, { className: "p-4 border-l-4 border-l-warning", children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: hint }) }),
|
|
17514
|
+
isComplete && !won && /* @__PURE__ */ jsx(HStack, { justify: "center", children: /* @__PURE__ */ jsx(Button, { variant: "primary", onClick: handleReset, children: t("negotiator.playAgain") }) })
|
|
17515
|
+
] })
|
|
17516
|
+
}
|
|
17517
|
+
);
|
|
17518
|
+
}
|
|
17519
|
+
var init_NegotiatorBoard = __esm({
|
|
17520
|
+
"components/game/2d/organisms/NegotiatorBoard.tsx"() {
|
|
17521
|
+
init_atoms();
|
|
17522
|
+
init_useEventBus();
|
|
17523
|
+
init_boardEntity();
|
|
17524
|
+
init_GameIcon();
|
|
17525
|
+
NegotiatorBoard.displayName = "NegotiatorBoard";
|
|
17526
|
+
}
|
|
17527
|
+
});
|
|
15361
17528
|
|
|
15362
17529
|
// components/game/shared/lib/mechanics.ts
|
|
15363
17530
|
var projectileMotion, pendulum, springOscillator;
|
|
@@ -15565,7 +17732,7 @@ function SimulationCanvas({
|
|
|
15565
17732
|
}
|
|
15566
17733
|
var PRESET_BY_ID;
|
|
15567
17734
|
var init_SimulationCanvas = __esm({
|
|
15568
|
-
"components/game/2d/
|
|
17735
|
+
"components/game/2d/organisms/SimulationCanvas.tsx"() {
|
|
15569
17736
|
init_cn();
|
|
15570
17737
|
init_atoms();
|
|
15571
17738
|
init_verificationRegistry();
|
|
@@ -16187,7 +18354,7 @@ var init_ErrorBoundary = __esm({
|
|
|
16187
18354
|
}
|
|
16188
18355
|
);
|
|
16189
18356
|
};
|
|
16190
|
-
ErrorBoundary = class extends
|
|
18357
|
+
ErrorBoundary = class extends React105__default.Component {
|
|
16191
18358
|
constructor(props) {
|
|
16192
18359
|
super(props);
|
|
16193
18360
|
__publicField(this, "reset", () => {
|
|
@@ -16232,15 +18399,15 @@ function HeaderSkeleton({ className }) {
|
|
|
16232
18399
|
] })
|
|
16233
18400
|
] });
|
|
16234
18401
|
}
|
|
16235
|
-
function TableSkeleton({ rows = 5, columns = 4, className }) {
|
|
18402
|
+
function TableSkeleton({ rows: rows2 = 5, columns = 4, className }) {
|
|
16236
18403
|
return /* @__PURE__ */ jsxs(VStack, { gap: "none", className: cn("border border-border rounded-lg overflow-hidden", className), children: [
|
|
16237
18404
|
/* @__PURE__ */ jsx(HStack, { className: "px-4 py-3 bg-muted/30 border-b border-border", children: Array.from({ length: columns }).map((_, i) => /* @__PURE__ */ jsx(SkeletonBlock, { className: "h-4 flex-1 mx-2" }, i)) }),
|
|
16238
|
-
Array.from({ length:
|
|
18405
|
+
Array.from({ length: rows2 }).map((_, rowIdx) => /* @__PURE__ */ jsx(
|
|
16239
18406
|
HStack,
|
|
16240
18407
|
{
|
|
16241
18408
|
className: cn(
|
|
16242
18409
|
"px-4 py-3",
|
|
16243
|
-
rowIdx <
|
|
18410
|
+
rowIdx < rows2 - 1 && "border-b border-border"
|
|
16244
18411
|
),
|
|
16245
18412
|
children: Array.from({ length: columns }).map((_2, colIdx) => /* @__PURE__ */ jsx(SkeletonLine, { className: "flex-1 mx-2" }, colIdx))
|
|
16246
18413
|
},
|
|
@@ -16288,18 +18455,18 @@ function CardSkeleton({ className }) {
|
|
|
16288
18455
|
}
|
|
16289
18456
|
);
|
|
16290
18457
|
}
|
|
16291
|
-
function TextSkeleton({ rows = 3, className }) {
|
|
16292
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className, children: Array.from({ length:
|
|
18458
|
+
function TextSkeleton({ rows: rows2 = 3, className }) {
|
|
18459
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className, children: Array.from({ length: rows2 }).map((_, i) => /* @__PURE__ */ jsx(
|
|
16293
18460
|
SkeletonLine,
|
|
16294
18461
|
{
|
|
16295
|
-
className: i ===
|
|
18462
|
+
className: i === rows2 - 1 ? "w-2/3" : "w-full"
|
|
16296
18463
|
},
|
|
16297
18464
|
i
|
|
16298
18465
|
)) });
|
|
16299
18466
|
}
|
|
16300
18467
|
function Skeleton({
|
|
16301
18468
|
variant = "text",
|
|
16302
|
-
rows,
|
|
18469
|
+
rows: rows2,
|
|
16303
18470
|
columns,
|
|
16304
18471
|
fields,
|
|
16305
18472
|
className
|
|
@@ -16309,15 +18476,15 @@ function Skeleton({
|
|
|
16309
18476
|
case "header":
|
|
16310
18477
|
return /* @__PURE__ */ jsx(HeaderSkeleton, { className });
|
|
16311
18478
|
case "table":
|
|
16312
|
-
return /* @__PURE__ */ jsx(TableSkeleton, { rows, columns, className });
|
|
18479
|
+
return /* @__PURE__ */ jsx(TableSkeleton, { rows: rows2, columns, className });
|
|
16313
18480
|
case "form":
|
|
16314
18481
|
return /* @__PURE__ */ jsx(FormSkeleton, { fields, className });
|
|
16315
18482
|
case "card":
|
|
16316
18483
|
return /* @__PURE__ */ jsx(CardSkeleton, { className });
|
|
16317
18484
|
case "text":
|
|
16318
|
-
return /* @__PURE__ */ jsx(TextSkeleton, { rows, className });
|
|
18485
|
+
return /* @__PURE__ */ jsx(TextSkeleton, { rows: rows2, className });
|
|
16319
18486
|
default:
|
|
16320
|
-
return /* @__PURE__ */ jsx(TextSkeleton, { rows, className });
|
|
18487
|
+
return /* @__PURE__ */ jsx(TextSkeleton, { rows: rows2, className });
|
|
16321
18488
|
}
|
|
16322
18489
|
}
|
|
16323
18490
|
var pulseClass;
|
|
@@ -16469,7 +18636,7 @@ var init_Container = __esm({
|
|
|
16469
18636
|
as: Component = "div"
|
|
16470
18637
|
}) => {
|
|
16471
18638
|
const resolvedSize = maxWidth ?? size ?? "lg";
|
|
16472
|
-
return
|
|
18639
|
+
return React105__default.createElement(
|
|
16473
18640
|
Component,
|
|
16474
18641
|
{
|
|
16475
18642
|
className: cn(
|
|
@@ -18310,7 +20477,7 @@ var init_CodeBlock = __esm({
|
|
|
18310
20477
|
DIFF_STYLE_FALLBACK = { bg: "", prefix: " ", text: "text-foreground" };
|
|
18311
20478
|
LINE_PROPS_FN = (n) => ({ "data-line": String(n - 1) });
|
|
18312
20479
|
HIDDEN_LINE_NUMBERS = { display: "none" };
|
|
18313
|
-
CodeBlock =
|
|
20480
|
+
CodeBlock = React105__default.memo(
|
|
18314
20481
|
({
|
|
18315
20482
|
code: rawCode,
|
|
18316
20483
|
language = "text",
|
|
@@ -18479,24 +20646,24 @@ var init_CodeBlock = __esm({
|
|
|
18479
20646
|
return;
|
|
18480
20647
|
}
|
|
18481
20648
|
lineEls.forEach((el) => {
|
|
18482
|
-
const
|
|
18483
|
-
if (hiddenLines.has(
|
|
20649
|
+
const num2 = parseInt(el.getAttribute("data-line") ?? "-1", 10);
|
|
20650
|
+
if (hiddenLines.has(num2)) {
|
|
18484
20651
|
el.style.display = "none";
|
|
18485
20652
|
return;
|
|
18486
20653
|
}
|
|
18487
20654
|
el.style.display = "";
|
|
18488
20655
|
el.style.position = "relative";
|
|
18489
20656
|
el.style.paddingLeft = "1.2em";
|
|
18490
|
-
const region = foldStartMap.get(
|
|
20657
|
+
const region = foldStartMap.get(num2);
|
|
18491
20658
|
if (!region) return;
|
|
18492
|
-
const isCollapsed = collapsed.has(
|
|
20659
|
+
const isCollapsed = collapsed.has(num2);
|
|
18493
20660
|
const toggle = document.createElement("span");
|
|
18494
20661
|
toggle.className = "fold-toggle";
|
|
18495
20662
|
toggle.textContent = isCollapsed ? "\u25B6" : "\u25BC";
|
|
18496
20663
|
toggle.style.cssText = "position:absolute;left:0;top:0;width:1.2em;text-align:center;cursor:pointer;color:#858585;font-size:10px;user-select:none;line-height:inherit;height:100%";
|
|
18497
20664
|
toggle.addEventListener("click", (e) => {
|
|
18498
20665
|
e.stopPropagation();
|
|
18499
|
-
toggleFoldRef.current(
|
|
20666
|
+
toggleFoldRef.current(num2);
|
|
18500
20667
|
});
|
|
18501
20668
|
el.insertBefore(toggle, el.firstChild);
|
|
18502
20669
|
if (isCollapsed) {
|
|
@@ -18897,7 +21064,7 @@ var init_MarkdownContent = __esm({
|
|
|
18897
21064
|
init_Box();
|
|
18898
21065
|
init_CodeBlock();
|
|
18899
21066
|
init_cn();
|
|
18900
|
-
MarkdownContent =
|
|
21067
|
+
MarkdownContent = React105__default.memo(
|
|
18901
21068
|
({ content, direction = "ltr", className }) => {
|
|
18902
21069
|
const { t: _t } = useTranslate();
|
|
18903
21070
|
const safeContent = typeof content === "string" ? content : String(content ?? "");
|
|
@@ -19466,7 +21633,7 @@ var init_QuizBlock = __esm({
|
|
|
19466
21633
|
QuizBlock.displayName = "QuizBlock";
|
|
19467
21634
|
}
|
|
19468
21635
|
});
|
|
19469
|
-
var
|
|
21636
|
+
var StateNode2, TransitionBundleArrow, BundleTooltip, EntityBox, OutputsBox, Legend, StateMachineView;
|
|
19470
21637
|
var init_StateMachineView = __esm({
|
|
19471
21638
|
"components/core/organisms/StateMachineView.tsx"() {
|
|
19472
21639
|
"use client";
|
|
@@ -19478,7 +21645,7 @@ var init_StateMachineView = __esm({
|
|
|
19478
21645
|
init_Icon();
|
|
19479
21646
|
init_useEventBus();
|
|
19480
21647
|
init_cn();
|
|
19481
|
-
|
|
21648
|
+
StateNode2 = ({ state, config }) => {
|
|
19482
21649
|
const { t } = useTranslate();
|
|
19483
21650
|
const size = state.radius * 2;
|
|
19484
21651
|
let borderColor = config.colors.nodeBorder;
|
|
@@ -20224,8 +22391,8 @@ var init_StateMachineView = __esm({
|
|
|
20224
22391
|
style: { top: title ? 30 : 0 },
|
|
20225
22392
|
children: [
|
|
20226
22393
|
entity && /* @__PURE__ */ jsx(EntityBox, { entity, config }),
|
|
20227
|
-
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(
|
|
20228
|
-
|
|
22394
|
+
states.map((state) => renderStateNode ? /* @__PURE__ */ jsx(React105__default.Fragment, { children: renderStateNode(state, config) }, state.id) : /* @__PURE__ */ jsx(
|
|
22395
|
+
StateNode2,
|
|
20229
22396
|
{
|
|
20230
22397
|
state,
|
|
20231
22398
|
config
|
|
@@ -25862,8 +28029,8 @@ var init_Menu = __esm({
|
|
|
25862
28029
|
"bottom-end": "bottom-start"
|
|
25863
28030
|
};
|
|
25864
28031
|
const effectivePosition = direction === "rtl" ? rtlMirror[position] ?? position : position;
|
|
25865
|
-
const triggerChild =
|
|
25866
|
-
const triggerElement =
|
|
28032
|
+
const triggerChild = React105__default.isValidElement(trigger) ? trigger : /* @__PURE__ */ jsx(Typography, { variant: "small", as: "span", children: trigger });
|
|
28033
|
+
const triggerElement = React105__default.cloneElement(
|
|
25867
28034
|
triggerChild,
|
|
25868
28035
|
{
|
|
25869
28036
|
ref: triggerRef,
|
|
@@ -25958,14 +28125,14 @@ function useDataDnd(args) {
|
|
|
25958
28125
|
const isZone = Boolean(dragGroup || accepts || sortable);
|
|
25959
28126
|
const enabled = isZone || Boolean(dndRoot);
|
|
25960
28127
|
const eventBus = useEventBus();
|
|
25961
|
-
const parentRoot =
|
|
28128
|
+
const parentRoot = React105__default.useContext(RootCtx);
|
|
25962
28129
|
const isRoot = enabled && parentRoot === null;
|
|
25963
|
-
const zoneId =
|
|
28130
|
+
const zoneId = React105__default.useId();
|
|
25964
28131
|
const ownGroup = dragGroup ?? accepts ?? zoneId;
|
|
25965
|
-
const [optimisticOrders, setOptimisticOrders] =
|
|
25966
|
-
const optimisticOrdersRef =
|
|
28132
|
+
const [optimisticOrders, setOptimisticOrders] = React105__default.useState(() => /* @__PURE__ */ new Map());
|
|
28133
|
+
const optimisticOrdersRef = React105__default.useRef(optimisticOrders);
|
|
25967
28134
|
optimisticOrdersRef.current = optimisticOrders;
|
|
25968
|
-
const clearOptimisticOrder =
|
|
28135
|
+
const clearOptimisticOrder = React105__default.useCallback((group) => {
|
|
25969
28136
|
setOptimisticOrders((prev) => {
|
|
25970
28137
|
if (!prev.has(group)) return prev;
|
|
25971
28138
|
const next = new Map(prev);
|
|
@@ -25990,7 +28157,7 @@ function useDataDnd(args) {
|
|
|
25990
28157
|
const raw = it[dndItemIdField];
|
|
25991
28158
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
25992
28159
|
}).join("|");
|
|
25993
|
-
const itemIds =
|
|
28160
|
+
const itemIds = React105__default.useMemo(
|
|
25994
28161
|
() => orderedItems.map((it, idx) => {
|
|
25995
28162
|
const raw = it[dndItemIdField];
|
|
25996
28163
|
return raw != null ? String(raw) : `__idx_${idx}`;
|
|
@@ -26001,7 +28168,7 @@ function useDataDnd(args) {
|
|
|
26001
28168
|
const raw = it[dndItemIdField];
|
|
26002
28169
|
return raw != null ? String(raw) : `__${idx}`;
|
|
26003
28170
|
}).join("|");
|
|
26004
|
-
|
|
28171
|
+
React105__default.useEffect(() => {
|
|
26005
28172
|
const root = isRoot ? null : parentRoot;
|
|
26006
28173
|
if (root) {
|
|
26007
28174
|
root.clearOptimisticOrder(ownGroup);
|
|
@@ -26009,20 +28176,20 @@ function useDataDnd(args) {
|
|
|
26009
28176
|
clearOptimisticOrder(ownGroup);
|
|
26010
28177
|
}
|
|
26011
28178
|
}, [itemsContentSig, ownGroup]);
|
|
26012
|
-
const zonesRef =
|
|
26013
|
-
const registerZone =
|
|
28179
|
+
const zonesRef = React105__default.useRef(/* @__PURE__ */ new Map());
|
|
28180
|
+
const registerZone = React105__default.useCallback((zoneId2, meta2) => {
|
|
26014
28181
|
zonesRef.current.set(zoneId2, meta2);
|
|
26015
28182
|
}, []);
|
|
26016
|
-
const unregisterZone =
|
|
28183
|
+
const unregisterZone = React105__default.useCallback((zoneId2) => {
|
|
26017
28184
|
zonesRef.current.delete(zoneId2);
|
|
26018
28185
|
}, []);
|
|
26019
|
-
const [activeDrag, setActiveDrag] =
|
|
26020
|
-
const [overZoneGroup, setOverZoneGroup] =
|
|
26021
|
-
const meta =
|
|
28186
|
+
const [activeDrag, setActiveDrag] = React105__default.useState(null);
|
|
28187
|
+
const [overZoneGroup, setOverZoneGroup] = React105__default.useState(null);
|
|
28188
|
+
const meta = React105__default.useMemo(
|
|
26022
28189
|
() => ({ group: ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, rawItems: items, idField: dndItemIdField }),
|
|
26023
28190
|
[ownGroup, dropEvent, reorderEvent, positionEvent, itemIds, items, dndItemIdField]
|
|
26024
28191
|
);
|
|
26025
|
-
|
|
28192
|
+
React105__default.useEffect(() => {
|
|
26026
28193
|
const target = isRoot ? null : parentRoot;
|
|
26027
28194
|
if (!target) {
|
|
26028
28195
|
zonesRef.current.set(zoneId, meta);
|
|
@@ -26041,7 +28208,7 @@ function useDataDnd(args) {
|
|
|
26041
28208
|
}, [parentRoot, isRoot, zoneId, meta]);
|
|
26042
28209
|
const sensors = useAlmadarDndSensors(true);
|
|
26043
28210
|
const collisionDetection = almadarDndCollisionDetection;
|
|
26044
|
-
const findZoneByItem =
|
|
28211
|
+
const findZoneByItem = React105__default.useCallback(
|
|
26045
28212
|
(id) => {
|
|
26046
28213
|
for (const z of zonesRef.current.values()) {
|
|
26047
28214
|
if (z.itemIds.includes(id)) return z;
|
|
@@ -26050,7 +28217,7 @@ function useDataDnd(args) {
|
|
|
26050
28217
|
},
|
|
26051
28218
|
[]
|
|
26052
28219
|
);
|
|
26053
|
-
|
|
28220
|
+
React105__default.useCallback(
|
|
26054
28221
|
(group) => {
|
|
26055
28222
|
for (const z of zonesRef.current.values()) {
|
|
26056
28223
|
if (z.group === group) return z;
|
|
@@ -26059,7 +28226,7 @@ function useDataDnd(args) {
|
|
|
26059
28226
|
},
|
|
26060
28227
|
[]
|
|
26061
28228
|
);
|
|
26062
|
-
const handleDragEnd =
|
|
28229
|
+
const handleDragEnd = React105__default.useCallback(
|
|
26063
28230
|
(event) => {
|
|
26064
28231
|
const { active, over } = event;
|
|
26065
28232
|
const activeIdStr = String(active.id);
|
|
@@ -26150,8 +28317,8 @@ function useDataDnd(args) {
|
|
|
26150
28317
|
},
|
|
26151
28318
|
[eventBus]
|
|
26152
28319
|
);
|
|
26153
|
-
const sortableData =
|
|
26154
|
-
const SortableItem =
|
|
28320
|
+
const sortableData = React105__default.useMemo(() => ({ dndGroup: ownGroup }), [ownGroup]);
|
|
28321
|
+
const SortableItem = React105__default.useCallback(
|
|
26155
28322
|
({ id, children }) => {
|
|
26156
28323
|
const {
|
|
26157
28324
|
attributes,
|
|
@@ -26191,7 +28358,7 @@ function useDataDnd(args) {
|
|
|
26191
28358
|
id: droppableId,
|
|
26192
28359
|
data: sortableData
|
|
26193
28360
|
});
|
|
26194
|
-
const ctx =
|
|
28361
|
+
const ctx = React105__default.useContext(RootCtx);
|
|
26195
28362
|
const activeDrag2 = ctx?.activeDrag ?? null;
|
|
26196
28363
|
const overZoneGroup2 = ctx?.overZoneGroup ?? null;
|
|
26197
28364
|
const isThisZoneOver = overZoneGroup2 === ownGroup;
|
|
@@ -26206,7 +28373,7 @@ function useDataDnd(args) {
|
|
|
26206
28373
|
showForeignPlaceholder,
|
|
26207
28374
|
ctxAvailable: ctx != null
|
|
26208
28375
|
});
|
|
26209
|
-
|
|
28376
|
+
React105__default.useEffect(() => {
|
|
26210
28377
|
dndLog.info("dropzone:isOver:change", { droppableId, group: ownGroup, isOver, isThisZoneOver, showForeignPlaceholder, activeDragSourceGroup: activeDrag2?.sourceGroup ?? null });
|
|
26211
28378
|
}, [droppableId, isOver, isThisZoneOver, showForeignPlaceholder]);
|
|
26212
28379
|
return /* @__PURE__ */ jsx(
|
|
@@ -26220,11 +28387,11 @@ function useDataDnd(args) {
|
|
|
26220
28387
|
}
|
|
26221
28388
|
);
|
|
26222
28389
|
};
|
|
26223
|
-
const rootContextValue =
|
|
28390
|
+
const rootContextValue = React105__default.useMemo(
|
|
26224
28391
|
() => ({ registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder }),
|
|
26225
28392
|
[registerZone, unregisterZone, activeDrag, overZoneGroup, optimisticOrders, clearOptimisticOrder]
|
|
26226
28393
|
);
|
|
26227
|
-
const handleDragStart =
|
|
28394
|
+
const handleDragStart = React105__default.useCallback((event) => {
|
|
26228
28395
|
const sourceZone = findZoneByItem(event.active.id);
|
|
26229
28396
|
const rect = event.active.rect.current.initial;
|
|
26230
28397
|
const height = rect?.height && rect.height > 0 ? rect.height : 64;
|
|
@@ -26243,7 +28410,7 @@ function useDataDnd(args) {
|
|
|
26243
28410
|
isRoot
|
|
26244
28411
|
});
|
|
26245
28412
|
}, [findZoneByItem, isRoot, zoneId]);
|
|
26246
|
-
const handleDragOver =
|
|
28413
|
+
const handleDragOver = React105__default.useCallback((event) => {
|
|
26247
28414
|
const { active, over } = event;
|
|
26248
28415
|
const overData = over?.data?.current;
|
|
26249
28416
|
const overGroup = overData?.dndGroup ?? null;
|
|
@@ -26313,7 +28480,7 @@ function useDataDnd(args) {
|
|
|
26313
28480
|
return next;
|
|
26314
28481
|
});
|
|
26315
28482
|
}, []);
|
|
26316
|
-
const handleDragCancel =
|
|
28483
|
+
const handleDragCancel = React105__default.useCallback((event) => {
|
|
26317
28484
|
setActiveDrag(null);
|
|
26318
28485
|
setOverZoneGroup(null);
|
|
26319
28486
|
dndLog.warn("dragCancel", {
|
|
@@ -26321,12 +28488,12 @@ function useDataDnd(args) {
|
|
|
26321
28488
|
reason: "dnd-kit cancelled the drag (escape key, pointer interrupted, or external)"
|
|
26322
28489
|
});
|
|
26323
28490
|
}, []);
|
|
26324
|
-
const handleDragEndWithCleanup =
|
|
28491
|
+
const handleDragEndWithCleanup = React105__default.useCallback((event) => {
|
|
26325
28492
|
handleDragEnd(event);
|
|
26326
28493
|
setActiveDrag(null);
|
|
26327
28494
|
setOverZoneGroup(null);
|
|
26328
28495
|
}, [handleDragEnd]);
|
|
26329
|
-
const wrapContainer =
|
|
28496
|
+
const wrapContainer = React105__default.useCallback(
|
|
26330
28497
|
(children) => {
|
|
26331
28498
|
if (!enabled) return children;
|
|
26332
28499
|
const strategy = layout === "grid" ? rectSortingStrategy : verticalListSortingStrategy;
|
|
@@ -26380,7 +28547,7 @@ var init_useDataDnd = __esm({
|
|
|
26380
28547
|
init_useAlmadarDndCollision();
|
|
26381
28548
|
init_Box();
|
|
26382
28549
|
dndLog = createLogger("almadar:ui:dnd");
|
|
26383
|
-
RootCtx =
|
|
28550
|
+
RootCtx = React105__default.createContext(null);
|
|
26384
28551
|
}
|
|
26385
28552
|
});
|
|
26386
28553
|
function renderIconInput(icon, props) {
|
|
@@ -26906,7 +29073,7 @@ function DataList({
|
|
|
26906
29073
|
}) {
|
|
26907
29074
|
const eventBus = useEventBus();
|
|
26908
29075
|
const { t } = useTranslate();
|
|
26909
|
-
const [visibleCount, setVisibleCount] =
|
|
29076
|
+
const [visibleCount, setVisibleCount] = React105__default.useState(pageSize || Infinity);
|
|
26910
29077
|
const fieldDefs = fields ?? columns ?? [];
|
|
26911
29078
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
26912
29079
|
const dnd = useDataDnd({
|
|
@@ -26925,7 +29092,7 @@ function DataList({
|
|
|
26925
29092
|
const data = pageSize > 0 ? allData.slice(0, visibleCount) : allData;
|
|
26926
29093
|
const hasMoreLocal = pageSize > 0 && visibleCount < allData.length;
|
|
26927
29094
|
const hasRenderProp = typeof children === "function";
|
|
26928
|
-
|
|
29095
|
+
React105__default.useEffect(() => {
|
|
26929
29096
|
const renderItemTypeOf = typeof schemaRenderItem;
|
|
26930
29097
|
const childrenTypeOf = typeof children;
|
|
26931
29098
|
if (data.length > 0 && !hasRenderProp) {
|
|
@@ -27029,7 +29196,7 @@ function DataList({
|
|
|
27029
29196
|
const items2 = [...data];
|
|
27030
29197
|
const groups2 = groupBy ? groupData(items2, groupBy) : [{ label: "", items: items2 }];
|
|
27031
29198
|
const contentField = titleField?.name ?? fieldDefs[0]?.name ?? "";
|
|
27032
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
29199
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "sm", className: cn("py-2", className), children: groups2.map((group, gi) => /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
27033
29200
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: "my-2" }),
|
|
27034
29201
|
group.items.map((itemData, index) => {
|
|
27035
29202
|
const id = itemData.id || `${gi}-${index}`;
|
|
@@ -27170,7 +29337,7 @@ function DataList({
|
|
|
27170
29337
|
className
|
|
27171
29338
|
),
|
|
27172
29339
|
children: [
|
|
27173
|
-
groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
29340
|
+
groups.map((group, gi) => /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
27174
29341
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-4" : "mt-0" }),
|
|
27175
29342
|
group.items.map(
|
|
27176
29343
|
(itemData, index) => renderItem(itemData, index, gi === groups.length - 1 && index === group.items.length - 1)
|
|
@@ -27255,7 +29422,7 @@ var init_FormSection = __esm({
|
|
|
27255
29422
|
columns = 1,
|
|
27256
29423
|
className
|
|
27257
29424
|
}) => {
|
|
27258
|
-
const [collapsed, setCollapsed] =
|
|
29425
|
+
const [collapsed, setCollapsed] = React105__default.useState(defaultCollapsed);
|
|
27259
29426
|
const { t } = useTranslate();
|
|
27260
29427
|
const eventBus = useEventBus();
|
|
27261
29428
|
const gridClass = {
|
|
@@ -27263,7 +29430,7 @@ var init_FormSection = __esm({
|
|
|
27263
29430
|
2: "grid-cols-1 md:grid-cols-2",
|
|
27264
29431
|
3: "grid-cols-1 md:grid-cols-2 lg:grid-cols-3"
|
|
27265
29432
|
}[columns];
|
|
27266
|
-
|
|
29433
|
+
React105__default.useCallback(() => {
|
|
27267
29434
|
if (collapsible) {
|
|
27268
29435
|
setCollapsed((prev) => !prev);
|
|
27269
29436
|
eventBus.emit("UI:TOGGLE_COLLAPSE", { collapsed: !collapsed });
|
|
@@ -28213,7 +30380,7 @@ var init_Flex = __esm({
|
|
|
28213
30380
|
flexStyle.flexBasis = typeof basis === "number" ? `${basis}px` : basis;
|
|
28214
30381
|
}
|
|
28215
30382
|
}
|
|
28216
|
-
return
|
|
30383
|
+
return React105__default.createElement(Component, {
|
|
28217
30384
|
className: cn(
|
|
28218
30385
|
inline ? "inline-flex" : "flex",
|
|
28219
30386
|
directionStyles[direction],
|
|
@@ -28319,7 +30486,7 @@ var init_Grid = __esm({
|
|
|
28319
30486
|
};
|
|
28320
30487
|
Grid = ({
|
|
28321
30488
|
cols = 1,
|
|
28322
|
-
rows,
|
|
30489
|
+
rows: rows2,
|
|
28323
30490
|
gap = "md",
|
|
28324
30491
|
rowGap,
|
|
28325
30492
|
colGap,
|
|
@@ -28331,8 +30498,8 @@ var init_Grid = __esm({
|
|
|
28331
30498
|
children,
|
|
28332
30499
|
as: Component = "div"
|
|
28333
30500
|
}) => {
|
|
28334
|
-
const mergedStyle =
|
|
28335
|
-
return
|
|
30501
|
+
const mergedStyle = rows2 ? { gridTemplateRows: `repeat(${rows2}, minmax(0, 1fr))`, ...style } : style;
|
|
30502
|
+
return React105__default.createElement(
|
|
28336
30503
|
Component,
|
|
28337
30504
|
{
|
|
28338
30505
|
className: cn(
|
|
@@ -28528,9 +30695,9 @@ var init_Popover = __esm({
|
|
|
28528
30695
|
onMouseLeave: handleClose,
|
|
28529
30696
|
onPointerDown: tapTriggerProps.onPointerDown
|
|
28530
30697
|
};
|
|
28531
|
-
const childElement =
|
|
30698
|
+
const childElement = React105__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
28532
30699
|
const childPointerDown = childElement.props.onPointerDown;
|
|
28533
|
-
const triggerElement =
|
|
30700
|
+
const triggerElement = React105__default.cloneElement(
|
|
28534
30701
|
childElement,
|
|
28535
30702
|
{
|
|
28536
30703
|
ref: triggerRef,
|
|
@@ -29132,9 +31299,9 @@ var init_Tooltip = __esm({
|
|
|
29132
31299
|
if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
|
|
29133
31300
|
};
|
|
29134
31301
|
}, []);
|
|
29135
|
-
const triggerElement =
|
|
31302
|
+
const triggerElement = React105__default.isValidElement(children) ? children : /* @__PURE__ */ jsx("span", { children });
|
|
29136
31303
|
const childPointerDown = triggerElement.props.onPointerDown;
|
|
29137
|
-
const trigger =
|
|
31304
|
+
const trigger = React105__default.cloneElement(triggerElement, {
|
|
29138
31305
|
ref: triggerRef,
|
|
29139
31306
|
onMouseEnter: handleMouseEnter,
|
|
29140
31307
|
onMouseLeave: handleMouseLeave,
|
|
@@ -29224,7 +31391,7 @@ var init_WizardProgress = __esm({
|
|
|
29224
31391
|
children: /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: normalizedSteps.map((step, index) => {
|
|
29225
31392
|
const isActive = index === currentStep;
|
|
29226
31393
|
const isCompleted = index < currentStep;
|
|
29227
|
-
return /* @__PURE__ */ jsxs(
|
|
31394
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
29228
31395
|
/* @__PURE__ */ jsx(
|
|
29229
31396
|
"button",
|
|
29230
31397
|
{
|
|
@@ -30784,13 +32951,13 @@ var init_MapView = __esm({
|
|
|
30784
32951
|
shadowSize: [41, 41]
|
|
30785
32952
|
});
|
|
30786
32953
|
L.Marker.prototype.options.icon = defaultIcon;
|
|
30787
|
-
const { useEffect:
|
|
32954
|
+
const { useEffect: useEffect71, useRef: useRef67, useCallback: useCallback105, useState: useState105 } = React105__default;
|
|
30788
32955
|
const { Typography: Typography2 } = await Promise.resolve().then(() => (init_Typography(), Typography_exports));
|
|
30789
32956
|
const { useEventBus: useEventBus2 } = await Promise.resolve().then(() => (init_useEventBus(), useEventBus_exports));
|
|
30790
32957
|
function MapUpdater({ centerLat, centerLng, zoom }) {
|
|
30791
32958
|
const map = useMap();
|
|
30792
|
-
const prevRef =
|
|
30793
|
-
|
|
32959
|
+
const prevRef = useRef67({ centerLat, centerLng, zoom });
|
|
32960
|
+
useEffect71(() => {
|
|
30794
32961
|
const prev = prevRef.current;
|
|
30795
32962
|
if (prev.centerLat !== centerLat || prev.centerLng !== centerLng || prev.zoom !== zoom) {
|
|
30796
32963
|
map.setView([centerLat, centerLng], zoom);
|
|
@@ -30801,7 +32968,7 @@ var init_MapView = __esm({
|
|
|
30801
32968
|
}
|
|
30802
32969
|
function MapClickHandler({ onMapClick }) {
|
|
30803
32970
|
const map = useMap();
|
|
30804
|
-
|
|
32971
|
+
useEffect71(() => {
|
|
30805
32972
|
if (!onMapClick) return;
|
|
30806
32973
|
const handler = (e) => {
|
|
30807
32974
|
onMapClick(e.latlng.lat, e.latlng.lng);
|
|
@@ -30829,8 +32996,8 @@ var init_MapView = __esm({
|
|
|
30829
32996
|
showAttribution = true
|
|
30830
32997
|
}) {
|
|
30831
32998
|
const eventBus = useEventBus2();
|
|
30832
|
-
const [clickedPosition, setClickedPosition] =
|
|
30833
|
-
const handleMapClick =
|
|
32999
|
+
const [clickedPosition, setClickedPosition] = useState105(null);
|
|
33000
|
+
const handleMapClick = useCallback105((lat, lng) => {
|
|
30834
33001
|
if (showClickedPin) {
|
|
30835
33002
|
setClickedPosition({ lat, lng });
|
|
30836
33003
|
}
|
|
@@ -30839,7 +33006,7 @@ var init_MapView = __esm({
|
|
|
30839
33006
|
eventBus.emit(`UI:${mapClickEvent}`, { latitude: lat, longitude: lng });
|
|
30840
33007
|
}
|
|
30841
33008
|
}, [onMapClick, mapClickEvent, eventBus, showClickedPin]);
|
|
30842
|
-
const handleMarkerClick =
|
|
33009
|
+
const handleMarkerClick = useCallback105((marker) => {
|
|
30843
33010
|
onMarkerClick?.(marker);
|
|
30844
33011
|
if (markerClickEvent) {
|
|
30845
33012
|
eventBus.emit(`UI:${markerClickEvent}`, { ...marker });
|
|
@@ -31699,8 +33866,8 @@ function TableView({
|
|
|
31699
33866
|
}) {
|
|
31700
33867
|
const eventBus = useEventBus();
|
|
31701
33868
|
const { t } = useTranslate();
|
|
31702
|
-
const [visibleCount, setVisibleCount] =
|
|
31703
|
-
const [localSelected, setLocalSelected] =
|
|
33869
|
+
const [visibleCount, setVisibleCount] = React105__default.useState(pageSize > 0 ? pageSize : Infinity);
|
|
33870
|
+
const [localSelected, setLocalSelected] = React105__default.useState(/* @__PURE__ */ new Set());
|
|
31704
33871
|
const colDefs = columns ?? fields ?? [];
|
|
31705
33872
|
const allDataRaw = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
31706
33873
|
const dnd = useDataDnd({
|
|
@@ -31895,12 +34062,12 @@ function TableView({
|
|
|
31895
34062
|
]
|
|
31896
34063
|
}
|
|
31897
34064
|
);
|
|
31898
|
-
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(
|
|
34065
|
+
return dnd.isZone ? /* @__PURE__ */ jsx(dnd.SortableItem, { id: row[idField] ?? id, children: rowInner }, id) : /* @__PURE__ */ jsx(React105__default.Fragment, { children: rowInner }, id);
|
|
31899
34066
|
};
|
|
31900
34067
|
const items = Array.from(data);
|
|
31901
34068
|
const groups = groupBy ? groupData2(items, groupBy) : [{ label: "", items }];
|
|
31902
34069
|
let runningIndex = 0;
|
|
31903
|
-
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(
|
|
34070
|
+
const body = /* @__PURE__ */ jsx(Box, { role: "rowgroup", children: groups.map((group, gi) => /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
31904
34071
|
group.label && /* @__PURE__ */ jsx(Divider, { label: group.label, className: gi > 0 ? "mt-3" : "mt-0" }),
|
|
31905
34072
|
group.items.map((row) => renderRow(row, runningIndex++))
|
|
31906
34073
|
] }, gi)) });
|
|
@@ -33257,7 +35424,7 @@ var init_StepFlow = __esm({
|
|
|
33257
35424
|
className
|
|
33258
35425
|
}) => {
|
|
33259
35426
|
if (orientation === "vertical") {
|
|
33260
|
-
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(
|
|
35427
|
+
return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React105__default.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
|
|
33261
35428
|
/* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
|
|
33262
35429
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
33263
35430
|
showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-border" })
|
|
@@ -33268,7 +35435,7 @@ var init_StepFlow = __esm({
|
|
|
33268
35435
|
] })
|
|
33269
35436
|
] }) }, index)) });
|
|
33270
35437
|
}
|
|
33271
|
-
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(
|
|
35438
|
+
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(React105__default.Fragment, { children: [
|
|
33272
35439
|
/* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
|
|
33273
35440
|
/* @__PURE__ */ jsx(StepCircle, { step, index }),
|
|
33274
35441
|
/* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
|
|
@@ -33994,11 +36161,11 @@ function LatticeSVG({
|
|
|
33994
36161
|
}) {
|
|
33995
36162
|
const paths = [];
|
|
33996
36163
|
const cols = 5;
|
|
33997
|
-
const
|
|
36164
|
+
const rows2 = Math.ceil(h / (w / cols));
|
|
33998
36165
|
const cellW = w / cols;
|
|
33999
36166
|
const cellH = cellW;
|
|
34000
36167
|
const bulge = cellW * 0.3;
|
|
34001
|
-
for (let row = 0; row <
|
|
36168
|
+
for (let row = 0; row < rows2; row++) {
|
|
34002
36169
|
for (let col = 0; col < cols; col++) {
|
|
34003
36170
|
const cx = col * cellW + cellW / 2;
|
|
34004
36171
|
const cy = row * cellH + cellH / 2;
|
|
@@ -34253,7 +36420,7 @@ var init_LikertScale = __esm({
|
|
|
34253
36420
|
md: "text-base",
|
|
34254
36421
|
lg: "text-lg"
|
|
34255
36422
|
};
|
|
34256
|
-
LikertScale =
|
|
36423
|
+
LikertScale = React105__default.forwardRef(
|
|
34257
36424
|
({
|
|
34258
36425
|
question,
|
|
34259
36426
|
options = DEFAULT_LIKERT_OPTIONS,
|
|
@@ -34265,7 +36432,7 @@ var init_LikertScale = __esm({
|
|
|
34265
36432
|
variant = "radios",
|
|
34266
36433
|
className
|
|
34267
36434
|
}, ref) => {
|
|
34268
|
-
const groupId =
|
|
36435
|
+
const groupId = React105__default.useId();
|
|
34269
36436
|
const eventBus = useEventBus();
|
|
34270
36437
|
const handleSelect = useCallback(
|
|
34271
36438
|
(next) => {
|
|
@@ -34419,7 +36586,7 @@ var init_MatrixQuestion = __esm({
|
|
|
34419
36586
|
};
|
|
34420
36587
|
MatrixQuestion = ({
|
|
34421
36588
|
title,
|
|
34422
|
-
rows,
|
|
36589
|
+
rows: rows2,
|
|
34423
36590
|
columns = DEFAULT_MATRIX_COLUMNS,
|
|
34424
36591
|
values,
|
|
34425
36592
|
onChange,
|
|
@@ -34429,7 +36596,7 @@ var init_MatrixQuestion = __esm({
|
|
|
34429
36596
|
className
|
|
34430
36597
|
}) => {
|
|
34431
36598
|
const styles = sizeStyles12[size];
|
|
34432
|
-
const safeRows =
|
|
36599
|
+
const safeRows = rows2 ?? [];
|
|
34433
36600
|
const safeValues = values ?? {};
|
|
34434
36601
|
const eventBus = useEventBus();
|
|
34435
36602
|
const handleChange = useCallback(
|
|
@@ -36547,7 +38714,7 @@ var init_DocBreadcrumb = __esm({
|
|
|
36547
38714
|
"aria-label": t("aria.breadcrumb"),
|
|
36548
38715
|
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", wrap: true, children: items.map((item, idx) => {
|
|
36549
38716
|
const isLast = idx === items.length - 1;
|
|
36550
|
-
return /* @__PURE__ */ jsxs(
|
|
38717
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
36551
38718
|
idx > 0 && /* @__PURE__ */ jsx(
|
|
36552
38719
|
Icon,
|
|
36553
38720
|
{
|
|
@@ -37211,7 +39378,7 @@ var init_PageHeader = __esm({
|
|
|
37211
39378
|
info: "bg-info/10 text-info"
|
|
37212
39379
|
};
|
|
37213
39380
|
return /* @__PURE__ */ jsxs(Box, { className: cn("mb-6", className), children: [
|
|
37214
|
-
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(
|
|
39381
|
+
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(React105__default.Fragment, { children: [
|
|
37215
39382
|
idx > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", color: "muted", children: "/" }),
|
|
37216
39383
|
crumb.href ? /* @__PURE__ */ jsx(
|
|
37217
39384
|
"a",
|
|
@@ -37569,7 +39736,7 @@ var init_Section = __esm({
|
|
|
37569
39736
|
as: Component = "section"
|
|
37570
39737
|
}) => {
|
|
37571
39738
|
const hasHeader = title || description || action;
|
|
37572
|
-
return
|
|
39739
|
+
return React105__default.createElement(
|
|
37573
39740
|
Component,
|
|
37574
39741
|
{
|
|
37575
39742
|
className: cn(
|
|
@@ -37893,8 +40060,8 @@ var init_WizardContainer = __esm({
|
|
|
37893
40060
|
return void 0;
|
|
37894
40061
|
if (typeof controlledStep === "number") return controlledStep;
|
|
37895
40062
|
if (typeof controlledStep === "string") return parseInt(controlledStep, 10);
|
|
37896
|
-
const
|
|
37897
|
-
return isNaN(
|
|
40063
|
+
const num2 = Number(controlledStep);
|
|
40064
|
+
return isNaN(num2) ? void 0 : num2;
|
|
37898
40065
|
})();
|
|
37899
40066
|
const currentStep = normalizedControlledStep !== void 0 ? normalizedControlledStep : internalStep;
|
|
37900
40067
|
const totalSteps = steps.length;
|
|
@@ -37943,7 +40110,7 @@ var init_WizardContainer = __esm({
|
|
|
37943
40110
|
const isCompleted = index < currentStep;
|
|
37944
40111
|
const stepKey = step.id ?? step.tabId ?? `step-${index}`;
|
|
37945
40112
|
const stepTitle = step.title ?? step.name ?? `Step ${index + 1}`;
|
|
37946
|
-
return /* @__PURE__ */ jsxs(
|
|
40113
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
37947
40114
|
/* @__PURE__ */ jsx(
|
|
37948
40115
|
Button,
|
|
37949
40116
|
{
|
|
@@ -39920,7 +42087,7 @@ function getBadgeVariant(fieldName, value) {
|
|
|
39920
42087
|
return "default";
|
|
39921
42088
|
}
|
|
39922
42089
|
function formatFieldLabel(fieldName) {
|
|
39923
|
-
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (
|
|
42090
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase());
|
|
39924
42091
|
}
|
|
39925
42092
|
function formatFieldValue(value, fieldName) {
|
|
39926
42093
|
if (typeof value === "number") {
|
|
@@ -39939,26 +42106,26 @@ function formatFieldValue(value, fieldName) {
|
|
|
39939
42106
|
}
|
|
39940
42107
|
function renderRichFieldValue(value, fieldName, fieldType) {
|
|
39941
42108
|
if (value === void 0 || value === null) return "\u2014";
|
|
39942
|
-
const
|
|
42109
|
+
const str2 = String(value);
|
|
39943
42110
|
switch (fieldType) {
|
|
39944
42111
|
case "image":
|
|
39945
42112
|
case "url": {
|
|
39946
|
-
if (
|
|
42113
|
+
if (str2.match(/\.(png|jpe?g|gif|svg|webp|avif)(\?|$)/i) || str2.startsWith("data:image/")) {
|
|
39947
42114
|
return /* @__PURE__ */ jsx(Box, { className: "mt-1 max-w-full", children: /* @__PURE__ */ jsx(
|
|
39948
42115
|
"img",
|
|
39949
42116
|
{
|
|
39950
|
-
src:
|
|
42117
|
+
src: str2,
|
|
39951
42118
|
alt: formatFieldLabel(fieldName),
|
|
39952
42119
|
className: "max-w-full max-h-64 rounded-md object-contain",
|
|
39953
42120
|
loading: "lazy"
|
|
39954
42121
|
}
|
|
39955
42122
|
) });
|
|
39956
42123
|
}
|
|
39957
|
-
return
|
|
42124
|
+
return str2;
|
|
39958
42125
|
}
|
|
39959
42126
|
case "markdown":
|
|
39960
42127
|
case "richtext":
|
|
39961
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "break-words", children:
|
|
42128
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Typography, { variant: "body", className: "break-words", children: str2 }), children: /* @__PURE__ */ jsx(
|
|
39962
42129
|
Box,
|
|
39963
42130
|
{
|
|
39964
42131
|
className: "prose prose-sm max-w-none",
|
|
@@ -39976,11 +42143,11 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
39976
42143
|
"--tw-prose-th-borders": "var(--color-border)",
|
|
39977
42144
|
"--tw-prose-td-borders": "var(--color-border)"
|
|
39978
42145
|
},
|
|
39979
|
-
children: /* @__PURE__ */ jsx(ReactMarkdown2, { children:
|
|
42146
|
+
children: /* @__PURE__ */ jsx(ReactMarkdown2, { children: str2 })
|
|
39980
42147
|
}
|
|
39981
42148
|
) });
|
|
39982
42149
|
case "code":
|
|
39983
|
-
return /* @__PURE__ */ jsx(Box, { className: "mt-1 rounded-md bg-muted p-3 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-sm font-mono whitespace-pre-wrap break-words m-0", children: /* @__PURE__ */ jsx("code", { children:
|
|
42150
|
+
return /* @__PURE__ */ jsx(Box, { className: "mt-1 rounded-md bg-muted p-3 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-sm font-mono whitespace-pre-wrap break-words m-0", children: /* @__PURE__ */ jsx("code", { children: str2 }) }) });
|
|
39984
42151
|
case "html":
|
|
39985
42152
|
return /* @__PURE__ */ jsx(
|
|
39986
42153
|
Box,
|
|
@@ -40000,12 +42167,12 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
40000
42167
|
"--tw-prose-th-borders": "var(--color-border)",
|
|
40001
42168
|
"--tw-prose-td-borders": "var(--color-border)"
|
|
40002
42169
|
},
|
|
40003
|
-
children: /* @__PURE__ */ jsx(Typography, { variant: "body", children:
|
|
42170
|
+
children: /* @__PURE__ */ jsx(Typography, { variant: "body", children: str2 })
|
|
40004
42171
|
}
|
|
40005
42172
|
);
|
|
40006
42173
|
case "date":
|
|
40007
42174
|
case "datetime": {
|
|
40008
|
-
const d = new Date(
|
|
42175
|
+
const d = new Date(str2);
|
|
40009
42176
|
if (!isNaN(d.getTime())) {
|
|
40010
42177
|
return d.toLocaleDateString(void 0, {
|
|
40011
42178
|
year: "numeric",
|
|
@@ -40014,7 +42181,7 @@ function renderRichFieldValue(value, fieldName, fieldType) {
|
|
|
40014
42181
|
...fieldType === "datetime" ? { hour: "2-digit", minute: "2-digit" } : {}
|
|
40015
42182
|
});
|
|
40016
42183
|
}
|
|
40017
|
-
return
|
|
42184
|
+
return str2;
|
|
40018
42185
|
}
|
|
40019
42186
|
default:
|
|
40020
42187
|
return formatFieldValue(value, fieldName);
|
|
@@ -40376,7 +42543,7 @@ var init_DetailPanel = __esm({
|
|
|
40376
42543
|
}
|
|
40377
42544
|
});
|
|
40378
42545
|
function extractTitle(children) {
|
|
40379
|
-
if (!
|
|
42546
|
+
if (!React105__default.isValidElement(children)) return void 0;
|
|
40380
42547
|
const props = children.props;
|
|
40381
42548
|
if (typeof props.title === "string") {
|
|
40382
42549
|
return props.title;
|
|
@@ -40726,12 +42893,12 @@ var init_Form = __esm({
|
|
|
40726
42893
|
const isSchemaEntity = isOrbitalEntitySchema(entity);
|
|
40727
42894
|
const resolvedEntity = isSchemaEntity ? entity : void 0;
|
|
40728
42895
|
const entityName = typeof entity === "string" ? entity : resolvedEntity?.name;
|
|
40729
|
-
const normalizedInitialData =
|
|
42896
|
+
const normalizedInitialData = React105__default.useMemo(() => {
|
|
40730
42897
|
const entityRowAsInitial = isPlainEntityRow(entity) ? entity : void 0;
|
|
40731
42898
|
const callerInitial = initialData !== null && typeof initialData === "object" && !Array.isArray(initialData) ? initialData : {};
|
|
40732
42899
|
return entityRowAsInitial !== void 0 ? { ...entityRowAsInitial, ...callerInitial } : callerInitial;
|
|
40733
42900
|
}, [entity, initialData]);
|
|
40734
|
-
const entityDerivedFields =
|
|
42901
|
+
const entityDerivedFields = React105__default.useMemo(() => {
|
|
40735
42902
|
if (fields && fields.length > 0) return void 0;
|
|
40736
42903
|
if (!resolvedEntity) return void 0;
|
|
40737
42904
|
return resolvedEntity.fields.map(
|
|
@@ -40752,16 +42919,16 @@ var init_Form = __esm({
|
|
|
40752
42919
|
const conditionalFields = typeof conditionalFieldsRaw === "boolean" ? {} : conditionalFieldsRaw;
|
|
40753
42920
|
const hiddenCalculations = typeof hiddenCalculationsRaw === "boolean" ? [] : hiddenCalculationsRaw;
|
|
40754
42921
|
const violationTriggers = typeof violationTriggersRaw === "boolean" ? [] : violationTriggersRaw;
|
|
40755
|
-
const [formData, setFormData] =
|
|
42922
|
+
const [formData, setFormData] = React105__default.useState(
|
|
40756
42923
|
normalizedInitialData
|
|
40757
42924
|
);
|
|
40758
|
-
const [collapsedSections, setCollapsedSections] =
|
|
42925
|
+
const [collapsedSections, setCollapsedSections] = React105__default.useState(
|
|
40759
42926
|
/* @__PURE__ */ new Set()
|
|
40760
42927
|
);
|
|
40761
|
-
const [submitError, setSubmitError] =
|
|
40762
|
-
const formRef =
|
|
42928
|
+
const [submitError, setSubmitError] = React105__default.useState(null);
|
|
42929
|
+
const formRef = React105__default.useRef(null);
|
|
40763
42930
|
const formMode = props.mode;
|
|
40764
|
-
const mountedRef =
|
|
42931
|
+
const mountedRef = React105__default.useRef(false);
|
|
40765
42932
|
if (!mountedRef.current) {
|
|
40766
42933
|
mountedRef.current = true;
|
|
40767
42934
|
debug("forms", "mount", {
|
|
@@ -40774,7 +42941,7 @@ var init_Form = __esm({
|
|
|
40774
42941
|
});
|
|
40775
42942
|
}
|
|
40776
42943
|
const shouldShowCancel = showCancel ?? (fields && fields.length > 0);
|
|
40777
|
-
const evalContext =
|
|
42944
|
+
const evalContext = React105__default.useMemo(
|
|
40778
42945
|
() => ({
|
|
40779
42946
|
formValues: formData,
|
|
40780
42947
|
globalVariables: externalContext?.globalVariables ?? {},
|
|
@@ -40783,7 +42950,7 @@ var init_Form = __esm({
|
|
|
40783
42950
|
}),
|
|
40784
42951
|
[formData, externalContext]
|
|
40785
42952
|
);
|
|
40786
|
-
|
|
42953
|
+
React105__default.useEffect(() => {
|
|
40787
42954
|
debug("forms", "initialData-sync", {
|
|
40788
42955
|
mode: formMode,
|
|
40789
42956
|
normalizedInitialData,
|
|
@@ -40794,7 +42961,7 @@ var init_Form = __esm({
|
|
|
40794
42961
|
setFormData(normalizedInitialData);
|
|
40795
42962
|
}
|
|
40796
42963
|
}, [normalizedInitialData]);
|
|
40797
|
-
const processCalculations =
|
|
42964
|
+
const processCalculations = React105__default.useCallback(
|
|
40798
42965
|
(changedFieldId, newFormData) => {
|
|
40799
42966
|
if (!hiddenCalculations.length) return;
|
|
40800
42967
|
const context = {
|
|
@@ -40819,7 +42986,7 @@ var init_Form = __esm({
|
|
|
40819
42986
|
},
|
|
40820
42987
|
[hiddenCalculations, externalContext, eventBus]
|
|
40821
42988
|
);
|
|
40822
|
-
const checkViolations =
|
|
42989
|
+
const checkViolations = React105__default.useCallback(
|
|
40823
42990
|
(changedFieldId, newFormData) => {
|
|
40824
42991
|
if (!violationTriggers.length) return;
|
|
40825
42992
|
const context = {
|
|
@@ -40857,7 +43024,7 @@ var init_Form = __esm({
|
|
|
40857
43024
|
processCalculations(name, newFormData);
|
|
40858
43025
|
checkViolations(name, newFormData);
|
|
40859
43026
|
};
|
|
40860
|
-
const isFieldVisible =
|
|
43027
|
+
const isFieldVisible = React105__default.useCallback(
|
|
40861
43028
|
(fieldName) => {
|
|
40862
43029
|
const condition = conditionalFields[fieldName];
|
|
40863
43030
|
if (!condition) return true;
|
|
@@ -40865,7 +43032,7 @@ var init_Form = __esm({
|
|
|
40865
43032
|
},
|
|
40866
43033
|
[conditionalFields, evalContext]
|
|
40867
43034
|
);
|
|
40868
|
-
const isSectionVisible =
|
|
43035
|
+
const isSectionVisible = React105__default.useCallback(
|
|
40869
43036
|
(section) => {
|
|
40870
43037
|
if (!section.condition) return true;
|
|
40871
43038
|
return Boolean(evaluateFormExpression(section.condition, evalContext));
|
|
@@ -40941,7 +43108,7 @@ var init_Form = __esm({
|
|
|
40941
43108
|
eventBus.emit(`UI:${onCancel}`);
|
|
40942
43109
|
}
|
|
40943
43110
|
};
|
|
40944
|
-
const renderField =
|
|
43111
|
+
const renderField = React105__default.useCallback(
|
|
40945
43112
|
(field) => {
|
|
40946
43113
|
const fieldName = field.name || field.field;
|
|
40947
43114
|
if (!fieldName) return null;
|
|
@@ -40962,7 +43129,7 @@ var init_Form = __esm({
|
|
|
40962
43129
|
[formData, isFieldVisible, relationsData, relationsLoading, isLoading]
|
|
40963
43130
|
);
|
|
40964
43131
|
const effectiveFields = entityDerivedFields ?? fields;
|
|
40965
|
-
const normalizedFields =
|
|
43132
|
+
const normalizedFields = React105__default.useMemo(() => {
|
|
40966
43133
|
if (!effectiveFields || effectiveFields.length === 0) return [];
|
|
40967
43134
|
return effectiveFields.map((field) => {
|
|
40968
43135
|
if (typeof field === "string") {
|
|
@@ -40986,7 +43153,7 @@ var init_Form = __esm({
|
|
|
40986
43153
|
return field;
|
|
40987
43154
|
});
|
|
40988
43155
|
}, [effectiveFields, resolvedEntity]);
|
|
40989
|
-
const schemaFields =
|
|
43156
|
+
const schemaFields = React105__default.useMemo(() => {
|
|
40990
43157
|
if (normalizedFields.length === 0) return null;
|
|
40991
43158
|
if (isDebugEnabled()) {
|
|
40992
43159
|
debugGroup(`Form: ${entityName || "unknown"}`);
|
|
@@ -40996,7 +43163,7 @@ var init_Form = __esm({
|
|
|
40996
43163
|
}
|
|
40997
43164
|
return normalizedFields.map(renderField).filter(Boolean);
|
|
40998
43165
|
}, [normalizedFields, renderField, entityName, conditionalFields]);
|
|
40999
|
-
const sectionElements =
|
|
43166
|
+
const sectionElements = React105__default.useMemo(() => {
|
|
41000
43167
|
if (!sections || sections.length === 0) return null;
|
|
41001
43168
|
return sections.map((section) => {
|
|
41002
43169
|
if (!isSectionVisible(section)) {
|
|
@@ -41575,7 +43742,7 @@ function formatValue3(value, fieldName) {
|
|
|
41575
43742
|
return String(value);
|
|
41576
43743
|
}
|
|
41577
43744
|
function formatFieldLabel2(fieldName) {
|
|
41578
|
-
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (
|
|
43745
|
+
return fieldName.replace(/([A-Z])/g, " $1").replace(/^./, (str2) => str2.toUpperCase()).replace(/Id$/, "").trim();
|
|
41579
43746
|
}
|
|
41580
43747
|
var STATUS_STYLES2, StatusBadge, ProgressIndicator, List3;
|
|
41581
43748
|
var init_List = __esm({
|
|
@@ -41721,7 +43888,7 @@ var init_List = __esm({
|
|
|
41721
43888
|
if (entity && typeof entity === "object" && "id" in entity) return [entity];
|
|
41722
43889
|
return [];
|
|
41723
43890
|
}, [entity]);
|
|
41724
|
-
const getItemActions =
|
|
43891
|
+
const getItemActions = React105__default.useCallback(
|
|
41725
43892
|
(item) => {
|
|
41726
43893
|
if (!itemActions) return [];
|
|
41727
43894
|
if (typeof itemActions === "function") {
|
|
@@ -42196,7 +44363,7 @@ var init_MediaGallery = __esm({
|
|
|
42196
44363
|
[selectable, selectedItems, selectionEvent, eventBus]
|
|
42197
44364
|
);
|
|
42198
44365
|
const entityData = Array.isArray(entity) ? entity : [];
|
|
42199
|
-
const items =
|
|
44366
|
+
const items = React105__default.useMemo(() => {
|
|
42200
44367
|
if (propItems) return propItems;
|
|
42201
44368
|
if (entityData.length === 0) return [];
|
|
42202
44369
|
return entityData.map((record, idx) => {
|
|
@@ -42359,7 +44526,7 @@ var init_MediaGallery = __esm({
|
|
|
42359
44526
|
}
|
|
42360
44527
|
});
|
|
42361
44528
|
function extractTitle2(children) {
|
|
42362
|
-
if (!
|
|
44529
|
+
if (!React105__default.isValidElement(children)) return void 0;
|
|
42363
44530
|
const props = children.props;
|
|
42364
44531
|
if (typeof props.title === "string") {
|
|
42365
44532
|
return props.title;
|
|
@@ -42633,7 +44800,7 @@ var init_debugRegistry = __esm({
|
|
|
42633
44800
|
}
|
|
42634
44801
|
});
|
|
42635
44802
|
function useDebugData() {
|
|
42636
|
-
const [data, setData] =
|
|
44803
|
+
const [data, setData] = React105.useState(() => ({
|
|
42637
44804
|
traits: [],
|
|
42638
44805
|
ticks: [],
|
|
42639
44806
|
guards: [],
|
|
@@ -42647,7 +44814,7 @@ function useDebugData() {
|
|
|
42647
44814
|
},
|
|
42648
44815
|
lastUpdate: Date.now()
|
|
42649
44816
|
}));
|
|
42650
|
-
|
|
44817
|
+
React105.useEffect(() => {
|
|
42651
44818
|
const updateData = () => {
|
|
42652
44819
|
setData({
|
|
42653
44820
|
traits: getAllTraits(),
|
|
@@ -42756,12 +44923,12 @@ function layoutGraph(states, transitions, initialState, width, height) {
|
|
|
42756
44923
|
return positions;
|
|
42757
44924
|
}
|
|
42758
44925
|
function WalkMinimap() {
|
|
42759
|
-
const [walkStep, setWalkStep] =
|
|
42760
|
-
const [traits2, setTraits] =
|
|
42761
|
-
const [coveredEdges, setCoveredEdges] =
|
|
42762
|
-
const [completedTraits, setCompletedTraits] =
|
|
42763
|
-
const prevTraitRef =
|
|
42764
|
-
|
|
44926
|
+
const [walkStep, setWalkStep] = React105.useState(null);
|
|
44927
|
+
const [traits2, setTraits] = React105.useState([]);
|
|
44928
|
+
const [coveredEdges, setCoveredEdges] = React105.useState([]);
|
|
44929
|
+
const [completedTraits, setCompletedTraits] = React105.useState(/* @__PURE__ */ new Set());
|
|
44930
|
+
const prevTraitRef = React105.useRef(null);
|
|
44931
|
+
React105.useEffect(() => {
|
|
42765
44932
|
const interval = setInterval(() => {
|
|
42766
44933
|
const w = window;
|
|
42767
44934
|
const step = w.__orbitalWalkStep;
|
|
@@ -43197,15 +45364,15 @@ var init_EntitiesTab = __esm({
|
|
|
43197
45364
|
});
|
|
43198
45365
|
function EventFlowTab({ events: events2 }) {
|
|
43199
45366
|
const { t } = useTranslate();
|
|
43200
|
-
const [filter, setFilter] =
|
|
43201
|
-
const containerRef =
|
|
43202
|
-
const [autoScroll, setAutoScroll] =
|
|
43203
|
-
|
|
45367
|
+
const [filter, setFilter] = React105.useState("all");
|
|
45368
|
+
const containerRef = React105.useRef(null);
|
|
45369
|
+
const [autoScroll, setAutoScroll] = React105.useState(true);
|
|
45370
|
+
React105.useEffect(() => {
|
|
43204
45371
|
if (autoScroll && containerRef.current) {
|
|
43205
45372
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
43206
45373
|
}
|
|
43207
45374
|
}, [events2.length, autoScroll]);
|
|
43208
|
-
const filteredEvents =
|
|
45375
|
+
const filteredEvents = React105.useMemo(() => {
|
|
43209
45376
|
if (filter === "all") return events2;
|
|
43210
45377
|
return events2.filter((e) => e.type === filter);
|
|
43211
45378
|
}, [events2, filter]);
|
|
@@ -43321,7 +45488,7 @@ var init_EventFlowTab = __esm({
|
|
|
43321
45488
|
});
|
|
43322
45489
|
function GuardsPanel({ guards }) {
|
|
43323
45490
|
const { t } = useTranslate();
|
|
43324
|
-
const [filter, setFilter] =
|
|
45491
|
+
const [filter, setFilter] = React105.useState("all");
|
|
43325
45492
|
if (guards.length === 0) {
|
|
43326
45493
|
return /* @__PURE__ */ jsx(
|
|
43327
45494
|
EmptyState,
|
|
@@ -43334,7 +45501,7 @@ function GuardsPanel({ guards }) {
|
|
|
43334
45501
|
}
|
|
43335
45502
|
const passedCount = guards.filter((g) => g.result).length;
|
|
43336
45503
|
const failedCount = guards.length - passedCount;
|
|
43337
|
-
const filteredGuards =
|
|
45504
|
+
const filteredGuards = React105.useMemo(() => {
|
|
43338
45505
|
if (filter === "all") return guards;
|
|
43339
45506
|
if (filter === "passed") return guards.filter((g) => g.result);
|
|
43340
45507
|
return guards.filter((g) => !g.result);
|
|
@@ -43497,10 +45664,10 @@ function EffectBadge({ effect }) {
|
|
|
43497
45664
|
}
|
|
43498
45665
|
function TransitionTimeline({ transitions }) {
|
|
43499
45666
|
const { t } = useTranslate();
|
|
43500
|
-
const containerRef =
|
|
43501
|
-
const [autoScroll, setAutoScroll] =
|
|
43502
|
-
const [expandedId, setExpandedId] =
|
|
43503
|
-
|
|
45667
|
+
const containerRef = React105.useRef(null);
|
|
45668
|
+
const [autoScroll, setAutoScroll] = React105.useState(true);
|
|
45669
|
+
const [expandedId, setExpandedId] = React105.useState(null);
|
|
45670
|
+
React105.useEffect(() => {
|
|
43504
45671
|
if (autoScroll && containerRef.current) {
|
|
43505
45672
|
containerRef.current.scrollTop = containerRef.current.scrollHeight;
|
|
43506
45673
|
}
|
|
@@ -43780,9 +45947,9 @@ function getAllEvents(traits2) {
|
|
|
43780
45947
|
function EventDispatcherTab({ traits: traits2, schema }) {
|
|
43781
45948
|
const eventBus = useEventBus();
|
|
43782
45949
|
const { t } = useTranslate();
|
|
43783
|
-
const [log11, setLog] =
|
|
43784
|
-
const prevStatesRef =
|
|
43785
|
-
|
|
45950
|
+
const [log11, setLog] = React105.useState([]);
|
|
45951
|
+
const prevStatesRef = React105.useRef(/* @__PURE__ */ new Map());
|
|
45952
|
+
React105.useEffect(() => {
|
|
43786
45953
|
for (const trait of traits2) {
|
|
43787
45954
|
const prev = prevStatesRef.current.get(trait.id);
|
|
43788
45955
|
if (prev && prev !== trait.currentState) {
|
|
@@ -43951,10 +46118,10 @@ function VerifyModePanel({
|
|
|
43951
46118
|
localCount
|
|
43952
46119
|
}) {
|
|
43953
46120
|
const { t } = useTranslate();
|
|
43954
|
-
const [expanded, setExpanded] =
|
|
43955
|
-
const scrollRef =
|
|
43956
|
-
const prevCountRef =
|
|
43957
|
-
|
|
46121
|
+
const [expanded, setExpanded] = React105.useState(true);
|
|
46122
|
+
const scrollRef = React105.useRef(null);
|
|
46123
|
+
const prevCountRef = React105.useRef(0);
|
|
46124
|
+
React105.useEffect(() => {
|
|
43958
46125
|
if (expanded && transitions.length > prevCountRef.current && scrollRef.current) {
|
|
43959
46126
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
43960
46127
|
}
|
|
@@ -44011,10 +46178,10 @@ function RuntimeDebugger({
|
|
|
44011
46178
|
schema
|
|
44012
46179
|
}) {
|
|
44013
46180
|
const { t } = useTranslate();
|
|
44014
|
-
const [isCollapsed, setIsCollapsed] =
|
|
44015
|
-
const [isVisible, setIsVisible] =
|
|
46181
|
+
const [isCollapsed, setIsCollapsed] = React105.useState(mode === "verify" ? true : defaultCollapsed);
|
|
46182
|
+
const [isVisible, setIsVisible] = React105.useState(mode === "inline" || mode === "verify" || isDebugEnabled2());
|
|
44016
46183
|
const debugData = useDebugData();
|
|
44017
|
-
|
|
46184
|
+
React105.useEffect(() => {
|
|
44018
46185
|
if (mode === "inline") return;
|
|
44019
46186
|
return onDebugToggle((enabled) => {
|
|
44020
46187
|
setIsVisible(enabled);
|
|
@@ -44023,7 +46190,7 @@ function RuntimeDebugger({
|
|
|
44023
46190
|
}
|
|
44024
46191
|
});
|
|
44025
46192
|
}, [mode]);
|
|
44026
|
-
|
|
46193
|
+
React105.useEffect(() => {
|
|
44027
46194
|
if (mode === "inline") return;
|
|
44028
46195
|
const handleKeyDown = (e) => {
|
|
44029
46196
|
if (e.key === "`" && isVisible) {
|
|
@@ -44543,7 +46710,7 @@ var init_StatCard = __esm({
|
|
|
44543
46710
|
const labelToUse = propLabel ?? propTitle;
|
|
44544
46711
|
const eventBus = useEventBus();
|
|
44545
46712
|
const { t } = useTranslate();
|
|
44546
|
-
const handleActionClick =
|
|
46713
|
+
const handleActionClick = React105__default.useCallback(() => {
|
|
44547
46714
|
if (action?.event) {
|
|
44548
46715
|
eventBus.emit(`UI:${action.event}`, {});
|
|
44549
46716
|
}
|
|
@@ -44554,7 +46721,7 @@ var init_StatCard = __esm({
|
|
|
44554
46721
|
const data = Array.isArray(entity) ? entity : entity ? [entity] : [];
|
|
44555
46722
|
const isLoading = externalLoading ?? false;
|
|
44556
46723
|
const error = externalError;
|
|
44557
|
-
const computeMetricValue =
|
|
46724
|
+
const computeMetricValue = React105__default.useCallback(
|
|
44558
46725
|
(metric, items) => {
|
|
44559
46726
|
if (metric.value !== void 0) {
|
|
44560
46727
|
return metric.value;
|
|
@@ -44593,7 +46760,7 @@ var init_StatCard = __esm({
|
|
|
44593
46760
|
},
|
|
44594
46761
|
[]
|
|
44595
46762
|
);
|
|
44596
|
-
const schemaStats =
|
|
46763
|
+
const schemaStats = React105__default.useMemo(() => {
|
|
44597
46764
|
if (!metrics || metrics.length === 0) return null;
|
|
44598
46765
|
return metrics.map((metric) => ({
|
|
44599
46766
|
label: metric.label,
|
|
@@ -44601,7 +46768,7 @@ var init_StatCard = __esm({
|
|
|
44601
46768
|
format: metric.format
|
|
44602
46769
|
}));
|
|
44603
46770
|
}, [metrics, data, computeMetricValue]);
|
|
44604
|
-
const calculatedTrend =
|
|
46771
|
+
const calculatedTrend = React105__default.useMemo(() => {
|
|
44605
46772
|
if (manualTrend !== void 0) return manualTrend;
|
|
44606
46773
|
if (previousValue === void 0 || currentValue === void 0)
|
|
44607
46774
|
return void 0;
|
|
@@ -45241,8 +47408,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
45241
47408
|
] });
|
|
45242
47409
|
};
|
|
45243
47410
|
InlineActivityStream = ({ activities, autoScroll = true, className }) => {
|
|
45244
|
-
const endRef =
|
|
45245
|
-
|
|
47411
|
+
const endRef = React105__default.useRef(null);
|
|
47412
|
+
React105__default.useEffect(() => {
|
|
45246
47413
|
if (!autoScroll) return;
|
|
45247
47414
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
45248
47415
|
}, [activities.length, autoScroll]);
|
|
@@ -45336,7 +47503,7 @@ var init_SubagentTracePanel = __esm({
|
|
|
45336
47503
|
};
|
|
45337
47504
|
SubagentRichCard = ({ subagent }) => {
|
|
45338
47505
|
const { t } = useTranslate();
|
|
45339
|
-
const activities =
|
|
47506
|
+
const activities = React105__default.useMemo(
|
|
45340
47507
|
() => subagentMessagesToActivities(subagent.messages),
|
|
45341
47508
|
[subagent.messages]
|
|
45342
47509
|
);
|
|
@@ -45413,8 +47580,8 @@ var init_SubagentTracePanel = __esm({
|
|
|
45413
47580
|
] });
|
|
45414
47581
|
};
|
|
45415
47582
|
CoordinatorConversation = ({ messages, autoScroll = true, className }) => {
|
|
45416
|
-
const endRef =
|
|
45417
|
-
|
|
47583
|
+
const endRef = React105__default.useRef(null);
|
|
47584
|
+
React105__default.useEffect(() => {
|
|
45418
47585
|
if (!autoScroll) return;
|
|
45419
47586
|
endRef.current?.scrollIntoView({ behavior: "smooth", block: "end" });
|
|
45420
47587
|
}, [messages.length, autoScroll]);
|
|
@@ -45844,7 +48011,7 @@ var init_Timeline = __esm({
|
|
|
45844
48011
|
}) => {
|
|
45845
48012
|
const { t } = useTranslate();
|
|
45846
48013
|
const entityData = entity ?? [];
|
|
45847
|
-
const items =
|
|
48014
|
+
const items = React105__default.useMemo(() => {
|
|
45848
48015
|
if (propItems) return propItems;
|
|
45849
48016
|
if (entityData.length === 0) return [];
|
|
45850
48017
|
return entityData.map((record, idx) => {
|
|
@@ -45946,7 +48113,7 @@ var init_Timeline = __esm({
|
|
|
45946
48113
|
}
|
|
45947
48114
|
});
|
|
45948
48115
|
function extractToastProps(children) {
|
|
45949
|
-
if (!
|
|
48116
|
+
if (!React105__default.isValidElement(children)) {
|
|
45950
48117
|
if (typeof children === "string") {
|
|
45951
48118
|
return { message: children };
|
|
45952
48119
|
}
|
|
@@ -45988,7 +48155,7 @@ var init_ToastSlot = __esm({
|
|
|
45988
48155
|
eventBus.emit(`${prefix}CLOSE`);
|
|
45989
48156
|
};
|
|
45990
48157
|
if (!isVisible) return null;
|
|
45991
|
-
const isCustomContent =
|
|
48158
|
+
const isCustomContent = React105__default.isValidElement(children) && !message;
|
|
45992
48159
|
return /* @__PURE__ */ jsx(Box, { className: "fixed bottom-4 right-4 z-50", children: isCustomContent ? children : /* @__PURE__ */ jsx(
|
|
45993
48160
|
Toast,
|
|
45994
48161
|
{
|
|
@@ -46005,7 +48172,7 @@ var init_ToastSlot = __esm({
|
|
|
46005
48172
|
}
|
|
46006
48173
|
});
|
|
46007
48174
|
function lazyThree(name, loader) {
|
|
46008
|
-
const Lazy =
|
|
48175
|
+
const Lazy = React105__default.lazy(
|
|
46009
48176
|
() => loader().then((m) => {
|
|
46010
48177
|
const Resolved = m[name];
|
|
46011
48178
|
if (!Resolved) {
|
|
@@ -46017,13 +48184,13 @@ function lazyThree(name, loader) {
|
|
|
46017
48184
|
})
|
|
46018
48185
|
);
|
|
46019
48186
|
function ThreeWrapper(props) {
|
|
46020
|
-
return
|
|
48187
|
+
return React105__default.createElement(
|
|
46021
48188
|
ThreeBoundary,
|
|
46022
48189
|
{ name },
|
|
46023
|
-
|
|
46024
|
-
|
|
48190
|
+
React105__default.createElement(
|
|
48191
|
+
React105__default.Suspense,
|
|
46025
48192
|
{ fallback: null },
|
|
46026
|
-
|
|
48193
|
+
React105__default.createElement(Lazy, props)
|
|
46027
48194
|
)
|
|
46028
48195
|
);
|
|
46029
48196
|
}
|
|
@@ -46059,6 +48226,7 @@ var init_component_registry_generated = __esm({
|
|
|
46059
48226
|
init_LayoutPatterns();
|
|
46060
48227
|
init_BranchingLogicBuilder();
|
|
46061
48228
|
init_Breadcrumb();
|
|
48229
|
+
init_BuilderBoard();
|
|
46062
48230
|
init_CTABanner();
|
|
46063
48231
|
init_CalendarGrid();
|
|
46064
48232
|
init_Canvas2D();
|
|
@@ -46074,6 +48242,7 @@ var init_component_registry_generated = __esm({
|
|
|
46074
48242
|
init_Checkbox();
|
|
46075
48243
|
init_ChemistryCanvas();
|
|
46076
48244
|
init_ChoiceButton();
|
|
48245
|
+
init_ClassifierBoard();
|
|
46077
48246
|
init_CodeBlock();
|
|
46078
48247
|
init_CodeRunnerPanel();
|
|
46079
48248
|
init_ComboCounter();
|
|
@@ -46097,6 +48266,7 @@ var init_component_registry_generated = __esm({
|
|
|
46097
48266
|
init_DateRangePicker();
|
|
46098
48267
|
init_DateRangeSelector();
|
|
46099
48268
|
init_DayCell();
|
|
48269
|
+
init_DebuggerBoard();
|
|
46100
48270
|
init_DetailPanel();
|
|
46101
48271
|
init_Dialog();
|
|
46102
48272
|
init_DialogueBubble();
|
|
@@ -46112,6 +48282,7 @@ var init_component_registry_generated = __esm({
|
|
|
46112
48282
|
init_EmptyState();
|
|
46113
48283
|
init_ErrorBoundary();
|
|
46114
48284
|
init_ErrorState();
|
|
48285
|
+
init_EventHandlerBoard();
|
|
46115
48286
|
init_EventLog();
|
|
46116
48287
|
init_FeatureCard();
|
|
46117
48288
|
init_FeatureDetailPageTemplate();
|
|
@@ -46178,6 +48349,7 @@ var init_component_registry_generated = __esm({
|
|
|
46178
48349
|
init_ModalSlot();
|
|
46179
48350
|
init_ModuleCard();
|
|
46180
48351
|
init_Navigation();
|
|
48352
|
+
init_NegotiatorBoard();
|
|
46181
48353
|
init_NumberStepper();
|
|
46182
48354
|
init_OptionConstraintGroup();
|
|
46183
48355
|
init_OrbitalVisualization();
|
|
@@ -46216,6 +48388,7 @@ var init_component_registry_generated = __esm({
|
|
|
46216
48388
|
init_SegmentRenderer();
|
|
46217
48389
|
init_Select();
|
|
46218
48390
|
init_SequenceBar();
|
|
48391
|
+
init_SequencerBoard();
|
|
46219
48392
|
init_ServiceCatalog();
|
|
46220
48393
|
init_ShowcaseCard();
|
|
46221
48394
|
init_ShowcaseOrganism();
|
|
@@ -46224,6 +48397,7 @@ var init_component_registry_generated = __esm({
|
|
|
46224
48397
|
init_SignaturePad();
|
|
46225
48398
|
init_SimpleGrid();
|
|
46226
48399
|
init_SimulationCanvas();
|
|
48400
|
+
init_SimulatorBoard();
|
|
46227
48401
|
init_Skeleton();
|
|
46228
48402
|
init_SocialProof();
|
|
46229
48403
|
init_SortableList();
|
|
@@ -46237,6 +48411,8 @@ var init_component_registry_generated = __esm({
|
|
|
46237
48411
|
init_StatBadge();
|
|
46238
48412
|
init_StatCard();
|
|
46239
48413
|
init_StatDisplay();
|
|
48414
|
+
init_StateArchitectBoard();
|
|
48415
|
+
init_StateGraph();
|
|
46240
48416
|
init_StateIndicator();
|
|
46241
48417
|
init_StateMachineView();
|
|
46242
48418
|
init_StatsGrid();
|
|
@@ -46291,7 +48467,7 @@ var init_component_registry_generated = __esm({
|
|
|
46291
48467
|
init_WizardContainer();
|
|
46292
48468
|
init_WizardNavigation();
|
|
46293
48469
|
init_WizardProgress();
|
|
46294
|
-
ThreeBoundary = class extends
|
|
48470
|
+
ThreeBoundary = class extends React105__default.Component {
|
|
46295
48471
|
constructor() {
|
|
46296
48472
|
super(...arguments);
|
|
46297
48473
|
__publicField(this, "state", { failed: false });
|
|
@@ -46301,7 +48477,7 @@ var init_component_registry_generated = __esm({
|
|
|
46301
48477
|
}
|
|
46302
48478
|
render() {
|
|
46303
48479
|
if (this.state.failed) {
|
|
46304
|
-
return
|
|
48480
|
+
return React105__default.createElement(
|
|
46305
48481
|
"div",
|
|
46306
48482
|
{
|
|
46307
48483
|
"data-testid": "three-unavailable",
|
|
@@ -46347,6 +48523,7 @@ var init_component_registry_generated = __esm({
|
|
|
46347
48523
|
"BoxPattern": BoxPattern,
|
|
46348
48524
|
"BranchingLogicBuilder": BranchingLogicBuilder,
|
|
46349
48525
|
"Breadcrumb": Breadcrumb,
|
|
48526
|
+
"BuilderBoard": BuilderBoard,
|
|
46350
48527
|
"Button": ButtonPattern,
|
|
46351
48528
|
"ButtonPattern": ButtonPattern,
|
|
46352
48529
|
"CTABanner": CTABanner,
|
|
@@ -46364,6 +48541,7 @@ var init_component_registry_generated = __esm({
|
|
|
46364
48541
|
"Checkbox": Checkbox,
|
|
46365
48542
|
"ChemistryCanvas": ChemistryCanvas,
|
|
46366
48543
|
"ChoiceButton": ChoiceButton,
|
|
48544
|
+
"ClassifierBoard": ClassifierBoard,
|
|
46367
48545
|
"CodeBlock": CodeBlock,
|
|
46368
48546
|
"CodeRunnerPanel": CodeRunnerPanel,
|
|
46369
48547
|
"ComboCounter": ComboCounter,
|
|
@@ -46387,6 +48565,7 @@ var init_component_registry_generated = __esm({
|
|
|
46387
48565
|
"DateRangePicker": DateRangePicker,
|
|
46388
48566
|
"DateRangeSelector": DateRangeSelector,
|
|
46389
48567
|
"DayCell": DayCell,
|
|
48568
|
+
"DebuggerBoard": DebuggerBoard,
|
|
46390
48569
|
"DetailPanel": DetailPanel,
|
|
46391
48570
|
"Dialog": Dialog,
|
|
46392
48571
|
"DialogueBubble": DialogueBubble,
|
|
@@ -46404,6 +48583,7 @@ var init_component_registry_generated = __esm({
|
|
|
46404
48583
|
"EmptyState": EmptyState,
|
|
46405
48584
|
"ErrorBoundary": ErrorBoundary,
|
|
46406
48585
|
"ErrorState": ErrorState,
|
|
48586
|
+
"EventHandlerBoard": EventHandlerBoard,
|
|
46407
48587
|
"EventLog": EventLog,
|
|
46408
48588
|
"FeatureCard": FeatureCard,
|
|
46409
48589
|
"FeatureDetailPageTemplate": FeatureDetailPageTemplate,
|
|
@@ -46478,6 +48658,7 @@ var init_component_registry_generated = __esm({
|
|
|
46478
48658
|
"ModalSlot": ModalSlot,
|
|
46479
48659
|
"ModuleCard": ModuleCard,
|
|
46480
48660
|
"Navigation": Navigation,
|
|
48661
|
+
"NegotiatorBoard": NegotiatorBoard,
|
|
46481
48662
|
"NumberStepper": NumberStepper,
|
|
46482
48663
|
"OptionConstraintGroup": OptionConstraintGroup,
|
|
46483
48664
|
"OrbitalVisualization": OrbitalVisualization,
|
|
@@ -46516,6 +48697,7 @@ var init_component_registry_generated = __esm({
|
|
|
46516
48697
|
"SegmentRenderer": SegmentRenderer,
|
|
46517
48698
|
"Select": Select,
|
|
46518
48699
|
"SequenceBar": SequenceBar,
|
|
48700
|
+
"SequencerBoard": SequencerBoard,
|
|
46519
48701
|
"ServiceCatalog": ServiceCatalog,
|
|
46520
48702
|
"ShowcaseCard": ShowcaseCard,
|
|
46521
48703
|
"ShowcaseOrganism": ShowcaseOrganism,
|
|
@@ -46524,6 +48706,7 @@ var init_component_registry_generated = __esm({
|
|
|
46524
48706
|
"SignaturePad": SignaturePad,
|
|
46525
48707
|
"SimpleGrid": SimpleGrid,
|
|
46526
48708
|
"SimulationCanvas": SimulationCanvas,
|
|
48709
|
+
"SimulatorBoard": SimulatorBoard,
|
|
46527
48710
|
"Skeleton": Skeleton,
|
|
46528
48711
|
"SocialProof": SocialProof,
|
|
46529
48712
|
"SortableList": SortableList,
|
|
@@ -46540,6 +48723,8 @@ var init_component_registry_generated = __esm({
|
|
|
46540
48723
|
"StatBadge": StatBadge,
|
|
46541
48724
|
"StatCard": StatCard,
|
|
46542
48725
|
"StatDisplay": StatDisplay,
|
|
48726
|
+
"StateArchitectBoard": StateArchitectBoard,
|
|
48727
|
+
"StateGraph": StateGraph,
|
|
46543
48728
|
"StateIndicator": StateIndicator,
|
|
46544
48729
|
"StateMachineView": StateMachineView,
|
|
46545
48730
|
"StatsGrid": StatsGrid,
|
|
@@ -46613,7 +48798,7 @@ function SuspenseConfigProvider({
|
|
|
46613
48798
|
config,
|
|
46614
48799
|
children
|
|
46615
48800
|
}) {
|
|
46616
|
-
return
|
|
48801
|
+
return React105__default.createElement(
|
|
46617
48802
|
SuspenseConfigContext.Provider,
|
|
46618
48803
|
{ value: config },
|
|
46619
48804
|
children
|
|
@@ -46655,7 +48840,7 @@ function enrichFormFields(fields, entityDef) {
|
|
|
46655
48840
|
}
|
|
46656
48841
|
return { name: field, label: field.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/\b\w/g, (c) => c.toUpperCase()) };
|
|
46657
48842
|
}
|
|
46658
|
-
if (field && typeof field === "object" && !Array.isArray(field) && !
|
|
48843
|
+
if (field && typeof field === "object" && !Array.isArray(field) && !React105__default.isValidElement(field) && !(field instanceof Date)) {
|
|
46659
48844
|
const obj = field;
|
|
46660
48845
|
const fieldName = typeof obj.name === "string" ? obj.name : typeof obj.field === "string" ? obj.field : void 0;
|
|
46661
48846
|
if (!fieldName) return field;
|
|
@@ -47108,7 +49293,7 @@ function renderPatternChildren(children, onDismiss, parentId = "root", parentPat
|
|
|
47108
49293
|
const key = `${parentId}-${index}-trait:${traitName}`;
|
|
47109
49294
|
return /* @__PURE__ */ jsx(TraitFrame, { traitName }, key);
|
|
47110
49295
|
}
|
|
47111
|
-
return /* @__PURE__ */ jsx(
|
|
49296
|
+
return /* @__PURE__ */ jsx(React105__default.Fragment, { children: child }, `${parentId}-${index}`);
|
|
47112
49297
|
}
|
|
47113
49298
|
if (!child || typeof child !== "object") return null;
|
|
47114
49299
|
const childId = `${parentId}-${index}`;
|
|
@@ -47148,14 +49333,14 @@ function isPatternConfig(value) {
|
|
|
47148
49333
|
if (value === null || value === void 0) return false;
|
|
47149
49334
|
if (typeof value !== "object") return false;
|
|
47150
49335
|
if (Array.isArray(value)) return false;
|
|
47151
|
-
if (
|
|
49336
|
+
if (React105__default.isValidElement(value)) return false;
|
|
47152
49337
|
if (value instanceof Date) return false;
|
|
47153
49338
|
if (typeof value === "function") return false;
|
|
47154
49339
|
const record = value;
|
|
47155
49340
|
return "type" in record && typeof record.type === "string" && getComponentForPattern$1(record.type) !== null;
|
|
47156
49341
|
}
|
|
47157
49342
|
function isPlainConfigObject(value) {
|
|
47158
|
-
if (
|
|
49343
|
+
if (React105__default.isValidElement(value)) return false;
|
|
47159
49344
|
if (value instanceof Date) return false;
|
|
47160
49345
|
const proto = Object.getPrototypeOf(value);
|
|
47161
49346
|
return proto === Object.prototype || proto === null;
|
|
@@ -47281,7 +49466,7 @@ function SlotContentRenderer({
|
|
|
47281
49466
|
for (const slotKey of CONTENT_NODE_SLOTS) {
|
|
47282
49467
|
const slotVal = restProps[slotKey];
|
|
47283
49468
|
if (slotVal === void 0 || slotVal === null) continue;
|
|
47284
|
-
if (
|
|
49469
|
+
if (React105__default.isValidElement(slotVal) || typeof slotVal === "string" || typeof slotVal === "number" || typeof slotVal === "boolean") continue;
|
|
47285
49470
|
if (Array.isArray(slotVal) || typeof slotVal === "object" && "type" in slotVal) {
|
|
47286
49471
|
nodeSlotOverrides[slotKey] = renderPatternChildren(
|
|
47287
49472
|
slotVal,
|
|
@@ -47330,7 +49515,7 @@ function SlotContentRenderer({
|
|
|
47330
49515
|
const resolvedItems = Array.isArray(entityVal) && entityVal[0] !== "fn" ? entityVal : null;
|
|
47331
49516
|
if (resolvedItems && resolvedItems.length > 0 && !finalProps.fields && !finalProps.columns) {
|
|
47332
49517
|
const sample = resolvedItems[0];
|
|
47333
|
-
if (sample && typeof sample === "object" && !Array.isArray(sample) && !
|
|
49518
|
+
if (sample && typeof sample === "object" && !Array.isArray(sample) && !React105__default.isValidElement(sample) && !(sample instanceof Date)) {
|
|
47334
49519
|
const keys = Object.keys(sample).filter((k) => k !== "id" && k !== "_id");
|
|
47335
49520
|
finalProps.fields = keys.map((k, i) => ({ name: k, variant: i === 0 ? "h4" : "body" }));
|
|
47336
49521
|
}
|
|
@@ -47693,7 +49878,7 @@ var AvlTransition = ({
|
|
|
47693
49878
|
opacity = 1,
|
|
47694
49879
|
className
|
|
47695
49880
|
}) => {
|
|
47696
|
-
const ids =
|
|
49881
|
+
const ids = React105__default.useMemo(() => {
|
|
47697
49882
|
avlTransitionId += 1;
|
|
47698
49883
|
return { arrow: `avl-tr-${avlTransitionId}-arrow` };
|
|
47699
49884
|
}, []);
|
|
@@ -48254,7 +50439,7 @@ var AvlStateMachine = ({
|
|
|
48254
50439
|
color = "var(--color-primary)",
|
|
48255
50440
|
animated = false
|
|
48256
50441
|
}) => {
|
|
48257
|
-
const ids =
|
|
50442
|
+
const ids = React105__default.useMemo(() => {
|
|
48258
50443
|
avlSmId += 1;
|
|
48259
50444
|
const base = `avl-sm-${avlSmId}`;
|
|
48260
50445
|
return { glow: `${base}-glow`, grad: `${base}-grad` };
|
|
@@ -48453,7 +50638,7 @@ var AvlOrbitalUnit = ({
|
|
|
48453
50638
|
color = "var(--color-primary)",
|
|
48454
50639
|
animated = false
|
|
48455
50640
|
}) => {
|
|
48456
|
-
const ids =
|
|
50641
|
+
const ids = React105__default.useMemo(() => {
|
|
48457
50642
|
avlOuId += 1;
|
|
48458
50643
|
const base = `avl-ou-${avlOuId}`;
|
|
48459
50644
|
return { glow: `${base}-glow`, grad: `${base}-grad` };
|
|
@@ -48549,7 +50734,7 @@ var AvlClosedCircuit = ({
|
|
|
48549
50734
|
color = "var(--color-primary)",
|
|
48550
50735
|
animated = false
|
|
48551
50736
|
}) => {
|
|
48552
|
-
const ids =
|
|
50737
|
+
const ids = React105__default.useMemo(() => {
|
|
48553
50738
|
avlCcId += 1;
|
|
48554
50739
|
const base = `avl-cc-${avlCcId}`;
|
|
48555
50740
|
return { glow: `${base}-glow`, grad: `${base}-grad`, arrow: `${base}-arrow` };
|
|
@@ -48704,7 +50889,7 @@ var AvlEmitListen = ({
|
|
|
48704
50889
|
color = "var(--color-primary)",
|
|
48705
50890
|
animated = false
|
|
48706
50891
|
}) => {
|
|
48707
|
-
const ids =
|
|
50892
|
+
const ids = React105__default.useMemo(() => {
|
|
48708
50893
|
avlElId += 1;
|
|
48709
50894
|
const base = `avl-el-${avlElId}`;
|
|
48710
50895
|
return { arrow: `${base}-arrow`, grad: `${base}-grad` };
|
|
@@ -48978,7 +51163,7 @@ function renderNode(node, color, glowId) {
|
|
|
48978
51163
|
const baseR = node.type === "operator" ? 20 : 16;
|
|
48979
51164
|
const r2 = Math.max(baseR, labelLen * 3.5 + 6);
|
|
48980
51165
|
const nc = nodeColor(node.type, color);
|
|
48981
|
-
return /* @__PURE__ */ jsxs(
|
|
51166
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
48982
51167
|
node.children.map((child, i) => {
|
|
48983
51168
|
const childR = Math.max(
|
|
48984
51169
|
child.type === "operator" ? 20 : 16,
|
|
@@ -49035,7 +51220,7 @@ var AvlExprTree = ({
|
|
|
49035
51220
|
className,
|
|
49036
51221
|
color = "var(--color-primary)"
|
|
49037
51222
|
}) => {
|
|
49038
|
-
const ids =
|
|
51223
|
+
const ids = React105__default.useMemo(() => {
|
|
49039
51224
|
avlEtId += 1;
|
|
49040
51225
|
return { glow: `avl-et-${avlEtId}-glow` };
|
|
49041
51226
|
}, []);
|
|
@@ -49588,10 +51773,10 @@ function parseApplicationLevel(schema) {
|
|
|
49588
51773
|
}
|
|
49589
51774
|
const count = schema.orbitals.length;
|
|
49590
51775
|
const cols = Math.ceil(Math.sqrt(count));
|
|
49591
|
-
const
|
|
51776
|
+
const rows2 = Math.ceil(count / cols);
|
|
49592
51777
|
const spacing = 200;
|
|
49593
51778
|
const gridW = cols * spacing;
|
|
49594
|
-
const gridH =
|
|
51779
|
+
const gridH = rows2 * spacing;
|
|
49595
51780
|
const originX = (600 - gridW) / 2 + spacing / 2;
|
|
49596
51781
|
const originY = (400 - gridH) / 2 + spacing / 2;
|
|
49597
51782
|
schema.orbitals.forEach((orbital, i) => {
|
|
@@ -49870,7 +52055,7 @@ var SystemNode = ({ data }) => {
|
|
|
49870
52055
|
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) => {
|
|
49871
52056
|
const tc = transitionCounts[s.name] ?? 0;
|
|
49872
52057
|
const role = getStateRole(s.name, s.isInitial ?? void 0, s.isTerminal ?? void 0, tc, maxTC);
|
|
49873
|
-
return /* @__PURE__ */ jsxs(
|
|
52058
|
+
return /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
49874
52059
|
/* @__PURE__ */ jsx(AvlState, { x: i * 14 + 1, y: 1, width: 10, height: 8, name: "", role, isInitial: s.isInitial ?? void 0, isTerminal: s.isTerminal ?? void 0 }),
|
|
49875
52060
|
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 })
|
|
49876
52061
|
] }, s.name);
|
|
@@ -51015,7 +53200,7 @@ function resolveLambdaBindings(body, params, item, index) {
|
|
|
51015
53200
|
if (Array.isArray(body)) {
|
|
51016
53201
|
return body.map((b) => recur(b));
|
|
51017
53202
|
}
|
|
51018
|
-
if (body !== null && typeof body === "object" && !
|
|
53203
|
+
if (body !== null && typeof body === "object" && !React105__default.isValidElement(body) && !(body instanceof Date) && typeof body !== "function") {
|
|
51019
53204
|
const out = {};
|
|
51020
53205
|
for (const [k, v] of Object.entries(body)) {
|
|
51021
53206
|
out[k] = recur(v);
|
|
@@ -51034,7 +53219,7 @@ function getSlotContentRenderer2() {
|
|
|
51034
53219
|
function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
51035
53220
|
return (item, index) => {
|
|
51036
53221
|
const resolvedBody = resolveLambdaBindings(lambdaBody, params, item, index);
|
|
51037
|
-
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" ||
|
|
53222
|
+
if (resolvedBody === null || typeof resolvedBody !== "object" || Array.isArray(resolvedBody) || typeof resolvedBody === "function" || React105__default.isValidElement(resolvedBody) || resolvedBody instanceof Date) {
|
|
51038
53223
|
return null;
|
|
51039
53224
|
}
|
|
51040
53225
|
const record = resolvedBody;
|
|
@@ -51053,7 +53238,7 @@ function makeLambdaFn(params, lambdaBody, callerKey) {
|
|
|
51053
53238
|
props: childProps,
|
|
51054
53239
|
priority: 0
|
|
51055
53240
|
};
|
|
51056
|
-
return
|
|
53241
|
+
return React105__default.createElement(SlotContentRenderer2, { content: childContent });
|
|
51057
53242
|
};
|
|
51058
53243
|
}
|
|
51059
53244
|
function convertNode(node, callerKey) {
|
|
@@ -51072,7 +53257,7 @@ function convertNode(node, callerKey) {
|
|
|
51072
53257
|
});
|
|
51073
53258
|
return anyChanged ? mapped : node;
|
|
51074
53259
|
}
|
|
51075
|
-
if (typeof node === "object" && !
|
|
53260
|
+
if (typeof node === "object" && !React105__default.isValidElement(node) && !(node instanceof Date)) {
|
|
51076
53261
|
return convertObjectProps(node);
|
|
51077
53262
|
}
|
|
51078
53263
|
return node;
|
|
@@ -52061,11 +54246,11 @@ function buildMockData(schema) {
|
|
|
52061
54246
|
result[entityName] = entity.instances;
|
|
52062
54247
|
continue;
|
|
52063
54248
|
}
|
|
52064
|
-
const
|
|
54249
|
+
const rows2 = Array.from(
|
|
52065
54250
|
{ length: 10 },
|
|
52066
54251
|
(_, i) => generateEntityRow(entity, i + 1)
|
|
52067
54252
|
);
|
|
52068
|
-
result[entityName] =
|
|
54253
|
+
result[entityName] = rows2;
|
|
52069
54254
|
}
|
|
52070
54255
|
for (const orbital of schema.orbitals) {
|
|
52071
54256
|
for (const traitRef of orbital.traits ?? []) {
|
|
@@ -52735,8 +54920,8 @@ function CanvasDndProvider({
|
|
|
52735
54920
|
}) {
|
|
52736
54921
|
const eventBus = useEventBus();
|
|
52737
54922
|
const sensors = useAlmadarDndSensors(false);
|
|
52738
|
-
const [activePayload, setActivePayload] =
|
|
52739
|
-
const handleDragStart =
|
|
54923
|
+
const [activePayload, setActivePayload] = React105__default.useState(null);
|
|
54924
|
+
const handleDragStart = React105__default.useCallback((e) => {
|
|
52740
54925
|
const data = e.active.data.current;
|
|
52741
54926
|
const payload = data?.payload;
|
|
52742
54927
|
if (payload) {
|
|
@@ -52747,7 +54932,7 @@ function CanvasDndProvider({
|
|
|
52747
54932
|
log9.warn("dragStart:missing-payload", { id: e.active.id });
|
|
52748
54933
|
}
|
|
52749
54934
|
}, [eventBus]);
|
|
52750
|
-
const handleDragEnd =
|
|
54935
|
+
const handleDragEnd = React105__default.useCallback((e) => {
|
|
52751
54936
|
setActivePayload(null);
|
|
52752
54937
|
const activeData = e.active.data.current;
|
|
52753
54938
|
const payload = activeData?.payload;
|
|
@@ -52776,7 +54961,7 @@ function CanvasDndProvider({
|
|
|
52776
54961
|
const suppressed = onDrop ? onDrop(drop) === true : false;
|
|
52777
54962
|
if (!suppressed) defaultEmit(eventBus, drop);
|
|
52778
54963
|
}, [eventBus, onDrop]);
|
|
52779
|
-
const handleDragCancel =
|
|
54964
|
+
const handleDragCancel = React105__default.useCallback(() => {
|
|
52780
54965
|
setActivePayload(null);
|
|
52781
54966
|
log9.info("dragCancel");
|
|
52782
54967
|
}, []);
|
|
@@ -53534,7 +55719,7 @@ var OrbPreviewNodeInner = (props) => {
|
|
|
53534
55719
|
}
|
|
53535
55720
|
);
|
|
53536
55721
|
};
|
|
53537
|
-
var OrbPreviewNode =
|
|
55722
|
+
var OrbPreviewNode = React105__default.memo(OrbPreviewNodeInner);
|
|
53538
55723
|
OrbPreviewNode.displayName = "OrbPreviewNode";
|
|
53539
55724
|
orbPreviewLog.debug("export-resolved", () => ({
|
|
53540
55725
|
type: typeof OrbPreviewNode,
|
|
@@ -53639,7 +55824,7 @@ var EventFlowEdgeInner = (props) => {
|
|
|
53639
55824
|
) })
|
|
53640
55825
|
] });
|
|
53641
55826
|
};
|
|
53642
|
-
var EventFlowEdge =
|
|
55827
|
+
var EventFlowEdge = React105__default.memo(EventFlowEdgeInner);
|
|
53643
55828
|
EventFlowEdge.displayName = "EventFlowEdge";
|
|
53644
55829
|
|
|
53645
55830
|
// components/avl/molecules/BehaviorComposeNode.tsx
|
|
@@ -53786,7 +55971,7 @@ var BehaviorComposeNodeInner = (props) => {
|
|
|
53786
55971
|
}
|
|
53787
55972
|
);
|
|
53788
55973
|
};
|
|
53789
|
-
var BehaviorComposeNode =
|
|
55974
|
+
var BehaviorComposeNode = React105__default.memo(BehaviorComposeNodeInner);
|
|
53790
55975
|
BehaviorComposeNode.displayName = "BehaviorComposeNode";
|
|
53791
55976
|
|
|
53792
55977
|
// components/avl/lib/avl-behavior-compose-converter.ts
|
|
@@ -54812,7 +56997,7 @@ var TraitCardNodeInner = (props) => {
|
|
|
54812
56997
|
}
|
|
54813
56998
|
);
|
|
54814
56999
|
};
|
|
54815
|
-
var TraitCardNode =
|
|
57000
|
+
var TraitCardNode = React105__default.memo(TraitCardNodeInner);
|
|
54816
57001
|
TraitCardNode.displayName = "TraitCardNode";
|
|
54817
57002
|
|
|
54818
57003
|
// components/avl/organisms/FlowCanvas.tsx
|
|
@@ -54885,7 +57070,7 @@ function FlowCanvasInner({
|
|
|
54885
57070
|
initialOrbital
|
|
54886
57071
|
);
|
|
54887
57072
|
const [expandedBehaviorAlias, setExpandedBehaviorAlias] = useState(void 0);
|
|
54888
|
-
const screenSizeUserOverrideRef =
|
|
57073
|
+
const screenSizeUserOverrideRef = React105__default.useRef(false);
|
|
54889
57074
|
const [screenSize, setScreenSize] = useState(
|
|
54890
57075
|
() => typeof window === "undefined" ? "laptop" : detectScreenSize(window.innerWidth)
|
|
54891
57076
|
);
|
|
@@ -55269,7 +57454,7 @@ var ZoomBreadcrumb = ({
|
|
|
55269
57454
|
if (eventName && band === "detail") {
|
|
55270
57455
|
segments.push({ icon: "\u26A1", label: eventName });
|
|
55271
57456
|
}
|
|
55272
|
-
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(
|
|
57457
|
+
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(React105__default.Fragment, { children: [
|
|
55273
57458
|
i > 0 && /* @__PURE__ */ jsx("span", { className: "opacity-40", children: ">" }),
|
|
55274
57459
|
/* @__PURE__ */ jsx("span", { className: "opacity-60", children: seg.icon }),
|
|
55275
57460
|
/* @__PURE__ */ jsx("span", { children: seg.label })
|
|
@@ -55581,18 +57766,18 @@ function layoutOrbitals(count, containerW, containerH) {
|
|
|
55581
57766
|
if (count === 0) return [];
|
|
55582
57767
|
if (count === 1) return [{ cx: containerW / 2, cy: containerH / 2 }];
|
|
55583
57768
|
const cols = Math.min(count, Math.ceil(Math.sqrt(count)));
|
|
55584
|
-
const
|
|
57769
|
+
const rows2 = Math.ceil(count / cols);
|
|
55585
57770
|
const edgePad = 24;
|
|
55586
57771
|
const fitMinCx = UNIT_DISPLAY_W / 2 + edgePad;
|
|
55587
57772
|
const fitMinCy = UNIT_DISPLAY_H / 2 + edgePad;
|
|
55588
57773
|
const fitMaxCx = Math.max(fitMinCx, containerW - UNIT_DISPLAY_W / 2 - edgePad);
|
|
55589
57774
|
const fitMaxCy = Math.max(fitMinCy, containerH - UNIT_DISPLAY_H / 2 - edgePad);
|
|
55590
57775
|
const fitStepX = cols > 1 ? (fitMaxCx - fitMinCx) / (cols - 1) : 0;
|
|
55591
|
-
const fitStepY =
|
|
57776
|
+
const fitStepY = rows2 > 1 ? (fitMaxCy - fitMinCy) / (rows2 - 1) : 0;
|
|
55592
57777
|
const stepX = Math.min(fitStepX, UNIT_DISPLAY_W * 3.5);
|
|
55593
57778
|
const stepY = Math.min(fitStepY, UNIT_DISPLAY_H * 3.5);
|
|
55594
57779
|
const gridW = (cols - 1) * stepX;
|
|
55595
|
-
const gridH = (
|
|
57780
|
+
const gridH = (rows2 - 1) * stepY;
|
|
55596
57781
|
const originX = (containerW - gridW) / 2;
|
|
55597
57782
|
const originY = (containerH - gridH) / 2;
|
|
55598
57783
|
return Array.from({ length: count }, (_, i) => ({
|
|
@@ -55610,7 +57795,7 @@ var EventWireOverlay = ({
|
|
|
55610
57795
|
containerW,
|
|
55611
57796
|
containerH
|
|
55612
57797
|
}) => {
|
|
55613
|
-
const ids =
|
|
57798
|
+
const ids = React105__default.useMemo(() => {
|
|
55614
57799
|
avlOczWireId += 1;
|
|
55615
57800
|
return { arrow: `avl-ocz-wire-${avlOczWireId}-arrow` };
|
|
55616
57801
|
}, []);
|
|
@@ -55977,7 +58162,7 @@ var AvlOrbitalsCosmicZoom = ({
|
|
|
55977
58162
|
borderRadius: 6,
|
|
55978
58163
|
border: `1px solid ${color}`
|
|
55979
58164
|
},
|
|
55980
|
-
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(
|
|
58165
|
+
children: /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", children: breadcrumbs.map((crumb, i) => /* @__PURE__ */ jsxs(React105__default.Fragment, { children: [
|
|
55981
58166
|
i > 0 && /* @__PURE__ */ jsx(Typography, { variant: "small", style: { opacity: 0.5, color }, children: "/" }),
|
|
55982
58167
|
i < breadcrumbs.length - 1 ? /* @__PURE__ */ jsx(
|
|
55983
58168
|
Box,
|