duoops 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -63
- package/data/aws_machine_power_profiles.json +54 -0
- package/data/cpu_physical_specs.json +105 -0
- package/data/cpu_power_profiles.json +275 -0
- package/data/gcp_machine_power_profiles.json +1802 -0
- package/data/runtime-pue-mappings.json +183 -0
- package/dist/commands/ask.d.ts +3 -0
- package/dist/commands/ask.js +9 -3
- package/dist/commands/autofix-ci.d.ts +13 -0
- package/dist/commands/autofix-ci.js +114 -0
- package/dist/commands/autofix.d.ts +5 -0
- package/dist/commands/autofix.js +11 -0
- package/dist/commands/config.d.ts +10 -0
- package/dist/commands/config.js +47 -0
- package/dist/commands/init.js +50 -27
- package/dist/commands/mcp/deploy.d.ts +13 -0
- package/dist/commands/mcp/deploy.js +139 -0
- package/dist/commands/measure/calculate.js +2 -2
- package/dist/commands/portal.js +428 -11
- package/dist/lib/ai/agent.d.ts +6 -2
- package/dist/lib/ai/agent.js +51 -57
- package/dist/lib/ai/tools/editing.js +28 -13
- package/dist/lib/ai/tools/gitlab.d.ts +4 -0
- package/dist/lib/ai/tools/gitlab.js +166 -11
- package/dist/lib/ai/tools/measure.js +7 -3
- package/dist/lib/ai/tools/types.d.ts +3 -0
- package/dist/lib/ai/tools/types.js +1 -0
- package/dist/lib/config.d.ts +10 -0
- package/dist/lib/gcloud.d.ts +7 -0
- package/dist/lib/gcloud.js +105 -0
- package/dist/lib/gitlab/pipelines-service.d.ts +23 -0
- package/dist/lib/gitlab/pipelines-service.js +146 -0
- package/dist/lib/gitlab/runner-service.d.ts +11 -0
- package/dist/lib/gitlab/runner-service.js +15 -0
- package/dist/lib/portal/settings.d.ts +3 -0
- package/dist/lib/portal/settings.js +48 -0
- package/dist/lib/scaffold.d.ts +5 -0
- package/dist/lib/scaffold.js +32 -0
- package/dist/portal/assets/HomeDashboard-DlkwSyKx.js +1 -0
- package/dist/portal/assets/JobDetailsDrawer-7kXXMSH8.js +1 -0
- package/dist/portal/assets/JobsDashboard-D4pNc9TM.js +1 -0
- package/dist/portal/assets/MetricsDashboard-BcgzvzBz.js +1 -0
- package/dist/portal/assets/PipelinesDashboard-BNrSM9GB.js +1 -0
- package/dist/portal/assets/allPaths-CXDKahbk.js +1 -0
- package/dist/portal/assets/allPathsLoader-BF5PAx2c.js +2 -0
- package/dist/portal/assets/cache-YerT0Slh.js +6 -0
- package/dist/portal/assets/core-Cz8f3oSB.js +19 -0
- package/dist/portal/assets/{index-B6bzT1Vv.js → index-B9sNUqEC.js} +1 -1
- package/dist/portal/assets/index-BWa_E8Y7.css +1 -0
- package/dist/portal/assets/index-Bp4RqK05.js +1 -0
- package/dist/portal/assets/index-DW6Qp0d6.js +64 -0
- package/dist/portal/assets/index-Uc4Xhv31.js +1 -0
- package/dist/portal/assets/progressBar-C4SmnGeZ.js +1 -0
- package/dist/portal/assets/splitPathsBySizeLoader-C-T9_API.js +1 -0
- package/dist/portal/index.html +2 -2
- package/oclif.manifest.json +282 -93
- package/package.json +2 -1
- package/templates/.gitlab/duo/flows/duoops.yaml +114 -0
- package/templates/agents/agent.yml +45 -0
- package/templates/duoops-autofix-component.yml +52 -0
- package/templates/flows/flow.yml +283 -0
- package/dist/portal/assets/MetricsDashboard-DIsoz4Sl.js +0 -71
- package/dist/portal/assets/index-BP8FwWqA.css +0 -1
- package/dist/portal/assets/index-DkVG3jel.js +0 -70
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { createGitlabClient } from './client.js';
|
|
3
|
+
const DEFAULT_LIMIT = 20;
|
|
4
|
+
const MAX_LIMIT = 100;
|
|
5
|
+
export async function fetchPortalPipelines(projectId, options) {
|
|
6
|
+
if (!projectId) {
|
|
7
|
+
throw new Error('Project ID is required to fetch pipelines');
|
|
8
|
+
}
|
|
9
|
+
const client = createGitlabClient();
|
|
10
|
+
const perPage = clampLimit(options?.limit);
|
|
11
|
+
const page = normalizePage(options?.page);
|
|
12
|
+
const requestLimit = Math.min(perPage + 1, MAX_LIMIT);
|
|
13
|
+
const raw = await client.Pipelines.all(projectId, {
|
|
14
|
+
maxPages: 1,
|
|
15
|
+
orderBy: 'id',
|
|
16
|
+
page,
|
|
17
|
+
perPage: requestLimit,
|
|
18
|
+
sort: 'desc',
|
|
19
|
+
});
|
|
20
|
+
const normalized = normalizePipelines(raw);
|
|
21
|
+
const hasNextPage = normalized.length > perPage;
|
|
22
|
+
const visiblePipelines = hasNextPage ? normalized.slice(0, perPage) : normalized;
|
|
23
|
+
const commitMessages = await fetchCommitMessages(client, projectId, visiblePipelines);
|
|
24
|
+
const pipelines = visiblePipelines.map((pipeline) => ({
|
|
25
|
+
...pipeline,
|
|
26
|
+
commit_message: pipeline.sha ? commitMessages.get(pipeline.sha) ?? undefined : undefined,
|
|
27
|
+
}));
|
|
28
|
+
return {
|
|
29
|
+
hasNextPage,
|
|
30
|
+
hasPrevPage: page > 1,
|
|
31
|
+
page,
|
|
32
|
+
perPage,
|
|
33
|
+
pipelines,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function normalizePipelines(raw) {
|
|
37
|
+
const data = Array.isArray(raw)
|
|
38
|
+
? raw
|
|
39
|
+
: Array.isArray(raw?.data)
|
|
40
|
+
? raw.data
|
|
41
|
+
: raw === undefined || raw === null
|
|
42
|
+
? []
|
|
43
|
+
: [raw];
|
|
44
|
+
const arrayData = Array.isArray(data) ? data : [];
|
|
45
|
+
return arrayData
|
|
46
|
+
.map((item) => normalizePipeline(item))
|
|
47
|
+
.filter((pipeline) => pipeline !== null);
|
|
48
|
+
}
|
|
49
|
+
function normalizePipeline(raw) {
|
|
50
|
+
if (raw.id === undefined || raw.id === null) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const branch = typeof raw.ref === 'string' ? raw.ref : String(raw.ref ?? '');
|
|
54
|
+
const sha = typeof raw.sha === 'string' ? raw.sha : String(raw.sha ?? '');
|
|
55
|
+
const status = typeof raw.status === 'string' && raw.status.length > 0
|
|
56
|
+
? raw.status
|
|
57
|
+
: 'unknown';
|
|
58
|
+
const duration = typeof raw.duration === 'number'
|
|
59
|
+
? raw.duration
|
|
60
|
+
: typeof raw.duration === 'string'
|
|
61
|
+
? Number.parseFloat(raw.duration)
|
|
62
|
+
: undefined;
|
|
63
|
+
return {
|
|
64
|
+
branch,
|
|
65
|
+
created_at: typeof raw.created_at === 'string'
|
|
66
|
+
? raw.created_at
|
|
67
|
+
: raw.created_at
|
|
68
|
+
? String(raw.created_at)
|
|
69
|
+
: '',
|
|
70
|
+
duration_seconds: Number.isFinite(duration) ? duration : undefined,
|
|
71
|
+
id: Number(raw.id),
|
|
72
|
+
sha,
|
|
73
|
+
status,
|
|
74
|
+
triggered_by: extractUser(raw.user),
|
|
75
|
+
updated_at: typeof raw.updated_at === 'string'
|
|
76
|
+
? raw.updated_at
|
|
77
|
+
: raw.updated_at
|
|
78
|
+
? String(raw.updated_at)
|
|
79
|
+
: undefined,
|
|
80
|
+
web_url: typeof raw.web_url === 'string'
|
|
81
|
+
? raw.web_url
|
|
82
|
+
: raw.web_url
|
|
83
|
+
? String(raw.web_url)
|
|
84
|
+
: undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function extractUser(user) {
|
|
88
|
+
if (!user || typeof user !== 'object') {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
if (typeof user.name === 'string' && user.name.trim().length > 0) {
|
|
92
|
+
return user.name;
|
|
93
|
+
}
|
|
94
|
+
if (typeof user.username === 'string' && user.username.trim().length > 0) {
|
|
95
|
+
return user.username;
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
async function fetchCommitMessages(client, projectId, pipelines) {
|
|
100
|
+
const map = new Map();
|
|
101
|
+
const shas = [...new Set(pipelines
|
|
102
|
+
.map((pipeline) => pipeline.sha)
|
|
103
|
+
.filter(Boolean))];
|
|
104
|
+
await Promise.all(shas.map(async (sha) => {
|
|
105
|
+
try {
|
|
106
|
+
const commit = await client.Commits.show(projectId, sha);
|
|
107
|
+
const message = extractCommitMessage(commit);
|
|
108
|
+
if (message) {
|
|
109
|
+
map.set(sha, message);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
map.set(sha, '');
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
return map;
|
|
117
|
+
}
|
|
118
|
+
function extractCommitMessage(raw) {
|
|
119
|
+
if (!raw || typeof raw !== 'object') {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
const data = raw;
|
|
123
|
+
const { title } = data;
|
|
124
|
+
const { message } = data;
|
|
125
|
+
if (typeof title === 'string' && title.trim().length > 0) {
|
|
126
|
+
return title;
|
|
127
|
+
}
|
|
128
|
+
if (typeof message === 'string' && message.trim().length > 0) {
|
|
129
|
+
return message;
|
|
130
|
+
}
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
function clampLimit(limit) {
|
|
134
|
+
if (!Number.isFinite(limit ?? Number.NaN)) {
|
|
135
|
+
return DEFAULT_LIMIT;
|
|
136
|
+
}
|
|
137
|
+
const value = Math.floor(limit ?? DEFAULT_LIMIT);
|
|
138
|
+
return Math.min(Math.max(value, 1), MAX_LIMIT - 1);
|
|
139
|
+
}
|
|
140
|
+
function normalizePage(page) {
|
|
141
|
+
if (!Number.isFinite(page ?? Number.NaN)) {
|
|
142
|
+
return 1;
|
|
143
|
+
}
|
|
144
|
+
const parsed = Math.floor(page ?? 1);
|
|
145
|
+
return parsed > 0 ? parsed : 1;
|
|
146
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RunnerStatus {
|
|
2
|
+
architecture?: string;
|
|
3
|
+
contactedAt?: string;
|
|
4
|
+
description: string;
|
|
5
|
+
id: number;
|
|
6
|
+
ipAddress?: string;
|
|
7
|
+
online: boolean;
|
|
8
|
+
status: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function fetchProjectRunners(projectId: string): Promise<RunnerStatus[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createGitlabClient } from './client.js';
|
|
2
|
+
export async function fetchProjectRunners(projectId) {
|
|
3
|
+
const client = createGitlabClient();
|
|
4
|
+
const runners = await client.Runners.all({ perPage: 50, projectId });
|
|
5
|
+
return runners.map((runner) => ({
|
|
6
|
+
architecture: typeof runner.architecture === 'string' ? runner.architecture : undefined,
|
|
7
|
+
contactedAt: typeof runner.contacted_at === 'string' ? runner.contacted_at : undefined,
|
|
8
|
+
description: typeof runner.description === 'string' ? runner.description : 'Runner',
|
|
9
|
+
id: Number(runner.id),
|
|
10
|
+
ipAddress: typeof runner.ip_address === 'string' ? runner.ip_address : undefined,
|
|
11
|
+
online: Boolean(runner.status === 'online'),
|
|
12
|
+
status: typeof runner.status === 'string' ? runner.status : 'unknown',
|
|
13
|
+
version: typeof runner.version === 'string' ? runner.version : undefined,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { configManager } from '../config.js';
|
|
2
|
+
const DEFAULT_BUDGETS = [
|
|
3
|
+
{
|
|
4
|
+
id: 'carbon',
|
|
5
|
+
limit: 5000,
|
|
6
|
+
name: 'Monthly Carbon Budget',
|
|
7
|
+
period: 'This month',
|
|
8
|
+
unit: 'gCO2e',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: 'runtime',
|
|
12
|
+
limit: 7200,
|
|
13
|
+
name: 'Pipeline Runtime Budget',
|
|
14
|
+
period: 'Rolling 7 days',
|
|
15
|
+
unit: 'seconds',
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
export function getPortalBudgets() {
|
|
19
|
+
const config = configManager.get();
|
|
20
|
+
const budgets = config.portal?.budgets;
|
|
21
|
+
if (!budgets || budgets.length === 0) {
|
|
22
|
+
return DEFAULT_BUDGETS;
|
|
23
|
+
}
|
|
24
|
+
return mergeBudgets(budgets);
|
|
25
|
+
}
|
|
26
|
+
export function savePortalBudgets(budgets) {
|
|
27
|
+
const normalized = mergeBudgets(budgets);
|
|
28
|
+
const config = configManager.get();
|
|
29
|
+
configManager.set({
|
|
30
|
+
...config,
|
|
31
|
+
portal: {
|
|
32
|
+
...config.portal,
|
|
33
|
+
budgets: normalized,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function mergeBudgets(budgets) {
|
|
38
|
+
return DEFAULT_BUDGETS.map((defaultBudget) => {
|
|
39
|
+
const match = budgets.find((budget) => budget.id === defaultBudget.id);
|
|
40
|
+
if (!match)
|
|
41
|
+
return defaultBudget;
|
|
42
|
+
return {
|
|
43
|
+
...defaultBudget,
|
|
44
|
+
...match,
|
|
45
|
+
limit: Number(match.limit) || defaultBudget.limit,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
const TEMPLATES_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../templates');
|
|
5
|
+
const SCAFFOLD_FILES = [
|
|
6
|
+
'agents/agent.yml',
|
|
7
|
+
'flows/flow.yml',
|
|
8
|
+
'.gitlab/duo/flows/duoops.yaml',
|
|
9
|
+
];
|
|
10
|
+
export function scaffoldProject(targetDir) {
|
|
11
|
+
const created = [];
|
|
12
|
+
const skipped = [];
|
|
13
|
+
for (const relPath of SCAFFOLD_FILES) {
|
|
14
|
+
const src = path.join(TEMPLATES_DIR, relPath);
|
|
15
|
+
const dest = path.join(targetDir, relPath);
|
|
16
|
+
if (!fs.existsSync(src)) {
|
|
17
|
+
skipped.push(relPath);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
if (fs.existsSync(dest)) {
|
|
21
|
+
skipped.push(relPath);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const destDir = path.dirname(dest);
|
|
25
|
+
if (!fs.existsSync(destDir)) {
|
|
26
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
fs.copyFileSync(src, dest);
|
|
29
|
+
created.push(relPath);
|
|
30
|
+
}
|
|
31
|
+
return { created, skipped };
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as a,j as e,D as q,a as J,c as K,b as U,d as X,e as Y,S as D,I as c,B as l,T as u,f as E,g as N}from"./index-DW6Qp0d6.js";import{h as Q,g as Z,u as ee,C as r,a as j,s as te}from"./cache-YerT0Slh.js";import{P as re}from"./progressBar-C4SmnGeZ.js";const W=a.forwardRef((n,m)=>{const{actions:d,children:y,className:s,minimal:x=!1,...p}=n;return e.jsxs("div",{...p,className:K(U,s,{[X]:!x}),ref:m,children:[e.jsx("div",{className:q,children:y}),d!=null&&e.jsx("div",{className:J,children:d})]})});W.displayName=`${Y}.DialogFooter`;const R=n=>{switch(n){case"breached":return"danger";case"warning":return"warning";default:return"success"}};function ne({activeProjectId:n}){const m=a.useMemo(()=>n?{projectId:n}:{},[n]),d=a.useMemo(()=>Q(["dashboard",m]),[m]),y=a.useMemo(()=>Z(d)??void 0,[d]),{data:s,isLoading:x,error:p,isFetching:M,refetch:f}=ee({queryKey:["dashboard",n],queryFn:async()=>{const t=await j.get("/api/dashboard",{params:m});return te(d,t.data,{ttlMs:6e4}),t.data},initialData:y,staleTime:6e4,refetchInterval:1e3*60*2}),i=s?.summary,b=s?.budgets??[],S=s?.alerts??[],z=s?.recommendations??[],B=s?.runnerHealth??[],[L,g]=a.useState(!1),[I,C]=a.useState(s?.budgetSettings??[]),[_,k]=a.useState(!1),[G,F]=a.useState(!1),[o,w]=a.useState(null),[O,T]=a.useState(null);a.useEffect(()=>{s?.budgetSettings&&C(s.budgetSettings)},[s?.budgetSettings]);const H=a.useMemo(()=>i?i.totalEmissions>0&&i.avgEmissions>0?`Average job emits ${i.avgEmissions.toFixed(1)} gCO₂e`:"Measurements will appear after your first pipeline run.":null,[i]),A=async()=>{try{T(null),w(null),F(!0),k(!0);const t=await j.post("/api/autofix",{projectId:n});w(t.data)}catch(t){T(String(t))}finally{F(!1)}},P=(t,h)=>{C($=>$.map(v=>v.id===t?{...v,limit:h}:v))},V=async()=>{try{await j.put("/api/budgets",{budgets:I}),g(!1),f()}catch(t){alert(`Failed to save budgets: ${String(t)}`)}};return!s&&x?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(D,{size:40,intent:"success"})}):e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:24,maxWidth:1100,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24},children:[e.jsxs("div",{children:[e.jsxs("h1",{style:{fontSize:22,fontWeight:600,color:"var(--text-primary)",margin:0,display:"flex",alignItems:"center",gap:10},children:[e.jsx(c,{icon:"clean",size:20,style:{color:"var(--green-primary)"}}),"Sustainability Overview"]}),s?.projectId&&e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4},children:["Project ID: ",s.projectId]}),i?.lastIngestedAt&&e.jsxs("p",{style:{fontSize:12,color:"var(--text-muted)"},children:["Last update: ",new Date(i.lastIngestedAt).toLocaleString()]})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(l,{icon:"build",text:"Inspect Latest Failure",intent:"primary",outlined:!0,small:!0,onClick:A}),e.jsx(l,{icon:"cog",text:"Manage Budgets",outlined:!0,small:!0,onClick:()=>g(!0)}),e.jsx(l,{icon:"refresh",small:!0,outlined:!0,loading:M,onClick:()=>f()})]})]}),p&&e.jsx(r,{style:{background:"rgba(219, 55, 55, 0.1)",border:"1px solid rgba(219, 55, 55, 0.3)",marginBottom:16},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("span",{style:{color:"#f97171",fontSize:13},children:["Failed to load dashboard: ",String(p)]}),e.jsx(l,{small:!0,minimal:!0,text:"Retry",onClick:()=>f()})]})}),i&&e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(c,{icon:"clean",size:14,style:{color:"var(--green-primary)"}}),"Total Emissions"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[i.totalEmissions.toFixed(1)," g"]})]}),e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(c,{icon:"flame",size:14,style:{color:"#d29922"}}),"Avg per Job"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[i.avgEmissions.toFixed(1)," g"]})]}),e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(c,{icon:"tick-circle",size:14,style:{color:"#58a6ff"}}),"Jobs Tracked"]}),e.jsx("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:i.jobCount})]}),e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(c,{icon:"time",size:14,style:{color:"var(--green-primary)"}}),"Avg Runtime"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[i.avgRuntime.toFixed(0)," s"]})]})]}),i&&e.jsxs(r,{style:{background:"linear-gradient(135deg, rgba(45, 164, 78, 0.12), var(--bg-card))",border:"1px solid var(--border-default)",padding:20,marginBottom:24},children:[e.jsx(u,{intent:"success",minimal:!0,style:{marginBottom:8,fontSize:10,letterSpacing:1},children:"INSIGHT"}),e.jsx("p",{style:{fontSize:16,fontWeight:500,color:"var(--text-primary)",margin:0},children:H})]}),B.length>0&&e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,marginBottom:24},children:[e.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:"Runner Health"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 12px"},children:"Current fleet status"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:12},children:B.map(t=>e.jsxs(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:12},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:4},children:[e.jsx("span",{style:{fontSize:13,color:"var(--text-primary)"},children:t.description}),e.jsx(u,{intent:t.online?"success":"danger",minimal:!0,round:!0,style:{fontSize:11},children:t.online?"Online":"Offline"})]}),e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:0},children:["Status: ",t.status]}),t.version&&e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:0},children:["Version: ",t.version]})]},t.id))})]}),b.length>0&&e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,marginBottom:24},children:[e.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:"Budgets"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 12px"},children:"Track sustainability guardrails in real time."}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:12},children:b.map(t=>e.jsxs(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:6},children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontSize:13,color:"var(--text-primary)",margin:0},children:t.name}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",margin:0},children:t.period})]}),e.jsx(u,{intent:R(t.status),minimal:!0,style:{fontSize:11},children:t.status==="breached"?"Breached":t.status==="warning"?"Warning":"On Track"})]}),e.jsxs("div",{style:{fontSize:18,fontFamily:"monospace",color:"var(--text-primary)",marginBottom:10},children:[t.used.toFixed(1)," / ",t.limit.toFixed(0)," ",t.unit]}),e.jsx(re,{intent:R(t.status),value:Math.min(1,Math.max(0,t.percent/100)),stripes:!1,animate:!1})]},t.id))})]}),S.length>0&&e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,marginBottom:24},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx(c,{icon:"warning-sign",size:14,style:{color:"#d29922"}}),e.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",fontWeight:600},children:"Alerts"})]}),S.map(t=>e.jsx(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:12,marginBottom:8},children:e.jsx("span",{style:{fontSize:13,color:"var(--text-primary)"},children:t.message})},t.id))]}),z.length>0&&e.jsxs(r,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,marginBottom:24},children:[e.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:"Recommendations"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",margin:"0 0 12px"},children:"Generated by DuoOps agent"}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:12},children:z.map(t=>e.jsxs(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:14},children:[e.jsx("p",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",margin:"0 0 4px"},children:t.title}),e.jsx("p",{style:{fontSize:12,color:"var(--text-secondary)",lineHeight:1.5,margin:"0 0 6px"},children:t.description}),e.jsx(u,{minimal:!0,style:{fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:t.source==="agent"?"Agent":"Heuristic"})]},t.id))})]}),!x&&!p&&!i&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",padding:"48px 0"},children:"No sustainability data yet. Run the measurement component in your CI and refresh this page."}),e.jsxs(E,{isOpen:L,onClose:()=>g(!1),title:"Manage Budgets",icon:"cog",className:"bp5-dark",children:[e.jsxs(N,{children:[e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:16},children:"Adjust sustainability budgets to fit your targets."}),I.map(t=>e.jsxs("div",{style:{marginBottom:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:4},children:[e.jsx("span",{style:{fontSize:13,color:"var(--text-primary)"},children:t.name}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:t.period})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("input",{className:"bp5-input bp5-fill",type:"number",min:1,value:t.limit,onChange:h=>P(t.id,Number(h.target.value))}),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)",whiteSpace:"nowrap"},children:t.unit})]})]},t.id))]}),e.jsx(W,{actions:e.jsxs(e.Fragment,{children:[e.jsx(l,{text:"Cancel",onClick:()=>g(!1)}),e.jsx(l,{text:"Save Budgets",intent:"success",onClick:V})]})})]}),e.jsx(E,{isOpen:_,onClose:()=>k(!1),title:"Latest Pipeline Diagnosis",icon:"build",className:"bp5-dark",style:{width:640},children:e.jsx(N,{children:G?e.jsx("div",{style:{display:"flex",justifyContent:"center",padding:48},children:e.jsx(D,{size:40,intent:"success"})}):O?e.jsxs("div",{children:[e.jsx("p",{style:{color:"#f97171",fontSize:13},children:O}),e.jsx(l,{small:!0,text:"Retry",onClick:A,style:{marginTop:8}})]}):o?e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:12},children:[e.jsxs("p",{style:{fontSize:13,color:"var(--text-secondary)",margin:0},children:["Pipeline #",o.pipeline.id," on ",e.jsx("strong",{style:{color:"var(--text-primary)"},children:o.pipeline.ref})]}),e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"2px 0"},children:["Status: ",o.pipeline.status]}),o.pipeline.webUrl&&e.jsx("a",{href:o.pipeline.webUrl,target:"_blank",rel:"noreferrer",style:{fontSize:12,color:"var(--green-light)"},children:"View in GitLab"})]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",marginBottom:8},children:"Jobs"}),o.jobs.length===0?e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)"},children:"No job information returned."}):o.jobs.map(t=>e.jsxs("p",{style:{fontSize:12,color:"var(--text-secondary)",margin:"2px 0",fontFamily:"monospace"},children:["#",t.id," ",t.name," • ",t.stage," • ",t.status,t.duration?` (${t.duration}s)`:""]},t.id))]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",marginBottom:8},children:"Agent Recommendation"}),e.jsx(r,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:14},children:e.jsx("pre",{style:{fontSize:12,color:"var(--text-primary)",whiteSpace:"pre-wrap",margin:0,fontFamily:"monospace"},children:o.analysis})})]})]}):e.jsx("p",{style:{color:"var(--text-muted)",fontSize:13},children:"No analysis to display."})})})]})}export{ne as HomeDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as _,e as O,c as p,m as j,p as E,j as e,O as b,n as R,o as I,q as B,s as L,B as y,t as S,u as z,v as m,w as A,I as r,H as P,G as C}from"./index-DW6Qp0d6.js";import{C as o}from"./cache-YerT0Slh.js";import{P as x}from"./progressBar-C4SmnGeZ.js";const s={BOTTOM:"bottom",BOTTOM_LEFT:"bottom-left",BOTTOM_RIGHT:"bottom-right",LEFT:"left",LEFT_BOTTOM:"left-bottom",LEFT_TOP:"left-top",RIGHT:"right",TOP:"top",TOP_LEFT:"top-left",TOP_RIGHT:"top-right"};function F(t){return t===s.TOP||t===s.TOP_LEFT||t===s.TOP_RIGHT||t===s.BOTTOM||t===s.BOTTOM_LEFT||t===s.BOTTOM_RIGHT}function g(t){return t===s.TOP||t===s.TOP_LEFT||t===s.TOP_RIGHT?s.TOP:t===s.BOTTOM||t===s.BOTTOM_LEFT||t===s.BOTTOM_RIGHT?s.BOTTOM:t===s.LEFT||t===s.LEFT_TOP||t===s.LEFT_BOTTOM?s.LEFT:s.RIGHT}var c;(function(t){t.SMALL="360px",t.STANDARD="50%",t.LARGE="90%"})(c||(c={}));class D extends _{static displayName=`${O}.Drawer`;static defaultProps={canOutsideClickClose:!0,isOpen:!1,position:"right",style:{}};render(){const{hasBackdrop:i,size:a,style:n,position:l}=this.props,{className:u,children:f,...h}=this.props,d=g(l),T=p(j,{[E(d)??""]:!0},u),v=a==null?n:{...n,[F(d)?"height":"width"]:a};return e.jsx(b,{...h,className:p({[R]:i}),children:e.jsxs("div",{className:T,style:v,children:[this.maybeRenderHeader(),f]})})}validateProps(i){i.title==null&&(i.icon!=null&&console.warn(I),i.isCloseButtonShown!=null&&console.warn(B)),i.position!=null&&i.position!==g(i.position)&&console.warn(L)}maybeRenderCloseButton(){return this.props.isCloseButtonShown!==!1?e.jsx(y,{"aria-label":"Close",className:S,icon:e.jsx(z,{size:m.LARGE}),onClick:this.props.onClose,variant:"minimal"}):null}maybeRenderHeader(){const{icon:i,title:a}=this.props;return a==null?null:e.jsxs("div",{className:A,children:[e.jsx(r,{icon:i,size:m.LARGE}),e.jsx(P,{children:a}),this.maybeRenderCloseButton()]})}}function M({job:t,onClose:i}){return t?e.jsx(D,{isOpen:!!t,onClose:i,size:c.SMALL,position:"right",title:e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(r,{icon:"console",style:{color:"var(--green-primary)"}}),"Job Details"]}),className:"bp5-dark",children:e.jsxs("div",{style:{padding:20,display:"flex",flexDirection:"column",gap:24,overflowY:"auto"},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{fontSize:20,fontWeight:700,color:"var(--text-primary)",margin:0},children:t.gitlab_job_name||`Job ${t.gitlab_job_id}`}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,fontFamily:"monospace",color:"var(--text-muted)",marginTop:4},children:[e.jsxs("span",{children:["ID: ",t.gitlab_job_id]}),e.jsx("span",{children:"•"}),e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(r,{icon:"time",size:10}),new Date(t.ingested_at.value).toLocaleString()]})]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[e.jsxs(o,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-default)",padding:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1,color:"var(--text-muted)",marginBottom:4},children:[e.jsx(r,{icon:"clean",size:12,style:{color:"var(--green-primary)"}}),"Emissions"]}),e.jsxs("div",{style:{fontSize:20,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[t.total_emissions_g.toFixed(2)," ",e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"gCO₂e"})]})]}),e.jsxs(o,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-default)",padding:14},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1,color:"var(--text-muted)",marginBottom:4},children:[e.jsx(r,{icon:"flash",size:12,style:{color:"#d29922"}}),"Energy"]}),e.jsxs("div",{style:{fontSize:20,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[(t.energy_kwh*1e3).toFixed(2)," ",e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"Wh"})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:1,color:"var(--text-muted)",marginBottom:12},children:"Resource Utilization"}),e.jsxs(o,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-default)",padding:14},children:[e.jsxs("div",{style:{marginBottom:14},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,marginBottom:6},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text-secondary)"},children:[e.jsx(r,{icon:"dashboard",size:14,style:{color:"var(--text-muted)"}})," CPU Usage"]}),e.jsxs("span",{style:{fontFamily:"monospace",color:"var(--text-primary)"},children:[(t.cpu_utilization_avg*100).toFixed(1),"%"]})]}),e.jsx(x,{value:t.cpu_utilization_avg,intent:"primary",stripes:!1,animate:!1})]}),e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:13,marginBottom:6},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"var(--text-secondary)"},children:[e.jsx(r,{icon:"pulse",size:14,style:{color:"var(--text-muted)"}})," RAM Usage"]}),e.jsxs("span",{style:{fontFamily:"monospace",color:"var(--text-primary)"},children:[(t.ram_utilization_avg*100).toFixed(1),"%"]})]}),e.jsx(x,{value:t.ram_utilization_avg,intent:"success",stripes:!1,animate:!1})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:1,color:"var(--text-muted)",marginBottom:12},children:"Environment Details"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[{icon:"cog",label:"Machine Type",value:e.jsx("code",{style:{background:"var(--bg-tertiary)",padding:"2px 8px",borderRadius:4,fontSize:12},children:t.machine_type})},{icon:"map-marker",label:"Region",value:t.region||"us-central1"},{icon:"person",label:"Triggered By",value:t.gitlab_user_name||"Unknown"},{icon:"time",label:"Duration",value:e.jsxs("span",{style:{fontFamily:"monospace"},children:[t.runtime_seconds?.toFixed(1),"s"]})}].map(({icon:a,label:n,value:l})=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 0",borderBottom:"1px solid var(--border-muted)",fontSize:13},children:[e.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8,color:"var(--text-muted)"},children:[e.jsx(r,{icon:a,size:14})," ",n]}),e.jsx("span",{style:{color:"var(--text-primary)"},children:l})]},n))})]}),e.jsx(y,{fill:!0,intent:"success",icon:e.jsx(C,{style:{width:16,height:16}}),text:"View Job on GitLab",onClick:()=>window.open(`https://gitlab.com/projects/${t.gitlab_project_id}/jobs/${t.gitlab_job_id}`,"_blank")})]})}):null}export{M as J};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as i,j as e,S as M,G as D,I as g,l as R,B as E,T as K}from"./index-DW6Qp0d6.js";import{h as L,g as $,u as N,C as n,a as O,s as U}from"./cache-YerT0Slh.js";import{J as V}from"./JobDetailsDrawer-7kXXMSH8.js";import"./progressBar-C4SmnGeZ.js";function Q({activeProjectId:d}){const[x,k]=i.useState("emissions"),[h,F]=i.useState("desc"),[c,w]=i.useState("all"),[m,C]=i.useState(""),[J,v]=i.useState(null),u=i.useMemo(()=>d?{projectId:d}:{},[d]),p=i.useMemo(()=>L(["jobs-dashboard",u]),[u]),T=i.useMemo(()=>$(p)??void 0,[p]),{data:r,isLoading:b,error:y,isFetching:A}=N({queryKey:["jobs-dashboard",d],queryFn:async()=>{const t=await O.get("/api/metrics",{params:u});return U(p,t.data,{ttlMs:45e3}),t.data},initialData:T,staleTime:45e3}),I=i.useMemo(()=>{if(!r)return[];const t=new Set(r.map(s=>s.machine_type).filter(Boolean));return Array.from(t)},[r]),j=i.useMemo(()=>r?r.filter(t=>{if(c!=="all"&&t.machine_type!==c)return!1;if(!m.trim())return!0;const s=m.toLowerCase();return String(t.gitlab_job_id).includes(s)||t.gitlab_job_name?.toLowerCase().includes(s)||t.gitlab_user_name?.toLowerCase().includes(s)}):[],[r,c,m]),W=i.useMemo(()=>{const t=s=>{switch(x){case"runtime":return s.runtime_seconds??0;case"energy":return s.energy_kwh??0;case"intensity":return s.energy_kwh>0?s.total_emissions_g/(s.energy_kwh*1e3):s.total_emissions_g;default:return s.total_emissions_g}};return[...j].sort((s,l)=>{const S=t(s),z=t(l);return h==="desc"?z-S:S-z})},[j,h,x]),a=i.useMemo(()=>!r||r.length===0?null:[...r].sort((t,s)=>s.total_emissions_g-t.total_emissions_g)[0],[r]),o=i.useMemo(()=>!r||r.length===0?null:[...r].sort((t,s)=>(s.runtime_seconds??0)-(t.runtime_seconds??0))[0],[r]),B=r&&r.length>0?r.reduce((t,s)=>t+s.total_emissions_g,0)/r.length:0,f=r&&r.length>0?r.reduce((t,s)=>t+(s.runtime_seconds??0),0)/r.length:0,_=i.useMemo(()=>{if(!r||r.length===0)return[];const t=r.find(l=>typeof l.cpu_utilization_avg=="number"&&l.cpu_utilization_avg<.4&&(l.runtime_seconds??0)>300),s=[];return a&&s.push({title:`Job ${a.gitlab_job_id} emits ${a.total_emissions_g.toFixed(1)} gCO₂e`,description:"Consider caching dependencies or breaking the workload into smaller stages to limit repeated compute."}),o&&(o.runtime_seconds??0)>f*1.5&&s.push({title:`Job ${o.gitlab_job_id} runs for ${(o.runtime_seconds??0).toFixed(0)} seconds`,description:"Investigate parallelizing the work or using a larger machine type temporarily to shorten the critical path."}),t&&s.push({title:`Job ${t.gitlab_job_id} averages ${(t.cpu_utilization_avg*100).toFixed(0)}% CPU`,description:"This workload looks underutilized—downsize the runner or combine tasks to improve efficiency."}),s.slice(0,3)},[f,o,r,a]);return(!r||r.length===0)&&b?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(M,{size:40,intent:"success"})}):e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:24,maxWidth:1100,margin:"0 auto"},children:[e.jsx(V,{job:J,onClose:()=>v(null)}),r&&r.length>0&&A&&e.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textAlign:"right",marginBottom:8},children:"Refreshing jobs…"}),y&&e.jsx(n,{style:{background:"rgba(219,55,55,0.1)",border:"1px solid rgba(219,55,55,0.3)",marginBottom:16,padding:14},children:e.jsxs("span",{style:{color:"#f97171",fontSize:13},children:["Failed to load jobs: ",String(y)]})}),r&&r.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[e.jsxs(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(D,{style:{width:14,height:14}}),"Jobs Tracked"]}),e.jsx("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:r.length})]}),e.jsxs(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(g,{icon:"flame",size:14,style:{color:"#d29922"}}),"Avg Emissions"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[B.toFixed(1)," ",e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"gCO₂e"})]}),a&&e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 0 0"},children:["Top: Job ",a.gitlab_job_id," (",a.total_emissions_g.toFixed(0)," g)"]})]}),e.jsxs(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(g,{icon:"time",size:14,style:{color:"#58a6ff"}}),"Avg Runtime"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[f.toFixed(0)," ",e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:"s"})]}),o&&e.jsxs("p",{style:{fontSize:11,color:"var(--text-muted)",margin:"4px 0 0"},children:["Longest: Job ",o.gitlab_job_id," (",(o.runtime_seconds??0).toFixed(0)," s)"]})]}),e.jsxs(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(g,{icon:"flash",size:14,style:{color:"var(--green-primary)"}}),"Energy / Job"]}),e.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[(r.reduce((t,s)=>t+s.energy_kwh,0)/r.length).toFixed(2),e.jsx("span",{style:{fontSize:12,color:"var(--text-muted)"},children:" kWh"})]})]})]}),e.jsx(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,marginBottom:24},children:e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("div",{style:{flex:1,minWidth:200},children:e.jsx(R,{leftIcon:"search",placeholder:"Search by job ID, name, or user",value:m,onChange:t=>C(t.target.value)})}),e.jsx("div",{className:"bp5-html-select",style:{minWidth:160},children:e.jsxs("select",{value:c,onChange:t=>w(t.target.value),style:{background:"var(--bg-primary)",border:"1px solid var(--border-default)",color:"var(--text-primary)",borderRadius:6,padding:"6px 8px",fontSize:12},children:[e.jsx("option",{value:"all",children:"All machine types"}),I.map(t=>e.jsx("option",{value:t,children:t},t))]})}),e.jsx("div",{className:"bp5-html-select",style:{minWidth:140},children:e.jsxs("select",{value:x,onChange:t=>k(t.target.value),style:{background:"var(--bg-primary)",border:"1px solid var(--border-default)",color:"var(--text-primary)",borderRadius:6,padding:"6px 8px",fontSize:12},children:[e.jsx("option",{value:"emissions",children:"Sort by emissions"}),e.jsx("option",{value:"runtime",children:"Sort by runtime"}),e.jsx("option",{value:"energy",children:"Sort by energy"}),e.jsx("option",{value:"intensity",children:"Sort by intensity"})]})}),e.jsx(E,{small:!0,icon:"sort",text:h==="desc"?"Desc":"Asc",onClick:()=>F(t=>t==="desc"?"asc":"desc")})]})}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"2fr 1fr",gap:16},children:[e.jsx(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:0,overflow:"hidden"},children:e.jsx("div",{style:{maxHeight:520,overflowY:"auto"},children:e.jsxs("table",{className:"bp5-html-table bp5-html-table-condensed",style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Job"}),e.jsx("th",{children:"Machine"}),e.jsx("th",{style:{textAlign:"right"},children:"Runtime (s)"}),e.jsx("th",{style:{textAlign:"right"},children:"Energy (Wh)"}),e.jsx("th",{style:{textAlign:"right"},children:"Emissions (g)"}),e.jsx("th",{style:{textAlign:"right"},children:"Intensity"}),e.jsx("th",{children:"User"})]})}),e.jsx("tbody",{children:W.map(t=>{const s=t.energy_kwh>0?t.total_emissions_g/(t.energy_kwh*1e3):0;return e.jsxs("tr",{style:{cursor:"pointer"},onClick:()=>v(t),children:[e.jsx("td",{children:e.jsxs("div",{children:[e.jsxs("span",{style:{fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:["Job ",t.gitlab_job_id]}),e.jsx("br",{}),e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:t.gitlab_job_name||"Unnamed job"})]})}),e.jsx("td",{children:e.jsx(K,{minimal:!0,style:{fontSize:11,fontFamily:"monospace"},children:t.machine_type})}),e.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:(t.runtime_seconds??0).toFixed(0)}),e.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:(t.energy_kwh*1e3).toFixed(0)}),e.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:t.total_emissions_g.toFixed(1)}),e.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:s.toFixed(2)}),e.jsx("td",{style:{fontSize:12,color:"var(--text-secondary)"},children:t.gitlab_user_name||"Unknown"})]},t.gitlab_job_id)})})]})})}),e.jsxs(n,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx(g,{icon:"warning-sign",size:14,style:{color:"#d29922"}}),e.jsx("span",{style:{fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",fontWeight:600},children:"Optimization Opportunities"})]}),_.length===0?e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)"},children:"No obvious issues detected. Keep collecting data to surface new opportunities."}):e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:_.map(t=>e.jsxs(n,{style:{background:"var(--bg-primary)",border:"1px solid var(--border-muted)",padding:12},children:[e.jsx("p",{style:{fontSize:13,fontWeight:500,color:"var(--text-primary)",margin:"0 0 4px"},children:t.title}),e.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",lineHeight:1.5,margin:0},children:t.description})]},t.title))})]})]})]}):!b&&!y&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",padding:32},children:"No job data available. Run the measurement component to populate this view."})]})}export{Q as JobsDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as D,j as l,S as q,I as Q}from"./index-DW6Qp0d6.js";import{h as ee,g as te,u as re,C as I,a as ie,s as oe}from"./cache-YerT0Slh.js";import{_ as w,c as $,r as ae,e as se,l as ne,u as J,s as le,i as ce,g as G,n as he,Z as de,a as F,b as ue,t as pe,d as Z,f as B,h as me,G as P,j as ye,k as ge,m as fe,o as ve,p as V,q as be,v as Se,w as xe,x as _e,S as Ie,B as Ce,P as De,C as je,y as H,z as we,R as ze,A as T,D as Ae,E as Te,F as Le,H as Me,I as Pe,J as Re}from"./core-Cz8f3oSB.js";import{J as Oe}from"./JobDetailsDrawer-7kXXMSH8.js";import"./progressBar-C4SmnGeZ.js";var ke=(function(n){w(t,n);function t(e,r,a,i){var o=n.call(this)||this;return o.updateData(e,r,a,i),o}return t.prototype._createSymbol=function(e,r,a,i,o,s){this.removeAll();var c=$(e,-1,-1,2,2,null,s);c.attr({z2:ae(o,100),culling:!0,scaleX:i[0]/2,scaleY:i[1]/2}),c.drift=Ee,this._symbolType=e,this.add(c)},t.prototype.stopSymbolAnimation=function(e){this.childAt(0).stopAnimation(null,e)},t.prototype.getSymbolType=function(){return this._symbolType},t.prototype.getSymbolPath=function(){return this.childAt(0)},t.prototype.highlight=function(){se(this.childAt(0))},t.prototype.downplay=function(){ne(this.childAt(0))},t.prototype.setZ=function(e,r){var a=this.childAt(0);a.zlevel=e,a.z=r},t.prototype.setDraggable=function(e,r){var a=this.childAt(0);a.draggable=e,a.cursor=!r&&e?"move":a.cursor},t.prototype.updateData=function(e,r,a,i){this.silent=!1;var o=e.getItemVisual(r,"symbol")||"circle",s=e.hostModel,c=t.getSymbolSize(e,r),p=t.getSymbolZ2(e,r),y=o!==this._symbolType,d=i&&i.disableAnimation;if(y){var m=e.getItemVisual(r,"symbolKeepAspect");this._createSymbol(o,e,r,c,p,m)}else{var h=this.childAt(0);h.silent=!1;var v={scaleX:c[0]/2,scaleY:c[1]/2};d?h.attr(v):J(h,v,s,r),le(h)}if(this._updateCommon(e,r,c,a,i),y){var h=this.childAt(0);if(!d){var v={scaleX:this._sizeX,scaleY:this._sizeY,style:{opacity:h.style.opacity}};h.scaleX=h.scaleY=0,h.style.opacity=0,ce(h,v,s,r)}}d&&this.childAt(0).stopAnimation("leave")},t.prototype._updateCommon=function(e,r,a,i,o){var s=this.childAt(0),c=e.hostModel,p,y,d,m,h,v,x,b,u;if(i&&(p=i.emphasisItemStyle,y=i.blurItemStyle,d=i.selectItemStyle,m=i.focus,h=i.blurScope,x=i.labelStatesModels,b=i.hoverScale,u=i.cursorStyle,v=i.emphasisDisabled),!i||e.hasItemOption){var f=i&&i.itemModel?i.itemModel:e.getItemModel(r),g=f.getModel("emphasis");p=g.getModel("itemStyle").getItemStyle(),d=f.getModel(["select","itemStyle"]).getItemStyle(),y=f.getModel(["blur","itemStyle"]).getItemStyle(),m=g.get("focus"),h=g.get("blurScope"),v=g.get("disabled"),x=G(f),b=g.getShallow("scale"),u=f.getShallow("cursor")}var _=e.getItemVisual(r,"symbolRotate");s.attr("rotation",(_||0)*Math.PI/180||0);var S=he(e.getItemVisual(r,"symbolOffset"),a);S&&(s.x=S[0],s.y=S[1]),u&&s.attr("cursor",u);var C=e.getItemVisual(r,"style"),R=C.fill;if(s instanceof de){var j=s.style;s.useStyle(F({image:j.image,x:j.x,y:j.y,width:j.width,height:j.height},C))}else s.__isEmptyBrush?s.useStyle(F({},C)):s.useStyle(C),s.style.decal=null,s.setColor(R,o&&o.symbolInnerColor),s.style.strokeNoScale=!0;var O=e.getItemVisual(r,"liftZ"),z=this._z2;O!=null?z==null&&(this._z2=s.z2,s.z2+=O):z!=null&&(s.z2=z,this._z2=null);var X=o&&o.useNameLabel;ue(s,x,{labelFetcher:c,labelDataIndex:r,defaultText:K,inheritColor:R,defaultOpacity:C.opacity});function K(E){return X?e.getName(E):ye(e,E)}this._sizeX=a[0]/2,this._sizeY=a[1]/2;var A=s.ensureState("emphasis");A.style=p,s.ensureState("select").style=d,s.ensureState("blur").style=y;var k=b==null||b===!0?Math.max(1.1,3/this._sizeY):isFinite(b)&&b>0?+b:1;A.scaleX=this._sizeX*k,A.scaleY=this._sizeY*k,this.setSymbolScale(1),pe(this,m,h,v)},t.prototype.setSymbolScale=function(e){this.scaleX=this.scaleY=e},t.prototype.fadeOut=function(e,r,a){var i=this.childAt(0),o=Z(this).dataIndex,s=a&&a.animation;if(this.silent=i.silent=!0,a&&a.fadeLabel){var c=i.getTextContent();c&&B(c,{style:{opacity:0}},r,{dataIndex:o,removeOpt:s,cb:function(){i.removeTextContent()}})}else i.removeTextContent();B(i,{style:{opacity:0},scaleX:0,scaleY:0},r,{dataIndex:o,cb:e,removeOpt:s})},t.getSymbolSize=function(e,r){return me(e.getItemVisual(r,"symbolSize"))},t.getSymbolZ2=function(e,r){return e.getItemVisual(r,"z2")},t})(P);function Ee(n,t){this.parent.drift(n,t)}function L(n,t,e,r){return t&&!isNaN(t[0])&&!isNaN(t[1])&&!(r.isIgnore&&r.isIgnore(e))&&!(r.clipShape&&!r.clipShape.contain(t[0],t[1]))&&n.getItemVisual(e,"symbol")!=="none"}function N(n){return n!=null&&!fe(n)&&(n={isIgnore:n}),n||{}}function W(n){var t=n.hostModel,e=t.getModel("emphasis");return{emphasisItemStyle:e.getModel("itemStyle").getItemStyle(),blurItemStyle:t.getModel(["blur","itemStyle"]).getItemStyle(),selectItemStyle:t.getModel(["select","itemStyle"]).getItemStyle(),focus:e.get("focus"),blurScope:e.get("blurScope"),emphasisDisabled:e.get("disabled"),hoverScale:e.get("scale"),labelStatesModels:G(t),cursorStyle:t.get("cursor")}}var Fe=(function(){function n(t){this.group=new P,this._SymbolCtor=t||ke}return n.prototype.updateData=function(t,e){this._progressiveEls=null,e=N(e);var r=this.group,a=t.hostModel,i=this._data,o=this._SymbolCtor,s=e.disableAnimation,c=W(t),p={disableAnimation:s},y=e.getSymbolPoint||function(d){return t.getItemLayout(d)};i||r.removeAll(),t.diff(i).add(function(d){var m=y(d);if(L(t,m,d,e)){var h=new o(t,d,c,p);h.setPosition(m),t.setItemGraphicEl(d,h),r.add(h)}}).update(function(d,m){var h=i.getItemGraphicEl(m),v=y(d);if(!L(t,v,d,e)){r.remove(h);return}var x=t.getItemVisual(d,"symbol")||"circle",b=h&&h.getSymbolType&&h.getSymbolType();if(!h||b&&b!==x)r.remove(h),h=new o(t,d,c,p),h.setPosition(v);else{h.updateData(t,d,c,p);var u={x:v[0],y:v[1]};s?h.attr(u):J(h,u,a)}r.add(h),t.setItemGraphicEl(d,h)}).remove(function(d){var m=i.getItemGraphicEl(d);m&&m.fadeOut(function(){r.remove(m)},a)}).execute(),this._getSymbolPoint=y,this._data=t},n.prototype.updateLayout=function(){var t=this,e=this._data;e&&e.eachItemGraphicEl(function(r,a){var i=t._getSymbolPoint(a);r.setPosition(i),r.markRedraw()})},n.prototype.incrementalPrepareUpdate=function(t){this._seriesScope=W(t),this._data=null,this.group.removeAll()},n.prototype.incrementalUpdate=function(t,e,r){this._progressiveEls=[],r=N(r);function a(c){c.isGroup||(c.incremental=!0,c.ensureState("emphasis").hoverLayer=!0)}for(var i=t.start;i<t.end;i++){var o=e.getItemLayout(i);if(L(e,o,i,r)){var s=new this._SymbolCtor(e,i,this._seriesScope);s.traverse(a),s.setPosition(o),this.group.add(s),e.setItemGraphicEl(i,s),this._progressiveEls.push(s)}}},n.prototype.eachRendered=function(t){ge(this._progressiveEls||this.group,t)},n.prototype.remove=function(t){var e=this.group,r=this._data;r&&t?r.eachItemGraphicEl(function(a){a.fadeOut(function(){e.remove(a)},r.hostModel)}):e.removeAll()},n})();function U(n,t){return{seriesType:n,plan:Se(),reset:function(e){var r=e.getData(),a=e.coordinateSystem,i=e.pipelineContext,o=i.large;if(a){var s=ve(a.dimensions,function(h){return r.mapDimension(h)}).slice(0,2),c=s.length,p=r.getCalculationInfo("stackResultDimension");V(r,s[0])&&(s[0]=p),V(r,s[1])&&(s[1]=p);var y=r.getStore(),d=r.getDimensionIndex(s[0]),m=r.getDimensionIndex(s[1]);return c&&{progress:function(h,v){for(var x=h.end-h.start,b=o&&be(x*c),u=[],f=[],g=h.start,_=0;g<h.end;g++){var S=void 0;if(c===1){var C=y.get(d,g);S=a.dataToPoint(C,null,f)}else u[0]=y.get(d,g),u[1]=y.get(m,g),S=a.dataToPoint(u,null,f);o?(b[_++]=S[0],b[_++]=S[1]):v.setItemLayout(g,S.slice())}o&&v.setLayout("points",b)}}}}}}var Be=(function(n){w(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.type=t.type,e.hasSymbolVisual=!0,e}return t.prototype.getInitialData=function(e,r){return xe(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){var e=this.option.progressive;return e??(this.option.large?5e3:this.get("progressive"))},t.prototype.getProgressiveThreshold=function(){var e=this.option.progressiveThreshold;return e??(this.option.large?1e4:this.get("progressiveThreshold"))},t.prototype.brushSelector=function(e,r,a){return a.point(r.getItemLayout(e))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},t.type="series.scatter",t.dependencies=["grid","polar","geo","singleAxis","calendar","matrix"],t.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:_e.color.primary}},universalTransition:{divideShape:"clone"}},t})(Ie),Y=4,Ve=(function(){function n(){}return n})(),Ne=(function(n){w(t,n);function t(e){var r=n.call(this,e)||this;return r._off=0,r.hoverDataIdx=-1,r}return t.prototype.getDefaultShape=function(){return new Ve},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.buildPath=function(e,r){var a=r.points,i=r.size,o=this.symbolProxy,s=o.shape,c=e.getContext?e.getContext():e,p=c&&i[0]<Y,y=this.softClipShape,d;if(p){this._ctx=c;return}for(this._ctx=null,d=this._off;d<a.length;){var m=a[d++],h=a[d++];isNaN(m)||isNaN(h)||y&&!y.contain(m,h)||(s.x=m-i[0]/2,s.y=h-i[1]/2,s.width=i[0],s.height=i[1],o.buildPath(e,s,!0))}this.incremental&&(this._off=d,this.notClear=!0)},t.prototype.afterBrush=function(){var e=this.shape,r=e.points,a=e.size,i=this._ctx,o=this.softClipShape,s;if(i){for(s=this._off;s<r.length;){var c=r[s++],p=r[s++];isNaN(c)||isNaN(p)||o&&!o.contain(c,p)||i.fillRect(c-a[0]/2,p-a[1]/2,a[0],a[1])}this.incremental&&(this._off=s,this.notClear=!0)}},t.prototype.findDataIndex=function(e,r){for(var a=this.shape,i=a.points,o=a.size,s=Math.max(o[0],4),c=Math.max(o[1],4),p=i.length/2-1;p>=0;p--){var y=p*2,d=i[y]-s/2,m=i[y+1]-c/2;if(e>=d&&r>=m&&e<=d+s&&r<=m+c)return p}return-1},t.prototype.contain=function(e,r){var a=this.transformCoordToLocal(e,r),i=this.getBoundingRect();if(e=a[0],r=a[1],i.contain(e,r)){var o=this.hoverDataIdx=this.findDataIndex(e,r);return o>=0}return this.hoverDataIdx=-1,!1},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var r=this.shape,a=r.points,i=r.size,o=i[0],s=i[1],c=1/0,p=1/0,y=-1/0,d=-1/0,m=0;m<a.length;){var h=a[m++],v=a[m++];c=Math.min(h,c),y=Math.max(h,y),p=Math.min(v,p),d=Math.max(v,d)}e=this._rect=new Ce(c-o/2,p-s/2,y-c+o,d-p+s)}return e},t})(De),We=(function(){function n(){this.group=new P}return n.prototype.updateData=function(t,e){this._clear();var r=this._create();r.setShape({points:t.getLayout("points")}),this._setCommon(r,t,e)},n.prototype.updateLayout=function(t){var e=t.getLayout("points");this.group.eachChild(function(r){if(r.startIndex!=null){var a=(r.endIndex-r.startIndex)*2,i=r.startIndex*4*2;e=new Float32Array(e.buffer,i,a)}r.setShape("points",e),r.reset()})},n.prototype.incrementalPrepareUpdate=function(t){this._clear()},n.prototype.incrementalUpdate=function(t,e,r){var a=this._newAdded[0],i=e.getLayout("points"),o=a&&a.shape.points;if(o&&o.length<2e4){var s=o.length,c=new Float32Array(s+i.length);c.set(o),c.set(i,s),a.endIndex=t.end,a.setShape({points:c})}else{this._newAdded=[];var p=this._create();p.startIndex=t.start,p.endIndex=t.end,p.incremental=!0,p.setShape({points:i}),this._setCommon(p,e,r)}},n.prototype.eachRendered=function(t){this._newAdded[0]&&t(this._newAdded[0])},n.prototype._create=function(){var t=new Ne({cursor:"default"});return t.ignoreCoarsePointer=!0,this.group.add(t),this._newAdded.push(t),t},n.prototype._setCommon=function(t,e,r){var a=e.hostModel;r=r||{};var i=e.getVisual("symbolSize");t.setShape("size",i instanceof Array?i:[i,i]),t.softClipShape=r.clipShape||null,t.symbolProxy=$(e.getVisual("symbol"),0,0,0,0),t.setColor=t.symbolProxy.setColor;var o=t.shape.size[0]<Y;t.useStyle(a.getModel("itemStyle").getItemStyle(o?["color","shadowBlur","shadowColor"]:["color"]));var s=e.getVisual("style"),c=s&&s.fill;c&&t.setColor(c);var p=Z(t);p.seriesIndex=a.seriesIndex,t.on("mousemove",function(y){p.dataIndex=null;var d=t.hoverDataIdx;d>=0&&(p.dataIndex=d+(t.startIndex||0))})},n.prototype.remove=function(){this._clear()},n.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},n})(),$e=(function(n){w(t,n);function t(){var e=n!==null&&n.apply(this,arguments)||this;return e.type=t.type,e}return t.prototype.render=function(e,r,a){var i=e.getData(),o=this._updateSymbolDraw(i,e);o.updateData(i,{clipShape:this._getClipShape(e)}),this._finished=!0},t.prototype.incrementalPrepareRender=function(e,r,a){var i=e.getData(),o=this._updateSymbolDraw(i,e);o.incrementalPrepareUpdate(i),this._finished=!1},t.prototype.incrementalRender=function(e,r,a){this._symbolDraw.incrementalUpdate(e,r.getData(),{clipShape:this._getClipShape(r)}),this._finished=e.end===r.getData().count()},t.prototype.updateTransform=function(e,r,a){var i=e.getData();if(this.group.dirty(),!this._finished||i.count()>1e4)return{update:!0};var o=U("").reset(e,r,a);o.progress&&o.progress({start:0,end:i.count(),count:i.count()},i),this._symbolDraw.updateLayout(i)},t.prototype.eachRendered=function(e){this._symbolDraw&&this._symbolDraw.eachRendered(e)},t.prototype._getClipShape=function(e){if(e.get("clip",!0)){var r=e.coordinateSystem;return r&&r.getArea&&r.getArea(.1)}},t.prototype._updateSymbolDraw=function(e,r){var a=this._symbolDraw,i=r.pipelineContext,o=i.large;return(!a||o!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=o?new We:new Fe,this._isLargeDraw=o,this.group.removeAll()),this.group.add(a.group),a},t.prototype.remove=function(e,r){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},t.prototype.dispose=function(){},t.type="scatter",t})(je);function Je(n){H(we),n.registerSeriesModel(Be),n.registerChartView($e),n.registerLayout(U("scatter"))}H([Ae,Te,Je,Le,Me,Pe,Re]);const M=ze;function Xe({activeProjectId:n}){const[t,e]=D.useState(null),r=D.useMemo(()=>n?{projectId:n}:{},[n]),a=D.useMemo(()=>ee(["metrics",r]),[r]),i=D.useMemo(()=>te(a)??void 0,[a]),{data:o,isLoading:s,error:c,isFetching:p}=re({queryKey:["metrics",n],queryFn:async()=>{const u=await ie.get("/api/metrics",{params:r});return oe(a,u.data,{ttlMs:45e3}),u.data},initialData:i,staleTime:45e3}),d={click:u=>{if(!o)return;let f;if(u.seriesType==="scatter")f=u.data[2];else if(u.seriesType==="bar"){const g=u.name.match(/Job (\d+)/);g&&(f=parseInt(g[1]))}if(f){const g=o.find(_=>_.gitlab_job_id===f);g&&e(g)}}},m=D.useMemo(()=>{if(!o||o.length===0)return{};const u=[...o].reverse();return{tooltip:{trigger:"axis",backgroundColor:"#161b22",borderColor:"#30363d",textStyle:{color:"#e6edf3"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:u.map(f=>`Job ${f.gitlab_job_id}`),axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#6e7681"}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#21262d"}},axisLabel:{color:"#6e7681",formatter:"{value} g"}},series:[{name:"Emissions",type:"bar",data:u.map(f=>f.total_emissions_g),itemStyle:{color:"#2da44e",borderRadius:[4,4,0,0]},barMaxWidth:50,cursor:"pointer"}]}},[o]),h=D.useMemo(()=>{if(!o||o.length===0)return{};const u={};o.forEach(g=>{u[g.machine_type]=(u[g.machine_type]||0)+g.total_emissions_g});const f=Object.entries(u).map(([g,_])=>({name:g,value:parseFloat(_.toFixed(2))}));return{tooltip:{trigger:"item",backgroundColor:"#161b22",borderColor:"#30363d",textStyle:{color:"#e6edf3"},formatter:"{b}: {c}g ({d}%)"},legend:{top:"5%",left:"center",textStyle:{color:"#8b949e"}},series:[{name:"Emissions by Machine Type",type:"pie",radius:["40%","70%"],avoidLabelOverlap:!1,itemStyle:{borderRadius:10,borderColor:"#0d1117",borderWidth:2},label:{show:!1},emphasis:{label:{show:!0,fontSize:18,fontWeight:"bold",color:"#e6edf3"}},labelLine:{show:!1},data:f}]}},[o]),v=D.useMemo(()=>!o||o.length===0?{}:{tooltip:{backgroundColor:"#161b22",borderColor:"#30363d",textStyle:{color:"#e6edf3"},formatter:u=>{const[f,g,_,S]=u.data;return`Job ${_}<br/>Runtime: ${f}s<br/>Emissions: ${g}g<br/>Type: ${S}`}},grid:{left:"8%",right:"8%",bottom:"8%",containLabel:!0},xAxis:{name:"Runtime (s)",nameTextStyle:{color:"#6e7681"},splitLine:{lineStyle:{color:"#21262d"}},axisLabel:{color:"#6e7681"}},yAxis:{name:"Emissions (g)",nameTextStyle:{color:"#6e7681"},splitLine:{lineStyle:{color:"#21262d"}},axisLabel:{color:"#6e7681"}},series:[{symbolSize:10,data:o.map(u=>[u.runtime_seconds||0,u.total_emissions_g,u.gitlab_job_id,u.machine_type]),type:"scatter",itemStyle:{color:"#2da44e"},cursor:"pointer"}]},[o]),x=o?.reduce((u,f)=>u+f.total_emissions_g,0)||0,b=o?.length?x/o.length:0;return(!o||o.length===0)&&s?l.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx(q,{size:40,intent:"success"})}):l.jsxs("div",{style:{flex:1,overflowY:"auto",padding:24,maxWidth:1100,margin:"0 auto"},children:[l.jsx(Oe,{job:t,onClose:()=>e(null)}),o&&o.length>0&&p&&l.jsx("div",{style:{fontSize:11,color:"var(--text-muted)",textAlign:"right",marginBottom:8},children:"Refreshing data…"}),c&&l.jsx(I,{style:{background:"rgba(219,55,55,0.1)",border:"1px solid rgba(219,55,55,0.3)",marginBottom:16,padding:14},children:l.jsxs("span",{style:{color:"#f97171",fontSize:13},children:["Failed to load metrics: ",String(c)]})}),o&&o.length>0&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:16,marginBottom:24},children:[l.jsxs(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[l.jsx(Q,{icon:"clean",size:12,style:{color:"var(--green-primary)"}}),"Total Emissions"]}),l.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[x.toFixed(2)," gCO₂e"]})]}),l.jsxs(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:"Avg per Job"}),l.jsxs("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:[b.toFixed(2)," gCO₂e"]})]}),l.jsxs(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[l.jsx("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:"Jobs Analyzed"}),l.jsx("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:o.length})]})]}),l.jsxs("div",{style:{marginBottom:24},children:[l.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Emissions History"}),l.jsx(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,height:320},children:l.jsx(M,{echarts:T,option:m,style:{height:"100%",width:"100%"},theme:"dark",onEvents:d})})]}),l.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:24},children:[l.jsxs("div",{children:[l.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Emissions by Machine Type"}),l.jsx(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,height:320},children:l.jsx(M,{echarts:T,option:h,style:{height:"100%",width:"100%"},theme:"dark",onEvents:d})})]}),l.jsxs("div",{children:[l.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Runtime vs Emissions"}),l.jsx(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,height:320},children:l.jsx(M,{echarts:T,option:v,style:{height:"100%",width:"100%"},theme:"dark",onEvents:d})})]})]}),l.jsxs("div",{children:[l.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Top Carbon-Intensive Jobs"}),l.jsx(I,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:0,overflow:"hidden"},children:l.jsx("div",{style:{overflowX:"auto"},children:l.jsxs("table",{className:"bp5-html-table bp5-html-table-condensed",style:{width:"100%"},children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{children:"Job ID"}),l.jsx("th",{children:"Machine Type"}),l.jsx("th",{style:{textAlign:"right"},children:"Runtime (s)"}),l.jsx("th",{style:{textAlign:"right"},children:"Energy (Wh)"}),l.jsx("th",{style:{textAlign:"right"},children:"Emissions (gCO₂e)"})]})}),l.jsx("tbody",{children:o.sort((u,f)=>f.total_emissions_g-u.total_emissions_g).slice(0,10).map(u=>l.jsxs("tr",{style:{cursor:"pointer"},onClick:()=>e(u),children:[l.jsx("td",{style:{fontFamily:"monospace",fontSize:12,color:"var(--text-primary)"},children:u.gitlab_job_id}),l.jsx("td",{children:l.jsx("code",{style:{background:"var(--bg-tertiary)",padding:"2px 6px",borderRadius:4,fontSize:11},children:u.machine_type})}),l.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-secondary)"},children:u.runtime_seconds?.toFixed(1)||"-"}),l.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-secondary)"},children:(u.energy_kwh*1e3).toFixed(2)}),l.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--green-light)",fontWeight:500},children:u.total_emissions_g.toFixed(2)})]},u.gitlab_job_id))})]})})})]})]}),o&&o.length===0&&!s&&l.jsx("div",{style:{textAlign:"center",padding:48,color:"var(--text-muted)"},children:"No metrics found for this project. Have you run a pipeline with the measurement component?"})]})}export{Xe as MetricsDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as o,j as e,S,T as w,I as x,B as z}from"./index-DW6Qp0d6.js";import{R,A as C,y as A,D as F,E as M,F as W,H as $,I as N,J as O}from"./core-Cz8f3oSB.js";import{h as K,g as q,u as G,a as H,s as V,C as g}from"./cache-YerT0Slh.js";function J({activeProjectId:a,page:u,limit:d}){const n=o.useMemo(()=>{const l={page:u};return l.limit=d,a&&(l.projectId=a),l},[a,u,d]),c=o.useMemo(()=>K(["pipelines",n]),[n]),h=o.useMemo(()=>q(c)??void 0,[c]);return G({queryKey:["pipelines",a,u,d],queryFn:async()=>{const{data:l}=await H.get("/api/pipelines",{params:n});return V(c,l,{ttlMs:45e3}),l},initialData:h,staleTime:45e3})}A([F,M,W,$,N,O]);const k=R,Q=20;function Z({activeProjectId:a}){const[u,d]=o.useState(1);o.useEffect(()=>{d(1)},[a]);const{data:n,isLoading:c,error:h,isFetching:l}=J({activeProjectId:a,page:u,limit:Q}),s=(n&&"pipelines"in n?n.pipelines:[])??[],y=a??(n&&"projectId"in n?n.projectId:void 0),f=n&&"pagination"in n?n.pagination:void 0,p=s.length===0?null:s.filter(t=>t.status==="success").length/s.length*100,b=s.length===0?null:s.reduce((t,r)=>t+(r.duration_seconds??0),0)/s.length,_=!!f?.hasPrevPage,P=!!f?.hasNextPage,m=l&&!c,j=o.useMemo(()=>{const t={};return s.forEach(r=>{t[r.status]=(t[r.status]||0)+1}),Object.entries(t).map(([r,i])=>({name:r,value:i}))},[s]),I=o.useMemo(()=>({tooltip:{trigger:"item",backgroundColor:"#161b22",borderColor:"#30363d",textStyle:{color:"#e6edf3"}},legend:{top:"5%",left:"center",textStyle:{color:"#8b949e"}},series:[{name:"Pipeline Status",type:"pie",radius:["40%","70%"],avoidLabelOverlap:!1,itemStyle:{borderRadius:10,borderColor:"#0d1117",borderWidth:2},label:{show:!1},emphasis:{label:{show:!0,fontSize:18,fontWeight:"bold",color:"#e6edf3"}},labelLine:{show:!1},data:j.map(t=>({...t,itemStyle:{color:t.name==="success"?"#2da44e":t.name==="failed"?"#f85149":t.name==="running"?"#58a6ff":"#6e7681"}}))}]}),[j]),B=o.useMemo(()=>{if(s.length===0)return{};const t=[...s].reverse().slice(-20);return{tooltip:{trigger:"axis",backgroundColor:"#161b22",borderColor:"#30363d",textStyle:{color:"#e6edf3"}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:{type:"category",data:t.map(r=>`#${r.id}`),axisLine:{show:!1},axisTick:{show:!1},axisLabel:{color:"#6e7681"}},yAxis:{type:"value",splitLine:{lineStyle:{color:"#21262d"}},axisLabel:{color:"#6e7681",formatter:"{value} s"}},series:[{name:"Duration",type:"bar",data:t.map(r=>({value:r.duration_seconds??0,itemStyle:{color:r.status==="success"?"#2da44e":r.status==="failed"?"#f85149":r.status==="running"?"#58a6ff":"#6e7681"}})),barMaxWidth:30}]}},[s]),D=t=>{switch(t){case"success":return e.jsx(x,{icon:"tick-circle",size:14,style:{color:"#2da44e"}});case"failed":return e.jsx(x,{icon:"error",size:14,style:{color:"#f85149"}});case"running":return e.jsx(S,{size:14,intent:"primary"});default:return e.jsx(x,{icon:"time",size:14,style:{color:"#6e7681"}})}},v=t=>{!t.web_url||typeof window>"u"||window.open(t.web_url,"_blank","noopener,noreferrer")},T=(t,r)=>{t.web_url&&(r.target instanceof HTMLElement&&r.target.closest("a")||v(t))},E=(t,r)=>{t.web_url&&(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),v(t))};return s.length===0&&c?e.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(S,{size:40,intent:"success"})}):e.jsxs("div",{style:{flex:1,overflowY:"auto",padding:24,maxWidth:1100,margin:"0 auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:24},children:[e.jsx("h2",{style:{fontSize:18,fontWeight:600,color:"var(--text-primary)",margin:0},children:"Pipelines Overview"}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m&&s.length>0&&e.jsx("span",{style:{fontSize:11,color:"var(--text-muted)"},children:"Refreshing…"}),y&&e.jsxs(w,{minimal:!0,style:{fontSize:11},children:["Project ID: ",y]})]})]}),h&&e.jsx(g,{style:{background:"rgba(219,55,55,0.1)",border:"1px solid rgba(219,55,55,0.3)",marginBottom:16,padding:14},children:e.jsxs("span",{style:{color:"#f97171",fontSize:13},children:["Failed to load pipelines: ",String(h)]})}),s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gap:16,marginBottom:24},children:[{icon:"play",label:"Total Pipelines",value:String(s.length),color:"var(--text-muted)"},{icon:"tick-circle",label:"Success Rate",value:p===null?"--":`${p.toFixed(1)}%`,color:"#2da44e"},{icon:"time",label:"Avg Duration",value:b===null?"--":`${b.toFixed(0)}s`,color:"var(--text-muted)"},{icon:"refresh",label:"Running",value:String(s.filter(t=>t.status==="running").length),color:"#58a6ff"}].map(({icon:t,label:r,value:i,color:L})=>e.jsxs(g,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,textTransform:"uppercase",letterSpacing:1.5,color:"var(--text-muted)",marginBottom:6},children:[e.jsx(x,{icon:t,size:14,style:{color:L}}),r]}),e.jsx("div",{style:{fontSize:24,fontFamily:"monospace",fontWeight:500,color:"var(--text-primary)"},children:i})]},r))}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Status Distribution"}),e.jsx(g,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,height:320},children:e.jsx(k,{echarts:C,option:I,style:{height:"100%",width:"100%"},theme:"dark"})})]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Duration Trend (Last 20)"}),e.jsx(g,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:16,height:320},children:e.jsx(k,{echarts:C,option:B,style:{height:"100%",width:"100%"},theme:"dark"})})]})]}),e.jsxs("div",{children:[e.jsx("h3",{style:{fontSize:13,fontWeight:500,color:"var(--text-secondary)",marginBottom:8},children:"Recent Pipelines"}),e.jsxs(g,{style:{background:"var(--bg-card)",border:"1px solid var(--border-default)",padding:0,overflow:"hidden"},children:[e.jsx("div",{style:{overflowX:"auto"},children:e.jsxs("table",{className:"bp5-html-table bp5-html-table-condensed",style:{width:"100%"},children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Pipeline ID"}),e.jsx("th",{children:"Branch"}),e.jsx("th",{children:"Commit"}),e.jsx("th",{children:"Triggered By"}),e.jsx("th",{style:{textAlign:"right"},children:"Duration"}),e.jsx("th",{style:{textAlign:"right"},children:"Created At"})]})}),e.jsx("tbody",{children:s.map(t=>{const r=t.triggered_by||"--";return e.jsxs("tr",{onClick:i=>T(t,i),onKeyDown:i=>E(t,i),role:t.web_url?"button":void 0,tabIndex:t.web_url?0:-1,style:{cursor:t.web_url?"pointer":"default"},children:[e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[D(t.status),e.jsx("span",{style:{textTransform:"capitalize",color:"var(--text-primary)",fontSize:12},children:t.status})]})}),e.jsx("td",{style:{fontFamily:"monospace",fontSize:12},children:t.web_url?e.jsxs("a",{href:t.web_url,target:"_blank",rel:"noreferrer",style:{color:"var(--green-light)"},onClick:i=>i.stopPropagation(),children:["#",t.id]}):`#${t.id}`}),e.jsx("td",{children:e.jsx(w,{minimal:!0,round:!0,style:{fontSize:11,fontFamily:"monospace"},children:t.branch||"-"})}),e.jsx("td",{style:{color:"var(--text-secondary)",fontSize:12,maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.commit_message||t.sha||"—"}),e.jsx("td",{children:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--text-secondary)"},children:[e.jsx("div",{style:{width:20,height:20,borderRadius:"50%",background:"var(--bg-tertiary)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:10,color:"var(--text-muted)",textTransform:"uppercase"},children:r.substring(0,2)}),r]})}),e.jsx("td",{style:{textAlign:"right",fontFamily:"monospace",fontSize:12,color:"var(--text-secondary)"},children:t.duration_seconds!==void 0?`${t.duration_seconds}s`:"--"}),e.jsx("td",{style:{textAlign:"right",fontSize:11,color:"var(--text-muted)"},children:t.created_at?new Date(t.created_at).toLocaleString():"--"})]},t.id)})})]})}),e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid var(--border-default)",padding:"10px 16px",background:"var(--bg-tertiary)"},children:[e.jsxs("span",{style:{fontSize:12,color:"var(--text-muted)"},children:["Page ",f?.page??u]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx(z,{small:!0,text:"Previous",disabled:!_||m,onClick:()=>d(t=>Math.max(1,t-1))}),e.jsx(z,{small:!0,text:"Next",disabled:!P||m,onClick:()=>d(t=>t+1)})]})]})]})]})]}),s.length===0&&!c&&!h&&e.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",padding:32},children:"No pipelines found for this project."})]})}export{Z as PipelinesDashboard};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as s}from"./index-Bp4RqK05.js";import{I as r}from"./index-Uc4Xhv31.js";import{a6 as n,v as c}from"./index-DW6Qp0d6.js";function i(a,t){const o=n(a);return t===c.STANDARD?s[o]:r[o]}export{s as IconSvgPaths16,r as IconSvgPaths20,i as getIconPaths};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/allPaths-CXDKahbk.js","assets/index-Bp4RqK05.js","assets/index-Uc4Xhv31.js","assets/index-DW6Qp0d6.js","assets/index-BWa_E8Y7.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a5 as e}from"./index-DW6Qp0d6.js";const s=async(t,a)=>{const{getIconPaths:o}=await e(async()=>{const{getIconPaths:r}=await import("./allPaths-CXDKahbk.js");return{getIconPaths:r}},__vite__mapDeps([0,1,2,3,4]));return o(t,a)};export{s as allPathsLoader};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{F as Lt,J as je,K as F,L as we,M as G,N as ge,Q as Se,R as qe,U as It,V as se,W as Bt,X as vt,Y as He,Z as ct,r as B,_ as lt,$ as kt,c as Mt,a0 as jt,a1 as qt,a2 as Ht,a3 as $t,a4 as zt,j as Jt,e as Vt}from"./index-DW6Qp0d6.js";var Qt=class extends Lt{constructor(e,t){super(),this.options=t,this.#n=e,this.#s=null,this.#r=je(),this.bindMethods(),this.setOptions(t)}#n;#e=void 0;#p=void 0;#t=void 0;#i;#u;#r;#s;#m;#f;#d;#a;#c;#o;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),$e(this.#e,this.options)?this.#l():this.updateResult(),this.#E())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Oe(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Oe(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#g(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#n.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof F(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#e.setOptions(this.options),t._defaulted&&!we(this.options,t)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&ze(this.#e,n,this.options,t)&&this.#l(),this.updateResult(),r&&(this.#e!==n||F(this.options.enabled,this.#e)!==F(t.enabled,this.#e)||G(this.options.staleTime,this.#e)!==G(t.staleTime,this.#e))&&this.#y();const s=this.#b();r&&(this.#e!==n||F(this.options.enabled,this.#e)!==F(t.enabled,this.#e)||s!==this.#o)&&this.#R(s)}getOptimisticResult(e){const t=this.#n.getQueryCache().build(this.#n,e),n=this.createResult(t,e);return Kt(this,n)&&(this.#t=n,this.#u=this.options,this.#i=this.#e.state),n}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#n.defaultQueryOptions(e),n=this.#n.getQueryCache().build(this.#n,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#l({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#l(e){this.#S();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ge)),t}#y(){this.#w();const e=G(this.options.staleTime,this.#e);if(Se||this.#t.isStale||!qe(e))return;const n=It(this.#t.dataUpdatedAt,e)+1;this.#a=se.setTimeout(()=>{this.#t.isStale||this.updateResult()},n)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#R(e){this.#g(),this.#o=e,!(Se||F(this.options.enabled,this.#e)===!1||!qe(this.#o)||this.#o===0)&&(this.#c=se.setInterval(()=>{(this.options.refetchIntervalInBackground||Bt.isFocused())&&this.#l()},this.#o))}#E(){this.#y(),this.#R(this.#b())}#w(){this.#a&&(se.clearTimeout(this.#a),this.#a=void 0)}#g(){this.#c&&(se.clearInterval(this.#c),this.#c=void 0)}createResult(e,t){const n=this.#e,r=this.options,s=this.#t,i=this.#i,o=this.#u,d=e!==n?e.state:this.#p,{state:u}=e;let l={...u},p=!1,b;if(t._optimisticResults){const C=this.hasListeners(),L=!C&&$e(e,t),q=C&&ze(e,n,t,r);(L||q)&&(l={...l,...vt(u.data,e.options)}),t._optimisticResults==="isRestoring"&&(l.fetchStatus="idle")}let{error:w,errorUpdatedAt:f,status:m}=l;b=l.data;let h=!1;if(t.placeholderData!==void 0&&b===void 0&&m==="pending"){let C;s?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(C=s.data,h=!0):C=typeof t.placeholderData=="function"?t.placeholderData(this.#d?.state.data,this.#d):t.placeholderData,C!==void 0&&(m="success",b=He(s?.data,C,t),p=!0)}if(t.select&&b!==void 0&&!h)if(s&&b===i?.data&&t.select===this.#m)b=this.#f;else try{this.#m=t.select,b=t.select(b),b=He(s?.data,b,t),this.#f=b,this.#s=null}catch(C){this.#s=C}this.#s&&(w=this.#s,b=this.#f,f=Date.now(),m="error");const R=l.fetchStatus==="fetching",T=m==="pending",E=m==="error",O=T&&R,x=b!==void 0,g={status:m,fetchStatus:l.fetchStatus,isPending:T,isSuccess:m==="success",isError:E,isInitialLoading:O,isLoading:O,data:b,dataUpdatedAt:l.dataUpdatedAt,error:w,errorUpdatedAt:f,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:l.dataUpdateCount>0||l.errorUpdateCount>0,isFetchedAfterMount:l.dataUpdateCount>d.dataUpdateCount||l.errorUpdateCount>d.errorUpdateCount,isFetching:R,isRefetching:R&&!T,isLoadingError:E&&!x,isPaused:l.fetchStatus==="paused",isPlaceholderData:p,isRefetchError:E&&x,isStale:_e(e,t),refetch:this.refetch,promise:this.#r,isEnabled:F(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const C=g.data!==void 0,L=g.status==="error"&&!C,q=I=>{L?I.reject(g.error):C&&I.resolve(g.data)},K=()=>{const I=this.#r=g.promise=je();q(I)},v=this.#r;switch(v.status){case"pending":e.queryHash===n.queryHash&&q(v);break;case"fulfilled":(L||g.data!==v.value)&&K();break;case"rejected":(!L||g.error!==v.reason)&&K();break}}return g}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#u=this.options,this.#i.data!==void 0&&(this.#d=this.#e),we(t,e))return;this.#t=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#h.size)return!0;const i=new Set(s??this.#h);return this.options.throwOnError&&i.add("error"),Object.keys(this.#t).some(o=>{const c=o;return this.#t[c]!==e[c]&&i.has(c)})};this.#O({listeners:n()})}#S(){const e=this.#n.getQueryCache().build(this.#n,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#p=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#E()}#O(e){ct.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Wt(e,t){return F(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $e(e,t){return Wt(e,t)||e.state.data!==void 0&&Oe(e,t,t.refetchOnMount)}function Oe(e,t,n){if(F(t.enabled,e)!==!1&&G(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&_e(e,t)}return!1}function ze(e,t,n,r){return(e!==t||F(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&_e(e,n)}function _e(e,t){return F(t.enabled,e)!==!1&&e.isStaleByTime(G(t.staleTime,e))}function Kt(e,t){return!we(e.getCurrentResult(),t)}var ut=B.createContext(!1),Xt=()=>B.useContext(ut);ut.Provider;function Gt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Zt=B.createContext(Gt()),Yt=()=>B.useContext(Zt),en=(e,t,n)=>{const r=n?.state.error&&typeof e.throwOnError=="function"?lt(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},tn=e=>{B.useEffect(()=>{e.clearReset()},[e])},nn=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||lt(n,[e.error,r])),rn=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},sn=(e,t)=>e.isLoading&&e.isFetching&&!t,on=(e,t)=>e?.suspense&&t.isPending,Je=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function an(e,t,n){const r=Xt(),s=Yt(),i=kt(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o);const c=i.getQueryCache().get(o.queryHash);o._optimisticResults=r?"isRestoring":"optimistic",rn(o),en(o,s,c),tn(s);const d=!i.getQueryCache().get(o.queryHash),[u]=B.useState(()=>new t(i,o)),l=u.getOptimisticResult(o),p=!r&&e.subscribed!==!1;if(B.useSyncExternalStore(B.useCallback(b=>{const w=p?u.subscribe(ct.batchCalls(b)):ge;return u.updateResult(),w},[u,p]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),B.useEffect(()=>{u.setOptions(o)},[o,u]),on(o,l))throw Je(o,u,s);if(nn({result:l,errorResetBoundary:s,throwOnError:o.throwOnError,query:c,suspense:o.suspense}))throw l.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,l),o.experimental_prefetchInRender&&!Se&&sn(l,r)&&(d?Je(o,u,s):c?.promise)?.catch(ge).finally(()=>{u.updateResult()}),o.notifyOnChangeProps?l:u.trackResult(l)}function zr(e,t){return an(e,Qt)}const cn={ZERO:0},ln=B.forwardRef((e,t)=>{const{className:n,elevation:r=cn.ZERO,interactive:s=!1,selected:i,compact:o,...c}=e,d=Mt(n,jt,qt(r),{[zt]:s,[$t]:o,[Ht]:i});return Jt.jsx("div",{className:d,ref:t,...c})});ln.displayName=`${Vt}.Card`;function ft(e,t){return function(){return e.apply(t,arguments)}}const{toString:un}=Object.prototype,{getPrototypeOf:Pe}=Object,{iterator:fe,toStringTag:dt}=Symbol,de=(e=>t=>{const n=un.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>de(t)===e),he=e=>t=>typeof t===e,{isArray:W}=Array,Q=he("undefined");function Z(e){return e!==null&&!Q(e)&&e.constructor!==null&&!Q(e.constructor)&&P(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ht=D("ArrayBuffer");function fn(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&ht(e.buffer),t}const dn=he("string"),P=he("function"),pt=he("number"),Y=e=>e!==null&&typeof e=="object",hn=e=>e===!0||e===!1,ie=e=>{if(de(e)!=="object")return!1;const t=Pe(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(dt in e)&&!(fe in e)},pn=e=>{if(!Y(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},mn=D("Date"),yn=D("File"),bn=D("Blob"),Rn=D("FileList"),En=e=>Y(e)&&P(e.pipe),wn=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||P(e.append)&&((t=de(e))==="formdata"||t==="object"&&P(e.toString)&&e.toString()==="[object FormData]"))},gn=D("URLSearchParams"),[Sn,On,Tn,Cn]=["ReadableStream","Request","Response","Headers"].map(D),An=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ee(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),W(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Z(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let c;for(r=0;r<o;r++)c=i[r],t.call(null,e[c],c,e)}}function mt(e,t){if(Z(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const $=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,yt=e=>!Q(e)&&e!==$;function Te(){const{caseless:e,skipUndefined:t}=yt(this)&&this||{},n={},r=(s,i)=>{if(i==="__proto__"||i==="constructor"||i==="prototype")return;const o=e&&mt(n,i)||i;ie(n[o])&&ie(s)?n[o]=Te(n[o],s):ie(s)?n[o]=Te({},s):W(s)?n[o]=s.slice():(!t||!Q(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&ee(arguments[s],r);return n}const xn=(e,t,n,{allOwnKeys:r}={})=>(ee(t,(s,i)=>{n&&P(s)?Object.defineProperty(e,i,{value:ft(s,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:s,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),_n=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Pn=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Nn=(e,t,n,r)=>{let s,i,o;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=n!==!1&&Pe(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Un=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Fn=e=>{if(!e)return null;if(W(e))return e;let t=e.length;if(!pt(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Dn=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Pe(Uint8Array)),Ln=(e,t)=>{const r=(e&&e[fe]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},In=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Bn=D("HTMLFormElement"),vn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Ve=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),kn=D("RegExp"),bt=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};ee(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Mn=e=>{bt(e,(t,n)=>{if(P(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(P(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},jn=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return W(e)?r(e):r(String(e).split(t)),n},qn=()=>{},Hn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $n(e){return!!(e&&P(e.append)&&e[dt]==="FormData"&&e[fe])}const zn=e=>{const t=new Array(10),n=(r,s)=>{if(Y(r)){if(t.indexOf(r)>=0)return;if(Z(r))return r;if(!("toJSON"in r)){t[s]=r;const i=W(r)?[]:{};return ee(r,(o,c)=>{const d=n(o,s+1);!Q(d)&&(i[c]=d)}),t[s]=void 0,i}}return r};return n(e,0)},Jn=D("AsyncFunction"),Vn=e=>e&&(Y(e)||P(e))&&P(e.then)&&P(e.catch),Rt=((e,t)=>e?setImmediate:t?((n,r)=>($.addEventListener("message",({source:s,data:i})=>{s===$&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),$.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",P($.postMessage)),Qn=typeof queueMicrotask<"u"?queueMicrotask.bind($):typeof process<"u"&&process.nextTick||Rt,Wn=e=>e!=null&&P(e[fe]),a={isArray:W,isArrayBuffer:ht,isBuffer:Z,isFormData:wn,isArrayBufferView:fn,isString:dn,isNumber:pt,isBoolean:hn,isObject:Y,isPlainObject:ie,isEmptyObject:pn,isReadableStream:Sn,isRequest:On,isResponse:Tn,isHeaders:Cn,isUndefined:Q,isDate:mn,isFile:yn,isBlob:bn,isRegExp:kn,isFunction:P,isStream:En,isURLSearchParams:gn,isTypedArray:Dn,isFileList:Rn,forEach:ee,merge:Te,extend:xn,trim:An,stripBOM:_n,inherits:Pn,toFlatObject:Nn,kindOf:de,kindOfTest:D,endsWith:Un,toArray:Fn,forEachEntry:Ln,matchAll:In,isHTMLForm:Bn,hasOwnProperty:Ve,hasOwnProp:Ve,reduceDescriptors:bt,freezeMethods:Mn,toObjectSet:jn,toCamelCase:vn,noop:qn,toFiniteNumber:Hn,findKey:mt,global:$,isContextDefined:yt,isSpecCompliantForm:$n,toJSONObject:zn,isAsyncFn:Jn,isThenable:Vn,setImmediate:Rt,asap:Qn,isIterable:Wn};let y=class Et extends Error{static from(t,n,r,s,i,o){const c=new Et(t.message,n||t.code,r,s,i);return c.cause=t,c.name=t.name,o&&Object.assign(c,o),c}constructor(t,n,r,s,i){super(t),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),s&&(this.request=s),i&&(this.response=i,this.status=i.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}};y.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";y.ERR_BAD_OPTION="ERR_BAD_OPTION";y.ECONNABORTED="ECONNABORTED";y.ETIMEDOUT="ETIMEDOUT";y.ERR_NETWORK="ERR_NETWORK";y.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";y.ERR_DEPRECATED="ERR_DEPRECATED";y.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";y.ERR_BAD_REQUEST="ERR_BAD_REQUEST";y.ERR_CANCELED="ERR_CANCELED";y.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";y.ERR_INVALID_URL="ERR_INVALID_URL";const Kn=null;function Ce(e){return a.isPlainObject(e)||a.isArray(e)}function wt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Qe(e,t,n){return e?e.concat(t).map(function(s,i){return s=wt(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function Xn(e){return a.isArray(e)&&!e.some(Ce)}const Gn=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function pe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,h){return!a.isUndefined(h[m])});const r=n.metaTokens,s=n.visitor||l,i=n.dots,o=n.indexes,d=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!d&&a.isBlob(f))throw new y("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?d&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function l(f,m,h){let R=f;if(f&&!h&&typeof f=="object"){if(a.endsWith(m,"{}"))m=r?m:m.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&Xn(f)||(a.isFileList(f)||a.endsWith(m,"[]"))&&(R=a.toArray(f)))return m=wt(m),R.forEach(function(E,O){!(a.isUndefined(E)||E===null)&&t.append(o===!0?Qe([m],O,i):o===null?m:m+"[]",u(E))}),!1}return Ce(f)?!0:(t.append(Qe(h,m,i),u(f)),!1)}const p=[],b=Object.assign(Gn,{defaultVisitor:l,convertValue:u,isVisitable:Ce});function w(f,m){if(!a.isUndefined(f)){if(p.indexOf(f)!==-1)throw Error("Circular reference detected in "+m.join("."));p.push(f),a.forEach(f,function(R,T){(!(a.isUndefined(R)||R===null)&&s.call(t,R,a.isString(T)?T.trim():T,m,b))===!0&&w(R,m?m.concat(T):[T])}),p.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return w(e),t}function We(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Ne(e,t){this._pairs=[],e&&pe(e,this,t)}const gt=Ne.prototype;gt.append=function(t,n){this._pairs.push([t,n])};gt.toString=function(t){const n=t?function(r){return t.call(this,r,We)}:We;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Zn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function St(e,t,n){if(!t)return e;const r=n&&n.encode||Zn,s=a.isFunction(n)?{serialize:n}:n,i=s&&s.serialize;let o;if(i?o=i(t,s):o=a.isURLSearchParams(t)?t.toString():new Ne(t,s).toString(r),o){const c=e.indexOf("#");c!==-1&&(e=e.slice(0,c)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Ke{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const Ue={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},Yn=typeof URLSearchParams<"u"?URLSearchParams:Ne,er=typeof FormData<"u"?FormData:null,tr=typeof Blob<"u"?Blob:null,nr={isBrowser:!0,classes:{URLSearchParams:Yn,FormData:er,Blob:tr},protocols:["http","https","file","blob","url","data"]},Fe=typeof window<"u"&&typeof document<"u",Ae=typeof navigator=="object"&&navigator||void 0,rr=Fe&&(!Ae||["ReactNative","NativeScript","NS"].indexOf(Ae.product)<0),sr=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",or=Fe&&window.location.href||"http://localhost",ir=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Fe,hasStandardBrowserEnv:rr,hasStandardBrowserWebWorkerEnv:sr,navigator:Ae,origin:or},Symbol.toStringTag,{value:"Module"})),A={...ir,...nr};function ar(e,t){return pe(e,new A.classes.URLSearchParams,{visitor:function(n,r,s,i){return A.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function cr(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function lr(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function Ot(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const c=Number.isFinite(+o),d=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,d?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!c):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=lr(s[o])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(cr(r),s,n,0)}),n}return null}function ur(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const te={transitional:Ue,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(Ot(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return ar(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const d=this.env&&this.env.FormData;return pe(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),ur(t)):t}],transformResponse:[function(t){const n=this.transitional||te.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?y.from(c,y.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:A.classes.FormData,Blob:A.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{te.headers[e]={}});const fr=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),dr=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
2
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&fr[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Xe=Symbol("internals");function X(e){return e&&String(e).trim().toLowerCase()}function ae(e){return e===!1||e==null?e:a.isArray(e)?e.map(ae):String(e)}function hr(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const pr=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function be(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function mr(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function yr(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let N=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(c,d,u){const l=X(d);if(!l)throw new Error("header name must be a non-empty string");const p=a.findKey(s,l);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||d]=ae(c))}const o=(c,d)=>a.forEach(c,(u,l)=>i(u,l,d));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!pr(t))o(dr(t),n);else if(a.isObject(t)&&a.isIterable(t)){let c={},d,u;for(const l of t){if(!a.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(d=c[u])?a.isArray(d)?[...d,l[1]]:[d,l[1]]:l[1]}o(c,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=X(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return hr(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=X(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||be(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=X(o),o){const c=a.findKey(r,o);c&&(!n||be(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||be(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=ae(s),delete n[i];return}const c=t?mr(i):String(i).trim();c!==i&&delete n[i],n[c]=ae(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
3
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Xe]=this[Xe]={accessors:{}}).accessors,s=this.prototype;function i(o){const c=X(o);r[c]||(yr(s,o),r[c]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};N.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(N.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(N);function Re(e,t){const n=this||te,r=t||n,s=N.from(r.headers);let i=r.data;return a.forEach(e,function(c){i=c.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function Tt(e){return!!(e&&e.__CANCEL__)}let ne=class extends y{constructor(t,n,r){super(t??"canceled",y.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function Ct(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new y("Request failed with status code "+n.status,[y.ERR_BAD_REQUEST,y.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function br(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Rr(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(d){const u=Date.now(),l=r[i];o||(o=u),n[s]=d,r[s]=u;let p=i,b=0;for(;p!==s;)b+=n[p++],p=p%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const w=l&&u-l;return w?Math.round(b*1e3/w):void 0}}function Er(e,t){let n=0,r=1e3/t,s,i;const o=(u,l=Date.now())=>{n=l,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const l=Date.now(),p=l-n;p>=r?o(u,l):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-p)))},()=>s&&o(s)]}const ue=(e,t,n=3)=>{let r=0;const s=Rr(50,250);return Er(i=>{const o=i.loaded,c=i.lengthComputable?i.total:void 0,d=o-r,u=s(d),l=o<=c;r=o;const p={loaded:o,total:c,progress:c?o/c:void 0,bytes:d,rate:u||void 0,estimated:u&&c&&l?(c-o)/u:void 0,event:i,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(p)},n)},Ge=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Ze=e=>(...t)=>a.asap(()=>e(...t)),wr=A.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,A.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(A.origin),A.navigator&&/(msie|trident)/i.test(A.navigator.userAgent)):()=>!0,gr=A.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const c=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&c.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&c.push(`path=${r}`),a.isString(s)&&c.push(`domain=${s}`),i===!0&&c.push("secure"),a.isString(o)&&c.push(`SameSite=${o}`),document.cookie=c.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Sr(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Or(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function At(e,t,n){let r=!Sr(t);return e&&(r||n==!1)?Or(e,t):t}const Ye=e=>e instanceof N?{...e}:e;function J(e,t){t=t||{};const n={};function r(u,l,p,b){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:b},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,p,b){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,p,b)}else return r(u,l,p,b)}function i(u,l){if(!a.isUndefined(l))return r(void 0,l)}function o(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,p){if(p in t)return r(u,l);if(p in e)return r(void 0,u)}const d={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,l,p)=>s(Ye(u),Ye(l),p,!0)};return a.forEach(Object.keys({...e,...t}),function(l){if(l==="__proto__"||l==="constructor"||l==="prototype")return;const p=a.hasOwnProp(d,l)?d[l]:s,b=p(e[l],t[l],l);a.isUndefined(b)&&p!==c||(n[l]=b)}),n}const xt=e=>{const t=J({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:c}=t;if(t.headers=o=N.from(o),t.url=St(At(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),a.isFormData(n)){if(A.hasStandardBrowserEnv||A.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const d=n.getHeaders(),u=["content-type","content-length"];Object.entries(d).forEach(([l,p])=>{u.includes(l.toLowerCase())&&o.set(l,p)})}}if(A.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&wr(t.url))){const d=s&&i&&gr.read(i);d&&o.set(s,d)}return t},Tr=typeof XMLHttpRequest<"u",Cr=Tr&&function(e){return new Promise(function(n,r){const s=xt(e);let i=s.data;const o=N.from(s.headers).normalize();let{responseType:c,onUploadProgress:d,onDownloadProgress:u}=s,l,p,b,w,f;function m(){w&&w(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function R(){if(!h)return;const E=N.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),x={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:E,config:e,request:h};Ct(function(g){n(g),m()},function(g){r(g),m()},x),h=null}"onloadend"in h?h.onloadend=R:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(R)},h.onabort=function(){h&&(r(new y("Request aborted",y.ECONNABORTED,e,h)),h=null)},h.onerror=function(O){const x=O&&O.message?O.message:"Network Error",k=new y(x,y.ERR_NETWORK,e,h);k.event=O||null,r(k),h=null},h.ontimeout=function(){let O=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const x=s.transitional||Ue;s.timeoutErrorMessage&&(O=s.timeoutErrorMessage),r(new y(O,x.clarifyTimeoutError?y.ETIMEDOUT:y.ECONNABORTED,e,h)),h=null},i===void 0&&o.setContentType(null),"setRequestHeader"in h&&a.forEach(o.toJSON(),function(O,x){h.setRequestHeader(x,O)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([b,f]=ue(u,!0),h.addEventListener("progress",b)),d&&h.upload&&([p,w]=ue(d),h.upload.addEventListener("progress",p),h.upload.addEventListener("loadend",w)),(s.cancelToken||s.signal)&&(l=E=>{h&&(r(!E||E.type?new ne(null,e,h):E),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const T=br(s.url);if(T&&A.protocols.indexOf(T)===-1){r(new y("Unsupported protocol "+T+":",y.ERR_BAD_REQUEST,e));return}h.send(i||null)})},Ar=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof y?l:new ne(l instanceof Error?l.message:l))}};let o=t&&setTimeout(()=>{o=null,i(new y(`timeout of ${t}ms exceeded`,y.ETIMEDOUT))},t);const c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:d}=r;return d.unsubscribe=()=>a.asap(c),d}},xr=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},_r=async function*(e,t){for await(const n of Pr(e))yield*xr(n,t)},Pr=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},et=(e,t,n,r)=>{const s=_r(e,t);let i=0,o,c=d=>{o||(o=!0,r&&r(d))};return new ReadableStream({async pull(d){try{const{done:u,value:l}=await s.next();if(u){c(),d.close();return}let p=l.byteLength;if(n){let b=i+=p;n(b)}d.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(d){return c(d),s.return()}},{highWaterMark:2})},tt=64*1024,{isFunction:oe}=a,Nr=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:nt,TextEncoder:rt}=a.global,st=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Ur=e=>{e=a.merge.call({skipUndefined:!0},Nr,e);const{fetch:t,Request:n,Response:r}=e,s=t?oe(t):typeof fetch=="function",i=oe(n),o=oe(r);if(!s)return!1;const c=s&&oe(nt),d=s&&(typeof rt=="function"?(f=>m=>f.encode(m))(new rt):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=i&&c&&st(()=>{let f=!1;const m=new n(A.origin,{body:new nt,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!m}),l=o&&c&&st(()=>a.isReadableStream(new r("").body)),p={stream:l&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!p[f]&&(p[f]=(m,h)=>{let R=m&&m[f];if(R)return R.call(m);throw new y(`Response type '${f}' is not supported`,y.ERR_NOT_SUPPORT,h)})});const b=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(A.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await d(f)).byteLength},w=async(f,m)=>{const h=a.toFiniteNumber(f.getContentLength());return h??b(m)};return async f=>{let{url:m,method:h,data:R,signal:T,cancelToken:E,timeout:O,onDownloadProgress:x,onUploadProgress:k,responseType:g,headers:C,withCredentials:L="same-origin",fetchOptions:q}=xt(f),K=t||fetch;g=g?(g+"").toLowerCase():"text";let v=Ar([T,E&&E.toAbortSignal()],O),I=null;const H=v&&v.unsubscribe&&(()=>{v.unsubscribe()});let Be;try{if(k&&u&&h!=="get"&&h!=="head"&&(Be=await w(C,R))!==0){let j=new n(m,{method:"POST",body:R,duplex:"half"}),V;if(a.isFormData(R)&&(V=j.headers.get("content-type"))&&C.setContentType(V),j.body){const[ye,re]=Ge(Be,ue(Ze(k)));R=et(j.body,tt,ye,re)}}a.isString(L)||(L=L?"include":"omit");const _=i&&"credentials"in n.prototype,ve={...q,signal:v,method:h.toUpperCase(),headers:C.normalize().toJSON(),body:R,duplex:"half",credentials:_?L:void 0};I=i&&new n(m,ve);let M=await(i?K(I,q):K(m,ve));const ke=l&&(g==="stream"||g==="response");if(l&&(x||ke&&H)){const j={};["status","statusText","headers"].forEach(Me=>{j[Me]=M[Me]});const V=a.toFiniteNumber(M.headers.get("content-length")),[ye,re]=x&&Ge(V,ue(Ze(x),!0))||[];M=new r(et(M.body,tt,ye,()=>{re&&re(),H&&H()}),j)}g=g||"text";let Dt=await p[a.findKey(p,g)||"text"](M,f);return!ke&&H&&H(),await new Promise((j,V)=>{Ct(j,V,{data:Dt,headers:N.from(M.headers),status:M.status,statusText:M.statusText,config:f,request:I})})}catch(_){throw H&&H(),_&&_.name==="TypeError"&&/Load failed|fetch/i.test(_.message)?Object.assign(new y("Network Error",y.ERR_NETWORK,f,I,_&&_.response),{cause:_.cause||_}):y.from(_,_&&_.code,f,I,_&&_.response)}}},Fr=new Map,_t=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,c=o,d,u,l=Fr;for(;c--;)d=i[c],u=l.get(d),u===void 0&&l.set(d,u=c?new Map:Ur(t)),l=u;return u};_t();const De={http:Kn,xhr:Cr,fetch:{get:_t}};a.forEach(De,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ot=e=>`- ${e}`,Dr=e=>a.isFunction(e)||e===null||e===!1;function Lr(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let c;if(s=r,!Dr(r)&&(s=De[(c=String(r)).toLowerCase()],s===void 0))throw new y(`Unknown adapter '${c}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[c||"#"+o]=s}if(!s){const o=Object.entries(i).map(([d,u])=>`adapter ${d} `+(u===!1?"is not supported by the environment":"is not available in the build"));let c=n?o.length>1?`since :
|
|
4
|
+
`+o.map(ot).join(`
|
|
5
|
+
`):" "+ot(o[0]):"as no adapter specified";throw new y("There is no suitable adapter to dispatch the request "+c,"ERR_NOT_SUPPORT")}return s}const Pt={getAdapter:Lr,adapters:De};function Ee(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new ne(null,e)}function it(e){return Ee(e),e.headers=N.from(e.headers),e.data=Re.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Pt.getAdapter(e.adapter||te.adapter,e)(e).then(function(r){return Ee(e),r.data=Re.call(e,e.transformResponse,r),r.headers=N.from(r.headers),r},function(r){return Tt(r)||(Ee(e),r&&r.response&&(r.response.data=Re.call(e,e.transformResponse,r.response),r.response.headers=N.from(r.response.headers))),Promise.reject(r)})}const Nt="1.13.5",me={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{me[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const at={};me.transitional=function(t,n,r){function s(i,o){return"[Axios v"+Nt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,c)=>{if(t===!1)throw new y(s(o," has been removed"+(n?" in "+n:"")),y.ERR_DEPRECATED);return n&&!at[o]&&(at[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,c):!0}};me.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Ir(e,t,n){if(typeof e!="object")throw new y("options must be an object",y.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const c=e[i],d=c===void 0||o(c,i,e);if(d!==!0)throw new y("option "+i+" must be "+d,y.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new y("Unknown option "+i,y.ERR_BAD_OPTION)}}const ce={assertOptions:Ir,validators:me},U=ce.validators;let z=class{constructor(t){this.defaults=t||{},this.interceptors={request:new Ke,response:new Ke}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
6
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=J(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ce.assertOptions(r,{silentJSONParsing:U.transitional(U.boolean),forcedJSONParsing:U.transitional(U.boolean),clarifyTimeoutError:U.transitional(U.boolean),legacyInterceptorReqResOrdering:U.transitional(U.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ce.assertOptions(s,{encode:U.function,serialize:U.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ce.assertOptions(n,{baseUrl:U.spelling("baseURL"),withXsrfToken:U.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=N.concat(o,i);const c=[];let d=!0;this.interceptors.request.forEach(function(m){if(typeof m.runWhen=="function"&&m.runWhen(n)===!1)return;d=d&&m.synchronous;const h=n.transitional||Ue;h&&h.legacyInterceptorReqResOrdering?c.unshift(m.fulfilled,m.rejected):c.push(m.fulfilled,m.rejected)});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let l,p=0,b;if(!d){const f=[it.bind(this),void 0];for(f.unshift(...c),f.push(...u),b=f.length,l=Promise.resolve(n);p<b;)l=l.then(f[p++],f[p++]);return l}b=c.length;let w=n;for(;p<b;){const f=c[p++],m=c[p++];try{w=f(w)}catch(h){m.call(this,h);break}}try{l=it.call(this,w)}catch(f){return Promise.reject(f)}for(p=0,b=u.length;p<b;)l=l.then(u[p++],u[p++]);return l}getUri(t){t=J(this.defaults,t);const n=At(t.baseURL,t.url,t.allowAbsoluteUrls);return St(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){z.prototype[t]=function(n,r){return this.request(J(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,c){return this.request(J(c||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}z.prototype[t]=n(),z.prototype[t+"Form"]=n(!0)});let Br=class Ut{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(c=>{r.subscribe(c),i=c}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,c){r.reason||(r.reason=new ne(i,o,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Ut(function(s){t=s}),cancel:t}}};function vr(e){return function(n){return e.apply(null,n)}}function kr(e){return a.isObject(e)&&e.isAxiosError===!0}const xe={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(xe).forEach(([e,t])=>{xe[t]=e});function Ft(e){const t=new z(e),n=ft(z.prototype.request,t);return a.extend(n,z.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return Ft(J(e,s))},n}const S=Ft(te);S.Axios=z;S.CanceledError=ne;S.CancelToken=Br;S.isCancel=Tt;S.VERSION=Nt;S.toFormData=pe;S.AxiosError=y;S.Cancel=S.CanceledError;S.all=function(t){return Promise.all(t)};S.spread=vr;S.isAxiosError=kr;S.mergeConfig=J;S.AxiosHeaders=N;S.formToJSON=e=>Ot(a.isHTMLForm(e)?new FormData(e):e);S.getAdapter=Pt.getAdapter;S.HttpStatusCode=xe;S.default=S;const{Axios:Wr,AxiosError:Kr,CanceledError:Xr,isCancel:Gr,CancelToken:Zr,VERSION:Yr,all:es,Cancel:ts,isAxiosError:ns,spread:rs,toFormData:ss,AxiosHeaders:os,HttpStatusCode:is,formToJSON:as,getAdapter:cs,mergeConfig:ls}=S,le=new Map,Le="duoops-cache:",Mr=3e4;function us(e){return JSON.stringify(e,(t,n)=>typeof n=="object"&&n!==null?Object.fromEntries(Object.entries(n).sort()):n)}function Ie(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function jr(e,t){if(Ie())try{window.sessionStorage.setItem(Le+e,JSON.stringify(t))}catch{}}function qr(e){if(!Ie())return null;try{const t=window.sessionStorage.getItem(Le+e);return t?JSON.parse(t):null}catch{return null}}function Hr(e){if(Ie())try{window.sessionStorage.removeItem(Le+e)}catch{}}function fs(e){let t=le.get(e);return t||(t=qr(e)??void 0,t&&le.set(e,t)),t?Date.now()>t.timestamp+t.expiry?(le.delete(e),Hr(e),null):t.value:null}function ds(e,t,n){const s={expiry:n?.ttlMs??Mr,timestamp:Date.now(),value:t};le.set(e,s),jr(e,s)}export{ln as C,S as a,fs as g,us as h,ds as s,zr as u};
|