"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("vue"),V=require("../utils/dateUtil.js"),a=require("../utils/miscUtil.js");function h(l,o,s,n){const e=V.getClosingViewDate(l,s,n,1);function t(u){return u(l,o)?"same":u(e,o)?"closing":"far"}switch(s){case"year":return t((u,r)=>V.isSameDecade(n,u,r));case"quarter":case"month":return t((u,r)=>V.isSameYear(n,u,r));default:return t((u,r)=>V.isSameMonth(n,u,r))}}function S(l,o,s,n){const e=a.getValue(l,0),t=a.getValue(l,1);if(o===0)return e;if(e&&t)switch(h(e,t,s,n)){case"same":return e;case"closing":return e;default:return V.getClosingViewDate(t,s,n,-1)}return e}function q({values:l,picker:o,defaultDates:s,generateConfig:n}){const e=i.ref([a.getValue(s,0),a.getValue(s,1)]),t=i.ref(null),u=i.computed(()=>a.getValue(l.value,0)),r=i.computed(()=>a.getValue(l.value,1)),d=c=>e.value[c]?e.value[c]:a.getValue(t.value,c)||S(l.value,c,o.value,n.value)||u.value||r.value||n.value.getNow(),w=i.ref(null),g=i.ref(null);i.watchEffect(()=>{w.value=d(0),g.value=d(1)});function m(c,f){if(c){let v=a.updateValues(t.value,c,f);e.value=a.updateValues(e.value,null,f)||[null,null];const D=(f+1)%2;a.getValue(l.value,D)||(v=a.updateValues(v,c,D)),t.value=v}else(u.value||r.value)&&(t.value=null)}return[w,g,m]}exports.default=q;
