@openbkn/workshop 0.2.2-rc.5 → 0.2.2-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +79 -8
  2. package/component.d.ts +10 -0
  3. package/dist/ActionConfirm-DJ91X3ml.js +236 -0
  4. package/dist/ActionFailure-ZgPt_3B-.js +37 -0
  5. package/dist/AgentChat-CRYai8ge.js +1062 -0
  6. package/dist/AppFormModal-D73ucaHK.js +4282 -0
  7. package/dist/AppListPage-D87piiOw.js +1364 -0
  8. package/dist/AskDrawer-BUMYsRnt.js +38 -0
  9. package/dist/ComputedView-CgYrDbx1.js +3221 -0
  10. package/dist/ConclusionApply-sjGfoEBY.js +153 -0
  11. package/dist/CypherEditor-lus6FA5L.js +485 -0
  12. package/dist/LandingList-6JI6864C.js +230 -0
  13. package/dist/MenuUnfoldOutlined-Cdg24l2h.js +27 -0
  14. package/dist/ModelTrial-ClHFGTpQ.js +359 -0
  15. package/dist/PageRenderer-DBd_g6mN.js +85480 -0
  16. package/dist/README-DjRyTQSR.js +76 -0
  17. package/dist/ScenarioApply-DtW_hh47.js +590 -0
  18. package/dist/SimulateForm-C-i08Jjd.js +153 -0
  19. package/dist/Subgraph-CnrkH9AN.js +32586 -0
  20. package/dist/WorkshopLabPage-DiVXQL9e.js +11364 -0
  21. package/dist/WorkshopRunPage-6hjRUf64.js +253 -0
  22. package/dist/abnfDiagram-WEYOIA3C-beRNhN3c.js +87 -0
  23. package/dist/action-type-tool.service-B2B74fKC.js +1060 -0
  24. package/dist/actionButton-DA5CNEzx.js +94 -0
  25. package/dist/actionButton.en-US-qjeqA7hs.js +94 -0
  26. package/dist/agentChat-EoDznd58.js +116 -0
  27. package/dist/agentChat.en-US-B6-pFd9Y.js +116 -0
  28. package/dist/alertList-DqditwM8.js +84 -0
  29. package/dist/alertList.en-US-BAXAgltP.js +84 -0
  30. package/dist/architectureDiagram-ZHVYKT53-DY2l1qxx.js +4779 -0
  31. package/dist/asOfSlider-QPvHWUMV.js +83 -0
  32. package/dist/asOfSlider.en-US-BI4jVfSn.js +83 -0
  33. package/dist/bkn-agent-execution.service-DVh-SHyl.js +205 -0
  34. package/dist/blockDiagram-RJAE7QA3-DR0mjN2h.js +1435 -0
  35. package/dist/c4Diagram-XDPPPE54-DH5zsGug.js +1518 -0
  36. package/dist/channel-B034hcOF.js +5 -0
  37. package/dist/china-C6m7zXIv.js +9 -0
  38. package/dist/chunk-2E7WHVMD-Ba3svxgx.js +664 -0
  39. package/dist/chunk-2Q5K7J3B-rT4eU6_y.js +15 -0
  40. package/dist/chunk-4EMNKR2T-C1kQZYHK.js +262 -0
  41. package/dist/chunk-55XCU76K-dcpLOktb.js +68 -0
  42. package/dist/chunk-5VM5RSS4-BdpQuzmO.js +19 -0
  43. package/dist/chunk-JWPE2WC7-CDBrSjU7.js +8 -0
  44. package/dist/chunk-VQ5W62QI-BiVKc40w.js +19 -0
  45. package/dist/chunk-XXDRQBXY-CPYrcdVW.js +8 -0
  46. package/dist/chunk-ZCHMQSOR-BG8OLpvb.js +451 -0
  47. package/dist/classDiagram-v2-4MYWR3UA-DqbpQpwI.js +1564 -0
  48. package/dist/component.d-DFoMKuUv.js +179 -0
  49. package/dist/cose-bilkent-JH36ORCC-CdXk4sPf.js +2609 -0
  50. package/dist/customComponents-DasaZ6pq.js +4 -0
  51. package/dist/customComponents.en-US-CkabuCXg.js +79 -0
  52. package/dist/customParseFormat-C0uLEpdq.js +182 -0
  53. package/dist/cynefin-EF2NZ3EQ-D7MVnMHu.js +21746 -0
  54. package/dist/cynefinDiagram-WF24UDRP-BYT_KpDL.js +299 -0
  55. package/dist/cytoscape.esm-BCV9V6aO.js +18760 -0
  56. package/dist/d3-scale-DA8IHmf0.js +1841 -0
  57. package/dist/dagre-NK4GIZVX-l-ghPdM8.js +2154 -0
  58. package/dist/dateRange-BbkLMg8L.js +79 -0
  59. package/dist/dateRange.en-US-CV12Q02G.js +79 -0
  60. package/dist/dayjs.min-DZ-YV8Mv.js +284 -0
  61. package/dist/diagram-CBK3MWTC-Bt3HiwvA.js +542 -0
  62. package/dist/diagram-I5XIIV2D-DcbqfBjx.js +150 -0
  63. package/dist/diagram-ODIL2UCW-9PC1n3n5.js +346 -0
  64. package/dist/diagram-PFBEJUXE-DGhr2kc7.js +478 -0
  65. package/dist/diagram-RJA3I4VV-DwzpOjZ_.js +219 -0
  66. package/dist/diagram-TYUNFSNR-B3Bd3TDU.js +2583 -0
  67. package/dist/dropdownFilter-DOi_8-ZT.js +76 -0
  68. package/dist/dropdownFilter.en-US-BiXpvXtF.js +76 -0
  69. package/dist/ebnfDiagram-V4P3TTPT-E5NN2oKc.js +109 -0
  70. package/dist/elk-QONTBCTQ-dFjcujl_.js +49170 -0
  71. package/dist/erDiagram-KYQIGQAA-BMrasBzB.js +1061 -0
  72. package/dist/eventList-CnsAwfDS.js +115 -0
  73. package/dist/eventList.en-US-Cof3rCLq.js +115 -0
  74. package/dist/eventReport-XS-HegnH.js +76 -0
  75. package/dist/eventReport.en-US-DTx4vzWT.js +76 -0
  76. package/dist/flowDiagram-IUGLLWBU-BGIBH0q0.js +1769 -0
  77. package/dist/ganttChart-DEeSvTJA.js +77 -0
  78. package/dist/ganttChart.en-US-SwRKrnoD.js +77 -0
  79. package/dist/ganttDiagram-R7GPNTJY-C0tb1Lpp.js +1741 -0
  80. package/dist/generateCypher-Ch9_lQa6.js +399 -0
  81. package/dist/gitGraphDiagram-PDYL7XHY-DBqcOa-c.js +815 -0
  82. package/dist/graph-CKJmgLki.js +1541 -0
  83. package/dist/index-BA-GzCXt.js +441 -0
  84. package/dist/infoDiagram-MVDRKAX5-Bwuki4JA.js +24 -0
  85. package/dist/ishikawaDiagram-HPEHV2GE-Dz4d6ygx.js +622 -0
  86. package/dist/journeyDiagram-BOSHW7O7-C99m34Bb.js +834 -0
  87. package/dist/kanban-definition-FNSA4HC5-mdqjODsT.js +724 -0
  88. package/dist/katex-BsrBVQKd.js +11314 -0
  89. package/dist/manifest-BjV1PJ6u.js +41 -0
  90. package/dist/mermaid.core-yQghUlIz.js +17642 -0
  91. package/dist/metricCards-CSb-_cT2.js +104 -0
  92. package/dist/metricCards.en-US-BLLhRsQU.js +104 -0
  93. package/dist/mindmap-definition-6OY57UG3-BZhO2wX4.js +834 -0
  94. package/dist/modelTrial-Bvb-RhGt.js +137 -0
  95. package/dist/modelTrial.en-US-DYcuor-G.js +137 -0
  96. package/dist/models-DekiCOuZ.js +6 -0
  97. package/dist/object-metric-numeric-vs3BeDkH.js +42 -0
  98. package/dist/object-metric.service-flZgBMRX.js +233 -0
  99. package/dist/objectDetail-SQUbp4Py.js +117 -0
  100. package/dist/objectDetail.en-US-DW3mlONM.js +117 -0
  101. package/dist/objectList-D99wPtJH.js +97 -0
  102. package/dist/objectList.en-US-PBBNyVLW.js +97 -0
  103. package/dist/objectTable-0jsFFMN3.js +127 -0
  104. package/dist/objectTable.en-US-yWEs8qc_.js +127 -0
  105. package/dist/pegDiagram-ECIUJNBX-BDa5RfZt.js +95 -0
  106. package/dist/pieDiagram-GNMPY74T-DNVtzXPv.js +165 -0
  107. package/dist/pivotTable-CHmQw18-.js +102 -0
  108. package/dist/pivotTable.en-US-B4uv4P08.js +102 -0
  109. package/dist/prompt-DYrjlEFr.js +373 -0
  110. package/dist/quadrantDiagram-D57K4MC3-vK0f2OvQ.js +1023 -0
  111. package/dist/railroadDiagram-Y72NRBL7-j6ZrTmRp.js +77 -0
  112. package/dist/regionMap-Cme-JyV_.js +128 -0
  113. package/dist/regionMap.en-US-Bwr2_p32.js +128 -0
  114. package/dist/requirementDiagram-EQYSW5RA-DgfEyljA.js +886 -0
  115. package/dist/sankeyDiagram-SY24JHO5-CImx-IX0.js +1160 -0
  116. package/dist/scenarioBar-BV43p7n-.js +122 -0
  117. package/dist/scenarioBar.en-US-5KqMQ2Bg.js +122 -0
  118. package/dist/scheduleGantt-CTYO-zYP.js +180 -0
  119. package/dist/scheduleGantt.en-US-hE7mvVUW.js +180 -0
  120. package/dist/searchBox-Ca7w0f_6.js +67 -0
  121. package/dist/searchBox.en-US-ArS_XBvB.js +67 -0
  122. package/dist/segmentedFilter-MhjVcWo0.js +80 -0
  123. package/dist/segmentedFilter.en-US-BxNrQO5T.js +80 -0
  124. package/dist/sequenceDiagram-BLEHNHQU-nWmjd1ci.js +2969 -0
  125. package/dist/sizeCapture-INFHLROL-D3jlbt7h.js +46 -0
  126. package/dist/stageChain-BxBafwjD.js +74 -0
  127. package/dist/stageChain.en-US-CP0G27n8.js +74 -0
  128. package/dist/stateDiagram-v2-A6IESKWZ-DG1ZetEu.js +1514 -0
  129. package/dist/subgraph-7n4SwliR.js +71 -0
  130. package/dist/subgraph.en-US-BNvY18IW.js +71 -0
  131. package/dist/swimlanes-B3ENRKFQ-cCmJE8AU.js +4991 -0
  132. package/dist/swimlanesDiagram-AYQRV4AK-CtuhyguU.js +14 -0
  133. package/dist/taskInbox-DGWYeI2b.js +118 -0
  134. package/dist/taskInbox.en-US-B-OzDmVl.js +118 -0
  135. package/dist/text-BqSVQKS6.js +78 -0
  136. package/dist/text.en-US-BhAxy_LE.js +78 -0
  137. package/dist/timeline-definition-JXYKGLGB-Cc-INsOv.js +1057 -0
  138. package/dist/trendChart-BjEeRS5_.js +135 -0
  139. package/dist/trendChart.en-US-BBGqWUKM.js +135 -0
  140. package/dist/useLabData-Df-jEHKs.js +20470 -0
  141. package/dist/usecaseDiagram-WPOLBNNX-r8wVjopm.js +7920 -0
  142. package/dist/vennDiagram-Q3Y3IDCW-BZiOcgrj.js +1579 -0
  143. package/dist/wardleyDiagram-IVAIDKWA-16jd07C_.js +675 -0
  144. package/dist/workshop-app-DnHNjBqy.js +86038 -0
  145. package/dist/workshop-app.css +1 -0
  146. package/dist/workshop-app.js +4 -0
  147. package/dist/world-Djau1JyJ.js +9 -0
  148. package/dist/xychartDiagram-4URNHDU4-C8DwWQNh.js +1460 -0
  149. package/dist-cli/workshop.js +340 -217
  150. package/example/host.js +109 -0
  151. package/example/index.html +93 -0
  152. package/example/server.mjs +237 -0
  153. package/index.d.ts +48 -0
  154. package/lib/validate.js +47 -1
  155. package/package.json +17 -5
  156. package/runtime/frame-runtime.js +13 -1
  157. package/workshop-component.js +32 -12
  158. package/workshop.js +2 -0
