@foodpilot/foods 0.3.13 → 0.3.15

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.
@@ -1,3 +1,4 @@
1
+ import { PopoverOrigin } from "@mui/material";
1
2
  import { ReactNode } from "react";
2
3
  export type CoordinatePopoverProps = {
3
4
  x: number;
@@ -5,5 +6,6 @@ export type CoordinatePopoverProps = {
5
6
  content: ReactNode;
6
7
  open: boolean;
7
8
  setOpen: (value: boolean) => void;
9
+ transformOrigin?: PopoverOrigin;
8
10
  };
9
11
  export declare const CoordinatePopover: (props: CoordinatePopoverProps) => import("react/jsx-runtime").JSX.Element;
@@ -13,8 +13,7 @@ export type FoodsSelectProps<T> = {
13
13
  BoxOptionsProps?: SxProps;
14
14
  unit?: string;
15
15
  };
16
- type SelectWrapperProps<T> = FoodsSelectProps<T> & ExtraSelectOptions;
16
+ export type SelectWrapperProps<T> = FoodsSelectProps<T> & ExtraSelectOptions;
17
17
  export declare const FoodsSelect: <T>(props: SelectWrapperProps<T>) => import("react/jsx-runtime").JSX.Element;
18
- type SelectWrapperWithServerPaginationProps<T> = Omit<SelectWrapperProps<T>, "disableSearch"> & SearchOptions;
18
+ export type SelectWrapperWithServerPaginationProps<T> = Omit<SelectWrapperProps<T>, "disableSearch"> & SearchOptions;
19
19
  export declare const FoodsSelectServerPagination: <T>(props: Omit<SelectWrapperProps<T>, "disableSearch"> & SearchOptions) => import("react/jsx-runtime").JSX.Element;
20
- export {};
package/dist/main.js CHANGED
@@ -43043,7 +43043,7 @@ const ele = (e) => {
43043
43043
  }
43044
43044
  );
