mastra 1.40.2-alpha.7 → 1.40.2-alpha.9
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/analytics/index.d.ts +15 -4
- package/dist/analytics/index.js +1 -1
- package/dist/{analytics-DcvNOF6c.js → analytics-CLQaMGC3.js} +57 -2
- package/dist/commands/api/factory-route-metadata.generated.d.ts +7 -1
- package/dist/commands/api/index.d.ts +2 -2
- package/dist/commands/api/route-metadata.generated.d.ts +1 -1
- package/dist/commands/create/create.js +2 -2
- package/dist/{create-DlrSzNAx.js → create-CDcMfsm7.js} +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +7 -7
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
- package/dist/factory/assets/{AlertDialog.es-Dd0j0SAo.js → AlertDialog.es-Dkf8ZLsq.js} +1 -1
- package/dist/factory/assets/BoardConfigPage-CbGjRoKd.js +1 -0
- package/dist/factory/assets/{BoardIcons-BZwAAPO8.js → BoardIcons-ChSrt-Ky.js} +1 -1
- package/dist/factory/assets/BoardIntakePage-lNVbdWDh.js +1 -0
- package/dist/factory/assets/BoardRulesPage-DWDWpS0z.js +1 -0
- package/dist/factory/assets/{Breadcrumb.es-CVW-e0jJ.js → Breadcrumb.es-DRA_fT-0.js} +1 -1
- package/dist/factory/assets/{Card-C1AF3dS4-gxDCT3SZ.js → Card-C1AF3dS4-D5nc4nsO.js} +1 -1
- package/dist/factory/assets/CodeBlock.es-CSnUNCvE.js +6 -0
- package/dist/factory/assets/{CodeEditor-DKVZX8c1-D3tFx8Wi.js → CodeEditor-DE69mZsU-DhkPbKOd.js} +1 -1
- package/dist/factory/assets/{Command.es-DYk0Ffqt.js → Command.es-CJWc6UXm.js} +1 -1
- package/dist/factory/assets/{CompositeItem-CSfZykYZ.js → CompositeItem-DXJX9-KR.js} +1 -1
- package/dist/factory/assets/{CompositeRoot-BDBckJr1.js → CompositeRoot-COSYbRmu.js} +1 -1
- package/dist/factory/assets/ConditionRows-mhryClJA.js +1 -0
- package/dist/factory/assets/CreateFactoryPage-BJVsA5mX.js +1 -0
- package/dist/factory/assets/{DescriptionMarkdown-C5kG44nn.js → DescriptionMarkdown-iotpUxXF.js} +1 -1
- package/dist/factory/assets/{FactorySkillPage-CMrHhFOw.js → FactorySkillPage-D9qzT8bU.js} +3 -3
- package/dist/factory/assets/{FactorySkillsPage-vhvDsQ0Z.js → FactorySkillsPage-PMfXgYDo.js} +1 -1
- package/dist/factory/assets/{Field.es-C1w4lsXS.js → Field.es-BgoAtL-2.js} +1 -1
- package/dist/factory/assets/GithubIcon-CAP9GMMO.css +1 -0
- package/dist/factory/assets/GithubIcon.es-CIm0nGDf.js +55 -0
- package/dist/factory/assets/{HrefLink-y54gg66e.js → HrefLink-1sjfHRy7.js} +1 -1
- package/dist/factory/assets/IconArrowRotateClockwise.es-INXo4MVi.js +1 -0
- package/dist/factory/assets/{IconFormCircle.es-BAAQjWeh.js → IconFormCircle.es-DNm0NK7A.js} +1 -1
- package/dist/factory/assets/IconLoadingCircle.es-Cj4Y7rb5.js +1 -0
- package/dist/factory/assets/{IconPencil.es-DqPc7VYz.js → IconPencil.es-DLEsNj2e.js} +1 -1
- package/dist/factory/assets/{IconScript.es-CSjJFbyA.js → IconScript.es-CPO1Fq6Z.js} +1 -1
- package/dist/factory/assets/{IconSettingsSliderHor.es-CWhsvZzL.js → IconSettingsSliderHor.es-VS_Cfpz8.js} +1 -1
- package/dist/factory/assets/{Input-BWp76snh.js → Input-9DXuotFV.js} +1 -1
- package/dist/factory/assets/{InputNumber.es-DuTGd35f.js → InputNumber.es-Bho-MKtp.js} +1 -1
- package/dist/factory/assets/KnowledgePage-CmdlrOqT.js +13 -0
- package/dist/factory/assets/{LoadErrorState-B6WrspsB.js → LoadErrorState-w5i-jqQO.js} +1 -1
- package/dist/factory/assets/{MarkdownRenderer-BpCw3sc3-QbpHR9ZL.js → MarkdownRenderer-Ca7UVGTG-D9IuJEv9.js} +2 -2
- package/dist/factory/assets/MastraGatewayBilling-D2xarOnv.js +1 -0
- package/dist/factory/assets/{NewBoardPage-DoLZgbSQ.js → NewBoardPage-Co58G3u-.js} +2 -2
- package/dist/factory/assets/{NewPage-c0luvVcE.js → NewPage-B4lBGEFC.js} +1 -1
- package/dist/factory/assets/{OnboardingPage-DUlIJiRQ.js → OnboardingPage-D1AJcuIq.js} +1 -1
- package/dist/factory/assets/{ProviderBrandIcon-DvMLpnTc.js → ProviderBrandIcon-CKq3WaGZ.js} +1 -1
- package/dist/factory/assets/{RadioGroup-B980sx1z.js → RadioGroup-CvTRwRir.js} +1 -1
- package/dist/factory/assets/{RadioGroup.es-BfW3ErPZ.js → RadioGroup.es-DQfIiNtD.js} +1 -1
- package/dist/factory/assets/RootGuards-CZvggXIb.js +1 -0
- package/dist/factory/assets/{RulesPage-Dul5FLpw.js → RulesPage-Bu80TWNE.js} +1 -1
- package/dist/factory/assets/{SearchInput.es-B6oIv0hQ.js → SearchInput.es-BRVlUePH.js} +1 -1
- package/dist/factory/assets/SessionLayout-DeleDrJs.js +4 -0
- package/dist/factory/assets/SessionPage-BAz6O4wl.js +1 -0
- package/dist/factory/assets/SessionSharingPopover-CX69d1UJ.js +1 -0
- package/dist/factory/assets/SettingsPage-9wgvYj6_.js +3 -0
- package/dist/factory/assets/{SettingsSubsection-B_X_u0Kt.js → SettingsSubsection-D1Yp4Ujt.js} +1 -1
- package/dist/factory/assets/Sidebar.es-B464rGRm.js +1 -0
- package/dist/factory/assets/{SignInPage-BCtFfzzk.js → SignInPage-BBl3lfcN.js} +1 -1
- package/dist/factory/assets/{SkillBadges-IJt3Rano.js → SkillBadges-DuFvl4d8.js} +1 -1
- package/dist/factory/assets/{SlackConnectionPage-BnDwJ3TI.js → SlackConnectionPage-6H6OccOz.js} +1 -1
- package/dist/factory/assets/{StackedDiffs-C6mm4aE1.js → StackedDiffs-DtoTOL9C.js} +1 -1
- package/dist/factory/assets/{TabsRoot-DNjGHnQQ.js → TabsRoot-MM_4fh4A.js} +1 -1
- package/dist/factory/assets/{ThinkingLevel.es-DUHMUmiq.js → ThinkingLevel.es-Q1cgMAQj.js} +1 -1
- package/dist/factory/assets/{Tree-B90XgTY4-B_Crja84.js → Tree-B90XgTY4-DvEdNAwi.js} +1 -1
- package/dist/factory/assets/{buttons-group-DA_wORqQ-87uBfszt.js → buttons-group-DA_wORqQ-tI0OhQlr.js} +1 -1
- package/dist/factory/assets/combobox-parts-BVuRAhY6-ClaPtI8E.js +1 -0
- package/dist/factory/assets/{copy-button-BPysC9gu-Ce9_m0Wu.js → copy-button-C3L1ZoAD-DpbBeGOv.js} +1 -1
- package/dist/factory/assets/{esm-KJWZ33y-.js → esm-C7YFnOq6.js} +1 -1
- package/dist/factory/assets/index-Btp5jnxM.js +125 -0
- package/dist/factory/assets/index-CK3K8ZRd.css +1 -0
- package/dist/factory/assets/{input-DqReKX0A-ScC7s6sY.js → input-DqReKX0A-D66C6dWr.js} +3 -3
- package/dist/factory/assets/{input-group-C64rGEu8-tF1AZfiZ.js → input-group-BXqgO3Q2-BNrm-udR.js} +1 -1
- package/dist/factory/assets/{onboardingFlow-DTVR_ThV.js → onboardingFlow-C89nSzO4.js} +1 -1
- package/dist/factory/assets/relative-time.es-2U7OUie-.js +1 -0
- package/dist/factory/assets/{ruleLanes-zac0HQwn.js → ruleLanes-CB6XWPZ9.js} +1 -1
- package/dist/factory/assets/{select-jT0h_BBB-6ji8g_rW.js → select-BPzTS5dZ-BGYcBcgg.js} +1 -1
- package/dist/factory/assets/{settings-C5r2ThW9-D7BpEINa.js → settings-C5r2ThW9-DgHKaQxx.js} +1 -1
- package/dist/factory/assets/{use-keydown.es-Celupa-_.js → use-keydown.es-BFnOTORr.js} +1 -1
- package/dist/factory/assets/{useBoardCatalog-C-gXjA-g.js → useBoardCatalog-DC55UfJd.js} +1 -1
- package/dist/factory/assets/{useBoardEditor-Bn11vS5Q.js → useBoardEditor-DFyQuLCD.js} +1 -1
- package/dist/factory/assets/{useChatSessionContext-CAxNkdHm.js → useChatSessionContext--lCmFMPT.js} +1 -1
- package/dist/factory/assets/useDraftModelGuards-BRcs4Wdl.js +29 -0
- package/dist/factory/assets/{useFactoryDecisions-600qQ62i.js → useFactoryDecisions-O_sajSic.js} +1 -1
- package/dist/factory/assets/{useGlobalSearchControls-CDvuBRkd.js → useGlobalSearchControls-BOmC11Gr.js} +1 -1
- package/dist/factory/assets/{useInfiniteQuery-BqXR1JQ-.js → useInfiniteQuery-D1T5yb8L.js} +1 -1
- package/dist/factory/assets/{useIntakeRoutes-OObHoZos.js → useIntakeRoutes-C2h717K6.js} +1 -1
- package/dist/factory/assets/{useLinearData-Bbyd0L4b.js → useLinearData-D6cSKZs3.js} +1 -1
- package/dist/factory/assets/{useRouteSessionId-DjQx4Cd4.js → useRouteSessionId-BYStxtYL.js} +1 -1
- package/dist/factory/assets/{useRowDrag-0taus7Yi.js → useRowDrag-B2rvWAzw.js} +1 -1
- package/dist/factory/assets/{useSessionCard-bQ1xW_Go.js → useSessionCard-mjrTpVMe.js} +1 -1
- package/dist/factory/assets/{useSessionRepository-tNhUsjDB.js → useSessionRepository-CCb1tcZg.js} +1 -1
- package/dist/factory/assets/{useSessionRows-CnLoToLZ.js → useSessionRows-CIakAaqj.js} +1 -1
- package/dist/factory/assets/{useThreadWorkspacePath-BZmjtdux.js → useThreadWorkspacePath-BmtxcrV6.js} +1 -1
- package/dist/factory/assets/workspaces-DYc-hvkC.js +2 -0
- package/dist/factory/index.html +44 -46
- package/dist/index.js +22 -5
- package/dist/studio/assets/{index-DMAiK4D1.js → index-Bb18bYfu.js} +2 -2
- package/dist/studio/assets/{main-BGtwg6oJ.js → main-B2dVWRoj.js} +279 -276
- package/dist/studio/assets/style-CLhrNGTk.css +3 -0
- package/dist/studio/index.html +2 -2
- package/package.json +4 -4
- package/dist/factory/assets/BoardConfigPage-CY0I73js.js +0 -1
- package/dist/factory/assets/BoardIntakePage-BmLhWdlQ.js +0 -1
- package/dist/factory/assets/BoardRulesPage-CxpDy8Vt.js +0 -1
- package/dist/factory/assets/CodeBlock.es-BJ0-aeYG.js +0 -6
- package/dist/factory/assets/ConditionRows-BXZDW3lX.js +0 -1
- package/dist/factory/assets/CreateFactoryPage-CdbDQ-iV.js +0 -1
- package/dist/factory/assets/GithubIcon-C0PmZadW.css +0 -1
- package/dist/factory/assets/GithubIcon.es-BmZS8JQG.js +0 -55
- package/dist/factory/assets/IconArrowRotateClockwise.es-CbHVv0Jf.js +0 -1
- package/dist/factory/assets/IconShieldCheck.es-Cps6CwGD.js +0 -1
- package/dist/factory/assets/KnowledgePage-DCcitSOk.js +0 -13
- package/dist/factory/assets/MastraGatewayBilling-DHfgi3gb.js +0 -1
- package/dist/factory/assets/RootGuards-BNlIx3jH.js +0 -1
- package/dist/factory/assets/SessionLayout-2Oqv7hBl.js +0 -4
- package/dist/factory/assets/SessionPage-DkoKp_WW.js +0 -1
- package/dist/factory/assets/SessionSharingPopover-d9TlNyFr.js +0 -1
- package/dist/factory/assets/SettingsPage-Da0IUyQa.js +0 -3
- package/dist/factory/assets/Sidebar.es-CFLW5bYW.js +0 -1
- package/dist/factory/assets/combobox-parts-DhYtFSRV-BZqyW5dv.js +0 -1
- package/dist/factory/assets/index-CNDr9VfG.css +0 -1
- package/dist/factory/assets/index-DtRZNzyn.js +0 -125
- package/dist/factory/assets/relative-time.es-BTUAMo6M.js +0 -1
- package/dist/factory/assets/spinner-B9ykw74u-DYljVQkq.js +0 -1
- package/dist/factory/assets/spinner-B9ykw74u-zThqnDlE.css +0 -1
- package/dist/factory/assets/useDraftModelGuards-_-KExOpc.js +0 -29
- package/dist/factory/assets/usePlatformConnections-PVZyB721.js +0 -1
- package/dist/factory/assets/workspaces-DgeuLqOD.js +0 -2
- package/dist/studio/assets/style-DpqHossu.css +0 -3
- /package/dist/factory/assets/{MarkdownRenderer-BpCw3sc3-C04mQel5.css → MarkdownRenderer-Ca7UVGTG-C04mQel5.css} +0 -0
- /package/dist/factory/assets/{combobox-parts-DhYtFSRV-CYlMQsMB.css → combobox-parts-BVuRAhY6-CYlMQsMB.css} +0 -0
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The only command options that are ever sent. Add an option here only if its value can't contain
|
|
3
|
+
* a secret: no keys, tokens, env values, or free-form arguments.
|
|
4
|
+
*/
|
|
5
|
+
declare const COMMAND_ARG_KEYS: readonly ['components', 'debug', 'default', 'default_template', 'dir', 'env', 'envFile', 'example', 'force', 'git', 'hasConfig', 'hasEnvFile', 'hasInput', 'hasOrg', 'hasProject', 'has_org', 'headless', 'json', 'llm', 'mcp', 'mode', 'no_platform', 'observability', 'positionalCount', 'positionalPresent', 'preflight', 'region', 'root', 'scorerName', 'skills', 'skipBuild', 'skipPreflight', 'strict', 'studio', 'targetApi', 'tools', 'version_tag', 'workers', 'yes'];
|
|
6
|
+
type CommandArgKey = (typeof COMMAND_ARG_KEYS)[number];
|
|
7
|
+
/** Rejects objects with any other key, such as a command's raw options. */
|
|
8
|
+
type CommandArgs<Args> = Args & {
|
|
9
|
+
[Key in Exclude<keyof Args, CommandArgKey>]: never;
|
|
10
|
+
};
|
|
1
11
|
export type CLI_ORIGIN = 'mastra-cloud' | 'oss';
|
|
2
12
|
/**
|
|
3
13
|
* Bucket the Mastra platform API host into coarse labels for analytics.
|
|
@@ -31,17 +41,17 @@ export declare class PosthogAnalytics {
|
|
|
31
41
|
private captureSessionStart;
|
|
32
42
|
getDistinctId(): string;
|
|
33
43
|
trackEvent(eventName: string, properties?: Record<string, any>): void;
|
|
34
|
-
trackCommand(options: {
|
|
44
|
+
trackCommand<Args extends object>(options: {
|
|
35
45
|
command: string;
|
|
36
|
-
args?:
|
|
46
|
+
args?: CommandArgs<Args>;
|
|
37
47
|
durationMs?: number;
|
|
38
48
|
status?: 'success' | 'error';
|
|
39
49
|
error?: string;
|
|
40
50
|
origin?: CLI_ORIGIN;
|
|
41
51
|
}): void;
|
|
42
|
-
trackCommandExecution<T>({ command, args, execution, origin, }: {
|
|
52
|
+
trackCommandExecution<T, Args extends object>({ command, args, execution, origin, }: {
|
|
43
53
|
command: string;
|
|
44
|
-
args:
|
|
54
|
+
args: CommandArgs<Args>;
|
|
45
55
|
execution: () => Promise<T>;
|
|
46
56
|
origin?: CLI_ORIGIN;
|
|
47
57
|
}): Promise<T>;
|
|
@@ -56,4 +66,5 @@ export declare class PosthogAnalytics {
|
|
|
56
66
|
}): Promise<boolean>;
|
|
57
67
|
shutdown(timeoutMs?: number): Promise<void>;
|
|
58
68
|
}
|
|
69
|
+
export {};
|
|
59
70
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/analytics/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as PosthogAnalytics, n as bucketApiHost, r as getAnalytics, i as setAnalytics } from "../analytics-
|
|
1
|
+
export { t as PosthogAnalytics, n as bucketApiHost, r as getAnalytics, i as setAnalytics } from "../analytics-CLQaMGC3.js";
|
|
@@ -1554,6 +1554,61 @@ async function gitInit({ cwd }) {
|
|
|
1554
1554
|
// src/analytics/index.ts
|
|
1555
1555
|
const ANALYTICS_CONFIG_PATH = path.join(os.homedir(), ".mastra", "analytics.json");
|
|
1556
1556
|
/**
|
|
1557
|
+
* The only command options that are ever sent. Add an option here only if its value can't contain
|
|
1558
|
+
* a secret: no keys, tokens, env values, or free-form arguments.
|
|
1559
|
+
*/
|
|
1560
|
+
const COMMAND_ARG_KEYS = [
|
|
1561
|
+
"components",
|
|
1562
|
+
"debug",
|
|
1563
|
+
"default",
|
|
1564
|
+
"default_template",
|
|
1565
|
+
"dir",
|
|
1566
|
+
"env",
|
|
1567
|
+
"envFile",
|
|
1568
|
+
"example",
|
|
1569
|
+
"force",
|
|
1570
|
+
"git",
|
|
1571
|
+
"hasConfig",
|
|
1572
|
+
"hasEnvFile",
|
|
1573
|
+
"hasInput",
|
|
1574
|
+
"hasOrg",
|
|
1575
|
+
"hasProject",
|
|
1576
|
+
"has_org",
|
|
1577
|
+
"headless",
|
|
1578
|
+
"json",
|
|
1579
|
+
"llm",
|
|
1580
|
+
"mcp",
|
|
1581
|
+
"mode",
|
|
1582
|
+
"no_platform",
|
|
1583
|
+
"observability",
|
|
1584
|
+
"positionalCount",
|
|
1585
|
+
"positionalPresent",
|
|
1586
|
+
"preflight",
|
|
1587
|
+
"region",
|
|
1588
|
+
"root",
|
|
1589
|
+
"scorerName",
|
|
1590
|
+
"skills",
|
|
1591
|
+
"skipBuild",
|
|
1592
|
+
"skipPreflight",
|
|
1593
|
+
"strict",
|
|
1594
|
+
"studio",
|
|
1595
|
+
"targetApi",
|
|
1596
|
+
"tools",
|
|
1597
|
+
"version_tag",
|
|
1598
|
+
"workers",
|
|
1599
|
+
"yes"
|
|
1600
|
+
];
|
|
1601
|
+
function pickCommandArgs(args) {
|
|
1602
|
+
return Object.fromEntries(Object.entries(args).filter(([key]) => COMMAND_ARG_KEYS.includes(key)));
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Errors can quote a URL the user passed, so drop its query string, or all of it when it may hold
|
|
1606
|
+
* credentials. Where those end is ambiguous: passwords can contain `/` or `?`, and queries `@`.
|
|
1607
|
+
*/
|
|
1608
|
+
function stripUrlSecrets(message) {
|
|
1609
|
+
return message.replace(/:\/\/\S+/g, (url) => url.includes("@") ? "://[redacted]" : url.replace(/[?#].*/, ""));
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1557
1612
|
* Bucket the Mastra platform API host into coarse labels for analytics.
|
|
1558
1613
|
*
|
|
1559
1614
|
* We report the *category* of API surface a deploy is talking to (cloud,
|
|
@@ -1697,9 +1752,9 @@ var PosthogAnalytics = class PosthogAnalytics {
|
|
|
1697
1752
|
command: options.command,
|
|
1698
1753
|
status: options.status || "success"
|
|
1699
1754
|
};
|
|
1700
|
-
if (options.args) commandData.args = options.args;
|
|
1755
|
+
if (options.args) commandData.args = pickCommandArgs(options.args);
|
|
1701
1756
|
if (options.durationMs) commandData.durationMs = options.durationMs;
|
|
1702
|
-
if (options.error) commandData.error = options.error;
|
|
1757
|
+
if (options.error) commandData.error = stripUrlSecrets(options.error);
|
|
1703
1758
|
this.client.capture({
|
|
1704
1759
|
distinctId: this.distinctId,
|
|
1705
1760
|
event: "cli_command",
|
|
@@ -161,7 +161,7 @@ export declare const FACTORY_API_ROUTE_METADATA: {
|
|
|
161
161
|
readonly path: "/web/factory/projects/:id/boards/:boardKey/phases";
|
|
162
162
|
readonly description: "List the cards under each phase of a board view, in order, with how many match";
|
|
163
163
|
readonly pathParams: readonly ["id", "boardKey"];
|
|
164
|
-
readonly queryParams: readonly ["assignee", "author", "cards", "item", "label", "limit", "linearProject", "q", "reviewer", "sort", "source", "teammate", "window", "worked"];
|
|
164
|
+
readonly queryParams: readonly ["assignee", "author", "cards", "item", "label", "limit", "linearProject", "pullRequest", "q", "reviewer", "sort", "source", "teammate", "trust", "window", "worked"];
|
|
165
165
|
readonly bodyParams: readonly [];
|
|
166
166
|
readonly hasQuery: true;
|
|
167
167
|
readonly hasBody: false;
|
|
@@ -1944,6 +1944,12 @@ export declare const FACTORY_API_ROUTE_SCHEMAS: {
|
|
|
1944
1944
|
readonly label: {
|
|
1945
1945
|
readonly $ref: "#/$defs/__schema0";
|
|
1946
1946
|
};
|
|
1947
|
+
readonly pullRequest: {
|
|
1948
|
+
readonly $ref: "#/$defs/__schema0";
|
|
1949
|
+
};
|
|
1950
|
+
readonly trust: {
|
|
1951
|
+
readonly $ref: "#/$defs/__schema0";
|
|
1952
|
+
};
|
|
1947
1953
|
readonly teammate: {
|
|
1948
1954
|
readonly $ref: "#/$defs/__schema0";
|
|
1949
1955
|
};
|
|
@@ -168,7 +168,7 @@ export declare const CLI_ROUTE_METADATA: {
|
|
|
168
168
|
readonly path: "/web/factory/projects/:id/boards/:boardKey/phases";
|
|
169
169
|
readonly description: "List the cards under each phase of a board view, in order, with how many match";
|
|
170
170
|
readonly pathParams: readonly ["id", "boardKey"];
|
|
171
|
-
readonly queryParams: readonly ["assignee", "author", "cards", "item", "label", "limit", "linearProject", "q", "reviewer", "sort", "source", "teammate", "window", "worked"];
|
|
171
|
+
readonly queryParams: readonly ["assignee", "author", "cards", "item", "label", "limit", "linearProject", "pullRequest", "q", "reviewer", "sort", "source", "teammate", "trust", "window", "worked"];
|
|
172
172
|
readonly bodyParams: readonly [];
|
|
173
173
|
readonly hasQuery: true;
|
|
174
174
|
readonly hasBody: false;
|
|
@@ -4998,7 +4998,7 @@ export declare const CLI_ROUTE_METADATA: {
|
|
|
4998
4998
|
readonly path: "/datasets/:datasetId/experiments";
|
|
4999
4999
|
readonly pathParams: readonly ["datasetId"];
|
|
5000
5000
|
readonly queryParams: readonly [];
|
|
5001
|
-
readonly bodyParams: readonly ["agentModel", "agentVersion", "description", "grouping", "id", "maxConcurrency", "metadata", "name", "provenance", "requestContext", "scorerIds", "start", "targetId", "targetType", "version", "versions"];
|
|
5001
|
+
readonly bodyParams: readonly ["agentModel", "agentVersion", "description", "durable", "grouping", "id", "itemTimeout", "maxConcurrency", "maxRetries", "metadata", "name", "provenance", "requestContext", "scorerIds", "start", "targetId", "targetType", "version", "versions"];
|
|
5002
5002
|
readonly hasQuery: false;
|
|
5003
5003
|
readonly hasBody: true;
|
|
5004
5004
|
readonly responseShape: {
|
|
@@ -3917,7 +3917,7 @@ export declare const API_ROUTE_METADATA: {
|
|
|
3917
3917
|
readonly path: "/datasets/:datasetId/experiments";
|
|
3918
3918
|
readonly pathParams: readonly ["datasetId"];
|
|
3919
3919
|
readonly queryParams: readonly [];
|
|
3920
|
-
readonly bodyParams: readonly ["agentModel", "agentVersion", "description", "grouping", "id", "maxConcurrency", "metadata", "name", "provenance", "requestContext", "scorerIds", "start", "targetId", "targetType", "version", "versions"];
|
|
3920
|
+
readonly bodyParams: readonly ["agentModel", "agentVersion", "description", "durable", "grouping", "id", "itemTimeout", "maxConcurrency", "maxRetries", "metadata", "name", "provenance", "requestContext", "scorerIds", "start", "targetId", "targetType", "version", "versions"];
|
|
3921
3921
|
readonly hasQuery: false;
|
|
3922
3922
|
readonly hasBody: true;
|
|
3923
3923
|
readonly responseShape: {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as validateCreateOptionConflicts, F as getCreateMode, I as normalizeCreateCommandOptions, L as parseCreateLLMProvider, N as CREATE_LLM_PROVIDERS, P as configureCreateCommand, R as parseCreateTimeout, V as validateProjectName, z as selectMatchingDistTag } from "../../analytics-
|
|
2
|
-
import { a as runCreateCommand, i as isCreateCancelledError, n as create, r as getCreateCommandAnalyticsArgs, t as CreateCancelledError } from "../../create-
|
|
1
|
+
import { B as validateCreateOptionConflicts, F as getCreateMode, I as normalizeCreateCommandOptions, L as parseCreateLLMProvider, N as CREATE_LLM_PROVIDERS, P as configureCreateCommand, R as parseCreateTimeout, V as validateProjectName, z as selectMatchingDistTag } from "../../analytics-CLQaMGC3.js";
|
|
2
|
+
import { a as runCreateCommand, i as isCreateCancelledError, n as create, r as getCreateCommandAnalyticsArgs, t as CreateCancelledError } from "../../create-CDcMfsm7.js";
|
|
3
3
|
export { CREATE_LLM_PROVIDERS, CreateCancelledError, configureCreateCommand, create, getCreateCommandAnalyticsArgs, getCreateMode, isCreateCancelledError, normalizeCreateCommandOptions, parseCreateLLMProvider, parseCreateTimeout, runCreateCommand, selectMatchingDistTag, validateCreateOptionConflicts, validateProjectName };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as validateCreateOptionConflicts, I as normalizeCreateCommandOptions, N as CREATE_LLM_PROVIDERS, V as validateProjectName, a as getPackageManager, c as gitInit, k as writeObservabilityEnv, l as isGitInitialized, r as getAnalytics } from "./analytics-
|
|
1
|
+
import { B as validateCreateOptionConflicts, I as normalizeCreateCommandOptions, N as CREATE_LLM_PROVIDERS, V as validateProjectName, a as getPackageManager, c as gitInit, k as writeObservabilityEnv, l as isGitInitialized, r as getAnalytics } from "./analytics-CLQaMGC3.js";
|
|
2
2
|
import { c as openBrowser, i as getToken, t as LoginCancelledError } from "./credentials-BV9JpjhI.js";
|
|
3
3
|
import { r as resolveCurrentOrg, t as OrgSelectionCancelledError } from "./orgs-U8xs5uGQ.js";
|
|
4
4
|
import { i as authHeaders, n as MASTRA_PROJECTS_URL, o as extractApiErrorDetail, s as platformFetch, t as MASTRA_PLATFORM_API_URL } from "./client-CKs2N-Pd.js";
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.40.2-alpha.
|
|
2
|
+
"version": "1.40.2-alpha.9",
|
|
3
3
|
"package": "mastra",
|
|
4
4
|
"exports": {
|
|
5
5
|
"PosthogAnalytics": {
|
|
6
6
|
"types": "dist/analytics/index.d.ts",
|
|
7
|
-
"implementation": "dist/analytics-
|
|
8
|
-
"line":
|
|
7
|
+
"implementation": "dist/analytics-CLQaMGC3.js",
|
|
8
|
+
"line": 1636
|
|
9
9
|
},
|
|
10
10
|
"analytics": {
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 40353
|
|
14
14
|
},
|
|
15
15
|
"create": {
|
|
16
16
|
"types": "dist/commands/create/create.d.ts",
|
|
17
|
-
"implementation": "dist/create-
|
|
17
|
+
"implementation": "dist/create-CDcMfsm7.js",
|
|
18
18
|
"line": 1023
|
|
19
19
|
},
|
|
20
20
|
"origin": {
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 40360
|
|
24
24
|
},
|
|
25
25
|
"version": {
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 40352
|
|
29
29
|
},
|
|
30
30
|
"answerRelevancyScorer": {
|
|
31
31
|
"types": "dist/index.d.ts",
|
|
@@ -208,7 +208,7 @@ Platform adds these fields and grouping options:
|
|
|
208
208
|
| `aggregateTraces()` | Supports `groupBy: ['projectId']` and `countDistinct.projectId`. |
|
|
209
209
|
| `aggregateSpans()` | Supports `groupBy: ['projectId']`, but not `countDistinct.projectId`. |
|
|
210
210
|
|
|
211
|
-
Data retention depends on your plan: 15 days for Starter,
|
|
211
|
+
Data retention depends on your plan: 15 days for Free, 60 days for Starter, 180 days for Team, and custom retention for Enterprise. See [pricing](https://mastra.ai/pricing) for current plan limits.
|
|
212
212
|
|
|
213
213
|
### Other observability data
|
|
214
214
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{At as e,Dt as t,Et as n,Mt as r,Nt as i,Ot as a,Pt as o,St as s,Tt as c,jt as l,kt as u,ni as d,wt as f}from"./GithubIcon.es-
|
|
1
|
+
import{At as e,Dt as t,Et as n,Mt as r,Nt as i,Ot as a,Pt as o,St as s,Tt as c,jt as l,kt as u,ni as d,wt as f}from"./GithubIcon.es-CIm0nGDf.js";import{O as p,T as m}from"./IconChevronRightMedium.es-BkPdzxSm.js";var h=p();function g(e){return(0,h.jsx)(s,{...e,modal:!0,disablePointerDismissal:!0})}function _({size:e=`sm`,...n}){return(0,h.jsx)(t,{"data-slot":`alert-dialog-content`,size:e,showCloseButton:!1,...n,role:`alertdialog`})}function v({children:e,loading:t,...r}){return(0,h.jsx)(n,{render:(0,h.jsx)(d,{variant:`primary`,size:`md`,loading:t,className:m(i,o.md),children:e}),...r})}g.Trigger=r,g.Content=_,g.Header=e,g.Footer=u,g.Body=f,g.Title=l,g.Description=a,g.Action=v,g.Cancel=c;export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./Breadcrumb.es-DRA_fT-0.js";import{t as r}from"./EmptyState-DJaZF543-BTdobX9X.js";import{$n as i,Cr as a,D as o,Fr as s,Gn as c,Nr as l,O as u,Pr as d,Qn as f,Tr as p,Wn as m,Xn as h,Zn as g,_r as _,ar as v,br as y,dr as b,en as x,er as ee,fn as te,fr as S,gr as C,ir as w,mr as T,nn as E,nr as D,pr as O,rn as k,rr as A,sr as j,tn as M,tr as N,ur as P,wr as ne,xr as re}from"./index-Btp5jnxM.js";import{a as F}from"./Sidebar.es-B464rGRm.js";import{d as I,f as L,i as ie,t as R,u as ae}from"./settings-C5r2ThW9-DgHKaQxx.js";import{O as oe,T as z,k as se,n as B,s as V,t as ce}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{$n as H,Fi as le,Li as ue,Pi as de,Qr as fe,cr as pe,dr as me,n as U,ni as W,r as he,rr as ge,zt as _e}from"./GithubIcon.es-CIm0nGDf.js";import{c as ve,o as ye,r as be,s as xe,t as Se}from"./useBoardEditor-DFyQuLCD.js";import{i as Ce,t as we}from"./SkillBadges-DuFvl4d8.js";import{a as G,c as Te,f as Ee,l as De,s as Oe}from"./boardConfigPaths-Btimpi_r.js";import{t as K}from"./AlertDialog.es-Dkf8ZLsq.js";import{t as q}from"./SettingsSubsection-D1Yp4Ujt.js";import{r as ke}from"./CompositeItem-DXJX9-KR.js";import{n as Ae}from"./useBoardCatalog-DC55UfJd.js";import{h as je,o as Me}from"./useIntakeRoutes-C2h717K6.js";import{a as Ne,d as Pe,t as Fe}from"./BoardIcons-ChSrt-Ky.js";import{i as Ie,n as Le,r as Re,t as ze}from"./IconPencil.es-DLEsNj2e.js";import{r as Be}from"./overlays-B4T3HdBk.js";import{t as Ve}from"./DescriptionMarkdown-iotpUxXF.js";import{h as He,w as Ue,y as We}from"./ruleLanes-CB6XWPZ9.js";import{k as Ge}from"./TabsRoot-MM_4fh4A.js";import{t as Ke}from"./CodeEditor-DE69mZsU-DhkPbKOd.js";import{a as qe,n as Je,r as Ye,t as Xe}from"./Field.es-BgoAtL-2.js";import{t as Ze}from"./input-DqReKX0A-D66C6dWr.js";import{a as Qe,n as $e}from"./input-group-BXqgO3Q2-BNrm-udR.js";import{a as et,i as tt,n as nt,r as rt,t as it}from"./InputNumber.es-Bho-MKtp.js";import{i as at,n as ot,r as st,t as ct}from"./select-BPzTS5dZ-BGYcBcgg.js";import{E as lt}from"./combobox-parts-BVuRAhY6-ClaPtI8E.js";import{n as ut,t as dt}from"./ConditionRows-mhryClJA.js";import{n as ft}from"./IconUserDuo.es-CJ2yCPc7.js";import{_t as pt}from"./useSessionRows-CIakAaqj.js";import{t as mt}from"./IconPlusMedium.es-BOotRziY.js";import{t as ht}from"./TrashIcon.es-DoCvaCDh.js";import{n as gt,t as _t}from"./boardCatalog-y-s19dQU.js";import{t as vt}from"./IconArrowRotateCounterClockwise.es-Dxk4yi6B.js";import{t as yt}from"./InlineText-tcMMASWp.js";import{t as bt}from"./LoadErrorState-w5i-jqQO.js";var J=e(se(),1),xt=`mx-auto w-full max-w-2xl`,St=`[container-type:inline-size] h-full min-h-0 overflow-auto overscroll-x-contain [scrollbar-gutter:stable]`,Ct=`sticky left-0 w-[100cqw] px-4`,Y=oe();function X({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:z(Ct,i),children:(0,Y.jsx)(`div`,{className:z(xt,n),children:r})}):(0,Y.jsx)(`div`,{className:z(xt,i,n),children:r})}function wt({factoryId:e,boardId:t,phase:n,skills:r}){let i=n.runner;if(!i)return null;let a=i.skill,s=a?r?.find(e=>e.name===a):void 0,c=a!==void 0&&r!==void 0&&s===void 0,l=c||s?.error!==void 0,u=a&&!c?Te(e,t,a):G(e,t,n.key),d=a?o:Be;return(0,Y.jsxs)(Le,{children:[(0,Y.jsxs)(Ie,{delay:0,closeDelay:100,render:(0,Y.jsx)(H,{to:u}),className:z(V,`border-border bg-fill-subtle hover:bg-fill flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md border px-1.5 py-0.5 transition-colors`,l&&`border-destructive-foreground text-destructive-foreground`),children:[(0,Y.jsx)(d,{"aria-hidden":!0,className:`size-icon-sm shrink-0 opacity-70`}),(0,Y.jsx)(`span`,{className:`truncate`,children:a??`Agent`}),l&&(0,Y.jsx)(`span`,{className:`sr-only`,children:c?`, skill not found`:`, skill failed to load`})]}),(0,Y.jsxs)(Re,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(d,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(B,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:a??`${n.name} agent`}),s&&(0,Y.jsx)(we,{skill:s})]}),c?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,a,` skill, so cards entering `,n.name,` fail to start.`]}):s?.error?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,s.error]}):s?.description&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:s.description}),a&&!r&&(0,Y.jsx)(f,{children:`Loading the skill…`}),s?.content.trim()&&(0,Y.jsx)(Tt,{title:`Skill instructions`,children:(0,Y.jsx)(Ve,{titleLevel:`h3`,children:s.content})}),i.instructions?.trim()&&(0,Y.jsx)(Tt,{title:`${n.name} adds`,children:(0,Y.jsx)(Ve,{titleLevel:`h3`,children:i.instructions})}),i.goal?.objective&&(0,Y.jsx)(Tt,{title:i.goal.maxRuns?`Goal, up to ${i.goal.maxRuns} runs`:`Goal`,children:(0,Y.jsx)(B,{as:`p`,variant:`body-sm`,className:`whitespace-pre-wrap`,children:i.goal.objective})}),(0,Y.jsxs)(B,{as:`p`,variant:`caption`,tone:`muted`,children:[`Session `,i.context||`work`,`, shared with phases that name it too.`]})]})]})}function Tt({title:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(B,{as:`span`,variant:`caption`,tone:`faint`,children:e}),(0,Y.jsx)(`div`,{className:`bg-fill-subtle max-h-56 overflow-y-auto rounded-md px-2.5 py-2`,children:t})]})}function Et({rules:e,title:t,to:n,boardId:r,boards:i}){return(0,Y.jsxs)(Le,{children:[(0,Y.jsx)(Ie,{delay:0,closeDelay:100,render:(0,Y.jsx)(H,{to:n}),className:z(V,`w-fit rounded-sm underline decoration-dotted underline-offset-2`),children:He(e.length)}),(0,Y.jsxs)(Re,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2`,children:[(0,Y.jsx)(B,{as:`span`,variant:`caption`,tone:`faint`,children:t}),(0,Y.jsx)(`ul`,{"aria-label":t,className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,children:e.map(e=>(0,Y.jsx)(c,{rule:e,boardId:r,boards:i},e.id))})]})]})}var Dt=`px-[max(0.75rem,calc((100cqw_-_42rem)/2_-_1.25rem))]`;function Ot({factoryId:e,boardId:t,phases:n,skills:r,action:a,onAutoStart:o}){let s=Ae(e),c=Me(e),l=s.isPending||c.isPending,u=s.data?.find(e=>e.id===t)?.initialPhase??n[0]?.key,d=n.map(e=>g(e,n)),p=c.data&&u?i(c.data.intakeRoutes,{key:t,initialPhase:u}):void 0;return(0,Y.jsxs)(`section`,{"aria-label":`Board map`,className:`flex flex-col gap-3`,children:[a&&(0,Y.jsx)(X,{pinned:!0,className:`flex justify-end`,children:a}),c.isError&&(0,Y.jsx)(X,{pinned:!0,children:(0,Y.jsx)(U,{variant:`warning`,children:(0,Y.jsx)(U.Message,{children:`Rules didn’t load, so the map doesn’t count them.`})})}),p&&p.leaving.length>0&&(0,Y.jsx)(X,{pinned:!0,className:`mb-4`,children:(0,Y.jsxs)(B,{as:`p`,variant:`caption`,tone:`muted`,children:[(0,Y.jsx)(Et,{rules:p.leaving,title:`Rules that send cards to other boards`,to:Oe(e,t,`leaving`),boardId:t,boards:s.data}),` `,p.leaving.length===1?`sends`:`send`,` cards from here to other boards.`]})}),(0,Y.jsx)(`ol`,{"aria-label":`Phases`,className:z(`mx-auto flex w-max`,Dt),children:n.map(i=>{let a=Ne(t,i.kind),c=p?.into.get(i.key)??[];return(0,Y.jsxs)(`li`,{"aria-label":i.name,className:`before:via-border-strong relative flex w-64 shrink-0 flex-col px-2 not-first:before:absolute not-first:before:inset-y-0 not-first:before:left-0 not-first:before:w-px not-first:before:bg-linear-to-b not-first:before:from-transparent not-first:before:to-transparent`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2 px-3 pt-3 pb-1`,children:(0,Y.jsxs)(H,{to:G(e,t,i.key),className:`flex min-w-0 items-center gap-2 hover:underline focus-visible:underline focus-visible:outline-hidden`,children:[(0,Y.jsx)(Fe,{stage:i.key,kind:a,decorative:!0}),(0,Y.jsx)(B,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:i.name})]})}),(0,Y.jsx)(`div`,{className:`px-3 py-3`,children:(0,Y.jsx)(h,{boardId:t,phase:g(i,n),phases:d,arrivals:(0,Y.jsxs)(Y.Fragment,{children:[l?(0,Y.jsx)(ke,{className:`h-4 w-20`}):p?c.length>0?(0,Y.jsx)(Et,{rules:c,title:`Rules that move cards into ${i.name}`,to:Oe(e,t,{into:i.key}),boardId:t,boards:s.data}):(0,Y.jsx)(f,{children:`No rule moves cards here`}):(0,Y.jsx)(f,{children:`Rules didn’t load`}),i.key===u&&(0,Y.jsx)(f,{children:`New cards start here`})]}),starts:(0,Y.jsx)(m,{label:i.name,autoStart:i.autoStart??!1,autoStartWhen:i.autoStartWhen,onChange:o&&(e=>o(i.key,e))}),agent:(0,Y.jsx)(wt,{factoryId:e,boardId:t,phase:i,skills:r})})})]},i.key)})})]})}var kt=`Finish or remove unfinished conditions to save.`;function At({label:e,description:t,rule:n,disabled:r,facts:i=We,options:o,schema:s,json:c,onChange:l,onUnfinished:u}){let[d,f]=(0,J.useState)(void 0),p=c?c.text:d,m=c?c.onChange:f,h=(0,J.useId)(),g=p===void 0?a(s,n):y(s,p),_=e=>{m(e);let t=re(s,e);`problem`in t?l(n??null,t.problem):l(t.rule,void 0)};return(0,Y.jsxs)(Xe,{invalid:g!==void 0,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(qe,{htmlFor:h,children:e}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,disabled:r,onClick:()=>{p===void 0?m(n?JSON.stringify(n,null,2):``):(m(void 0),l(n??null,a(s,n)))},children:p===void 0?`Edit as JSON`:`Edit as conditions`})]}),(0,Y.jsx)(Je,{children:t}),p===void 0?r?(0,Y.jsx)(B,{id:h,as:`p`,variant:`caption`,tone:`muted`,children:Ue(n,o)}):(0,Y.jsx)(`div`,{id:h,children:(0,Y.jsx)(dt,{label:e,rule:n,facts:i,options:o,onChange:(e,t)=>{u?.(t),t?l(n??null,kt):l(e,a(s,e))}})}):(0,Y.jsx)(x,{id:h,"aria-label":`${e} JSON`,value:p,disabled:r,rows:6,onChange:e=>_(e.target.value)}),g&&(0,Y.jsx)(Ye,{children:g})]})}var jt=`inline-flex h-8 max-w-48 min-w-0 items-center gap-1.5 rounded-lg border px-2.5`;function Mt({phase:e,phases:t,next:n,required:r,boardId:i,disabled:a,onChange:o}){let s=e=>o(n.includes(e)?n.filter(t=>t!==e):t.filter(t=>t.key===e||n.includes(t.key)).map(e=>e.key));return(0,Y.jsx)(`ul`,{"aria-label":`Allowed moves from ${e.name}`,className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let o=(0,Y.jsx)(Fe,{stage:t.key,kind:Ne(i,t.kind),decorative:!0});if(t.key===e.key)return(0,Y.jsxs)(`li`,{className:z(jt,`border-border-strong bg-card shadow-raised dark:bg-muted`),children:[o,(0,Y.jsx)(Nt,{children:t.name}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`(this phase)`})]},t.key);let c=n.includes(t.key),l=c&&r.has(t.key),u=l||a,d=(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":c,"aria-label":l?`${t.name} (locked)`:void 0,"aria-disabled":u||void 0,onClick:u?void 0:()=>s(t.key),className:z(jt,`group/move transition-colors`,c?`bg-fill text-foreground border-transparent`:`border-border text-muted-foreground border-dashed`,!u&&(c?`hover:bg-fill-hover`:`hover:text-foreground hover:border-border-strong`),u&&!l&&`cursor-default`,V),children:[(0,Y.jsx)(`span`,{className:z(`grid place-items-center`,!c&&`opacity-50`),children:o}),(0,Y.jsx)(Nt,{children:t.name}),(0,Y.jsx)(`span`,{className:`text-muted-foreground grid size-3.5 shrink-0 place-items-center`,children:l?(0,Y.jsx)(ft,{className:`size-icon-sm`,"aria-hidden":!0}):c?(0,Y.jsx)(pt,{className:`size-icon-sm`,"aria-hidden":!0}):!a&&(0,Y.jsx)(mt,{className:`size-icon-sm invisible group-hover/move:visible group-focus-visible/move:visible`,"aria-hidden":!0})})]});return(0,Y.jsx)(`li`,{className:`min-w-0`,children:l?(0,Y.jsxs)(de,{children:[(0,Y.jsx)(ue,{render:d}),(0,Y.jsx)(le,{children:`Factory's code makes this move`})]}):d},t.key)})})}function Nt({children:e}){return(0,Y.jsx)(B,{as:`span`,variant:`label`,className:`truncate`,children:e})}function Pt({label:e,children:t}){return(0,Y.jsx)(`ol`,{"aria-label":e,className:`flex flex-col`,children:t})}function Z({icon:e,title:t,description:n,children:r}){let i=(0,J.useId)();return(0,Y.jsxs)(`li`,{"aria-labelledby":i,className:`before:bg-border relative grid grid-cols-[--spacing(7)_minmax(0,1fr)] gap-x-3 pb-8 before:absolute before:top-9 before:bottom-1 before:left-[calc(--spacing(3.5)-0.5px)] before:w-px last:pb-0 last:before:hidden`,children:[(0,Y.jsx)(`span`,{className:`border-border bg-card text-muted-foreground [&_svg]:size-icon-sm flex size-7 items-center justify-center rounded-full border`,children:e}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-7 flex-col justify-center`,children:[(0,Y.jsx)(B,{as:`h2`,id:i,variant:`subheading`,tone:`ink`,children:t}),n&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:n})]}),r]})]})}var Ft=`__none__`,It=`sm:max-w-xs`,Lt=(e,t)=>e>=t-200?` ${e}/${t}`:``;function Q({title:e,description:t,error:n,disabled:r,children:i,after:a}){return(0,Y.jsxs)(ie,{children:[(0,Y.jsxs)(Xe,{invalid:!!n,disabled:r,children:[(0,Y.jsx)(I,{children:e}),(0,Y.jsx)(Je,{children:t}),i,n&&(0,Y.jsx)(Ye,{children:n})]}),a]})}function Rt({label:e,value:t,placeholder:n,disabled:r,onChange:i}){return(0,Y.jsx)(R,{children:(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ke,{"aria-label":e,value:t,placeholder:n,editable:!r,onChange:i,language:`markdown`,font:`body`,variant:`inline`,lineNumbers:!1,showCopyButton:!1})})})}function zt({phase:e,phases:t,requiredNextPhases:n,skills:r,skillsEditable:i,factoryId:a,boardId:s,disabled:c,rawRules:l,onChange:u,onRawRule:d,onUnfinished:f,onRemove:p}){let m=ut(a),h=e.kind===`working`,g=b(e,t),_=e.runner?.instructions??``,v=e.runner?.goal,y=v?.objective??``,x=e.tools??[],S=e.exitTool?.id??``,w=e.runner?.skill,T=w?r?.find(e=>e.name===w):void 0,E=w!==void 0&&r!==void 0&&T===void 0,O=t=>{let n={...e.runner,...t},r=Object.fromEntries(Object.entries(n).filter(([,e])=>e!=null&&e!==``));u({...e,runner:Object.keys(r).length>0?r:null})},k=e=>({text:l[e],onChange:t=>d(e,t)}),M=(0,Y.jsx)(Mt,{phase:e,phases:t,next:g,required:new Set(n),boardId:s,disabled:c,onChange:t=>u({...e,nextPhases:t})}),P=p&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(W,{variant:`ghost`,icon:(0,Y.jsx)(ht,{}),onClick:p,children:[`Remove `,e.name]})});return h?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsxs)(Pt,{label:`How ${e.name} runs`,children:[(0,Y.jsx)(Z,{icon:(0,Y.jsx)(Pe,{}),title:`Starts`,children:(0,Y.jsxs)(R,{children:[(0,Y.jsx)(L,{label:`Start on its own`,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: start on its own`,checked:e.autoStart??!1,disabled:c,onCheckedChange:t=>{u(C(e,t)),t||d(`autoStartWhen`,void 0)}})}),e.autoStart&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(At,{label:`${e.name}: start only when`,description:`Leave empty to start every card on its own.`,rule:e.autoStartWhen,schema:je,options:{"source.repository":m},disabled:c,json:k(`autoStartWhen`),onUnfinished:e=>f(`autoStartWhen`,e),onChange:t=>u({...e,autoStartWhen:t})})})]})}),(0,Y.jsxs)(Z,{icon:(0,Y.jsx)(Be,{}),title:`Agent runs`,children:[(0,Y.jsx)(Q,{title:`Instructions`,description:`Added to the agent's prompt when the phase starts.${Lt(_.length,N)}`,error:_.length>1e3?`Too long to save.`:void 0,disabled:c,children:(0,Y.jsx)(Rt,{label:`${e.name} instructions`,value:_,placeholder:`Tell the agent what to do, in Markdown`,disabled:c,onChange:e=>O({instructions:e})})}),(0,Y.jsx)(Q,{title:`Goal`,description:`The agent keeps working until a judge finds this objective met. Leave empty for a single run.${Lt(y.length,D)}`,error:y.length>2e3?`Too long to save.`:void 0,disabled:c,after:v&&(0,Y.jsxs)(Xe,{invalid:!j(v.maxRuns),disabled:c,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(qe,{info:`After this many runs without meeting the goal, the card waits for a person. From 1 to 50; leave empty for Factory's default.`,children:`Pause goal after`}),(0,Y.jsx)(it,{className:`w-36`,min:1,max:50,allowOutOfRange:!0,value:v.maxRuns??null,disabled:c,onValueChange:e=>{let{maxRuns:t,...n}=v;O({goal:e===null?n:{...n,maxRuns:e}})},children:(0,Y.jsxs)(rt,{size:`sm`,children:[(0,Y.jsx)(et,{placeholder:`Default`}),(0,Y.jsxs)($e,{align:`inline-end`,variant:`flush`,children:[(0,Y.jsx)(Qe,{className:`mr-1`,children:`runs`}),(0,Y.jsx)(nt,{}),(0,Y.jsx)(tt,{})]})]})})]}),!j(v.maxRuns)&&(0,Y.jsxs)(Ye,{children:[`Use a whole number from 1 to `,50,`.`]})]}),children:(0,Y.jsx)(Rt,{label:`${e.name} goal`,value:y,placeholder:`Describe what done looks like`,disabled:c,onChange:e=>O({goal:e.trim()?{...v,objective:e}:void 0})})}),(0,Y.jsx)(Q,{title:`Session`,description:`Phases with the same session share one agent session per card.`,disabled:c,children:(0,Y.jsx)(Ze,{className:It,"aria-label":`${e.name} session`,value:e.runner?.context??``,placeholder:ee,disabled:c,onChange:e=>O({context:e.target.value})})}),(0,Y.jsx)(q,{title:`Skill`,children:(0,Y.jsx)(R,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(ct,{value:w??Ft,disabled:c,onValueChange:e=>O({skill:e===Ft?void 0:String(e)}),children:[(0,Y.jsx)(at,{variant:`ghost`,size:`sm`,"aria-label":`${e.name} skill`,className:`-ml-2 w-fit`,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(o,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:w??`No skill`})]})}),(0,Y.jsxs)(ot,{children:[(0,Y.jsx)(st,{value:Ft,children:`None`}),(r??[]).map(e=>(0,Y.jsx)(st,{value:e.name,children:e.name},e.name))]})]}),E&&(0,Y.jsx)(Ge,{variant:`destructive`,children:`Not found`}),T?.error&&(0,Y.jsx)(Ge,{variant:`destructive`,children:`Failed to load`}),T&&(0,Y.jsx)(we,{skill:T}),T&&(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,icon:i?(0,Y.jsx)(ze,{}):(0,Y.jsx)(he,{}),"aria-label":`${i?`Edit`:`View`} ${T.name}`,className:`ml-auto`,render:(0,Y.jsx)(H,{to:Te(a,s,T.name)}),children:i?`Edit`:`View`})]}),T?.error?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,T.error]}):E?(0,Y.jsxs)(B,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,w,` skill, so cards entering `,e.name,` fail to start.`]}):T?.description&&(0,Y.jsx)(B,{as:`p`,variant:`caption`,tone:`muted`,children:T.description})]})})}),(0,Y.jsx)(q,{title:`Factory tools`,description:`Given to the session that works the card in this phase.`,children:(0,Y.jsx)(R,{children:A.map(t=>(0,Y.jsx)(L,{label:t.label,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: ${t.label}`,checked:x.includes(t.id),disabled:c,onCheckedChange:n=>{let r=A.map(({id:e})=>e).filter(e=>e===t.id?n:x.includes(e));u({...e,tools:r.length>0?r:null})}})},t.id))})})]}),(0,Y.jsxs)(Z,{icon:(0,Y.jsx)(ne,{}),title:`Ends`,children:[(0,Y.jsx)(Q,{title:`Exit tool`,description:`Ends the phase when it succeeds. Leave empty for none.`,disabled:c,children:(0,Y.jsx)(Ze,{className:It,"aria-label":`${e.name} exit tool`,value:S,disabled:c,onChange:t=>{let n=t.target.value.trim();u({...e,exitTool:n?{...e.exitTool,id:n}:null}),n||d(`autoApproveWhen`,void 0)}})}),S!==``&&(0,Y.jsxs)(R,{children:[(0,Y.jsx)(L,{label:`Approve on its own`,disabled:c,children:(0,Y.jsx)(lt,{"aria-label":`${e.name}: approve ${S} on its own`,checked:e.exitTool?.autoApprove??!1,disabled:c,onCheckedChange:t=>{u({...e,exitTool:{...e.exitTool,id:S,autoApprove:t,autoApproveWhen:t?e.exitTool?.autoApproveWhen:void 0}}),t||d(`autoApproveWhen`,void 0)}})}),e.exitTool?.autoApprove&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(At,{label:`${e.name}: approve only when`,description:`Leave empty to approve for every card.`,rule:e.exitTool.autoApproveWhen,schema:je,options:{"source.repository":m},disabled:c,json:k(`autoApproveWhen`),onUnfinished:e=>f(`autoApproveWhen`,e),onChange:t=>u({...e,exitTool:{...e.exitTool,id:S,autoApprove:!0,autoApproveWhen:t??void 0}})})})]})]}),(0,Y.jsx)(Z,{icon:(0,Y.jsx)(te,{}),title:`Allowed moves`,children:M})]}),P]}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(q,{title:`Allowed moves`,children:M}),P]})}var Bt=[`autoStartWhen`,`autoApproveWhen`];function Vt({factory:e,boardId:t,phaseKey:n,response:i,skills:a,skillsEditable:s,sidebarHidden:c,onReload:l}){let{board:d,canEdit:f}=i,{draft:p,rawRules:m,locked:h,setDraft:g,setRawRule:_,discard:y}=E(e.id,t,d),[b,x]=(0,J.useState)(0),ee=()=>{y(),x(e=>e+1)},te=me(),D=ve(e.id,t),k=fe(),A=!f||!d.editable,j=n?p.phases.find(e=>e.key===n):void 0,M=j&&`${j.key}:${d.revision??`code`}:${b}`,[N,P]=(0,J.useState)({page:M,fields:[]});N.page!==M&&P({page:M,fields:[]});let ne=N.page===M?N.fields:[],re=(e,t)=>P(n=>{let r=n.fields.filter(t=>t!==e);return{...n,fields:t?[...r,e]:r}}),F=!A&&(v(p,d)||Object.keys(m).length>0||ne.length>0),I=p.phases.filter(e=>S(e,m)||e===j&&ne.length>0),L=p.name.trim()===``,ie=D.error?.code===`revision_mismatch`,ae=pe(({nextLocation:n})=>{let r=k.getQueryData(_e.boardCatalog(e.id))?.boards.some(e=>e.id===t);if(!F||r===!1)return!1;let i=Ee(n.pathname);return i?.factoryId!==e.id||i.boardId!==t||i.skills===!0||i.rules===!0||i.intake===!0});ge(e=>{F&&e.preventDefault()});let oe=G(e.id,t),se;return se=n&&!j?(0,Y.jsx)(r,{titleSlot:(0,Y.jsxs)(`span`,{role:`alert`,children:[d.name,` has no such phase.`]}),actionSlot:(0,Y.jsx)(W,{size:`sm`,render:(0,Y.jsx)(H,{to:oe}),children:`Back to general`})}):j?(0,Y.jsx)(zt,{phase:j,phases:p.phases,requiredNextPhases:d.codeBehaviour?.[j.key]?.requiredNextPhases??[],skills:a,skillsEditable:s,factoryId:e.id,boardId:t,disabled:A||h,rawRules:{autoStartWhen:m[O(j.key,`autoStartWhen`)],autoApproveWhen:m[O(j.key,`autoApproveWhen`)]},onRawRule:(e,t)=>{_(O(j.key,e),t),re(e,!1)},onUnfinished:re,onRemove:A||h||!w(p.phases,j.key,d.codeBehaviour)?void 0:()=>{for(let e of Bt)_(O(j.key,e),void 0);g(e=>({...e,phases:T(e.phases,j.key)})),te(oe)},onChange:e=>g(t=>({...t,phases:t.phases.map(t=>t.key===e.key?e:t)}))},M):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(Ot,{factoryId:e.id,boardId:t,phases:p.phases,skills:a,onAutoStart:A||h?void 0:(e,t)=>{g(n=>({...n,phases:n.phases.map(n=>n.key===e?C(n,t):n)})),t||_(O(e,`autoStartWhen`),void 0)},action:c&&!A?(0,Y.jsx)(u,{factoryId:e.id,boardId:t,board:d,disabled:h}):void 0}),(0,Y.jsx)(X,{pinned:!0,className:`flex flex-col gap-8 empty:hidden`,children:c&&(0,Y.jsx)(q,{title:`Factory`,children:(0,Y.jsx)(R,{children:(0,Y.jsxs)(H,{to:De(e.id,t),className:`hover:bg-fill focus-visible:bg-fill flex items-center gap-3 px-4 py-3 focus-visible:outline-hidden`,children:[(0,Y.jsx)(o,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0}),(0,Y.jsx)(B,{as:`span`,variant:`label`,className:`min-w-0 flex-1 truncate`,children:`Skills`}),(0,Y.jsx)(ce,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0})]})})})})]}),(0,Y.jsxs)(`div`,{className:z(`flex flex-col gap-8 pb-4`,!j&&`w-max min-w-full`),children:[d.editable?!f&&(0,Y.jsx)(X,{pinned:!j,children:(0,Y.jsx)(U,{variant:`info`,children:`Only organization admins can change this board.`})}):(0,Y.jsx)(X,{pinned:!j,children:(0,Y.jsx)(U,{variant:`info`,children:`This board is defined in code, so it can't be changed here.`})}),!j&&d.problems.length>0&&(0,Y.jsx)(X,{pinned:!0,children:(0,Y.jsx)(U,{variant:`warning`,title:`This board has problems`,children:(0,Y.jsx)(U.Message,{children:d.problems.join(` `)})})}),se,F&&(0,Y.jsxs)(X,{pinned:!j,sticky:!0,className:`rounded-card bg-card shadow-overlay dark:bg-muted flex flex-col gap-3 p-3`,children:[ie&&(0,Y.jsx)(U,{variant:`warning`,title:`Someone else changed this board`,action:(0,Y.jsx)(U.Button,{onClick:l,children:`Reload`}),children:(0,Y.jsx)(U.Message,{children:`Reload to see their version. Your unsaved changes will be lost.`})}),D.error&&!ie&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not saved. `,D.error.reasons]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(B,{variant:`body-sm`,tone:`muted`,className:`min-w-0 flex-1`,role:`status`,children:L?`Name the board to save.`:I.length>0?`Fix ${I.map(e=>e.name||e.key).join(`, `)} to save.`:`Unsaved changes`}),(0,Y.jsx)(W,{size:`sm`,variant:`ghost`,disabled:D.isPending,onClick:ee,children:`Discard`}),(0,Y.jsx)(W,{size:`sm`,variant:`primary`,disabled:L||I.length>0,onClick:()=>D.mutate({name:p.name,description:p.description,phases:p.phases,expectedRevision:d.revision??0}),loading:D.isPending,children:`Save`})]})]}),(0,Y.jsx)(K,{open:ae.state===`blocked`,onOpenChange:e=>!e&&ae.reset?.(),children:(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Discard changes to `,d.name,`?`]}),(0,Y.jsx)(K.Description,{children:`Your unsaved changes to this board will be lost.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Keep editing`}),(0,Y.jsx)(W,{variant:`destructive`,size:`md`,onClick:()=>{y(),ae.proceed?.()},children:`Discard`})]})]})})]})}function Ht({name:e,disabled:t,loading:n,onDelete:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(K.Trigger,{render:(0,Y.jsx)(W,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(ht,{}),disabled:t,loading:n,children:`Delete`})}),(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Delete `,e,`?`]}),(0,Y.jsx)(K.Description,{children:`The board and its phases are removed from this project. A board that still has cards can’t be deleted.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Cancel`}),(0,Y.jsx)(K.Action,{onClick:r,children:`Delete`})]})]})]})}function Ut({name:e,disabled:t,loading:n,onReset:r}){return(0,Y.jsxs)(K,{children:[(0,Y.jsx)(K.Trigger,{render:(0,Y.jsx)(W,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(vt,{}),tooltip:`Go back to Factory's version of this board`,tooltipPosition:`bottom`,disabled:t,loading:n,children:`Reset`})}),(0,Y.jsxs)(K.Content,{children:[(0,Y.jsxs)(K.Header,{children:[(0,Y.jsxs)(K.Title,{children:[`Reset `,e,` to default?`]}),(0,Y.jsx)(K.Description,{children:`Every change made to this board's name and phases is replaced with Factory's version.`})]}),(0,Y.jsxs)(K.Footer,{children:[(0,Y.jsx)(K.Cancel,{children:`Cancel`}),(0,Y.jsx)(K.Action,{onClick:r,children:`Reset`})]})]})]})}var $={resting:{label:`Resting`,meaning:`No agent works here. Cards wait for a person or an event to move them.`},working:{label:`Working`,meaning:`An agent works on each card here, following the steps below.`},terminal:{label:`Terminal`,meaning:`Cards are finished here. Their agent sessions stop.`}},Wt=[`resting`,`working`,`terminal`];function Gt({label:e,meaning:t,children:n}){return(0,Y.jsxs)(de,{children:[(0,Y.jsx)(ue,{render:(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":`${e}. ${t}`,className:z(`inline-flex rounded-sm`,V),children:n})}),(0,Y.jsx)(le,{side:`bottom`,className:`max-w-72`,children:t})]})}function Kt({factoryId:e,boardId:t,phaseKey:n,response:r}){let{board:i,canEdit:a}=r,{draft:o,locked:c,setDraft:l,setRawRule:u,discard:d}=E(e,t,i),f=Ae(e),p=me(),m=!a||!i.editable||c,h=xe(e,t),g=ye(e,t,()=>{d();let n=gt(f.data??[]).find(e=>e.id!==t);p(n?_t(e,n.id):`/factories/${e}`,{replace:!0})}),v=!n&&a&&i.editable,y=v&&i.source!==`stored`,b=v&&i.source!==`builtin`,x=n?o.phases.find(e=>e.key===n):void 0;if(n&&!x)return null;let ee=e=>l(t=>({...t,phases:t.phases.map(t=>t.key===n?{...t,...e}:t)})),te=e=>{x&&(u(O(x.key,`autoStartWhen`),void 0),u(O(x.key,`autoApproveWhen`),void 0),l(t=>({...t,phases:t.phases.map(n=>n.key===x.key?_(n,e,t.phases):n)})))},S=x?x.name:o.name,C=(x?x.description:o.description)??``,w=x!==void 0&&!m&&!P(o.phases,x.key,i.codeBehaviour);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(s,{children:[(0,Y.jsxs)(s.Title,{className:`gap-2.5`,children:[x&&(0,Y.jsx)(Fe,{stage:x.key,kind:Ne(t,x.kind),decorative:!0}),(0,Y.jsx)(yt,{value:S,label:x?`Phase name`:`Board name`,required:!0,readOnly:m,variant:`heading`,tone:`ink`,onChange:e=>x?ee({name:e}):l(t=>({...t,name:e}))})]}),x&&(0,Y.jsx)(s.Meta,{beside:!0,children:w?(0,Y.jsxs)(ct,{value:x.kind,onValueChange:e=>{let t=Wt.find(t=>t===e);t&&te(t)},children:[(0,Y.jsx)(at,{size:`sm`,"aria-label":`Phase kind`,children:$[x.kind].label}),(0,Y.jsx)(ot,{children:Wt.map(e=>(0,Y.jsx)(st,{value:e,children:$[e].label},e))})]}):(0,Y.jsx)(Gt,{label:$[x.kind].label,meaning:$[x.kind].meaning,children:(0,Y.jsx)(Ge,{children:$[x.kind].label})})}),(C||!m)&&(0,Y.jsx)(s.Description,{children:(0,Y.jsx)(yt,{value:C,label:x?`Phase description`:`Board description`,placeholder:`Add a description`,multiline:!0,readOnly:m,variant:`caption`,tone:`muted`,className:`zoom-safe-text w-full`,onChange:e=>x?ee({description:e||null}):l(t=>({...t,description:e||null}))})}),(y||b)&&(0,Y.jsxs)(s.Action,{className:`gap-1`,children:[y&&(0,Y.jsx)(Ut,{name:i.name,disabled:c,loading:h.isPending,onReset:()=>h.mutate(i.revision??0)}),b&&(0,Y.jsx)(Ht,{name:i.name,disabled:c,loading:g.isPending,onDelete:()=>g.mutate(i.revision??0)})]})]}),h.error&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not reset. `,h.error.reasons]})}),g.error&&(0,Y.jsx)(U,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(U.Message,{children:[`The board was not deleted. `,g.error.reasons]})})]})}function qt(){let e=p(),i=M(),a=i?.boardId??``,o=i?.phaseKey,{isMobile:s,desktopState:c}=F(),u=s||c===`collapsed`,f=be(e.id,a),m=Ce(e.id),h=f.data?.board,g=k(e.id,a,h),_=o?g?.phases.find(e=>e.key===o):void 0,v=G(e.id,a),y=l({breadcrumbs:u&&h?(0,Y.jsxs)(n,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(t,{as:H,to:_t(e.id,a),children:g?.name||h.name}),o?(0,Y.jsx)(t,{as:H,to:v,children:`Configure`}):(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:`Configure`}),_&&(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:_.name})]}):void 0}),b=f.isSuccess&&(!o||_)?(0,Y.jsx)(Kt,{factoryId:e.id,boardId:a,phaseKey:o,response:f.data},`${a}:${f.data.board.revision??`code`}`):void 0,x=f.isPending?(0,Y.jsx)(R,{children:(0,Y.jsx)(ae,{label:`Loading board`,rows:3})}):f.isError&&f.error instanceof Se&&f.error.code===`board_not_found`?(0,Y.jsx)(r,{variant:`fill`,titleSlot:(0,Y.jsx)(`span`,{role:`alert`,children:`Board unavailable: this board is not installed.`})}):f.isError?(0,Y.jsx)(bt,{title:`Couldn’t load this board`,error:f.error,onRetry:()=>void f.refetch(),retrying:f.isFetching}):(0,Y.jsx)(Vt,{factory:e,boardId:a,phaseKey:o,response:f.data,skills:m.data?.skills,skillsEditable:m.data?.canEdit??!1,sidebarHidden:u,onReload:()=>void f.refetch()},`${a}:${f.data.board.revision??`code`}`);return o?(0,Y.jsx)(d,{variant:`settings`,header:b,...y,children:x}):(0,Y.jsx)(d,{variant:`page`,body:`fixed`,header:b&&(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:b}),...y,children:(0,Y.jsx)(`div`,{className:f.isSuccess?St:z(xt,`px-4`),children:x})})}export{qt as BoardConfigPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{s as r}from"./useBoardCatalog-
|
|
1
|
+
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{s as r}from"./useBoardCatalog-DC55UfJd.js";import{B as i}from"./useSessionRows-CIakAaqj.js";import{i as a,n as o,o as s,r as c}from"./TrashIcon.es-DoCvaCDh.js";import{t as l}from"./IconCircleDashed.es-CrssFpNj.js";import{t as u}from"./IconCircleX.es-Bah9f48z.js";import{n as d}from"./IconSettingsSliderHor.es-VS_Cfpz8.js";import{t as f}from"./IconCircleCheck.es-D6u0E19o.js";var p=e();function m({size:e=16,className:t}){return(0,p.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:t,"aria-hidden":!0,children:(0,p.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 14.67C11.68 14.67 14.67 11.68 14.67 8C14.67 4.32 11.68 1.33 8 1.33C4.32 1.33 1.33 4.32 1.33 8C1.33 11.68 4.32 14.67 8 14.67ZM9.14 5.53C8.88 5.27 8.46 5.27 8.2 5.53C7.93 5.79 7.93 6.21 8.2 6.47L9.06 7.33H5.33C4.97 7.33 4.67 7.63 4.67 8C4.67 8.37 4.97 8.67 5.33 8.67H9.06L8.2 9.53C7.93 9.79 7.93 10.21 8.2 10.47C8.46 10.73 8.88 10.73 9.14 10.47L11.14 8.47C11.4 8.21 11.4 7.79 11.14 7.53L9.14 5.53Z`,fill:`currentColor`})})}var h=n(`IconPlay`,()=>(0,p.jsx)(`path`,{d:`M20.245 10.2984L9.05099 3.38443C7.71854 2.56145 6 3.51992 6 5.08603V18.914C6 20.4801 7.71854 21.4385 9.05098 20.6156L20.245 13.7016C21.5104 12.9201 21.5104 11.0799 20.245 10.2984Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`})),g=n(`IconHammer`,()=>(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`path`,{d:`M6.70694 14.7929C6.31641 15.1834 5.68325 15.1834 5.29272 14.7929L2.45696 11.9571C2.06643 11.5666 2.06643 10.9334 2.45696 10.5429L9.70694 3.29289C9.89447 3.10536 10.1488 3 10.414 3L14.0857 3C14.3509 3 14.6052 3.10536 14.7928 3.29289L15.7927 4.29286C16.1832 4.68338 16.1832 5.31655 15.7927 5.70707L6.70694 14.7929Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,p.jsx)(`path`,{d:`M9.5 12.5L16.3358 19.3358C17.1168 20.1168 18.3832 20.1168 19.1642 19.3358L19.3358 19.1642C20.1168 18.3832 20.1168 17.1168 19.3358 16.3358L12.5 9.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}));function _({source:e,className:n}){let{Icon:r,iconClassName:a}=i[e];return(0,p.jsx)(r,{"data-source":e,className:t(`size-4 shrink-0`,a,n),"aria-hidden":!0})}var v={Investigate:d,Build:g,"Prepare approval":o,Review:c};function y(e){let t=v[e]??h;return(0,p.jsx)(t,{"aria-hidden":!0})}var b={resting:`neutral`,working:`info`,terminal:`success`},x={neutral:{icon:`text-muted-foreground`,tint:`bg-fill-subtle`,strongTint:`bg-fill-strong`,gradientFrom:`from-fill-subtle`},orange:{icon:`text-(--orange-500) dark:text-(--orange-400)`,tint:`bg-badge-orange-subtle`,strongTint:`bg-badge-orange-strong`,gradientFrom:`from-badge-orange-subtle`},cyan:{icon:`text-(--cyan-500) dark:text-(--cyan-400)`,tint:`bg-badge-cyan-subtle`,strongTint:`bg-badge-cyan-strong`,gradientFrom:`from-badge-cyan-subtle`},info:{icon:`text-info-indicator`,tint:`bg-info-subtle`,strongTint:`bg-badge-blue-strong`,gradientFrom:`from-badge-blue-subtle`},green:{icon:`text-badge-green-indicator`,tint:`bg-badge-green-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},purple:{icon:`text-badge-purple-indicator`,tint:`bg-badge-purple-subtle`,strongTint:`bg-badge-purple-strong`,gradientFrom:`from-badge-purple-subtle`},success:{icon:`text-(--green-500) dark:text-(--green-400)`,tint:`bg-success-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},destructive:{icon:`text-destructive-indicator`,tint:`bg-destructive-subtle`,strongTint:`bg-badge-red-strong`,gradientFrom:`from-badge-red-subtle`}};function S({source:e,className:n}){return(0,p.jsx)(`span`,{"aria-hidden":!0,style:{maskImage:`url(${e})`},className:t(`size-4 shrink-0 bg-current mask-center mask-no-repeat mask-contain`,n)})}var C=2.25,w=2*Math.PI*C;function T({progress:e,className:n}){return(0,p.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,className:t(`shrink-0`,n),children:[(0,p.jsx)(`circle`,{cx:8,cy:8,r:6,stroke:`currentColor`,strokeWidth:1.5}),(0,p.jsx)(`circle`,{cx:8,cy:8,r:C,stroke:`currentColor`,strokeWidth:C*2,strokeDasharray:`${e*w} ${w}`,transform:`rotate(-90 8 8)`})]})}function E(e,t){return t?void 0:a(e)}function D(e,t){return e===`work`||e===`review`?void 0:t}function O(e,t){let n=r(e,t);return e&&n?D(e.id,n):void 0}function k(e,t){let n=E(e,t);return n?s(n):b[t??`resting`]}function A({stage:e,kind:n,className:r}){let i=t(`shrink-0`,r);switch(E(e,n)??n??`resting`){case`intake`:return(0,p.jsx)(m,{className:i});case`triage`:return(0,p.jsx)(S,{source:`/factory-stage-icons/triage.svg`,className:r});case`planning`:return(0,p.jsx)(T,{progress:.25,className:r});case`execute`:case`working`:return(0,p.jsx)(T,{progress:.5,className:r});case`review`:case`pr-review`:return(0,p.jsx)(S,{source:`/factory-stage-icons/review.svg`,className:r});case`done`:case`terminal`:return(0,p.jsx)(f,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`canceled`:return(0,p.jsx)(u,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`resting`:return(0,p.jsx)(l,{"aria-hidden":!0,className:t(`size-icon-md`,i)})}}function j(e,t){return x[k(e,t)].tint}function M(e,n){return t(`bg-fill-subtle dark:bg-card bg-linear-to-r to-transparent`,x[k(e,n)].gradientFrom)}function N(e,t){return x[k(e,t)].strongTint}function P(e,t){return x[k(e,t)].icon}var F=`opacity-30`;function I({stage:e,kind:t,decorative:n=!1}){let r=(0,p.jsx)(A,{stage:e,kind:t,className:x[k(e,t)].icon});return n||!t?r:(0,p.jsx)(`span`,{role:`img`,"aria-label":`${t} phase`,className:`inline-flex shrink-0`,children:r})}export{D as a,N as c,h as d,m as f,O as i,j as l,_ as n,P as o,y as r,M as s,I as t,F as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Fr as t,Nr as n,Pr as r,Tr as i,tn as a}from"./index-Btp5jnxM.js";import{n as o,t as s}from"./Breadcrumb.es-DRA_fT-0.js";import{a as c}from"./Sidebar.es-B464rGRm.js";import{$n as l,n as u,ni as d}from"./GithubIcon.es-CIm0nGDf.js";import{r as f}from"./useBoardEditor-DFyQuLCD.js";import{a as p,n as m,s as h,t as g}from"./boardConfigPaths-Btimpi_r.js";import{k as _}from"./TabsRoot-MM_4fh4A.js";import{yt as v}from"./useSessionRows-CIakAaqj.js";import{O as y,T as b,k as x,n as S}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{o as C,s as w,t as T,u as E}from"./settings-C5r2ThW9-DgHKaQxx.js";import{a as D,c as O,d as k,i as A,l as j,n as M,o as N,r as P,t as F,u as I}from"./useRowDrag-B2rvWAzw.js";import{o as L}from"./useIntakeRoutes-C2h717K6.js";import{h as R,p as z}from"./ruleLanes-CB6XWPZ9.js";import{s as B}from"./Field.es-BgoAtL-2.js";import{n as V}from"./useBoardCatalog-DC55UfJd.js";import{t as H}from"./SettingsSubsection-D1Yp4Ujt.js";import{s as U}from"./settingsSections-XZPX_pR6.js";var W=e(x(),1),G=y();function K({factoryId:e}){let t=A(e),n=D(e),r=new Map((V(e).data??[]).map(e=>[e.id,e.name])),i=t.data?.pages??[],a=i.flatMap(e=>e.notRouted),o=i[0]?.canEdit??!1,s=e=>n.mutate(e.id,{onSuccess:t=>v.success(`Filing “${e.title}” on ${r.get(t.boardKey)??t.boardKey}.`),onError:e=>v.error(e.message)}),c=t.isPending?`Loading…`:t.isError?`Items not routed didn’t load.`:t.hasNextPage?`${a.length>0?`${a.length}+`:`More`} waiting for a board.`:a.length===0?`Every new issue and pull request found a board.`:`${a.length} waiting for a board.`;return(0,G.jsxs)(`section`,{id:m,"aria-label":`Not routed`,className:`flex scroll-mt-4 flex-col gap-3 px-3.5 pt-3 pb-3.5`,children:[(0,G.jsx)(C,{media:(0,G.jsx)(w,{children:(0,G.jsx)(j,{})}),title:(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Not routed`,(0,G.jsx)(B,{"aria-label":`When an item is not routed`,children:`A new issue or pull request ends up here when no board’s rules take it. Change a board’s rules, then route it again.`})]}),description:c}),(a.length>0||t.hasNextPage)&&(0,G.jsxs)(`ul`,{"aria-label":`Items not routed`,className:`ml-11 flex flex-col`,children:[a.map(t=>(0,G.jsx)(`li`,{className:`border-border border-t py-3`,children:(0,G.jsxs)(C,{title:t.url?(0,G.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,className:`hover:underline`,children:t.title}):t.title,description:(0,G.jsxs)(`span`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[t.sourceKey&&(0,G.jsx)(`span`,{children:t.sourceKey}),(0,G.jsx)(`span`,{children:t.reason??`No board’s rules match it.`}),(0,G.jsx)(`time`,{dateTime:t.decidedAt,children:q(t.decidedAt)})]}),children:[(0,G.jsx)(M,{factoryProjectId:e,itemId:t.id,label:`Why?`}),o&&(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>s(t),loading:n.isPending&&n.variables===t.id,children:`Route again`})]})},t.id)),t.hasNextPage&&(0,G.jsx)(`li`,{className:`border-border flex justify-center border-t pt-3`,children:(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>void t.fetchNextPage(),loading:t.isFetchingNextPage,children:`Load more`})})]})]})}function q(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var J=b(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:top-0 data-[drop=before]:before:block data-[drop=after]:before:bottom-0 data-[drop=after]:before:block`);function Y({factoryId:e}){let t=P(e);return(0,G.jsx)(H,{id:g,scope:`factory`,title:`Intake order`,description:`A new issue or pull request is offered to each board in this order. The first board whose rules take it keeps it.`,children:t.isPending?(0,G.jsx)(T,{children:(0,G.jsx)(E,{label:`Loading intake order`,variant:`item`,rows:3})}):t.isError?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(u,{variant:`destructive`,children:`The intake order didn’t load.`}),(0,G.jsx)(`div`,{className:`border-border rounded-xl border`,children:(0,G.jsx)(K,{factoryId:e})})]}):(0,G.jsx)(X,{factoryId:e,order:t.data},e)})}function X({factoryId:e,order:t}){let n=L(e),r=N(e),[i,a]=(0,W.useState)(),o=t.boards.map(e=>e.boardKey),s=i&&$(i,o)?i:void 0,c=s??o,f=new Map(t.boards.map(e=>[e.boardKey,e.name])),p=s!==void 0&&s.some((e,t)=>e!==o[t]),m=(e,t)=>{let n=[...c],[r]=n.splice(e,1);r!==void 0&&(n.splice(t,0,r),a(n))},g=F({min:0,max:c.length-1,onDrop:m}),_=()=>r.mutate(c,{onSuccess:()=>{a(void 0),v.success(`Intake order saved.`)},onError:e=>v.error(e.message)}),y=t.canEdit&&c.length>1,x=y&&!r.isPending;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(Q,{order:t,changed:p}),n.isError&&(0,G.jsx)(u,{variant:`warning`,children:`Rule counts didn’t load.`}),(0,G.jsxs)(`div`,{className:`border-border flex flex-col rounded-xl border`,children:[(0,G.jsx)(T,{role:`list`,"aria-label":`Intake order`,children:c.map((t,r)=>{let i=g.drag?.from===r,a=f.get(t)??t;return(0,G.jsx)(C,{role:`listitem`,"data-drop":g.dropAt(r),style:i?{transform:`translateY(${g.drag?.offset??0}px)`}:void 0,onPointerDown:x?e=>g.onPointerDown(e,r):void 0,onKeyDown:x?e=>g.onKeyDown(e,r):void 0,className:b(`group/row`,J,i&&`z-10 opacity-90`),media:(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{as:`span`,variant:`caption`,className:b(`tabular-nums`,y&&`pointer-fine:group-hover/row:hidden`,i&&`hidden`),children:r+1}),y&&(0,G.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:b(`text-icon3 hidden cursor-grab touch-none pointer-fine:group-hover/row:inline-flex`,i&&`inline-flex`),children:(0,G.jsx)(O,{className:`size-icon-md`})})]}),title:a,description:(0,G.jsx)(Z,{routes:n.data?.intakeRoutes,boardKey:t}),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1 transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/row:opacity-100 pointer-fine:group-hover/row:opacity-100`,children:[y&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(d,{size:`icon-sm`,variant:`ghost`,tooltip:`Check earlier`,disabled:!x||r===0,onClick:()=>m(r,r-1),children:(0,G.jsx)(I,{})}),(0,G.jsx)(d,{size:`icon-sm`,variant:`ghost`,tooltip:`Check later`,disabled:!x||r===c.length-1,onClick:()=>m(r,r+1),children:(0,G.jsx)(k,{})})]}),(0,G.jsx)(d,{size:`sm`,variant:`ghost`,render:(0,G.jsx)(l,{to:h(e,t)}),children:`Edit rules`})]})},t)})}),(0,G.jsx)(K,{factoryId:e})]}),t.canEdit&&p&&(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(d,{size:`sm`,variant:`ghost`,onClick:()=>a(void 0),disabled:r.isPending,children:`Discard`}),(0,G.jsx)(d,{size:`sm`,variant:`primary`,onClick:_,loading:r.isPending,children:`Save order`})]})]})}function Z({routes:e,boardKey:t}){if(!e)return null;let{count:n,catchesAll:r}=z(e.filter(e=>e.target.boardKey===t));return(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{children:n===0?`No rules for new issues and pull requests`:`${R(n)} for new issues and pull requests`}),r&&(0,G.jsx)(_,{children:`Ends in catch-all`})]})}function Q({order:e,changed:t}){let{compared:n,differing:r,notRouted:i}=e.comparison,a=[];if(e.origin===`derived`&&a.push(`Worked out from the old route list until someone saves an order.`),n>0){let e=i>0?`, ${i} of them Not routed`:``;a.push(r===0?`The last ${n} cards land on the same boards as with the old route list.`:`Of the last ${n} cards, ${r} would land on another board than with the old route list${e}.`)}return e.evaluator===`route-list`&&a.push(`Intake still files cards by the old route list.`),t&&a.push(`Not saved yet. The comparison is for the saved order.`),a.length===0?null:(0,G.jsx)(u,{variant:`info`,children:(0,G.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,G.jsx)(`span`,{children:e},e))})})}function $(e,t){let n=new Set(t);return e.length===t.length&&e.every(e=>n.has(e))}function ee(){let e=i(),u=a()?.boardId??``,{isMobile:d,desktopState:m}=c(),h=d||m===`collapsed`,g=f(e.id,u).data?.board,_=n({breadcrumbs:h&&g?(0,G.jsxs)(s,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,G.jsx)(o,{as:l,to:p(e.id,u),children:g.name}),(0,G.jsx)(o,{as:`span`,isCurrent:!0,children:`Routing`})]}):void 0});return(0,G.jsx)(r,{variant:`settings`,header:(0,G.jsxs)(t,{children:[(0,G.jsx)(t.Title,{children:`Routing`}),(0,G.jsx)(t.Description,{children:(0,G.jsxs)(`span`,{children:[`The order boards are offered new issues and pull requests. What comes in is chosen in`,` `,(0,G.jsx)(l,{to:U(e.id,`intake`),className:`underline`,children:`Settings → Work Intake`}),`.`]})})]}),..._,children:(0,G.jsx)(Y,{factoryId:e.id})})}export{ee as BoardIntakePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,Fr as n,Jn as r,Kn as i,Nr as a,Pr as o,Tr as s,Yn as c,qn as l,tn as u}from"./index-Btp5jnxM.js";import{n as d,t as f}from"./Breadcrumb.es-DRA_fT-0.js";import{a as p}from"./Sidebar.es-B464rGRm.js";import{$n as m,At as h,Dt as ee,St as g,ir as _,jt as v,kt as y,n as b,ni as x,t as S,wt as C}from"./GithubIcon.es-CIm0nGDf.js";import{r as w,t as T}from"./useBoardEditor-DFyQuLCD.js";import{a as E,i as D,o as O,s as k,t as A}from"./boardConfigPaths-Btimpi_r.js";import{r as j}from"./CompositeItem-DXJX9-KR.js";import{yt as M}from"./useSessionRows-CIakAaqj.js";import{d as N,n as te}from"./settings-C5r2ThW9-DgHKaQxx.js";import{O as P,T as F,k as I,n as L}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as R}from"./useBoardCatalog-DC55UfJd.js";import{c as ne,d as re,l as z,n as B,r as ie,s as V,t as H,u as U}from"./useRowDrag-B2rvWAzw.js";import{a as ae,d as oe,f as se,g as W,o as ce,r as G,s as le}from"./useIntakeRoutes-C2h717K6.js";import{C as ue,E as de,_ as fe,a as pe,c as K,d as me,f as he,g as ge,i as _e,l as q,m as ve,n as ye,o as be,s as xe,u as J,w as Se}from"./ruleLanes-CB6XWPZ9.js";import{t as Y}from"./createLucideIcon-BHFyd0LL.js";import{a as Ce,t as we}from"./BoardIcons-ChSrt-Ky.js";import{t as Te}from"./input-DqReKX0A-D66C6dWr.js";import{n as Ee,t as De}from"./RadioGroup.es-DQfIiNtD.js";import{n as Oe,t as ke}from"./ConditionRows-mhryClJA.js";import{i as X,k as Ae}from"./TabsRoot-MM_4fh4A.js";import{E as je}from"./combobox-parts-BVuRAhY6-ClaPtI8E.js";var Me={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Me.node;var Ne=Y(Me),Pe={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Pe.node;var Fe=Y(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var Le=Y(Ie),Re={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Re.node;var ze=Y(Re),Be={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Be.node;var Ve=Y(Be),He={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};He.node;var Ue=Y(He),We={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};We.node;var Ge=Y(We),Ke={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};Ke.node;var qe=Y(Ke),Je={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Je.node;var Ye=Y(Je),Xe={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Xe.node;var Ze=Y(Xe),Qe={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Qe.node;var $e=Y(Qe),Z=e(I(),1),Q=P();function et({when:e,options:t,everything:n}){let r=ue(e,t);return!e||!r?(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:n}):(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:r.parts.map((t,n)=>{let i=e.conditions[n],a=i&&`conditions`in i?i:void 0;return(0,Q.jsxs)(`span`,{className:`contents`,children:[n>0&&(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,children:r.join}),a?(0,Q.jsxs)(`span`,{className:`border-border inline-flex max-w-full items-center gap-1 rounded-md border border-dashed px-1 py-0.5`,children:[(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,children:a.operator===`OR`?`any of`:`all of`}),(0,Q.jsx)(tt,{children:t.replace(/^\((.*)\)$/,`$1`)})]}):(0,Q.jsx)(tt,{children:t})]},n)})})}function tt({children:e}){return(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`bg-fill max-w-full truncate rounded-sm px-1.5 py-0.5`,children:e})}function nt({boards:e,ownBoard:t,boardKey:n,phaseKey:r}){let a=e.find(e=>e.id===n);if(!a)return(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,children:[n,` (not installed)`]});let o=r??a.initialPhase,s=a.phases.find(e=>e.id===o);return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[a.id!==t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`truncate`,children:i(a)}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:`›`})]}),s&&(0,Q.jsx)(we,{stage:s.id,kind:Ce(a.id,s.kind),decorative:!0}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`truncate`,children:l(a,o)??o})]})}function rt({factoryId:e,rules:t,board:n,boards:a}){return(0,Q.jsxs)(`section`,{"aria-label":`From other boards`,className:`border-border mt-3 flex flex-col gap-1.5 border-t pt-3`,children:[(0,Q.jsxs)(L,{as:`h4`,variant:`meta`,tone:`muted`,className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(qe,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),`From other boards`]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(t=>{let o=a.find(e=>e.id===t.target.boardKey);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(m,{to:k(e,t.target.boardKey),"aria-label":`${t.name}, on ${o?i(o):t.target.boardKey}`,className:F(`group flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,!t.enabled&&`opacity-50`),children:[(0,Q.jsxs)(`span`,{className:`border-border group-hover:border-border-hover flex w-full min-w-0 flex-col gap-1 rounded-lg border border-dashed px-3 py-2 sm:flex-1`,children:[(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:o?i(o):`${t.target.boardKey} (not installed)`}),(0,Q.jsx)(et,{when:t.when,options:r(o),everything:`Every card`})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 shrink-0 items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`border-border-strong h-0 w-8 shrink-0 border-t border-dashed`}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex w-44 shrink-0 items-center px-3 py-2`,children:(0,Q.jsx)(nt,{boards:a,ownBoard:n.id,boardKey:n.id,phaseKey:t.target.phaseKey})})]}),!t.enabled&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,children:`Off`})]})},t.id)})})]})}function it({factoryId:e,boardKey:t,order:n,evaluator:r}){let i=n.some(e=>e.boardKey===t);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[r===`route-list`?(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`Intake still files new issues and pull requests by the old route list, not by board.`}):i?(0,Q.jsxs)(`ol`,{"aria-label":`Intake order`,className:`flex flex-wrap items-center gap-1`,children:[n.map(n=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`li`,{children:n.boardKey===t?(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,"aria-current":`step`,className:`bg-surface3 rounded-md px-2 py-0.5 font-medium`,children:n.name}):(0,Q.jsx)(m,{to:k(e,n.boardKey),className:`text-muted-foreground hover:text-foreground rounded-md px-2 py-0.5`,children:(0,Q.jsx)(L,{as:`span`,variant:`caption`,children:n.name})})}),(0,Q.jsx)(Le,{"aria-hidden":!0,className:`text-muted-foreground size-icon-xs shrink-0`})]},n.boardKey)),(0,Q.jsx)(`li`,{children:(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`px-2 py-0.5`,children:`Not routed`})})]}):(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`Not in the intake order: new issues and pull requests never reach these rules.`}),(0,Q.jsxs)(m,{to:O(e,t,A),className:`text-muted-foreground hover:text-foreground flex items-center gap-1.5`,children:[(0,Q.jsx)(Ge,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,className:`underline decoration-dotted underline-offset-2`,children:`Reorder`})]})]})}var at=`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,ot=`border-border-focus bg-fill-hover`,st=`border-border bg-fill-subtle hover:border-border-hover hover:bg-fill-hover`;function ct({selected:e,disabled:t,onClick:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,onClick:n,className:F(at,`disabled:opacity-50`,e?ot:st),children:r})}function lt({value:e,selected:t,disabled:n,onClick:r,children:i}){let a=(0,Z.useId)();return(0,Q.jsxs)(`label`,{onClick:r,className:F(at,`has-[[role=radio]:focus-visible]:outline-border-focus has-[[role=radio]:focus-visible]:outline-1 has-[[role=radio]:focus-visible]:outline-solid`,t?ot:st,n?`cursor-not-allowed opacity-50`:`cursor-pointer`),children:[(0,Q.jsx)(Ee,{value:e,disabled:n,"aria-labelledby":a,className:`sr-only`}),(0,Q.jsx)(`span`,{id:a,className:`flex min-w-0 items-start gap-3`,children:i})]})}function ut(){return(0,Q.jsx)(Ae,{size:`xs`,variant:`neutral`,emphasis:`subtle`,icon:(0,Q.jsx)(S,{"aria-hidden":`true`}),children:`GitHub only`})}var dt=120,ft=W(le),$=[{id:`trigger`,title:`Trigger`,question:`What should this rule listen for?`},{id:`conditions`,title:`Only if`,question:`Which items should it apply to?`},{id:`action`,title:`Move to`,question:`Where should it go?`},{id:`review`,title:`Review`,question:`Name and check your rule`}];function pt(e,t){let n=e?.phases??[];return t?n.filter(e=>e.kind!==`terminal`):n}function mt(e,t){if(t){let e=ft.safeParse(t);if(!e.success)return e.error.issues[0]?.message}return se(e,t)??void 0}function ht(e,t,n){let r=`When ${e.map(e=>J(e).label.toLowerCase()).join(` or `)}${t?`, ${Se(t).charAt(0).toLowerCase()}${Se(t).slice(1)}`:``}, move to ${n}`;return r.length>dt?`${r.slice(0,119)}…`:r}function gt({factoryId:e,board:t,boards:n,initial:a,initialEvent:o,initialStep:s,readOnly:c,saving:u,error:d,onSave:f,onClose:p}){let m=Oe(e),[_,S]=(0,Z.useState)(()=>a?.on??(o?[o]:[])),[w,T]=(0,Z.useState)(()=>a?.when??null),[E,D]=(0,Z.useState)(()=>(a?.when?.conditions.length??0)>0),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(()=>a?.target.moveToBoardKey??t.id),[M,N]=(0,Z.useState)(()=>a?a.target.phaseKey??void 0:void 0),[te,P]=(0,Z.useState)(()=>a?.name),[I,R]=(0,Z.useState)(s),[ne,re]=(0,Z.useState)(0),z=ve(_),B=n.find(e=>e.id===A),ie=pt(B,z),V=ie.find(e=>e.id===(M??B?.initialPhase)),H=E?w:null,U=_.length?mt(_,H):void 0,ae=V&&B?`${i(B)} › ${l(B,V.id)}`:``,se=te??(V?ht(_,H,ae):``),W={trigger:_.length>0,conditions:_.length>0&&!(E&&O)&&!U,action:V!==void 0,review:se.trim().length>0},ce=!c&&W.trigger&&W.conditions&&W.action&&W.review,G=$.findIndex(e=>e.id===I),le=$[G]??$[0],ue=e=>{S(e),ve(e)&&A!==t.id&&(j(t.id),N(void 0))},fe=()=>{ce&&V&&f({name:se.trim(),on:_,when:H,target:{phaseKey:V.id,moveToBoardKey:A===t.id?null:A}})},pe=()=>{let e={field:`pullRequest.trusted`,operator:`equals`,value:!0};T(H===null?{operator:`AND`,conditions:[e]}:H.operator===`AND`?{...H,conditions:[...H.conditions,e]}:{operator:`AND`,conditions:[H,e]}),D(!0),k(!1),re(e=>e+1)},K={trigger:_.length?_.map(e=>J(e).label).join(`, `):void 0,conditions:_.length?Se(H,r(t)):void 0,action:V?(0,Q.jsx)(nt,{boards:n,ownBoard:t.id,boardKey:A,phaseKey:V.id}):void 0,review:void 0};return(0,Q.jsx)(g,{open:!0,onOpenChange:e=>!e&&p(),children:(0,Q.jsxs)(ee,{size:`xl`,children:[(0,Q.jsx)(h,{children:(0,Q.jsx)(v,{children:c?`Rule`:a?`Edit rule`:`Add rule`})}),(0,Q.jsx)(C,{children:(0,Q.jsxs)(`div`,{className:`grid min-h-105 grid-cols-1 gap-6 sm:grid-cols-[12rem_1fr]`,children:[(0,Q.jsx)(`nav`,{"aria-label":`Rule steps`,className:`sm:border-border flex gap-1 overflow-x-auto sm:flex-col sm:border-r sm:pr-4`,children:$.map((e,t)=>{let n=t===0||$.slice(0,t).every(e=>W[e.id]),r=W[e.id]&&e.id!==`review`;return(0,Q.jsxs)(`button`,{type:`button`,disabled:!n,"aria-current":I===e.id?`step`:void 0,onClick:()=>R(e.id),className:F(`flex shrink-0 items-start gap-2.5 rounded-lg px-2 py-2 text-left transition-colors disabled:opacity-40`,I===e.id?`bg-fill-hover`:`hover:bg-fill-subtle`),children:[(0,Q.jsx)(L,{as:`span`,variant:`meta`,className:F(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border`,r?`border-transparent bg-fill-inverse text-background`:`border-border-strong`),children:r?(0,Q.jsx)(Fe,{className:`size-icon-xs`,"aria-hidden":!0}):t+1}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e.title}),K[e.id]&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`hidden truncate sm:block`,children:K[e.id]})]})]},e.id)})}),(0,Q.jsxs)(`section`,{"aria-label":le.title,className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(L,{as:`h3`,variant:`heading`,children:le.question}),I===`trigger`&&(0,Q.jsx)(yt,{value:_,disabled:c,onChange:ue}),I===`conditions`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(De,{"aria-label":`Which ones`,value:E?`matching`:`every`,disabled:c,onValueChange:e=>{D(e===`matching`),k(!1)},className:`grid-cols-1 sm:grid-cols-2`,children:[(0,Q.jsx)(lt,{value:`every`,selected:!E,disabled:c,children:(0,Q.jsx)(_t,{title:z?`Every new one`:`Every card`,hint:`Run whenever this happens.`})}),(0,Q.jsx)(lt,{value:`matching`,selected:E,disabled:c,children:(0,Q.jsx)(_t,{title:`Only ones that match`,hint:`Narrow it down by repository, label, author and more.`})})]}),E&&(0,Q.jsx)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-3`,children:(0,Q.jsx)(ke,{label:`Conditions`,rule:w,facts:de(_),options:{...r(t),"source.repository":m},onChange:(e,t)=>{T(e),k(t)}},ne)}),U&&(0,Q.jsx)(b,{variant:`warning`,children:U}),!a?.outsiderPullRequestsGated&&oe(_,H)&&(0,Q.jsx)(b,{variant:`info`,children:(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{children:`Also matches pull requests from outside authors.`}),!c&&(0,Q.jsx)(`button`,{type:`button`,onClick:pe,className:`shrink-0 underline`,children:`Add: Pull request trusted is yes`})]})})]}),I===`action`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[z?(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:`An item with no card yet can only be filed on this board.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Board`}),(0,Q.jsx)(De,{"aria-label":`Board`,value:A,disabled:c,onValueChange:e=>{typeof e==`string`&&e!==A&&(j(e),N(void 0))},className:`grid-cols-1 sm:grid-cols-3`,children:n.map(e=>(0,Q.jsx)(lt,{value:e.id,selected:e.id===A,disabled:c,children:(0,Q.jsxs)(L,{as:`span`,variant:`label`,tone:`ink`,children:[i(e),e.id===t.id?` (this board)`:``]})},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Phase`}),(0,Q.jsx)(De,{"aria-label":`Phase`,value:V?.id??null,disabled:c,onValueChange:e=>typeof e==`string`&&N(e),className:`grid-cols-1 sm:grid-cols-2`,children:B&&ie.map(e=>(0,Q.jsx)(lt,{value:e.id,selected:e.id===V?.id,disabled:c,onClick:()=>{N(e.id),R(`review`)},children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(we,{stage:e.id,kind:Ce(B.id,e.kind),decorative:!0}),(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,children:l(B,e.id)})]})},e.id))})]})]}),I===`review`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`muted`,children:`Name`}),(0,Q.jsx)(Te,{value:se,maxLength:dt,disabled:c,onChange:e=>P(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-4`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,className:`mb-3 block`,children:`This rule reads as`}),(0,Q.jsxs)(`ol`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(vt,{label:`When`,children:K.trigger}),(0,Q.jsx)(vt,{label:`Only if`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ve,{className:`text-muted-foreground size-icon-sm`,"aria-hidden":!0}),K.conditions]})}),(0,Q.jsx)(vt,{label:`Then`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Move to `,(0,Q.jsx)(Ne,{className:`size-icon-sm`,"aria-hidden":!0}),` `,K.action]})})]})]})]}),d&&(0,Q.jsx)(b,{variant:`destructive`,role:`alert`,children:d})]})]})}),(0,Q.jsxs)(y,{children:[(0,Q.jsx)(x,{variant:`ghost`,onClick:p,children:c?`Close`:`Cancel`}),(0,Q.jsx)(`div`,{className:`flex-1`}),G>0&&(0,Q.jsx)(x,{variant:`default`,onClick:()=>R($[G-1].id),children:`Back`}),!c&&(I===`review`||a&&ce?(0,Q.jsx)(x,{variant:`primary`,disabled:!ce,onClick:fe,loading:u,children:a?`Save rule`:`Create rule`}):(0,Q.jsx)(x,{variant:`primary`,disabled:!W[I],onClick:()=>R($[G+1]?.id??`review`),children:`Continue`}))]})]})})}function _t({title:e,hint:t}){return(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(L,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e}),(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`block`,children:t})]})}function vt({label:e,children:t}){return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] items-start gap-3`,children:[(0,Q.jsx)(L,{as:`span`,variant:`body-sm`,tone:`muted`,children:e}),(0,Q.jsx)(L,{as:`span`,variant:`body-sm`,children:t})]})}function yt({value:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.includes(`work_item.created`)&&(0,Q.jsxs)(b,{variant:`info`,children:[`Also listens on “`,J(`work_item.created`).label,`”, which takes new issues and pull requests. Saving keeps it.`]}),ye.map(r=>(0,Q.jsxs)(`div`,{role:`group`,"aria-label":r.title,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(L,{as:`span`,variant:`eyebrow`,tone:`muted`,children:r.title}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:r.events.map(r=>{let i=J(r),a=i.icon,o=e.includes(r);return(0,Q.jsxs)(ct,{selected:o,disabled:t||o&&e.length===1,onClick:()=>n(o?e.filter(e=>e!==r):[...e,r]),children:[(0,Q.jsx)(a,{className:`text-badge-amber-indicator mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(_t,{title:i.label,hint:i.description}),i.githubOnly&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Q.jsx)(ut,{})})]},r)})})]},r.title))]})}function bt({count:e,into:t,leaving:n,showAll:r}){let i=n?`sending cards to ${t}`:`moving cards into ${t}`;return(0,Q.jsxs)(`div`,{className:`border-border flex items-center gap-2 rounded-lg border px-3 py-2`,children:[(0,Q.jsx)(Ue,{className:`size-icon-md text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`p`,variant:`body-sm`,tone:e===void 0?`muted`:`ink`,className:`flex-1`,children:e===void 0?`Couldn’t pick out the rules ${i}, so every rule is shown.`:e===0?`No rule is ${i}.`:`Only the ${e===1?`rule`:`${e} rules`} ${i}.`}),(0,Q.jsx)(x,{size:`sm`,variant:`ghost`,render:(0,Q.jsx)(m,{to:r}),children:`Show all`})]})}var xt=F(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:-top-1 data-[drop=before]:before:block data-[drop=after]:before:-bottom-1 data-[drop=after]:before:block`);function St({event:e,rules:t,board:n,boards:r,phaseOptions:a,canEdit:o,skips:s,footer:c,incoming:u,only:d,onEdit:f,onAdd:p,onMove:m,onToggle:h,onDelete:ee,onUngate:g}){let _=J(e),v=_.icon,y=pe(t,e),b=K(e),S=be(e),C=H({min:0,max:t.length-1,onDrop:m}),w=o&&t.length>1&&!d,T=c??(t.length?`Otherwise, the card stays where it is`:u?`No rules: this board’s cards stay where they are`:`No rules: the card stays where it is`);return(0,Q.jsxs)(`section`,{"aria-label":_.label,className:F(`flex flex-col gap-3 rounded-xl border border-border bg-card p-4`,!t.length&&!u&&`opacity-60 focus-within:opacity-100 hover:opacity-100`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(v,{className:`text-badge-amber-indicator size-3.5 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(L,{as:`h3`,variant:`label`,tone:`ink`,children:_.label}),_.githubOnly&&(0,Q.jsx)(ut,{})]}),_.description&&(0,Q.jsx)(L,{as:`p`,variant:`caption`,tone:`muted`,children:_.description})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`${_.label} rules`,className:`flex min-w-0 flex-col`,children:[t.map((c,u)=>{if(d&&!d.has(c.id))return null;let p=ge(t,e,u),v=p>=0,T=!c.enabled||v,E=C.drag?.from===u,D=s?.get(c.id),O=r.find(e=>e.id===(c.target.moveToBoardKey??c.target.boardKey)),k=!he(c.name,[_.label,Se(c.when,a),O&&i(O),l(O,c.target.phaseKey)].join(` `));return(0,Q.jsxs)(`li`,{"aria-label":c.name,"data-drop":C.dropAt(u),style:E?{transform:`translateY(${C.drag?.offset??0}px)`}:void 0,onPointerDown:w?e=>C.onPointerDown(e,u):void 0,className:F(`group/rule flex flex-col`,xt,E&&`z-10 opacity-90`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 sm:flex-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Edit conditions of ${c.name}`,onClick:()=>f(c,`conditions`),onKeyDown:w?e=>C.onKeyDown(e,u):void 0,className:F(`flex w-full items-start gap-2.5 rounded-lg border bg-fill-subtle px-3 py-2 text-left transition-colors hover:border-border-hover`,T?`border-dashed border-border opacity-50`:`border-border`),children:[(0,Q.jsxs)(L,{as:`span`,variant:`meta`,tone:`muted`,className:`bg-fill mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full tabular-nums`,children:[(0,Q.jsx)(`span`,{className:F(w&&`pointer-fine:group-hover/rule:hidden`,E&&`hidden`),children:u+1}),w&&(0,Q.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:F(`hidden cursor-grab touch-none pointer-fine:group-hover/rule:flex`,E&&`flex`),children:(0,Q.jsx)(ne,{className:`size-icon-sm`})})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[k&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:c.name}),(0,Q.jsx)(et,{when:c.when,options:a,everything:S})]})]}),w&&(0,Q.jsxs)(`div`,{className:`border-border bg-card absolute top-0 right-2 flex -translate-y-1/2 rounded-md border shadow-sm transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/rule:opacity-100 pointer-fine:group-hover/rule:opacity-100`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check earlier`,disabled:u===0,onClick:()=>m(u,u-1),children:(0,Q.jsx)(U,{})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check later`,disabled:u===t.length-1,onClick:()=>m(u,u+1),children:(0,Q.jsx)(re,{})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 sm:shrink-0`,children:[(0,Q.jsxs)(`div`,{className:F(`flex min-w-0 items-center`,T&&`opacity-40`),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:F(`h-px w-8 shrink-0`,T?`border-t border-dashed border-border-strong`:`bg-muted-foreground`)}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Edit where ${c.name} moves the card`,onClick:()=>f(c,`action`),className:`border-border bg-fill-subtle hover:border-border-hover flex w-44 shrink-0 rounded-lg border px-3 py-2 text-left`,children:(0,Q.jsx)(nt,{boards:r,ownBoard:n.id,boardKey:c.target.moveToBoardKey??c.target.boardKey,phaseKey:c.target.phaseKey})})]}),o&&(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(je,{"aria-label":`${c.name} on`,checked:c.enabled,onCheckedChange:e=>h(c,e)}),(0,Q.jsxs)(X,{children:[(0,Q.jsx)(X.Trigger,{render:(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`More for ${c.name}`,children:(0,Q.jsx)(ze,{})})}),(0,Q.jsx)(X.Content,{align:`end`,children:(0,Q.jsxs)(X.Item,{variant:`destructive`,onClick:()=>ee(c),children:[(0,Q.jsx)(Ze,{}),`Delete rule`]})})]})]})]})]}),T&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:v?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs`,"aria-hidden":!0}),`Never reached: rule `,p+1,` above matches `,S.toLowerCase(),`.`]}):`Off, skipped`}),c.problems.map(e=>(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),e]},e)),D&&(0,Q.jsx)(wt,{skips:D}),fe(c,e)&&(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[`Skips outside authors’ pull requests (older rule).`,o&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>g(c),className:`underline`,children:`Let outside authors match`})]}),me(c,e)&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:`Moves cards only: files no new pull requests`}),b&&xe(c)&&(0,Q.jsx)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:J(`work_item.created`).label}),u!==y&&!d&&(0,Q.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-7 items-center pl-5.5`,children:[(0,Q.jsx)(`span`,{className:`bg-border-strong h-full w-px`}),(0,Q.jsx)(L,{as:`span`,variant:`meta`,tone:`muted`,className:`ml-2`,children:`no`})]})]},c.id)}),!d&&(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3`,children:[y<0&&(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`flex flex-1 items-center gap-2.5 px-3 py-1.5`,children:[(0,Q.jsx)(z,{className:`size-icon-md shrink-0`,"aria-hidden":!0}),T]}),o&&(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(Ye,{}),onClick:p,children:`Add rule`})]})]}),u]})]})}function Ct(e){return e?.match(/was skipped: (.+?)\.?$/)?.[1]??e??`its target couldn’t take the card`}function wt({skips:e}){let{count:t,latest:n}=e;return(0,Q.jsxs)(L,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Skipped `,t===1?`once`:`${t} times`,` in the last 30 days: `,Ct(n.reason),`.`]}),n.url?(0,Q.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`underline`,children:[`Latest: `,n.title]}):(0,Q.jsxs)(`span`,{children:[`Latest: `,n.title]})]})}var Tt=new Set([`revision_mismatch`,`intake_route_set_mismatch`,`intake_route_not_found`]);function Et(e){return e instanceof T&&e.code!==void 0&&Tt.has(e.code)}function Dt(e){return Et(e)?`Someone else changed these rules first. They have been reloaded; try again.`:e instanceof Error?e.message:`The change didn’t save.`}function Ot({factoryId:e,boardId:t}){let n=R(e),r=n.data?.find(e=>e.id===t);return n.isPending?(0,Q.jsx)(j,{className:`h-64 w-full`}):n.isError?(0,Q.jsx)(b,{variant:`destructive`,children:`Boards didn’t load.`}):r?(0,Q.jsx)(kt,{factoryId:e,board:r,boards:n.data},`${e}:${r.id}`):(0,Q.jsx)(b,{variant:`warning`,children:`This board isn’t installed.`})}function kt({factoryId:e,board:n,boards:i}){let a=G(e,n.id),o=ce(e),s=ie(e),u=V(e),d=ae(e),[f,p]=(0,Z.useState)(),m=(0,Z.useRef)(void 0),h=e=>{m.current=e,p(e)},[ee,g]=(0,Z.useState)(),v=a.data?.intakeRoutes??[],y=a.data?.canEdit??!1,x=r(n),S=(o.data?.intakeRoutes??[]).filter(e=>e.target.moveToBoardKey===n.id&&e.target.boardKey!==n.id),C=new Map(u.data?.skipped.map(e=>[e.routeId,e])),[w]=_(),T=w.get(`into`)??void 0,E=w.has(D),O=E||T!==void 0,A=O&&o.data?t(o.data.intakeRoutes,{key:n.id,initialPhase:n.initialPhase}):void 0,P=A&&new Set((E?A.leaving:A.into.get(T??``)??[]).map(e=>e.id)),F=e=>!P||e.some(e=>P.has(e.id));if(a.isPending||O&&o.isPending)return(0,Q.jsx)(j,{className:`h-64 w-full`});if(a.isError)return(0,Q.jsx)(b,{variant:`destructive`,children:`This board’s rules didn’t load.`});let I=e=>d.mutateAsync(e).catch(e=>M.error(Dt(e))),L=(e,t,r)=>{let i=q(v,e).map(e=>e.id);I([{kind:`reorder`,boardKey:n.id,ids:c(v,i,t,r)}])},R=e=>{g(void 0),h(e)},ne=async e=>{let t=m.current,r=t?.rule,i=()=>t!==void 0&&m.current===t;g(void 0);try{if(r)await d.mutateAsync([{kind:`update`,id:r.id,patch:{name:e.name,on:e.on,when:e.when,target:{boardKey:r.target.boardKey,...e.target,joinClosedIssue:r.target.joinClosedIssue},expectedRevision:r.revision}}]);else{let[t]=await d.mutateAsync([{kind:`create`,route:{...e,target:{boardKey:n.id,...e.target}}}]);i()&&h(void 0),t&&await z(t,e.on).catch(e=>M.error(Dt(e)));return}i()&&h(void 0)}catch(e){if(!i())return;if(r&&Et(e))return re(r);g(Dt(e))}},re=async e=>{let t=m.current,n=(await a.refetch()).data?.intakeRoutes.find(t=>t.id===e.id);t&&m.current===t&&(n?(h({...t,rule:n}),g(`Someone else changed this rule first. It now shows their version; make your change again.`)):(h(void 0),M.error(`Someone else deleted this rule first.`)))},z=async(e,t)=>{if(e.target.boardKey!==n.id)return;let r=(await a.refetch()).data?.intakeRoutes??[],i=r.map(e=>e.id),o=i.indexOf(e.id),s=t.flatMap(t=>{let n=q(r,t),a=n[ge(n,t,n.findIndex(t=>t.id===e.id))];return a?[i.indexOf(a.id)]:[]}),l=Math.min(...s);o<0||!(l<o)||await d.mutateAsync([{kind:`reorder`,boardKey:n.id,ids:c(r,i,o,l)}])},B=s.data?.evaluator===`route-list`?`Otherwise: the old route list decides`:_e(s.data?.boards,n.id);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[o.isError&&(0,Q.jsx)(b,{variant:`warning`,children:`Rules on other boards that move cards here didn’t load, so they aren’t shown.`}),O&&(0,Q.jsx)(bt,{count:P?.size,into:E||!T?`other boards`:l(n,T)??T,leaving:E,showAll:k(e,n.id)}),ye.filter(e=>e.events.some(e=>F([...q(v,e),...q(S,e)]))).map(t=>(0,Q.jsxs)(`section`,{"aria-label":t.title,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(N,{children:t.title}),t.events.some(K)?s.data&&(0,Q.jsx)(it,{factoryId:e,boardKey:n.id,order:s.data.boards,evaluator:s.data.evaluator}):(0,Q.jsx)(te,{children:`Only cards already on this board; other boards never see them.`})]}),t.events.map(t=>{let r=K(t),a=q(v,t),o=q(S,t).filter(e=>!P||P.has(e.id));return F([...a,...o])?(0,Q.jsx)(St,{event:t,rules:a,board:n,boards:i,phaseOptions:x,canEdit:y,skips:C,footer:r?B:void 0,only:P,incoming:o.length?(0,Q.jsx)(rt,{factoryId:e,rules:o,board:n,boards:i}):void 0,onEdit:(e,t)=>R({rule:e,step:t}),onAdd:()=>R({event:t,step:`conditions`}),onMove:(e,n)=>L(t,e,n),onToggle:(e,t)=>void I([{kind:`update`,id:e.id,patch:{enabled:t,expectedRevision:e.revision}}]),onDelete:e=>void I([{kind:`delete`,id:e.id,expectedRevision:e.revision}]).then(t=>t&&M.success(`Deleted “${e.name}”`)),onUngate:e=>void I([{kind:`update`,id:e.id,patch:{outsiderPullRequestsGated:!1,expectedRevision:e.revision}}]).then(t=>t&&M.success(`“${e.name}” now matches outside authors’ pull requests`))},t):null})]},t.title)),f&&(0,Q.jsx)(gt,{factoryId:e,board:n,boards:i,initial:f.rule,initialEvent:f.event,initialStep:f.step,readOnly:!y,saving:d.isPending,error:ee,onSave:e=>void ne(e),onClose:()=>h(void 0)},f.rule?`${f.rule.id}:${f.rule.revision}`:`new-${f.event}`)]})}function At(){let e=s(),t=u()?.boardId??``,{isMobile:r,desktopState:i}=p(),c=r||i===`collapsed`,l=w(e.id,t).data?.board,h=a({breadcrumbs:c&&l?(0,Q.jsxs)(f,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(d,{as:m,to:E(e.id,t),children:l.name}),(0,Q.jsx)(d,{as:`span`,isCurrent:!0,children:`Rules`})]}):void 0});return(0,Q.jsx)(o,{variant:`settings`,header:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(n,{children:[(0,Q.jsx)(n.Title,{children:`Rules`}),(0,Q.jsx)(n.Description,{children:`What happens to issues and pull requests on this board. In each lane the first matching rule wins.`})]}),(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(B,{factoryProjectId:e.id,label:`Test an issue or pull request`})})]}),...h,children:(0,Q.jsx)(Ot,{factoryId:e.id,boardId:t})})}export{At as BoardRulesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ei as t,Jt as n,Mi as r,qt as i}from"./GithubIcon.es-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Ei as t,Jt as n,Mi as r,qt as i}from"./GithubIcon.es-CIm0nGDf.js";import{O as a,T as o,k as s,o as c}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{r as l}from"./CompositeItem-DXJX9-KR.js";import{t as u}from"./popup-anchor.es-g9MI9mVW.js";var d=e(s(),1),f=a(),p=e=>(0,f.jsx)(`svg`,{width:`19.125`,height:`18`,viewBox:`-1.0625 -1 19.125 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,f.jsx)(`path`,{d:`M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z`,fill:`currentColor`})}),m=({children:e,label:t,className:n,listClassName:r})=>(0,f.jsx)(`nav`,{"aria-label":t,className:n,children:(0,f.jsx)(`ol`,{className:o(`flex items-center gap-0.5`,r),children:e})}),h=e=>(0,f.jsx)(l,{className:`h-3 w-24`,...e}),g=({className:e,as:a,to:s,href:l,isCurrent:m,action:g,switcher:_,icon:v,isLoading:y,children:b,...x})=>{let S=a||`span`,C=!(!_||!m&&(s||l)),w=d.useRef(null);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`li`,{ref:w,className:o(`group flex h-control-sm min-w-0 items-center`,m?`shrink`:`shrink-0`,C&&`relative rounded-full has-[[data-slot=crumb-switcher]_[data-popup-open]]:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:hover:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:active:bg-fill`),children:[(0,f.jsxs)(S,{"aria-current":m?`page`:void 0,className:o(`inline-flex min-w-0 items-center gap-2 overflow-hidden rounded-full px-[.9em]`,t.sm,c,m?`max-w-xs cursor-default text-foreground`:C?o(n,`max-w-48`):o(i,`max-w-48 cursor-pointer hover:bg-fill-subtle active:bg-fill`),e),to:s,href:l,...x,children:[v&&(0,f.jsx)(r,{className:o(`ml-[-.3em] shrink-0 opacity-50 group-hover:opacity-100`,`transition-opacity duration-normal ease-out-custom`),children:v}),y?(0,f.jsx)(h,{}):(0,f.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:b})]}),_&&(0,f.jsx)(`span`,{"data-slot":`crumb-switcher`,className:o(`-ml-1 flex h-control-sm shrink-0 items-center`,C&&`[&_button]:bg-transparent! [&_button:enabled]:after:absolute [&_button:enabled]:after:inset-0 [&_button:enabled]:after:rounded-full`),children:(0,f.jsx)(u,{value:w,children:_})}),g&&(0,f.jsx)(`span`,{className:`-ml-1 flex h-control-sm shrink-0 items-center`,children:g})]}),!m&&(0,f.jsx)(`li`,{role:`separator`,className:`flex h-full items-center`,children:(0,f.jsx)(r,{className:`text-subtle-foreground`,children:(0,f.jsx)(p,{})})})]})};export{g as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bs as t,Is as n,Ls as r,Si as i,js as a}from"./GithubIcon.es-CIm0nGDf.js";import{O as o,T as s,c,k as l}from"./IconChevronRightMedium.es-BkPdzxSm.js";var u=e(l(),1),d=o(),f=s(`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=grow-y]]:scale-y-125`,`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=grow-x]]:scale-x-125`,`motion-safe:not-disabled:not-aria-disabled:hover:[&_[data-emphasis=pop]]:scale-110`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=grow-y]]:scale-y-125`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=grow-x]]:scale-x-125`,`motion-safe:not-disabled:not-aria-disabled:focus-visible:[&_[data-emphasis=pop]]:scale-110`),p=t(s(n,`rounded-xl transition-all duration-normal ease-out-custom motion-reduce:transition-none`),{variants:{elevation:{flat:`shadow-none`,raised:``},interactive:{true:s(r,i,f,`cursor-pointer active:scale-99 aria-[current=true]:[--surface-rim:var(--border-focus)]`),false:``}},compoundVariants:[{elevation:`flat`,interactive:!0,class:s(c,`aria-[current=true]:outline-1 aria-[current=true]:-outline-offset-1 aria-[current=true]:outline-border-focus aria-[current=true]:outline-solid`)}],defaultVariants:{elevation:`raised`,interactive:!1}}),m=u.forwardRef(({className:e,elevation:t,interactive:n,as:r,...i},a)=>{let o=r||(n?`button`:`div`);return(0,d.jsx)(o,{ref:a,type:o===`button`?`button`:void 0,className:s(p({elevation:t,interactive:n}),e),...i})});m.displayName=`Card`;function h({className:e,elevation:t,LinkComponent:n=`a`,...r}){return(0,d.jsx)(n,{className:s(p({elevation:t,interactive:!0}),e),...r})}var g=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`div`,{ref:n,className:s(`flex flex-col space-y-1.5 px-3 py-1`,e),...t}));g.displayName=`CardHeader`;var _=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`h3`,{ref:n,className:s(`text-subheading text-foreground`,e),...t}));_.displayName=`CardTitle`;var v=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`p`,{ref:n,className:s(`text-caption text-muted-foreground`,e),...t}));v.displayName=`CardDescription`;var y=t(``,{variants:{density:{default:`p-3`,compact:`p-2`}},defaultVariants:{density:`default`}}),b=u.forwardRef(({className:e,density:t,...n},r)=>(0,d.jsx)(`div`,{ref:r,className:s(y({density:t}),e),...n}));b.displayName=`CardContent`;var x=u.forwardRef(({className:e,...t},n)=>(0,d.jsx)(`div`,{ref:n,className:s(`flex items-center p-3 pt-0`,e),...t}));x.displayName=`CardFooter`;var S=u.forwardRef(({className:e,as:t=`div`,...n},r)=>(0,d.jsx)(t,{ref:r,className:s(a,`overflow-hidden rounded-lg bg-nested px-3 *:py-3 [&>*+*]:border-t [&>*+*]:border-separator`,e),...n}));S.displayName=`CardInset`;export{b as n,h as r,m as t};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-Sr6WSEaV.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-6WNNvkM4.js","assets/dist-B5wMYzWI.js","assets/dist-D1JI_ikE.js","assets/dist-DtnqB3m_.js","assets/dist-CMX7_OjZ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,T as n,b as r,d as i,f as a,k as o,m as s,o as c,s as l,u,v as d}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Bs as f,Ds as p,Fi as m,Gt as h,Ii as g,Li as _,Lo as v,Oo as y,Os as b,Pi as x,Qa as S,Ra as C,Ti as w,Tn as T,Wi as E,ao as D,ci as O,cs as k,di as ee,ds as A,fs as j,is as M,ls as N,no as P,ns as te,oi as F,os as I,qn as L,qt as ne,ra as re}from"./GithubIcon.es-CIm0nGDf.js";import{a as ie,i as R,n as z,r as B,t as ae}from"./select-BPzTS5dZ-BGYcBcgg.js";import{n as oe}from"./CompositeItem-DXJX9-KR.js";import{i as V,n as H,r as U,t as se}from"./TabsRoot-MM_4fh4A.js";import{n as ce,t as le}from"./CompositeRoot-COSYbRmu.js";import{t as ue}from"./copy-button-C3L1ZoAD-DpbBeGOv.js";import{n as de}from"./index.module-Dtojw6Gd.js";import{a as W,i as fe,m as pe,n as me}from"./dist-6WNNvkM4.js";import{t as G}from"./preload-helper-BLdHbfdN.js";var K=e(o(),1),q=t(),he=re();function ge(e){let t=I(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=A(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r;return(S(n)!==a||S(r)!==o)&&(n=a,r=o),{width:n,height:r}}var _e=K.createContext(void 0);function ve(){let e=K.useContext(_e);if(e===void 0)throw Error(p(65));return e}var ye=K.forwardRef(function(e,t){let{className:n,disabled:r=!1,render:i,value:a,id:o,nativeButton:c=!0,style:l,...u}=e,{value:d,getTabPanelIdByValue:f,onValueChange:p,orientation:m,tabActivationDirection:h}=U(),{activateOnFocus:g,registerTabResizeObserverElement:_,tabsListElement:x}=ve(),{highlightedIndex:S,onHighlightedIndexChange:C}=ee(),w=E(o),T=K.useMemo(()=>({disabled:r,id:w,value:a}),[r,w,a]),{compositeProps:k,compositeRef:A,index:j}=oe({metadata:T}),N=a===d,F=K.useRef(!1),I=K.useRef(null),L=D(e=>{I.current?.(),I.current=e?_(e):null});b(()=>{if(F.current){F.current=!1;return}if(!(N&&j>-1&&S!==j))return;let e=x;if(e!=null){let t=te(P(e));if(t&&M(e,t))return}r||C(j)},[N,j,S,C,r,x]);let{getButtonProps:ne,buttonRef:re}=O({disabled:r,native:c,focusableWhenDisabled:!0}),ie=f(a),R=K.useRef(!1),z=K.useRef(!1);function B(e){p(a,v(y,e.nativeEvent,void 0,{activationDirection:`none`}))}function ae(e){N||r||B(e)}function V(e){N||r||g&&(!R.current||z.current)&&B(e)}function se(e){if(N||r)return;R.current=!0,z.current=e.button===0;let t=P(e.currentTarget);function n(){R.current=!1,z.current=!1,t.removeEventListener(`pointerup`,n),t.removeEventListener(`pointercancel`,n)}t.addEventListener(`pointerup`,n),t.addEventListener(`pointercancel`,n)}return s(`button`,e,{state:{disabled:r,active:N,orientation:m,tabActivationDirection:h},ref:[t,re,A,L],props:[k,{role:`tab`,"aria-controls":ie,"aria-selected":N,id:w,onClick:ae,onFocus:V,onPointerDown:se,[ce]:N?``:void 0,onKeyDownCapture(){F.current=!0}},u,ne],stateAttributesMapping:H})}),be=()=>()=>{},xe=()=>!0,Se=()=>!1;function Ce(){return(0,he.useSyncExternalStore)(be,xe,Se)}function we(){let[e,t]=K.useState(!1);return K.useEffect(()=>{t(!0)},[]),e}var Te=d(18)?Ce:we;function Ee(){return!Te()}function De(e){let{script:t}=e,{nonce:n}=h();return Ee()?(0,q.jsx)(`script`,{nonce:n,dangerouslySetInnerHTML:{__html:t},suppressHydrationWarning:!0}):null}var Oe=`--active-tab-left`,ke=`--active-tab-right`,Ae=`--active-tab-top`,je=`--active-tab-bottom`,Me=`--active-tab-width`,Ne=`--active-tab-height`,Pe,Fe={...H,activeTabPosition:()=>null,activeTabSize:()=>null},Ie=2,Le=K.forwardRef(function(e,t){let{className:n,render:r,renderBeforeHydration:i=!1,style:a,...o}=e,{getTabElementBySelectedValue:c,orientation:l,tabActivationDirection:u,value:d}=U(),{tabsListElement:f,registerIndicatorUpdateListener:p}=ve(),m=C();K.useEffect(()=>p(m),[p,m]);let h=0,g=0,_=0,v=0,y=0,b=0,x=!1;if(d!=null&&f!=null){let e=c(d);if(e!=null){x=!0;let{width:t,height:n}=ge(e),{width:r,height:i}=ge(f),a=e.getBoundingClientRect(),o=f.getBoundingClientRect(),s=r>0?o.width/r:1,c=i>0?o.height/i:1,l=Re(e,f);h=l.left,_=l.top;let u=(a.left-o.left)/s+f.scrollLeft-f.clientLeft,d=(a.top-o.top)/c+f.scrollTop-f.clientTop,p=Be(e);Math.abs(u-p.x-h)<=Ie&&Math.abs(d-p.y-_)<=Ie&&(h=u,_=d),y=t,b=n,g=f.scrollWidth-h-y,v=f.scrollHeight-_-b}}let S=x?{left:h,right:g,top:_,bottom:v}:null,w=x?{width:y,height:b}:null,T=x?{[Oe]:`${h}px`,[ke]:`${g}px`,[Ae]:`${_}px`,[je]:`${v}px`,[Me]:`${y}px`,[Ne]:`${b}px`}:void 0,E=s(`span`,e,{state:{orientation:l,activeTabPosition:S,activeTabSize:w,tabActivationDirection:u},ref:t,props:[{role:`presentation`,style:T,hidden:!(x&&y>0&&b>0)},o,{suppressHydrationWarning:!0}],stateAttributesMapping:Fe});return d==null?null:(0,q.jsxs)(K.Fragment,{children:[E,i&&(Pe||=(0,q.jsx)(De,{script:``}))]})});function Re(e,t){let n=ze(e),r=ze(t),i=n.left-r.left-t.clientLeft,a=n.top-r.top-t.clientTop,o=k(e);for(;A(o)&&o!==t&&!j(o);)i-=o.scrollLeft,a-=o.scrollTop,o=k(o);return{left:i,top:a}}function ze(e){let t=0,n=0,r=e;for(;r!=null;){t+=r.offsetLeft,n+=r.offsetTop;let e=r.offsetParent;e!=null&&(t+=e.clientLeft,n+=e.clientTop),r=e}return{left:t,top:n}}function Be(e){let t=N(e).getComputedStyle(e),{x:n,y:r}=T(e,t),i=n,a=r,{translate:o}=t;if(o&&o!==`none`){let t=o.split(` `);i+=Ve(t[0],e.offsetWidth),a+=Ve(t[1],e.offsetHeight)}return{x:i,y:a}}function Ve(e,t){if(!e)return 0;let n=parseFloat(e);return Number.isFinite(n)?e.endsWith(`%`)?n/100*t:n:0}var He=K.forwardRef(function(e,t){let{activateOnFocus:n=!1,className:i,loopFocus:a=!0,render:o,style:s,...c}=e,{orientation:l,setTabMap:u,tabActivationDirection:d}=U(),[f,p]=K.useState(0),[m,h]=K.useState(null),g=K.useRef(new Set),_=K.useRef(new Set),v=K.useRef(null);b(()=>{if(typeof ResizeObserver>`u`)return;let e=new ResizeObserver(()=>{g.current.forEach(e=>{e()})});return v.current=e,m&&e.observe(m),_.current.forEach(t=>{e.observe(t)}),()=>{e.disconnect(),v.current=null}},[m]);let y=D(e=>(g.current.add(e),()=>{g.current.delete(e)})),x=D(e=>(_.current.add(e),v.current?.observe(e),()=>{_.current.delete(e),v.current?.unobserve(e)})),S={orientation:l,tabActivationDirection:d},C={"aria-orientation":l===`vertical`?`vertical`:void 0,role:`tablist`},w=K.useMemo(()=>({activateOnFocus:n,registerIndicatorUpdateListener:y,registerTabResizeObserverElement:x,tabsListElement:m}),[n,y,x,m]);return(0,q.jsx)(_e.Provider,{value:w,children:(0,q.jsx)(le,{render:o,className:i,style:s,state:S,refs:[t,h],props:[C,c],stateAttributesMapping:H,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:a,orientation:l,onHighlightedIndexChange:p,onMapChange:u,disabledIndices:r})})}),Ue=a(`IconArrowInbox`,()=>(0,q.jsx)(`path`,{d:`M20 15V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V15M12 14.5V4M12 14.5L8.5 11M12 14.5L15.5 11`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})),J=(0,K.createContext)(null),We=(0,K.createContext)(null),Ge=f(`relative flex items-center text-body`,{variants:{variant:{pill:`w-fit gap-1 rounded-full bg-fill-subtle p-1`,"pill-ghost":`w-fit gap-0.5 rounded-full`}},defaultVariants:{variant:`pill`}});function Ke(e,t){return e===`pill`?t?`h-[calc(100%-0.5rem)]`:`h-[calc(100%-0.25rem)]`:`h-full`}var qe=({children:e,className:t,variant:r,size:a=`md`,sticky:o,style:s,overflow:c=`scroll`})=>{let l=r??`pill`,d=(0,K.useContext)(J),f=(0,K.useRef)(null),p=(0,K.useRef)(new Map),h=(0,K.useRef)(new Map),v=(0,K.useRef)(d?.value),[y,b]=(0,K.useState)(null),[S,C]=(0,K.useState)([]),T=(0,K.useCallback)(e=>{C(t=>{let n=t.find(t=>t.value===e.value);return n&&n.element===e.element&&n.width===e.width&&n.label===e.label&&n.disabled===e.disabled&&n.onClick===e.onClick&&n.onClose===e.onClose?t:(n?t.map(t=>t.value===e.value?e:t):[...t,e]).sort((e,t)=>e.element===t.element?0:e.element.compareDocumentPosition(t.element)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1)})},[]),E=(0,K.useCallback)(e=>C(t=>t.filter(t=>t.value!==e)),[]),D=d?.appearance===`contained`,O=D||c===`menu`,k=l===`pill`&&!D,ee=Ke(l,D);(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||!O)return;let t=()=>b(e.clientWidth);if(t(),!(`ResizeObserver`in globalThis))return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[O]);let A=D||k?4:l===`pill-ghost`?2:0,j=D?30:k?4:0,M=D?48:72,N=(0,K.useMemo)(()=>{let e=new Set;if(!O||y===null||S.reduce((e,t)=>e+t.width,0)+A*Math.max(S.length-1,0)+j<=y)return e;let t=y-j-M,n=S.find(e=>e.value===d?.value);n&&(t-=n.width+A);let r=!1;for(let i of S)i!==n&&(r||i.width+A>t?(r=!0,e.add(i.value)):t-=i.width+A);return e},[O,y,S,A,j,M,d?.value]),P=S.filter(e=>N.has(e.value)),te=S.filter(e=>!N.has(e.value)).reduce((e,t)=>e+t.width+A,D?4:0),F=S.filter(e=>!N.has(e.value)&&e.onClose),I=(0,K.useMemo)(()=>({variant:l,size:a,hiddenValues:N,register:T,unregister:E}),[l,a,N,T,E]);return(0,K.useLayoutEffect)(()=>{let e=new Map(h.current),t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;for(let n of S){if(N.has(n.value))continue;let r=n.element.offsetLeft,i=h.current.get(n.value),a=p.current.get(n.value);a&&(a.style.left=`${r}px`,a.style.top=`${n.element.offsetTop}px`,a.style.width=`${n.element.offsetWidth}px`,a.style.height=`${n.element.offsetHeight}px`);let o=i===void 0?0:i-r,s=n.value!==d?.value&&Math.abs(o)<=32;!t&&s&&o!==0&&`animate`in n.element&&n.element.animate([{transform:`translateX(${o}px)`},{transform:`translateX(0)`}],{duration:180,easing:`cubic-bezier(0.32, 0.72, 0, 1)`}),e.set(n.value,r)}for(let t of e.keys())S.some(e=>e.value===t)||e.delete(t);h.current=e},[N,S,d?.value]),(0,K.useLayoutEffect)(()=>{let e=v.current;v.current=d?.value;let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;if(!D||e===d?.value||t)return;let n=f.current?.querySelector(`[data-slot="tabs-indicator"]`);n&&`animate`in n&&n.animate([{opacity:.72,scale:`0.97`},{opacity:1,scale:`1`}],{duration:140,easing:`cubic-bezier(0.32, 0.72, 0, 1)`})},[D,d?.value]),(0,q.jsx)(We.Provider,{value:I,children:(0,q.jsx)(g,{delay:200,children:(0,q.jsxs)(`div`,{ref:f,"data-slot":`tabs-list-scroll`,className:n(`relative w-full`,O&&!D?`flex items-center gap-1`:`overflow-x-auto`,o&&`sticky top-0 z-10 bg-background`),children:[(0,q.jsxs)(He,{"data-slot":`tabs-list`,"data-overflow":P.length>0||void 0,"data-variant":l,"data-size":a,className:n(`group/tabs-list`,Ge({variant:l}),k&&n(w[a],`items-stretch p-0.5`),t),style:s,children:[e,(0,q.jsx)(Le,{className:n(`absolute top-1/2 left-0 z-0 rounded-full bg-[var(--tab-indicator-color,var(--fill-hover))]`,ee,`w-[var(--active-tab-width)]`,`transition-[width,transform] duration-200 ease-in-out motion-reduce:transition-none`),"data-slot":`tabs-indicator`,style:{transform:`translateY(var(--tabs-indicator-y, -50%)) translateX(var(--active-tab-left))`}})]}),(0,q.jsx)(`div`,{"data-slot":`tabs-close-actions`,children:F.map(e=>(0,q.jsx)(`div`,{ref:t=>{t?p.current.set(e.value,t):p.current.delete(e.value)},"data-slot":`tab-close-item`,"data-visible":d?.value===e.value||void 0,children:(0,q.jsxs)(x,{children:[(0,q.jsxs)(_,{render:(0,q.jsx)(`button`,{type:`button`,tabIndex:d?.value===e.value?0:-1,"data-slot":`tab-close`,onClick:e.onClose,className:n(`rounded p-0.5 hover:bg-fill-hover hover:text-destructive-foreground`,u.colors)}),children:[(0,q.jsxs)(`span`,{className:`sr-only`,children:[`Close `,e.label]}),(0,q.jsx)(L,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsxs)(m,{children:[`Close `,e.label]})]})},e.value))}),P.length>0&&(0,q.jsx)(`div`,{"data-slot":`tabs-overflow`,style:D?{transform:`translateX(${te}px)`}:void 0,className:D?`tabs-overflow`:void 0,children:(0,q.jsxs)(V,{children:[(0,q.jsxs)(V.Trigger,{"aria-label":`${P.length} more tabs`,variant:`ghost`,size:`sm`,className:`tabular-nums`,children:[`+`,P.length,(0,q.jsx)(i,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsx)(V.Content,{children:P.map((e,t)=>(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(V.Item,{"data-slot":`tabs-overflow-tab`,disabled:e.disabled,className:e.onClose?`pr-9`:void 0,style:{gridArea:`${t+1} / 1`},onClick:()=>{d?.select(e.value),e.onClick?.()},children:e.label}),e.onClose?(0,q.jsxs)(x,{children:[(0,q.jsxs)(_,{render:(0,q.jsx)(V.Item,{"data-slot":`tabs-overflow-close`,className:`pointer-events-none z-10 m-1 size-6 self-center justify-self-end p-0 opacity-0 hover:text-destructive-foreground data-[highlighted]:text-destructive-foreground`,style:{gridArea:`${t+1} / 1`},onClick:e.onClose}),children:[(0,q.jsxs)(`span`,{className:`sr-only`,children:[`Close `,e.label]}),(0,q.jsx)(L,{"aria-hidden":`true`,className:`size-icon-xs`})]}),(0,q.jsxs)(m,{side:`right`,children:[`Close `,e.label]})]}):null]},e.value))})]})})]})})})},Je=({children:e,defaultTab:t,value:r,onValueChange:i,appearance:a=`default`,frame:o=`inset`,className:s,...c})=>{let[l,u]=(0,K.useState)(t),d=r??l,f=e=>{u(e),i?.(e)};return(0,q.jsx)(J.Provider,{value:{appearance:a,value:d,select:f},children:(0,q.jsx)(se,{defaultValue:t,value:d,onValueChange:f,"data-slot":`tabs`,"data-appearance":a,"data-frame":o,className:n(`group/tabs`,a==="default"?`overflow-y-auto`:`w-full min-w-0`,s),...c,children:e})})},Ye=({children:e,value:t,onClick:r,onClose:i,disabled:a,disabledTooltip:o,tooltip:s,attention:u=!1,className:d})=>{let f=(0,K.useContext)(We),p=(0,K.useRef)(null),h=f?.register,g=f?.unregister,v=f?.hiddenValues.has(t)??!1;(0,K.useEffect)(()=>{let n=p.current;if(!n||!h)return;let o=()=>h({value:t,label:e,disabled:a??!1,width:n.getBoundingClientRect().width,element:n,onClick:r,onClose:i});if(o(),!(`ResizeObserver`in globalThis))return;let s=new ResizeObserver(o);return s.observe(n),()=>s.disconnect()},[h,t,e,a,r,i]),(0,K.useEffect)(()=>()=>g?.(t),[g,t]);let y=f?.size??`md`,b=f?.variant===`pill-ghost`?n(F({variant:`ghost`,size:y}),`relative z-10 whitespace-nowrap`,`data-[active]:text-foreground`,`aria-disabled:cursor-not-allowed aria-disabled:opacity-50`,`data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,d):n(`text-label`,ne,u&&`relative`,`flex cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap outline-none`,c,l,`data-[active]:text-foreground`,`disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:text-muted-foreground`,`aria-disabled:cursor-not-allowed aria-disabled:opacity-50 aria-disabled:hover:text-muted-foreground`,`data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:text-muted-foreground`,d),S=(0,q.jsxs)(ye,{ref:p,render:(0,q.jsx)(`div`,{}),nativeButton:!1,"data-overflowed":v||void 0,"aria-hidden":v||void 0,value:t,disabled:a||v,"data-slot":`tab`,"data-base-ui-swipe-ignore":``,"data-closable":i?``:void 0,className:b,onClick:r,children:[e,u&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`tab-attention`}),(0,q.jsx)(`span`,{className:`sr-only`,children:` Needs attention`})]})]});return a&&o?(0,q.jsxs)(x,{children:[(0,q.jsx)(_,{render:(0,q.jsx)(`span`,{tabIndex:0,className:`inline-flex`}),children:S}),(0,q.jsx)(m,{children:o})]}):s&&!a?(0,q.jsxs)(x,{children:[(0,q.jsx)(_,{render:S}),(0,q.jsx)(m,{children:s})]}):S},Xe={js:`javascript`,javascript:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,typescript:`typescript`,mts:`typescript`,cts:`typescript`,tsx:`tsx`,jsx:`jsx`,json:`json`,json5:`json`,md:`markdown`,markdown:`markdown`,py:`python`,python:`python`,sh:`bash`,bash:`bash`,shell:`bash`,zsh:`bash`,yml:`yaml`,yaml:`yaml`,diff:`diff`,patch:`diff`,css:`css`,scss:`css`,html:`html`,htm:`html`,xml:`xml`,svg:`xml`,sql:`sql`};async function Y(e){let[{StreamLanguage:t},n]=await Promise.all([G(()=>import(`./dist-Sr6WSEaV.js`).then(e=>e.h),__vite__mapDeps([0,1,2])),e]);return t.define(n).parser}async function X(e){let{javascript:t}=await G(async()=>{let{javascript:e}=await import(`./dist-B5wMYzWI.js`).then(e=>e.t);return{javascript:e}},__vite__mapDeps([3,1,4,2,0]));return t(e).language.parser}var Ze={javascript:()=>X({}),jsx:()=>X({jsx:!0}),typescript:()=>X({typescript:!0}),tsx:()=>X({jsx:!0,typescript:!0}),json:()=>G(()=>import(`./dist-DtnqB3m_.js`).then(e=>e.t).then(e=>e.jsonLanguage.parser),__vite__mapDeps([5,1,4,2,0])),markdown:()=>G(()=>import(`./dist-CMX7_OjZ.js`).then(e=>e.t).then(e=>e.markdownLanguage.parser),__vite__mapDeps([6,1,0,2,3,4])),bash:()=>Y(G(()=>import(`./shell-DwuoZtxw.js`).then(e=>e.shell),[])),python:()=>Y(G(()=>import(`./python-DIWH3FmR.js`).then(e=>e.python),[])),yaml:()=>Y(G(()=>import(`./yaml-BEzOWJ7L.js`).then(e=>e.yaml),[])),diff:()=>Y(G(()=>import(`./diff-ChtP43wD.js`).then(e=>e.diff),[])),css:()=>Y(G(()=>import(`./css-CIHhKeSF.js`).then(e=>e.css),[])),html:()=>Y(G(()=>import(`./xml-aKzObEic.js`).then(e=>e.html),[])),xml:()=>Y(G(()=>import(`./xml-aKzObEic.js`).then(e=>e.xml),[])),sql:()=>Y(G(()=>import(`./sql-DrH7SW3s.js`).then(e=>e.standardSQL),[]))},Z=new Map;function Qe(e){let t=Z.get(e);return t||(t=Ze[e](),t.catch(()=>Z.delete(e)),Z.set(e,t)),t}var $e=[{tag:[W.comment,W.bracket],class:`syntax-comment`},{tag:[W.string,W.meta,W.regexp,W.name,W.quote,W.standard(W.tagName)],class:`syntax-string`},{tag:[W.atom,W.bool,W.special(W.variableName)],class:`syntax-literal`},{tag:[W.keyword,W.operator,W.tagName,W.deleted],class:`syntax-keyword`},{tag:[W.function(W.propertyName),W.propertyName,W.variableName,W.number],class:`syntax-name`},{tag:[W.definition(W.variableName),W.function(W.variableName),W.className,W.attributeName,W.url],class:`syntax-definition`},{tag:W.link,class:`syntax-link`},{tag:W.heading,class:`syntax-heading`},{tag:W.emphasis,class:`syntax-emphasis`},{tag:W.strong,class:`syntax-strong`},{tag:W.strikethrough,class:`syntax-strike`},{tag:W.invalid,class:`syntax-invalid`}],et=fe($e);function tt(e,t){if(!t||!e.startsWith(t.code))return;let n=t.code.length;return pe.applyChanges(pe.addTree(t.tree),[{fromA:n,toA:n,fromB:n,toB:e.length}])}async function nt(e,t,n){let r=Xe[t?.toLowerCase()];if(!r)return null;let i=(await Qe(r)).parse(e,tt(e,n)),a=[],o=[a],s=(e,t)=>{e.split(`
|
|
3
|
+
`).forEach((e,n)=>{n>0&&o.push(a=[]),e&&a.push(t?{content:e,className:t}:{content:e})})},c=0;return me(i,et,(t,n,r)=>{t>c&&s(e.slice(c,t)),s(e.slice(t,n),r),c=n}),c<e.length&&s(e.slice(c)),{code:e,tokens:o,tree:i}}function rt(e){let t=e?.split(`.`).pop()?.toLowerCase();return t?Xe[t]:void 0}var Q=75;function it(e,t){let[n,r]=(0,K.useState)(null),i=(0,K.useRef)(null),[a,o]=de(e,Q,{leading:!0,maxWait:Q});return(0,K.useEffect)(()=>()=>o.cancel(),[o]),(0,K.useEffect)(()=>{if(!t)return;let e=!1,n=i.current?.lang===t?i.current:void 0;return nt(a,t,n).then(n=>{!e&&n?.tokens.length&&(i.current={...n,lang:t},r(i.current))}).catch(()=>{}),()=>{e=!0}},[a,t]),t?n:null}function at(e,t,n){return!e||e.lang!==n?null:t.startsWith(e.code)?e:null}var $=K.memo(function({code:e,lang:t,lineClassName:n,...r}){let i=at(it(e,t),e,t);if(!i){if(!n)return(0,q.jsx)(`pre`,{...r,children:e});let t=e.split(`
|
|
4
|
+
`);return(0,q.jsx)(`pre`,{...r,children:t.map((e,r)=>(0,q.jsxs)(K.Fragment,{children:[(0,q.jsx)(`span`,{"data-line":r,className:n(r,e),children:e}),r!==t.length-1&&`
|
|
5
|
+
`]},r))})}let a=e.slice(i.code.length),o=0;return(0,q.jsx)(`pre`,{...r,children:(0,q.jsxs)(`code`,{className:`font-[inherit]`,children:[i.tokens.map((e,t)=>{let r=o,a=r,s=e.map(e=>{let t=a;return a+=e.content.length,(0,q.jsx)(`span`,{className:e.className,children:e.content},t)});return o=a+1,(0,q.jsxs)(K.Fragment,{children:[n?(0,q.jsx)(`span`,{"data-line":t,className:n(t,e.map(e=>e.content).join(``)),children:s}):(0,q.jsx)(`span`,{children:s}),t!==i.tokens.length-1&&`
|
|
6
|
+
`]},r)}),a]})})});function ot({code:e,options:t,value:r,onValueChange:i,selector:a=`select`,fileName:o,lang:s,overflow:c=`wrap`,copyMessage:l,copyTooltip:d,actions:f,className:p}){let m=t&&t.length>0,h=m&&a===`tabs`,g=m&&a===`select`,_=t?.[0],v=r??_?.value;return(0,q.jsxs)(`figure`,{className:n(`group relative flex w-full flex-col overflow-hidden rounded-2xl bg-nested [contain:inline-size]`,p),children:[h&&_&&(0,q.jsx)(Je,{defaultTab:_.value,value:v,onValueChange:i??(()=>{}),children:(0,q.jsxs)(`div`,{className:`flex items-stretch`,children:[(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(qe,{children:t.map(e=>(0,q.jsx)(Ye,{value:e.value,children:e.label},e.value))})}),f&&(0,q.jsx)(`div`,{className:`flex shrink-0 items-center border-b border-border pr-2 pl-3`,children:f})]})}),g&&t&&(0,q.jsxs)(`div`,{className:`flex items-center border-b border-border px-2 py-1.5`,children:[(0,q.jsxs)(ae,{value:v,onValueChange:i,children:[(0,q.jsx)(R,{size:`sm`,variant:`ghost`,className:`w-auto`,children:(0,q.jsx)(ie,{})}),(0,q.jsx)(z,{children:t.map(e=>(0,q.jsx)(B,{value:e.value,children:e.label},e.value))})]}),f&&(0,q.jsx)(`div`,{className:`ml-auto flex items-center`,children:f})]}),!m&&o&&(0,q.jsxs)(`div`,{className:`flex items-center border-b border-border px-4 py-2`,children:[(0,q.jsx)(`figcaption`,{className:`font-mono text-caption text-muted-foreground`,children:o}),f&&(0,q.jsx)(`div`,{className:`ml-auto flex items-center`,children:f})]}),!m&&!o&&f&&(0,q.jsx)(`div`,{className:`flex items-center justify-end border-b border-border px-2 py-1.5`,children:f}),(0,q.jsxs)(`div`,{className:`relative`,children:[(0,q.jsx)($,{code:e,lang:s,className:n(`px-4 py-3 font-mono text-caption text-foreground`,c===`scroll`?`overflow-x-auto whitespace-pre`:`break-all whitespace-pre-wrap`)}),(0,q.jsx)(ue,{content:e,copyMessage:l,tooltip:d,className:n(`absolute top-2 right-2 opacity-100 group-focus-within:opacity-100 group-hover:opacity-100 pointer-fine:opacity-0`,u.opacity)})]})]})}export{et as a,qe as c,Ue as d,rt as i,Je as l,$ as n,$e as o,it as r,Ye as s,ot as t,J as u};
|
package/dist/factory/assets/{CodeEditor-DKVZX8c1-D3tFx8Wi.js → CodeEditor-DE69mZsU-DhkPbKOd.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Bs as t,mi as n,ni as r,vi as i}from"./GithubIcon.es-CIm0nGDf.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./esm-C7YFnOq6.js";import{a as d}from"./CodeBlock.es-CSnUNCvE.js";import{t as f}from"./copy-button-C3L1ZoAD-DpbBeGOv.js";import{t as p}from"./IconCodeBrackets.es-CuUuf_Z9.js";import{t as m}from"./preload-helper-BLdHbfdN.js";import{yt as h}from"./useSessionRows-CIakAaqj.js";import{O as g,T as _,k as v}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as y}from"./dist-DtnqB3m_.js";import{n as b,r as x}from"./dist-CMX7_OjZ.js";import{F as S,I as C,L as w,N as T,_ as E,dt as D,j as O}from"./dist-Sr6WSEaV.js";import{c as k}from"./dist-B5wMYzWI.js";var A,j=()=>A??=Promise.all([m(()=>import(`./standalone-YobQElH8.js`),[]),m(()=>import(`./babel-BaOs8qJH.js`),[]),m(()=>import(`./estree-Cw-tQG5d.js`),[])]).catch(e=>{throw A=void 0,e}),M=async e=>{let[t,n,r]=await j();return await t.format(e,{semi:!1,parser:`json`,printWidth:80,tabWidth:2,plugins:[n,r]})},N=e(v(),1),P=g(),F=S.theme({".cm-foldGutter .cm-gutterElement":{display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`0 4px`},".cm-fold-marker":{display:`inline-flex`,alignItems:`center`,justifyContent:`center`,width:`12px`,height:`12px`,boxSizing:`border-box`,border:`1px solid var(--border)`,borderRadius:`2px`,color:`var(--muted-foreground)`,fontSize:`var(--text-caption)`,lineHeight:`1`,cursor:`pointer`,userSelect:`none`},".cm-fold-marker:hover":{background:`var(--fill-hover)`,color:`var(--foreground)`},".cm-foldPlaceholder":{background:`var(--fill-hover)`,border:`1px solid var(--border)`,color:`var(--muted-foreground)`,borderRadius:`2px`,padding:`0 4px`,margin:`0 2px`}}),I=[E({markerDOM:e=>{let t=document.createElement(`span`);return t.className=`cm-fold-marker`,t.dataset.state=e?`open`:`closed`,t.title=e?`Fold`:`Unfold`,t.textContent=e?`−`:`+`,t}}),F];function L(e,t=5){if(!e?.properties)return[];let n=[];function r(e,i,a){if(a>t)return;let o=Array.isArray(e.type)?e.type.join(` | `):e.type;if(n.push({path:i,label:i,description:e.description??e.title,type:o}),e.properties)for(let[t,n]of Object.entries(e.properties))r(n,`${i}.${t}`,a+1);if(e.items?.properties)for(let[t,n]of Object.entries(e.items.properties))r(n,`${i}[].${t}`,a+1)}for(let[t,n]of Object.entries(e.properties))r(n,t,1);return n}function R(e){let t=L(e);return k({override:[z(t)],defaultKeymap:!0,closeOnBlur:!0,icons:!1})}function z(e){return t=>{let n=t.state.sliceDoc(Math.max(0,t.pos-50),t.pos).match(/\{\{([a-zA-Z0-9_.\[\]]*)?$/);if(!n)return null;let r=n[1]??``,i=t.pos-r.length,a=r?e.filter(e=>e.path.toLowerCase().startsWith(r.toLowerCase())):e;return a.length===0?null:{from:i,options:a.map(e=>({label:e.path,displayLabel:e.path,detail:e.type,info:e.description,apply:(e,t,n,r)=>{let i=r+(e.state.sliceDoc(r).match(/^[a-zA-Z0-9_.\[\]]*/)?.[0].length??0),a=e.state.sliceDoc(i,i+2)===`}}`,o=a?i:r,s=a?t.label:`${t.label}}}`;e.dispatch({changes:{from:n,to:o,insert:s},selection:{anchor:n+s.length}})}})),validFor:/^[a-zA-Z0-9_.\[\]]*$/}}}var B=/\{\{([a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)*)\}\}/g,V=T.mark({class:`cm-variable-highlight`}),H=new C({regexp:B,decoration:()=>V}),U=w.fromClass(class{decorations;constructor(e){this.decorations=H.createDeco(e)}update(e){this.decorations=H.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}),W=(e=`mono`)=>(0,N.useMemo)(()=>[l(e),O(d)],[e]),G=t(_(`relative overflow-hidden font-mono outline-hidden focus-within:outline-hidden focus:outline-hidden`,`transition-colors duration-normal ease-out-custom`),{variants:{variant:{default:_(i,`rounded-md p-1`,n),embedded:`rounded-none border-none bg-transparent p-0`,inline:`rounded-none border-none bg-transparent p-0`}},defaultVariants:{variant:`default`}}),K=(0,N.forwardRef)(({data:e,value:t,onChange:n,showCopyButton:i=!0,showFormatButton:l=!1,className:d,language:m=`json`,font:g=`mono`,highlightVariables:v=!1,placeholder:C,schema:w,autoFocus:T,lineNumbers:E=!0,lineWrapping:O=!0,editable:k,extensions:A,variant:j,id:F,"aria-label":L,"aria-labelledby":z,"aria-describedby":B,"aria-invalid":V,...H},K)=>{let{ariaLabel:q,contentAttributes:J}=c({id:F,"aria-label":L,"aria-labelledby":z,"aria-describedby":B,"aria-invalid":V},`Code editor`),Y=W(g),X=e?JSON.stringify(e,null,2):t??``,Z=l&&m===`json`&&k!==!1&&!!n,Q=async()=>{try{n?.((await M(X)).trimEnd())}catch{h.error(`Can’t format: the JSON is invalid`)}},$=(0,N.useMemo)(()=>{let e=[...o,J,j===`inline`?a:I];return O&&e.push(S.lineWrapping),m===`json`?e.push(y):m===`markdown`&&e.push(b({base:x,codeLanguages:s})),v&&m===`markdown`&&e.push(U),w&&m===`markdown`&&e.push(R(w)),k===!1&&e.push(D.readOnly.of(!0)),A&&e.push(...A),e},[A,j,m,v,w,k,O,J]);return(0,P.jsxs)(`div`,{className:_(G({variant:j}),d),...H,children:[(i||Z)&&(0,P.jsxs)(`div`,{className:`absolute top-2 right-2 z-20 flex gap-1`,children:[Z&&(0,P.jsx)(r,{type:`button`,size:`icon-sm`,tooltip:`Format JSON`,"aria-label":`Format JSON`,onClick:Q,children:(0,P.jsx)(p,{})}),i&&(0,P.jsx)(f,{content:X})]}),(0,P.jsx)(u,{ref:K,value:X,theme:Y,extensions:$,onChange:n,editable:k,"aria-label":q,placeholder:C,height:`100%`,style:{height:`100%`},autoFocus:T,basicSetup:{lineNumbers:E,foldGutter:!1}})]})});export{K as t};
|