@tai42/studio-sdk 13.3.0 → 15.0.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/components/components.css +19 -0
- package/dist/components/icons.d.ts +2 -0
- package/dist/components/icons.d.ts.map +1 -1
- package/dist/components/icons.js +2 -0
- package/dist/components/icons.js.map +1 -1
- package/dist/components/templated-text-field.d.ts +98 -0
- package/dist/components/templated-text-field.d.ts.map +1 -0
- package/dist/components/templated-text-field.js +217 -0
- package/dist/components/templated-text-field.js.map +1 -0
- package/dist/hooks/useApi.d.ts +461 -59
- package/dist/hooks/useApi.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/navigation/types.d.ts +2 -1
- package/dist/navigation/types.d.ts.map +1 -1
- package/dist/query-keys.d.ts +13 -0
- package/dist/query-keys.d.ts.map +1 -1
- package/dist/query-keys.js +13 -0
- package/dist/query-keys.js.map +1 -1
- package/dist/state-binding/AdapterMapping.d.ts +33 -0
- package/dist/state-binding/AdapterMapping.d.ts.map +1 -0
- package/dist/state-binding/AdapterMapping.js +205 -0
- package/dist/state-binding/AdapterMapping.js.map +1 -0
- package/dist/state-binding/BindingJqField.d.ts +43 -0
- package/dist/state-binding/BindingJqField.d.ts.map +1 -0
- package/dist/state-binding/BindingJqField.js +57 -0
- package/dist/state-binding/BindingJqField.js.map +1 -0
- package/dist/state-binding/BindingTemplatedJqField.d.ts +24 -0
- package/dist/state-binding/BindingTemplatedJqField.d.ts.map +1 -0
- package/dist/state-binding/BindingTemplatedJqField.js +7 -0
- package/dist/state-binding/BindingTemplatedJqField.js.map +1 -0
- package/dist/state-binding/InputInjectionRow.d.ts +18 -0
- package/dist/state-binding/InputInjectionRow.d.ts.map +1 -0
- package/dist/state-binding/InputInjectionRow.js +55 -0
- package/dist/state-binding/InputInjectionRow.js.map +1 -0
- package/dist/state-binding/StateAttachRow.d.ts +27 -0
- package/dist/state-binding/StateAttachRow.d.ts.map +1 -0
- package/dist/state-binding/StateAttachRow.js +102 -0
- package/dist/state-binding/StateAttachRow.js.map +1 -0
- package/dist/state-binding/StateBindingEditor.d.ts +37 -0
- package/dist/state-binding/StateBindingEditor.d.ts.map +1 -0
- package/dist/state-binding/StateBindingEditor.js +54 -0
- package/dist/state-binding/StateBindingEditor.js.map +1 -0
- package/dist/state-binding/StateBindingSection.d.ts +14 -0
- package/dist/state-binding/StateBindingSection.d.ts.map +1 -0
- package/dist/state-binding/StateBindingSection.js +17 -0
- package/dist/state-binding/StateBindingSection.js.map +1 -0
- package/dist/state-binding/SubjectScopeFields.d.ts +20 -0
- package/dist/state-binding/SubjectScopeFields.d.ts.map +1 -0
- package/dist/state-binding/SubjectScopeFields.js +8 -0
- package/dist/state-binding/SubjectScopeFields.js.map +1 -0
- package/dist/state-binding/UpdateRow.d.ts +20 -0
- package/dist/state-binding/UpdateRow.d.ts.map +1 -0
- package/dist/state-binding/UpdateRow.js +89 -0
- package/dist/state-binding/UpdateRow.js.map +1 -0
- package/dist/state-binding/adapter.d.ts +93 -0
- package/dist/state-binding/adapter.d.ts.map +1 -0
- package/dist/state-binding/adapter.js +251 -0
- package/dist/state-binding/adapter.js.map +1 -0
- package/dist/state-binding/build-catalog.d.ts +19 -0
- package/dist/state-binding/build-catalog.d.ts.map +1 -0
- package/dist/state-binding/build-catalog.js +43 -0
- package/dist/state-binding/build-catalog.js.map +1 -0
- package/dist/state-binding/catalog.d.ts +26 -0
- package/dist/state-binding/catalog.d.ts.map +1 -0
- package/dist/state-binding/catalog.js +71 -0
- package/dist/state-binding/catalog.js.map +1 -0
- package/dist/state-binding/index.d.ts +33 -0
- package/dist/state-binding/index.d.ts.map +1 -0
- package/dist/state-binding/index.js +20 -0
- package/dist/state-binding/index.js.map +1 -0
- package/dist/state-binding/templated-text-catalog.d.ts +21 -0
- package/dist/state-binding/templated-text-catalog.d.ts.map +1 -0
- package/dist/state-binding/templated-text-catalog.js +48 -0
- package/dist/state-binding/templated-text-catalog.js.map +1 -0
- package/dist/state-binding/types.d.ts +78 -0
- package/dist/state-binding/types.d.ts.map +1 -0
- package/dist/state-binding/types.js +2 -0
- package/dist/state-binding/types.js.map +1 -0
- package/package.json +5 -5
- package/src/components/components.css +19 -0
- package/src/components/icons.tsx +8 -0
- package/src/components/templated-text-field.tsx +508 -0
- package/src/index.ts +76 -1
- package/src/navigation/types.ts +4 -1
- package/src/query-keys.ts +15 -0
- package/src/state-binding/AdapterMapping.tsx +468 -0
- package/src/state-binding/BindingJqField.tsx +146 -0
- package/src/state-binding/BindingTemplatedJqField.tsx +73 -0
- package/src/state-binding/InputInjectionRow.tsx +157 -0
- package/src/state-binding/README.md +46 -0
- package/src/state-binding/StateAttachRow.tsx +289 -0
- package/src/state-binding/StateBindingEditor.tsx +166 -0
- package/src/state-binding/StateBindingSection.tsx +37 -0
- package/src/state-binding/SubjectScopeFields.tsx +57 -0
- package/src/state-binding/UpdateRow.tsx +227 -0
- package/src/state-binding/adapter.ts +276 -0
- package/src/state-binding/build-catalog.ts +59 -0
- package/src/state-binding/catalog.ts +87 -0
- package/src/state-binding/index.ts +67 -0
- package/src/state-binding/templated-text-catalog.ts +69 -0
- package/src/state-binding/types.ts +91 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The jq input every field a binding owns renders through — the Subject/Scope
|
|
4
|
+
* expressions, a custom injection or update jq, an adapter escape hatch, an op-id.
|
|
5
|
+
*
|
|
6
|
+
* It reuses the form door pattern: when a host has injected an expression editor
|
|
7
|
+
* through {@link ExpressionFieldContext} (the visual jq editor from
|
|
8
|
+
* `@tai42/jq-studio`), that door renders here; with no door it falls back to a
|
|
9
|
+
* plain multiline textarea, so this package keeps NO edge to the jq subgraph.
|
|
10
|
+
*
|
|
11
|
+
* The attached templates' template jq are offered as an autocomplete source: an
|
|
12
|
+
* `Insert` control per jq name appends the call `tjq_<name>({…})` to the
|
|
13
|
+
* expression — the attachment-qualified `tjq_<attachment>__<name>` form when a name is
|
|
14
|
+
* ambiguous across attachments.
|
|
15
|
+
*/
|
|
16
|
+
import { useContext } from 'react';
|
|
17
|
+
import { Button } from '../components/primitives';
|
|
18
|
+
import { PlusIcon } from '../components/icons';
|
|
19
|
+
import { Field } from '../components/field';
|
|
20
|
+
import { Textarea } from '../components/inputs';
|
|
21
|
+
import { ExpressionFieldContext } from '../schema-form/context';
|
|
22
|
+
import { generateTemplateCall } from './adapter';
|
|
23
|
+
/** Append a `tjq_<name>({…})` template call to the current expression (space-separated when non-empty). */
|
|
24
|
+
export function appendTjq(current, ref) {
|
|
25
|
+
const call = generateTemplateCall(ref, []);
|
|
26
|
+
const trimmed = current.trim();
|
|
27
|
+
return trimmed === '' ? call : `${trimmed} ${call}`;
|
|
28
|
+
}
|
|
29
|
+
export function BindingJqField({ label, value, onChange, description, error, placeholder, suggestions = [], hideLabel = false, }) {
|
|
30
|
+
const Door = useContext(ExpressionFieldContext);
|
|
31
|
+
// A stable hook for e2e: the injected jq editor owns its own DOM, so the wrapper
|
|
32
|
+
// carries the field's identity (`binding-jq-<label>`) for the driver to locate.
|
|
33
|
+
const testId = `binding-jq-${label.trim().replace(/\s+/g, '-').toLowerCase()}`;
|
|
34
|
+
// Only `input`-purpose jq are callable from an expression; an `update` jq returns an
|
|
35
|
+
// op batch and is picked solely by an update's own select — never offered as an insert.
|
|
36
|
+
const inputSuggestions = suggestions.filter((suggestion) => suggestion.purpose === 'input');
|
|
37
|
+
return (_jsxs("div", { "data-testid": testId,
|
|
38
|
+
// The label-hide is scoped to a direct-child jq editor: the injected door is a
|
|
39
|
+
// direct child here, so a group header above it becomes the single visible label.
|
|
40
|
+
className: hideLabel ? 'tai-templated-inline--grouped' : undefined, style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-1)' }, children: [Door !== undefined ? (_jsx(Door, { label: label, value: value, onChange: onChange, description: description, error: error, multiline: true })) : (_jsx(Field, { label: label, hideLabel: hideLabel, description: typeof description === 'string' ? description : undefined, error: error, children: _jsx(Textarea, { value: value, placeholder: placeholder, onChange: (event) => {
|
|
41
|
+
onChange(event.target.value);
|
|
42
|
+
}, "aria-invalid": error !== undefined ? true : undefined }) })), inputSuggestions.length > 0 ? (_jsx("div", { role: "group", "aria-label": `Insert template jq into ${label}`, style: { display: 'flex', flexWrap: 'wrap', gap: 'var(--tai-space-1)' }, children: inputSuggestions.map((suggestion) => (_jsxs(Button, { type: "button", variant: "secondary",
|
|
43
|
+
// A compact outlined pill: the leading plus reads it as an insert
|
|
44
|
+
// affordance so the monospace call text is a control, not stray code.
|
|
45
|
+
style: {
|
|
46
|
+
minHeight: 'auto',
|
|
47
|
+
padding: 'var(--tai-space-1) var(--tai-space-2)',
|
|
48
|
+
borderRadius: 'var(--tai-radius-full)',
|
|
49
|
+
fontFamily: 'var(--tai-font-mono)',
|
|
50
|
+
fontSize: 'var(--tai-text-sm)',
|
|
51
|
+
}, title: suggestion.description !== undefined && suggestion.description !== ''
|
|
52
|
+
? `${suggestion.purpose} — ${suggestion.description}`
|
|
53
|
+
: suggestion.purpose, onClick: () => {
|
|
54
|
+
onChange(appendTjq(value, suggestion.ref));
|
|
55
|
+
}, children: [_jsx(PlusIcon, {}), generateTemplateCall(suggestion.ref, [])] }, suggestion.ref))) })) : null] }));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=BindingJqField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BindingJqField.js","sourceRoot":"","sources":["../../src/state-binding/BindingJqField.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/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BAAoB;qBAC/B,EACD,KAAK,EACH,UAAU,CAAC,WAAW,KAAK,SAAS,IAAI,UAAU,CAAC,WAAW,KAAK,EAAE;wBACnE,CAAC,CAAC,GAAG,UAAU,CAAC,OAAO,MAAM,UAAU,CAAC,WAAW,EAAE;wBACrD,CAAC,CAAC,UAAU,CAAC,OAAO,EAExB,OAAO,EAAE,GAAG,EAAE;wBACZ,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC7C,CAAC,aAED,KAAC,QAAQ,KAAG,EACX,oBAAoB,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,KAtBpC,UAAU,CAAC,GAAG,CAuBZ,CACV,CAAC,GACE,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One state-binding jq slot authored as a {@link TemplatedText}: a
|
|
3
|
+
* `TemplatedTextField` whose INLINE editor is the jq field (the host's visual jq
|
|
4
|
+
* door, else a textarea) carrying the attached templates' template-jq inserts, and
|
|
5
|
+
* whose STORED mode picks a stored template that renders to the jq at run time.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import { type TemplateJqSuggestion } from './BindingJqField';
|
|
9
|
+
import type { TemplatedText, TemplatedTextCatalog } from './types';
|
|
10
|
+
export interface BindingTemplatedJqFieldProps {
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly value: TemplatedText | null;
|
|
13
|
+
readonly onChange: (value: TemplatedText | null) => void;
|
|
14
|
+
readonly description?: string;
|
|
15
|
+
readonly error?: string;
|
|
16
|
+
/** The subject/adapter slots require a source; the rest are optional (`null` clears). */
|
|
17
|
+
readonly required?: boolean;
|
|
18
|
+
readonly placeholder?: string;
|
|
19
|
+
readonly suggestions?: readonly TemplateJqSuggestion[];
|
|
20
|
+
readonly templates?: TemplatedTextCatalog;
|
|
21
|
+
readonly disabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function BindingTemplatedJqField({ label, value, onChange, description, error, required, placeholder, suggestions, templates, disabled, }: BindingTemplatedJqFieldProps): ReactNode;
|
|
24
|
+
//# sourceMappingURL=BindingTemplatedJqField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BindingTemplatedJqField.d.ts","sourceRoot":"","sources":["../../src/state-binding/BindingTemplatedJqField.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,yFAAyF;IACzF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,KAAK,EACL,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,GACT,EAAE,4BAA4B,GAAG,SAAS,CAmC1C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TemplatedTextField } from '../components/templated-text-field';
|
|
3
|
+
import { BindingJqField } from './BindingJqField';
|
|
4
|
+
export function BindingTemplatedJqField({ label, value, onChange, description, error, required, placeholder, suggestions, templates, disabled, }) {
|
|
5
|
+
return (_jsx(TemplatedTextField, { label: label, value: value, onChange: onChange, description: description, error: error, required: required, disabled: disabled, templates: templates?.templates, templatesLoading: templates?.loading, templatesError: templates?.error, onTemplatesRetry: templates?.onRetry, storageAbsent: templates?.storageAbsent, storagePresenceLoading: templates?.storagePresenceLoading, renderInline: ({ label: inlineLabel, value: inlineValue, onChange: onInlineChange, error: inlineError, hideLabel: inlineHideLabel, }) => (_jsx(BindingJqField, { label: inlineLabel, value: inlineValue, onChange: onInlineChange, error: inlineError, placeholder: placeholder, suggestions: suggestions, hideLabel: inlineHideLabel })) }));
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=BindingTemplatedJqField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BindingTemplatedJqField.js","sourceRoot":"","sources":["../../src/state-binding/BindingTemplatedJqField.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,cAAc,EAA6B,MAAM,kBAAkB,CAAC;AAiB7E,MAAM,UAAU,uBAAuB,CAAC,EACtC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,KAAK,EACL,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,EACT,QAAQ,GACqB;IAC7B,OAAO,CACL,KAAC,kBAAkB,IACjB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EAAE,SAAS,EAC/B,gBAAgB,EAAE,SAAS,EAAE,OAAO,EACpC,cAAc,EAAE,SAAS,EAAE,KAAK,EAChC,gBAAgB,EAAE,SAAS,EAAE,OAAO,EACpC,aAAa,EAAE,SAAS,EAAE,aAAa,EACvC,sBAAsB,EAAE,SAAS,EAAE,sBAAsB,EACzD,YAAY,EAAE,CAAC,EACb,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,eAAe,GAC3B,EAAE,EAAE,CAAC,CACJ,KAAC,cAAc,IACb,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,WAAW,EAClB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,eAAe,GAC1B,CACH,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The input-injection list of one attached state. Each row injects a value into the
|
|
3
|
+
* run input BEFORE the run: either a template `input` jq (picked by name) or a
|
|
4
|
+
* custom jq over the record, placed under the `into` run-input field.
|
|
5
|
+
*/
|
|
6
|
+
import type { ReactNode } from 'react';
|
|
7
|
+
import type { TemplateJqSuggestion } from './BindingJqField';
|
|
8
|
+
import type { ResolvedTemplateJq } from './catalog';
|
|
9
|
+
import type { StateInjection, TemplatedTextCatalog } from './types';
|
|
10
|
+
export interface InjectionListProps {
|
|
11
|
+
readonly injections: readonly StateInjection[];
|
|
12
|
+
readonly onChange: (injections: readonly StateInjection[]) => void;
|
|
13
|
+
readonly inputJq: readonly ResolvedTemplateJq[];
|
|
14
|
+
readonly suggestions?: readonly TemplateJqSuggestion[];
|
|
15
|
+
readonly templates?: TemplatedTextCatalog;
|
|
16
|
+
}
|
|
17
|
+
export declare function InjectionList({ injections, onChange, inputJq, suggestions, templates, }: InjectionListProps): ReactNode;
|
|
18
|
+
//# sourceMappingURL=InputInjectionRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputInjectionRow.d.ts","sourceRoot":"","sources":["../../src/state-binding/InputInjectionRow.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA2FpE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,CAAC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,SAAS,cAAc,EAAE,KAAK,IAAI,CAAC;IACnE,QAAQ,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAChD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC3C;AAED,wBAAgB,aAAa,CAAC,EAC5B,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAS,GACV,EAAE,kBAAkB,GAAG,SAAS,CAoChC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from '../components/primitives';
|
|
3
|
+
import { Field } from '../components/field';
|
|
4
|
+
import { Select } from '../components/select';
|
|
5
|
+
import { TextInput } from '../components/inputs';
|
|
6
|
+
import { CloseIcon } from '../components/icons';
|
|
7
|
+
import { BindingTemplatedJqField } from './BindingTemplatedJqField';
|
|
8
|
+
function optionLabel(entry) {
|
|
9
|
+
return entry.description !== undefined && entry.description !== ''
|
|
10
|
+
? `${entry.ref} — ${entry.description}`
|
|
11
|
+
: entry.ref;
|
|
12
|
+
}
|
|
13
|
+
const CUSTOM = '__custom__';
|
|
14
|
+
function InjectionRow({ injection, index, inputJq, suggestions, templates, onChange, onRemove, }) {
|
|
15
|
+
const isCustom = injection.jq !== null;
|
|
16
|
+
const selectValue = isCustom ? CUSTOM : (injection.template_jq ?? '');
|
|
17
|
+
return (_jsxs("div", { "data-testid": `injection-row-${String(index)}`, style: {
|
|
18
|
+
display: 'flex',
|
|
19
|
+
gap: 'var(--tai-space-2)',
|
|
20
|
+
alignItems: 'flex-start',
|
|
21
|
+
flexWrap: 'wrap',
|
|
22
|
+
}, children: [_jsx(Field, { label: `Injection source ${String(index + 1)}`, hideLabel: true, children: _jsx(Select, { placeholder: "Choose a template jq", value: selectValue, onValueChange: (next) => {
|
|
23
|
+
if (next === CUSTOM)
|
|
24
|
+
onChange({ template_jq: null, jq: { content: '' }, into: injection.into });
|
|
25
|
+
else
|
|
26
|
+
onChange({ template_jq: next, jq: null, into: injection.into });
|
|
27
|
+
}, groups: [
|
|
28
|
+
{
|
|
29
|
+
label: 'Template jq',
|
|
30
|
+
options: inputJq.map((entry) => ({ value: entry.ref, label: optionLabel(entry) })),
|
|
31
|
+
},
|
|
32
|
+
{ label: 'Custom', options: [{ value: CUSTOM, label: 'Custom jq' }] },
|
|
33
|
+
] }) }), isCustom ? (_jsx(BindingTemplatedJqField, { label: `Custom injection jq ${String(index + 1)}`, required: true, value: injection.jq, onChange: (next) => {
|
|
34
|
+
onChange({ template_jq: null, jq: next ?? { content: '' }, into: injection.into });
|
|
35
|
+
}, suggestions: suggestions, templates: templates })) : null, _jsx(Field, { label: `Into field ${String(index + 1)}`, hideLabel: true, children: _jsx(TextInput, { placeholder: "Input field", value: injection.into, onChange: (event) => {
|
|
36
|
+
onChange({ ...injection, into: event.target.value });
|
|
37
|
+
} }) }), _jsx(Button, { type: "button", variant: "ghost", "aria-label": `Remove input ${String(index + 1)}`, onClick: onRemove, children: _jsx(CloseIcon, { "aria-hidden": "true" }) })] }));
|
|
38
|
+
}
|
|
39
|
+
export function InjectionList({ injections, onChange, inputJq, suggestions, templates, }) {
|
|
40
|
+
const add = () => {
|
|
41
|
+
const first = inputJq[0];
|
|
42
|
+
const next = first !== undefined
|
|
43
|
+
? { template_jq: first.ref, jq: null, into: '' }
|
|
44
|
+
: { template_jq: null, jq: { content: '' }, into: '' };
|
|
45
|
+
onChange([...injections, next]);
|
|
46
|
+
};
|
|
47
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-2)' }, children: [injections.map((injection, index) => (_jsx(InjectionRow
|
|
48
|
+
// Rows are positional; the index is their stable identity within a save.
|
|
49
|
+
, { injection: injection, index: index, inputJq: inputJq, suggestions: suggestions, templates: templates, onChange: (next) => {
|
|
50
|
+
onChange(injections.map((current, position) => (position === index ? next : current)));
|
|
51
|
+
}, onRemove: () => {
|
|
52
|
+
onChange(injections.filter((_, position) => position !== index));
|
|
53
|
+
} }, index))), _jsx("div", { children: _jsx(Button, { type: "button", variant: "ghost", onClick: add, children: "Add input" }) })] }));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=InputInjectionRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputInjectionRow.js","sourceRoot":"","sources":["../../src/state-binding/InputInjectionRow.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,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Q,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;gBACzF,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE;oBACb,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC;gBACnE,CAAC,IAXI,KAAK,CAYV,CACH,CAAC,EACF,wBACE,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,0BAEzC,GACL,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One attached state of a binding: the state selector, the templates it attaches
|
|
3
|
+
* (attach-on-use — a not-yet-attached pick shows the "attached on save" hint), the subject
|
|
4
|
+
* and scope expressions, the input injections, and the updates.
|
|
5
|
+
*/
|
|
6
|
+
import { type ReactNode } from 'react';
|
|
7
|
+
import type { BindingSourceSchemas, BindingStateOption, BindingTemplateOption, StateAttach, TemplatedText, TemplatedTextCatalog } from './types';
|
|
8
|
+
/** The subject/scope of the target's own (inherited) binding for a state this one also names. */
|
|
9
|
+
export interface InheritedSubject {
|
|
10
|
+
readonly subject_expr: TemplatedText;
|
|
11
|
+
readonly scope_expr: TemplatedText | null;
|
|
12
|
+
}
|
|
13
|
+
export interface StateAttachRowProps {
|
|
14
|
+
readonly attach: StateAttach;
|
|
15
|
+
readonly onChange: (attach: StateAttach) => void;
|
|
16
|
+
readonly onRemove: () => void;
|
|
17
|
+
readonly statesCatalog: readonly BindingStateOption[];
|
|
18
|
+
readonly templatesCatalog: readonly BindingTemplateOption[];
|
|
19
|
+
readonly sources?: BindingSourceSchemas;
|
|
20
|
+
readonly subjectError?: string;
|
|
21
|
+
/** The target's own binding subject for this state, when it also binds it (precedence). */
|
|
22
|
+
readonly inherited?: InheritedSubject;
|
|
23
|
+
/** The stored templates a templated-text field's id picker offers. */
|
|
24
|
+
readonly templates?: TemplatedTextCatalog;
|
|
25
|
+
}
|
|
26
|
+
export declare function StateAttachRow({ attach, onChange, onRemove, statesCatalog, templatesCatalog, sources, subjectError, inherited, templates, }: StateAttachRowProps): ReactNode;
|
|
27
|
+
//# sourceMappingURL=StateAttachRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateAttachRow.d.ts","sourceRoot":"","sources":["../../src/state-binding/StateAttachRow.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAchD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAIjB,iGAAiG;AACjG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,CAAC;CAC3C;AAoBD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC5D,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,2FAA2F;IAC3F,QAAQ,CAAC,SAAS,CAAC,EAAE,gBAAgB,CAAC;IACtC,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC3C;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,YAAY,EACZ,SAAS,EACT,SAAS,GACV,EAAE,mBAAmB,GAAG,SAAS,CAkNjC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* One attached state of a binding: the state selector, the templates it attaches
|
|
4
|
+
* (attach-on-use — a not-yet-attached pick shows the "attached on save" hint), the subject
|
|
5
|
+
* and scope expressions, the input injections, and the updates.
|
|
6
|
+
*/
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { Button } from '../components/primitives';
|
|
9
|
+
import { CodeBlock } from '../components/code-block';
|
|
10
|
+
import { Checkbox } from '../components/checkbox';
|
|
11
|
+
import { Field } from '../components/field';
|
|
12
|
+
import { Select } from '../components/select';
|
|
13
|
+
import { templatedTextSummary } from '../components/templated-text-field';
|
|
14
|
+
import { AlertTriangleIcon, CloseIcon } from '../components/icons';
|
|
15
|
+
import { InjectionList } from './InputInjectionRow';
|
|
16
|
+
import { UpdateList } from './UpdateRow';
|
|
17
|
+
import { SubjectScopeFields } from './SubjectScopeFields';
|
|
18
|
+
import { resolveTemplateJq } from './catalog';
|
|
19
|
+
const ATTACH_ON_USE_HINT = 'This template will be attached to the state when you save.';
|
|
20
|
+
/** The stored binding's raw jq, for the unresolved-catalog read-only fallback. */
|
|
21
|
+
function rawBindingLines(attach) {
|
|
22
|
+
const lines = [`subject: ${templatedTextSummary(attach.subject_expr)}`];
|
|
23
|
+
if (attach.scope_expr !== null)
|
|
24
|
+
lines.push(`scope: ${templatedTextSummary(attach.scope_expr)}`);
|
|
25
|
+
for (const injection of attach.input_injections) {
|
|
26
|
+
lines.push(`input ${injection.into || '(unset)'} <- ${injection.template_jq ?? templatedTextSummary(injection.jq)}`);
|
|
27
|
+
}
|
|
28
|
+
for (const update of attach.updates) {
|
|
29
|
+
const ref = update.template_jq ?? templatedTextSummary(update.jq);
|
|
30
|
+
lines.push(`update ${ref}${update.adapter !== null ? ` adapter ${templatedTextSummary(update.adapter)}` : ''}`);
|
|
31
|
+
}
|
|
32
|
+
return lines.join('\n');
|
|
33
|
+
}
|
|
34
|
+
export function StateAttachRow({ attach, onChange, onRemove, statesCatalog, templatesCatalog, sources, subjectError, inherited, templates, }) {
|
|
35
|
+
const stateOption = statesCatalog.find((option) => option.name === attach.state);
|
|
36
|
+
const attachedTemplates = stateOption?.attachedTemplates ?? [];
|
|
37
|
+
// A bound state or template absent on the server cannot resolve its pickers: show
|
|
38
|
+
// the raw jq read-only rather than a blank form.
|
|
39
|
+
const stateMissing = attach.state !== '' && stateOption === undefined;
|
|
40
|
+
const missingTemplates = attach.templates.filter((name) => !templatesCatalog.some((template) => template.name === name));
|
|
41
|
+
const unresolved = stateMissing || missingTemplates.length > 0;
|
|
42
|
+
const inputJq = useMemo(() => resolveTemplateJq(attach.templates, templatesCatalog, 'input'), [attach.templates, templatesCatalog]);
|
|
43
|
+
const updateJq = useMemo(() => resolveTemplateJq(attach.templates, templatesCatalog, 'update'), [attach.templates, templatesCatalog]);
|
|
44
|
+
// An `update` jq returns an op batch and is never callable from an expression (it is
|
|
45
|
+
// picked only by an update's own select), so the `tjq_…` insert suggestions offered to
|
|
46
|
+
// EVERY jq field are the attached templates' `input`-purpose jq only.
|
|
47
|
+
const suggestions = useMemo(() => inputJq.map((entry) => ({
|
|
48
|
+
ref: entry.ref,
|
|
49
|
+
purpose: entry.purpose,
|
|
50
|
+
description: entry.description,
|
|
51
|
+
})), [inputJq]);
|
|
52
|
+
const toggleTemplate = (name, checked) => {
|
|
53
|
+
const next = checked
|
|
54
|
+
? [...attach.templates, name]
|
|
55
|
+
: attach.templates.filter((template) => template !== name);
|
|
56
|
+
onChange({ ...attach, templates: next });
|
|
57
|
+
};
|
|
58
|
+
return (_jsxs("div", { "data-testid": `state-attach-${attach.state}`, style: {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexDirection: 'column',
|
|
61
|
+
gap: 'var(--tai-space-3)',
|
|
62
|
+
padding: 'var(--tai-space-3)',
|
|
63
|
+
border: '1px solid var(--tai-color-border)',
|
|
64
|
+
borderRadius: 'var(--tai-radius-md)',
|
|
65
|
+
}, children: [_jsxs("div", { style: {
|
|
66
|
+
display: 'flex',
|
|
67
|
+
gap: 'var(--tai-space-2)',
|
|
68
|
+
alignItems: 'flex-end',
|
|
69
|
+
flexWrap: 'wrap',
|
|
70
|
+
}, children: [_jsx(Field, { label: "State", children: _jsx(Select, { "aria-label": "State", placeholder: "Choose a state", value: attach.state, onValueChange: (next) => {
|
|
71
|
+
// A new state resets the template picks (its attachments differ).
|
|
72
|
+
onChange({ ...attach, state: next, templates: [] });
|
|
73
|
+
}, options: statesCatalog.map((option) => ({ value: option.name, label: option.name })) }) }), _jsx(Button, { type: "button", variant: "ghost", "aria-label": `Remove state ${attach.state === '' ? '(unset)' : attach.state}`, onClick: onRemove, children: _jsx(CloseIcon, { "aria-hidden": "true" }) })] }), inherited !== undefined && attach.state !== '' ? (_jsxs("div", { role: "status", style: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
gap: 'var(--tai-space-2)',
|
|
76
|
+
alignItems: 'flex-start',
|
|
77
|
+
padding: 'var(--tai-space-2)',
|
|
78
|
+
borderRadius: 'var(--tai-radius-md)',
|
|
79
|
+
background: 'var(--tai-color-warn-tint)',
|
|
80
|
+
color: 'var(--tai-color-warn-text)',
|
|
81
|
+
}, children: [_jsx(AlertTriangleIcon, { "aria-hidden": "true" }), _jsxs("div", { children: [_jsx("strong", { children: "Overrides the preset\u2019s subject" }), _jsxs("div", { style: { display: 'flex', gap: 'var(--tai-space-2)', flexWrap: 'wrap' }, children: [_jsx("span", { style: { color: 'var(--tai-color-text-muted)', fontSize: 'var(--tai-text-sm)' }, children: "Preset default:" }), _jsxs("span", { style: { fontFamily: 'var(--tai-font-mono)', fontSize: 'var(--tai-text-sm)' }, children: [`subject: ${templatedTextSummary(inherited.subject_expr)}`, inherited.scope_expr !== null
|
|
82
|
+
? `, scope: ${templatedTextSummary(inherited.scope_expr)}`
|
|
83
|
+
: ''] })] })] })] })) : null, attach.state !== '' && unresolved ? (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-2)' }, children: [_jsx("p", { role: "alert", style: { margin: 0, color: 'var(--tai-color-err-text)' }, children: "Template not attached." }), _jsx(CodeBlock, { code: rawBindingLines(attach), language: "text" })] })) : null, attach.state !== '' && !unresolved ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: "Templates", group: true, description: "One or more templates this binding attaches to the state.", children: _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-1)' }, children: templatesCatalog.length === 0 ? (_jsx("p", { style: { margin: 0, color: 'var(--tai-color-text-muted)' }, children: "No templates available." })) : (templatesCatalog.map((template) => {
|
|
84
|
+
const checked = attach.templates.includes(template.name);
|
|
85
|
+
const willAttach = checked && !attachedTemplates.includes(template.name);
|
|
86
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '2px' }, children: [_jsx(Checkbox, { checked: checked, label: template.name, onCheckedChange: (next) => {
|
|
87
|
+
toggleTemplate(template.name, next);
|
|
88
|
+
} }), willAttach ? (_jsx("span", { style: {
|
|
89
|
+
color: 'var(--tai-color-text-muted)',
|
|
90
|
+
fontSize: 'var(--tai-text-sm)',
|
|
91
|
+
}, children: ATTACH_ON_USE_HINT })) : null] }, template.name));
|
|
92
|
+
})) }) }), _jsx(SubjectScopeFields, { subjectExpr: attach.subject_expr, scopeExpr: attach.scope_expr, subjectError: subjectError, suggestions: suggestions, templates: templates, onSubjectChange: (next) => {
|
|
93
|
+
onChange({ ...attach, subject_expr: next });
|
|
94
|
+
}, onScopeChange: (next) => {
|
|
95
|
+
onChange({ ...attach, scope_expr: next });
|
|
96
|
+
} }), _jsx(Field, { label: "Inputs", group: true, children: _jsx(InjectionList, { injections: attach.input_injections, inputJq: inputJq, suggestions: suggestions, templates: templates, onChange: (next) => {
|
|
97
|
+
onChange({ ...attach, input_injections: [...next] });
|
|
98
|
+
} }) }), _jsx(Field, { label: "Updates", group: true, children: _jsx(UpdateList, { updates: attach.updates, updateJq: updateJq, sources: sources, suggestions: suggestions, templates: templates, onChange: (next) => {
|
|
99
|
+
onChange({ ...attach, updates: [...next] });
|
|
100
|
+
} }) })] })) : null] }));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=StateAttachRow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateAttachRow.js","sourceRoot":"","sources":["../../src/state-binding/StateAttachRow.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAU9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AAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;gCACjB,QAAQ,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;4BAC9C,CAAC,GACD,GACI,IACP,CACJ,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional state-binding editor — one shape on every door (a preset, a channel
|
|
3
|
+
* route, a schedule, a hook) and, in the flow engine, per node. It attaches one or
|
|
4
|
+
* more states, each with the templates it attaches on save, a subject/scope, input
|
|
5
|
+
* injections evaluated before the run, and updates applied after it.
|
|
6
|
+
*
|
|
7
|
+
* It lives in the Studio SDK so every plugin door reuses it; it holds NO edge to jq
|
|
8
|
+
* (the jq fields render through the host's ambient expression door, else a plain
|
|
9
|
+
* textarea) and paints from SDK tokens only.
|
|
10
|
+
*/
|
|
11
|
+
import type { ReactNode } from 'react';
|
|
12
|
+
import type { BindingSourceSchemas, BindingStateOption, BindingTemplateOption, StateBinding, TemplatedTextCatalog } from './types';
|
|
13
|
+
export interface StateBindingEditorProps {
|
|
14
|
+
/** The binding, or `null` when the door binds no state. */
|
|
15
|
+
readonly value: StateBinding | null;
|
|
16
|
+
readonly onChange: (value: StateBinding | null) => void;
|
|
17
|
+
/** The states this door may bind, each with its attached templates and fields. */
|
|
18
|
+
readonly statesCatalog: readonly BindingStateOption[];
|
|
19
|
+
/** The templates the editor may attach (attach-on-use), each with its template jq. */
|
|
20
|
+
readonly templatesCatalog: readonly BindingTemplateOption[];
|
|
21
|
+
/** The run's output/input field paths a picker offers when a schema is known. */
|
|
22
|
+
readonly sources?: BindingSourceSchemas;
|
|
23
|
+
/**
|
|
24
|
+
* The TARGET's own binding (e.g. the preset a route dispatches), passed by the door
|
|
25
|
+
* screen — never fetched here. A state this binding names that the inherited one
|
|
26
|
+
* also names shows a precedence warning on its card.
|
|
27
|
+
*/
|
|
28
|
+
readonly inherited?: StateBinding | null;
|
|
29
|
+
/** The catalog fetch is in flight. */
|
|
30
|
+
readonly loading?: boolean;
|
|
31
|
+
/** The catalog fetch failed. */
|
|
32
|
+
readonly error?: string;
|
|
33
|
+
/** The stored templates a templated-text field's id picker offers, resolved by the door. */
|
|
34
|
+
readonly templatedTextTemplates?: TemplatedTextCatalog;
|
|
35
|
+
}
|
|
36
|
+
export declare function StateBindingEditor({ value, onChange, statesCatalog, templatesCatalog, sources, inherited, loading, error, templatedTextTemplates, }: StateBindingEditorProps): ReactNode;
|
|
37
|
+
//# sourceMappingURL=StateBindingEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateBindingEditor.d.ts","sourceRoot":"","sources":["../../src/state-binding/StateBindingEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EAErB,YAAY,EACZ,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,KAAK,IAAI,CAAC;IACxD,kFAAkF;IAClF,QAAQ,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACtD,sFAAsF;IACtF,QAAQ,CAAC,gBAAgB,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC5D,iFAAiF;IACjF,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IACzC,sCAAsC;IACtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,4FAA4F;IAC5F,QAAQ,CAAC,sBAAsB,CAAC,EAAE,oBAAoB,CAAC;CACxD;AAaD,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,OAAO,EACP,SAAS,EACT,OAAe,EACf,KAAK,EACL,sBAAsB,GACvB,EAAE,uBAAuB,GAAG,SAAS,CAiGrC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Button, EmptyState, ErrorState, Skeleton } from '../components/primitives';
|
|
3
|
+
import { StateAttachRow } from './StateAttachRow';
|
|
4
|
+
function blankAttach() {
|
|
5
|
+
return {
|
|
6
|
+
state: '',
|
|
7
|
+
templates: [],
|
|
8
|
+
subject_expr: { content: '' },
|
|
9
|
+
scope_expr: null,
|
|
10
|
+
input_injections: [],
|
|
11
|
+
updates: [],
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function StateBindingEditor({ value, onChange, statesCatalog, templatesCatalog, sources, inherited, loading = false, error, templatedTextTemplates, }) {
|
|
15
|
+
if (loading) {
|
|
16
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-2)' }, children: [_jsx(Skeleton, { height: 32 }), _jsx(Skeleton, { height: 32 })] }));
|
|
17
|
+
}
|
|
18
|
+
if (error !== undefined) {
|
|
19
|
+
return _jsx(ErrorState, { message: "Couldn't load states and templates." });
|
|
20
|
+
}
|
|
21
|
+
const states = value?.states ?? [];
|
|
22
|
+
const setStates = (next) => {
|
|
23
|
+
onChange(next.length === 0 ? null : { states: [...next] });
|
|
24
|
+
};
|
|
25
|
+
return (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-3)' }, children: states.length === 0 ? (_jsx(EmptyState, { title: "No state bound", description: "Attach a state to inject a value into the run and update the record after it.", action: _jsx(Button, { type: "button", variant: "primary", onClick: () => {
|
|
26
|
+
setStates([blankAttach()]);
|
|
27
|
+
}, children: "Attach a state" }) })) : (_jsxs(_Fragment, { children: [states.map((attach, index) => {
|
|
28
|
+
const inheritedAttach = attach.state === ''
|
|
29
|
+
? undefined
|
|
30
|
+
: inherited?.states.find((entry) => entry.state === attach.state);
|
|
31
|
+
// The subject is a required authored value; an empty one (no stored id and
|
|
32
|
+
// no inline text) is caught inline once a state is chosen, never sent for
|
|
33
|
+
// the server to 422.
|
|
34
|
+
const subjectEmpty = attach.subject_expr.id !== undefined
|
|
35
|
+
? attach.subject_expr.id.trim() === ''
|
|
36
|
+
: (attach.subject_expr.content ?? '').trim() === '';
|
|
37
|
+
const subjectError = attach.state !== '' && subjectEmpty ? 'Subject is required.' : undefined;
|
|
38
|
+
return (_jsx(StateAttachRow
|
|
39
|
+
// Positional identity within a save; a state name may be blank while picking.
|
|
40
|
+
, { attach: attach, statesCatalog: statesCatalog, templatesCatalog: templatesCatalog, sources: sources, subjectError: subjectError, templates: templatedTextTemplates, inherited: inheritedAttach === undefined
|
|
41
|
+
? undefined
|
|
42
|
+
: {
|
|
43
|
+
subject_expr: inheritedAttach.subject_expr,
|
|
44
|
+
scope_expr: inheritedAttach.scope_expr,
|
|
45
|
+
}, onChange: (next) => {
|
|
46
|
+
setStates(states.map((current, position) => (position === index ? next : current)));
|
|
47
|
+
}, onRemove: () => {
|
|
48
|
+
setStates(states.filter((_, position) => position !== index));
|
|
49
|
+
} }, index));
|
|
50
|
+
}), _jsx("div", { children: _jsx(Button, { type: "button", variant: "ghost", onClick: () => {
|
|
51
|
+
setStates([...states, blankAttach()]);
|
|
52
|
+
}, children: "Attach a state" }) })] })) }));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=StateBindingEditor.js.map
|
|
@@ -0,0 +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;oBAC3E,OAAO,CACL,KAAC,cAAc;oBACb,8EAA8E;wBAE9E,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,sBAAsB,EACjC,SAAS,EACP,eAAe,KAAK,SAAS;4BAC3B,CAAC,CAAC,SAAS;4BACX,CAAC,CAAC;gCACE,YAAY,EAAE,eAAe,CAAC,YAAY;gCAC1C,UAAU,EAAE,eAAe,CAAC,UAAU;6BACvC,EAEP,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;4BACjB,SAAS,CACP,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CACzE,CAAC;wBACJ,CAAC,EACD,QAAQ,EAAE,GAAG,EAAE;4BACb,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC;wBAChE,CAAC,IAtBI,KAAK,CAuBV,CACH,CAAC;gBACJ,CAAC,CAAC,EACF,wBACE,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,GAAG,EAAE;4BACZ,SAAS,CAAC,CAAC,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;wBACxC,CAAC,+BAGM,GACL,IACL,CACJ,GACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The collapsed "Bind state (optional)" section every platform door screen adds
|
|
3
|
+
* below its own fields. It is chrome only — the door fetches the catalogs (via its
|
|
4
|
+
* own api-client + query stack) and passes them in; this wraps `StateBindingEditor`
|
|
5
|
+
* in a keyboard-native disclosure that opens when a binding already exists.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
8
|
+
import { type StateBindingEditorProps } from './StateBindingEditor';
|
|
9
|
+
export interface StateBindingSectionProps extends StateBindingEditorProps {
|
|
10
|
+
/** Copy on the disclosure toggle. */
|
|
11
|
+
readonly label?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function StateBindingSection({ label, ...editor }: StateBindingSectionProps): ReactNode;
|
|
14
|
+
//# sourceMappingURL=StateBindingSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateBindingSection.d.ts","sourceRoot":"","sources":["../../src/state-binding/StateBindingSection.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGjD,OAAO,EAAsB,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAExF,MAAM,WAAW,wBAAyB,SAAQ,uBAAuB;IACvE,qCAAqC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAA+B,EAC/B,GAAG,MAAM,EACV,EAAE,wBAAwB,GAAG,SAAS,CAiBtC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The collapsed "Bind state (optional)" section every platform door screen adds
|
|
4
|
+
* below its own fields. It is chrome only — the door fetches the catalogs (via its
|
|
5
|
+
* own api-client + query stack) and passes them in; this wraps `StateBindingEditor`
|
|
6
|
+
* in a keyboard-native disclosure that opens when a binding already exists.
|
|
7
|
+
*/
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { Button } from '../components/primitives';
|
|
10
|
+
import { StateBindingEditor } from './StateBindingEditor';
|
|
11
|
+
export function StateBindingSection({ label = 'Bind state (optional)', ...editor }) {
|
|
12
|
+
const [open, setOpen] = useState((editor.value?.states.length ?? 0) > 0);
|
|
13
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-2)' }, children: [_jsx(Button, { type: "button", variant: "ghost", "aria-expanded": open, onClick: () => {
|
|
14
|
+
setOpen((current) => !current);
|
|
15
|
+
}, children: label }), open ? _jsx(StateBindingEditor, { ...editor }) : null] }));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=StateBindingSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StateBindingSection.js","sourceRoot":"","sources":["../../src/state-binding/StateBindingSection.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAgC,MAAM,sBAAsB,CAAC;AAOxF,MAAM,UAAU,mBAAmB,CAAC,EAClC,KAAK,GAAG,uBAAuB,EAC/B,GAAG,MAAM,EACgB;IACzB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACzE,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,oBAAoB,EAAE,aACjF,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,mBACA,IAAI,EACnB,OAAO,EAAE,GAAG,EAAE;oBACZ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;gBACjC,CAAC,YAEA,KAAK,GACC,EACR,IAAI,CAAC,CAAC,CAAC,KAAC,kBAAkB,OAAK,MAAM,GAAI,CAAC,CAAC,CAAC,IAAI,IAC7C,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The subject + scope of one attached state: the SUBJECT (required) yields either a
|
|
3
|
+
* bare record-key string or a full subject object; the optional SCOPE is a boolean
|
|
4
|
+
* jq predicate — when it is false the state is skipped for the run. Each is an
|
|
5
|
+
* authored templated-text value (inline jq or a stored template that renders to it).
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import type { TemplateJqSuggestion } from './BindingJqField';
|
|
9
|
+
import type { TemplatedText, TemplatedTextCatalog } from './types';
|
|
10
|
+
export interface SubjectScopeFieldsProps {
|
|
11
|
+
readonly subjectExpr: TemplatedText;
|
|
12
|
+
readonly scopeExpr: TemplatedText | null;
|
|
13
|
+
readonly onSubjectChange: (value: TemplatedText) => void;
|
|
14
|
+
readonly onScopeChange: (value: TemplatedText | null) => void;
|
|
15
|
+
readonly subjectError?: string;
|
|
16
|
+
readonly suggestions?: readonly TemplateJqSuggestion[];
|
|
17
|
+
readonly templates?: TemplatedTextCatalog;
|
|
18
|
+
}
|
|
19
|
+
export declare function SubjectScopeFields({ subjectExpr, scopeExpr, onSubjectChange, onScopeChange, subjectError, suggestions, templates, }: SubjectScopeFieldsProps): ReactNode;
|
|
20
|
+
//# sourceMappingURL=SubjectScopeFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubjectScopeFields.d.ts","sourceRoot":"","sources":["../../src/state-binding/SubjectScopeFields.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEnE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IACzD,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC3C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,WAAW,EACX,SAAS,EACT,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,SAAS,GACV,EAAE,uBAAuB,GAAG,SAAS,CA0BrC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BindingTemplatedJqField } from './BindingTemplatedJqField';
|
|
3
|
+
export function SubjectScopeFields({ subjectExpr, scopeExpr, onSubjectChange, onScopeChange, subjectError, suggestions, templates, }) {
|
|
4
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: 'var(--tai-space-2)' }, children: [_jsx(BindingTemplatedJqField, { label: "Subject", required: true, description: "The record key this binding reads and updates: a key string, or a full subject object.", value: subjectExpr, error: subjectError, suggestions: suggestions, templates: templates, placeholder: ".subject_id", onChange: (next) => {
|
|
5
|
+
onSubjectChange(next ?? { content: '' });
|
|
6
|
+
} }), _jsx(BindingTemplatedJqField, { label: "Scope", description: "Optional. A jq condition; when it is false this state is skipped for the run.", value: scopeExpr, suggestions: suggestions, templates: templates, onChange: onScopeChange })] }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=SubjectScopeFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubjectScopeFields.js","sourceRoot":"","sources":["../../src/state-binding/SubjectScopeFields.tsx"],"names":[],"mappings":";AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAcpE,MAAM,UAAU,kBAAkB,CAAC,EACjC,WAAW,EACX,SAAS,EACT,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,SAAS,GACe;IACxB,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,oBAAoB,EAAE,aACjF,KAAC,uBAAuB,IACtB,KAAK,EAAC,SAAS,EACf,QAAQ,QACR,WAAW,EAAC,wFAAwF,EACpG,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAC,aAAa,EACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;oBACjB,eAAe,CAAC,IAAI,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC3C,CAAC,GACD,EACF,KAAC,uBAAuB,IACtB,KAAK,EAAC,OAAO,EACb,WAAW,EAAC,+EAA+E,EAC3F,KAAK,EAAE,SAAS,EAChB,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,aAAa,GACvB,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The update list of one attached state. Each update applies AFTER the run: either
|
|
3
|
+
* a template `update` jq (picked by name, whose declared input is authored through
|
|
4
|
+
* the adapter mapping) or a custom jq over `{ record, output, input }` that authors
|
|
5
|
+
* the whole op batch itself. An optional op-id expression carries idempotency.
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode } from 'react';
|
|
8
|
+
import type { TemplateJqSuggestion } from './BindingJqField';
|
|
9
|
+
import { type ResolvedTemplateJq } from './catalog';
|
|
10
|
+
import type { BindingSourceSchemas, StateUpdate, TemplatedTextCatalog } from './types';
|
|
11
|
+
export interface UpdateListProps {
|
|
12
|
+
readonly updates: readonly StateUpdate[];
|
|
13
|
+
readonly onChange: (updates: readonly StateUpdate[]) => void;
|
|
14
|
+
readonly updateJq: readonly ResolvedTemplateJq[];
|
|
15
|
+
readonly sources?: BindingSourceSchemas;
|
|
16
|
+
readonly suggestions?: readonly TemplateJqSuggestion[];
|
|
17
|
+
readonly templates?: TemplatedTextCatalog;
|
|
18
|
+
}
|
|
19
|
+
export declare function UpdateList({ updates, onChange, updateJq, sources, suggestions, templates, }: UpdateListProps): ReactNode;
|
|
20
|
+
//# sourceMappingURL=UpdateRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateRow.d.ts","sourceRoot":"","sources":["../../src/state-binding/UpdateRow.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAa,KAAK,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AA2JvF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,oBAAoB,CAAC;IACxC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACvD,QAAQ,CAAC,SAAS,CAAC,EAAE,oBAAoB,CAAC;CAC3C;AAED,wBAAgB,UAAU,CAAC,EACzB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,SAAS,GACV,EAAE,eAAe,GAAG,SAAS,CAqC7B"}
|