"use strict";(globalThis.webpackChunkcomplianz_gdpr=globalThis.webpackChunkcomplianz_gdpr||[]).push([[5279,8432,7660],{95279:(e,t,a)=>{a.r(t),a.d(t,{default:()=>z});var n=a(51609),l=a(86087),d=a(59402),r=a(30020),s=a(1806),o=a(31127),u=a(66212),c=a(92998),D=a(20543),f=a(2118),i=a(19312),y=a(17054),g=a(49317),m=a(53039),p=a(81810),w=a(72346),h=a(45111),b=a(27723),_=a(38432);const z=()=>{const[e,t]=(0,l.useState)(null),a=Boolean(e),z=(0,_.default)((e=>e.startDate)),M=(0,_.default)((e=>e.endDate)),E=(0,_.default)((e=>e.setStartDate)),v=(0,_.default)((e=>e.setEndDate)),k=(0,_.default)((e=>e.range)),A=(0,_.default)((e=>e.setRange)),S={startDate:(0,s.A)(z),endDate:(0,s.A)(M),key:"selection"},C=(0,l.useRef)(0),L=["today","yesterday","last-7-days","last-30-days","last-90-days","last-month","last-year","year-to-date"],R={today:{label:(0,b.__)("Today","complianz-gdpr"),range:()=>({startDate:(0,o.default)(new Date),endDate:(0,u.default)(new Date)})},yesterday:{label:(0,b.__)("Yesterday","complianz-gdpr"),range:()=>({startDate:(0,o.default)((0,c.default)(new Date,-1)),endDate:(0,u.default)((0,c.default)(new Date,-1))})},"last-7-days":{label:(0,b.__)("Last 7 days","complianz-gdpr"),range:()=>({startDate:(0,o.default)((0,c.default)(new Date,-7)),endDate:(0,u.default)((0,c.default)(new Date,-1))})},"last-30-days":{label:(0,b.__)("Last 30 days","complianz-gdpr"),range:()=>({startDate:(0,o.default)((0,c.default)(new Date,-30)),endDate:(0,u.default)((0,c.default)(new Date,-1))})},"last-90-days":{label:(0,b.__)("Last 90 days","complianz-gdpr"),range:()=>({startDate:(0,o.default)((0,c.default)(new Date,-90)),endDate:(0,u.default)((0,c.default)(new Date,-1))})},"last-month":{label:(0,b.__)("Last month","complianz-gdpr"),range:()=>({startDate:(0,D.default)((0,f.default)(new Date,-1)),endDate:(0,i.default)((0,f.default)(new Date,-1))})},"year-to-date":{label:(0,b.__)("Year to date","complianz-gdpr"),range:()=>({startDate:(0,y.A)(new Date),endDate:(0,u.default)(new Date)})},"last-year":{label:(0,b.__)("Last year","complianz-gdpr"),range:()=>({startDate:(0,y.A)((0,g.default)(new Date,-1)),endDate:(0,m.A)((0,g.default)(new Date,-1))})}};function O(e){const t=this.range();return(0,p.default)(e.startDate,t.startDate)&&(0,p.default)(e.endDate,t.endDate)}const T=[];for(const[e,t]of Object.entries(L))t&&(T.push(R[t]),T[T.length-1].isSelected=O);const j=e=>{t(null)},F="MMMM d, yyyy",N=z?(0,w.default)(new Date(z),F):(0,w.default)(defaultStart,F),Y=M?(0,w.default)(new Date(M),F):(0,w.default)(defaultEnd,F);return(0,n.createElement)("div",{className:"cmplz-date-range-container"},(0,n.createElement)("button",{onClick:e=>{t(e.currentTarget)},id:"cmplz-date-range-picker-open-button"},(0,n.createElement)(h.default,{name:"calendar",size:"18"}),"custom"===k&&N+" - "+Y,"custom"!==k&&R[k].label,(0,n.createElement)(h.default,{name:"chevron-down"})),(0,n.createElement)(d.Ay,{anchorEl:e,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},open:a,onClose:j,className:"burst"},(0,n.createElement)("div",{id:"cmplz-date-range-picker-container"},(0,n.createElement)(r.Ur,{ranges:[S],rangeColors:["var(--rsp-brand-primary)"],dateDisplayFormat:F,monthDisplayFormat:"MMMM",onChange:e=>{(e=>{C.current++;let t=(0,w.default)(e.selection.startDate,"yyyy-MM-dd"),a=(0,w.default)(e.selection.endDate,"yyyy-MM-dd"),n="custom";for(const[t,a]of Object.entries(R))a.isSelected(e.selection)&&(n=t);e.selection.startDate,e.selection.endDate,2!==C.current&&t===a&&"custom"===n||(C.current=0,E(t),v(a),A(n),j())})(e)},inputRanges:[],showSelectionPreview:!0,months:2,direction:"horizontal",minDate:new Date(2022,0,1),maxDate:new Date,staticRanges:T}))))}},38432:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});var n=a(81621),l=a(72346),d=a(31127),r=a(979),s=a(66212);const o=(0,n.vt)((e=>({startDate:(0,l.default)((0,d.default)((0,r.A)(new Date,7)),"yyyy-MM-dd"),setStartDate:t=>e((e=>({startDate:t}))),endDate:(0,l.default)((0,s.default)((0,r.A)(new Date,1)),"yyyy-MM-dd"),setEndDate:t=>e((e=>({endDate:t}))),range:"last-7-days",setRange:t=>e((e=>({range:t})))})))}}]);