mainstack-design-system 1.24.0 → 1.24.1

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./mainstack-design-system393.cjs"),c=require("./mainstack-design-system402.cjs");require("./mainstack-design-system406.cjs");require("./mainstack-design-system407.cjs");require("./mainstack-design-system408.cjs");require("./mainstack-design-system409.cjs");const o=require("./mainstack-design-system410.cjs"),u=require("./index-Be9vqci0.cjs"),a=(r,t)=>u.formatInTimeZone(r,t,"h:mm a"),x=({slots:r,isLoading:t,error:i,timeZone:m,selectedSlotId:n,onSelect:l})=>t?e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160",children:e.jsx(c.Spinner,{})}):i?e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16",children:e.jsx(d.BodyText,{size:"extrasmall",weight:"regular",className:"mds:text-error",children:i})}):r.length?e.jsx("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:gap-8 mds:overflow-y-auto mds:pr-4",children:r.map(s=>e.jsxs(o.Button,{variant:n===s.id?"primary":"outline",size:"sm",rounded:"md",type:"button",onClick:()=>l(s),"aria-pressed":n===s.id,children:[a(s.start,m)," -"," ",a(s.end,m)]},s.id))}):e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16",children:e.jsx(d.BodyText,{size:"extrasmall",weight:"regular",className:"mds:text-secondary",children:"No available times on this day"})});exports.TimeSlotList=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("./mainstack-design-system393.cjs"),c=require("./mainstack-design-system402.cjs");require("./mainstack-design-system406.cjs");require("./mainstack-design-system407.cjs");require("./mainstack-design-system408.cjs");require("./mainstack-design-system409.cjs");const o=require("./mainstack-design-system410.cjs"),u=require("./index-Be9vqci0.cjs"),a=(r,t)=>u.formatInTimeZone(r,t,"h:mm a"),x=({slots:r,isLoading:t,error:m,timeZone:i,selectedSlotId:n,onSelect:l})=>t?e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160",children:e.jsx(c.Spinner,{})}):m?e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16",children:e.jsx(d.BodyText,{size:"extrasmall",weight:"regular",className:"mds:text-error",children:m})}):r.length?e.jsx("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:gap-8 mds:max-h-420 mds:overflow-y-auto mds:px-16",children:r.map(s=>e.jsxs(o.Button,{variant:n===s.id?"primary":"outline",size:"sm",rounded:"md",type:"button",className:"mds:shrink-0",onClick:()=>l(s),"aria-pressed":n===s.id,children:[a(s.start,i)," -"," ",a(s.end,i)]},s.id))}):e.jsx("div",{className:"mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16",children:e.jsx(d.BodyText,{size:"extrasmall",weight:"regular",className:"mds:text-secondary",children:"No available times on this day"})});exports.TimeSlotList=x;
@@ -1,38 +1,39 @@
1
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
2
- import { BodyText as n } from "./mainstack-design-system393.js";
1
+ import { jsx as m, jsxs as o } from "react/jsx-runtime";
2
+ import { BodyText as a } from "./mainstack-design-system393.js";
3
3
  import { Spinner as c } from "./mainstack-design-system402.js";
4
4
  import "./mainstack-design-system406.js";
5
5
  import "./mainstack-design-system407.js";
6
6
  import "./mainstack-design-system408.js";
7
7
  import "./mainstack-design-system409.js";
8
8
  import { Button as f } from "./mainstack-design-system410.js";