@@ -0,0 +1,230 @@
1
+ import { h as D, u as K, r as T, j as u, I as Q, c as V, l as W, f as G } from "./workshop-app-DnHNjBqy.js";
2
+ import { a as B, a0 as X, a1 as Y, a2 as Z, a3 as _, a4 as nn, u as H, a5 as en, e as tn, n as C, T as R } from "./useLabData-Df-jEHKs.js";
3
+ import { e as an } from "./generateCypher-Ch9_lQa6.js";
4
+ import { i as sn, s as y, c as on } from "./PageRenderer-DBd_g6mN.js";
5
+ import { A as rn } from "./ActionFailure-ZgPt_3B-.js";
6
+ const cn = (n, e) => `${n}\0${e}`;
7
+ function ln(n, e, s, r) {
8
+ const o = n.model?.landing;
9
+ if (!o) return [];
10
+ const c = o.action ? B(s, o.action.id) : void 0;
11
+ return e.filter((l) => D(l, o.when, r)).map((l) => ({
12
+ id: cn(n.id, l.$key),
13
+ source: n,
14
+ row: l,
15
+ landing: o,
16
+ ...c ? { action: c } : {}
17
+ }));
18
+ }
19
+ const I = (n) => Object.entries(n.action?.params ?? {}).filter(([, e]) => e.from === "ask").map(([e]) => e), P = (n, e) => n.from === "field" ? e[n.name] ?? null : n.value, S = (n) => n == null || n === "";
20
+ function dn(n, e, s) {
21
+ const r = {}, o = [], c = n.landing.action?.params ?? {}, l = n.landing.action?.newObject?.fields ?? {}, a = U(n, s);
22
+ for (const i of n.action?.inputs ?? []) {
23
+ const m = c[i.name];
24
+ let d;
25
+ if (!m && i.property) {
26
+ d = i.name in l ? n.row[l[i.name]] : void 0, S(d) ? i.name !== a && o.push(i.name) : r[i.name] = d;
27
+ continue;
28
+ }
29
+ m ? m.from === "ask" ? d = e[i.name] : m.from === "item" ? d = [
30
+ Object.fromEntries(
31
+ Object.entries(m.fields).map(([g, w]) => [g, P(w, n.row)])
32
+ )
33
+ ] : d = P(m, n.row) : d = void 0, S(d) ? o.push(i.name) : r[i.name] = d;
34
+ }
35
+ return { params: r, missing: o };
36
+ }
37
+ function U(n, e) {
38
+ const s = n.landing.action;
39
+ if (!(s?.target !== "new" || !n.action))
40
+ return s.newObject?.keyField ?? e.objectTypes[n.action.objectType]?.primaryKeys[0];
41
+ }
42
+ function pn(n, e, s) {
43
+ const r = n.landing.action;
44
+ if (!r || !n.action) return {};
45
+ if (r.target === "new") {
46
+ const l = U(n, e);
47
+ if (!l || !s) return {};
48
+ const a = { [l]: s };
49
+ for (const [i, m] of Object.entries(r.newObject?.fields ?? {}))
50
+ a[i] = n.row[m] ?? null;
51
+ return a;
52
+ }
53
+ const o = e.objectTypes[n.landing.object.type]?.primaryKeys ?? [], c = n.row[n.landing.object.field];
54
+ return o.length === 1 && !S(c) ? { [o[0]]: c } : {};
55
+ }
56
+ const un = (n, e, s) => `${n}${e.toString(36).toUpperCase()}${s.toString(36).toUpperCase().padStart(3, "0")}`;
57
+ async function fn(n, e, s, r) {
58
+ const o = e.objectTypes[s], c = o?.primaryKeys ?? [];
59
+ if (!o || c.length !== 1 || r.length === 0) return /* @__PURE__ */ new Set();
60
+ const l = { label: o.name, objectType: s, key: c[0] }, a = X(l, e), i = (d) => `MATCH (n:\`${s}\`) WHERE ${_("n", c, d, a)} RETURN ${nn("n", c)}`, m = /* @__PURE__ */ new Set();
61
+ for (const d of Y(r, c, i))
62
+ for (const g of await n(i(d))) m.add(Z(g, c, a));
63
+ return m;
64
+ }
65
+ const mn = {
66
+ accepted: "processing",
67
+ done: "success",
68
+ failed: "error",
69
+ cancelled: "default",
70
+ manual: "warning",
71
+ skipped: "default"
72
+ };
73
+ function yn(n, e) {
74
+ const s = n?.trim() ?? "";
75
+ if (s !== "") {
76
+ if (e && /int|number|float|double|decimal|long/i.test(e)) {
77
+ const r = Number(s);
78
+ return Number.isFinite(r) ? r : void 0;
79
+ }
80
+ return s;
81
+ }
82
+ }
83
+ function wn({
84
+ sources: n,
85
+ views: e,
86
+ records: s,
87
+ upToDate: r,
88
+ moved: o,
89
+ asOf: c,
90
+ again: l
91
+ }) {
92
+ const { t: a } = K(), i = H(), m = T.useMemo(
93
+ () => n.flatMap(
94
+ (t) => ln(t, e?.[t.id]?.rows ?? [], i.kn, c)
95
+ ),
96
+ [n, e, i.kn, c]
97
+ ), d = n.filter((t) => t.model?.landing?.action?.target === "object"), g = (t) => m.filter((p) => p.source.id === t.id).map((p) => String(p.row[p.landing.object.field] ?? "")), w = d.length > 0 ? JSON.stringify(d.map((t) => [t.id, g(t)])) : null, h = sn(w, async () => {
98
+ const t = await Promise.all(
99
+ d.map(
100
+ async (p) => [
101
+ p.id,
102
+ await fn(
103
+ i.run,
104
+ i.kn,
105
+ p.model.landing.object.type,
106
+ g(p).filter(Boolean)
107
+ )
108
+ ]
109
+ )
110
+ );
111
+ return new Map(t);
112
+ }), b = n.flatMap((t) => {
113
+ const p = t.model.landing, k = p.action ? B(i.kn, p.action.id) : void 0;
114
+ return I(p).map((j) => ({
115
+ source: t,
116
+ name: j,
117
+ label: en(k, j),
118
+ type: k?.inputs.find((L) => L.name === j)?.type
119
+ }));
120
+ }), [x, $] = T.useState({}), f = (t) => Object.fromEntries(
121
+ b.filter((p) => p.source.id === t.id).map((p) => [p.name, yn(x[`${t.id}\0${p.name}`], p.type)])
122
+ ), [O] = T.useState(() => Date.now()), J = m.map((t, p) => {
123
+ const k = s?.[t.id], j = t.landing.action?.target, L = k && !l?.has(t.id) ? k.key : void 0, M = j === "new" ? L ?? un(t.landing.action?.newObject?.prefix ?? "", O, p) : void 0, v = t.action ? dn(t, f(t.source), i.kn) : void 0, E = I(t.landing), F = (v?.missing ?? []).filter((N) => !E.includes(N)), A = t.action ? pn(t, i.kn, M) : {}, q = String(t.row[t.landing.object.field] ?? ""), z = r ? t.landing.action && !t.action ? a("workshopLab.act.unknown", { id: t.landing.action.id }) : t.action && !t.action.canExecute ? a("workshopLab.act.forbidden") : j === "object" && h.status === "loading" ? a("workshopLab.scenario.apply.finding") : j === "object" && (h.status !== "ready" || !h.value.get(t.source.id)?.has(q)) || t.action && Object.keys(A).length === 0 ? a("workshopLab.scenario.apply.noObject") : F.length > 0 ? a("workshopLab.scenario.apply.missing", { names: F.join("、") }) : void 0 : a("workshopLab.scenario.computeFirst");
124
+ return {
125
+ item: t,
126
+ record: k,
127
+ newKey: M,
128
+ prepared: v,
129
+ identity: A,
130
+ blocked: z,
131
+ waiting: (v?.missing ?? []).filter((N) => E.includes(N)),
132
+ moved: o.has(t.source.id)
133
+ };
134
+ });
135
+ return { items: m, plans: J, asks: b, asked: x, setAsked: $, finding: h.status === "loading" };
136
+ }
137
+ async function xn(n, e, s) {
138
+ const r = e.newKey ?? String(e.item.row[e.item.landing.object.field] ?? "");
139
+ if (!e.item.action || !e.prepared) return { key: r, applied: { status: "manual", at: s } };
140
+ try {
141
+ const o = await tn(
142
+ n,
143
+ e.item.action,
144
+ e.identity,
145
+ e.prepared.params
146
+ );
147
+ return { key: r, applied: { status: "accepted", executionId: o, at: s } };
148
+ } catch (o) {
149
+ return { key: r, applied: { status: "failed", error: an(o), at: s } };
150
+ }
151
+ }
152
+ function On({
153
+ source: n,
154
+ asks: e,
155
+ asked: s,
156
+ onAsked: r,
157
+ disabled: o
158
+ }) {
159
+ const { t: c } = K(), l = e.filter((a) => a.source.id === n.id);
160
+ return l.length === 0 ? null : /* @__PURE__ */ u.jsxs("div", { className: y.actConfirm, children: [
161
+ /* @__PURE__ */ u.jsx("span", { className: y.actMuted, children: c("workshopLab.scenario.apply.askedHint") }),
162
+ l.map((a) => /* @__PURE__ */ u.jsxs("label", { className: y.actField, children: [
163
+ /* @__PURE__ */ u.jsx("span", { children: a.label }),
164
+ /* @__PURE__ */ u.jsx(
165
+ Q,
166
+ {
167
+ size: "small",
168
+ disabled: o,
169
+ value: s[`${n.id}\0${a.name}`] ?? "",
170
+ onChange: (i) => r({ ...s, [`${n.id}\0${a.name}`]: i.target.value })
171
+ }
172
+ )
173
+ ] }, a.name))
174
+ ] });
175
+ }
176
+ function $n({
177
+ plan: n,
178
+ ticked: e,
179
+ disabled: s,
180
+ onTick: r,
181
+ note: o
182
+ }) {
183
+ const { t: c } = K(), l = H(), { item: a, record: i } = n, m = V(a.source, l.kn), d = a.source.model?.outputs ?? [], g = (f) => G(a.source, m, f, a.row[f]), w = d.filter(
184
+ (f) => f.type === "text" && f.name !== a.source.key
185
+ ), h = d.filter((f) => f.type !== "text"), b = i?.applied, x = W(b), $ = Object.entries(n.prepared?.params ?? {}).map(
186
+ ([f, O]) => `${f} ${typeof O == "object" ? JSON.stringify(O) : String(O)}`
187
+ ).join(";");
188
+ return /* @__PURE__ */ u.jsxs("li", { children: [
189
+ /* @__PURE__ */ u.jsx(
190
+ on,
191
+ {
192
+ checked: e,
193
+ disabled: s,
194
+ onChange: (f) => r(f.target.checked)
195
+ }
196
+ ),
197
+ /* @__PURE__ */ u.jsxs("span", { className: y.applyBody, children: [
198
+ /* @__PURE__ */ u.jsxs("span", { children: [
199
+ /* @__PURE__ */ u.jsx("b", { children: C(a.row, a.source, l.kn, a.row.$key) }),
200
+ " ",
201
+ w.map((f) => g(f.name)).filter(Boolean).join(" · ")
202
+ ] }),
203
+ /* @__PURE__ */ u.jsx("span", { className: y.actMuted, children: h.map((f) => `${f.label} ${g(f.name)}`).join(";") }),
204
+ n.newKey && /* @__PURE__ */ u.jsx("span", { className: y.actMuted, children: c("workshopLab.scenario.apply.newObject", { key: n.newKey }) }),
205
+ $ && /* @__PURE__ */ u.jsx("span", { className: y.actMuted, children: c("workshopLab.scenario.apply.params", { params: $ }) }),
206
+ o && /* @__PURE__ */ u.jsx("span", { className: y.actMuted, children: o }),
207
+ n.moved && !x && /* @__PURE__ */ u.jsx("span", { className: y.actError, children: c("workshopLab.scenario.apply.movedSince") }),
208
+ n.blocked && !x && /* @__PURE__ */ u.jsx("span", { className: y.actError, children: n.blocked }),
209
+ b?.error && /* @__PURE__ */ u.jsx(
210
+ rn,
211
+ {
212
+ error: b.error,
213
+ item: C(a.row, a.source, l.kn, a.row.$key),
214
+ ...a.action ? { action: a.action.name } : {}
215
+ }
216
+ )
217
+ ] }),
218
+ /* @__PURE__ */ u.jsxs("span", { className: y.applyAction, children: [
219
+ a.action ? a.action.name : /* @__PURE__ */ u.jsx(R, { children: c("workshopLab.scenario.apply.manualTag") }),
220
+ b && /* @__PURE__ */ u.jsx(R, { color: mn[b.status], children: c(`workshopLab.scenario.apply.status.${b.status}`) })
221
+ ] })
222
+ ] });
223
+ }
224
+ export {
225
+ On as L,
226
+ mn as T,
227
+ $n as a,
228
+ xn as r,
229
+ wn as u
230
+ };
@@ -0,0 +1,27 @@
1
+ import { N as l, r as u, R as d } from "./workshop-app-DnHNjBqy.js";
2
+ var t = {}, o;
3
+ function s() {
4
+ if (o) return t;
5
+ o = 1, Object.defineProperty(t, "__esModule", { value: !0 });
6
+ var e = { icon: { tag: "svg", attrs: { viewBox: "64 64 896 896", focusable: "false" }, children: [{ tag: "path", attrs: { d: "M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 000-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0014.4 7z" } }] }, name: "menu-unfold", theme: "outlined" };
7
+ return t.default = e, t;
8
+ }
9
+ var f = /* @__PURE__ */ s();
10
+ const i = /* @__PURE__ */ l(f);
11
+ function c() {
12
+ return c = Object.assign ? Object.assign.bind() : function(e) {
13
+ for (var n = 1; n < arguments.length; n++) {
14
+ var r = arguments[n];
15
+ for (var a in r)
16
+ Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
17
+ }
18
+ return e;
19
+ }, c.apply(this, arguments);
20
+ }
21
+ const v = (e, n) => /* @__PURE__ */ u.createElement(d, c({}, e, {
22
+ ref: n,
23
+ icon: i
24
+ })), p = /* @__PURE__ */ u.forwardRef(v);
25
+ export {
26
+ p as R
27
+ };
@@ -0,0 +1,359 @@
1
+ import { r as v, j as t, u as La, p as va, i as sa, I as Na, a as C, k as Sa } from "./workshop-app-DnHNjBqy.js";
2
+ import { e as Oa } from "./generateCypher-Ch9_lQa6.js";
3
+ import { u as la, c as Ca, d as Ta, g as $a, b as Ia, r as za, l as Ea, s as Ma, h as Aa, v as Pa, j as ea, k as ta, m as Ra, a as Da, T as Ga, o as _a, p as Ba, A as Fa, q as na, n as Ka, w as ia, x as Ja, y as Va, z as qa } from "./useLabData-Df-jEHKs.js";
4
+ import { a as ca, u as Ha, E as Ua, C as ra, b as i, F as J, T as Xa, R as Ya, c as Qa } from "./PageRenderer-DBd_g6mN.js";
5
+ const Wa = 10, Za = 2, V = (m, s) => JSON.stringify(m) === JSON.stringify(s), as = /^\d{4}-\d{2}-\d{2}$/, ss = (m, s) => m.type === "number" ? typeof s == "number" : m.type !== "date" || typeof s == "string" && as.test(s);
6
+ function es(m, s, b) {
7
+ const j = ia(m.params);
8
+ return Object.fromEntries(
9
+ m.params.map((h) => {
10
+ const w = Object.hasOwn(s.params, h.name) ? s.params[h.name] : h.scenarioParam && b && Object.hasOwn(b, h.scenarioParam) ? b[h.scenarioParam] : j[h.name];
11
+ return [h.name, ss(h, w) ? w : null];
12
+ })
13
+ );
14
+ }
15
+ const ts = (m) => m == null || m === "";
16
+ function oa(m) {
17
+ const s = m ? ia(m.params) : {}, b = Object.fromEntries(
18
+ Object.entries(s).filter(
19
+ ([j]) => !m?.params.find((h) => h.name === j)?.scenarioParam
20
+ )
21
+ );
22
+ return {
23
+ model: m?.id ?? "",
24
+ groups: [
25
+ { id: "g1", params: b },
26
+ { id: "g2", params: s }
27
+ ]
28
+ };
29
+ }
30
+ function cs({ config: m }) {
31
+ const { appId: s = "", pageId: b = "" } = la(), j = v.useContext(ca)?.id ?? "trial";
32
+ return /* @__PURE__ */ t.jsx(ns, { config: m }, Ca(s, b, j));
33
+ }
34
+ function ns({ config: m }) {
35
+ const { t: s } = La(), { title: b, source: j, filters: h } = m, { spec: w, kn: T, values: q, act: M, appId: A = "", pageId: P = "" } = la(), R = v.useContext(ca)?.id ?? "trial", f = Ta(j, h), S = $a(), { create: da } = Ha(), $ = Ia(w, q), x = f.status === "ready" ? f.source : za(w, j), N = v.useMemo(() => x?.models ?? [], [x]), [y, D] = v.useState(
36
+ () => Ea(A, P, R) ?? oa(N[0])
37
+ ), [G, H] = v.useState(!1), [U, ma] = v.useState(!1), [_, ua] = v.useState(null);
38
+ v.useEffect(() => Ma(A, P, R, y), [A, P, R, y]);
39
+ const l = N.find((a) => a.id === y.model) ?? N[0], k = f.status === "ready" ? f.rows : [], u = y.groups, p = y.run && y.model === l?.id ? y.run : void 0, X = Aa(h).flatMap((a) => {
40
+ const e = q[a.variable], r = Pa(w, a.variable)?.label;
41
+ if (e == null || e === "" || !r) return [];
42
+ const n = e;
43
+ return [typeof n == "object" && n.label ? `${r}(${n.label})` : r];
44
+ }), pa = va(w.scenarioParams, S), I = (a, e) => l ? es(l, a, e === 0 ? pa : void 0) : {}, ha = l ? ea(l, $, k) : "", B = p !== void 0 && l !== void 0 && (p.signature !== ha || u.some(
45
+ (a, e) => !p.groups[a.id] || !V(p.groups[a.id].params, I(a, e))
46
+ )), F = (a) => D((e) => ({ ...e, groups: a })), Y = (a, e, r) => F(
47
+ u.map(
48
+ (n) => n.id === a ? { ...n, params: { ...n.params, [e]: r } } : n
49
+ )
50
+ ), ba = async () => {
51
+ if (!l) return;
52
+ H(!0);
53
+ const a = y.model, e = k, r = u.map((o, c) => ({ ...o, params: I(o, c) })), n = await Promise.all(
54
+ r.map(async (o) => {
55
+ const c = o.params;
56
+ try {
57
+ const d = await Ja(l, $, c, e);
58
+ return [
59
+ o.id,
60
+ { params: c, status: "done", results: Object.fromEntries(d) }
61
+ ];
62
+ } catch (d) {
63
+ return [
64
+ o.id,
65
+ { params: c, status: "failed", error: Oa(d) }
66
+ ];
67
+ }
68
+ })
69
+ );
70
+ D(
71
+ (o) => o.model !== a ? o : {
72
+ ...o,
73
+ model: l.id,
74
+ // Values the sets did not hold are kept as run; any set meanwhile stays as set.
75
+ groups: o.groups.map((c) => {
76
+ const d = r.find((g) => g.id === c.id);
77
+ return d ? { ...c, params: { ...d.params, ...c.params } } : c;
78
+ }),
79
+ run: {
80
+ at: (/* @__PURE__ */ new Date()).toISOString(),
81
+ signature: ea(l, $, e),
82
+ ...S ? { scenario: S.name } : {},
83
+ count: e.length,
84
+ groups: Object.fromEntries(n)
85
+ }
86
+ }
87
+ ), H(!1);
88
+ };
89
+ if (!x) return /* @__PURE__ */ t.jsx(Ua, { text: s("workshopLab.trial.noSource") });
90
+ if (!l)
91
+ return /* @__PURE__ */ t.jsx(ra, { title: b, children: /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.noModels", { source: x.label ?? x.id }) }) });
92
+ const Q = k.length > ta, fa = !B && l.params.some((a) => a.scenarioParam), ga = (a, e) => {
93
+ const r = p?.groups[a.id];
94
+ if (!r) return;
95
+ const n = { ...S?.params };
96
+ for (const o of l.params) {
97
+ const c = w.scenarioParams?.find((g) => g.name === o.scenarioParam), d = r.params[o.name];
98
+ !c || typeof d != "string" && typeof d != "number" || (d === c.default ? delete n[c.name] : n[c.name] = d);
99
+ }
100
+ da(S, {
101
+ name: s("workshopLab.trial.savedName", {
102
+ base: S?.name ?? s("workshopLab.scenario.fact"),
103
+ group: L(e)
104
+ }),
105
+ params: n
106
+ });
107
+ }, W = u.some((a, e) => Object.values(I(a, e)).some(ts)), z = u.map((a) => Ra(p?.groups[a.id])), L = (a) => s("workshopLab.trial.group", { n: a + 1 }), Z = (a, e) => {
108
+ const r = z[a];
109
+ return r ? Va(
110
+ k.filter((n) => r.has(n.$key)),
111
+ r,
112
+ e,
113
+ $
114
+ ) : null;
115
+ }, ka = (a, e) => e === void 0 ? s("workshopLab.trial.noResult") : Sa(e, a.type), ja = (a) => l.outputs.some((e) => {
116
+ const r = z.filter((n) => !!n).map((n) => n.get(a.$key)?.[e.name]);
117
+ return r.some((n) => !V(n, r[0]));
118
+ }), wa = p ? k.filter((a) => !U || ja(a)) : [], E = u.filter((a) => p?.groups[a.id]?.status === "done").map((a) => a.id), O = _ && E.includes(_) ? _ : E[E.length - 1], aa = l.action ? Da(T, l.action.id) : void 0, xa = (T.actionTypes ?? []).some(
119
+ (a) => a.objectType === x.objectType && a.canExecute
120
+ ), K = l.action ? aa ? aa.canExecute ? B ? s("workshopLab.trial.stale") : !O || !M ? s("workshopLab.trial.nothingToAct") : null : s("workshopLab.act.forbidden") : s("workshopLab.act.unknown", { id: l.action.id }) : s(xa ? "workshopLab.trial.noAction" : "workshopLab.trial.noRunnable"), ya = () => {
121
+ const a = O ? p?.groups[O] : void 0, e = a && qa(l, T, x, a, k);
122
+ if (!e || !M) return;
123
+ const r = u.findIndex((n) => n.id === O);
124
+ M({
125
+ ...e.request,
126
+ confirm: s("workshopLab.trial.actConfirm", { model: l.label, group: L(r) }),
127
+ ...e.skipped.length > 0 ? {
128
+ note: s("workshopLab.trial.skipped", {
129
+ count: e.skipped.length,
130
+ names: [...new Set(e.skipped.flatMap((n) => n.missing))].map((n) => `「${n}」`).join("")
131
+ })
132
+ } : {},
133
+ origin: "trial"
134
+ });
135
+ };
136
+ return /* @__PURE__ */ t.jsx(ra, { title: b, children: /* @__PURE__ */ t.jsxs("div", { className: i.trial, children: [
137
+ /* @__PURE__ */ t.jsxs("div", { className: i.trialLine, children: [
138
+ N.length > 1 && /* @__PURE__ */ t.jsx(
139
+ sa,
140
+ {
141
+ size: "small",
142
+ className: i.trialSelect,
143
+ "aria-label": s("workshopLab.trial.model"),
144
+ value: l.id,
145
+ disabled: G,
146
+ onChange: (a) => {
147
+ const e = N.find((r) => r.id === a);
148
+ D({ ...oa(e), model: a });
149
+ },
150
+ options: N.map((a) => ({ value: a.id, label: a.label }))
151
+ }
152
+ ),
153
+ N.length === 1 && /* @__PURE__ */ t.jsx("b", { children: l.label }),
154
+ f.status === "loading" ? /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.data.loading") }) : f.status === "error" ? /* @__PURE__ */ t.jsx("span", { className: i.muted, children: f.message }) : /* @__PURE__ */ t.jsxs("span", { children: [
155
+ s("workshopLab.trial.objects", { count: k.length }),
156
+ X.length > 0 ? s("workshopLab.trial.from", { names: X.map((a) => `「${a}」`).join("") }) : s("workshopLab.trial.fromAll")
157
+ ] })
158
+ ] }),
159
+ l.description && /* @__PURE__ */ t.jsx("span", { className: i.muted, children: l.description }),
160
+ f.status === "ready" && k.length === 0 && /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.none") }),
161
+ Q && /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.tooMany", { max: ta }) }),
162
+ /* @__PURE__ */ t.jsx("div", { className: i.tableScroll, children: /* @__PURE__ */ t.jsx(
163
+ J,
164
+ {
165
+ size: "small",
166
+ rowKey: "name",
167
+ pagination: !1,
168
+ dataSource: l.params,
169
+ columns: [
170
+ { key: "param", title: s("workshopLab.trial.param"), dataIndex: "label" },
171
+ ...u.map((a, e) => ({
172
+ key: a.id,
173
+ title: /* @__PURE__ */ t.jsxs("span", { className: i.trialGroupHead, children: [
174
+ L(e),
175
+ e === 0 && /* @__PURE__ */ t.jsx(Ga, { children: s("workshopLab.trial.baseline") }),
176
+ e > 0 && u.length > Za && /* @__PURE__ */ t.jsx(
177
+ C,
178
+ {
179
+ size: "small",
180
+ type: "text",
181
+ icon: /* @__PURE__ */ t.jsx(Ya, {}),
182
+ "aria-label": `${s("workshopLab.trial.removeGroup")} ${L(e)}`,
183
+ onClick: () => F(u.filter((r) => r.id !== a.id))
184
+ }
185
+ )
186
+ ] }),
187
+ render: (r, n) => {
188
+ const o = I(a, e)[n.name], c = `${L(e)} ${n.label}`;
189
+ return n.type === "number" ? /* @__PURE__ */ t.jsx(
190
+ Xa,
191
+ {
192
+ size: "small",
193
+ "aria-label": c,
194
+ min: n.min,
195
+ max: n.max,
196
+ value: typeof o == "number" ? o : null,
197
+ onChange: (d) => Y(a.id, n.name, d ?? null)
198
+ }
199
+ ) : /* @__PURE__ */ t.jsx(
200
+ Na,
201
+ {
202
+ size: "small",
203
+ "aria-label": c,
204
+ type: n.type === "date" ? "date" : "text",
205
+ value: o == null ? "" : String(o),
206
+ onChange: (d) => Y(a.id, n.name, d.target.value)
207
+ }
208
+ );
209
+ }
210
+ }))
211
+ ]
212
+ }
213
+ ) }),
214
+ /* @__PURE__ */ t.jsxs("div", { className: i.trialLine, children: [
215
+ /* @__PURE__ */ t.jsx(
216
+ C,
217
+ {
218
+ size: "small",
219
+ icon: /* @__PURE__ */ t.jsx(Ba, {}),
220
+ disabled: u.length >= _a,
221
+ onClick: () => {
222
+ const a = u[u.length - 1], e = new Set(u.map((n) => n.id));
223
+ let r = u.length + 1;
224
+ for (; e.has(`g${r}`); ) r++;
225
+ F([...u, { id: `g${r}`, params: { ...a.params } }]);
226
+ },
227
+ children: s("workshopLab.trial.addGroup")
228
+ }
229
+ ),
230
+ /* @__PURE__ */ t.jsx(
231
+ C,
232
+ {
233
+ size: "small",
234
+ type: "primary",
235
+ loading: G,
236
+ disabled: f.status !== "ready" || k.length === 0 || Q || W,
237
+ onClick: () => {
238
+ ba();
239
+ },
240
+ children: s(G ? "workshopLab.trial.running" : "workshopLab.trial.run")
241
+ }
242
+ ),
243
+ W && /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.unfilled") })
244
+ ] }),
245
+ p && f.status === "ready" && /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
246
+ /* @__PURE__ */ t.jsxs("div", { className: i.trialLine, children: [
247
+ /* @__PURE__ */ t.jsx("span", { className: i.tag, "data-tone": "info", children: s("workshopLab.trial.resultTag") }),
248
+ /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.runInfo", {
249
+ count: p.count,
250
+ at: new Date(p.at).toLocaleString(),
251
+ basis: p.scenario ? s("workshopLab.trial.onScenario", { name: p.scenario }) : s("workshopLab.trial.onFact")
252
+ }) })
253
+ ] }),
254
+ B && /* @__PURE__ */ t.jsx(Fa, { type: "warning", showIcon: !0, message: s("workshopLab.trial.stale") }),
255
+ /* @__PURE__ */ t.jsx("div", { className: i.tableScroll, children: /* @__PURE__ */ t.jsx(
256
+ J,
257
+ {
258
+ size: "small",
259
+ rowKey: "label",
260
+ pagination: !1,
261
+ dataSource: l.measures,
262
+ columns: [
263
+ { key: "label", title: s("workshopLab.trial.measure"), dataIndex: "label" },
264
+ ...u.map((a, e) => {
265
+ const r = p.groups[a.id];
266
+ return {
267
+ key: a.id,
268
+ align: "right",
269
+ title: /* @__PURE__ */ t.jsxs("span", { className: i.trialGroupHead, children: [
270
+ L(e),
271
+ fa && r?.status === "done" && /* @__PURE__ */ t.jsx(C, { size: "small", type: "link", onClick: () => ga(a, e), children: s("workshopLab.trial.saveAs") })
272
+ ] }),
273
+ render: (n, o) => {
274
+ if (r?.status === "failed")
275
+ return /* @__PURE__ */ t.jsx("span", { className: i.muted, children: s("workshopLab.trial.failed", { error: r.error }) });
276
+ const c = Z(e, o), d = e > 0 ? Z(0, o) : null, g = c !== null && d !== null ? c - d : null;
277
+ return /* @__PURE__ */ t.jsxs("span", { className: i.compareCell, children: [
278
+ na(c, o.aggregate),
279
+ g !== null && g !== 0 && /* @__PURE__ */ t.jsxs("span", { className: i.compareDelta, children: [
280
+ g > 0 ? "+" : "",
281
+ na(g, o.aggregate)
282
+ ] })
283
+ ] });
284
+ }
285
+ };
286
+ })
287
+ ]
288
+ }
289
+ ) }),
290
+ /* @__PURE__ */ t.jsxs("div", { className: i.trialLine, children: [
291
+ /* @__PURE__ */ t.jsx("span", { children: s("workshopLab.trial.actOn") }),
292
+ /* @__PURE__ */ t.jsx(
293
+ sa,
294
+ {
295
+ size: "small",
296
+ className: i.trialSelect,
297
+ "aria-label": s("workshopLab.trial.actGroup"),
298
+ value: O,
299
+ onChange: (a) => ua(a),
300
+ options: u.map((a, e) => ({ value: a.id, label: L(e) })).filter((a) => E.includes(a.value))
301
+ }
302
+ ),
303
+ /* @__PURE__ */ t.jsx(C, { size: "small", disabled: !!K, onClick: ya, children: s("workshopLab.trial.act") }),
304
+ K && /* @__PURE__ */ t.jsx("span", { className: i.muted, children: K })
305
+ ] }),
306
+ /* @__PURE__ */ t.jsxs("div", { className: i.trialLine, children: [
307
+ /* @__PURE__ */ t.jsx("b", { className: i.compareTitle, children: s("workshopLab.trial.detail") }),
308
+ /* @__PURE__ */ t.jsx(
309
+ Qa,
310
+ {
311
+ checked: U,
312
+ onChange: (a) => ma(a.target.checked),
313
+ children: s("workshopLab.trial.onlyDiffering")
314
+ }
315
+ )
316
+ ] }),
317
+ /* @__PURE__ */ t.jsx(
318
+ J,
319
+ {
320
+ size: "small",
321
+ rowKey: "$key",
322
+ pagination: { pageSize: Wa, size: "small", showSizeChanger: !1 },
323
+ scroll: { x: "max-content" },
324
+ dataSource: wa,
325
+ columns: [
326
+ {
327
+ key: "object",
328
+ title: s("workshopLab.trial.object"),
329
+ render: (a, e) => Ka(e, x, T)
330
+ },
331
+ ...l.outputs.map((a) => ({
332
+ key: a.name,
333
+ title: a.label,
334
+ children: u.map((e, r) => ({
335
+ key: `${a.name}\0${e.id}`,
336
+ title: L(r),
337
+ render: (n, o) => {
338
+ const c = z[r];
339
+ if (!c) return "—";
340
+ const d = c.get(o.$key)?.[a.name], g = z[0]?.get(o.$key)?.[a.name];
341
+ return /* @__PURE__ */ t.jsx(
342
+ "span",
343
+ {
344
+ className: r > 0 && !V(d, g) ? i.trialChanged : void 0,
345
+ children: ka(a, d)
346
+ }
347
+ );
348
+ }
349
+ }))
350
+ }))
351
+ ]
352
+ }
353
+ )
354
+ ] })
355
+ ] }) });
356
+ }
357
+ export {
358
+ cs as ModelTrial
359
+ };