"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkQ4WARTDEjs = require('./chunk-Q4WARTDE.js');var _react = require('react');var _drawers = require('@baseapp-frontend/design-system/components/web/drawers');var _utils = require('@baseapp-frontend/utils');var _iconsmaterial = require('@mui/icons-material');var _material = require('@mui/material');var _luxon = require('luxon');var _jsxruntime = require('react/jsx-runtime');function T(e,t){return H(e)||B(e,t)||P(e,t)||L()}function L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P(e,t){if(e){if(typeof e=="string")return _(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,l=Array(t);r<t;r++)l[r]=e[r];return l}function B(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var l,p,u,f,i=[],c=!0,s=!1;try{if(u=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(l=u.call(r)).done)&&(i.push(l.value),i.length!==t);c=!0);}catch(h){s=!0,p=h}finally{try{if(!c&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(s)throw p}}return i}}function H(e){if(Array.isArray(e))return e}var N=function(t){var r=t.fetchParameters,l=t.executeRefetch,p=_react.useState.call(void 0, !1),u=T(p,2),f=u[0],i=u[1],c=_react.useState.call(void 0, null),s=T(c,2),h=s[0],y=s[1],b=_material.useMediaQuery.call(void 0, function(a){return a.breakpoints.down("sm")}),R=function(){return i(!0)},D=function(){return i(!1)},C=function(){return y(null)},m=r.createdFrom,d=r.createdTo,I=m||d,g=function(n){return n?_luxon.DateTime.fromFormat(n,_utils.DATE_FORMAT.api):null},A=function(n){return n?_utils.formatDate.call(void 0, n,{toFormat:_utils.DATE_FORMAT[3]}):null},k=function(){var n=A(m),w=A(d);return m&&d?"".concat(n," - ").concat(w):m?"From ".concat(n):d?"Until ".concat(w):"Period"},E=function(n){b?R():y(n.currentTarget)},F=function(n){return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _material.Typography,{variant:"subtitle1",m:4,align:"center",children:"Period"}),_jsxruntime.jsx.call(void 0, _material.Divider,{sx:{marginBottom:2}}),_jsxruntime.jsx.call(void 0, _chunkQ4WARTDEjs.a,{createdFrom:g(m),createdTo:g(d),executeRefetch:l,onApply:n,onClearFilter:n})]})};return _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment,{children:[_jsxruntime.jsx.call(void 0, _material.Chip,{label:_jsxruntime.jsxs.call(void 0, _material.Box,{sx:{display:"flex",alignItems:"center",gap:1},children:[_jsxruntime.jsx.call(void 0, "span",{children:k()}),_jsxruntime.jsx.call(void 0, _iconsmaterial.KeyboardArrowDown,{color:"action"})]}),onClick:E,variant:I?"filled":"soft",color:"default"}),b?_jsxruntime.jsx.call(void 0, _drawers.SwipeableDrawer,{globalHeight:"auto",open:f,onClose:D,children:F(D)}):_jsxruntime.jsx.call(void 0, _material.Menu,{anchorEl:h,open:!!h,onClose:C,children:_jsxruntime.jsx.call(void 0, _material.Box,{padding:2,children:F(C)})})]})},ae= exports.a =N;exports.a = ae;
//# sourceMappingURL=chunk-3IRWUOJO.js.map