9
- import { f as p } from "./index-CDX3sAyX.js";
10
- const a = (r, s) => p(r, s, "h:mm a"), w = ({
11
- slots: r,
12
- isLoading: s,
9
+ import { f as h } from "./index-CDX3sAyX.js";
10
+ const n = (s, r) => h(s, r, "h:mm a"), w = ({
11
+ slots: s,
12
+ isLoading: r,
13
13
  error: i,
14
14
  timeZone: t,
15
15
  selectedSlotId: d,
16
16
  onSelect: l
17
- }) => s ? /* @__PURE__ */ e("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160", children: /* @__PURE__ */ e(c, {}) }) : i ? /* @__PURE__ */ e("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16", children: /* @__PURE__ */ e(n, { size: "extrasmall", weight: "regular", className: "mds:text-error", children: i }) }) : r.length ? /* @__PURE__ */ e("div", { className: "mds:flex-1 mds:flex mds:flex-col mds:gap-8 mds:overflow-y-auto mds:pr-4", children: r.map((m) => /* @__PURE__ */ o(
17
+ }) => r ? /* @__PURE__ */ m("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160", children: /* @__PURE__ */ m(c, {}) }) : i ? /* @__PURE__ */ m("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16", children: /* @__PURE__ */ m(a, { size: "extrasmall", weight: "regular", className: "mds:text-error", children: i }) }) : s.length ? /* @__PURE__ */ m("div", { className: "mds:flex-1 mds:flex mds:flex-col mds:gap-8 mds:max-h-420 mds:overflow-y-auto mds:px-16", children: s.map((e) => /* @__PURE__ */ o(
18
18
  f,
19
19
  {
20
- variant: d === m.id ? "primary" : "outline",
20
+ variant: d === e.id ? "primary" : "outline",
21
21
  size: "sm",
22
22
  rounded: "md",
23
23
  type: "button",
24
- onClick: () => l(m),
25
- "aria-pressed": d === m.id,
24
+ className: "mds:shrink-0",
25
+ onClick: () => l(e),
26
+ "aria-pressed": d === e.id,
26
27
  children: [
27
- a(m.start, t),
28
+ n(e.start, t),
28
29
  " -",
29
30
  " ",
30
- a(m.end, t)
31
+ n(e.end, t)
31
32
  ]
32
33
  },
33
- m.id
34
- )) }) : /* @__PURE__ */ e("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16", children: /* @__PURE__ */ e(
35
- n,
34
+ e.id
35
+ )) }) : /* @__PURE__ */ m("div", { className: "mds:flex mds:items-center mds:justify-center mds:h-full mds:min-h-160 mds:text-center mds:px-16", children: /* @__PURE__ */ m(
36
+ a,
36
37
  {
37
38
  size: "extrasmall",
38
39
  weight: "regular",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react/jsx-runtime"),H=require("react"),$=require("./mainstack-design-system393.cjs");require("./mainstack-design-system452.cjs");const Z=require("./mainstack-design-system453.cjs"),U=require("./mainstack-design-system454.cjs");require("./mainstack-design-system455.cjs");require("./mainstack-design-system456.cjs");require("./mainstack-design-system457.cjs");require("./mainstack-design-system458.cjs");require("./mainstack-design-system459.cjs");require("./mainstack-design-system403.cjs");require("./mainstack-design-system371.cjs");require("./player-C3k5D-V7.cjs");const J=require("./mainstack-design-system415.cjs"),S=require("./mainstack-design-system416.cjs"),ee=require("./mainstack-design-system417.cjs"),te=require("./mainstack-design-system418.cjs"),f=require("./format-8xxtMKGT.cjs"),d=require("./startOfYear-DrIIMygk.cjs"),re=require("./index-Be9vqci0.cjs"),A=require("./utils-Ch5Y1-k5.cjs");function se(s,e){const r=d.toDate(s,e?.in).getDay();return r===0?7:r}function ne(s,e){const r=oe(e)?new e(0):d.constructFrom(e,0);return r.setFullYear(s.getFullYear(),s.getMonth(),s.getDate()),r.setHours(s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),r}function oe(s){return typeof s=="function"&&s.prototype?.constructor===s}const ae=10;class j{subPriority=0;validate(e,r){return!0}}class ie extends j{constructor(e,r,t,n,o){super(),this.value=e,this.validateValue=r,this.setValue=t,this.priority=n,o&&(this.subPriority=o)}validate(e,r){return this.validateValue(e,this.value,r)}set(e,r,t){return this.setValue(e,r,this.value,t)}}class ce extends j{priority=ae;subPriority=-1;constructor(e,r){super(),this.context=e||(t=>d.constructFrom(r,t))}set(e,r){return r.timestampIsSet?e:d.constructFrom(e,ne(e,this.context))}}class i{run(e,r,t,n){const o=this.parse(e,r,t,n);return o?{setter:new ie(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,r,t){return!0}}class ue extends i{priority=140;parse(e,r,t){switch(r){case"G":case"GG":case"GGG":return t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"});case"GGGGG":return t.era(e,{width:"narrow"});case"GGGG":default:return t.era(e,{width:"wide"})||t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"})}}set(e,r,t){return r.era=t,e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const h={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},T={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function m(s,e){return s&&{value:e(s.value),rest:s.rest}}function l(s,e){const r=e.match(s);return r?{value:parseInt(r[0],10),rest:e.slice(r[0].length)}:null}function g(s,e){const r=e.match(s);if(!r)return null;if(r[0]==="Z")return{value:0,rest:e.slice(1)};const t=r[1]==="+"?1:-1,n=r[2]?parseInt(r[2],10):0,o=r[3]?parseInt(r[3],10):0,c=r[5]?parseInt(r[5],10):0;return{value:t*(n*d.millisecondsInHour+o*d.millisecondsInMinute+c*d.millisecondsInSecond),rest:e.slice(r[0].length)}}function G(s){return l(h.anyDigitsSigned,s)}function w(s,e){switch(s){case 1:return l(h.singleDigit,e);case 2:return l(h.twoDigits,e);case 3:return l(h.threeDigits,e);case 4:return l(h.fourDigits,e);default:return l(new RegExp("^\\d{1,"+s+"}"),e)}}function L(s,e){switch(s){case 1:return l(h.singleDigitSigned,e);case 2:return l(h.twoDigitsSigned,e);case 3:return l(h.threeDigitsSigned,e);case 4:return l(h.fourDigitsSigned,e);default:return l(new RegExp("^-?\\d{1,"+s+"}"),e)}}function Q(s){switch(s){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function X(s,e){const r=e>0,t=r?e:1-e;let n;if(t<=50)n=s||100;else{const o=t+50,c=Math.trunc(o/100)*100,x=s>=o%100;n=s+c-(x?100:0)}return r?n:1-n}function z(s){return s%400===0||s%4===0&&s%100!==0}class le extends i{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,r,t){const n=o=>({year:o,isTwoDigitYear:r==="yy"});switch(r){case"y":return m(w(4,e),n);case"yo":return m(t.ordinalNumber(e,{unit:"year"}),n);default:return m(w(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,t){const n=e.getFullYear();if(t.isTwoDigitYear){const c=X(t.year,n);return e.setFullYear(c,0,1),e.setHours(0,0,0,0),e}const o=!("era"in r)||r.era===1?t.year:1-t.year;return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}}class de extends i{priority=130;parse(e,r,t){const n=o=>({year:o,isTwoDigitYear:r==="YY"});switch(r){case"Y":return m(w(4,e),n);case"Yo":return m(t.ordinalNumber(e,{unit:"year"}),n);default:return m(w(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,t,n){const o=f.getWeekYear(e,n);if(t.isTwoDigitYear){const x=X(t.year,o);return e.setFullYear(x,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),f.startOfWeek(e,n)}const c=!("era"in r)||r.era===1?t.year:1-t.year;return e.setFullYear(c,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),f.startOfWeek(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class we extends i{priority=130;parse(e,r){return L(r==="R"?4:r.length,e)}set(e,r,t){const n=d.constructFrom(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),f.startOfISOWeek(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class fe extends i{priority=130;parse(e,r){return L(r==="u"?4:r.length,e)}set(e,r,t){return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class he extends i{priority=120;parse(e,r,t){switch(r){case"Q":case"QQ":return w(r.length,e);case"Qo":return t.ordinalNumber(e,{unit:"quarter"});case"QQQ":return t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(e,{width:"wide",context:"formatting"})||t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=1&&r<=4}set(e,r,t){return e.setMonth((t-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class me extends i{priority=120;parse(e,r,t){switch(r){case"q":case"qq":return w(r.length,e);case"qo":return t.ordinalNumber(e,{unit:"quarter"});case"qqq":return t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return t.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(e,{width:"wide",context:"standalone"})||t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=1&&r<=4}set(e,r,t){return e.setMonth((t-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class xe extends i{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,r,t){const n=o=>o-1;switch(r){case"M":return m(l(h.month,e),n);case"MM":return m(w(2,e),n);case"Mo":return m(t.ordinalNumber(e,{unit:"month"}),n);case"MMM":return t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return t.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(e,{width:"wide",context:"formatting"})||t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.setMonth(t,1),e.setHours(0,0,0,0),e}}class pe extends i{priority=110;parse(e,r,t){const n=o=>o-1;switch(r){case"L":return m(l(h.month,e),n);case"LL":return m(w(2,e),n);case"Lo":return m(t.ordinalNumber(e,{unit:"month"}),n);case"LLL":return t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return t.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(e,{width:"wide",context:"standalone"})||t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.setMonth(t,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function ye(s,e,r){const t=d.toDate(s,r?.in),n=f.getWeek(t,r)-e;return t.setDate(t.getDate()-n*7),d.toDate(t,r?.in)}class be extends i{priority=100;parse(e,r,t){switch(r){case"w":return l(h.week,e);case"wo":return t.ordinalNumber(e,{unit:"week"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,t,n){return f.startOfWeek(ye(e,t,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function De(s,e,r){const t=d.toDate(s,r?.in),n=f.getISOWeek(t,r)-e;return t.setDate(t.getDate()-n*7),t}class Te extends i{priority=100;parse(e,r,t){switch(r){case"I":return l(h.week,e);case"Io":return t.ordinalNumber(e,{unit:"week"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,t){return f.startOfISOWeek(De(e,t))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const ge=[31,28,31,30,31,30,31,31,30,31,30,31],ke=[31,29,31,30,31,30,31,31,30,31,30,31];class Pe extends i{priority=90;subPriority=1;parse(e,r,t){switch(r){case"d":return l(h.date,e);case"do":return t.ordinalNumber(e,{unit:"date"});default:return w(r.length,e)}}validate(e,r){const t=e.getFullYear(),n=z(t),o=e.getMonth();return n?r>=1&&r<=ke[o]:r>=1&&r<=ge[o]}set(e,r,t){return e.setDate(t),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class _e extends i{priority=90;subpriority=1;parse(e,r,t){switch(r){case"D":case"DD":return l(h.dayOfYear,e);case"Do":return t.ordinalNumber(e,{unit:"date"});default:return w(r.length,e)}}validate(e,r){const t=e.getFullYear();return z(t)?r>=1&&r<=366:r>=1&&r<=365}set(e,r,t){return e.setMonth(0,t),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function R(s,e,r){const t=f.getDefaultOptions(),n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,o=d.toDate(s,r?.in),c=o.getDay(),M=(e%7+7)%7,y=7-n,k=e<0||e>6?e-(c+y)%7:(M+y)%7-(c+y)%7;return A.addDays(o,k,r)}class Me extends i{priority=90;parse(e,r,t){switch(r){case"E":case"EE":case"EEE":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return t.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class qe extends i{priority=90;parse(e,r,t,n){const o=c=>{const x=Math.floor((c-1)/7)*7;return(c+n.weekStartsOn+6)%7+x};switch(r){case"e":case"ee":return m(w(r.length,e),o);case"eo":return m(t.ordinalNumber(e,{unit:"day"}),o);case"eee":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeeee":return t.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Oe extends i{priority=90;parse(e,r,t,n){const o=c=>{const x=Math.floor((c-1)/7)*7;return(c+n.weekStartsOn+6)%7+x};switch(r){case"c":case"cc":return m(w(r.length,e),o);case"co":return m(t.ordinalNumber(e,{unit:"day"}),o);case"ccc":return t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"ccccc":return t.day(e,{width:"narrow",context:"standalone"});case"cccccc":return t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return t.day(e,{width:"wide",context:"standalone"})||t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Ee(s,e,r){const t=d.toDate(s,r?.in),n=se(t,r),o=e-n;return A.addDays(t,o,r)}class Ye extends i{priority=90;parse(e,r,t){const n=o=>o===0?7:o;switch(r){case"i":case"ii":return w(r.length,e);case"io":return t.ordinalNumber(e,{unit:"day"});case"iii":return m(t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return m(t.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return m(t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n);case"iiii":default:return m(t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,r){return r>=1&&r<=7}set(e,r,t){return e=Ee(e,t),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class Ie extends i{priority=80;parse(e,r,t){switch(r){case"a":case"aa":case"aaa":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class He extends i{priority=80;parse(e,r,t){switch(r){case"b":case"bb":case"bbb":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class Le extends i{priority=80;parse(e,r,t){switch(r){case"B":case"BB":case"BBB":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class ve extends i{priority=70;parse(e,r,t){switch(r){case"h":return l(h.hour12h,e);case"ho":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=12}set(e,r,t){const n=e.getHours()>=12;return n&&t<12?e.setHours(t+12,0,0,0):!n&&t===12?e.setHours(0,0,0,0):e.setHours(t,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class Ne extends i{priority=70;parse(e,r,t){switch(r){case"H":return l(h.hour23h,e);case"Ho":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=23}set(e,r,t){return e.setHours(t,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class Fe extends i{priority=70;parse(e,r,t){switch(r){case"K":return l(h.hour11h,e);case"Ko":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.getHours()>=12&&t<12?e.setHours(t+12,0,0,0):e.setHours(t,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class Be extends i{priority=70;parse(e,r,t){switch(r){case"k":return l(h.hour24h,e);case"ko":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=24}set(e,r,t){const n=t<=24?t%24:t;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class Qe extends i{priority=60;parse(e,r,t){switch(r){case"m":return l(h.minute,e);case"mo":return t.ordinalNumber(e,{unit:"minute"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,t){return e.setMinutes(t,0,0),e}incompatibleTokens=["t","T"]}class Re extends i{priority=50;parse(e,r,t){switch(r){case"s":return l(h.second,e);case"so":return t.ordinalNumber(e,{unit:"second"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,t){return e.setSeconds(t,0),e}incompatibleTokens=["t","T"]}class Ce extends i{priority=30;parse(e,r){const t=n=>Math.trunc(n*Math.pow(10,-r.length+3));return m(w(r.length,e),t)}set(e,r,t){return e.setMilliseconds(t),e}incompatibleTokens=["t","T"]}class We extends i{priority=10;parse(e,r){switch(r){case"X":return g(T.basicOptionalMinutes,e);case"XX":return g(T.basic,e);case"XXXX":return g(T.basicOptionalSeconds,e);case"XXXXX":return g(T.extendedOptionalSeconds,e);case"XXX":default:return g(T.extended,e)}}set(e,r,t){return r.timestampIsSet?e:d.constructFrom(e,e.getTime()-f.getTimezoneOffsetInMilliseconds(e)-t)}incompatibleTokens=["t","T","x"]}class Ae extends i{priority=10;parse(e,r){switch(r){case"x":return g(T.basicOptionalMinutes,e);case"xx":return g(T.basic,e);case"xxxx":return g(T.basicOptionalSeconds,e);case"xxxxx":return g(T.extendedOptionalSeconds,e);case"xxx":default:return g(T.extended,e)}}set(e,r,t){return r.timestampIsSet?e:d.constructFrom(e,e.getTime()-f.getTimezoneOffsetInMilliseconds(e)-t)}incompatibleTokens=["t","T","X"]}class je extends i{priority=40;parse(e){return G(e)}set(e,r,t){return[d.constructFrom(e,t*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class Ge extends i{priority=20;parse(e){return G(e)}set(e,r,t){return[d.constructFrom(e,t),{timestampIsSet:!0}]}incompatibleTokens="*"}const Xe={G:new ue,y:new le,Y:new de,R:new we,u:new fe,Q:new he,q:new me,M:new xe,L:new pe,w:new be,I:new Te,d:new Pe,D:new _e,E:new Me,e:new qe,c:new Oe,i:new Ye,a:new Ie,b:new He,B:new Le,h:new ve,H:new Ne,K:new Fe,k:new Be,m:new Qe,s:new Re,S:new Ce,X:new We,x:new Ae,t:new je,T:new Ge},ze=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ve=/^'([^]*?)'?$/,$e=/''/g,Ze=/\S/,Ue=/[a-zA-Z]/;function Je(s,e,r,t){const n=()=>d.constructFrom(r,NaN),o=re.getDefaultOptions(),c=o.locale??f.enUS,x=o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,M=o.weekStartsOn??o.locale?.options?.weekStartsOn??0,y={firstWeekContainsDate:x,weekStartsOn:M,locale:c},k=[new ce(t?.in,r)],v=e.match(Ke).map(a=>{const u=a[0];if(u in f.longFormatters){const b=f.longFormatters[u];return b(a,c.formatLong)}return a}).join("").match(ze),P=[];for(let a of v){f.isProtectedWeekYearToken(a)&&f.warnOrThrowProtectedError(a,e,s),f.isProtectedDayOfYearToken(a)&&f.warnOrThrowProtectedError(a,e,s);const u=a[0],b=Xe[u];if(b){const{incompatibleTokens:Y}=b;if(Array.isArray(Y)){const p=P.find(I=>Y.includes(I.token)||I.token===u);if(p)throw new RangeError(`The format string mustn't contain \`${p.fullToken}\` and \`${a}\` at the same time`)}else if(b.incompatibleTokens==="*"&&P.length>0)throw new RangeError(`The format string mustn't contain \`${a}\` and any other token at the same time`);P.push({token:u,fullToken:a});const O=b.run(s,a,c.match,y);if(!O)return n();k.push(O.setter),s=O.rest}else{if(u.match(Ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");if(a==="''"?a="'":u==="'"&&(a=Se(a)),s.indexOf(a)===0)s=s.slice(a.length);else return n()}}if(s.length>0&&Ze.test(s))return n();const N=k.map(a=>a.priority).sort((a,u)=>u-a).filter((a,u,b)=>b.indexOf(a)===u).map(a=>k.filter(u=>u.priority===a).sort((u,b)=>b.subPriority-u.subPriority)).map(a=>a[0]);let _=d.toDate(r,t?.in);if(isNaN(+_))return n();const q={};for(const a of N){if(!a.validate(_,y))return n();const u=a.set(_,q,y);Array.isArray(u)?(_=u[0],Object.assign(q,u[1])):_=u}return _}function Se(s){return s.match(Ve)[1].replace($e,"'")}const C="yyyy-MM-dd",E=s=>Je(s,C,new Date),B=s=>f.format(s,C),K=s=>{const e=s.find(r=>r.slots.length>0)||s[0];return e?E(e.date):d.startOfDay(new Date)},W=s=>s.map(e=>`${e.date}:${e.slots.map(r=>r.id).join(",")}`).join("|"),et=(s,e)=>{if(!s.length)return d.startOfDay(new Date);const r=E(s[0].date),t=E(s[s.length-1].date),n=d.startOfDay(e),o=s.find(x=>x.date===B(n)),c=n>=r&&n<=t;return o&&c&&o.slots.length>0?n:K(s)},tt=({timezones:s,timeZone:e,onTimeZoneChange:r,days:t,isLoading:n=!1,error:o,onConfirm:c})=>{const[x,M]=H.useState(()=>K(t)),[y,k]=H.useState(null),[v,P]=H.useState(!1),[N,_]=H.useState(()=>W(t)),q=W(t);if(q!==N){const p=et(t,x),I=t.find(F=>F.date===B(p)),V=y!=null&&!!I?.slots.some(F=>F.id===y.id);_(q),M(p),V||(k(null),P(!1))}const a=t.length?E(t[0].date):d.startOfDay(new Date),u=t.length?E(t[t.length-1].date):a,b=new Set(t.filter(p=>p.slots.length>0).map(p=>p.date)),Y=B(x),O=t.find(p=>p.date===Y)?.slots||[];return D.jsxs("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:gap-24",children:[D.jsxs(Z.FormItem,{children:[D.jsx(U.FormLabel,{children:"Time zone"}),D.jsx(J.TimezoneSelect,{timezones:s,value:e,onChange:r})]}),D.jsxs("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:md:flex-row mds:gap-24",children:[D.jsx("div",{className:"mds:flex mds:flex-1 mds:flex-col",children:D.jsx(S.BookingCalendarView,{selected:x,onSelect:p=>{M(p),k(null),P(!1)},minDate:a,maxDate:u,isDateAvailable:p=>b.has(f.format(p,C))})}),D.jsx("div",{className:"mds:flex-1 mds:min-w-0 mds:md:max-w-260 mds:flex mds:flex-col",children:!o&&v&&y?D.jsx(te.BookingConfirmPanel,{slot:y,timeZone:e,onBack:()=>P(!1),onConfirm:c}):D.jsxs("div",{className:"mds:border-1 mds:rounded-16 mds:border-[#EDEFF3] mds:p-16 mds:h-full",children:[D.jsx($.BodyText,{size:"small",weight:"semibold",className:"mds:mb-16 mds:text-center",children:f.format(x,"EEEE MMMM d")}),D.jsx(ee.TimeSlotList,{slots:O,isLoading:n,error:o,timeZone:e,selectedSlotId:y?.id,onSelect:p=>{k(p),P(!0)}})]})})]})]})};exports.BookingScheduler=tt;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("react/jsx-runtime"),H=require("react"),$=require("./mainstack-design-system393.cjs");require("./mainstack-design-system452.cjs");const Z=require("./mainstack-design-system453.cjs"),U=require("./mainstack-design-system454.cjs");require("./mainstack-design-system455.cjs");require("./mainstack-design-system456.cjs");require("./mainstack-design-system457.cjs");require("./mainstack-design-system458.cjs");require("./mainstack-design-system459.cjs");require("./mainstack-design-system403.cjs");require("./mainstack-design-system371.cjs");require("./player-C3k5D-V7.cjs");const J=require("./mainstack-design-system415.cjs"),S=require("./mainstack-design-system416.cjs"),ee=require("./mainstack-design-system417.cjs"),te=require("./mainstack-design-system418.cjs"),f=require("./format-8xxtMKGT.cjs"),d=require("./startOfYear-DrIIMygk.cjs"),re=require("./index-Be9vqci0.cjs"),A=require("./utils-Ch5Y1-k5.cjs");function se(s,e){const r=d.toDate(s,e?.in).getDay();return r===0?7:r}function ne(s,e){const r=oe(e)?new e(0):d.constructFrom(e,0);return r.setFullYear(s.getFullYear(),s.getMonth(),s.getDate()),r.setHours(s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()),r}function oe(s){return typeof s=="function"&&s.prototype?.constructor===s}const ae=10;class j{subPriority=0;validate(e,r){return!0}}class ie extends j{constructor(e,r,t,n,o){super(),this.value=e,this.validateValue=r,this.setValue=t,this.priority=n,o&&(this.subPriority=o)}validate(e,r){return this.validateValue(e,this.value,r)}set(e,r,t){return this.setValue(e,r,this.value,t)}}class ce extends j{priority=ae;subPriority=-1;constructor(e,r){super(),this.context=e||(t=>d.constructFrom(r,t))}set(e,r){return r.timestampIsSet?e:d.constructFrom(e,ne(e,this.context))}}class i{run(e,r,t,n){const o=this.parse(e,r,t,n);return o?{setter:new ie(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,r,t){return!0}}class ue extends i{priority=140;parse(e,r,t){switch(r){case"G":case"GG":case"GGG":return t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"});case"GGGGG":return t.era(e,{width:"narrow"});case"GGGG":default:return t.era(e,{width:"wide"})||t.era(e,{width:"abbreviated"})||t.era(e,{width:"narrow"})}}set(e,r,t){return r.era=t,e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]}const h={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},T={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function m(s,e){return s&&{value:e(s.value),rest:s.rest}}function l(s,e){const r=e.match(s);return r?{value:parseInt(r[0],10),rest:e.slice(r[0].length)}:null}function g(s,e){const r=e.match(s);if(!r)return null;if(r[0]==="Z")return{value:0,rest:e.slice(1)};const t=r[1]==="+"?1:-1,n=r[2]?parseInt(r[2],10):0,o=r[3]?parseInt(r[3],10):0,c=r[5]?parseInt(r[5],10):0;return{value:t*(n*d.millisecondsInHour+o*d.millisecondsInMinute+c*d.millisecondsInSecond),rest:e.slice(r[0].length)}}function G(s){return l(h.anyDigitsSigned,s)}function w(s,e){switch(s){case 1:return l(h.singleDigit,e);case 2:return l(h.twoDigits,e);case 3:return l(h.threeDigits,e);case 4:return l(h.fourDigits,e);default:return l(new RegExp("^\\d{1,"+s+"}"),e)}}function L(s,e){switch(s){case 1:return l(h.singleDigitSigned,e);case 2:return l(h.twoDigitsSigned,e);case 3:return l(h.threeDigitsSigned,e);case 4:return l(h.fourDigitsSigned,e);default:return l(new RegExp("^-?\\d{1,"+s+"}"),e)}}function Q(s){switch(s){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function X(s,e){const r=e>0,t=r?e:1-e;let n;if(t<=50)n=s||100;else{const o=t+50,c=Math.trunc(o/100)*100,x=s>=o%100;n=s+c-(x?100:0)}return r?n:1-n}function z(s){return s%400===0||s%4===0&&s%100!==0}class le extends i{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,r,t){const n=o=>({year:o,isTwoDigitYear:r==="yy"});switch(r){case"y":return m(w(4,e),n);case"yo":return m(t.ordinalNumber(e,{unit:"year"}),n);default:return m(w(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,t){const n=e.getFullYear();if(t.isTwoDigitYear){const c=X(t.year,n);return e.setFullYear(c,0,1),e.setHours(0,0,0,0),e}const o=!("era"in r)||r.era===1?t.year:1-t.year;return e.setFullYear(o,0,1),e.setHours(0,0,0,0),e}}class de extends i{priority=130;parse(e,r,t){const n=o=>({year:o,isTwoDigitYear:r==="YY"});switch(r){case"Y":return m(w(4,e),n);case"Yo":return m(t.ordinalNumber(e,{unit:"year"}),n);default:return m(w(r.length,e),n)}}validate(e,r){return r.isTwoDigitYear||r.year>0}set(e,r,t,n){const o=f.getWeekYear(e,n);if(t.isTwoDigitYear){const x=X(t.year,o);return e.setFullYear(x,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),f.startOfWeek(e,n)}const c=!("era"in r)||r.era===1?t.year:1-t.year;return e.setFullYear(c,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),f.startOfWeek(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]}class we extends i{priority=130;parse(e,r){return L(r==="R"?4:r.length,e)}set(e,r,t){const n=d.constructFrom(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),f.startOfISOWeek(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]}class fe extends i{priority=130;parse(e,r){return L(r==="u"?4:r.length,e)}set(e,r,t){return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]}class he extends i{priority=120;parse(e,r,t){switch(r){case"Q":case"QQ":return w(r.length,e);case"Qo":return t.ordinalNumber(e,{unit:"quarter"});case"QQQ":return t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return t.quarter(e,{width:"narrow",context:"formatting"});case"QQQQ":default:return t.quarter(e,{width:"wide",context:"formatting"})||t.quarter(e,{width:"abbreviated",context:"formatting"})||t.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=1&&r<=4}set(e,r,t){return e.setMonth((t-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]}class me extends i{priority=120;parse(e,r,t){switch(r){case"q":case"qq":return w(r.length,e);case"qo":return t.ordinalNumber(e,{unit:"quarter"});case"qqq":return t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return t.quarter(e,{width:"narrow",context:"standalone"});case"qqqq":default:return t.quarter(e,{width:"wide",context:"standalone"})||t.quarter(e,{width:"abbreviated",context:"standalone"})||t.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=1&&r<=4}set(e,r,t){return e.setMonth((t-1)*3,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]}class xe extends i{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,r,t){const n=o=>o-1;switch(r){case"M":return m(l(h.month,e),n);case"MM":return m(w(2,e),n);case"Mo":return m(t.ordinalNumber(e,{unit:"month"}),n);case"MMM":return t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return t.month(e,{width:"narrow",context:"formatting"});case"MMMM":default:return t.month(e,{width:"wide",context:"formatting"})||t.month(e,{width:"abbreviated",context:"formatting"})||t.month(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.setMonth(t,1),e.setHours(0,0,0,0),e}}class pe extends i{priority=110;parse(e,r,t){const n=o=>o-1;switch(r){case"L":return m(l(h.month,e),n);case"LL":return m(w(2,e),n);case"Lo":return m(t.ordinalNumber(e,{unit:"month"}),n);case"LLL":return t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return t.month(e,{width:"narrow",context:"standalone"});case"LLLL":default:return t.month(e,{width:"wide",context:"standalone"})||t.month(e,{width:"abbreviated",context:"standalone"})||t.month(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.setMonth(t,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]}function ye(s,e,r){const t=d.toDate(s,r?.in),n=f.getWeek(t,r)-e;return t.setDate(t.getDate()-n*7),d.toDate(t,r?.in)}class be extends i{priority=100;parse(e,r,t){switch(r){case"w":return l(h.week,e);case"wo":return t.ordinalNumber(e,{unit:"week"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,t,n){return f.startOfWeek(ye(e,t,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]}function De(s,e,r){const t=d.toDate(s,r?.in),n=f.getISOWeek(t,r)-e;return t.setDate(t.getDate()-n*7),t}class Te extends i{priority=100;parse(e,r,t){switch(r){case"I":return l(h.week,e);case"Io":return t.ordinalNumber(e,{unit:"week"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=53}set(e,r,t){return f.startOfISOWeek(De(e,t))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]}const ge=[31,28,31,30,31,30,31,31,30,31,30,31],ke=[31,29,31,30,31,30,31,31,30,31,30,31];class Pe extends i{priority=90;subPriority=1;parse(e,r,t){switch(r){case"d":return l(h.date,e);case"do":return t.ordinalNumber(e,{unit:"date"});default:return w(r.length,e)}}validate(e,r){const t=e.getFullYear(),n=z(t),o=e.getMonth();return n?r>=1&&r<=ke[o]:r>=1&&r<=ge[o]}set(e,r,t){return e.setDate(t),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]}class _e extends i{priority=90;subpriority=1;parse(e,r,t){switch(r){case"D":case"DD":return l(h.dayOfYear,e);case"Do":return t.ordinalNumber(e,{unit:"date"});default:return w(r.length,e)}}validate(e,r){const t=e.getFullYear();return z(t)?r>=1&&r<=366:r>=1&&r<=365}set(e,r,t){return e.setMonth(0,t),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]}function R(s,e,r){const t=f.getDefaultOptions(),n=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??t.weekStartsOn??t.locale?.options?.weekStartsOn??0,o=d.toDate(s,r?.in),c=o.getDay(),M=(e%7+7)%7,y=7-n,k=e<0||e>6?e-(c+y)%7:(M+y)%7-(c+y)%7;return A.addDays(o,k,r)}class Me extends i{priority=90;parse(e,r,t){switch(r){case"E":case"EE":case"EEE":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return t.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"EEEE":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]}class qe extends i{priority=90;parse(e,r,t,n){const o=c=>{const x=Math.floor((c-1)/7)*7;return(c+n.weekStartsOn+6)%7+x};switch(r){case"e":case"ee":return m(w(r.length,e),o);case"eo":return m(t.ordinalNumber(e,{unit:"day"}),o);case"eee":return t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeeee":return t.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"});case"eeee":default:return t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]}class Oe extends i{priority=90;parse(e,r,t,n){const o=c=>{const x=Math.floor((c-1)/7)*7;return(c+n.weekStartsOn+6)%7+x};switch(r){case"c":case"cc":return m(w(r.length,e),o);case"co":return m(t.ordinalNumber(e,{unit:"day"}),o);case"ccc":return t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"ccccc":return t.day(e,{width:"narrow",context:"standalone"});case"cccccc":return t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"});case"cccc":default:return t.day(e,{width:"wide",context:"standalone"})||t.day(e,{width:"abbreviated",context:"standalone"})||t.day(e,{width:"short",context:"standalone"})||t.day(e,{width:"narrow",context:"standalone"})}}validate(e,r){return r>=0&&r<=6}set(e,r,t,n){return e=R(e,t,n),e.setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]}function Ee(s,e,r){const t=d.toDate(s,r?.in),n=se(t,r),o=e-n;return A.addDays(t,o,r)}class Ye extends i{priority=90;parse(e,r,t){const n=o=>o===0?7:o;switch(r){case"i":case"ii":return w(r.length,e);case"io":return t.ordinalNumber(e,{unit:"day"});case"iii":return m(t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return m(t.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return m(t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n);case"iiii":default:return m(t.day(e,{width:"wide",context:"formatting"})||t.day(e,{width:"abbreviated",context:"formatting"})||t.day(e,{width:"short",context:"formatting"})||t.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,r){return r>=1&&r<=7}set(e,r,t){return e=Ee(e,t),e.setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]}class Ie extends i{priority=80;parse(e,r,t){switch(r){case"a":case"aa":case"aaa":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaa":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]}class He extends i{priority=80;parse(e,r,t){switch(r){case"b":case"bb":case"bbb":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbb":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]}class Le extends i{priority=80;parse(e,r,t){switch(r){case"B":case"BB":case"BBB":return t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return t.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBB":default:return t.dayPeriod(e,{width:"wide",context:"formatting"})||t.dayPeriod(e,{width:"abbreviated",context:"formatting"})||t.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,r,t){return e.setHours(Q(t),0,0,0),e}incompatibleTokens=["a","b","t","T"]}class ve extends i{priority=70;parse(e,r,t){switch(r){case"h":return l(h.hour12h,e);case"ho":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=12}set(e,r,t){const n=e.getHours()>=12;return n&&t<12?e.setHours(t+12,0,0,0):!n&&t===12?e.setHours(0,0,0,0):e.setHours(t,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]}class Ne extends i{priority=70;parse(e,r,t){switch(r){case"H":return l(h.hour23h,e);case"Ho":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=23}set(e,r,t){return e.setHours(t,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]}class Fe extends i{priority=70;parse(e,r,t){switch(r){case"K":return l(h.hour11h,e);case"Ko":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=11}set(e,r,t){return e.getHours()>=12&&t<12?e.setHours(t+12,0,0,0):e.setHours(t,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]}class Be extends i{priority=70;parse(e,r,t){switch(r){case"k":return l(h.hour24h,e);case"ko":return t.ordinalNumber(e,{unit:"hour"});default:return w(r.length,e)}}validate(e,r){return r>=1&&r<=24}set(e,r,t){const n=t<=24?t%24:t;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]}class Qe extends i{priority=60;parse(e,r,t){switch(r){case"m":return l(h.minute,e);case"mo":return t.ordinalNumber(e,{unit:"minute"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,t){return e.setMinutes(t,0,0),e}incompatibleTokens=["t","T"]}class Re extends i{priority=50;parse(e,r,t){switch(r){case"s":return l(h.second,e);case"so":return t.ordinalNumber(e,{unit:"second"});default:return w(r.length,e)}}validate(e,r){return r>=0&&r<=59}set(e,r,t){return e.setSeconds(t,0),e}incompatibleTokens=["t","T"]}class Ce extends i{priority=30;parse(e,r){const t=n=>Math.trunc(n*Math.pow(10,-r.length+3));return m(w(r.length,e),t)}set(e,r,t){return e.setMilliseconds(t),e}incompatibleTokens=["t","T"]}class We extends i{priority=10;parse(e,r){switch(r){case"X":return g(T.basicOptionalMinutes,e);case"XX":return g(T.basic,e);case"XXXX":return g(T.basicOptionalSeconds,e);case"XXXXX":return g(T.extendedOptionalSeconds,e);case"XXX":default:return g(T.extended,e)}}set(e,r,t){return r.timestampIsSet?e:d.constructFrom(e,e.getTime()-f.getTimezoneOffsetInMilliseconds(e)-t)}incompatibleTokens=["t","T","x"]}class Ae extends i{priority=10;parse(e,r){switch(r){case"x":return g(T.basicOptionalMinutes,e);case"xx":return g(T.basic,e);case"xxxx":return g(T.basicOptionalSeconds,e);case"xxxxx":return g(T.extendedOptionalSeconds,e);case"xxx":default:return g(T.extended,e)}}set(e,r,t){return r.timestampIsSet?e:d.constructFrom(e,e.getTime()-f.getTimezoneOffsetInMilliseconds(e)-t)}incompatibleTokens=["t","T","X"]}class je extends i{priority=40;parse(e){return G(e)}set(e,r,t){return[d.constructFrom(e,t*1e3),{timestampIsSet:!0}]}incompatibleTokens="*"}class Ge extends i{priority=20;parse(e){return G(e)}set(e,r,t){return[d.constructFrom(e,t),{timestampIsSet:!0}]}incompatibleTokens="*"}const Xe={G:new ue,y:new le,Y:new de,R:new we,u:new fe,Q:new he,q:new me,M:new xe,L:new pe,w:new be,I:new Te,d:new Pe,D:new _e,E:new Me,e:new qe,c:new Oe,i:new Ye,a:new Ie,b:new He,B:new Le,h:new ve,H:new Ne,K:new Fe,k:new Be,m:new Qe,s:new Re,S:new Ce,X:new We,x:new Ae,t:new je,T:new Ge},ze=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ke=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ve=/^'([^]*?)'?$/,$e=/''/g,Ze=/\S/,Ue=/[a-zA-Z]/;function Je(s,e,r,t){const n=()=>d.constructFrom(r,NaN),o=re.getDefaultOptions(),c=o.locale??f.enUS,x=o.firstWeekContainsDate??o.locale?.options?.firstWeekContainsDate??1,M=o.weekStartsOn??o.locale?.options?.weekStartsOn??0,y={firstWeekContainsDate:x,weekStartsOn:M,locale:c},k=[new ce(t?.in,r)],v=e.match(Ke).map(a=>{const u=a[0];if(u in f.longFormatters){const b=f.longFormatters[u];return b(a,c.formatLong)}return a}).join("").match(ze),P=[];for(let a of v){f.isProtectedWeekYearToken(a)&&f.warnOrThrowProtectedError(a,e,s),f.isProtectedDayOfYearToken(a)&&f.warnOrThrowProtectedError(a,e,s);const u=a[0],b=Xe[u];if(b){const{incompatibleTokens:Y}=b;if(Array.isArray(Y)){const p=P.find(I=>Y.includes(I.token)||I.token===u);if(p)throw new RangeError(`The format string mustn't contain \`${p.fullToken}\` and \`${a}\` at the same time`)}else if(b.incompatibleTokens==="*"&&P.length>0)throw new RangeError(`The format string mustn't contain \`${a}\` and any other token at the same time`);P.push({token:u,fullToken:a});const O=b.run(s,a,c.match,y);if(!O)return n();k.push(O.setter),s=O.rest}else{if(u.match(Ue))throw new RangeError("Format string contains an unescaped latin alphabet character `"+u+"`");if(a==="''"?a="'":u==="'"&&(a=Se(a)),s.indexOf(a)===0)s=s.slice(a.length);else return n()}}if(s.length>0&&Ze.test(s))return n();const N=k.map(a=>a.priority).sort((a,u)=>u-a).filter((a,u,b)=>b.indexOf(a)===u).map(a=>k.filter(u=>u.priority===a).sort((u,b)=>b.subPriority-u.subPriority)).map(a=>a[0]);let _=d.toDate(r,t?.in);if(isNaN(+_))return n();const q={};for(const a of N){if(!a.validate(_,y))return n();const u=a.set(_,q,y);Array.isArray(u)?(_=u[0],Object.assign(q,u[1])):_=u}return _}function Se(s){return s.match(Ve)[1].replace($e,"'")}const C="yyyy-MM-dd",E=s=>Je(s,C,new Date),B=s=>f.format(s,C),K=s=>{const e=s.find(r=>r.slots.length>0)||s[0];return e?E(e.date):d.startOfDay(new Date)},W=s=>s.map(e=>`${e.date}:${e.slots.map(r=>r.id).join(",")}`).join("|"),et=(s,e)=>{if(!s.length)return d.startOfDay(new Date);const r=E(s[0].date),t=E(s[s.length-1].date),n=d.startOfDay(e),o=s.find(x=>x.date===B(n)),c=n>=r&&n<=t;return o&&c&&o.slots.length>0?n:K(s)},tt=({timezones:s,timeZone:e,onTimeZoneChange:r,days:t,isLoading:n=!1,error:o,onConfirm:c})=>{const[x,M]=H.useState(()=>K(t)),[y,k]=H.useState(null),[v,P]=H.useState(!1),[N,_]=H.useState(()=>W(t)),q=W(t);if(q!==N){const p=et(t,x),I=t.find(F=>F.date===B(p)),V=y!=null&&!!I?.slots.some(F=>F.id===y.id);_(q),M(p),V||(k(null),P(!1))}const a=t.length?E(t[0].date):d.startOfDay(new Date),u=t.length?E(t[t.length-1].date):a,b=new Set(t.filter(p=>p.slots.length>0).map(p=>p.date)),Y=B(x),O=t.find(p=>p.date===Y)?.slots||[];return D.jsxs("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:gap-24",children:[D.jsxs(Z.FormItem,{children:[D.jsx(U.FormLabel,{children:"Time zone"}),D.jsx(J.TimezoneSelect,{timezones:s,value:e,onChange:r})]}),D.jsxs("div",{className:"mds:flex-1 mds:flex mds:flex-col mds:md:flex-row mds:gap-24",children:[D.jsx("div",{className:"mds:flex mds:flex-1 mds:flex-col",children:D.jsx(S.BookingCalendarView,{selected:x,onSelect:p=>{M(p),k(null),P(!1)},minDate:a,maxDate:u,isDateAvailable:p=>b.has(f.format(p,C))})}),D.jsx("div",{className:"mds:flex-1 mds:min-w-0 mds:md:max-w-260 mds:flex mds:flex-col",children:!o&&v&&y?D.jsx(te.BookingConfirmPanel,{slot:y,timeZone:e,onBack:()=>P(!1),onConfirm:c}):D.jsxs("div",{className:"mds:border-1 mds:rounded-16 mds:border-[#EDEFF3] mds:py-16 mds:h-full",children:[D.jsx($.BodyText,{size:"small",weight:"semibold",className:"mds:mb-16 mds:text-center",children:f.format(x,"EEEE MMMM d")}),D.jsx(ee.TimeSlotList,{slots:O,isLoading:n,error:o,timeZone:e,selectedSlotId:y?.id,onSelect:p=>{k(p),P(!0)}})]})})]})]})};exports.BookingScheduler=tt;
@@ -1568,7 +1568,7 @@ const X = "yyyy-MM-dd", O = (s) => pt(s, X, /* @__PURE__ */ new Date()), F = (s)
1568
1568
  onBack: () => g(!1),
1569
1569
  onConfirm: c
1570
1570
  }
1571
- ) : /* @__PURE__ */ q("div", { className: "mds:border-1 mds:rounded-16 mds:border-[#EDEFF3] mds:p-16 mds:h-full", children: [
1571
+ ) : /* @__PURE__ */ q("div", { className: "mds:border-1 mds:rounded-16 mds:border-[#EDEFF3] mds:py-16 mds:h-full", children: [
1572
1572
  /* @__PURE__ */ P(
1573
1573
  se,
1574
1574
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mainstack-design-system",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "type": "module",
5
5
  "main": "./dist/mainstack-design-system.cjs",
6
6
  "module": "./dist/mainstack-design-system.js",