43045
43045
  }, tle = (e) => {
43046
- const { content: t, x: n, y: o, open: r, setOpen: s } = e, a = et();
43046
+ const { content: t, x: n, y: o, open: r, setOpen: s, transformOrigin: a } = e, l = et();
43047
43047
  return /* @__PURE__ */ p.jsx(
43048
43048
  Ji,
43049
43049
  {
@@ -43054,7 +43054,7 @@ const ele = (e) => {
43054
43054
  },
43055
43055
  open: r,
43056
43056
  onClose: () => s(!1),
43057
- transformOrigin: {
43057
+ transformOrigin: a || {
43058
43058
  vertical: "center",
43059
43059
  horizontal: "center"
43060
43060
  },
@@ -43067,7 +43067,7 @@ const ele = (e) => {
43067
43067
  marginTop: 1.5,
43068
43068
  overflow: "visible",
43069
43069
  boxShadow: "0px 4px 20px 0px rgba(81, 78, 78, 0.12)",
43070
- border: `1px solid ${a.custom.grey[500]}`
43070
+ border: `1px solid ${l.custom.grey[500]}`
43071
43071
  }
43072
43072
  }
43073
43073
  },
package/dist/main.umd.cjs CHANGED
@@ -437,7 +437,7 @@ const theme2 = createTheme({ palette: {
437
437
  * (c) 2017-2022 chartjs-plugin-datalabels contributors
438
438
  * Released under the MIT license
439
439
  */var y7=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}(),Ll={toTextLines:function(e){var t=[],n;for(e=[].concat(e);e.length;)n=e.pop(),typeof n=="string"?t.unshift.apply(t,n.split(`
440
- `)):Array.isArray(n)?e.push.apply(e,n):Lt(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var o=[].concat(t),r=o.length,s=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=s,{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,s,a,l;for(r=0,a=t.length;r<a;++r)l=t[r],s=n.indexOf(l),s===-1?o.push([l,1]):n.splice(s,1);for(r=0,a=n.length;r<a;++r)o.push([n[r],-1]);return o},rasterize:function(e){return Math.round(e*y7)/y7}};function Kf(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,s=e.y-o,a=Math.sqrt(r*r+s*s);return{x:a?r/a:0,y:a?s/a:-1}}function Pz(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 Mz=0,C7=1,w7=2,S7=4,T7=8;function hd(e,t,n){var o=Mz;return e<n.left?o|=C7:e>n.right&&(o|=w7),t<n.top?o|=T7:t>n.bottom&&(o|=S7),o}function Oz(e,t){for(var n=e.x0,o=e.y0,r=e.x1,s=e.y1,a=hd(n,o,t),l=hd(r,s,t),c,u,d;!(!(a|l)||a&l);)c=a||l,c&T7?(u=n+(r-n)*(t.top-o)/(s-o),d=t.top):c&S7?(u=n+(r-n)*(t.bottom-o)/(s-o),d=t.bottom):c&w7?(d=o+(s-o)*(t.right-n)/(r-n),u=t.right):c&C7&&(d=o+(s-o)*(t.left-n)/(r-n),u=t.left),c===a?(n=u,o=d,a=hd(n,o,t)):(r=u,s=d,l=hd(r,s,t));return{x0:n,x1:r,y0:o,y1:s}}function gd(e,t){var n=t.anchor,o=e,r,s;return t.clamp&&(o=Oz(o,t.area)),n==="start"?(r=o.x0,s=o.y0):n==="end"?(r=o.x1,s=o.y1):(r=(o.x0+o.x1)/2,s=(o.y0+o.y1)/2),Pz(r,s,e.vx,e.vy,t.align)}var md={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,o=Math.cos(n),r=Math.sin(n),s=e.innerRadius,a=e.outerRadius;return gd({x0:e.x+o*s,y0:e.y+r*s,x1:e.x+o*a,y1:e.y+r*a,vx:o,vy:r},t)},point:function(e,t){var n=Kf(e,t.origin),o=n.x*e.options.radius,r=n.y*e.options.radius;return gd({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=Kf(e,t.origin),o=e.x,r=e.y,s=0,a=0;return e.horizontal?(o=Math.min(e.x,e.base),s=Math.abs(e.base-e.x)):(r=Math.min(e.y,e.base),a=Math.abs(e.base-e.y)),gd({x0:o,y0:r+a,x1:o+s,y1:r,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=Kf(e,t.origin);return gd({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)}},Vr=Ll.rasterize;function Rz(e){var t=e.borderWidth||0,n=e.padding,o=e.size.height,r=e.size.width,s=-r/2,a=-o/2;return{frame:{x:s-n.left-t,y:a-n.top-t,w:r+n.width+t*2,h:o+n.height+t*2},text:{x:s,y:a,w:r,h:o}}}function Ez(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 kz(e){return e instanceof Wi?md.arc:e instanceof El?md.point:e instanceof kl?md.bar:md.fallback}function _z(e,t,n,o,r,s){var a=Math.PI/2;if(s){var l=Math.min(s,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 Dz(e,t,n){var o=n.backgroundColor,r=n.borderColor,s=n.borderWidth;!o&&(!r||!s)||(e.beginPath(),_z(e,Vr(t.x)+s/2,Vr(t.y)+s/2,Vr(t.w)-s,Vr(t.h)-s,n.borderRadius),e.closePath(),o&&(e.fillStyle=o,e.fill()),r&&s&&(e.strokeStyle=r,e.lineWidth=s,e.lineJoin="miter",e.stroke()))}function jz(e,t,n){var o=n.lineHeight,r=e.w,s=e.x,a=e.y+o/2;return t==="center"?s+=r/2:(t==="end"||t==="right")&&(s+=r),{h:o,w:r,x:s,y:a}}function Iz(e,t,n){var o=e.shadowBlur,r=n.stroked,s=Vr(n.x),a=Vr(n.y),l=Vr(n.w);r&&e.strokeText(t,s,a,l),n.filled&&(o&&r&&(e.shadowBlur=0),e.fillText(t,s,a,l),o&&r&&(e.shadowBlur=o))}function Lz(e,t,n,o){var r=o.textAlign,s=o.color,a=!!s,l=o.font,c=t.length,u=o.textStrokeColor,d=o.textStrokeWidth,f=u&&d,h;if(!(!c||!a&&!f))for(n=jz(n,r,l),e.font=l.string,e.textAlign=r,e.textBaseline="middle",e.shadowBlur=o.textShadowBlur,e.shadowColor=o.textShadowColor,a&&(e.fillStyle=s),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),h=0,c=t.length;h<c;++h)Iz(e,t[h],{stroked:f,filled:a,w:n.w,x:n.x,y:n.y+n.h*h})}var P7=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};fr(P7.prototype,{_modelize:function(e,t,n,o){var r=this,s=r._index,a=Fn(Cn([n.font,{}],o,s)),l=Cn([n.color,Pn.color],o,s);return{align:Cn([n.align,"center"],o,s),anchor:Cn([n.anchor,"center"],o,s),area:o.chart.chartArea,backgroundColor:Cn([n.backgroundColor,null],o,s),borderColor:Cn([n.borderColor,null],o,s),borderRadius:Cn([n.borderRadius,0],o,s),borderWidth:Cn([n.borderWidth,0],o,s),clamp:Cn([n.clamp,!1],o,s),clip:Cn([n.clip,!1],o,s),color:l,display:e,font:a,lines:t,offset:Cn([n.offset,4],o,s),opacity:Cn([n.opacity,1],o,s),origin:Ez(r._el,o),padding:Yn(Cn([n.padding,4],o,s)),positioner:kz(r._el),rotation:Cn([n.rotation,0],o,s)*(Math.PI/180),size:Ll.textSize(r._ctx,t,a),textAlign:Cn([n.textAlign,"start"],o,s),textShadowBlur:Cn([n.textShadowBlur,0],o,s),textShadowColor:Cn([n.textShadowColor,l],o,s),textStrokeColor:Cn([n.textStrokeColor,l],o,s),textStrokeWidth:Cn([n.textStrokeWidth,0],o,s)}},update:function(e){var t=this,n=null,o=null,r=t._index,s=t._config,a,l,c,u=Cn([s.display,!0],e,r);u&&(a=e.dataset.data[r],l=Ot(pn(s.formatter,[a,e]),a),c=Lt(l)?[]:Ll.toTextLines(l),c.length&&(n=t._modelize(u,c,s,e),o=Rz(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,s=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=Ll.bound(0,r.opacity,1),o.translate(Vr(t.x),Vr(t.y)),o.rotate(r.rotation),Dz(o,s.frame,r),Lz(o,r.lines,s.text,r),o.restore())}});var Az=Number.MIN_SAFE_INTEGER||-9007199254740991,Vz=Number.MAX_SAFE_INTEGER||9007199254740991;function Al(e,t,n){var o=Math.cos(n),r=Math.sin(n),s=t.x,a=t.y;return{x:s+o*(e.x-s)-r*(e.y-a),y:a+r*(e.x-s)+o*(e.y-a)}}function M7(e,t){var n=Vz,o=Az,r=t.origin,s,a,l,c,u;for(s=0;s<e.length;++s)a=e[s],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 bd(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 O7=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};fr(O7.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=Al(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=[bd(t[0],t[1]),bd(t[0],t[3])],r,s,a;for(this._rotation!==e._rotation&&o.push(bd(n[0],n[1]),bd(n[0],n[3])),r=0;r<o.length;++r)if(s=M7(t,o[r]),a=M7(n,o[r]),s.max<a.min||a.max<s.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,o=e.center();return[Al({x:t.x,y:t.y},o,n),Al({x:t.x+t.w,y:t.y},o,n),Al({x:t.x+t.w,y:t.y+t.h},o,n),Al({x:t.x,y:t.y+t.h},o,n)]}});function R7(e,t,n){var o=t.positioner(e,t),r=o.vx,s=o.vy;if(!r&&!s)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(s));return u*=r*f,d*=s*f,u+=t.offset*r,d+=t.offset*s,{x:o.x+u,y:o.y+d}}function Fz(e,t){var n,o,r,s;for(n=e.length-1;n>=0;--n)for(r=e[n].$layout,o=n-1;o>=0&&r._visible;--o)s=e[o].$layout,s._visible&&r._box.intersects(s._box)&&t(r,s);return e}function $z(e){var t,n,o,r,s,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]}),s=o.geometry(),a=R7(l,o.model(),s),r._box.update(a,s,o.rotation()));return Fz(e,function(c,u){var d=c._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(c._visible=!1)})}var Vl={prepare:function(e){var t=[],n,o,r,s,a;for(n=0,r=e.length;n<r;++n)for(o=0,s=e[n].length;o<s;++o)a=e[n][o],t.push(a),a.$layout={_box:new O7,_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,s,a;for(n=0,o=e.length;n<o;++n)r=e[n],s=r.model(),a=r.$layout,a._hidable=s&&s.display==="auto",a._visible=r.visible(),t|=a._hidable;t&&$z(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,s,a,l;for(n=0,o=t.length;n<o;++n)r=t[n],s=r.$layout,s._visible&&(a=r.geometry(),l=R7(r._el,r.model(),a),s._box.update(l,a,r.rotation()),r.draw(e,l))}},Nz=function(e){if(Lt(e))return null;var t=e,n,o,r;if(Ft(e))if(!Lt(e.label))t=e.label;else if(!Lt(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},Hz={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:Nz,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},bo="$datalabels",E7="$default";function Bz(e,t){var n=e.datalabels,o={},r=[],s,a;return n===!1?null:(n===!0&&(n={}),t=fr({},[t,n]),s=t.labels||{},a=Object.keys(s),delete t.labels,a.length?a.forEach(function(l){s[l]&&r.push(fr({},[t,s[l],{_key:l}]))}):r.push(t),o=r.reduce(function(l,c){return sn(c.listeners||{},function(u,d){l[d]=l[d]||{},l[d][c._key||E7]=u}),delete c.listeners,l},{}),{labels:r,listeners:o})}function Xf(e,t,n,o){if(t){var r=n.$context,s=n.$groups,a;t[s._set]&&(a=t[s._set][s._key],a&&pn(a,[r,o])===!0&&(e[bo]._dirty=!0,n.update(r)))}}function zz(e,t,n,o,r){var s,a;!n&&!o||(n?o?n!==o&&(a=s=!0):a=!0:s=!0,a&&Xf(e,t.leave,n,r),s&&Xf(e,t.enter,o,r))}function Wz(e,t){var n=e[bo],o=n._listeners,r,s;if(!(!o.enter&&!o.leave)){if(t.type==="mousemove")s=Vl.lookup(n._labels,t);else if(t.type!=="mouseout")return;r=n._hovered,n._hovered=s,zz(e,o,r,s,t)}}function Uz(e,t){var n=e[bo],o=n._listeners.click,r=o&&Vl.lookup(n._labels,t);r&&Xf(e,o,r,t)}var Zz={id:"datalabels",defaults:Hz,beforeInit:function(e){e[bo]={_actives:[]}},beforeUpdate:function(e){var t=e[bo];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var o=t.index,r=e[bo],s=r._datasets[o]=[],a=e.isDatasetVisible(o),l=e.data.datasets[o],c=Bz(l,n),u=t.meta.data||[],d=e.ctx,f,h,g,b,m,v,y,w;for(d.save(),f=0,g=u.length;f<g;++f)if(y=u[f],y[bo]=[],a&&y&&e.getDataVisibility(f)&&!y.skip)for(h=0,b=c.labels.length;h<b;++h)m=c.labels[h],v=m._key,w=new P7(m,d,y,f),w.$groups={_set:o,_key:v||E7},w.$context={active:!1,chart:e,dataIndex:f,dataset:l,datasetIndex:o},w.update(w.$context),y[bo].push(w),s.push(w);d.restore(),fr(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[bo]._labels=Vl.prepare(e[bo]._datasets)},afterDatasetsDraw:function(e){Vl.draw(e,e[bo]._labels)},beforeEvent:function(e,t){if(e[bo]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":Wz(e,n);break;case"click":Uz(e,n);break}}},afterEvent:function(e){var t=e[bo],n=t._actives,o=t._actives=e.getActiveElements(),r=Ll.arrayDiff(n,o),s,a,l,c,u,d,f;for(s=0,a=r.length;s<a;++s)if(u=r[s],u[1])for(f=u[0].element[bo]||[],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)&&(Vl.update(t._labels),e.render()),delete t._dirty}};Rl.register(...dz,Zz);const qz=e=>{const t=(r,s,a)=>{var u;if(r===null||!((u=e.values)!=null&&u[r])||s===null||a===null){e.onPointSelection(null);return}const c={point:e.values[r],absoluteCoordinate:{x:s,y:a}};e.onPointSelection(c)},n=nt(),o=Gz({...e,theme:n,updateCurrentSelectedPoint:t});return p.jsxs(je,{sx:{backgroundColor:n.custom.grey[200],borderRadius:"8px",border:`1px solid ${n.custom.grey[500]}`,padding:"12px"},children:[e.y,p.jsx(bz,{...o}),p.jsx(je,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.x})]})},Gz=e=>{const{values:t,color:n,theme:o,updateCurrentSelectedPoint:r,...s}=e;return{...s,data:Yz(t,n),options:Kz(o,t,r)}},k7=(e,t)=>{var s;const n=e.filter(a=>a[t]===Math.max(...e.flatMap(l=>l[t]))),o=((s=n[0])==null?void 0:s[t])??0;let r=o*1.1;if(t==="x"){const l=n.reduce((c,u)=>u.label.length>c.label.length?u:c,n[0]).label.length;r=o+l*o/150}return r<1?r.toFixed(1):Math.ceil(r)},Yz=(e,t)=>({datasets:[{data:e,backgroundColor:t,pointStyle:"circle",pointRadius:8,pointHoverRadius:9}],labels:Array.from(e.map(n=>n.label))}),Kz=(e,t,n)=>({plugins:{datalabels:{color:"#403d58",formatter:function(r){return r.label},align:"right",padding:{left:25},font:{weight:600,size:12,family:e.typography.fontFamily}},tooltip:{enabled:!1},legend:{display:!1,usePointStyle:!0}},scales:{x:{beginAtZero:!0,max:k7(t,"x"),linear:!0,border:{dash:[5,5]}},y:{beginAtZero:!0,linear:!0,max:k7(t,"y"),border:{dash:[5,5]}}},layout:{padding:{left:25,right:25,top:15,bottom:15}},onHover:(r,s)=>{if(r.type==="click"){if(s.length){n(s[0].index,r.x,r.y);return}n(null,null,null)}}}),_7=e=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"white"}),x.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,stroke:"#D1CFCE",strokeWidth:2})),D7=e=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("rect",{width:20,height:20,rx:4,fill:"url(#paint0_linear_2034_7850)"}),x.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"}),x.createElement("defs",null,x.createElement("linearGradient",{id:"paint0_linear_2034_7850",x1:7.58928,y1:755124e-13,x2:7.58928,y2:20,gradientUnits:"userSpaceOnUse"},x.createElement("stop",{stopColor:"#484945"}),x.createElement("stop",{offset:1,stopColor:"#2A2B27"})))),Xz=X(ki)(()=>({":hover":{background:qe[400]}})),Qz=e=>{const{values:t,...n}=e,{onChange:o,...r}=n,s=Object.entries(t);return p.jsx(I6,{children:s.map(([a,l],c)=>p.jsx(Ka,{control:p.jsx(Xz,{...r,checkedIcon:p.jsx(D7,{}),icon:p.jsx(_7,{}),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}`))})},Jz=(e,t,n)=>Object.entries(t).flatMap(r=>{const[s,a]=r;if(a.state===!1)return[];const l=Number(s),c=e.find(u=>u.id===l);return c?[c]:[n({id:l,name:a.name})]}),eW=(e,t)=>{const n={};return e.reduce((r,s)=>{const a=t.some(l=>l.id===s.id);return r[s.id]={name:s.name,state:a},r},n)},tW=X(ki)(()=>({":hover":{background:qe[400]}})),nW=e=>{const{values:t,onChange:n,FormGroupProps:o,FormControlLabelProps:r,CheckboxProps:s}=e,a=Object.entries(t);return p.jsx(I6,{...o,children:a.map(([l,c],u)=>p.jsx(Ka,{sx:{gap:"1rem"},checked:c.state,...r,label:c.name,control:p.jsx(tW,{checkedIcon:p.jsx(D7,{}),icon:p.jsx(_7,{}),disableRipple:!0,...s,onChange:(d,f)=>{const h={...t};h[l]={...h[l],name:c.name,state:f},n(h)}})},`${l}-${u}`))})},oW=e=>{const{values:t,selectedItems:n,onChange:o,getId:r=u=>u.id,getName:s=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:s(d),state:g,rawData:d},u},{});return p.jsx(nW,{values:c,onChange:u=>{const d=Object.values(u).flatMap(f=>f.state===!1?[]:f.rawData);return o(d)},...a})},rW=e=>{const{value:t,maxLength:n,...o}=e,r=t.map((d,f)=>t.slice(0,f+1).reduce((h,g)=>{const b=h.length+g.length;if(b>n){const m=n-b,v=[...h.words,g.slice(0,m)].filter(Boolean);return{length:b,words:v,rest:t.length-v.length}}return{...h,length:b,words:[...h.words,g]}},{length:0,words:[],rest:0})),s=r[r.length-1],l=t[t.length-1].length===s.words[s.words.length-1].length?"":"…",c=s.words.join(", "),u=s.rest>0?`${c}… +${s.rest}`:c+l;return p.jsx(Fe,{...o,children:u})},iW=e=>{const{value:t,maxLength:n,separator:o=",",...r}=e;if(n===0)return p.jsx(Fe,{...r,children:""});const s=t.join("").length;if(n>s)return p.jsx(Fe,{...r,children:t.join(o)});let a=0;const l=t.reduce((y,w)=>{const T=a+w.length,P={low:a,high:T};return a=T,y.push(P),y},[]),c=l.findIndex(y=>y.low<n&&n<=y.high),u=c+1,d=l.length-u,h=l[c].high===n?"":"…",g=u*o.length,b=t.join(o).slice(0,n-1+g),m=d?`+${d}`:"",v=`${b}${h} ${m}`;return p.jsx(Fe,{...r,children:v})},sW=e=>{const{setOpen:t,options:n,onValidate:o,onCancel:r,canValidate:s=!0,confirmAction:a,cancelText:l,validateText:c,...u}=e,[d,f]=te.useState(!1),h=()=>t(!1),g=()=>{f(!1)},b=()=>{r&&r(),h()},m=()=>{if(!a){o&&o(),h();return}d?(f(!1),o&&o(),h()):f(!0)};return p.jsxs(vu,{onClose:b,...u,fullWidth:!0,maxWidth:"md",scroll:"body",children:[p.jsxs(Rp,{sx:I7,children:[n.title,p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:b})]}),p.jsx(je,{sx:{width:"100%"},children:n.content}),p.jsx(j7,{onCancelAction:b,onConfirmAction:m,canValidate:s,cancelText:l,validateText:c}),a&&p.jsx(aW,{openConfirmAction:d,onCancel:g,onValidate:m,confirmAction:a,cancelText:l,validateText:c})]})},aW=e=>{const{confirmAction:t,onCancel:n,onValidate:o,openConfirmAction:r,cancelText:s,validateText:a}=e;return p.jsxs(vu,{open:r,onClose:n,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${qe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},children:[p.jsxs(Rp,{sx:I7,children:[t.title,p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:n})]}),p.jsx(je,{sx:{padding:"32px",width:"100%"},children:t.content}),p.jsx(j7,{onCancelAction:n,onConfirmAction:o,cancelText:t.cancelText??s,validateText:t.validateText??a})]})},j7=e=>{const{onCancelAction:t,onConfirmAction:n,canValidate:o=!0,cancelText:r,validateText:s}=e;return p.jsxs(P6,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${qe[500]}`,minHeight:"68px",paddingInline:"1rem",padding:"28px 32px 32px 32px"},children:[p.jsx(Rt,{variant:"text",onClick:t,children:r}),p.jsx(Rt,{variant:"primary",onClick:n,disabled:!o,children:s})]})},I7={display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${qe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},lW=X(hu)(({theme:e})=>({fontFamily:e.typography.fontFamily,...e.typography.body})),vd=te.forwardRef(function(e){const t=nt(),{sx:n,error:o,...r}=e;return p.jsx(lW,{...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}})}),cW=e=>{const{title:t,unit:n,placeholder:o,value:r,description:s,error:a,required:l,...c}=e,u=l?"*":"",d=nt(),f=te.useRef(!1),h=f.current&&a,[g,b]=te.useState(!1),[m,v]=te.useState(!1),[y,w]=te.useState(!1);te.useEffect(()=>{const R=T(P,e.setMinMaxError);b(R);const E=T(C,e.setMinError);v(E);const _=T(M,e.setMaxError);w(_)},[r]);const T=(R,E)=>{const _=R();return E!==void 0&&E(_),_},P=()=>{if(e.min===void 0&&e.max===void 0||r===void 0||r==="")return!1;const R=Number(r);return!(e.min!==void 0&&R>e.min&&e.max!==void 0&&R<e.max)},C=()=>e.min===void 0||r===void 0||r===""?!1:!(e.min<Number(r)&&e.max===void 0),M=()=>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(Fe,{variant:"h5",children:`${t}${u} :`}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[p.jsx(vd,{...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:R=>{f.current=!0,c.onChange&&c.onChange(R)}}),p.jsx(Fe,{variant:"body",children:n})]}),(!!e.minMaxErrorMessage&&g||!!e.minErrorMessage&&m||!!e.maxErrorMessage&&y)&&p.jsxs(Fe,{variant:"body",style:{color:d.custom.red[600]},children:[!!e.minMaxErrorMessage&&g&&e.minMaxErrorMessage,!!e.minErrorMessage&&m&&e.minErrorMessage,!!e.maxErrorMessage&&y&&e.maxErrorMessage]}),p.jsx(Fe,{variant:"body",children:s})]})},uW=te.forwardRef(function(t){const{title:n,placeholder:o,value:r,description:s,sx:a,error:l,required:c,...u}=t,d=c?"*":"",f=nt(),h=te.useRef(!1),g=h.current&&l;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(Fe,{variant:"h5",children:`${n}${d} :`}),p.jsx(vd,{...u,sx:{width:"70%",borderColor:g?f.custom.red[600]:"inherit",backgroundColor:g?f.custom.red[100]:"inherit",...a},placeholder:o,value:r,onChange:b=>{h.current=!0,u.onChange&&u.onChange(b)}}),p.jsx(Fe,{variant:"body",children:s})]})});function dW(e){return p.jsxs("div",{children:[p.jsx(Fe,{variant:"body-bold",sx:{marginBottom:"16px"},children:e.header}),p.jsxs(lt,{direction:"column",useFlexGap:!0,gap:"12px",children:[p.jsxs(lt,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(ki,{checked:!0,sx:{width:"20px",height:"20px"}}),p.jsx(Fe,{variant:"body",children:e.allText})]}),e.values.map((t,n)=>p.jsxs(lt,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(ki,{checked:!1,sx:{width:"20px",height:"20px"}}),p.jsx(Fe,{variant:"body",children:t})]},n))]})]})}function pW(e){return p.jsxs(lt,{direction:"column",useFlexGap:!0,gap:"12px",alignItems:"flex-start",children:[p.jsx(Fe,{variant:"body-bold",children:e.header}),p.jsx(lt,{direction:"row",useFlexGap:!0,gap:"8px",flexWrap:"wrap",children:e.values.map((t,n)=>p.jsxs(lt,{direction:"row",useFlexGap:!0,gap:"4px",sx:{height:"28px",borderRadius:"4px",background:"#EFEDEC",paddingLeft:"8px"},alignItems:"center",children:[p.jsx(Fe,{variant:"body",children:t}),p.jsx(Kt,{sx:{width:"20px",height:"20px"},children:p.jsx(L4,{sx:{width:"16px",height:"16px"}})})]},n))}),p.jsx(Rt,{variant:"text",startIcon:p.jsx(hV,{}),children:e.addText})]})}const L7=e=>{const t=nt(),{steps:n,currentStep:o=0,icons:r=[],clickable:s=!1,onClick:a}=e;return p.jsxs(je,{display:"inline-flex",position:"relative",children:[p.jsx(lt,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(n??r.length).keys()].map(l=>{const c=l<=o;return p.jsx(ju,{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:s?"pointer":"default","&:hover":s?{fill:"#FFF",color:"#FFF",bgcolor:t.custom.grey[c?2800:2e3]}:{}},onClick:()=>{s&&a&&a(l)},children:r&&r[l]?r[l]:l+1},l)})}),p.jsx(Zo,{sx:{backgroundColor:t.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},A7=e=>x.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"})),V7=e=>x.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"})),F7=e=>{var t;return p.jsxs(lt,{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(fW,{title:e.title,subtitle:e.subtitle}),p.jsx(L7,{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(gW,{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})]})},fW=e=>{const t=nt();return p.jsx(lt,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(lt,{gap:"4px",children:[p.jsx(Fe,{variant:"h3",children:e.title}),e.subtitle&&p.jsx(Fe,{variant:"body",color:t.custom.grey[2e3],children:e.subtitle})]})})},hW=e=>{const t=nt(),n=e.saving?F4:V4,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}}),s=p.jsx(je,{padding:"12px 16px",textAlign:"center",children:p.jsx(Fe,{variant:"body",children:e.saving?e.savingMessage:e.savedMessage})});return p.jsx(Fl,{icon:r,body:s,size:"260px"})},gW=e=>{const t=nt(),n=p.jsx(Rt,{variant:"primary",disabled:e.validateSteps&&!e.validateSteps[e.currentPage],endIcon:p.jsx(A7,{}),onClick:e.onPageForward,children:e.nextPageText}),o=p.jsxs(je,{padding:"12px 16px",children:[p.jsx(Fe,{variant:"body-bold",children:e.warningText||""}),p.jsx("br",{}),p.jsx(Fe,{variant:"body",children:e.validateStepsTexts&&e.validateStepsTexts[e.currentPage]||""})]});return p.jsxs(lt,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(je,{sx:{">*":{display:"flex"}},children:e.savingState&&p.jsx(hW,{...e.savingState})}),p.jsxs(lt,{direction:"row",gap:"20px",children:[e.previousPageText&&p.jsx(Rt,{variant:"text",startIcon:p.jsx(V7,{}),onClick:e.onPageBack,children:e.previousPageText}),e.validateSteps&&!e.validateSteps[e.currentPage]?e.nextPageText&&p.jsx(Fl,{icon:n,body:o,size:"260px"}):e.nextPageText&&n]}),e.closeable&&p.jsx(Rt,{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(A4,{sx:{width:"20px",color:t.custom.grey[2800]}})})]})},Qf=e=>{const t=nt(),{title:n,titleSize:o,badge:r}=e,a=o||"h1";return p.jsxs(lt,{direction:"row",alignItems:"center",gap:"16px",children:[typeof r=="number"?p.jsx(ju,{size:"big",children:r}):p.jsx(lt,{width:"40px",alignItems:"center",color:t.custom.grey[2800],children:p.jsx(lt,{sx:{transform:"scale(250%)"},children:r})}),p.jsx(Fe,{variant:a,children:n})]})},mW=e=>{const{title:t,subtitle:n,pages:o,pageIndexToDisplay:r=0,savingState:s,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(te.Fragment,{children:d},f));return p.jsxs(p.Fragment,{children:[p.jsx(F7,{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:s,navigable:e.navigable,onNavigate:e.onNavigate,closeable:a,onClose:e.onClose}),p.jsx(lt,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(lt,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[c.title&&p.jsx(Qf,{title:c.title,badge:c.icon??r+1}),c.subTitle&&p.jsx(Fe,{variant:"h4",children:c.subTitle}),c.subTitle&&p.jsx(Zo,{}),c.info]}),c.usesBaseLayout===!1?p.jsx(p.Fragment,{children:u}):p.jsx(bW,{children:u})]})})]})},bW=e=>{const{children:t}=e,n=Array.isArray(t)?t:[t];return p.jsx("div",{children:n.map((o,r)=>p.jsx(te.Fragment,{children:o},r))})},vW=({sx:e={},...t})=>p.jsx(je,{sx:{boxShadow:"0px 2px 8px 0px #2A2B270A",border:`1px solid ${qe[500]}`,borderRadius:"16px",backgroundColor:"#FFFFFF",padding:"2rem",height:"fit-content",...e},...t}),xW=e=>{const{title:t,hint:n,indicator:o,children:r,...s}=e;return p.jsx(Jr,{width:"100%",padding:"32px",...s,children:p.jsxs(lt,{gap:"32px",children:[p.jsxs(lt,{direction:"row",alignItems:"start",gap:"32px",children:[p.jsx(Fe,{variant:"h4",flex:1,children:t}),o&&p.jsx(ef,{value:o.value,unit:o.unit,sx:{top:"-12px",right:"-12px"}})]}),p.jsxs(lt,{gap:"24px",children:[r,n&&p.jsx(Z4,{children:p.jsx(je,{dangerouslySetInnerHTML:{__html:n}})})]})]})})},yW=()=>{const[e,t]=te.useState({isLocked:!1}),n=d=>{t({isLocked:!0,message:d})},o=()=>{t({isLocked:!1})},[r,s]=te.useState({isLocked:!1}),a=d=>{s({isLocked:!0,message:d})},l=()=>{s({isLocked:!1})};return{forwardLock:e,lockForward:n,unlockForward:o,previousLock:r,lockPrevious:a,unlockPrevious:l,lockAll:d=>{n(d),a(d)},unlockAll:()=>{o(),l()}}},$7=te.createContext(null),N7=e=>{const{children:t,startingPage:n=0,...o}=e,[r,s]=te.useState(!1),[a,l]=te.useState(!1),[c,u]=te.useState(n),d=e.pages.length,f=e.pages[c]??null,h=yW(),[g,b]=te.useState(!1),m={...o,...h,isSaving:r,setSaving:s,selectedPage:f,selectedPageIndex:c,setPage:u,maxPage:d,formSaved:g,setFormSaved:b,isError:a,setError:l};return p.jsx($7.Provider,{value:m,children:t})},Zi=()=>{const e=te.useContext($7);if(e)return e;throw new Error("useFormBaseContext must be used within an FormBaseContextProvider")},CW=()=>{const{selectedPageIndex:e,setPage:t,onPageChange:n,pages:o,previousLock:r,forwardLock:s,maxPage:a,setFormSaved:l,isLoading:c}=Zi(),u=nt(),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(qa,{}):p.jsxs(je,{display:"inline-flex",position:"relative",children:[p.jsx(lt,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(a)].map((f,h)=>{var T;const g=r.isLocked&&h<e,b=s.isLocked&&h>e,m=g||b,y=h===e?d.selected:d[m?"locked":"default"],w=((T=o[h])==null?void 0:T.icon)??h+1;return p.jsx(ju,{size:"medium",border:`1px solid ${u.custom.grey[500]}`,color:y.color,bgcolor:y.background,sx:{fill:y.color,cursor:m?"default":"pointer","&:hover":{fill:y.hover.color,color:y.hover.color,bgcolor:y.hover.background}},onClick:()=>{h===e||m||(l(!1),t(h),n==null||n(h,e))},children:w},`page-top-display-${h}`)})}),p.jsx(Zo,{sx:{backgroundColor:u.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},wW=()=>{const{textOptions:e,isLoading:t}=Zi(),n=nt();return p.jsx(lt,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(lt,{gap:"4px",children:[p.jsx(Fe,{variant:"h3",children:t?p.jsx(qa,{size:"18px"}):e.title}),e.subtitle&&p.jsx(Fe,{variant:"body",color:n.custom.grey[2e3],children:e.subtitle})]})})};function xd(e){return e.variant==="themed"?p.jsx(H7,{...e}):e.variant==="headless"?p.jsx(e2,{...e}):p.jsx(e2,{...e,variant:"themed"})}const Jf={leftside:{anchorPosition:"left",anchorIndicatorPosition:"calc(100% - (1.5 * 30px))"},rightside:{anchorPosition:"right",anchorIndicatorPosition:"15px"},center:{anchorPosition:"center",anchorIndicatorPosition:"calc(50% - (30px / 2))"}};function H7(e){const t=nt(),n=e.anchorPosition?Jf[e.anchorPosition].anchorPosition:"right",o=e.anchorPosition?Jf[e.anchorPosition].anchorIndicatorPosition:"15px";return p.jsx(_i,{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 e2(e){const t=e.anchorPosition?Jf[e.anchorPosition].anchorPosition:"right";return p.jsx(_i,{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 SW=e=>p.jsxs(je,{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(lt,{direction:"row",useFlexGap:!0,alignContent:"center",justifyContent:"space-between",sx:{padding:"18px 16px"},children:[e.headerIcon??p.jsx(xV,{}),p.jsx(Fe,{variant:"h4",sx:{height:"24px"},children:e.headerText}),p.jsx(Kt,{sx:{padding:"0"},onClick:e.onClose,children:p.jsx(L4,{})})]}),p.jsx(Zo,{}),p.jsx(je,{sx:{padding:"24px",height:"420px",overflow:"auto"},children:e.children}),e.bottomActions&&p.jsx(TW,{onCancel:e.onCancel,onValidate:e.onValidate})]}),TW=e=>{const{t}=Vs();return p.jsxs(p.Fragment,{children:[p.jsx(Zo,{}),p.jsxs(lt,{direction:"row",useFlexGap:!0,justifyContent:"space-between",alignItems:"center",sx:{padding:"20px 32px"},children:[p.jsx(Rt,{variant:"text",onClick:e.onCancel,children:t("Annuler")}),p.jsx(Rt,{variant:"primary",onClick:e.onValidate,children:t("Valider")})]})]})};function PW(e){const t=nt(),{content:n,onChange:o,defaultIndex:r,...s}=e,[a,l]=te.useState(r??0);return p.jsx(Jr,{borderRadius:"12px",boxShadow:"0 4px 20px 0 rgba(81, 78, 78, 0.12)",padding:"24px 28px",...s,children:p.jsx(lt,{gap:"24px",children:n.map((c,u)=>p.jsxs(lt,{gap:"16px",children:[p.jsxs(lt,{gap:"16px",children:[c.header&&p.jsx(Fe,{variant:"h5",children:c.header}),p.jsx(lt,{gap:"12px",children:c.options.map((d,f)=>{const h=d.id===a;return p.jsxs(lt,{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(Fe,{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(bV,{sx:{color:t.palette.primary[600],width:"16px",height:"16px"}})]},f)})})]}),u<n.length-1&&p.jsx(Zo,{color:t.custom.grey[500]})]},u))})})}const MW=e=>{const{size:t,icon:n,body:o}=e,[r,s]=te.useState(null),a=()=>{s(null)},l=u=>{s(u.currentTarget)},c=!!r;return p.jsxs("div",{style:{position:"relative",width:"20px",height:"20px"},onMouseEnter:l,onMouseLeave:a,children:[n,p.jsx(_i,{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})]})},Fl=e=>{const{size:t,icon:n,body:o,leftPosition:r}=e,[s,a]=te.useState(null),l=()=>{a(null)},c=d=>{a(d.currentTarget)},u=!!s;return p.jsxs("div",{style:{position:"relative"},onMouseEnter:c,onMouseLeave:l,children:[n,p.jsx(_i,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:u,anchorEl:s,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})]})},OW=e=>{const{content:t,x:n,y:o,open:r,setOpen:s}=e,a=nt();return p.jsx(_i,{anchorReference:"anchorPosition",anchorPosition:{top:o,left:n},open:r,onClose:()=>s(!1),transformOrigin:{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 ${a.custom.grey[500]}`}}},children:t})},RW=()=>{const e=nt(),{isSaving:t,textOptions:n,isError:o}=Zi(),r=t?F4:o?PV:V4,s=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],...s}}),l=p.jsx(je,{padding:"12px 16px",textAlign:"center",children:p.jsx(Fe,{variant:"body-medium",children:t?n.syncingMessage:o?n.errorDefaultMessage:n.savingDefaultMessage})});return p.jsx(Fl,{icon:a,body:l,size:"260px"})},EW=()=>{const{confirmExit:e,selectedPageIndex:t,setPage:n,maxPage:o,forwardLock:r,previousLock:s,textOptions:a,onClose:l,onValidate:c,onPageChange:u,showSync:d,setFormSaved:f,openConfirmDialog:h,isLoading:g}=Zi(),b=nt(),v=t===o-1&&a.finalPage?a.finalPage:a.nextPage,y=p.jsx(Rt,{variant:"primary",disabled:r.isLocked||g,endIcon:p.jsx(A7,{}),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(je,{padding:"12px 16px",children:[p.jsx(Fe,{variant:"body-bold",children:a.warningText?a.warningText:""}),p.jsx("br",{}),p.jsx(Fe,{variant:"body",children:r.isLocked&&r.message||""})]});return p.jsxs(lt,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(je,{sx:{">*":{display:"flex"}},children:d&&p.jsx(RW,{})}),p.jsxs(lt,{direction:"row",gap:"20px",children:[a.previousPage&&p.jsx(Rt,{sx:{minWidth:"90px"},variant:"text",disabled:s.isLocked||g,startIcon:s.isLocked||g?null:p.jsx(V7,{}),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(Fl,{icon:y,body:w,size:"260px",leftPosition:130}):v&&y]}),l&&p.jsx(Rt,{variant:"white-filled",onClick:e?h:l,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:b.custom.grey[400]},"&:active":{background:b.custom.grey[600]}},children:p.jsx(A4,{sx:{width:"20px",color:b.custom.grey[2800]}})})]})},kW=()=>p.jsxs(je,{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(je,{sx:{gridColumn:"1 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"left"},children:p.jsx(wW,{})}),p.jsx(je,{sx:{gridColumn:"2 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"center"},children:p.jsx(CW,{})}),p.jsx(je,{sx:{gridColumn:"3 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"right"},children:p.jsx(EW,{})})]}),_W=()=>{const{selectedPage:e,selectedPageIndex:t,isLoading:n}=Zi(),o=e.icon??t+1,r=e.title,s=e.subtitle;return n?p.jsx(DW,{}):p.jsx(lt,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(lt,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[r&&p.jsx(Qf,{title:r,badge:o}),s&&p.jsxs(p.Fragment,{children:[p.jsx(Fe,{variant:"h4",children:s}),p.jsx(Zo,{})]})]}),e.content]})})},DW=()=>p.jsx(je,{sx:{marginLeft:"auto",marginRight:"auto",width:"fit-content",marginTop:"5%",marginBottom:"5%"},children:p.jsx(qa,{})}),jW=e=>{const t=nt(),{onClose:n,open:o,confirmOptions:r}=e,s=()=>{r.onConfirm(),n()},a=()=>{r.onCancel(),n()};return p.jsxs(vu,{fullWidth:!0,maxWidth:"xs",open:o,onClose:n,sx:{".MuiPaper-rounded":{borderRadius:"12px"}},children:[p.jsxs(Rp,{sx:{borderBottom:`1px solid ${t.custom.grey[500]}`},children:[p.jsxs(je,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"68px"},children:[p.jsx(Fe,{variant:"h3",children:r.titleText}),p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:n})]}),(r==null?void 0:r.infoText)&&p.jsx(Fe,{sx:{marginBlock:1.5},children:r.infoText})]}),p.jsxs(lt,{flexDirection:"column",alignItems:"center",p:3,gap:"1rem",children:[p.jsx(Rt,{variant:"primary",onClick:s,children:r.confirmText}),p.jsx(Rt,{onClick:a,children:r.cancelText})]})]})},IW=()=>{const{confirmExit:e,formSaved:t}=Zi(),n=o=>{o.preventDefault()};return te.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(kW,{}),p.jsx(_W,{})]})},LW=e=>{const[t,n]=te.useState(!1);return p.jsxs(N7,{...e,openConfirmDialog:()=>n(!0),children:[p.jsx(IW,{}),e.confirmExit&&p.jsx(jW,{open:t,onClose:()=>n(!1),confirmOptions:e.confirmOptions})]})};/**
440
+ `)):Array.isArray(n)?e.push.apply(e,n):Lt(e)||t.unshift(""+n);return t},textSize:function(e,t,n){var o=[].concat(t),r=o.length,s=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=s,{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,s,a,l;for(r=0,a=t.length;r<a;++r)l=t[r],s=n.indexOf(l),s===-1?o.push([l,1]):n.splice(s,1);for(r=0,a=n.length;r<a;++r)o.push([n[r],-1]);return o},rasterize:function(e){return Math.round(e*y7)/y7}};function Kf(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,s=e.y-o,a=Math.sqrt(r*r+s*s);return{x:a?r/a:0,y:a?s/a:-1}}function Pz(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 Mz=0,C7=1,w7=2,S7=4,T7=8;function hd(e,t,n){var o=Mz;return e<n.left?o|=C7:e>n.right&&(o|=w7),t<n.top?o|=T7:t>n.bottom&&(o|=S7),o}function Oz(e,t){for(var n=e.x0,o=e.y0,r=e.x1,s=e.y1,a=hd(n,o,t),l=hd(r,s,t),c,u,d;!(!(a|l)||a&l);)c=a||l,c&T7?(u=n+(r-n)*(t.top-o)/(s-o),d=t.top):c&S7?(u=n+(r-n)*(t.bottom-o)/(s-o),d=t.bottom):c&w7?(d=o+(s-o)*(t.right-n)/(r-n),u=t.right):c&C7&&(d=o+(s-o)*(t.left-n)/(r-n),u=t.left),c===a?(n=u,o=d,a=hd(n,o,t)):(r=u,s=d,l=hd(r,s,t));return{x0:n,x1:r,y0:o,y1:s}}function gd(e,t){var n=t.anchor,o=e,r,s;return t.clamp&&(o=Oz(o,t.area)),n==="start"?(r=o.x0,s=o.y0):n==="end"?(r=o.x1,s=o.y1):(r=(o.x0+o.x1)/2,s=(o.y0+o.y1)/2),Pz(r,s,e.vx,e.vy,t.align)}var md={arc:function(e,t){var n=(e.startAngle+e.endAngle)/2,o=Math.cos(n),r=Math.sin(n),s=e.innerRadius,a=e.outerRadius;return gd({x0:e.x+o*s,y0:e.y+r*s,x1:e.x+o*a,y1:e.y+r*a,vx:o,vy:r},t)},point:function(e,t){var n=Kf(e,t.origin),o=n.x*e.options.radius,r=n.y*e.options.radius;return gd({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=Kf(e,t.origin),o=e.x,r=e.y,s=0,a=0;return e.horizontal?(o=Math.min(e.x,e.base),s=Math.abs(e.base-e.x)):(r=Math.min(e.y,e.base),a=Math.abs(e.base-e.y)),gd({x0:o,y0:r+a,x1:o+s,y1:r,vx:n.x,vy:n.y},t)},fallback:function(e,t){var n=Kf(e,t.origin);return gd({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)}},Vr=Ll.rasterize;function Rz(e){var t=e.borderWidth||0,n=e.padding,o=e.size.height,r=e.size.width,s=-r/2,a=-o/2;return{frame:{x:s-n.left-t,y:a-n.top-t,w:r+n.width+t*2,h:o+n.height+t*2},text:{x:s,y:a,w:r,h:o}}}function Ez(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 kz(e){return e instanceof Wi?md.arc:e instanceof El?md.point:e instanceof kl?md.bar:md.fallback}function _z(e,t,n,o,r,s){var a=Math.PI/2;if(s){var l=Math.min(s,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 Dz(e,t,n){var o=n.backgroundColor,r=n.borderColor,s=n.borderWidth;!o&&(!r||!s)||(e.beginPath(),_z(e,Vr(t.x)+s/2,Vr(t.y)+s/2,Vr(t.w)-s,Vr(t.h)-s,n.borderRadius),e.closePath(),o&&(e.fillStyle=o,e.fill()),r&&s&&(e.strokeStyle=r,e.lineWidth=s,e.lineJoin="miter",e.stroke()))}function jz(e,t,n){var o=n.lineHeight,r=e.w,s=e.x,a=e.y+o/2;return t==="center"?s+=r/2:(t==="end"||t==="right")&&(s+=r),{h:o,w:r,x:s,y:a}}function Iz(e,t,n){var o=e.shadowBlur,r=n.stroked,s=Vr(n.x),a=Vr(n.y),l=Vr(n.w);r&&e.strokeText(t,s,a,l),n.filled&&(o&&r&&(e.shadowBlur=0),e.fillText(t,s,a,l),o&&r&&(e.shadowBlur=o))}function Lz(e,t,n,o){var r=o.textAlign,s=o.color,a=!!s,l=o.font,c=t.length,u=o.textStrokeColor,d=o.textStrokeWidth,f=u&&d,h;if(!(!c||!a&&!f))for(n=jz(n,r,l),e.font=l.string,e.textAlign=r,e.textBaseline="middle",e.shadowBlur=o.textShadowBlur,e.shadowColor=o.textShadowColor,a&&(e.fillStyle=s),f&&(e.lineJoin="round",e.lineWidth=d,e.strokeStyle=u),h=0,c=t.length;h<c;++h)Iz(e,t[h],{stroked:f,filled:a,w:n.w,x:n.x,y:n.y+n.h*h})}var P7=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};fr(P7.prototype,{_modelize:function(e,t,n,o){var r=this,s=r._index,a=Fn(Cn([n.font,{}],o,s)),l=Cn([n.color,Pn.color],o,s);return{align:Cn([n.align,"center"],o,s),anchor:Cn([n.anchor,"center"],o,s),area:o.chart.chartArea,backgroundColor:Cn([n.backgroundColor,null],o,s),borderColor:Cn([n.borderColor,null],o,s),borderRadius:Cn([n.borderRadius,0],o,s),borderWidth:Cn([n.borderWidth,0],o,s),clamp:Cn([n.clamp,!1],o,s),clip:Cn([n.clip,!1],o,s),color:l,display:e,font:a,lines:t,offset:Cn([n.offset,4],o,s),opacity:Cn([n.opacity,1],o,s),origin:Ez(r._el,o),padding:Yn(Cn([n.padding,4],o,s)),positioner:kz(r._el),rotation:Cn([n.rotation,0],o,s)*(Math.PI/180),size:Ll.textSize(r._ctx,t,a),textAlign:Cn([n.textAlign,"start"],o,s),textShadowBlur:Cn([n.textShadowBlur,0],o,s),textShadowColor:Cn([n.textShadowColor,l],o,s),textStrokeColor:Cn([n.textStrokeColor,l],o,s),textStrokeWidth:Cn([n.textStrokeWidth,0],o,s)}},update:function(e){var t=this,n=null,o=null,r=t._index,s=t._config,a,l,c,u=Cn([s.display,!0],e,r);u&&(a=e.dataset.data[r],l=Ot(pn(s.formatter,[a,e]),a),c=Lt(l)?[]:Ll.toTextLines(l),c.length&&(n=t._modelize(u,c,s,e),o=Rz(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,s=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=Ll.bound(0,r.opacity,1),o.translate(Vr(t.x),Vr(t.y)),o.rotate(r.rotation),Dz(o,s.frame,r),Lz(o,r.lines,s.text,r),o.restore())}});var Az=Number.MIN_SAFE_INTEGER||-9007199254740991,Vz=Number.MAX_SAFE_INTEGER||9007199254740991;function Al(e,t,n){var o=Math.cos(n),r=Math.sin(n),s=t.x,a=t.y;return{x:s+o*(e.x-s)-r*(e.y-a),y:a+r*(e.x-s)+o*(e.y-a)}}function M7(e,t){var n=Vz,o=Az,r=t.origin,s,a,l,c,u;for(s=0;s<e.length;++s)a=e[s],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 bd(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 O7=function(){this._rotation=0,this._rect={x:0,y:0,w:0,h:0}};fr(O7.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=Al(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=[bd(t[0],t[1]),bd(t[0],t[3])],r,s,a;for(this._rotation!==e._rotation&&o.push(bd(n[0],n[1]),bd(n[0],n[3])),r=0;r<o.length;++r)if(s=M7(t,o[r]),a=M7(n,o[r]),s.max<a.min||a.max<s.min)return!1;return!0},_points:function(){var e=this,t=e._rect,n=e._rotation,o=e.center();return[Al({x:t.x,y:t.y},o,n),Al({x:t.x+t.w,y:t.y},o,n),Al({x:t.x+t.w,y:t.y+t.h},o,n),Al({x:t.x,y:t.y+t.h},o,n)]}});function R7(e,t,n){var o=t.positioner(e,t),r=o.vx,s=o.vy;if(!r&&!s)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(s));return u*=r*f,d*=s*f,u+=t.offset*r,d+=t.offset*s,{x:o.x+u,y:o.y+d}}function Fz(e,t){var n,o,r,s;for(n=e.length-1;n>=0;--n)for(r=e[n].$layout,o=n-1;o>=0&&r._visible;--o)s=e[o].$layout,s._visible&&r._box.intersects(s._box)&&t(r,s);return e}function $z(e){var t,n,o,r,s,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]}),s=o.geometry(),a=R7(l,o.model(),s),r._box.update(a,s,o.rotation()));return Fz(e,function(c,u){var d=c._hidable,f=u._hidable;d&&f||f?u._visible=!1:d&&(c._visible=!1)})}var Vl={prepare:function(e){var t=[],n,o,r,s,a;for(n=0,r=e.length;n<r;++n)for(o=0,s=e[n].length;o<s;++o)a=e[n][o],t.push(a),a.$layout={_box:new O7,_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,s,a;for(n=0,o=e.length;n<o;++n)r=e[n],s=r.model(),a=r.$layout,a._hidable=s&&s.display==="auto",a._visible=r.visible(),t|=a._hidable;t&&$z(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,s,a,l;for(n=0,o=t.length;n<o;++n)r=t[n],s=r.$layout,s._visible&&(a=r.geometry(),l=R7(r._el,r.model(),a),s._box.update(l,a,r.rotation()),r.draw(e,l))}},Nz=function(e){if(Lt(e))return null;var t=e,n,o,r;if(Ft(e))if(!Lt(e.label))t=e.label;else if(!Lt(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},Hz={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:Nz,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},bo="$datalabels",E7="$default";function Bz(e,t){var n=e.datalabels,o={},r=[],s,a;return n===!1?null:(n===!0&&(n={}),t=fr({},[t,n]),s=t.labels||{},a=Object.keys(s),delete t.labels,a.length?a.forEach(function(l){s[l]&&r.push(fr({},[t,s[l],{_key:l}]))}):r.push(t),o=r.reduce(function(l,c){return sn(c.listeners||{},function(u,d){l[d]=l[d]||{},l[d][c._key||E7]=u}),delete c.listeners,l},{}),{labels:r,listeners:o})}function Xf(e,t,n,o){if(t){var r=n.$context,s=n.$groups,a;t[s._set]&&(a=t[s._set][s._key],a&&pn(a,[r,o])===!0&&(e[bo]._dirty=!0,n.update(r)))}}function zz(e,t,n,o,r){var s,a;!n&&!o||(n?o?n!==o&&(a=s=!0):a=!0:s=!0,a&&Xf(e,t.leave,n,r),s&&Xf(e,t.enter,o,r))}function Wz(e,t){var n=e[bo],o=n._listeners,r,s;if(!(!o.enter&&!o.leave)){if(t.type==="mousemove")s=Vl.lookup(n._labels,t);else if(t.type!=="mouseout")return;r=n._hovered,n._hovered=s,zz(e,o,r,s,t)}}function Uz(e,t){var n=e[bo],o=n._listeners.click,r=o&&Vl.lookup(n._labels,t);r&&Xf(e,o,r,t)}var Zz={id:"datalabels",defaults:Hz,beforeInit:function(e){e[bo]={_actives:[]}},beforeUpdate:function(e){var t=e[bo];t._listened=!1,t._listeners={},t._datasets=[],t._labels=[]},afterDatasetUpdate:function(e,t,n){var o=t.index,r=e[bo],s=r._datasets[o]=[],a=e.isDatasetVisible(o),l=e.data.datasets[o],c=Bz(l,n),u=t.meta.data||[],d=e.ctx,f,h,g,b,m,v,y,w;for(d.save(),f=0,g=u.length;f<g;++f)if(y=u[f],y[bo]=[],a&&y&&e.getDataVisibility(f)&&!y.skip)for(h=0,b=c.labels.length;h<b;++h)m=c.labels[h],v=m._key,w=new P7(m,d,y,f),w.$groups={_set:o,_key:v||E7},w.$context={active:!1,chart:e,dataIndex:f,dataset:l,datasetIndex:o},w.update(w.$context),y[bo].push(w),s.push(w);d.restore(),fr(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[bo]._labels=Vl.prepare(e[bo]._datasets)},afterDatasetsDraw:function(e){Vl.draw(e,e[bo]._labels)},beforeEvent:function(e,t){if(e[bo]._listened){var n=t.event;switch(n.type){case"mousemove":case"mouseout":Wz(e,n);break;case"click":Uz(e,n);break}}},afterEvent:function(e){var t=e[bo],n=t._actives,o=t._actives=e.getActiveElements(),r=Ll.arrayDiff(n,o),s,a,l,c,u,d,f;for(s=0,a=r.length;s<a;++s)if(u=r[s],u[1])for(f=u[0].element[bo]||[],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)&&(Vl.update(t._labels),e.render()),delete t._dirty}};Rl.register(...dz,Zz);const qz=e=>{const t=(r,s,a)=>{var u;if(r===null||!((u=e.values)!=null&&u[r])||s===null||a===null){e.onPointSelection(null);return}const c={point:e.values[r],absoluteCoordinate:{x:s,y:a}};e.onPointSelection(c)},n=nt(),o=Gz({...e,theme:n,updateCurrentSelectedPoint:t});return p.jsxs(je,{sx:{backgroundColor:n.custom.grey[200],borderRadius:"8px",border:`1px solid ${n.custom.grey[500]}`,padding:"12px"},children:[e.y,p.jsx(bz,{...o}),p.jsx(je,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.x})]})},Gz=e=>{const{values:t,color:n,theme:o,updateCurrentSelectedPoint:r,...s}=e;return{...s,data:Yz(t,n),options:Kz(o,t,r)}},k7=(e,t)=>{var s;const n=e.filter(a=>a[t]===Math.max(...e.flatMap(l=>l[t]))),o=((s=n[0])==null?void 0:s[t])??0;let r=o*1.1;if(t==="x"){const l=n.reduce((c,u)=>u.label.length>c.label.length?u:c,n[0]).label.length;r=o+l*o/150}return r<1?r.toFixed(1):Math.ceil(r)},Yz=(e,t)=>({datasets:[{data:e,backgroundColor:t,pointStyle:"circle",pointRadius:8,pointHoverRadius:9}],labels:Array.from(e.map(n=>n.label))}),Kz=(e,t,n)=>({plugins:{datalabels:{color:"#403d58",formatter:function(r){return r.label},align:"right",padding:{left:25},font:{weight:600,size:12,family:e.typography.fontFamily}},tooltip:{enabled:!1},legend:{display:!1,usePointStyle:!0}},scales:{x:{beginAtZero:!0,max:k7(t,"x"),linear:!0,border:{dash:[5,5]}},y:{beginAtZero:!0,linear:!0,max:k7(t,"y"),border:{dash:[5,5]}}},layout:{padding:{left:25,right:25,top:15,bottom:15}},onHover:(r,s)=>{if(r.type==="click"){if(s.length){n(s[0].index,r.x,r.y);return}n(null,null,null)}}}),_7=e=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,fill:"white"}),x.createElement("rect",{x:1,y:1,width:18,height:18,rx:3,stroke:"#D1CFCE",strokeWidth:2})),D7=e=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.createElement("rect",{width:20,height:20,rx:4,fill:"url(#paint0_linear_2034_7850)"}),x.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"}),x.createElement("defs",null,x.createElement("linearGradient",{id:"paint0_linear_2034_7850",x1:7.58928,y1:755124e-13,x2:7.58928,y2:20,gradientUnits:"userSpaceOnUse"},x.createElement("stop",{stopColor:"#484945"}),x.createElement("stop",{offset:1,stopColor:"#2A2B27"})))),Xz=X(ki)(()=>({":hover":{background:qe[400]}})),Qz=e=>{const{values:t,...n}=e,{onChange:o,...r}=n,s=Object.entries(t);return p.jsx(I6,{children:s.map(([a,l],c)=>p.jsx(Ka,{control:p.jsx(Xz,{...r,checkedIcon:p.jsx(D7,{}),icon:p.jsx(_7,{}),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}`))})},Jz=(e,t,n)=>Object.entries(t).flatMap(r=>{const[s,a]=r;if(a.state===!1)return[];const l=Number(s),c=e.find(u=>u.id===l);return c?[c]:[n({id:l,name:a.name})]}),eW=(e,t)=>{const n={};return e.reduce((r,s)=>{const a=t.some(l=>l.id===s.id);return r[s.id]={name:s.name,state:a},r},n)},tW=X(ki)(()=>({":hover":{background:qe[400]}})),nW=e=>{const{values:t,onChange:n,FormGroupProps:o,FormControlLabelProps:r,CheckboxProps:s}=e,a=Object.entries(t);return p.jsx(I6,{...o,children:a.map(([l,c],u)=>p.jsx(Ka,{sx:{gap:"1rem"},checked:c.state,...r,label:c.name,control:p.jsx(tW,{checkedIcon:p.jsx(D7,{}),icon:p.jsx(_7,{}),disableRipple:!0,...s,onChange:(d,f)=>{const h={...t};h[l]={...h[l],name:c.name,state:f},n(h)}})},`${l}-${u}`))})},oW=e=>{const{values:t,selectedItems:n,onChange:o,getId:r=u=>u.id,getName:s=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:s(d),state:g,rawData:d},u},{});return p.jsx(nW,{values:c,onChange:u=>{const d=Object.values(u).flatMap(f=>f.state===!1?[]:f.rawData);return o(d)},...a})},rW=e=>{const{value:t,maxLength:n,...o}=e,r=t.map((d,f)=>t.slice(0,f+1).reduce((h,g)=>{const b=h.length+g.length;if(b>n){const m=n-b,v=[...h.words,g.slice(0,m)].filter(Boolean);return{length:b,words:v,rest:t.length-v.length}}return{...h,length:b,words:[...h.words,g]}},{length:0,words:[],rest:0})),s=r[r.length-1],l=t[t.length-1].length===s.words[s.words.length-1].length?"":"…",c=s.words.join(", "),u=s.rest>0?`${c}… +${s.rest}`:c+l;return p.jsx(Fe,{...o,children:u})},iW=e=>{const{value:t,maxLength:n,separator:o=",",...r}=e;if(n===0)return p.jsx(Fe,{...r,children:""});const s=t.join("").length;if(n>s)return p.jsx(Fe,{...r,children:t.join(o)});let a=0;const l=t.reduce((y,w)=>{const T=a+w.length,P={low:a,high:T};return a=T,y.push(P),y},[]),c=l.findIndex(y=>y.low<n&&n<=y.high),u=c+1,d=l.length-u,h=l[c].high===n?"":"…",g=u*o.length,b=t.join(o).slice(0,n-1+g),m=d?`+${d}`:"",v=`${b}${h} ${m}`;return p.jsx(Fe,{...r,children:v})},sW=e=>{const{setOpen:t,options:n,onValidate:o,onCancel:r,canValidate:s=!0,confirmAction:a,cancelText:l,validateText:c,...u}=e,[d,f]=te.useState(!1),h=()=>t(!1),g=()=>{f(!1)},b=()=>{r&&r(),h()},m=()=>{if(!a){o&&o(),h();return}d?(f(!1),o&&o(),h()):f(!0)};return p.jsxs(vu,{onClose:b,...u,fullWidth:!0,maxWidth:"md",scroll:"body",children:[p.jsxs(Rp,{sx:I7,children:[n.title,p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:b})]}),p.jsx(je,{sx:{width:"100%"},children:n.content}),p.jsx(j7,{onCancelAction:b,onConfirmAction:m,canValidate:s,cancelText:l,validateText:c}),a&&p.jsx(aW,{openConfirmAction:d,onCancel:g,onValidate:m,confirmAction:a,cancelText:l,validateText:c})]})},aW=e=>{const{confirmAction:t,onCancel:n,onValidate:o,openConfirmAction:r,cancelText:s,validateText:a}=e;return p.jsxs(vu,{open:r,onClose:n,sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${qe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},children:[p.jsxs(Rp,{sx:I7,children:[t.title,p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:n})]}),p.jsx(je,{sx:{padding:"32px",width:"100%"},children:t.content}),p.jsx(j7,{onCancelAction:n,onConfirmAction:o,cancelText:t.cancelText??s,validateText:t.validateText??a})]})},j7=e=>{const{onCancelAction:t,onConfirmAction:n,canValidate:o=!0,cancelText:r,validateText:s}=e;return p.jsxs(P6,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:`1px solid ${qe[500]}`,minHeight:"68px",paddingInline:"1rem",padding:"28px 32px 32px 32px"},children:[p.jsx(Rt,{variant:"text",onClick:t,children:r}),p.jsx(Rt,{variant:"primary",onClick:n,disabled:!o,children:s})]})},I7={display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:`1px solid ${qe[500]}`,minHeight:"68px",padding:"28px 27px 28px 32px"},lW=X(hu)(({theme:e})=>({fontFamily:e.typography.fontFamily,...e.typography.body})),vd=te.forwardRef(function(e){const t=nt(),{sx:n,error:o,...r}=e;return p.jsx(lW,{...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}})}),cW=e=>{const{title:t,unit:n,placeholder:o,value:r,description:s,error:a,required:l,...c}=e,u=l?"*":"",d=nt(),f=te.useRef(!1),h=f.current&&a,[g,b]=te.useState(!1),[m,v]=te.useState(!1),[y,w]=te.useState(!1);te.useEffect(()=>{const R=T(P,e.setMinMaxError);b(R);const E=T(C,e.setMinError);v(E);const _=T(M,e.setMaxError);w(_)},[r]);const T=(R,E)=>{const _=R();return E!==void 0&&E(_),_},P=()=>{if(e.min===void 0&&e.max===void 0||r===void 0||r==="")return!1;const R=Number(r);return!(e.min!==void 0&&R>e.min&&e.max!==void 0&&R<e.max)},C=()=>e.min===void 0||r===void 0||r===""?!1:!(e.min<Number(r)&&e.max===void 0),M=()=>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(Fe,{variant:"h5",children:`${t}${u} :`}),p.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"5px"},children:[p.jsx(vd,{...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:R=>{f.current=!0,c.onChange&&c.onChange(R)}}),p.jsx(Fe,{variant:"body",children:n})]}),(!!e.minMaxErrorMessage&&g||!!e.minErrorMessage&&m||!!e.maxErrorMessage&&y)&&p.jsxs(Fe,{variant:"body",style:{color:d.custom.red[600]},children:[!!e.minMaxErrorMessage&&g&&e.minMaxErrorMessage,!!e.minErrorMessage&&m&&e.minErrorMessage,!!e.maxErrorMessage&&y&&e.maxErrorMessage]}),p.jsx(Fe,{variant:"body",children:s})]})},uW=te.forwardRef(function(t){const{title:n,placeholder:o,value:r,description:s,sx:a,error:l,required:c,...u}=t,d=c?"*":"",f=nt(),h=te.useRef(!1),g=h.current&&l;return p.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"10px"},children:[p.jsx(Fe,{variant:"h5",children:`${n}${d} :`}),p.jsx(vd,{...u,sx:{width:"70%",borderColor:g?f.custom.red[600]:"inherit",backgroundColor:g?f.custom.red[100]:"inherit",...a},placeholder:o,value:r,onChange:b=>{h.current=!0,u.onChange&&u.onChange(b)}}),p.jsx(Fe,{variant:"body",children:s})]})});function dW(e){return p.jsxs("div",{children:[p.jsx(Fe,{variant:"body-bold",sx:{marginBottom:"16px"},children:e.header}),p.jsxs(lt,{direction:"column",useFlexGap:!0,gap:"12px",children:[p.jsxs(lt,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(ki,{checked:!0,sx:{width:"20px",height:"20px"}}),p.jsx(Fe,{variant:"body",children:e.allText})]}),e.values.map((t,n)=>p.jsxs(lt,{direction:"row",sx:{height:"20px"},useFlexGap:!0,gap:"12px",justifyContent:"flex-start",children:[p.jsx(ki,{checked:!1,sx:{width:"20px",height:"20px"}}),p.jsx(Fe,{variant:"body",children:t})]},n))]})]})}function pW(e){return p.jsxs(lt,{direction:"column",useFlexGap:!0,gap:"12px",alignItems:"flex-start",children:[p.jsx(Fe,{variant:"body-bold",children:e.header}),p.jsx(lt,{direction:"row",useFlexGap:!0,gap:"8px",flexWrap:"wrap",children:e.values.map((t,n)=>p.jsxs(lt,{direction:"row",useFlexGap:!0,gap:"4px",sx:{height:"28px",borderRadius:"4px",background:"#EFEDEC",paddingLeft:"8px"},alignItems:"center",children:[p.jsx(Fe,{variant:"body",children:t}),p.jsx(Kt,{sx:{width:"20px",height:"20px"},children:p.jsx(L4,{sx:{width:"16px",height:"16px"}})})]},n))}),p.jsx(Rt,{variant:"text",startIcon:p.jsx(hV,{}),children:e.addText})]})}const L7=e=>{const t=nt(),{steps:n,currentStep:o=0,icons:r=[],clickable:s=!1,onClick:a}=e;return p.jsxs(je,{display:"inline-flex",position:"relative",children:[p.jsx(lt,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(n??r.length).keys()].map(l=>{const c=l<=o;return p.jsx(ju,{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:s?"pointer":"default","&:hover":s?{fill:"#FFF",color:"#FFF",bgcolor:t.custom.grey[c?2800:2e3]}:{}},onClick:()=>{s&&a&&a(l)},children:r&&r[l]?r[l]:l+1},l)})}),p.jsx(Zo,{sx:{backgroundColor:t.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},A7=e=>x.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"})),V7=e=>x.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},x.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"})),F7=e=>{var t;return p.jsxs(lt,{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(fW,{title:e.title,subtitle:e.subtitle}),p.jsx(L7,{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(gW,{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})]})},fW=e=>{const t=nt();return p.jsx(lt,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(lt,{gap:"4px",children:[p.jsx(Fe,{variant:"h3",children:e.title}),e.subtitle&&p.jsx(Fe,{variant:"body",color:t.custom.grey[2e3],children:e.subtitle})]})})},hW=e=>{const t=nt(),n=e.saving?F4:V4,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}}),s=p.jsx(je,{padding:"12px 16px",textAlign:"center",children:p.jsx(Fe,{variant:"body",children:e.saving?e.savingMessage:e.savedMessage})});return p.jsx(Fl,{icon:r,body:s,size:"260px"})},gW=e=>{const t=nt(),n=p.jsx(Rt,{variant:"primary",disabled:e.validateSteps&&!e.validateSteps[e.currentPage],endIcon:p.jsx(A7,{}),onClick:e.onPageForward,children:e.nextPageText}),o=p.jsxs(je,{padding:"12px 16px",children:[p.jsx(Fe,{variant:"body-bold",children:e.warningText||""}),p.jsx("br",{}),p.jsx(Fe,{variant:"body",children:e.validateStepsTexts&&e.validateStepsTexts[e.currentPage]||""})]});return p.jsxs(lt,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(je,{sx:{">*":{display:"flex"}},children:e.savingState&&p.jsx(hW,{...e.savingState})}),p.jsxs(lt,{direction:"row",gap:"20px",children:[e.previousPageText&&p.jsx(Rt,{variant:"text",startIcon:p.jsx(V7,{}),onClick:e.onPageBack,children:e.previousPageText}),e.validateSteps&&!e.validateSteps[e.currentPage]?e.nextPageText&&p.jsx(Fl,{icon:n,body:o,size:"260px"}):e.nextPageText&&n]}),e.closeable&&p.jsx(Rt,{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(A4,{sx:{width:"20px",color:t.custom.grey[2800]}})})]})},Qf=e=>{const t=nt(),{title:n,titleSize:o,badge:r}=e,a=o||"h1";return p.jsxs(lt,{direction:"row",alignItems:"center",gap:"16px",children:[typeof r=="number"?p.jsx(ju,{size:"big",children:r}):p.jsx(lt,{width:"40px",alignItems:"center",color:t.custom.grey[2800],children:p.jsx(lt,{sx:{transform:"scale(250%)"},children:r})}),p.jsx(Fe,{variant:a,children:n})]})},mW=e=>{const{title:t,subtitle:n,pages:o,pageIndexToDisplay:r=0,savingState:s,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(te.Fragment,{children:d},f));return p.jsxs(p.Fragment,{children:[p.jsx(F7,{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:s,navigable:e.navigable,onNavigate:e.onNavigate,closeable:a,onClose:e.onClose}),p.jsx(lt,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(lt,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[c.title&&p.jsx(Qf,{title:c.title,badge:c.icon??r+1}),c.subTitle&&p.jsx(Fe,{variant:"h4",children:c.subTitle}),c.subTitle&&p.jsx(Zo,{}),c.info]}),c.usesBaseLayout===!1?p.jsx(p.Fragment,{children:u}):p.jsx(bW,{children:u})]})})]})},bW=e=>{const{children:t}=e,n=Array.isArray(t)?t:[t];return p.jsx("div",{children:n.map((o,r)=>p.jsx(te.Fragment,{children:o},r))})},vW=({sx:e={},...t})=>p.jsx(je,{sx:{boxShadow:"0px 2px 8px 0px #2A2B270A",border:`1px solid ${qe[500]}`,borderRadius:"16px",backgroundColor:"#FFFFFF",padding:"2rem",height:"fit-content",...e},...t}),xW=e=>{const{title:t,hint:n,indicator:o,children:r,...s}=e;return p.jsx(Jr,{width:"100%",padding:"32px",...s,children:p.jsxs(lt,{gap:"32px",children:[p.jsxs(lt,{direction:"row",alignItems:"start",gap:"32px",children:[p.jsx(Fe,{variant:"h4",flex:1,children:t}),o&&p.jsx(ef,{value:o.value,unit:o.unit,sx:{top:"-12px",right:"-12px"}})]}),p.jsxs(lt,{gap:"24px",children:[r,n&&p.jsx(Z4,{children:p.jsx(je,{dangerouslySetInnerHTML:{__html:n}})})]})]})})},yW=()=>{const[e,t]=te.useState({isLocked:!1}),n=d=>{t({isLocked:!0,message:d})},o=()=>{t({isLocked:!1})},[r,s]=te.useState({isLocked:!1}),a=d=>{s({isLocked:!0,message:d})},l=()=>{s({isLocked:!1})};return{forwardLock:e,lockForward:n,unlockForward:o,previousLock:r,lockPrevious:a,unlockPrevious:l,lockAll:d=>{n(d),a(d)},unlockAll:()=>{o(),l()}}},$7=te.createContext(null),N7=e=>{const{children:t,startingPage:n=0,...o}=e,[r,s]=te.useState(!1),[a,l]=te.useState(!1),[c,u]=te.useState(n),d=e.pages.length,f=e.pages[c]??null,h=yW(),[g,b]=te.useState(!1),m={...o,...h,isSaving:r,setSaving:s,selectedPage:f,selectedPageIndex:c,setPage:u,maxPage:d,formSaved:g,setFormSaved:b,isError:a,setError:l};return p.jsx($7.Provider,{value:m,children:t})},Zi=()=>{const e=te.useContext($7);if(e)return e;throw new Error("useFormBaseContext must be used within an FormBaseContextProvider")},CW=()=>{const{selectedPageIndex:e,setPage:t,onPageChange:n,pages:o,previousLock:r,forwardLock:s,maxPage:a,setFormSaved:l,isLoading:c}=Zi(),u=nt(),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(qa,{}):p.jsxs(je,{display:"inline-flex",position:"relative",children:[p.jsx(lt,{direction:"row",gap:"12px",position:"relative",sx:{zIndex:1},children:[...Array(a)].map((f,h)=>{var T;const g=r.isLocked&&h<e,b=s.isLocked&&h>e,m=g||b,y=h===e?d.selected:d[m?"locked":"default"],w=((T=o[h])==null?void 0:T.icon)??h+1;return p.jsx(ju,{size:"medium",border:`1px solid ${u.custom.grey[500]}`,color:y.color,bgcolor:y.background,sx:{fill:y.color,cursor:m?"default":"pointer","&:hover":{fill:y.hover.color,color:y.hover.color,bgcolor:y.hover.background}},onClick:()=>{h===e||m||(l(!1),t(h),n==null||n(h,e))},children:w},`page-top-display-${h}`)})}),p.jsx(Zo,{sx:{backgroundColor:u.custom.grey[500],position:"absolute",inset:`${36/2}px`}})]})},wW=()=>{const{textOptions:e,isLoading:t}=Zi(),n=nt();return p.jsx(lt,{direction:"row",alignItems:"center",justifyContent:"start",marginX:"20px",maxWidth:"33%",children:p.jsxs(lt,{gap:"4px",children:[p.jsx(Fe,{variant:"h3",children:t?p.jsx(qa,{size:"18px"}):e.title}),e.subtitle&&p.jsx(Fe,{variant:"body",color:n.custom.grey[2e3],children:e.subtitle})]})})};function xd(e){return e.variant==="themed"?p.jsx(H7,{...e}):e.variant==="headless"?p.jsx(e2,{...e}):p.jsx(e2,{...e,variant:"themed"})}const Jf={leftside:{anchorPosition:"left",anchorIndicatorPosition:"calc(100% - (1.5 * 30px))"},rightside:{anchorPosition:"right",anchorIndicatorPosition:"15px"},center:{anchorPosition:"center",anchorIndicatorPosition:"calc(50% - (30px / 2))"}};function H7(e){const t=nt(),n=e.anchorPosition?Jf[e.anchorPosition].anchorPosition:"right",o=e.anchorPosition?Jf[e.anchorPosition].anchorIndicatorPosition:"15px";return p.jsx(_i,{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 e2(e){const t=e.anchorPosition?Jf[e.anchorPosition].anchorPosition:"right";return p.jsx(_i,{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 SW=e=>p.jsxs(je,{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(lt,{direction:"row",useFlexGap:!0,alignContent:"center",justifyContent:"space-between",sx:{padding:"18px 16px"},children:[e.headerIcon??p.jsx(xV,{}),p.jsx(Fe,{variant:"h4",sx:{height:"24px"},children:e.headerText}),p.jsx(Kt,{sx:{padding:"0"},onClick:e.onClose,children:p.jsx(L4,{})})]}),p.jsx(Zo,{}),p.jsx(je,{sx:{padding:"24px",height:"420px",overflow:"auto"},children:e.children}),e.bottomActions&&p.jsx(TW,{onCancel:e.onCancel,onValidate:e.onValidate})]}),TW=e=>{const{t}=Vs();return p.jsxs(p.Fragment,{children:[p.jsx(Zo,{}),p.jsxs(lt,{direction:"row",useFlexGap:!0,justifyContent:"space-between",alignItems:"center",sx:{padding:"20px 32px"},children:[p.jsx(Rt,{variant:"text",onClick:e.onCancel,children:t("Annuler")}),p.jsx(Rt,{variant:"primary",onClick:e.onValidate,children:t("Valider")})]})]})};function PW(e){const t=nt(),{content:n,onChange:o,defaultIndex:r,...s}=e,[a,l]=te.useState(r??0);return p.jsx(Jr,{borderRadius:"12px",boxShadow:"0 4px 20px 0 rgba(81, 78, 78, 0.12)",padding:"24px 28px",...s,children:p.jsx(lt,{gap:"24px",children:n.map((c,u)=>p.jsxs(lt,{gap:"16px",children:[p.jsxs(lt,{gap:"16px",children:[c.header&&p.jsx(Fe,{variant:"h5",children:c.header}),p.jsx(lt,{gap:"12px",children:c.options.map((d,f)=>{const h=d.id===a;return p.jsxs(lt,{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(Fe,{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(bV,{sx:{color:t.palette.primary[600],width:"16px",height:"16px"}})]},f)})})]}),u<n.length-1&&p.jsx(Zo,{color:t.custom.grey[500]})]},u))})})}const MW=e=>{const{size:t,icon:n,body:o}=e,[r,s]=te.useState(null),a=()=>{s(null)},l=u=>{s(u.currentTarget)},c=!!r;return p.jsxs("div",{style:{position:"relative",width:"20px",height:"20px"},onMouseEnter:l,onMouseLeave:a,children:[n,p.jsx(_i,{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})]})},Fl=e=>{const{size:t,icon:n,body:o,leftPosition:r}=e,[s,a]=te.useState(null),l=()=>{a(null)},c=d=>{a(d.currentTarget)},u=!!s;return p.jsxs("div",{style:{position:"relative"},onMouseEnter:c,onMouseLeave:l,children:[n,p.jsx(_i,{sx:{pointerEvents:"none",left:"-2.375rem",top:"9px"},open:u,anchorEl:s,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})]})},OW=e=>{const{content:t,x:n,y:o,open:r,setOpen:s,transformOrigin:a}=e,l=nt();return p.jsx(_i,{anchorReference:"anchorPosition",anchorPosition:{top:o,left:n},open:r,onClose:()=>s(!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})},RW=()=>{const e=nt(),{isSaving:t,textOptions:n,isError:o}=Zi(),r=t?F4:o?PV:V4,s=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],...s}}),l=p.jsx(je,{padding:"12px 16px",textAlign:"center",children:p.jsx(Fe,{variant:"body-medium",children:t?n.syncingMessage:o?n.errorDefaultMessage:n.savingDefaultMessage})});return p.jsx(Fl,{icon:a,body:l,size:"260px"})},EW=()=>{const{confirmExit:e,selectedPageIndex:t,setPage:n,maxPage:o,forwardLock:r,previousLock:s,textOptions:a,onClose:l,onValidate:c,onPageChange:u,showSync:d,setFormSaved:f,openConfirmDialog:h,isLoading:g}=Zi(),b=nt(),v=t===o-1&&a.finalPage?a.finalPage:a.nextPage,y=p.jsx(Rt,{variant:"primary",disabled:r.isLocked||g,endIcon:p.jsx(A7,{}),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(je,{padding:"12px 16px",children:[p.jsx(Fe,{variant:"body-bold",children:a.warningText?a.warningText:""}),p.jsx("br",{}),p.jsx(Fe,{variant:"body",children:r.isLocked&&r.message||""})]});return p.jsxs(lt,{direction:"row",alignItems:"center",justifyContent:"end",gap:"28px",children:[p.jsx(je,{sx:{">*":{display:"flex"}},children:d&&p.jsx(RW,{})}),p.jsxs(lt,{direction:"row",gap:"20px",children:[a.previousPage&&p.jsx(Rt,{sx:{minWidth:"90px"},variant:"text",disabled:s.isLocked||g,startIcon:s.isLocked||g?null:p.jsx(V7,{}),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(Fl,{icon:y,body:w,size:"260px",leftPosition:130}):v&&y]}),l&&p.jsx(Rt,{variant:"white-filled",onClick:e?h:l,sx:{minWidth:0,aspectRatio:1,borderRadius:"100%",padding:0,"&:hover":{background:b.custom.grey[400]},"&:active":{background:b.custom.grey[600]}},children:p.jsx(A4,{sx:{width:"20px",color:b.custom.grey[2800]}})})]})},kW=()=>p.jsxs(je,{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(je,{sx:{gridColumn:"1 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"left"},children:p.jsx(wW,{})}),p.jsx(je,{sx:{gridColumn:"2 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"center"},children:p.jsx(CW,{})}),p.jsx(je,{sx:{gridColumn:"3 / 3",gridRow:" 1 / 1",display:"flex",justifyContent:"right"},children:p.jsx(EW,{})})]}),_W=()=>{const{selectedPage:e,selectedPageIndex:t,isLoading:n}=Zi(),o=e.icon??t+1,r=e.title,s=e.subtitle;return n?p.jsx(DW,{}):p.jsx(lt,{direction:"column",alignItems:"center",children:p.jsxs("div",{style:{width:"1024px"},children:[p.jsxs(lt,{direction:"column",marginTop:"44px",marginBottom:"36px",gap:"2rem",children:[r&&p.jsx(Qf,{title:r,badge:o}),s&&p.jsxs(p.Fragment,{children:[p.jsx(Fe,{variant:"h4",children:s}),p.jsx(Zo,{})]})]}),e.content]})})},DW=()=>p.jsx(je,{sx:{marginLeft:"auto",marginRight:"auto",width:"fit-content",marginTop:"5%",marginBottom:"5%"},children:p.jsx(qa,{})}),jW=e=>{const t=nt(),{onClose:n,open:o,confirmOptions:r}=e,s=()=>{r.onConfirm(),n()},a=()=>{r.onCancel(),n()};return p.jsxs(vu,{fullWidth:!0,maxWidth:"xs",open:o,onClose:n,sx:{".MuiPaper-rounded":{borderRadius:"12px"}},children:[p.jsxs(Rp,{sx:{borderBottom:`1px solid ${t.custom.grey[500]}`},children:[p.jsxs(je,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"68px"},children:[p.jsx(Fe,{variant:"h3",children:r.titleText}),p.jsx(Rt,{variant:"text",endIcon:p.jsx(Iu,{}),onClick:n})]}),(r==null?void 0:r.infoText)&&p.jsx(Fe,{sx:{marginBlock:1.5},children:r.infoText})]}),p.jsxs(lt,{flexDirection:"column",alignItems:"center",p:3,gap:"1rem",children:[p.jsx(Rt,{variant:"primary",onClick:s,children:r.confirmText}),p.jsx(Rt,{onClick:a,children:r.cancelText})]})]})},IW=()=>{const{confirmExit:e,formSaved:t}=Zi(),n=o=>{o.preventDefault()};return te.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(kW,{}),p.jsx(_W,{})]})},LW=e=>{const[t,n]=te.useState(!1);return p.jsxs(N7,{...e,openConfirmDialog:()=>n(!0),children:[p.jsx(IW,{}),e.confirmExit&&p.jsx(jW,{open:t,onClose:()=>n(!1),confirmOptions:e.confirmOptions})]})};/**
441
441
  * table-core
442
442
  *
443
443
  * Copyright (c) TanStack
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foodpilot/foods",
3
3
  "private": false,
4
- "version": "0.3.13",
4
+ "version": "0.3.15",
5
5
  "type": "module",
6
6
  "main": "./dist/main.umd.cjs",
7
7
  "module": "./dist/main.js",