import{X as c}from"./index-Bf3Szspx.js";const g="HH:mm";function y(e){return c(e,g)}function p(e){return e==="00:00"?c("23:59:59","HH:mm:ss"):c(e,g)}function S(e,s){const{start:n}=s.parent;if(!n||!e)return!0;const r=y(n),i=p(e);return!r.isAfter(i)}function D({days:e,start:s,end:n},r){if(!r.length)return!1;for(const i of r){const{days:u,start:t,end:o}=i;if(!e.some(m=>u.includes(m)))continue;if(s===t)return!0;const a=c(s,g),f=c(c(t,g)),R=p(n),l=p(o);if(a.isBefore(f)&&R.isAfter(f)||a.isAfter(f)&&a.isBefore(l))return!0}return!1}function I(e){if(!e)return!1;const{days:s,start:n,end:r}=e,i=c().day();return s.includes(i)&&c().isBetween(y(n),p(r))}function B(e,s){if(!e.timeScheduling)return null;const n=e.timeScheduling.ranges.reduce((d,a)=>({...d,[a.id]:a}),{}),r=[];let i=null;const u=e[s]||[],{itemRanges:t}=e.timeScheduling,o=u.find((d,a)=>{if(a===0)return;const f=u[a-1],R=t[d.id]||[],l=t[f.id]||[];return r.push(...l),i=R.find(h=>{const m=n[h];if(m)return D(m,l.map(v=>n[v]).filter(Boolean))}),!!i});return o?{id:o==null?void 0:o.id,rangeId:i}:null}function A(e,s){const n=e.timeScheduling.ranges.reduce((u,t)=>({...u,[t.id]:t}),{});let r=null;return e[s].find(u=>{var o;const t=(o=e.timeScheduling.itemRanges)==null?void 0:o[u.id];return t!=null&&t.length?t.some(d=>I(n[d])):(r||(r=u),!1)})||r}export{I as a,B as b,A as g,D as i,S as v};