"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react"));function r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){return e&&e.name?e.name.split("_")[1]:""}!function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".rmdp-range-picker-footer{padding:10px;text-align:left}.rtl.rmdp-range-picker-footer{direction:rtl;text-align:right}.rmdp-range-picker-footer h6{font-size:16px;margin:0;white-space:nowrap}.left.rmdp-range-picker-footer h6,.right.rmdp-range-picker-footer h6{flex-direction:row;padding-top:5px;width:100%}.rmdp-cancel{background-color:#bdbcbc;border-radius:50%;color:#fff;cursor:pointer;display:inline-block;font-family:Arial!important;font-size:16px;height:17px;line-height:19px;margin:auto 7px auto 0;text-align:center;transform:rotate(45deg);width:17px}.rtl .rmdp-cancel{margin-left:7px;margin-right:unset}.rmdp-range-picker-footer span{font-size:16px;margin-top:auto}"),exports.default=function(e){var r,a=e.state,o=e.handleChange,i=e.position,c=e.direction,d=void 0===c?["fa","ar"].includes(l(a.date.locale))?"rtl":"ltr":c,s=e.format,u=void 0===s?"rtl"===d?"DD MMMM":"MMMM DD":s,p=e.names,f=e.DatePicker,m=a.selectedDate,g=a.date.locale,y=a.multiple,b=a.range,v=["bottom","top"].includes(i),h={en:{selectedDates:"Selected Dates"+(v?":":""),from:"From:",to:"To:",selectDate:"Select Date",close:"Close",separator:"-"},fa:{selectedDates:"تاریخ انتخابی شما"+(v?":":""),from:"از:",to:"تا:",selectDate:"انتخاب کنید",close:"بستن",separator:"-"}},x=p||h[l(g)]||h.en;return t.default.createElement("div",{className:"rmdp-range-picker-footer ".concat(d," ").concat(i),style:{display:v?"block":"grid",gridTemplateRows:"auto 1fr"}},t.default.createElement("h6",{className:"rmdp-week-day"},x.selectedDates),t.default.createElement("div",{style:{position:"relative",display:"grid"}},y&&b?m.map((function(e,r){return t.default.createElement("div",{key:r},k(e))})):k(m),f&&(null===(r=m)||void 0===r?void 0:r.length)>0&&t.default.createElement("button",{className:"rmdp-button",style:{maxHeight:"30px",position:v?"absolute":"block",right:"0",top:"50%",transform:"translateY(-50%)"},onClick:function(){return f.closeCalendar()}},x.close)));function k(e){var r,n,a,l,o=null===(r=e[0])||void 0===r||null===(n=r.format)||void 0===n?void 0:n.call(r,u),i=null===(a=e[1])||void 0===a||null===(l=a.format)||void 0===l?void 0:l.call(a,u);return t.default.createElement("div",{className:"rmdp-header-values",style:{flex:"1",display:v?"":"grid",margin:"0"}},t.default.createElement("div",{style:{display:"inline-block"}},t.default.createElement("i",{className:"rmdp-cancel",onClick:function(){return D(e[0])}},"+"),t.default.createElement("span",null,x.from," ",null!=o?o:x.selectDate)),v&&t.default.createElement("span",{style:{padding:"0px 10px"}},x.separator),t.default.createElement("div",{style:{display:"inline-block"}},t.default.createElement("i",{className:"rmdp-cancel",onClick:function(){return D(e[1])}},"+"),t.default.createElement("span",null,x.to," ",null!=i?i:x.selectDate)))}function D(e){Array.isArray(m)&&(m=y&&b?m.map((function(t){return t.filter((function(t){return t!==e}))})).filter((function(e){return e.length>0})):m.filter((function(t){return t!==e})),o(m,n(n({},a),{},{selectedDate:m})))}};
