"use strict";(("undefined"!=typeof self?self:this).webpackChunkroomstay=("undefined"!=typeof self?self:this).webpackChunkroomstay||[]).push([[873],{49873:function(e,t,n){n.r(t),n.d(t,{default:function(){return M}});var a=n(87462),r=n(42982),o=n(15861),i=n(70885),c=n(64687),u=n.n(c),s=n(38342),l=n(88144),f=n(27484),d=n.n(f),m=n(67294),v=n(87582),Z=n(73460),h=n(64401),p=n(78886),k=n(30584),y=n(77898),E=n(97754),g=n(84544),w=n(90292),x=n(39605);function M(){var e,t,n=(0,m.useContext)(s.lN),c=(0,m.useContext)(s.g7),f=null!==(e=null!==(t=n.startDate)&&void 0!==t?t:n.currentMonth)&&void 0!==e?e:d()().add(14,"day"),M=(0,l.q_)((function(){return{x:0,config:{mass:1,tension:170,friction:20}}})),b=(0,i.Z)(M,2),N=b[0].x,C=b[1],D=(0,m.useState)(0),S=(0,i.Z)(D,2),P=S[0],A=S[1],T=(0,Z.Z)(),I=(0,i.Z)(T,2),W=(I[0],I[1],(0,m.useState)([])),j=(0,i.Z)(W,2),R=j[0],_=j[1],F=(0,m.useState)(null),z=(0,i.Z)(F,2),B=(z[0],z[1]),L=(0,m.useState)(d()()),q=(0,i.Z)(L,2),J=q[0],G=q[1],H=(0,m.useState)(0),K=(0,i.Z)(H,2),O=K[0],Q=K[1],U=(0,m.useState)(!1),V=(0,i.Z)(U,2);V[0],V[1],(0,m.useEffect)((function(){_(y.ZP.getDaysBetween(d()(),f)),n.startDate&&setTimeout((function(){Y(n.startDate)}),500)}),[]);var X=function(e){e>0&&(e=0),C({x:e}),A(e)},Y=function(e){var t;t=J?Math.abs(Number(e.diff(J,"day"))):Number(e.format("DD")),X(-62*t)},$=function(){var e=(0,o.Z)(u().mark((function e(t){var n,a=arguments;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!(a.length>1&&void 0!==a[1])||a[1],!t.isBefore(d()())){e.next=3;break}return e.abrupt("return");case 3:_((function(e){var a=n?y.ZP.getWeekFrom(t):y.ZP.getWeekTo(t);return n?[].concat((0,r.Z)(e),(0,r.Z)(a)):[].concat((0,r.Z)(a.reverse()),(0,r.Z)(e))}));case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();(0,m.useEffect)((function(){B(R[R.length-1]),G(R[0]),Q(R.length)}),[R]),(0,m.useEffect)((function(){62*O-1e3<=-P&&te()}),[P]);var ee,te=function(){var e=(0,o.Z)(u().mark((function e(){var t;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:$(null!==(t=R[R.length-1])&&void 0!==t?t:f.add(7,"days"));case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),ne=(0,v.c0)((function(e){var t=e.down,n=(0,i.Z)(e.movement,1)[0],a=e.velocity;if(n*=c.screenSize<=w.Z.Medium?(a*=.75)>4?4:a<1?1:a:1,t)C({x:P+n});else{var r=P+n,o=62*O,u=0;if(r>0)u=0;else if(r<-o)u=-o;else{var s=-r/62;u=-62*(r%62>-31?Math.floor(s):Math.ceil(s))}62*O-1e3<=-r&&te(),C({x:u}),A(u)}})),ae=(0,m.useMemo)((function(){return m.createElement(m.Fragment,null,R.map((function(e,t){var n=e.format("D"),a=e.unix();return m.createElement(m.Fragment,null,m.createElement(h.Z,{key:a,text:n,selectable:!0,day:e,displayType:"week",unix:a}))})))}),[R]),re=(ee=Math.floor(P/62),J?J.add(-ee,"day").format("MMMM"):f.format("MMMM"));return m.createElement(m.Fragment,null,m.createElement("div",{className:"diji-calendar-navigation"},m.createElement(p.ZP,{icon:p.Tu.ArrowLeft2,onClick:function(){g.ZP.instance.sendInteraction("Show Previous Week",g.s_.CALENDAR,g._J.DATES),X(P+434)},color:E.Il.White,backgroundColor:E.Il.Navy,borderRadius:"round",size:"24px"}),m.createElement(p.ZP,{icon:p.Tu.ArrowRight2,onClick:function(){g.ZP.instance.sendInteraction("Show Next Week",g.s_.CALENDAR,g._J.DATES),X(P-434)},color:E.Il.White,backgroundColor:E.Il.Navy,borderRadius:"round",size:"24px"})),m.createElement("div",{className:"u-marg-top"},m.createElement(k.xv,{type:k.yG.Body,bold:!0,align:x.P.Center},re)),m.createElement("div",{className:"diji-calendar-week--global-month"},re),m.createElement("div",{className:"diji-calendar-week"},m.createElement("div",(0,a.Z)({className:"diji-calendar-week--track"},ne()),m.createElement(l.q.div,{className:"diji-calendar-week--items",style:{left:N}},ae))))}}}]);