@foodpilot/foods 0.3.42 → 0.3.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ComparisonBlock/Blocks/HorizontalLargeBlock.d.ts +2 -2
- package/dist/components/ComparisonBlock/Blocks/HorizontalMediumBlock.d.ts +2 -2
- package/dist/components/ComparisonBlock/Blocks/VerticalLargeBlock.d.ts +4 -4
- package/dist/components/ComparisonBlock/Blocks/VerticalMediumBlock.d.ts +2 -2
- package/dist/components/ComparisonBlock/ComparisonBlock.d.ts +3 -3
- package/dist/main.js +54 -154
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -3,10 +3,10 @@ import { ColorSet } from '../getColorAndArrow';
|
|
|
3
3
|
|
|
4
4
|
type ComparisonBlockProps = {
|
|
5
5
|
percentageDifference: string;
|
|
6
|
-
comparedTo
|
|
7
|
-
value
|
|
8
|
-
unit
|
|
9
|
-
label
|
|
6
|
+
comparedTo?: {
|
|
7
|
+
value?: number;
|
|
8
|
+
unit?: string;
|
|
9
|
+
label?: string;
|
|
10
10
|
};
|
|
11
11
|
iconName: keyof IconMapping;
|
|
12
12
|
colors: ColorSet;
|
|
@@ -12,11 +12,11 @@ type ComparisonBlockProps = {
|
|
|
12
12
|
currentValue: number;
|
|
13
13
|
comparedTo: {
|
|
14
14
|
value: number;
|
|
15
|
-
unit
|
|
16
|
-
label
|
|
15
|
+
unit?: string;
|
|
16
|
+
label?: string;
|
|
17
17
|
};
|
|
18
|
-
disableText?: boolean;
|
|
19
18
|
improvement: Improvement;
|
|
19
|
+
disableText?: boolean;
|
|
20
20
|
comparisonText?: string;
|
|
21
21
|
layout?: Layout;
|
|
22
22
|
};
|
package/dist/main.js
CHANGED
|
@@ -42291,15 +42291,8 @@ const wre = (e) => {
|
|
|
42291
42291
|
}
|
|
42292
42292
|
);
|
|
42293
42293
|
}, DU = (e) => {
|
|
42294
|
-
const {
|
|
42295
|
-
|
|
42296
|
-
comparedTo: n,
|
|
42297
|
-
comparisonText: o,
|
|
42298
|
-
iconName: r,
|
|
42299
|
-
colors: i,
|
|
42300
|
-
disableText: a
|
|
42301
|
-
} = e;
|
|
42302
|
-
return /* @__PURE__ */ p.jsxs(Ue, { direction: "row", alignItems: "center", gap: "2px", flexWrap: "wrap", children: [
|
|
42294
|
+
const { percentageDifference: t, comparedTo: n, comparisonText: o, iconName: r, colors: i, disableText: a } = e;
|
|
42295
|
+
return /* @__PURE__ */ p.jsxs(Ue, { direction: "row", alignItems: "center", gap: "2px", flexWrap: "wrap", className: "comparison-block-wrapper", children: [
|
|
42303
42296
|
/* @__PURE__ */ p.jsxs(
|
|
42304
42297
|
be,
|
|
42305
42298
|
{
|
|
@@ -42317,45 +42310,20 @@ const wre = (e) => {
|
|
|
42317
42310
|
},
|
|
42318
42311
|
children: [
|
|
42319
42312
|
/* @__PURE__ */ p.jsx(Vn, { icon: r, size: 1 }),
|
|
42320
|
-
/* @__PURE__ */ p.jsx(be, { display: "flex", alignItems: "center", flexDirection: "row", gap: "8px", children: /* @__PURE__ */ p.jsx(
|
|
42321
|
-
ve,
|
|
42322
|
-
{
|
|
42323
|
-
component: "span",
|
|
42324
|
-
variant: "h6",
|
|
42325
|
-
children: t
|
|
42326
|
-
}
|
|
42327
|
-
) })
|
|
42313
|
+
/* @__PURE__ */ p.jsx(be, { display: "flex", alignItems: "center", flexDirection: "row", gap: "8px", children: /* @__PURE__ */ p.jsx(ve, { component: "span", variant: "h6", children: t }) })
|
|
42328
42314
|
]
|
|
42329
42315
|
}
|
|
42330
42316
|
),
|
|
42331
42317
|
!a && /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
42332
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "small", children: [
|
|
42318
|
+
o !== void 0 && (n == null ? void 0 : n.label) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "small", children: [
|
|
42333
42319
|
o,
|
|
42334
42320
|
" ",
|
|
42335
|
-
/* @__PURE__ */ p.jsx(
|
|
42336
|
-
ve,
|
|
42337
|
-
{
|
|
42338
|
-
component: "span",
|
|
42339
|
-
variant: "small",
|
|
42340
|
-
fontWeight: 600,
|
|
42341
|
-
children: n.label
|
|
42342
|
-
}
|
|
42343
|
-
)
|
|
42321
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "small", fontWeight: 600, children: n.label })
|
|
42344
42322
|
] }),
|
|
42345
|
-
" ",
|
|
42346
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "div", variant: "h6", children: [
|
|
42323
|
+
(n == null ? void 0 : n.value) !== void 0 && (n == null ? void 0 : n.unit) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "div", variant: "h6", children: [
|
|
42347
42324
|
"(",
|
|
42348
42325
|
n.value,
|
|
42349
|
-
" ",
|
|
42350
|
-
/* @__PURE__ */ p.jsx(
|
|
42351
|
-
ve,
|
|
42352
|
-
{
|
|
42353
|
-
color: "#A3A2A0",
|
|
42354
|
-
component: "span",
|
|
42355
|
-
fontSize: "0.625rem",
|
|
42356
|
-
children: n.unit
|
|
42357
|
-
}
|
|
42358
|
-
),
|
|
42326
|
+
/* @__PURE__ */ p.jsx(ve, { color: "#A3A2A0", component: "span", fontSize: "0.625rem", children: n.unit }),
|
|
42359
42327
|
")"
|
|
42360
42328
|
] })
|
|
42361
42329
|
] })
|
|
@@ -42389,123 +42357,73 @@ const wre = (e) => {
|
|
|
42389
42357
|
icon: a
|
|
42390
42358
|
};
|
|
42391
42359
|
}, AU = (e) => {
|
|
42392
|
-
const {
|
|
42393
|
-
percentageDifference: t,
|
|
42394
|
-
comparedTo: n,
|
|
42395
|
-
comparisonText: o,
|
|
42396
|
-
iconName: r,
|
|
42397
|
-
colors: i
|
|
42398
|
-
} = e;
|
|
42360
|
+
const { percentageDifference: t, comparedTo: n, comparisonText: o, iconName: r, colors: i } = e;
|
|
42399
42361
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
42400
42362
|
/* @__PURE__ */ p.jsxs(be, { display: "flex", alignItems: "center", gap: "8px", mb: "4px", children: [
|
|
42401
|
-
/* @__PURE__ */ p.jsx(ku, { icon: r, size: 3, boxProps: {
|
|
42402
|
-
sx: {
|
|
42403
|
-
backgroundColor: i.primaryColor,
|
|
42404
|
-
borderRadius: "32px",
|
|
42405
|
-
color: "#fff"
|
|
42406
|
-
}
|
|
42407
|
-
} }),
|
|
42408
42363
|
/* @__PURE__ */ p.jsx(
|
|
42409
|
-
|
|
42364
|
+
ku,
|
|
42410
42365
|
{
|
|
42411
|
-
|
|
42412
|
-
|
|
42413
|
-
|
|
42366
|
+
icon: r,
|
|
42367
|
+
size: 3,
|
|
42368
|
+
boxProps: {
|
|
42369
|
+
sx: {
|
|
42370
|
+
backgroundColor: i.primaryColor,
|
|
42371
|
+
borderRadius: "32px",
|
|
42372
|
+
color: "#fff"
|
|
42373
|
+
}
|
|
42374
|
+
}
|
|
42414
42375
|
}
|
|
42415
|
-
)
|
|
42376
|
+
),
|
|
42377
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "h2", children: t })
|
|
42416
42378
|
] }),
|
|
42417
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "body", children: [
|
|
42379
|
+
o !== void 0 && (n == null ? void 0 : n.label) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "body", children: [
|
|
42418
42380
|
o,
|
|
42419
42381
|
" ",
|
|
42420
|
-
/* @__PURE__ */ p.jsx(
|
|
42421
|
-
ve,
|
|
42422
|
-
{
|
|
42423
|
-
component: "span",
|
|
42424
|
-
variant: "body",
|
|
42425
|
-
fontWeight: 600,
|
|
42426
|
-
children: n.label
|
|
42427
|
-
}
|
|
42428
|
-
)
|
|
42382
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "body", fontWeight: 600, children: n.label })
|
|
42429
42383
|
] }),
|
|
42430
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "div", variant: "h4", fontSize: "0.875rem", children: [
|
|
42384
|
+
(n == null ? void 0 : n.value) !== void 0 && (n == null ? void 0 : n.unit) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "div", variant: "h4", fontSize: "0.875rem", children: [
|
|
42431
42385
|
"(",
|
|
42432
42386
|
n.value,
|
|
42433
42387
|
" ",
|
|
42434
|
-
/* @__PURE__ */ p.jsx(
|
|
42435
|
-
ve,
|
|
42436
|
-
{
|
|
42437
|
-
color: "#A3A2A0",
|
|
42438
|
-
component: "span",
|
|
42439
|
-
fontSize: "0.625rem",
|
|
42440
|
-
children: n.unit
|
|
42441
|
-
}
|
|
42442
|
-
),
|
|
42388
|
+
/* @__PURE__ */ p.jsx(ve, { color: "#A3A2A0", component: "span", fontSize: "0.625rem", children: n.unit }),
|
|
42443
42389
|
")"
|
|
42444
42390
|
] })
|
|
42445
42391
|
] });
|
|
42446
42392
|
}, VU = (e) => {
|
|
42447
|
-
const {
|
|
42448
|
-
percentageDifference: t,
|
|
42449
|
-
comparedTo: n,
|
|
42450
|
-
iconName: o,
|
|
42451
|
-
colors: r,
|
|
42452
|
-
comparisonText: i
|
|
42453
|
-
} = e;
|
|
42393
|
+
const { percentageDifference: t, comparedTo: n, iconName: o, colors: r, comparisonText: i } = e;
|
|
42454
42394
|
return /* @__PURE__ */ p.jsxs(p.Fragment, { children: [
|
|
42455
42395
|
/* @__PURE__ */ p.jsxs(be, { display: "flex", alignItems: "center", gap: "8px", children: [
|
|
42456
|
-
/* @__PURE__ */ p.jsx(ku, { icon: o, size: 0.5, boxProps: {
|
|
42457
|
-
sx: {
|
|
42458
|
-
backgroundColor: r.primaryColor,
|
|
42459
|
-
borderRadius: "32px",
|
|
42460
|
-
color: "#fff"
|
|
42461
|
-
}
|
|
42462
|
-
} }),
|
|
42463
42396
|
/* @__PURE__ */ p.jsx(
|
|
42464
|
-
|
|
42397
|
+
ku,
|
|
42465
42398
|
{
|
|
42466
|
-
|
|
42467
|
-
|
|
42468
|
-
|
|
42399
|
+
icon: o,
|
|
42400
|
+
size: 0.5,
|
|
42401
|
+
boxProps: {
|
|
42402
|
+
sx: {
|
|
42403
|
+
backgroundColor: r.primaryColor,
|
|
42404
|
+
borderRadius: "32px",
|
|
42405
|
+
color: "#fff"
|
|
42406
|
+
}
|
|
42407
|
+
}
|
|
42469
42408
|
}
|
|
42470
|
-
)
|
|
42409
|
+
),
|
|
42410
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "h4", children: t })
|
|
42471
42411
|
] }),
|
|
42472
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "small", children: [
|
|
42412
|
+
i !== void 0 && (n == null ? void 0 : n.label) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "small", children: [
|
|
42473
42413
|
i,
|
|
42474
42414
|
" ",
|
|
42475
|
-
/* @__PURE__ */ p.jsx(
|
|
42476
|
-
ve,
|
|
42477
|
-
{
|
|
42478
|
-
component: "span",
|
|
42479
|
-
variant: "body",
|
|
42480
|
-
fontWeight: 600,
|
|
42481
|
-
children: n.label
|
|
42482
|
-
}
|
|
42483
|
-
)
|
|
42415
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "body", fontWeight: 600, children: n.label })
|
|
42484
42416
|
] }),
|
|
42485
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "div", fontWeight: 700, fontSize: "0.625rem", children: [
|
|
42417
|
+
(n == null ? void 0 : n.value) !== void 0 && (n == null ? void 0 : n.unit) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "div", fontWeight: 700, fontSize: "0.625rem", children: [
|
|
42486
42418
|
"(",
|
|
42487
42419
|
n.value,
|
|
42488
42420
|
" ",
|
|
42489
|
-
/* @__PURE__ */ p.jsx(
|
|
42490
|
-
ve,
|
|
42491
|
-
{
|
|
42492
|
-
color: "#A3A2A0",
|
|
42493
|
-
component: "span",
|
|
42494
|
-
fontSize: "0.625rem",
|
|
42495
|
-
children: n.unit
|
|
42496
|
-
}
|
|
42497
|
-
),
|
|
42421
|
+
/* @__PURE__ */ p.jsx(ve, { color: "#A3A2A0", component: "span", fontSize: "0.625rem", children: n.unit }),
|
|
42498
42422
|
")"
|
|
42499
42423
|
] })
|
|
42500
42424
|
] });
|
|
42501
42425
|
}, $U = (e) => {
|
|
42502
|
-
const {
|
|
42503
|
-
percentageDifference: t,
|
|
42504
|
-
comparedTo: n,
|
|
42505
|
-
iconName: o,
|
|
42506
|
-
colors: r,
|
|
42507
|
-
comparisonText: i
|
|
42508
|
-
} = e;
|
|
42426
|
+
const { percentageDifference: t, comparedTo: n, iconName: o, colors: r, comparisonText: i } = e;
|
|
42509
42427
|
return /* @__PURE__ */ p.jsx(p.Fragment, { children: /* @__PURE__ */ p.jsxs(be, { display: "flex", alignItems: "center", flexDirection: "row", gap: "8px", mb: "4px", flexWrap: "wrap", children: [
|
|
42510
42428
|
/* @__PURE__ */ p.jsx(
|
|
42511
42429
|
ku,
|
|
@@ -42521,40 +42439,17 @@ const wre = (e) => {
|
|
|
42521
42439
|
}
|
|
42522
42440
|
}
|
|
42523
42441
|
),
|
|
42524
|
-
/* @__PURE__ */ p.jsx(
|
|
42525
|
-
|
|
42526
|
-
{
|
|
42527
|
-
component: "span",
|
|
42528
|
-
variant: "h2",
|
|
42529
|
-
children: t
|
|
42530
|
-
}
|
|
42531
|
-
),
|
|
42532
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "body", children: [
|
|
42442
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "h2", children: t }),
|
|
42443
|
+
i !== void 0 && (n == null ? void 0 : n.label) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "span", variant: "body", children: [
|
|
42533
42444
|
i,
|
|
42534
42445
|
" ",
|
|
42535
|
-
/* @__PURE__ */ p.jsx(
|
|
42536
|
-
ve,
|
|
42537
|
-
{
|
|
42538
|
-
component: "span",
|
|
42539
|
-
variant: "body",
|
|
42540
|
-
fontWeight: 600,
|
|
42541
|
-
children: n.label
|
|
42542
|
-
}
|
|
42543
|
-
)
|
|
42446
|
+
/* @__PURE__ */ p.jsx(ve, { component: "span", variant: "body", fontWeight: 600, children: n.label })
|
|
42544
42447
|
] }),
|
|
42545
|
-
/* @__PURE__ */ p.jsxs(ve, { component: "div", fontWeight: 700, fontSize: "0.875rem", children: [
|
|
42448
|
+
(n == null ? void 0 : n.value) !== void 0 && (n == null ? void 0 : n.unit) !== void 0 && /* @__PURE__ */ p.jsxs(ve, { component: "div", fontWeight: 700, fontSize: "0.875rem", children: [
|
|
42546
42449
|
"(",
|
|
42547
42450
|
n.value,
|
|
42548
42451
|
" ",
|
|
42549
|
-
/* @__PURE__ */ p.jsx(
|
|
42550
|
-
ve,
|
|
42551
|
-
{
|
|
42552
|
-
color: "#A3A2A0",
|
|
42553
|
-
component: "span",
|
|
42554
|
-
fontSize: "0.625rem",
|
|
42555
|
-
children: n.unit
|
|
42556
|
-
}
|
|
42557
|
-
),
|
|
42452
|
+
/* @__PURE__ */ p.jsx(ve, { color: "#A3A2A0", component: "span", fontSize: "0.625rem", children: n.unit }),
|
|
42558
42453
|
")"
|
|
42559
42454
|
] })
|
|
42560
42455
|
] }) });
|
|
@@ -42564,7 +42459,7 @@ const wre = (e) => {
|
|
|
42564
42459
|
iconName: n,
|
|
42565
42460
|
colors: o
|
|
42566
42461
|
} = e;
|
|
42567
|
-
return /* @__PURE__ */ p.jsxs(Ue, { direction: "row", alignItems: "center", gap: "2px", children: [
|
|
42462
|
+
return /* @__PURE__ */ p.jsxs(Ue, { direction: "row", alignItems: "center", gap: "2px", className: "comparison-block-wrapper", children: [
|
|
42568
42463
|
/* @__PURE__ */ p.jsx(
|
|
42569
42464
|
be,
|
|
42570
42465
|
{
|
|
@@ -42605,7 +42500,10 @@ const wre = (e) => {
|
|
|
42605
42500
|
},
|
|
42606
42501
|
disableText: a = !1
|
|
42607
42502
|
// works only for horizontal-m;
|
|
42608
|
-
} = e
|
|
42503
|
+
} = e;
|
|
42504
|
+
if (n === void 0 || n.value === void 0)
|
|
42505
|
+
throw new Error("comparedTo.value is required for ComparisonBlock");
|
|
42506
|
+
const l = LU(t, n.value, o), d = `${n.value > 0 ? Math.round(Math.abs(100 - t / n.value * 100)) : "N/A"} %`;
|
|
42609
42507
|
if (i.direction === "vertical")
|
|
42610
42508
|
return /* @__PURE__ */ p.jsxs(
|
|
42611
42509
|
be,
|
|
@@ -42616,6 +42514,7 @@ const wre = (e) => {
|
|
|
42616
42514
|
width: "fit-content",
|
|
42617
42515
|
padding: ((u = e.layout) == null ? void 0 : u.size) === "M" ? "8px" : "16px"
|
|
42618
42516
|
},
|
|
42517
|
+
className: "comparison-block-wrapper",
|
|
42619
42518
|
children: [
|
|
42620
42519
|
((f = e.layout) == null ? void 0 : f.size) === "L" && /* @__PURE__ */ p.jsx(
|
|
42621
42520
|
AU,
|
|
@@ -42651,6 +42550,7 @@ const wre = (e) => {
|
|
|
42651
42550
|
width: "fit-content",
|
|
42652
42551
|
padding: "24px 16px"
|
|
42653
42552
|
},
|
|
42553
|
+
className: "comparison-block-wrapper",
|
|
42654
42554
|
children: /* @__PURE__ */ p.jsx(
|
|
42655
42555
|
$U,
|
|
42656
42556
|
{
|
package/dist/main.umd.cjs
CHANGED
|
@@ -371,7 +371,7 @@ const theme2 = createTheme({ palette: {
|
|
|
371
371
|
* (c) 2017-2022 chartjs-plugin-datalabels contributors
|
|
372
372
|
* Released under the MIT license
|
|
373
373
|
*/var l7=function(){if(typeof window<"u"){if(window.devicePixelRatio)return window.devicePixelRatio;var e=window.screen;if(e)return(e.deviceXDPI||1)/(e.logicalXDPI||1)}return 1}(),wl={toTextLines:function(e){var t=[],n;for(e=[].concat(e);e.length;)n=e.pop(),typeof n=="string"?t.unshift.apply(t,n.split(`
|
|
374
|
-
`)):Array.isArray(n)?e.push.apply(e,n):Ct(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var o=[].concat(t),r=o.length,i=e.font,a=0,l;for(e.font=n.string,l=0;l<r;++l)a=Math.max(e.measureText(o[l]).width,a);return e.font=i,{height:r*n.lineHeight,width:a}},bound:function(e,t,n){return Math.max(e,Math.min(t,n))},arrayDiff:function(e,t){var n=e.slice(),o=[],r,i,a,l;for(r=0,a=t.length;r<a;++r)l=t[r],i=n.indexOf(l),i===-1?o.push([l,1]):n.splice(i,1);for(r=0,a=n.length;r<a;++r)o.push([n[r],-1]);return o},rasterize:function(e){return Math.round(e*l7)/l7}};function e2(e,t){var n=t.x,o=t.y;if(n===null)return{x:0,y:-1};if(o===null)return{x:1,y:0};var r=e.x-n,i=e.y-o,a=Math.sqrt(r*r+i*i);return{x:a?r/a:0,y:a?i/a:-1}}function zH(e,t,n,o,r){switch(r){case"center":n=o=0;break;case"bottom":n=0,o=1;break;case"right":n=1,o=0;break;case"left":n=-1,o=0;break;case"top":n=0,o=-1;break;case"start":n=-n,o=-o;break;case"end":break;default:r*=Math.PI/180,n=Math.cos(r),o=Math.sin(r);break}return{x:e,y:t,vx:n,vy:o}}var WH=0,c7=1,u7=2,d7=4,p7=8;function id(e,t,n){var o=WH;return e<n.left?o|=c7:e>n.right&&(o|=u7),t<n.top?o|=p7:t>n.bottom&&(o|=d7),o}function UH(e,t){for(var n=e.x0,o=e.y0,r=e.x1,i=e.y1,a=id(n,o,t),l=id(r,i,t),c,u,d;!(!(a|l)||a&l);)c=a||l,c&p7?(u=n+(r-n)*(t.top-o)/(i-o),d=t.top):c&d7?(u=n+(r-n)*(t.bottom-o)/(i-o),d=t.bottom):c&u7?(d=o+(i-o)*(t.right-n)/(r-n),u=t.right):c&c7&&(d=o+(i-o)*(t.left-n)/(r-n),u=t.left),c===a?(n=u,o=d,a=id(n,o,t)):(r=u,i=d,l=id(r,i,t));return{x0:n,x1:r,y0:o,y1:i}}function sd(e,t){var n=t.anchor,o=e,r,i;return t.clamp&&(o=UH(o,t.area)),n==="start"?(r=o.x0,i=o.y0):n==="end"?(r=o.x1,i=o.y1):(r=(o.x0+o.x1)/2,i=(o.y0+o.y1)/2),zH(r,i,e.vx,e.vy,t.align)}var ad={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,o=Math.cos(n),r=Math.sin(n),i=e.innerRadius,a=e.outerRadius;return sd({x0:e.x+o*i,y0:e.y+r*i,x1:e.x+o*a,y1:e.y+r*a,vx:o,vy:r},t)},point:function(e,t){var n=e2(e,t.origin),o=n.x*e.options.radius,r=n.y*e.options.radius;return sd({x0:e.x-o,y0:e.y-r,x1:e.x+o,y1:e.y+r,vx:n.x,vy:n.y},t)},bar:function(e,t){var n=e2(e,t.origin),o=e.x,r=e.y,i=0,a=0;return e.horizontal?(o=Math.min(e.x,e.base),i=Math.abs(e.base-e.x)):(r=Math.min(e.y,e.base),a=Math.abs(e.base-e.y)),sd({x0:o,y0:r+a,x1:o+i,y1:r,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=e2(e,t.origin);return sd({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:n.x,vy:n.y},t)}},Cr=wl.rasterize;function ZH(e){var t=e.borderWidth||0,n=e.padding,o=e.size.height,r=e.size.width,i=-r/2,a=-o/2;return{frame:{x:i-n.left-t,y:a-n.top-t,w:r+n.width+t*2,h:o+n.height+t*2},text:{x:i,y:a,w:r,h:o}}}function qH(e,t){var n=t.chart.getDatasetMeta(t.datasetIndex).vScale;if(!n)return null;if(n.xCenter!==void 0&&n.yCenter!==void 0)return{x:n.xCenter,y:n.yCenter};var o=n.getBasePixel();return e.horizontal?{x:o,y:null}:{x:null,y:o}}function GH(e){return e instanceof Ei?ad.arc:e instanceof gl?ad.point:e instanceof ml?ad.bar:ad.fallback}function YH(e,t,n,o,r,i){var a=Math.PI/2;if(i){var l=Math.min(i,r/2,o/2),c=t+l,u=n+l,d=t+o-l,f=n+r-l;e.moveTo(t,u),c<d&&u<f?(e.arc(c,u,l,-Math.PI,-a),e.arc(d,u,l,-a,0),e.arc(d,f,l,0,a),e.arc(c,f,l,a,Math.PI)):c<d?(e.moveTo(c,n),e.arc(d,u,l,-a,a),e.arc(c,u,l,a,Math.PI+a)):u<f?(e.arc(c,u,l,-Math.PI,0),e.arc(c,f,l,0,Math.PI)):e.arc(c,u,l,-Math.PI,Math.PI),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,o,r)}function KH(e,t,n){var o=n.backgroundColor,r=n.borderColor,i=n.borderWidth;!o&&(!r||!i)||(e.beginPath(),YH(e,Cr(t.x)+i/2,Cr(t.y)+i/2,Cr(t.w)-i,Cr(t.h)-i,n.borderRadius),e.closePath(),o&&(e.fillStyle=o,e.fill()),r&&i&&(e.strokeStyle=r,e.lineWidth=i,e.lineJoin="miter",e.stroke()))}function XH(e,t,n){var o=n.lineHeight,r=e.w,i=e.x,a=e.y+o/2;return t==="center"?i+=r/2:(t==="end"||t==="right")&&(i+=r),{h:o,w:r,x:i,y:a}}function QH(e,t,n){var o=e.shadowBlur,r=n.stroked,i=Cr(n.x),a=Cr(n.y),l=Cr(n.w);r&&e.strokeText(t,i,a,l),n.filled&&(o&&r&&(e.shadowBlur=0),e.fillText(t,i,a,l),o&&r&&(e.shadowBlur=o))}function JH(e,t,n,o){var r=o.textAlign,i=o.color,a=!!i,l=o.font,c=t.length,u=o.textStrokeColor,d=o.textStrokeWidth,f=u&&d,h;if(!(!c||!a&&!f))for(n=XH(n,r,l),e.font=l.string,e.textAlign=r,e.textBaseline="middle",e.shadowBlur=o.textShadowBlur,e.shadowColor=o.textShadowColor,a&&(e.fillStyle=i),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),h=0,c=t.length;h<c;++h)QH(e,t[h],{stroked:f,filled:a,w:n.w,x:n.x,y:n.y+n.h*h})}var f7=function(e,t,n,o){var r=this;r._config=e,r._index=o,r._model=null,r._rects=null,r._ctx=t,r._el=n};Yo(f7.prototype,{_modelize:function(e,t,n,o){var r=this,i=r._index,a=hn(Kt([n.font,{}],o,i)),l=Kt([n.color,tn.color],o,i);return{align:Kt([n.align,"center"],o,i),anchor:Kt([n.anchor,"center"],o,i),area:o.chart.chartArea,backgroundColor:Kt([n.backgroundColor,null],o,i),borderColor:Kt([n.borderColor,null],o,i),borderRadius:Kt([n.borderRadius,0],o,i),borderWidth:Kt([n.borderWidth,0],o,i),clamp:Kt([n.clamp,!1],o,i),clip:Kt([n.clip,!1],o,i),color:l,display:e,font:a,lines:t,offset:Kt([n.offset,4],o,i),opacity:Kt([n.opacity,1],o,i),origin:qH(r._el,o),padding:Rn(Kt([n.padding,4],o,i)),positioner:GH(r._el),rotation:Kt([n.rotation,0],o,i)*(Math.PI/180),size:wl.textSize(r._ctx,t,a),textAlign:Kt([n.textAlign,"start"],o,i),textShadowBlur:Kt([n.textShadowBlur,0],o,i),textShadowColor:Kt([n.textShadowColor,l],o,i),textStrokeColor:Kt([n.textStrokeColor,l],o,i),textStrokeWidth:Kt([n.textStrokeWidth,0],o,i)}},update:function(e){var t=this,n=null,o=null,r=t._index,i=t._config,a,l,c,u=Kt([i.display,!0],e,r);u&&(a=e.dataset.data[r],l=ct(Wt(i.formatter,[a,e]),a),c=Ct(l)?[]:wl.toTextLines(l),c.length&&(n=t._modelize(u,c,i,e),o=ZH(n))),t._model=n,t._rects=o},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,t){var n=this,o=e.ctx,r=n._model,i=n._rects,a;this.visible()&&(o.save(),r.clip&&(a=r.area,o.beginPath(),o.rect(a.left,a.top,a.right-a.left,a.bottom-a.top),o.clip()),o.globalAlpha=wl.bound(0,r.opacity,1),o.translate(Cr(t.x),Cr(t.y)),o.rotate(r.rotation),KH(o,i.frame,r),JH(o,r.lines,i.text,r),o.restore())}});var ez=Number.MIN_SAFE_INTEGER||-9007199254740991,tz=Number.MAX_SAFE_INTEGER||9007199254740991;function Sl(e,t,n){var o=Math.cos(n),r=Math.sin(n),i=t.x,a=t.y;return{x:i+o*(e.x-i)-r*(e.y-a),y:a+r*(e.x-i)+o*(e.y-a)}}function h7(e,t){var n=tz,o=ez,r=t.origin,i,a,l,c,u;for(i=0;i<e.length;++i)a=e[i],l=a.x-r.x,c=a.y-r.y,u=t.vx*l+t.vy*c,n=Math.min(n,u),o=Math.max(o,u);return{min:n,max:o}}function ld(e,t){var n=t.x-e.x,o=t.y-e.y,r=Math.sqrt(n*n+o*o);return{vx:(t.x-e.x)/r,vy:(t.y-e.y)/r,origin:e,ln:r}}var g7=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};Yo(g7.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,t,n){this._rotation=n,this._rect={x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},contains:function(e){var t=this,n=1,o=t._rect;return e=Sl(e,t.center(),-t._rotation),!(e.x<o.x-n||e.y<o.y-n||e.x>o.x+o.w+n*2||e.y>o.y+o.h+n*2)},intersects:function(e){var t=this._points(),n=e._points(),o=[ld(t[0],t[1]),ld(t[0],t[3])],r,i,a;for(this._rotation!==e._rotation&&o.push(ld(n[0],n[1]),ld(n[0],n[3])),r=0;r<o.length;++r)if(i=h7(t,o[r]),a=h7(n,o[r]),i.max<a.min||a.max<i.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,o=e.center();return[Sl({x:t.x,y:t.y},o,n),Sl({x:t.x+t.w,y:t.y},o,n),Sl({x:t.x+t.w,y:t.y+t.h},o,n),Sl({x:t.x,y:t.y+t.h},o,n)]}});function m7(e,t,n){var o=t.positioner(e,t),r=o.vx,i=o.vy;if(!r&&!i)return{x:o.x,y:o.y};var a=n.w,l=n.h,c=t.rotation,u=Math.abs(a/2*Math.cos(c))+Math.abs(l/2*Math.sin(c)),d=Math.abs(a/2*Math.sin(c))+Math.abs(l/2*Math.cos(c)),f=1/Math.max(Math.abs(r),Math.abs(i));return u*=r*f,d*=i*f,u+=t.offset*r,d+=t.offset*i,{x:o.x+u,y:o.y+d}}function nz(e,t){var n,o,r,i;for(n=e.length-1;n>=0;--n)for(r=e[n].$layout,o=n-1;o>=0&&r._visible;--o)i=e[o].$layout,i._visible&&r._box.intersects(i._box)&&t(r,i);return e}function oz(e){var t,n,o,r,i,a,l;for(t=0,n=e.length;t<n;++t)o=e[t],r=o.$layout,r._visible&&(l=new Proxy(o._el,{get:(c,u)=>c.getProps([u],!0)[u]}),i=o.geometry(),a=m7(l,o.model(),i),r._box.update(a,i,o.rotation()));return nz(e,function(c,u){var d=c._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(c._visible=!1)})}var Tl={prepare:function(e){var t=[],n,o,r,i,a;for(n=0,r=e.length;n<r;++n)for(o=0,i=e[n].length;o<i;++o)a=e[n][o],t.push(a),a.$layout={_box:new g7,_hidable:!1,_visible:!0,_set:n,_idx:a._index};return t.sort(function(l,c){var u=l.$layout,d=c.$layout;return u._idx===d._idx?d._set-u._set:d._idx-u._idx}),this.update(t),t},update:function(e){var t=!1,n,o,r,i,a;for(n=0,o=e.length;n<o;++n)r=e[n],i=r.model(),a=r.$layout,a._hidable=i&&i.display==="auto",a._visible=r.visible(),t|=a._hidable;t&&oz(e)},lookup:function(e,t){var n,o;for(n=e.length-1;n>=0;--n)if(o=e[n].$layout,o&&o._visible&&o._box.contains(t))return e[n];return null},draw:function(e,t){var n,o,r,i,a,l;for(n=0,o=t.length;n<o;++n)r=t[n],i=r.$layout,i._visible&&(a=r.geometry(),l=m7(r._el,r.model(),a),i._box.update(l,a,r.rotation()),r.draw(e,l))}},rz=function(e){if(Ct(e))return null;var t=e,n,o,r;if(Tt(e))if(!Ct(e.label))t=e.label;else if(!Ct(e.r))t=e.r;else for(t="",n=Object.keys(e),r=0,o=n.length;r<o;++r)t+=(r!==0?", ":"")+n[r]+": "+e[n[r]];return""+t},iz={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:rz,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},Gn="$datalabels",b7="$default";function sz(e,t){var n=e.datalabels,o={},r=[],i,a;return n===!1?null:(n===!0&&(n={}),t=Yo({},[t,n]),i=t.labels||{},a=Object.keys(i),delete t.labels,a.length?a.forEach(function(l){i[l]&&r.push(Yo({},[t,i[l],{_key:l}]))}):r.push(t),o=r.reduce(function(l,c){return $t(c.listeners||{},function(u,d){l[d]=l[d]||{},l[d][c._key||b7]=u}),delete c.listeners,l},{}),{labels:r,listeners:o})}function t2(e,t,n,o){if(t){var r=n.$context,i=n.$groups,a;t[i._set]&&(a=t[i._set][i._key],a&&Wt(a,[r,o])===!0&&(e[Gn]._dirty=!0,n.update(r)))}}function az(e,t,n,o,r){var i,a;!n&&!o||(n?o?n!==o&&(a=i=!0):a=!0:i=!0,a&&t2(e,t.leave,n,r),i&&t2(e,t.enter,o,r))}function lz(e,t){var n=e[Gn],o=n._listeners,r,i;if(!(!o.enter&&!o.leave)){if(t.type==="mousemove")i=Tl.lookup(n._labels,t);else if(t.type!=="mouseout")return;r=n._hovered,n._hovered=i,az(e,o,r,i,t)}}function cz(e,t){var n=e[Gn],o=n._listeners.click,r=o&&Tl.lookup(n._labels,t);r&&t2(e,o,r,t)}var uz={id:"datalabels",defaults:iz,beforeInit:function(e){e[Gn]={_actives:[]}},beforeUpdate:function(e){var t=e[Gn];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var o=t.index,r=e[Gn],i=r._datasets[o]=[],a=e.isDatasetVisible(o),l=e.data.datasets[o],c=sz(l,n),u=t.meta.data||[],d=e.ctx,f,h,g,m,b,v,x,w;for(d.save(),f=0,g=u.length;f<g;++f)if(x=u[f],x[Gn]=[],a&&x&&e.getDataVisibility(f)&&!x.skip)for(h=0,m=c.labels.length;h<m;++h)b=c.labels[h],v=b._key,w=new f7(b,d,x,f),w.$groups={_set:o,_key:v||b7},w.$context={active:!1,chart:e,dataIndex:f,dataset:l,datasetIndex:o},w.update(w.$context),x[Gn].push(w),i.push(w);d.restore(),Yo(r._listeners,c.listeners,{merger:function(T,P,C){P[T]=P[T]||{},P[T][t.index]=C[T],r._listened=!0}})},afterUpdate:function(e){e[Gn]._labels=Tl.prepare(e[Gn]._datasets)},afterDatasetsDraw:function(e){Tl.draw(e,e[Gn]._labels)},beforeEvent:function(e,t){if(e[Gn]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":lz(e,n);break;case"click":cz(e,n);break}}},afterEvent:function(e){var t=e[Gn],n=t._actives,o=t._actives=e.getActiveElements(),r=wl.arrayDiff(n,o),i,a,l,c,u,d,f;for(i=0,a=r.length;i<a;++i)if(u=r[i],u[1])for(f=u[0].element[Gn]||[],l=0,c=f.length;l<c;++l)d=f[l],d.$context.active=u[1]===1,d.update(d.$context);(t._dirty||r.length)&&(Tl.update(t._labels),e.render()),delete t._dirty}};const dz=e=>{const{values:t,color:n,theme:o,updateCurrentSelectedPoint:r,...i}=e;return{...i,data:pz(t,n),options:fz(o,r),plugins:[gz]}},pz=(e,t)=>({datasets:[{data:e,backgroundColor:t,pointStyle:"circle",pointRadius:8,pointHoverRadius:9}],labels:Array.from(e.map(n=>n.label))}),fz=(e,t)=>({plugins:{datalabels:{color:"#403d58",formatter:function(o){return o.label},align:"right",padding:{left:25},font:{weight:600,size:12,family:e.typography.fontFamily}},legend:{display:!1,usePointStyle:!0},tooltip:{enabled:!1,external:hz}},scales:{x:{beginAtZero:!0,grace:"15%",linear:!0,border:{dash:[5,5]}},y:{beginAtZero:!0,linear:!0,grace:"20%",border:{dash:[5,5]}}},layout:{padding:{left:25,right:25,top:15,bottom:15}},onHover:(o,r)=>{if(o.type==="click"){if(r.length){t(r[0].index,o.x,o.y);return}t(null,null,null)}}}),v7={opacity:"0",position:"absolute",backgroundColor:"#393A36",color:"#fff",borderRadius:"4px",padding:"6px",pointerEvents:"none",textAlign:"center",fontSize:"10px",fontWeight:"600",minWidth:"30px"},hz=e=>{const{chart:t,tooltip:n}=e;let o=document.getElementById("chartjs-tooltip-x");o||(o=document.createElement("div"),o.id="chartjs-tooltip-x",Object.assign(o.style,v7),document.body.appendChild(o));let r=document.getElementById("chartjs-tooltip-y");if(r||(r=document.createElement("div"),r.id="chartjs-tooltip-y",Object.assign(r.style,v7),document.body.appendChild(r)),n.opacity===0){o.style.opacity="0",r.style.opacity="0";return}if(n.dataPoints){const b=n.dataPoints[0],{x:v,y:x}=b.raw;o.textContent=`${v}`,r.textContent=`${x}`}const i=t.canvas.getBoundingClientRect(),a=t.scales.x,c=t.scales.y.bottom+i.top+window.scrollY,u=a.left+i.left+window.scrollX,d=i.left+window.scrollX+n.caretX-o.offsetWidth/2,f=c;o.style.left=`${d}px`,o.style.top=`${f}px`,o.style.opacity="1";const h=u-r.offsetWidth,g=i.top+window.scrollY+n.caretY-r.offsetHeight/2;r.style.left=`${h}px`,r.style.top=`${g}px`,r.style.opacity="1"},gz={id:"crosshair",defaults:{width:1,color:"#000000",dash:[],tooltipBackground:"#f5f5f5",tooltipTextColor:"#000000",tooltipFontSize:10,tooltipPadding:6,tooltipRadius:4},afterInit:e=>{e.crosshair={x:0,y:0,draw:!1,xValue:null,yValue:null}},afterEvent:(e,t)=>{const{inChartArea:n}=t,o=e.getElementsAtEventForMode(t.event,"nearest",{intersect:!0},!1);if(o.length){const r=o[0].index,i=e.data.datasets[0].data[r],{x:a,y:l}=o[0].element;e.crosshair={x:a,y:l,draw:n,xValue:i.x,yValue:i.y}}else e.crosshair.draw=!1;e.draw()},beforeDatasetsDraw:e=>{var u,d,f,h,g,m,b,v;const{ctx:t,crosshair:n}=e;if(!n)return;const{bottom:o,left:r}=e.chartArea,{x:i,y:a,draw:l}=n;if(!l)return;t.save(),t.beginPath(),t.lineWidth=((d=(u=e.options.plugins)==null?void 0:u.crosshair)==null?void 0:d.width)??1,t.strokeStyle=((h=(f=e.options.plugins)==null?void 0:f.crosshair)==null?void 0:h.color)??"#000000";const c=((m=(g=e.options.plugins)==null?void 0:g.crosshair)==null?void 0:m.dash)??[];t.setLineDash(c.filter(x=>x!==void 0)),t.moveTo(i,a),t.lineTo(i,o),t.moveTo(r,a),t.lineTo(i,a),t.stroke(),t.font=`${((v=(b=e.options.plugins)==null?void 0:b.crosshair)==null?void 0:v.tooltipFontSize)??10}px ${t.font.split(" ").slice(-1)}`,t.textAlign="center",t.textBaseline="middle",t.restore()}};hl.register(...qN,uz);const mz=e=>{const t=(i,a,l)=>{var d;if(i===null||!((d=e.values)!=null&&d[i])||a===null||l===null){e.onPointSelection(null);return}const u={point:e.values[i],absoluteCoordinate:{x:a,y:l}};e.onPointSelection(u)},n="#F6A500",o=ze(),r=dz({...e,color:o.palette.primary[500]??n,theme:o,updateCurrentSelectedPoint:t});return p.jsxs(ve,{sx:{backgroundColor:o.custom.grey[200],borderRadius:"8px",border:`1px solid ${o.custom.grey[500]}`,padding:"12px"},children:[e.y,p.jsx(JN,{...r}),p.jsx(ve,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.x})]})},x7=e=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"white"}),y.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,stroke:"#D1CFCE",strokeWidth:2})),y7=e=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("rect",{width:20,height:20,rx:4,fill:"url(#paint0_linear_2034_7850)"}),y.createElement("path",{d:"M8.32244 13.9335L4.56689 10.178L5.36133 9.38351L8.32244 12.3446L14.628 6.03906L15.4224 6.83351L8.32244 13.9335Z",fill:"white"}),y.createElement("defs",null,y.createElement("linearGradient",{id:"paint0_linear_2034_7850",x1:7.58928,y1:755124e-13,x2:7.58928,y2:20,gradientUnits:"userSpaceOnUse"},y.createElement("stop",{stopColor:"#484945"}),y.createElement("stop",{offset:1,stopColor:"#2A2B27"})))),bz=W(qo)(()=>({":hover":{background:Oe[400]}})),vz=e=>{const{values:t,...n}=e,{onChange:o,...r}=n,i=Object.entries(t);return p.jsx(vf,{children:i.map(([a,l],c)=>p.jsx(ys,{control:p.jsx(bz,{...r,checkedIcon:p.jsx(y7,{}),icon:p.jsx(x7,{}),disableRipple:!0,onChange:(u,d)=>{const f={};f[a]={name:l.name,state:d},o(f)}}),sx:{gap:"1rem"},label:l.name,checked:l.state},`${a}-${c}`))})},xz=(e,t,n)=>Object.entries(t).flatMap(r=>{const[i,a]=r;if(a.state===!1)return[];const l=Number(i),c=e.find(u=>u.id===l);return c?[c]:[n({id:l,name:a.name})]}),yz=(e,t)=>{const n={};return e.reduce((r,i)=>{const a=t.some(l=>l.id===i.id);return r[i.id]={name:i.name,state:a},r},n)},Cz=W(qo)(()=>({":hover":{background:Oe[400]}})),wz=e=>{const{values:t,onChange:n,FormGroupProps:o,FormControlLabelProps:r,CheckboxProps:i}=e,a=Object.entries(t);return p.jsx(vf,{...o,children:a.map(([l,c],u)=>p.jsx(ys,{sx:{gap:"1rem"},checked:c.state,...r,label:c.name,control:p.jsx(Cz,{checkedIcon:p.jsx(y7,{}),icon:p.jsx(x7,{}),disableRipple:!0,...i,onChange:(d,f)=>{const h={...t};h[l]={...h[l],name:c.name,state:f},n(h)}})},`${l}-${u}`))})},Sz=e=>{const{values:t,selectedItems:n,onChange:o,getId:r=u=>u.id,getName:i=u=>u.name,...a}=e,l=(n==null?void 0:n.map(u=>r(u)))??[],c=t.reduce((u,d)=>{const f=r(d),h=l.includes(f),g=n===void 0?!1:h;return u[f]={name:i(d),state:g,rawData:d},u},{});return p.jsx(wz,{values:c,onChange:u=>{const d=Object.values(u).flatMap(f=>f.state===!1?[]:f.rawData);return o(d)},...a})},Tz=e=>{const{percentageDifference:t,comparedTo:n,comparisonText:o,iconName:r,colors:i,disableText:a}=e;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"2px",flexWrap:"wrap",children:[p.jsxs(ve,{sx:{border:`1px solid ${i.primaryColor}`,background:i.secondaryColor,width:"fit-content",padding:"3px 7px",display:"flex",borderRadius:"20px",alignItems:"center",gap:"2px",color:i.primaryColor,marginRight:"6px"},children:[p.jsx(Mn,{icon:r,size:1}),p.jsx(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",children:p.jsx(xe,{component:"span",variant:"h6",children:t})})]}),!a&&p.jsxs(p.Fragment,{children:[p.jsxs(xe,{component:"span",variant:"small",children:[o," ",p.jsx(xe,{component:"span",variant:"small",fontWeight:600,children:n.label})]})," ",p.jsxs(xe,{component:"div",variant:"h6",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})]})},n2={POSITIVE:{primaryColor:Co[500],secondaryColor:Co[100]},NEGATIVE:{primaryColor:wn[500],secondaryColor:wn[100]},NEUTRAL:{primaryColor:Ff.main,secondaryColor:Ff[100]}},Pz=(e,t,n)=>{const o=n2.POSITIVE,r=n2.NEGATIVE;if(e===t)return{color:n2.NEUTRAL,icon:"equal"};const i=e>t,a=i?"arrowUpRight":"arrowDownRight";return n==="increase"?{color:i?o:r,icon:a}:{color:i?r:o,icon:a}},Mz=e=>{const{percentageDifference:t,comparedTo:n,comparisonText:o,iconName:r,colors:i}=e;return p.jsxs(p.Fragment,{children:[p.jsxs(ve,{display:"flex",alignItems:"center",gap:"8px",mb:"4px",children:[p.jsx(qa,{icon:r,size:3,boxProps:{sx:{backgroundColor:i.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h2",children:t})]}),p.jsxs(xe,{component:"span",variant:"body",children:[o," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),p.jsxs(xe,{component:"div",variant:"h4",fontSize:"0.875rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})},Rz=e=>{const{percentageDifference:t,comparedTo:n,iconName:o,colors:r,comparisonText:i}=e;return p.jsxs(p.Fragment,{children:[p.jsxs(ve,{display:"flex",alignItems:"center",gap:"8px",children:[p.jsx(qa,{icon:o,size:.5,boxProps:{sx:{backgroundColor:r.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h4",children:t})]}),p.jsxs(xe,{component:"span",variant:"small",children:[i," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),p.jsxs(xe,{component:"div",fontWeight:700,fontSize:"0.625rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})},Oz=e=>{const{percentageDifference:t,comparedTo:n,iconName:o,colors:r,comparisonText:i}=e;return p.jsx(p.Fragment,{children:p.jsxs(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",mb:"4px",flexWrap:"wrap",children:[p.jsx(qa,{icon:o,size:3,boxProps:{sx:{backgroundColor:r.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h2",children:t}),p.jsxs(xe,{component:"span",variant:"body",children:[i," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),p.jsxs(xe,{component:"div",fontWeight:700,fontSize:"0.875rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})})},Ez=e=>{const{percentageDifference:t,iconName:n,colors:o}=e;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"2px",children:[p.jsx(ve,{sx:{border:`1px solid ${o.primaryColor}`,background:o.secondaryColor,width:"fit-content",padding:"1px",display:"flex",borderRadius:"20px",alignItems:"center",color:o.primaryColor,marginRight:"2px"},children:p.jsx(Mn,{icon:n,size:.1})}),p.jsx(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",children:p.jsx(xe,{color:o.primaryColor,component:"span",variant:"h6",children:t})})]})},kz=e=>{var d,f,h,g,m,b;const{currentValue:t,comparedTo:n,improvement:o,comparisonText:r="par rapport à",layout:i={direction:"vertical",size:"L"},disableText:a=!1}=e,l=Pz(t,n.value,o),u=`${n.value>0?Math.round(Math.abs(100-t/n.value*100)):"N/A"} %`;if(i.direction==="vertical")return p.jsxs(ve,{sx:{borderRadius:"12px",background:l.color.secondaryColor,width:"fit-content",padding:((d=e.layout)==null?void 0:d.size)==="M"?"8px":"16px"},children:[((f=e.layout)==null?void 0:f.size)==="L"&&p.jsx(Mz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color}),((h=e.layout)==null?void 0:h.size)==="M"&&p.jsx(Rz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color})]});if(i.direction==="horizontal"){if(((g=e.layout)==null?void 0:g.size)==="L")return p.jsx(ve,{sx:{borderRadius:"12px",background:l.color.secondaryColor,width:"fit-content",padding:"24px 16px"},children:p.jsx(Oz,{percentageDifference:u,comparisonText:r,comparedTo:n,iconName:l.icon,colors:l.color})});if(((m=e.layout)==null?void 0:m.size)==="M")return p.jsx(Tz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color,disableText:a})}if(((b=e.layout)==null?void 0:b.size)==="S")return p.jsx(Ez,{percentageDifference:u,iconName:l.icon,colors:l.color})},Iz=e=>{const{value:t,maxLength:n,...o}=e,r=t.map((d,f)=>t.slice(0,f+1).reduce((h,g)=>{const m=h.length+g.length;if(m>n){const b=n-m,v=[...h.words,g.slice(0,b)].filter(Boolean);return{length:m,words:v,rest:t.length-v.length}}return{...h,length:m,words:[...h.words,g]}},{length:0,words:[],rest:0})),i=r[r.length-1],l=t[t.length-1].length===i.words[i.words.length-1].length?"":"…",c=i.words.join(", "),u=i.rest>0?`${c}… +${i.rest}`:c+l;return p.jsx(xe,{...o,children:u})},_z=e=>{const{value:t,maxLength:n,separator:o=",",...r}=e;if(n===0)return p.jsx(xe,{...r,children:""});const i=t.join("").length;if(n>i)return p.jsx(xe,{...r,children:t.join(o)});let a=0;const l=t.reduce((x,w)=>{const T=a+w.length,P={low:a,high:T};return a=T,x.push(P),x},[]),c=l.findIndex(x=>x.low<n&&n<=x.high),u=c+1,d=l.length-u,h=l[c].high===n?"":"…",g=u*o.length,m=t.join(o).slice(0,n-1+g),b=d?`+${d}`:"",v=`${m}${h} ${b}`;return p.jsx(xe,{...r,children:v})},jz=e=>{const{setOpen:t,options:n,onValidate:o,onCancel:r,canValidate:i=!0,confirmAction:a,cancelText:l,validateText:c,...u}=e,[d,f]=J.useState(!1),h=()=>t(!1),g=()=>{f(!1)},m=()=>{r&&r(),h()},b=()=>{if(!a){o&&o(),h();return}d?(f(!1),o&&o(),h()):f(!0)};return p.jsxs(ja,{onClose:m,...u,fullWidth:!0,maxWidth:"md",scroll:"body",children:[p.jsxs(Uc,{sx:w7,children:[n.title,p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:m})]}),p.jsx(ve,{sx:{width:"100%"},children:n.content}),p.jsx(C7,{onCancelAction:m,onConfirmAction:b,canValidate:i,cancelText:l,validateText:c}),a&&p.jsx(Dz,{openConfirmAction:d,onCancel:g,onValidate:b,confirmAction:a,cancelText:l,validateText:c})]})},Dz=e=>{const{confirmAction:t,onCancel:n,onValidate:o,openConfirmAction:r,cancelText:i,validateText:a}=e;return p.jsxs(ja,{open:r,onClose:n,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Oe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},children:[p.jsxs(Uc,{sx:w7,children:[t.title,p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:n})]}),p.jsx(ve,{sx:{padding:"32px",width:"100%"},children:t.content}),p.jsx(C7,{onCancelAction:n,onConfirmAction:o,cancelText:t.cancelText??i,validateText:t.validateText??a})]})},C7=e=>{const{onCancelAction:t,onConfirmAction:n,canValidate:o=!0,cancelText:r,validateText:i}=e;return p.jsxs(bf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${Oe[500]}`,minHeight:"68px",paddingInline:"1rem",padding:"28px 32px 32px 32px"},children:[p.jsx(lt,{variant:"text",onClick:t,children:r}),p.jsx(lt,{variant:"primary",onClick:n,disabled:!o,children:i})]})},w7={display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Oe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},Lz=W(Oa)(({theme:e})=>({fontFamily:e.typography.fontFamily,...e.typography.body})),cd=J.forwardRef(function(e){const t=ze(),{sx:n,error:o,...r}=e;return p.jsx(Lz,{...r,sx:{color:o?t.custom.red[600]:t.custom.grey[2800],border:o?`1px solid ${t.custom.red[600]}`:`1px solid ${t.custom.grey[1400]}`,backgroundColor:o?t.custom.red[100]:"inherit",borderRadius:"16px",paddingInline:"20px",...n}})}),Az=e=>{const{title:t,unit:n,placeholder:o,value:r,description:i,error:a,required:l,...c}=e,u=l?"*":"",d=ze(),f=J.useRef(!1),h=f.current&&a,[g,m]=J.useState(!1),[b,v]=J.useState(!1),[x,w]=J.useState(!1);J.useEffect(()=>{const M=T(P,e.setMinMaxError);m(M);const O=T(C,e.setMinError);v(O);const E=T(R,e.setMaxError);w(E)},[r]);const T=(M,O)=>{const E=M();return O!==void 0&&O(E),E},P=()=>{if(e.min===void 0&&e.max===void 0||r===void 0||r==="")return!1;const M=Number(r);return!(e.min!==void 0&&M>e.min&&e.max!==void 0&&M<e.max)},C=()=>e.min===void 0||r===void 0||r===""?!1:!(e.min<Number(r)&&e.max===void 0),R=()=>e.max===void 0||r===void 0||r===""?!1:!(e.max>Number(r)&&e.min===void 0);return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(xe,{variant:"h5",children:`${t}${u} :`}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[p.jsx(cd,{...c,type:"number",style:{minWidth:"150px",width:"10%",borderColor:h?d.palette.error.main:"inherit",backgroundColor:h?d.palette.error.light:"inherit"},placeholder:o,value:r,onChange:M=>{f.current=!0,c.onChange&&c.onChange(M)}}),p.jsx(xe,{variant:"body",children:n})]}),(!!e.minMaxErrorMessage&&g||!!e.minErrorMessage&&b||!!e.maxErrorMessage&&x)&&p.jsxs(xe,{variant:"body",style:{color:d.custom.red[600]},children:[!!e.minMaxErrorMessage&&g&&e.minMaxErrorMessage,!!e.minErrorMessage&&b&&e.minErrorMessage,!!e.maxErrorMessage&&x&&e.maxErrorMessage]}),p.jsx(xe,{variant:"body",children:i})]})},Vz=J.forwardRef(function(t){const{title:n,placeholder:o,value:r,description:i,sx:a,error:l,required:c,...u}=t,d=c?"*":"",f=ze(),h=J.useRef(!1),g=h.current&&l;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(xe,{variant:"h5",children:`${n}${d} :`}),p.jsx(cd,{...u,sx:{width:"70%",borderColor:g?f.custom.red[600]:"inherit",backgroundColor:g?f.custom.red[100]:"inherit",...a},placeholder:o,value:r,onChange:m=>{h.current=!0,u.onChange&&u.onChange(m)}}),p.jsx(xe,{variant:"body",children:i})]})});function Fz(e){return p.jsxs("div",{children:[p.jsx(xe,{variant:"body-bold",sx:{marginBottom:"16px"},children:e.header}),p.jsxs(qe,{direction:"column",useFlexGap:!0,gap:"12px",children:[p.jsxs(qe,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(qo,{checked:!0,sx:{width:"20px",height:"20px"}}),p.jsx(xe,{variant:"body",children:e.allText})]}),e.values.map((t,n)=>p.jsxs(qe,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(qo,{checked:!1,sx:{width:"20px",height:"20px"}}),p.jsx(xe,{variant:"body",children:t})]},n))]})]})}function $z(e){return p.jsxs(qe,{direction:"column",useFlexGap:!0,gap:"12px",alignItems:"flex-start",children:[p.jsx(xe,{variant:"body-bold",children:e.header}),p.jsx(qe,{direction:"row",useFlexGap:!0,gap:"8px",flexWrap:"wrap",children:e.values.map((t,n)=>p.jsxs(qe,{direction:"row",useFlexGap:!0,gap:"4px",sx:{height:"28px",borderRadius:"4px",background:"#EFEDEC",paddingLeft:"8px"},alignItems:"center",children:[p.jsx(xe,{variant:"body",children:t}),p.jsx(Rt,{sx:{width:"20px",height:"20px"},children:p.jsx(z6,{sx:{width:"16px",height:"16px"}})})]},n))}),p.jsx(lt,{variant:"text",startIcon:p.jsx(qD,{}),children:e.addText})]})}const S7=e=>{const t=ze(),{steps:n,currentStep:o=0,icons:r=[],clickable:i=!1,onClick:a}=e;return p.jsxs(ve,{display:"inline-flex",position:"relative",children:[p.jsx(qe,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(n??r.length).keys()].map(l=>{const c=l<=o;return p.jsx(mu,{size:"medium",border:`1px solid ${t.custom.grey[500]}`,color:c?"#FFF":t.custom.grey[2800],bgcolor:c?t.custom.grey[2800]:"#FFF",sx:{fill:c?"#FFF":t.custom.grey[2800],cursor:i?"pointer":"default","&:hover":i?{fill:"#FFF",color:"#FFF",bgcolor:t.custom.grey[c?2800:2e3]}:{}},onClick:()=>{i&&a&&a(l)},children:r&&r[l]?r[l]:l+1},l)})}),p.jsx(oo,{sx:{backgroundColor:t.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},T7=e=>y.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("path",{d:"M11.021 7.69411H0.333496V6.30524H11.021L6.021 1.30522L7.00016 0.333008L13.6668 6.99967L7.00016 13.6663L6.021 12.6941L11.021 7.69411Z",fill:"white"})),P7=e=>y.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("path",{d:"M2.97919 7.69411L7.97921 12.6941L7.00004 13.6663L0.333374 6.99967L7.00004 0.333008L7.97921 1.30522L2.97919 6.30524H13.6667V7.69411H2.97919Z",fill:"#B06803"})),M7=e=>{var t;return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{minHeight:"96px",zIndex:1e3,position:"sticky",top:"28px",border:"1px solid #E7E6E4",borderRadius:"52px",backgroundColor:"#FFFFFF",padding:"20px 28px"},children:[p.jsx(Nz,{title:e.title,subtitle:e.subtitle}),p.jsx(S7,{icons:e.icons,steps:e.steps??((t=e.icons)==null?void 0:t.length)??0,currentStep:e.currentPage,clickable:e.navigable,onClick:e.onNavigate}),p.jsx(Hz,{onPageForward:e.onPageForward,onPageBack:e.onPageBack,nextPageText:e.nextPageText,previousPageText:e.previousPageText,currentPage:e.currentPage,validateSteps:e.validateSteps,validateStepsTexts:e.validateStepsTexts,warningText:e.warningText,savingState:e.savingState,closeable:e.closeable,onClose:e.onClose})]})},Nz=e=>{const t=ze();return p.jsx(qe,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(qe,{gap:"4px",children:[p.jsx(xe,{variant:"h3",children:e.title}),e.subtitle&&p.jsx(xe,{variant:"body",color:t.custom.grey[2e3],children:e.subtitle})]})})},Bz=e=>{const t=ze(),n=e.saving?Z6:U6,o=e.saving?{animation:"spin 1s linear infinite","@keyframes spin":{"0%":{transform:"rotate(360deg)"},"100%":{transform:"rotate(0deg)"}}}:{},r=p.jsx(n,{sx:{width:"24px",color:t.custom.grey[2e3],...o}}),i=p.jsx(ve,{padding:"12px 16px",textAlign:"center",children:p.jsx(xe,{variant:"body",children:e.saving?e.savingMessage:e.savedMessage})});return p.jsx(Pl,{icon:r,body:i,size:"260px"})},Hz=e=>{const t=ze(),n=p.jsx(lt,{variant:"primary",disabled:e.validateSteps&&!e.validateSteps[e.currentPage],endIcon:p.jsx(T7,{}),onClick:e.onPageForward,children:e.nextPageText}),o=p.jsxs(ve,{padding:"12px 16px",children:[p.jsx(xe,{variant:"body-bold",children:e.warningText||""}),p.jsx("br",{}),p.jsx(xe,{variant:"body",children:e.validateStepsTexts&&e.validateStepsTexts[e.currentPage]||""})]});return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(ve,{sx:{">*":{display:"flex"}},children:e.savingState&&p.jsx(Bz,{...e.savingState})}),p.jsxs(qe,{direction:"row",gap:"20px",children:[e.previousPageText&&p.jsx(lt,{variant:"text",startIcon:p.jsx(P7,{}),onClick:e.onPageBack,children:e.previousPageText}),e.validateSteps&&!e.validateSteps[e.currentPage]?e.nextPageText&&p.jsx(Pl,{icon:n,body:o,size:"260px"}):e.nextPageText&&n]}),e.closeable&&p.jsx(lt,{variant:"white-filled",onClick:e.onClose,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:t.custom.grey[400]},"&:active":{background:t.custom.grey[600]}},children:p.jsx(W6,{sx:{width:"20px",color:t.custom.grey[2800]}})})]})},o2=e=>{const t=ze(),{title:n,titleSize:o,badge:r}=e,a=o||"h1";return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"16px",children:[typeof r=="number"?p.jsx(mu,{size:"big",children:r}):p.jsx(qe,{width:"40px",alignItems:"center",color:t.custom.grey[2800],children:p.jsx(qe,{sx:{transform:"scale(250%)"},children:r})}),p.jsx(xe,{variant:a,children:n})]})},zz=e=>{const{title:t,subtitle:n,pages:o,pageIndexToDisplay:r=0,savingState:i,closeable:a=!0}=e,l=o.map(d=>d.icon),c=o[r],u=(Array.isArray(c.content)?c.content:[c.content]).map((d,f)=>p.jsx(J.Fragment,{children:d},f));return p.jsxs(p.Fragment,{children:[p.jsx(M7,{title:t,subtitle:n,icons:l,steps:o.length,currentPage:r,nextPageText:e.nextPageText,previousPageText:e.previousPageText,onPageForward:e.onPageForward,onPageBack:e.onPageBack,validateSteps:e.validateSteps,validateStepsTexts:e.validateStepsTexts,warningText:e.warningText,savingState:i,navigable:e.navigable,onNavigate:e.onNavigate,closeable:a,onClose:e.onClose}),p.jsx(qe,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(qe,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[c.title&&p.jsx(o2,{title:c.title,badge:c.icon??r+1}),c.subTitle&&p.jsx(xe,{variant:"h4",children:c.subTitle}),c.subTitle&&p.jsx(oo,{}),c.info]}),c.usesBaseLayout===!1?p.jsx(p.Fragment,{children:u}):p.jsx(Wz,{children:u})]})})]})},Wz=e=>{const{children:t}=e,n=Array.isArray(t)?t:[t];return p.jsx("div",{children:n.map((o,r)=>p.jsx(J.Fragment,{children:o},r))})},Uz=({sx:e={},...t})=>p.jsx(ve,{sx:{boxShadow:"0px 2px 8px 0px #2A2B270A",border:`1px solid ${Oe[500]}`,borderRadius:"16px",backgroundColor:"#FFFFFF",padding:"2rem",height:"fit-content",...e},...t}),Zz=e=>{const{title:t,hint:n,indicator:o,children:r,...i}=e;return p.jsx(Ar,{width:"100%",padding:"32px",...i,children:p.jsxs(qe,{gap:"32px",children:[p.jsxs(qe,{direction:"row",alignItems:"start",gap:"32px",children:[p.jsx(xe,{variant:"h4",flex:1,children:t}),o&&p.jsx(Vf,{value:o.value,unit:o.unit,sx:{top:"-12px",right:"-12px"}})]}),p.jsxs(qe,{gap:"24px",children:[r,n&&p.jsx(J6,{children:p.jsx(ve,{dangerouslySetInnerHTML:{__html:n}})})]})]})})},qz=()=>{const[e,t]=J.useState({isLocked:!1}),n=d=>{t({isLocked:!0,message:d})},o=()=>{t({isLocked:!1})},[r,i]=J.useState({isLocked:!1}),a=d=>{i({isLocked:!0,message:d})},l=()=>{i({isLocked:!1})};return{forwardLock:e,lockForward:n,unlockForward:o,previousLock:r,lockPrevious:a,unlockPrevious:l,lockAll:d=>{n(d),a(d)},unlockAll:()=>{o(),l()}}},R7=J.createContext(null),O7=e=>{const{children:t,startingPage:n=0,...o}=e,[r,i]=J.useState(!1),[a,l]=J.useState(!1),[c,u]=J.useState(n),d=e.pages.length,f=e.pages[c]??null,h=qz(),[g,m]=J.useState(!1),b={...o,...h,isSaving:r,setSaving:i,selectedPage:f,selectedPageIndex:c,setPage:u,maxPage:d,formSaved:g,setFormSaved:m,isError:a,setError:l};return p.jsx(R7.Provider,{value:b,children:t})},Ii=()=>{const e=J.useContext(R7);if(e)return e;throw new Error("useFormBaseContext must be used within an FormBaseContextProvider")},Gz=()=>{const{selectedPageIndex:e,setPage:t,onPageChange:n,pages:o,previousLock:r,forwardLock:i,maxPage:a,setFormSaved:l,isLoading:c}=Ii(),u=ze(),d={selected:{color:"#FFF",background:u.custom.grey[2800],hover:{color:"#FFF",background:u.custom.grey[2800]}},locked:{color:u.custom.grey[500],background:"#FFF",hover:{color:u.custom.grey[500],background:"#FFF"}},default:{color:u.custom.grey[2800],background:"#FFF",hover:{color:"#FFF",background:u.custom.grey[2e3]}}};return c?p.jsx(xs,{}):p.jsxs(ve,{display:"inline-flex",position:"relative",children:[p.jsx(qe,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(a)].map((f,h)=>{var T;const g=r.isLocked&&h<e,m=i.isLocked&&h>e,b=g||m,x=h===e?d.selected:d[b?"locked":"default"],w=((T=o[h])==null?void 0:T.icon)??h+1;return p.jsx(mu,{size:"medium",border:`1px solid ${u.custom.grey[500]}`,color:x.color,bgcolor:x.background,sx:{fill:x.color,cursor:b?"default":"pointer","&:hover":{fill:x.hover.color,color:x.hover.color,bgcolor:x.hover.background}},onClick:()=>{h===e||b||(l(!1),t(h),n==null||n(h,e))},children:w},`page-top-display-${h}`)})}),p.jsx(oo,{sx:{backgroundColor:u.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},Yz=()=>{const{textOptions:e,isLoading:t}=Ii(),n=ze();return p.jsx(qe,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(qe,{gap:"4px",children:[p.jsx(xe,{variant:"h3",children:t?p.jsx(xs,{size:"18px"}):e.title}),e.subtitle&&p.jsx(xe,{variant:"body",color:n.custom.grey[2e3],children:e.subtitle})]})})};function ud(e){return e.variant==="themed"?p.jsx(E7,{...e}):e.variant==="headless"?p.jsx(i2,{...e}):p.jsx(i2,{...e,variant:"themed"})}const r2={leftside:{anchorPosition:"left",anchorIndicatorPosition:"calc(100% - (1.5 * 30px))"},rightside:{anchorPosition:"right",anchorIndicatorPosition:"15px"},center:{anchorPosition:"center",anchorIndicatorPosition:"calc(50% - (30px / 2))"}};function E7(e){const t=ze(),n=e.anchorPosition?r2[e.anchorPosition].anchorPosition:"right",o=e.anchorPosition?r2[e.anchorPosition].anchorIndicatorPosition:"15px";return p.jsx(cr,{open:e.open,anchorEl:e.anchor,onClose:e.onClose,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:n,vertical:"bottom"},slotProps:{paper:{sx:{padding:"24px 20px",borderRadius:"12px",marginTop:1.5,overflow:"visible",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${t.custom.grey[500]}`,transform:n==="center"?"translateX(50%) !important":"none","&:before":{content:'""',display:"block",position:"absolute",top:"-15px",right:o,width:0,height:0,borderLeft:"15px solid transparent",borderRight:"15px solid transparent",borderBottom:`15px solid ${t.custom.grey[500]}`,zIndex:-1},"&:after":{content:'""',display:"block",position:"absolute",top:-14,right:o,width:0,height:0,borderLeft:"15px solid transparent",borderRight:"15px solid transparent",borderBottom:"15px solid #fff",zIndex:0}}}},sx:e.sx,children:e.children})}function i2(e){const t=e.anchorPosition?r2[e.anchorPosition].anchorPosition:"right";return p.jsx(cr,{open:e.open,anchorEl:e.anchor,onClose:e.onClose,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:t,vertical:"bottom"},slotProps:{paper:{sx:{borderRadius:"12px",...e.paperProps}}},sx:e.sx,children:e.children})}const Kz=e=>p.jsxs(ve,{component:"div",sx:{background:"white",width:e.width??"376px",borderRadius:"12px",border:"1px solid #E7E6E4",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)"},children:[p.jsxs(qe,{direction:"row",useFlexGap:!0,alignContent:"center",justifyContent:"space-between",sx:{padding:"18px 16px"},children:[e.headerIcon??p.jsx(QD,{}),p.jsx(xe,{variant:"h4",sx:{height:"24px"},children:e.headerText}),p.jsx(Rt,{sx:{padding:"0"},onClick:e.onClose,children:p.jsx(z6,{})})]}),p.jsx(oo,{}),p.jsx(ve,{sx:{padding:"24px",height:"420px",overflow:"auto"},children:e.children}),e.bottomActions&&p.jsx(Xz,{onCancel:e.onCancel,onValidate:e.onValidate})]}),Xz=e=>{const{t}=vi();return p.jsxs(p.Fragment,{children:[p.jsx(oo,{}),p.jsxs(qe,{direction:"row",useFlexGap:!0,justifyContent:"space-between",alignItems:"center",sx:{padding:"20px 32px"},children:[p.jsx(lt,{variant:"text",onClick:e.onCancel,children:t("Annuler")}),p.jsx(lt,{variant:"primary",onClick:e.onValidate,children:t("Valider")})]})]})};function Qz(e){const t=ze(),{content:n,onChange:o,defaultIndex:r,...i}=e,[a,l]=J.useState(r??0);return p.jsx(Ar,{borderRadius:"12px",boxShadow:"0 4px 20px 0 rgba(81, 78, 78, 0.12)",padding:"24px 28px",...i,children:p.jsx(qe,{gap:"24px",children:n.map((c,u)=>p.jsxs(qe,{gap:"16px",children:[p.jsxs(qe,{gap:"16px",children:[c.header&&p.jsx(xe,{variant:"h5",children:c.header}),p.jsx(qe,{gap:"12px",children:c.options.map((d,f)=>{const h=d.id===a;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"6px",sx:{cursor:d.disabled?"default":"pointer","&:hover > span":{color:h?t.palette.primary[600]:t.custom.grey[1500]}},onClick:()=>{d.disabled||(l(d.id),o==null||o(d,c))},children:[p.jsx(xe,{variant:"body",sx:{color:d.disabled?t.custom.grey[1500]:h?t.palette.primary[600]:t.custom.grey[2800],fontWeight:h?600:500},children:d.label}),h&&p.jsx(KD,{sx:{color:t.palette.primary[600],width:"16px",height:"16px"}})]},f)})})]}),u<n.length-1&&p.jsx(oo,{color:t.custom.grey[500]})]},u))})})}const Jz=e=>{const{size:t,icon:n,body:o}=e,[r,i]=J.useState(null),a=()=>{i(null)},l=u=>{i(u.currentTarget)},c=!!r;return p.jsxs("div",{style:{position:"relative",width:"20px",height:"20px"},onMouseEnter:l,onMouseLeave:a,children:[n,p.jsx(cr,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:c,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{position:"relative",top:"10px",width:t,borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:"1px solid #E7E6E4",overflow:"visible",backgroundColor:"#FFFFFF","&:before":{content:'""',position:"absolute",top:18/2*-1,left:28,width:18,height:18,borderTop:"1px solid #E7E6E4",borderRight:"1px solid #E7E6E4",backgroundColor:"#FFFFFF",transform:"rotate(-45deg)"}}}},children:o})]})},Pl=e=>{const{size:t,icon:n,body:o,leftPosition:r}=e,[i,a]=J.useState(null),l=()=>{a(null)},c=d=>{a(d.currentTarget)},u=!!i;return p.jsxs("div",{style:{position:"relative"},onMouseEnter:c,onMouseLeave:l,children:[n,p.jsx(cr,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:u,anchorEl:i,disableAutoFocus:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{position:"relative",top:"10px",width:t,borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:"1px solid #E7E6E4",overflow:"visible",backgroundColor:"#FFFFFF","&:before":{content:'""',position:"absolute",top:18/2*-1,left:r||28,width:18,height:18,borderTop:"1px solid #E7E6E4",borderRight:"1px solid #E7E6E4",backgroundColor:"#FFFFFF",transform:"rotate(-45deg)"}}}},children:o})]})},eW=e=>{const{content:t,x:n,y:o,open:r,setOpen:i,transformOrigin:a}=e,l=ze();return p.jsx(cr,{anchorReference:"anchorPosition",anchorPosition:{top:o,left:n},open:r,onClose:()=>i(!1),transformOrigin:a||{vertical:"center",horizontal:"center"},slotProps:{paper:{sx:{minWidth:"340px",padding:"24px 20px",borderRadius:"12px",marginTop:1.5,overflow:"visible",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${l.custom.grey[500]}`}}},children:t})},tW=()=>{const e=ze(),{isSaving:t,textOptions:n,isError:o}=Ii(),r=t?Z6:o?rL:U6,i=t?{animation:"spin 1s linear infinite","@keyframes spin":{"0%":{transform:"rotate(360deg)"},"100%":{transform:"rotate(0deg)"}}}:{},a=p.jsx(r,{sx:{width:"24px",color:o?e.custom.red[600]:e.custom.grey[2e3],...i}}),l=p.jsx(ve,{padding:"12px 16px",textAlign:"center",children:p.jsx(xe,{variant:"body-medium",children:t?n.syncingMessage:o?n.errorDefaultMessage:n.savingDefaultMessage})});return p.jsx(Pl,{icon:a,body:l,size:"260px"})},nW=()=>{const{confirmExit:e,selectedPageIndex:t,setPage:n,maxPage:o,forwardLock:r,previousLock:i,textOptions:a,onClose:l,onValidate:c,onPageChange:u,showSync:d,setFormSaved:f,openConfirmDialog:h,isLoading:g}=Ii(),m=ze(),v=t===o-1&&a.finalPage?a.finalPage:a.nextPage,x=p.jsx(lt,{variant:"primary",disabled:r.isLocked||g,endIcon:p.jsx(T7,{}),onClick:()=>{if(t===o-1){f(!0),c==null||c();return}return f(!1),u==null||u(t+1,t),n(t+1)},children:v}),w=p.jsxs(ve,{padding:"12px 16px",children:[p.jsx(xe,{variant:"body-bold",children:a.warningText?a.warningText:""}),p.jsx("br",{}),p.jsx(xe,{variant:"body",children:r.isLocked&&r.message||""})]});return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(ve,{sx:{">*":{display:"flex"}},children:d&&p.jsx(tW,{})}),p.jsxs(qe,{direction:"row",gap:"20px",children:[a.previousPage&&p.jsx(lt,{sx:{minWidth:"90px"},variant:"text",disabled:i.isLocked||g,startIcon:i.isLocked||g?null:p.jsx(P7,{}),onClick:()=>{if(f(!1),t===0){u==null||u(t,t);return}return u==null||u(t-1,t),n(t-1)},children:a.previousPage}),r.isLocked?v&&p.jsx(Pl,{icon:x,body:w,size:"260px",leftPosition:130}):v&&x]}),l&&p.jsx(lt,{variant:"white-filled",onClick:e?h:l,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:m.custom.grey[400]},"&:active":{background:m.custom.grey[600]}},children:p.jsx(W6,{sx:{width:"20px",color:m.custom.grey[2800]}})})]})},oW=()=>p.jsxs(ve,{sx:{zIndex:1e3,minHeight:"96px",position:"sticky",top:"28px",border:"1px solid #E7E6E4",borderRadius:"52px",backgroundColor:"#FFFFFF",padding:"20px 28px",display:"grid",gridTemplateColumns:"1fr 50% 1fr",gridTemplateRows:"1fr",alignItems:"center"},children:[p.jsx(ve,{sx:{gridColumn:"1 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"left"},children:p.jsx(Yz,{})}),p.jsx(ve,{sx:{gridColumn:"2 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"center"},children:p.jsx(Gz,{})}),p.jsx(ve,{sx:{gridColumn:"3 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"right"},children:p.jsx(nW,{})})]}),rW=()=>{const{selectedPage:e,selectedPageIndex:t,isLoading:n}=Ii(),o=e.icon??t+1,r=e.title,i=e.subtitle;return n?p.jsx(iW,{}):p.jsx(qe,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(qe,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[r&&p.jsx(o2,{title:r,badge:o}),i&&p.jsxs(p.Fragment,{children:[p.jsx(xe,{variant:"h4",children:i}),p.jsx(oo,{})]})]}),e.content]})})},iW=()=>p.jsx(ve,{sx:{marginLeft:"auto",marginRight:"auto",width:"fit-content",marginTop:"5%",marginBottom:"5%"},children:p.jsx(xs,{})}),sW=e=>{const t=ze(),{onClose:n,open:o,confirmOptions:r}=e,i=()=>{r.onConfirm(),n()},a=()=>{r.onCancel(),n()};return p.jsxs(ja,{fullWidth:!0,maxWidth:"xs",open:o,onClose:n,sx:{".MuiPaper-rounded":{borderRadius:"12px"}},children:[p.jsxs(Uc,{sx:{borderBottom:`1px solid ${t.custom.grey[500]}`},children:[p.jsxs(ve,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"68px"},children:[p.jsx(xe,{variant:"h3",children:r.titleText}),p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:n})]}),(r==null?void 0:r.infoText)&&p.jsx(xe,{sx:{marginBlock:1.5},children:r.infoText})]}),p.jsxs(qe,{flexDirection:"column",alignItems:"center",p:3,gap:"1rem",children:[p.jsx(lt,{variant:"primary",onClick:i,children:r.confirmText}),p.jsx(lt,{onClick:a,children:r.cancelText})]})]})},aW=()=>{const{confirmExit:e,formSaved:t}=Ii(),n=o=>{o.preventDefault()};return J.useEffect(()=>{if(e)return window.removeEventListener("beforeunload",n),t===!1&&window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}},[t,e]),p.jsxs(p.Fragment,{children:[p.jsx(oW,{}),p.jsx(rW,{})]})},lW=e=>{const[t,n]=J.useState(!1);return p.jsxs(O7,{...e,openConfirmDialog:()=>n(!0),children:[p.jsx(aW,{}),e.confirmExit&&p.jsx(sW,{open:t,onClose:()=>n(!1),confirmOptions:e.confirmOptions})]})};/**
|
|
374
|
+
`)):Array.isArray(n)?e.push.apply(e,n):Ct(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var o=[].concat(t),r=o.length,i=e.font,a=0,l;for(e.font=n.string,l=0;l<r;++l)a=Math.max(e.measureText(o[l]).width,a);return e.font=i,{height:r*n.lineHeight,width:a}},bound:function(e,t,n){return Math.max(e,Math.min(t,n))},arrayDiff:function(e,t){var n=e.slice(),o=[],r,i,a,l;for(r=0,a=t.length;r<a;++r)l=t[r],i=n.indexOf(l),i===-1?o.push([l,1]):n.splice(i,1);for(r=0,a=n.length;r<a;++r)o.push([n[r],-1]);return o},rasterize:function(e){return Math.round(e*l7)/l7}};function e2(e,t){var n=t.x,o=t.y;if(n===null)return{x:0,y:-1};if(o===null)return{x:1,y:0};var r=e.x-n,i=e.y-o,a=Math.sqrt(r*r+i*i);return{x:a?r/a:0,y:a?i/a:-1}}function zH(e,t,n,o,r){switch(r){case"center":n=o=0;break;case"bottom":n=0,o=1;break;case"right":n=1,o=0;break;case"left":n=-1,o=0;break;case"top":n=0,o=-1;break;case"start":n=-n,o=-o;break;case"end":break;default:r*=Math.PI/180,n=Math.cos(r),o=Math.sin(r);break}return{x:e,y:t,vx:n,vy:o}}var WH=0,c7=1,u7=2,d7=4,p7=8;function id(e,t,n){var o=WH;return e<n.left?o|=c7:e>n.right&&(o|=u7),t<n.top?o|=p7:t>n.bottom&&(o|=d7),o}function UH(e,t){for(var n=e.x0,o=e.y0,r=e.x1,i=e.y1,a=id(n,o,t),l=id(r,i,t),c,u,d;!(!(a|l)||a&l);)c=a||l,c&p7?(u=n+(r-n)*(t.top-o)/(i-o),d=t.top):c&d7?(u=n+(r-n)*(t.bottom-o)/(i-o),d=t.bottom):c&u7?(d=o+(i-o)*(t.right-n)/(r-n),u=t.right):c&c7&&(d=o+(i-o)*(t.left-n)/(r-n),u=t.left),c===a?(n=u,o=d,a=id(n,o,t)):(r=u,i=d,l=id(r,i,t));return{x0:n,x1:r,y0:o,y1:i}}function sd(e,t){var n=t.anchor,o=e,r,i;return t.clamp&&(o=UH(o,t.area)),n==="start"?(r=o.x0,i=o.y0):n==="end"?(r=o.x1,i=o.y1):(r=(o.x0+o.x1)/2,i=(o.y0+o.y1)/2),zH(r,i,e.vx,e.vy,t.align)}var ad={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,o=Math.cos(n),r=Math.sin(n),i=e.innerRadius,a=e.outerRadius;return sd({x0:e.x+o*i,y0:e.y+r*i,x1:e.x+o*a,y1:e.y+r*a,vx:o,vy:r},t)},point:function(e,t){var n=e2(e,t.origin),o=n.x*e.options.radius,r=n.y*e.options.radius;return sd({x0:e.x-o,y0:e.y-r,x1:e.x+o,y1:e.y+r,vx:n.x,vy:n.y},t)},bar:function(e,t){var n=e2(e,t.origin),o=e.x,r=e.y,i=0,a=0;return e.horizontal?(o=Math.min(e.x,e.base),i=Math.abs(e.base-e.x)):(r=Math.min(e.y,e.base),a=Math.abs(e.base-e.y)),sd({x0:o,y0:r+a,x1:o+i,y1:r,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=e2(e,t.origin);return sd({x0:e.x,y0:e.y,x1:e.x+(e.width||0),y1:e.y+(e.height||0),vx:n.x,vy:n.y},t)}},Cr=wl.rasterize;function ZH(e){var t=e.borderWidth||0,n=e.padding,o=e.size.height,r=e.size.width,i=-r/2,a=-o/2;return{frame:{x:i-n.left-t,y:a-n.top-t,w:r+n.width+t*2,h:o+n.height+t*2},text:{x:i,y:a,w:r,h:o}}}function qH(e,t){var n=t.chart.getDatasetMeta(t.datasetIndex).vScale;if(!n)return null;if(n.xCenter!==void 0&&n.yCenter!==void 0)return{x:n.xCenter,y:n.yCenter};var o=n.getBasePixel();return e.horizontal?{x:o,y:null}:{x:null,y:o}}function GH(e){return e instanceof Ei?ad.arc:e instanceof gl?ad.point:e instanceof ml?ad.bar:ad.fallback}function YH(e,t,n,o,r,i){var a=Math.PI/2;if(i){var l=Math.min(i,r/2,o/2),c=t+l,u=n+l,d=t+o-l,f=n+r-l;e.moveTo(t,u),c<d&&u<f?(e.arc(c,u,l,-Math.PI,-a),e.arc(d,u,l,-a,0),e.arc(d,f,l,0,a),e.arc(c,f,l,a,Math.PI)):c<d?(e.moveTo(c,n),e.arc(d,u,l,-a,a),e.arc(c,u,l,a,Math.PI+a)):u<f?(e.arc(c,u,l,-Math.PI,0),e.arc(c,f,l,0,Math.PI)):e.arc(c,u,l,-Math.PI,Math.PI),e.closePath(),e.moveTo(t,n)}else e.rect(t,n,o,r)}function KH(e,t,n){var o=n.backgroundColor,r=n.borderColor,i=n.borderWidth;!o&&(!r||!i)||(e.beginPath(),YH(e,Cr(t.x)+i/2,Cr(t.y)+i/2,Cr(t.w)-i,Cr(t.h)-i,n.borderRadius),e.closePath(),o&&(e.fillStyle=o,e.fill()),r&&i&&(e.strokeStyle=r,e.lineWidth=i,e.lineJoin="miter",e.stroke()))}function XH(e,t,n){var o=n.lineHeight,r=e.w,i=e.x,a=e.y+o/2;return t==="center"?i+=r/2:(t==="end"||t==="right")&&(i+=r),{h:o,w:r,x:i,y:a}}function QH(e,t,n){var o=e.shadowBlur,r=n.stroked,i=Cr(n.x),a=Cr(n.y),l=Cr(n.w);r&&e.strokeText(t,i,a,l),n.filled&&(o&&r&&(e.shadowBlur=0),e.fillText(t,i,a,l),o&&r&&(e.shadowBlur=o))}function JH(e,t,n,o){var r=o.textAlign,i=o.color,a=!!i,l=o.font,c=t.length,u=o.textStrokeColor,d=o.textStrokeWidth,f=u&&d,h;if(!(!c||!a&&!f))for(n=XH(n,r,l),e.font=l.string,e.textAlign=r,e.textBaseline="middle",e.shadowBlur=o.textShadowBlur,e.shadowColor=o.textShadowColor,a&&(e.fillStyle=i),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),h=0,c=t.length;h<c;++h)QH(e,t[h],{stroked:f,filled:a,w:n.w,x:n.x,y:n.y+n.h*h})}var f7=function(e,t,n,o){var r=this;r._config=e,r._index=o,r._model=null,r._rects=null,r._ctx=t,r._el=n};Yo(f7.prototype,{_modelize:function(e,t,n,o){var r=this,i=r._index,a=hn(Kt([n.font,{}],o,i)),l=Kt([n.color,tn.color],o,i);return{align:Kt([n.align,"center"],o,i),anchor:Kt([n.anchor,"center"],o,i),area:o.chart.chartArea,backgroundColor:Kt([n.backgroundColor,null],o,i),borderColor:Kt([n.borderColor,null],o,i),borderRadius:Kt([n.borderRadius,0],o,i),borderWidth:Kt([n.borderWidth,0],o,i),clamp:Kt([n.clamp,!1],o,i),clip:Kt([n.clip,!1],o,i),color:l,display:e,font:a,lines:t,offset:Kt([n.offset,4],o,i),opacity:Kt([n.opacity,1],o,i),origin:qH(r._el,o),padding:Rn(Kt([n.padding,4],o,i)),positioner:GH(r._el),rotation:Kt([n.rotation,0],o,i)*(Math.PI/180),size:wl.textSize(r._ctx,t,a),textAlign:Kt([n.textAlign,"start"],o,i),textShadowBlur:Kt([n.textShadowBlur,0],o,i),textShadowColor:Kt([n.textShadowColor,l],o,i),textStrokeColor:Kt([n.textStrokeColor,l],o,i),textStrokeWidth:Kt([n.textStrokeWidth,0],o,i)}},update:function(e){var t=this,n=null,o=null,r=t._index,i=t._config,a,l,c,u=Kt([i.display,!0],e,r);u&&(a=e.dataset.data[r],l=ct(Wt(i.formatter,[a,e]),a),c=Ct(l)?[]:wl.toTextLines(l),c.length&&(n=t._modelize(u,c,i,e),o=ZH(n))),t._model=n,t._rects=o},geometry:function(){return this._rects?this._rects.frame:{}},rotation:function(){return this._model?this._model.rotation:0},visible:function(){return this._model&&this._model.opacity},model:function(){return this._model},draw:function(e,t){var n=this,o=e.ctx,r=n._model,i=n._rects,a;this.visible()&&(o.save(),r.clip&&(a=r.area,o.beginPath(),o.rect(a.left,a.top,a.right-a.left,a.bottom-a.top),o.clip()),o.globalAlpha=wl.bound(0,r.opacity,1),o.translate(Cr(t.x),Cr(t.y)),o.rotate(r.rotation),KH(o,i.frame,r),JH(o,r.lines,i.text,r),o.restore())}});var ez=Number.MIN_SAFE_INTEGER||-9007199254740991,tz=Number.MAX_SAFE_INTEGER||9007199254740991;function Sl(e,t,n){var o=Math.cos(n),r=Math.sin(n),i=t.x,a=t.y;return{x:i+o*(e.x-i)-r*(e.y-a),y:a+r*(e.x-i)+o*(e.y-a)}}function h7(e,t){var n=tz,o=ez,r=t.origin,i,a,l,c,u;for(i=0;i<e.length;++i)a=e[i],l=a.x-r.x,c=a.y-r.y,u=t.vx*l+t.vy*c,n=Math.min(n,u),o=Math.max(o,u);return{min:n,max:o}}function ld(e,t){var n=t.x-e.x,o=t.y-e.y,r=Math.sqrt(n*n+o*o);return{vx:(t.x-e.x)/r,vy:(t.y-e.y)/r,origin:e,ln:r}}var g7=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};Yo(g7.prototype,{center:function(){var e=this._rect;return{x:e.x+e.w/2,y:e.y+e.h/2}},update:function(e,t,n){this._rotation=n,this._rect={x:t.x+e.x,y:t.y+e.y,w:t.w,h:t.h}},contains:function(e){var t=this,n=1,o=t._rect;return e=Sl(e,t.center(),-t._rotation),!(e.x<o.x-n||e.y<o.y-n||e.x>o.x+o.w+n*2||e.y>o.y+o.h+n*2)},intersects:function(e){var t=this._points(),n=e._points(),o=[ld(t[0],t[1]),ld(t[0],t[3])],r,i,a;for(this._rotation!==e._rotation&&o.push(ld(n[0],n[1]),ld(n[0],n[3])),r=0;r<o.length;++r)if(i=h7(t,o[r]),a=h7(n,o[r]),i.max<a.min||a.max<i.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,o=e.center();return[Sl({x:t.x,y:t.y},o,n),Sl({x:t.x+t.w,y:t.y},o,n),Sl({x:t.x+t.w,y:t.y+t.h},o,n),Sl({x:t.x,y:t.y+t.h},o,n)]}});function m7(e,t,n){var o=t.positioner(e,t),r=o.vx,i=o.vy;if(!r&&!i)return{x:o.x,y:o.y};var a=n.w,l=n.h,c=t.rotation,u=Math.abs(a/2*Math.cos(c))+Math.abs(l/2*Math.sin(c)),d=Math.abs(a/2*Math.sin(c))+Math.abs(l/2*Math.cos(c)),f=1/Math.max(Math.abs(r),Math.abs(i));return u*=r*f,d*=i*f,u+=t.offset*r,d+=t.offset*i,{x:o.x+u,y:o.y+d}}function nz(e,t){var n,o,r,i;for(n=e.length-1;n>=0;--n)for(r=e[n].$layout,o=n-1;o>=0&&r._visible;--o)i=e[o].$layout,i._visible&&r._box.intersects(i._box)&&t(r,i);return e}function oz(e){var t,n,o,r,i,a,l;for(t=0,n=e.length;t<n;++t)o=e[t],r=o.$layout,r._visible&&(l=new Proxy(o._el,{get:(c,u)=>c.getProps([u],!0)[u]}),i=o.geometry(),a=m7(l,o.model(),i),r._box.update(a,i,o.rotation()));return nz(e,function(c,u){var d=c._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(c._visible=!1)})}var Tl={prepare:function(e){var t=[],n,o,r,i,a;for(n=0,r=e.length;n<r;++n)for(o=0,i=e[n].length;o<i;++o)a=e[n][o],t.push(a),a.$layout={_box:new g7,_hidable:!1,_visible:!0,_set:n,_idx:a._index};return t.sort(function(l,c){var u=l.$layout,d=c.$layout;return u._idx===d._idx?d._set-u._set:d._idx-u._idx}),this.update(t),t},update:function(e){var t=!1,n,o,r,i,a;for(n=0,o=e.length;n<o;++n)r=e[n],i=r.model(),a=r.$layout,a._hidable=i&&i.display==="auto",a._visible=r.visible(),t|=a._hidable;t&&oz(e)},lookup:function(e,t){var n,o;for(n=e.length-1;n>=0;--n)if(o=e[n].$layout,o&&o._visible&&o._box.contains(t))return e[n];return null},draw:function(e,t){var n,o,r,i,a,l;for(n=0,o=t.length;n<o;++n)r=t[n],i=r.$layout,i._visible&&(a=r.geometry(),l=m7(r._el,r.model(),a),i._box.update(l,a,r.rotation()),r.draw(e,l))}},rz=function(e){if(Ct(e))return null;var t=e,n,o,r;if(Tt(e))if(!Ct(e.label))t=e.label;else if(!Ct(e.r))t=e.r;else for(t="",n=Object.keys(e),r=0,o=n.length;r<o;++r)t+=(r!==0?", ":"")+n[r]+": "+e[n[r]];return""+t},iz={align:"center",anchor:"center",backgroundColor:null,borderColor:null,borderRadius:0,borderWidth:0,clamp:!1,clip:!1,color:void 0,display:!0,font:{family:void 0,lineHeight:1.2,size:void 0,style:void 0,weight:null},formatter:rz,labels:void 0,listeners:{},offset:4,opacity:1,padding:{top:4,right:4,bottom:4,left:4},rotation:0,textAlign:"start",textStrokeColor:void 0,textStrokeWidth:0,textShadowBlur:0,textShadowColor:void 0},Gn="$datalabels",b7="$default";function sz(e,t){var n=e.datalabels,o={},r=[],i,a;return n===!1?null:(n===!0&&(n={}),t=Yo({},[t,n]),i=t.labels||{},a=Object.keys(i),delete t.labels,a.length?a.forEach(function(l){i[l]&&r.push(Yo({},[t,i[l],{_key:l}]))}):r.push(t),o=r.reduce(function(l,c){return $t(c.listeners||{},function(u,d){l[d]=l[d]||{},l[d][c._key||b7]=u}),delete c.listeners,l},{}),{labels:r,listeners:o})}function t2(e,t,n,o){if(t){var r=n.$context,i=n.$groups,a;t[i._set]&&(a=t[i._set][i._key],a&&Wt(a,[r,o])===!0&&(e[Gn]._dirty=!0,n.update(r)))}}function az(e,t,n,o,r){var i,a;!n&&!o||(n?o?n!==o&&(a=i=!0):a=!0:i=!0,a&&t2(e,t.leave,n,r),i&&t2(e,t.enter,o,r))}function lz(e,t){var n=e[Gn],o=n._listeners,r,i;if(!(!o.enter&&!o.leave)){if(t.type==="mousemove")i=Tl.lookup(n._labels,t);else if(t.type!=="mouseout")return;r=n._hovered,n._hovered=i,az(e,o,r,i,t)}}function cz(e,t){var n=e[Gn],o=n._listeners.click,r=o&&Tl.lookup(n._labels,t);r&&t2(e,o,r,t)}var uz={id:"datalabels",defaults:iz,beforeInit:function(e){e[Gn]={_actives:[]}},beforeUpdate:function(e){var t=e[Gn];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var o=t.index,r=e[Gn],i=r._datasets[o]=[],a=e.isDatasetVisible(o),l=e.data.datasets[o],c=sz(l,n),u=t.meta.data||[],d=e.ctx,f,h,g,m,b,v,x,w;for(d.save(),f=0,g=u.length;f<g;++f)if(x=u[f],x[Gn]=[],a&&x&&e.getDataVisibility(f)&&!x.skip)for(h=0,m=c.labels.length;h<m;++h)b=c.labels[h],v=b._key,w=new f7(b,d,x,f),w.$groups={_set:o,_key:v||b7},w.$context={active:!1,chart:e,dataIndex:f,dataset:l,datasetIndex:o},w.update(w.$context),x[Gn].push(w),i.push(w);d.restore(),Yo(r._listeners,c.listeners,{merger:function(T,P,C){P[T]=P[T]||{},P[T][t.index]=C[T],r._listened=!0}})},afterUpdate:function(e){e[Gn]._labels=Tl.prepare(e[Gn]._datasets)},afterDatasetsDraw:function(e){Tl.draw(e,e[Gn]._labels)},beforeEvent:function(e,t){if(e[Gn]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":lz(e,n);break;case"click":cz(e,n);break}}},afterEvent:function(e){var t=e[Gn],n=t._actives,o=t._actives=e.getActiveElements(),r=wl.arrayDiff(n,o),i,a,l,c,u,d,f;for(i=0,a=r.length;i<a;++i)if(u=r[i],u[1])for(f=u[0].element[Gn]||[],l=0,c=f.length;l<c;++l)d=f[l],d.$context.active=u[1]===1,d.update(d.$context);(t._dirty||r.length)&&(Tl.update(t._labels),e.render()),delete t._dirty}};const dz=e=>{const{values:t,color:n,theme:o,updateCurrentSelectedPoint:r,...i}=e;return{...i,data:pz(t,n),options:fz(o,r),plugins:[gz]}},pz=(e,t)=>({datasets:[{data:e,backgroundColor:t,pointStyle:"circle",pointRadius:8,pointHoverRadius:9}],labels:Array.from(e.map(n=>n.label))}),fz=(e,t)=>({plugins:{datalabels:{color:"#403d58",formatter:function(o){return o.label},align:"right",padding:{left:25},font:{weight:600,size:12,family:e.typography.fontFamily}},legend:{display:!1,usePointStyle:!0},tooltip:{enabled:!1,external:hz}},scales:{x:{beginAtZero:!0,grace:"15%",linear:!0,border:{dash:[5,5]}},y:{beginAtZero:!0,linear:!0,grace:"20%",border:{dash:[5,5]}}},layout:{padding:{left:25,right:25,top:15,bottom:15}},onHover:(o,r)=>{if(o.type==="click"){if(r.length){t(r[0].index,o.x,o.y);return}t(null,null,null)}}}),v7={opacity:"0",position:"absolute",backgroundColor:"#393A36",color:"#fff",borderRadius:"4px",padding:"6px",pointerEvents:"none",textAlign:"center",fontSize:"10px",fontWeight:"600",minWidth:"30px"},hz=e=>{const{chart:t,tooltip:n}=e;let o=document.getElementById("chartjs-tooltip-x");o||(o=document.createElement("div"),o.id="chartjs-tooltip-x",Object.assign(o.style,v7),document.body.appendChild(o));let r=document.getElementById("chartjs-tooltip-y");if(r||(r=document.createElement("div"),r.id="chartjs-tooltip-y",Object.assign(r.style,v7),document.body.appendChild(r)),n.opacity===0){o.style.opacity="0",r.style.opacity="0";return}if(n.dataPoints){const b=n.dataPoints[0],{x:v,y:x}=b.raw;o.textContent=`${v}`,r.textContent=`${x}`}const i=t.canvas.getBoundingClientRect(),a=t.scales.x,c=t.scales.y.bottom+i.top+window.scrollY,u=a.left+i.left+window.scrollX,d=i.left+window.scrollX+n.caretX-o.offsetWidth/2,f=c;o.style.left=`${d}px`,o.style.top=`${f}px`,o.style.opacity="1";const h=u-r.offsetWidth,g=i.top+window.scrollY+n.caretY-r.offsetHeight/2;r.style.left=`${h}px`,r.style.top=`${g}px`,r.style.opacity="1"},gz={id:"crosshair",defaults:{width:1,color:"#000000",dash:[],tooltipBackground:"#f5f5f5",tooltipTextColor:"#000000",tooltipFontSize:10,tooltipPadding:6,tooltipRadius:4},afterInit:e=>{e.crosshair={x:0,y:0,draw:!1,xValue:null,yValue:null}},afterEvent:(e,t)=>{const{inChartArea:n}=t,o=e.getElementsAtEventForMode(t.event,"nearest",{intersect:!0},!1);if(o.length){const r=o[0].index,i=e.data.datasets[0].data[r],{x:a,y:l}=o[0].element;e.crosshair={x:a,y:l,draw:n,xValue:i.x,yValue:i.y}}else e.crosshair.draw=!1;e.draw()},beforeDatasetsDraw:e=>{var u,d,f,h,g,m,b,v;const{ctx:t,crosshair:n}=e;if(!n)return;const{bottom:o,left:r}=e.chartArea,{x:i,y:a,draw:l}=n;if(!l)return;t.save(),t.beginPath(),t.lineWidth=((d=(u=e.options.plugins)==null?void 0:u.crosshair)==null?void 0:d.width)??1,t.strokeStyle=((h=(f=e.options.plugins)==null?void 0:f.crosshair)==null?void 0:h.color)??"#000000";const c=((m=(g=e.options.plugins)==null?void 0:g.crosshair)==null?void 0:m.dash)??[];t.setLineDash(c.filter(x=>x!==void 0)),t.moveTo(i,a),t.lineTo(i,o),t.moveTo(r,a),t.lineTo(i,a),t.stroke(),t.font=`${((v=(b=e.options.plugins)==null?void 0:b.crosshair)==null?void 0:v.tooltipFontSize)??10}px ${t.font.split(" ").slice(-1)}`,t.textAlign="center",t.textBaseline="middle",t.restore()}};hl.register(...qN,uz);const mz=e=>{const t=(i,a,l)=>{var d;if(i===null||!((d=e.values)!=null&&d[i])||a===null||l===null){e.onPointSelection(null);return}const u={point:e.values[i],absoluteCoordinate:{x:a,y:l}};e.onPointSelection(u)},n="#F6A500",o=ze(),r=dz({...e,color:o.palette.primary[500]??n,theme:o,updateCurrentSelectedPoint:t});return p.jsxs(ve,{sx:{backgroundColor:o.custom.grey[200],borderRadius:"8px",border:`1px solid ${o.custom.grey[500]}`,padding:"12px"},children:[e.y,p.jsx(JN,{...r}),p.jsx(ve,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.x})]})},x7=e=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"white"}),y.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,stroke:"#D1CFCE",strokeWidth:2})),y7=e=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("rect",{width:20,height:20,rx:4,fill:"url(#paint0_linear_2034_7850)"}),y.createElement("path",{d:"M8.32244 13.9335L4.56689 10.178L5.36133 9.38351L8.32244 12.3446L14.628 6.03906L15.4224 6.83351L8.32244 13.9335Z",fill:"white"}),y.createElement("defs",null,y.createElement("linearGradient",{id:"paint0_linear_2034_7850",x1:7.58928,y1:755124e-13,x2:7.58928,y2:20,gradientUnits:"userSpaceOnUse"},y.createElement("stop",{stopColor:"#484945"}),y.createElement("stop",{offset:1,stopColor:"#2A2B27"})))),bz=W(qo)(()=>({":hover":{background:Oe[400]}})),vz=e=>{const{values:t,...n}=e,{onChange:o,...r}=n,i=Object.entries(t);return p.jsx(vf,{children:i.map(([a,l],c)=>p.jsx(ys,{control:p.jsx(bz,{...r,checkedIcon:p.jsx(y7,{}),icon:p.jsx(x7,{}),disableRipple:!0,onChange:(u,d)=>{const f={};f[a]={name:l.name,state:d},o(f)}}),sx:{gap:"1rem"},label:l.name,checked:l.state},`${a}-${c}`))})},xz=(e,t,n)=>Object.entries(t).flatMap(r=>{const[i,a]=r;if(a.state===!1)return[];const l=Number(i),c=e.find(u=>u.id===l);return c?[c]:[n({id:l,name:a.name})]}),yz=(e,t)=>{const n={};return e.reduce((r,i)=>{const a=t.some(l=>l.id===i.id);return r[i.id]={name:i.name,state:a},r},n)},Cz=W(qo)(()=>({":hover":{background:Oe[400]}})),wz=e=>{const{values:t,onChange:n,FormGroupProps:o,FormControlLabelProps:r,CheckboxProps:i}=e,a=Object.entries(t);return p.jsx(vf,{...o,children:a.map(([l,c],u)=>p.jsx(ys,{sx:{gap:"1rem"},checked:c.state,...r,label:c.name,control:p.jsx(Cz,{checkedIcon:p.jsx(y7,{}),icon:p.jsx(x7,{}),disableRipple:!0,...i,onChange:(d,f)=>{const h={...t};h[l]={...h[l],name:c.name,state:f},n(h)}})},`${l}-${u}`))})},Sz=e=>{const{values:t,selectedItems:n,onChange:o,getId:r=u=>u.id,getName:i=u=>u.name,...a}=e,l=(n==null?void 0:n.map(u=>r(u)))??[],c=t.reduce((u,d)=>{const f=r(d),h=l.includes(f),g=n===void 0?!1:h;return u[f]={name:i(d),state:g,rawData:d},u},{});return p.jsx(wz,{values:c,onChange:u=>{const d=Object.values(u).flatMap(f=>f.state===!1?[]:f.rawData);return o(d)},...a})},Tz=e=>{const{percentageDifference:t,comparedTo:n,comparisonText:o,iconName:r,colors:i,disableText:a}=e;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"2px",flexWrap:"wrap",className:"comparison-block-wrapper",children:[p.jsxs(ve,{sx:{border:`1px solid ${i.primaryColor}`,background:i.secondaryColor,width:"fit-content",padding:"3px 7px",display:"flex",borderRadius:"20px",alignItems:"center",gap:"2px",color:i.primaryColor,marginRight:"6px"},children:[p.jsx(Mn,{icon:r,size:1}),p.jsx(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",children:p.jsx(xe,{component:"span",variant:"h6",children:t})})]}),!a&&p.jsxs(p.Fragment,{children:[o!==void 0&&(n==null?void 0:n.label)!==void 0&&p.jsxs(xe,{component:"span",variant:"small",children:[o," ",p.jsx(xe,{component:"span",variant:"small",fontWeight:600,children:n.label})]}),(n==null?void 0:n.value)!==void 0&&(n==null?void 0:n.unit)!==void 0&&p.jsxs(xe,{component:"div",variant:"h6",children:["(",n.value,p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})]})},n2={POSITIVE:{primaryColor:Co[500],secondaryColor:Co[100]},NEGATIVE:{primaryColor:wn[500],secondaryColor:wn[100]},NEUTRAL:{primaryColor:Ff.main,secondaryColor:Ff[100]}},Pz=(e,t,n)=>{const o=n2.POSITIVE,r=n2.NEGATIVE;if(e===t)return{color:n2.NEUTRAL,icon:"equal"};const i=e>t,a=i?"arrowUpRight":"arrowDownRight";return n==="increase"?{color:i?o:r,icon:a}:{color:i?r:o,icon:a}},Mz=e=>{const{percentageDifference:t,comparedTo:n,comparisonText:o,iconName:r,colors:i}=e;return p.jsxs(p.Fragment,{children:[p.jsxs(ve,{display:"flex",alignItems:"center",gap:"8px",mb:"4px",children:[p.jsx(qa,{icon:r,size:3,boxProps:{sx:{backgroundColor:i.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h2",children:t})]}),o!==void 0&&(n==null?void 0:n.label)!==void 0&&p.jsxs(xe,{component:"span",variant:"body",children:[o," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),(n==null?void 0:n.value)!==void 0&&(n==null?void 0:n.unit)!==void 0&&p.jsxs(xe,{component:"div",variant:"h4",fontSize:"0.875rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})},Rz=e=>{const{percentageDifference:t,comparedTo:n,iconName:o,colors:r,comparisonText:i}=e;return p.jsxs(p.Fragment,{children:[p.jsxs(ve,{display:"flex",alignItems:"center",gap:"8px",children:[p.jsx(qa,{icon:o,size:.5,boxProps:{sx:{backgroundColor:r.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h4",children:t})]}),i!==void 0&&(n==null?void 0:n.label)!==void 0&&p.jsxs(xe,{component:"span",variant:"small",children:[i," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),(n==null?void 0:n.value)!==void 0&&(n==null?void 0:n.unit)!==void 0&&p.jsxs(xe,{component:"div",fontWeight:700,fontSize:"0.625rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})},Oz=e=>{const{percentageDifference:t,comparedTo:n,iconName:o,colors:r,comparisonText:i}=e;return p.jsx(p.Fragment,{children:p.jsxs(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",mb:"4px",flexWrap:"wrap",children:[p.jsx(qa,{icon:o,size:3,boxProps:{sx:{backgroundColor:r.primaryColor,borderRadius:"32px",color:"#fff"}}}),p.jsx(xe,{component:"span",variant:"h2",children:t}),i!==void 0&&(n==null?void 0:n.label)!==void 0&&p.jsxs(xe,{component:"span",variant:"body",children:[i," ",p.jsx(xe,{component:"span",variant:"body",fontWeight:600,children:n.label})]}),(n==null?void 0:n.value)!==void 0&&(n==null?void 0:n.unit)!==void 0&&p.jsxs(xe,{component:"div",fontWeight:700,fontSize:"0.875rem",children:["(",n.value," ",p.jsx(xe,{color:"#A3A2A0",component:"span",fontSize:"0.625rem",children:n.unit}),")"]})]})})},Ez=e=>{const{percentageDifference:t,iconName:n,colors:o}=e;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"2px",className:"comparison-block-wrapper",children:[p.jsx(ve,{sx:{border:`1px solid ${o.primaryColor}`,background:o.secondaryColor,width:"fit-content",padding:"1px",display:"flex",borderRadius:"20px",alignItems:"center",color:o.primaryColor,marginRight:"2px"},children:p.jsx(Mn,{icon:n,size:.1})}),p.jsx(ve,{display:"flex",alignItems:"center",flexDirection:"row",gap:"8px",children:p.jsx(xe,{color:o.primaryColor,component:"span",variant:"h6",children:t})})]})},kz=e=>{var d,f,h,g,m,b;const{currentValue:t,comparedTo:n,improvement:o,comparisonText:r="par rapport à",layout:i={direction:"vertical",size:"L"},disableText:a=!1}=e;if(n===void 0||n.value===void 0)throw new Error("comparedTo.value is required for ComparisonBlock");const l=Pz(t,n.value,o),u=`${n.value>0?Math.round(Math.abs(100-t/n.value*100)):"N/A"} %`;if(i.direction==="vertical")return p.jsxs(ve,{sx:{borderRadius:"12px",background:l.color.secondaryColor,width:"fit-content",padding:((d=e.layout)==null?void 0:d.size)==="M"?"8px":"16px"},className:"comparison-block-wrapper",children:[((f=e.layout)==null?void 0:f.size)==="L"&&p.jsx(Mz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color}),((h=e.layout)==null?void 0:h.size)==="M"&&p.jsx(Rz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color})]});if(i.direction==="horizontal"){if(((g=e.layout)==null?void 0:g.size)==="L")return p.jsx(ve,{sx:{borderRadius:"12px",background:l.color.secondaryColor,width:"fit-content",padding:"24px 16px"},className:"comparison-block-wrapper",children:p.jsx(Oz,{percentageDifference:u,comparisonText:r,comparedTo:n,iconName:l.icon,colors:l.color})});if(((m=e.layout)==null?void 0:m.size)==="M")return p.jsx(Tz,{comparisonText:r,percentageDifference:u,comparedTo:n,iconName:l.icon,colors:l.color,disableText:a})}if(((b=e.layout)==null?void 0:b.size)==="S")return p.jsx(Ez,{percentageDifference:u,iconName:l.icon,colors:l.color})},Iz=e=>{const{value:t,maxLength:n,...o}=e,r=t.map((d,f)=>t.slice(0,f+1).reduce((h,g)=>{const m=h.length+g.length;if(m>n){const b=n-m,v=[...h.words,g.slice(0,b)].filter(Boolean);return{length:m,words:v,rest:t.length-v.length}}return{...h,length:m,words:[...h.words,g]}},{length:0,words:[],rest:0})),i=r[r.length-1],l=t[t.length-1].length===i.words[i.words.length-1].length?"":"…",c=i.words.join(", "),u=i.rest>0?`${c}… +${i.rest}`:c+l;return p.jsx(xe,{...o,children:u})},_z=e=>{const{value:t,maxLength:n,separator:o=",",...r}=e;if(n===0)return p.jsx(xe,{...r,children:""});const i=t.join("").length;if(n>i)return p.jsx(xe,{...r,children:t.join(o)});let a=0;const l=t.reduce((x,w)=>{const T=a+w.length,P={low:a,high:T};return a=T,x.push(P),x},[]),c=l.findIndex(x=>x.low<n&&n<=x.high),u=c+1,d=l.length-u,h=l[c].high===n?"":"…",g=u*o.length,m=t.join(o).slice(0,n-1+g),b=d?`+${d}`:"",v=`${m}${h} ${b}`;return p.jsx(xe,{...r,children:v})},jz=e=>{const{setOpen:t,options:n,onValidate:o,onCancel:r,canValidate:i=!0,confirmAction:a,cancelText:l,validateText:c,...u}=e,[d,f]=J.useState(!1),h=()=>t(!1),g=()=>{f(!1)},m=()=>{r&&r(),h()},b=()=>{if(!a){o&&o(),h();return}d?(f(!1),o&&o(),h()):f(!0)};return p.jsxs(ja,{onClose:m,...u,fullWidth:!0,maxWidth:"md",scroll:"body",children:[p.jsxs(Uc,{sx:w7,children:[n.title,p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:m})]}),p.jsx(ve,{sx:{width:"100%"},children:n.content}),p.jsx(C7,{onCancelAction:m,onConfirmAction:b,canValidate:i,cancelText:l,validateText:c}),a&&p.jsx(Dz,{openConfirmAction:d,onCancel:g,onValidate:b,confirmAction:a,cancelText:l,validateText:c})]})},Dz=e=>{const{confirmAction:t,onCancel:n,onValidate:o,openConfirmAction:r,cancelText:i,validateText:a}=e;return p.jsxs(ja,{open:r,onClose:n,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Oe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},children:[p.jsxs(Uc,{sx:w7,children:[t.title,p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:n})]}),p.jsx(ve,{sx:{padding:"32px",width:"100%"},children:t.content}),p.jsx(C7,{onCancelAction:n,onConfirmAction:o,cancelText:t.cancelText??i,validateText:t.validateText??a})]})},C7=e=>{const{onCancelAction:t,onConfirmAction:n,canValidate:o=!0,cancelText:r,validateText:i}=e;return p.jsxs(bf,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${Oe[500]}`,minHeight:"68px",paddingInline:"1rem",padding:"28px 32px 32px 32px"},children:[p.jsx(lt,{variant:"text",onClick:t,children:r}),p.jsx(lt,{variant:"primary",onClick:n,disabled:!o,children:i})]})},w7={display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${Oe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},Lz=W(Oa)(({theme:e})=>({fontFamily:e.typography.fontFamily,...e.typography.body})),cd=J.forwardRef(function(e){const t=ze(),{sx:n,error:o,...r}=e;return p.jsx(Lz,{...r,sx:{color:o?t.custom.red[600]:t.custom.grey[2800],border:o?`1px solid ${t.custom.red[600]}`:`1px solid ${t.custom.grey[1400]}`,backgroundColor:o?t.custom.red[100]:"inherit",borderRadius:"16px",paddingInline:"20px",...n}})}),Az=e=>{const{title:t,unit:n,placeholder:o,value:r,description:i,error:a,required:l,...c}=e,u=l?"*":"",d=ze(),f=J.useRef(!1),h=f.current&&a,[g,m]=J.useState(!1),[b,v]=J.useState(!1),[x,w]=J.useState(!1);J.useEffect(()=>{const M=T(P,e.setMinMaxError);m(M);const O=T(C,e.setMinError);v(O);const E=T(R,e.setMaxError);w(E)},[r]);const T=(M,O)=>{const E=M();return O!==void 0&&O(E),E},P=()=>{if(e.min===void 0&&e.max===void 0||r===void 0||r==="")return!1;const M=Number(r);return!(e.min!==void 0&&M>e.min&&e.max!==void 0&&M<e.max)},C=()=>e.min===void 0||r===void 0||r===""?!1:!(e.min<Number(r)&&e.max===void 0),R=()=>e.max===void 0||r===void 0||r===""?!1:!(e.max>Number(r)&&e.min===void 0);return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(xe,{variant:"h5",children:`${t}${u} :`}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[p.jsx(cd,{...c,type:"number",style:{minWidth:"150px",width:"10%",borderColor:h?d.palette.error.main:"inherit",backgroundColor:h?d.palette.error.light:"inherit"},placeholder:o,value:r,onChange:M=>{f.current=!0,c.onChange&&c.onChange(M)}}),p.jsx(xe,{variant:"body",children:n})]}),(!!e.minMaxErrorMessage&&g||!!e.minErrorMessage&&b||!!e.maxErrorMessage&&x)&&p.jsxs(xe,{variant:"body",style:{color:d.custom.red[600]},children:[!!e.minMaxErrorMessage&&g&&e.minMaxErrorMessage,!!e.minErrorMessage&&b&&e.minErrorMessage,!!e.maxErrorMessage&&x&&e.maxErrorMessage]}),p.jsx(xe,{variant:"body",children:i})]})},Vz=J.forwardRef(function(t){const{title:n,placeholder:o,value:r,description:i,sx:a,error:l,required:c,...u}=t,d=c?"*":"",f=ze(),h=J.useRef(!1),g=h.current&&l;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(xe,{variant:"h5",children:`${n}${d} :`}),p.jsx(cd,{...u,sx:{width:"70%",borderColor:g?f.custom.red[600]:"inherit",backgroundColor:g?f.custom.red[100]:"inherit",...a},placeholder:o,value:r,onChange:m=>{h.current=!0,u.onChange&&u.onChange(m)}}),p.jsx(xe,{variant:"body",children:i})]})});function Fz(e){return p.jsxs("div",{children:[p.jsx(xe,{variant:"body-bold",sx:{marginBottom:"16px"},children:e.header}),p.jsxs(qe,{direction:"column",useFlexGap:!0,gap:"12px",children:[p.jsxs(qe,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(qo,{checked:!0,sx:{width:"20px",height:"20px"}}),p.jsx(xe,{variant:"body",children:e.allText})]}),e.values.map((t,n)=>p.jsxs(qe,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(qo,{checked:!1,sx:{width:"20px",height:"20px"}}),p.jsx(xe,{variant:"body",children:t})]},n))]})]})}function $z(e){return p.jsxs(qe,{direction:"column",useFlexGap:!0,gap:"12px",alignItems:"flex-start",children:[p.jsx(xe,{variant:"body-bold",children:e.header}),p.jsx(qe,{direction:"row",useFlexGap:!0,gap:"8px",flexWrap:"wrap",children:e.values.map((t,n)=>p.jsxs(qe,{direction:"row",useFlexGap:!0,gap:"4px",sx:{height:"28px",borderRadius:"4px",background:"#EFEDEC",paddingLeft:"8px"},alignItems:"center",children:[p.jsx(xe,{variant:"body",children:t}),p.jsx(Rt,{sx:{width:"20px",height:"20px"},children:p.jsx(z6,{sx:{width:"16px",height:"16px"}})})]},n))}),p.jsx(lt,{variant:"text",startIcon:p.jsx(qD,{}),children:e.addText})]})}const S7=e=>{const t=ze(),{steps:n,currentStep:o=0,icons:r=[],clickable:i=!1,onClick:a}=e;return p.jsxs(ve,{display:"inline-flex",position:"relative",children:[p.jsx(qe,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(n??r.length).keys()].map(l=>{const c=l<=o;return p.jsx(mu,{size:"medium",border:`1px solid ${t.custom.grey[500]}`,color:c?"#FFF":t.custom.grey[2800],bgcolor:c?t.custom.grey[2800]:"#FFF",sx:{fill:c?"#FFF":t.custom.grey[2800],cursor:i?"pointer":"default","&:hover":i?{fill:"#FFF",color:"#FFF",bgcolor:t.custom.grey[c?2800:2e3]}:{}},onClick:()=>{i&&a&&a(l)},children:r&&r[l]?r[l]:l+1},l)})}),p.jsx(oo,{sx:{backgroundColor:t.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},T7=e=>y.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("path",{d:"M11.021 7.69411H0.333496V6.30524H11.021L6.021 1.30522L7.00016 0.333008L13.6668 6.99967L7.00016 13.6663L6.021 12.6941L11.021 7.69411Z",fill:"white"})),P7=e=>y.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},y.createElement("path",{d:"M2.97919 7.69411L7.97921 12.6941L7.00004 13.6663L0.333374 6.99967L7.00004 0.333008L7.97921 1.30522L2.97919 6.30524H13.6667V7.69411H2.97919Z",fill:"#B06803"})),M7=e=>{var t;return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{minHeight:"96px",zIndex:1e3,position:"sticky",top:"28px",border:"1px solid #E7E6E4",borderRadius:"52px",backgroundColor:"#FFFFFF",padding:"20px 28px"},children:[p.jsx(Nz,{title:e.title,subtitle:e.subtitle}),p.jsx(S7,{icons:e.icons,steps:e.steps??((t=e.icons)==null?void 0:t.length)??0,currentStep:e.currentPage,clickable:e.navigable,onClick:e.onNavigate}),p.jsx(Hz,{onPageForward:e.onPageForward,onPageBack:e.onPageBack,nextPageText:e.nextPageText,previousPageText:e.previousPageText,currentPage:e.currentPage,validateSteps:e.validateSteps,validateStepsTexts:e.validateStepsTexts,warningText:e.warningText,savingState:e.savingState,closeable:e.closeable,onClose:e.onClose})]})},Nz=e=>{const t=ze();return p.jsx(qe,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(qe,{gap:"4px",children:[p.jsx(xe,{variant:"h3",children:e.title}),e.subtitle&&p.jsx(xe,{variant:"body",color:t.custom.grey[2e3],children:e.subtitle})]})})},Bz=e=>{const t=ze(),n=e.saving?Z6:U6,o=e.saving?{animation:"spin 1s linear infinite","@keyframes spin":{"0%":{transform:"rotate(360deg)"},"100%":{transform:"rotate(0deg)"}}}:{},r=p.jsx(n,{sx:{width:"24px",color:t.custom.grey[2e3],...o}}),i=p.jsx(ve,{padding:"12px 16px",textAlign:"center",children:p.jsx(xe,{variant:"body",children:e.saving?e.savingMessage:e.savedMessage})});return p.jsx(Pl,{icon:r,body:i,size:"260px"})},Hz=e=>{const t=ze(),n=p.jsx(lt,{variant:"primary",disabled:e.validateSteps&&!e.validateSteps[e.currentPage],endIcon:p.jsx(T7,{}),onClick:e.onPageForward,children:e.nextPageText}),o=p.jsxs(ve,{padding:"12px 16px",children:[p.jsx(xe,{variant:"body-bold",children:e.warningText||""}),p.jsx("br",{}),p.jsx(xe,{variant:"body",children:e.validateStepsTexts&&e.validateStepsTexts[e.currentPage]||""})]});return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(ve,{sx:{">*":{display:"flex"}},children:e.savingState&&p.jsx(Bz,{...e.savingState})}),p.jsxs(qe,{direction:"row",gap:"20px",children:[e.previousPageText&&p.jsx(lt,{variant:"text",startIcon:p.jsx(P7,{}),onClick:e.onPageBack,children:e.previousPageText}),e.validateSteps&&!e.validateSteps[e.currentPage]?e.nextPageText&&p.jsx(Pl,{icon:n,body:o,size:"260px"}):e.nextPageText&&n]}),e.closeable&&p.jsx(lt,{variant:"white-filled",onClick:e.onClose,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:t.custom.grey[400]},"&:active":{background:t.custom.grey[600]}},children:p.jsx(W6,{sx:{width:"20px",color:t.custom.grey[2800]}})})]})},o2=e=>{const t=ze(),{title:n,titleSize:o,badge:r}=e,a=o||"h1";return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"16px",children:[typeof r=="number"?p.jsx(mu,{size:"big",children:r}):p.jsx(qe,{width:"40px",alignItems:"center",color:t.custom.grey[2800],children:p.jsx(qe,{sx:{transform:"scale(250%)"},children:r})}),p.jsx(xe,{variant:a,children:n})]})},zz=e=>{const{title:t,subtitle:n,pages:o,pageIndexToDisplay:r=0,savingState:i,closeable:a=!0}=e,l=o.map(d=>d.icon),c=o[r],u=(Array.isArray(c.content)?c.content:[c.content]).map((d,f)=>p.jsx(J.Fragment,{children:d},f));return p.jsxs(p.Fragment,{children:[p.jsx(M7,{title:t,subtitle:n,icons:l,steps:o.length,currentPage:r,nextPageText:e.nextPageText,previousPageText:e.previousPageText,onPageForward:e.onPageForward,onPageBack:e.onPageBack,validateSteps:e.validateSteps,validateStepsTexts:e.validateStepsTexts,warningText:e.warningText,savingState:i,navigable:e.navigable,onNavigate:e.onNavigate,closeable:a,onClose:e.onClose}),p.jsx(qe,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(qe,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[c.title&&p.jsx(o2,{title:c.title,badge:c.icon??r+1}),c.subTitle&&p.jsx(xe,{variant:"h4",children:c.subTitle}),c.subTitle&&p.jsx(oo,{}),c.info]}),c.usesBaseLayout===!1?p.jsx(p.Fragment,{children:u}):p.jsx(Wz,{children:u})]})})]})},Wz=e=>{const{children:t}=e,n=Array.isArray(t)?t:[t];return p.jsx("div",{children:n.map((o,r)=>p.jsx(J.Fragment,{children:o},r))})},Uz=({sx:e={},...t})=>p.jsx(ve,{sx:{boxShadow:"0px 2px 8px 0px #2A2B270A",border:`1px solid ${Oe[500]}`,borderRadius:"16px",backgroundColor:"#FFFFFF",padding:"2rem",height:"fit-content",...e},...t}),Zz=e=>{const{title:t,hint:n,indicator:o,children:r,...i}=e;return p.jsx(Ar,{width:"100%",padding:"32px",...i,children:p.jsxs(qe,{gap:"32px",children:[p.jsxs(qe,{direction:"row",alignItems:"start",gap:"32px",children:[p.jsx(xe,{variant:"h4",flex:1,children:t}),o&&p.jsx(Vf,{value:o.value,unit:o.unit,sx:{top:"-12px",right:"-12px"}})]}),p.jsxs(qe,{gap:"24px",children:[r,n&&p.jsx(J6,{children:p.jsx(ve,{dangerouslySetInnerHTML:{__html:n}})})]})]})})},qz=()=>{const[e,t]=J.useState({isLocked:!1}),n=d=>{t({isLocked:!0,message:d})},o=()=>{t({isLocked:!1})},[r,i]=J.useState({isLocked:!1}),a=d=>{i({isLocked:!0,message:d})},l=()=>{i({isLocked:!1})};return{forwardLock:e,lockForward:n,unlockForward:o,previousLock:r,lockPrevious:a,unlockPrevious:l,lockAll:d=>{n(d),a(d)},unlockAll:()=>{o(),l()}}},R7=J.createContext(null),O7=e=>{const{children:t,startingPage:n=0,...o}=e,[r,i]=J.useState(!1),[a,l]=J.useState(!1),[c,u]=J.useState(n),d=e.pages.length,f=e.pages[c]??null,h=qz(),[g,m]=J.useState(!1),b={...o,...h,isSaving:r,setSaving:i,selectedPage:f,selectedPageIndex:c,setPage:u,maxPage:d,formSaved:g,setFormSaved:m,isError:a,setError:l};return p.jsx(R7.Provider,{value:b,children:t})},Ii=()=>{const e=J.useContext(R7);if(e)return e;throw new Error("useFormBaseContext must be used within an FormBaseContextProvider")},Gz=()=>{const{selectedPageIndex:e,setPage:t,onPageChange:n,pages:o,previousLock:r,forwardLock:i,maxPage:a,setFormSaved:l,isLoading:c}=Ii(),u=ze(),d={selected:{color:"#FFF",background:u.custom.grey[2800],hover:{color:"#FFF",background:u.custom.grey[2800]}},locked:{color:u.custom.grey[500],background:"#FFF",hover:{color:u.custom.grey[500],background:"#FFF"}},default:{color:u.custom.grey[2800],background:"#FFF",hover:{color:"#FFF",background:u.custom.grey[2e3]}}};return c?p.jsx(xs,{}):p.jsxs(ve,{display:"inline-flex",position:"relative",children:[p.jsx(qe,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(a)].map((f,h)=>{var T;const g=r.isLocked&&h<e,m=i.isLocked&&h>e,b=g||m,x=h===e?d.selected:d[b?"locked":"default"],w=((T=o[h])==null?void 0:T.icon)??h+1;return p.jsx(mu,{size:"medium",border:`1px solid ${u.custom.grey[500]}`,color:x.color,bgcolor:x.background,sx:{fill:x.color,cursor:b?"default":"pointer","&:hover":{fill:x.hover.color,color:x.hover.color,bgcolor:x.hover.background}},onClick:()=>{h===e||b||(l(!1),t(h),n==null||n(h,e))},children:w},`page-top-display-${h}`)})}),p.jsx(oo,{sx:{backgroundColor:u.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},Yz=()=>{const{textOptions:e,isLoading:t}=Ii(),n=ze();return p.jsx(qe,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(qe,{gap:"4px",children:[p.jsx(xe,{variant:"h3",children:t?p.jsx(xs,{size:"18px"}):e.title}),e.subtitle&&p.jsx(xe,{variant:"body",color:n.custom.grey[2e3],children:e.subtitle})]})})};function ud(e){return e.variant==="themed"?p.jsx(E7,{...e}):e.variant==="headless"?p.jsx(i2,{...e}):p.jsx(i2,{...e,variant:"themed"})}const r2={leftside:{anchorPosition:"left",anchorIndicatorPosition:"calc(100% - (1.5 * 30px))"},rightside:{anchorPosition:"right",anchorIndicatorPosition:"15px"},center:{anchorPosition:"center",anchorIndicatorPosition:"calc(50% - (30px / 2))"}};function E7(e){const t=ze(),n=e.anchorPosition?r2[e.anchorPosition].anchorPosition:"right",o=e.anchorPosition?r2[e.anchorPosition].anchorIndicatorPosition:"15px";return p.jsx(cr,{open:e.open,anchorEl:e.anchor,onClose:e.onClose,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:n,vertical:"bottom"},slotProps:{paper:{sx:{padding:"24px 20px",borderRadius:"12px",marginTop:1.5,overflow:"visible",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${t.custom.grey[500]}`,transform:n==="center"?"translateX(50%) !important":"none","&:before":{content:'""',display:"block",position:"absolute",top:"-15px",right:o,width:0,height:0,borderLeft:"15px solid transparent",borderRight:"15px solid transparent",borderBottom:`15px solid ${t.custom.grey[500]}`,zIndex:-1},"&:after":{content:'""',display:"block",position:"absolute",top:-14,right:o,width:0,height:0,borderLeft:"15px solid transparent",borderRight:"15px solid transparent",borderBottom:"15px solid #fff",zIndex:0}}}},sx:e.sx,children:e.children})}function i2(e){const t=e.anchorPosition?r2[e.anchorPosition].anchorPosition:"right";return p.jsx(cr,{open:e.open,anchorEl:e.anchor,onClose:e.onClose,transformOrigin:{horizontal:"right",vertical:"top"},anchorOrigin:{horizontal:t,vertical:"bottom"},slotProps:{paper:{sx:{borderRadius:"12px",...e.paperProps}}},sx:e.sx,children:e.children})}const Kz=e=>p.jsxs(ve,{component:"div",sx:{background:"white",width:e.width??"376px",borderRadius:"12px",border:"1px solid #E7E6E4",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)"},children:[p.jsxs(qe,{direction:"row",useFlexGap:!0,alignContent:"center",justifyContent:"space-between",sx:{padding:"18px 16px"},children:[e.headerIcon??p.jsx(QD,{}),p.jsx(xe,{variant:"h4",sx:{height:"24px"},children:e.headerText}),p.jsx(Rt,{sx:{padding:"0"},onClick:e.onClose,children:p.jsx(z6,{})})]}),p.jsx(oo,{}),p.jsx(ve,{sx:{padding:"24px",height:"420px",overflow:"auto"},children:e.children}),e.bottomActions&&p.jsx(Xz,{onCancel:e.onCancel,onValidate:e.onValidate})]}),Xz=e=>{const{t}=vi();return p.jsxs(p.Fragment,{children:[p.jsx(oo,{}),p.jsxs(qe,{direction:"row",useFlexGap:!0,justifyContent:"space-between",alignItems:"center",sx:{padding:"20px 32px"},children:[p.jsx(lt,{variant:"text",onClick:e.onCancel,children:t("Annuler")}),p.jsx(lt,{variant:"primary",onClick:e.onValidate,children:t("Valider")})]})]})};function Qz(e){const t=ze(),{content:n,onChange:o,defaultIndex:r,...i}=e,[a,l]=J.useState(r??0);return p.jsx(Ar,{borderRadius:"12px",boxShadow:"0 4px 20px 0 rgba(81, 78, 78, 0.12)",padding:"24px 28px",...i,children:p.jsx(qe,{gap:"24px",children:n.map((c,u)=>p.jsxs(qe,{gap:"16px",children:[p.jsxs(qe,{gap:"16px",children:[c.header&&p.jsx(xe,{variant:"h5",children:c.header}),p.jsx(qe,{gap:"12px",children:c.options.map((d,f)=>{const h=d.id===a;return p.jsxs(qe,{direction:"row",alignItems:"center",gap:"6px",sx:{cursor:d.disabled?"default":"pointer","&:hover > span":{color:h?t.palette.primary[600]:t.custom.grey[1500]}},onClick:()=>{d.disabled||(l(d.id),o==null||o(d,c))},children:[p.jsx(xe,{variant:"body",sx:{color:d.disabled?t.custom.grey[1500]:h?t.palette.primary[600]:t.custom.grey[2800],fontWeight:h?600:500},children:d.label}),h&&p.jsx(KD,{sx:{color:t.palette.primary[600],width:"16px",height:"16px"}})]},f)})})]}),u<n.length-1&&p.jsx(oo,{color:t.custom.grey[500]})]},u))})})}const Jz=e=>{const{size:t,icon:n,body:o}=e,[r,i]=J.useState(null),a=()=>{i(null)},l=u=>{i(u.currentTarget)},c=!!r;return p.jsxs("div",{style:{position:"relative",width:"20px",height:"20px"},onMouseEnter:l,onMouseLeave:a,children:[n,p.jsx(cr,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:c,anchorEl:r,anchorOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{position:"relative",top:"10px",width:t,borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:"1px solid #E7E6E4",overflow:"visible",backgroundColor:"#FFFFFF","&:before":{content:'""',position:"absolute",top:18/2*-1,left:28,width:18,height:18,borderTop:"1px solid #E7E6E4",borderRight:"1px solid #E7E6E4",backgroundColor:"#FFFFFF",transform:"rotate(-45deg)"}}}},children:o})]})},Pl=e=>{const{size:t,icon:n,body:o,leftPosition:r}=e,[i,a]=J.useState(null),l=()=>{a(null)},c=d=>{a(d.currentTarget)},u=!!i;return p.jsxs("div",{style:{position:"relative"},onMouseEnter:c,onMouseLeave:l,children:[n,p.jsx(cr,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:u,anchorEl:i,disableAutoFocus:!0,anchorOrigin:{vertical:"bottom",horizontal:"center"},slotProps:{paper:{sx:{position:"relative",top:"10px",width:t,borderRadius:"12px",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:"1px solid #E7E6E4",overflow:"visible",backgroundColor:"#FFFFFF","&:before":{content:'""',position:"absolute",top:18/2*-1,left:r||28,width:18,height:18,borderTop:"1px solid #E7E6E4",borderRight:"1px solid #E7E6E4",backgroundColor:"#FFFFFF",transform:"rotate(-45deg)"}}}},children:o})]})},eW=e=>{const{content:t,x:n,y:o,open:r,setOpen:i,transformOrigin:a}=e,l=ze();return p.jsx(cr,{anchorReference:"anchorPosition",anchorPosition:{top:o,left:n},open:r,onClose:()=>i(!1),transformOrigin:a||{vertical:"center",horizontal:"center"},slotProps:{paper:{sx:{minWidth:"340px",padding:"24px 20px",borderRadius:"12px",marginTop:1.5,overflow:"visible",boxShadow:"0px 4px 20px 0px rgba(81, 78, 78, 0.12)",border:`1px solid ${l.custom.grey[500]}`}}},children:t})},tW=()=>{const e=ze(),{isSaving:t,textOptions:n,isError:o}=Ii(),r=t?Z6:o?rL:U6,i=t?{animation:"spin 1s linear infinite","@keyframes spin":{"0%":{transform:"rotate(360deg)"},"100%":{transform:"rotate(0deg)"}}}:{},a=p.jsx(r,{sx:{width:"24px",color:o?e.custom.red[600]:e.custom.grey[2e3],...i}}),l=p.jsx(ve,{padding:"12px 16px",textAlign:"center",children:p.jsx(xe,{variant:"body-medium",children:t?n.syncingMessage:o?n.errorDefaultMessage:n.savingDefaultMessage})});return p.jsx(Pl,{icon:a,body:l,size:"260px"})},nW=()=>{const{confirmExit:e,selectedPageIndex:t,setPage:n,maxPage:o,forwardLock:r,previousLock:i,textOptions:a,onClose:l,onValidate:c,onPageChange:u,showSync:d,setFormSaved:f,openConfirmDialog:h,isLoading:g}=Ii(),m=ze(),v=t===o-1&&a.finalPage?a.finalPage:a.nextPage,x=p.jsx(lt,{variant:"primary",disabled:r.isLocked||g,endIcon:p.jsx(T7,{}),onClick:()=>{if(t===o-1){f(!0),c==null||c();return}return f(!1),u==null||u(t+1,t),n(t+1)},children:v}),w=p.jsxs(ve,{padding:"12px 16px",children:[p.jsx(xe,{variant:"body-bold",children:a.warningText?a.warningText:""}),p.jsx("br",{}),p.jsx(xe,{variant:"body",children:r.isLocked&&r.message||""})]});return p.jsxs(qe,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(ve,{sx:{">*":{display:"flex"}},children:d&&p.jsx(tW,{})}),p.jsxs(qe,{direction:"row",gap:"20px",children:[a.previousPage&&p.jsx(lt,{sx:{minWidth:"90px"},variant:"text",disabled:i.isLocked||g,startIcon:i.isLocked||g?null:p.jsx(P7,{}),onClick:()=>{if(f(!1),t===0){u==null||u(t,t);return}return u==null||u(t-1,t),n(t-1)},children:a.previousPage}),r.isLocked?v&&p.jsx(Pl,{icon:x,body:w,size:"260px",leftPosition:130}):v&&x]}),l&&p.jsx(lt,{variant:"white-filled",onClick:e?h:l,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:m.custom.grey[400]},"&:active":{background:m.custom.grey[600]}},children:p.jsx(W6,{sx:{width:"20px",color:m.custom.grey[2800]}})})]})},oW=()=>p.jsxs(ve,{sx:{zIndex:1e3,minHeight:"96px",position:"sticky",top:"28px",border:"1px solid #E7E6E4",borderRadius:"52px",backgroundColor:"#FFFFFF",padding:"20px 28px",display:"grid",gridTemplateColumns:"1fr 50% 1fr",gridTemplateRows:"1fr",alignItems:"center"},children:[p.jsx(ve,{sx:{gridColumn:"1 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"left"},children:p.jsx(Yz,{})}),p.jsx(ve,{sx:{gridColumn:"2 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"center"},children:p.jsx(Gz,{})}),p.jsx(ve,{sx:{gridColumn:"3 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"right"},children:p.jsx(nW,{})})]}),rW=()=>{const{selectedPage:e,selectedPageIndex:t,isLoading:n}=Ii(),o=e.icon??t+1,r=e.title,i=e.subtitle;return n?p.jsx(iW,{}):p.jsx(qe,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(qe,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[r&&p.jsx(o2,{title:r,badge:o}),i&&p.jsxs(p.Fragment,{children:[p.jsx(xe,{variant:"h4",children:i}),p.jsx(oo,{})]})]}),e.content]})})},iW=()=>p.jsx(ve,{sx:{marginLeft:"auto",marginRight:"auto",width:"fit-content",marginTop:"5%",marginBottom:"5%"},children:p.jsx(xs,{})}),sW=e=>{const t=ze(),{onClose:n,open:o,confirmOptions:r}=e,i=()=>{r.onConfirm(),n()},a=()=>{r.onCancel(),n()};return p.jsxs(ja,{fullWidth:!0,maxWidth:"xs",open:o,onClose:n,sx:{".MuiPaper-rounded":{borderRadius:"12px"}},children:[p.jsxs(Uc,{sx:{borderBottom:`1px solid ${t.custom.grey[500]}`},children:[p.jsxs(ve,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"68px"},children:[p.jsx(xe,{variant:"h3",children:r.titleText}),p.jsx(lt,{variant:"text",endIcon:p.jsx(bu,{}),onClick:n})]}),(r==null?void 0:r.infoText)&&p.jsx(xe,{sx:{marginBlock:1.5},children:r.infoText})]}),p.jsxs(qe,{flexDirection:"column",alignItems:"center",p:3,gap:"1rem",children:[p.jsx(lt,{variant:"primary",onClick:i,children:r.confirmText}),p.jsx(lt,{onClick:a,children:r.cancelText})]})]})},aW=()=>{const{confirmExit:e,formSaved:t}=Ii(),n=o=>{o.preventDefault()};return J.useEffect(()=>{if(e)return window.removeEventListener("beforeunload",n),t===!1&&window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}},[t,e]),p.jsxs(p.Fragment,{children:[p.jsx(oW,{}),p.jsx(rW,{})]})},lW=e=>{const[t,n]=J.useState(!1);return p.jsxs(O7,{...e,openConfirmDialog:()=>n(!0),children:[p.jsx(aW,{}),e.confirmExit&&p.jsx(sW,{open:t,onClose:()=>n(!1),confirmOptions:e.confirmOptions})]})};/**
|
|
375
375
|
* table-core
|
|
376
376
|
*
|
|
377
377
|
* Copyright (c) TanStack
|