import{Kt as e,P as t,jt as n,n as r,nt as i}from"./core-CSDCjw7P.js";import{n as a,r as o,t as s}from"./esm-BvxKf1KU.js";var c={parse(e,t){if(e.rrule!=null){let n=l(e,t);if(n)return{typeData:{rruleSet:n.rruleSet,dateEnv:n.isTimeZoneSpecified?void 0:t},allDayGuess:!n.isTimeSpecified,duration:e.duration}}return null},expand(e,n,r){return e.rruleSet.between(t(n.start,-1),t(n.end,1)).map(t=>r.createMarker(e.dateEnv?e.dateEnv.toDate(t):t))}};function l(t,n){let r,i=!1,a=!1;if(typeof t.rrule==`string`){let e=d(t.rrule);r=e.rruleSet,i=e.isTimeSpecified,a=e.isTimeZoneSpecified}if(typeof t.rrule==`object`&&t.rrule){let e=u(t.rrule,n);r=new s,r.rrule(e.rrule),i=e.isTimeSpecified,a=e.isTimeZoneSpecified}let o=[].concat(t.exdate||[]),c=[].concat(t.exrule||[]);for(let t of o){let n=e(t);i||=!n.isTimeUnspecified,a||=n.timeZoneOffset!==null,r.exdate(new Date(n.marker.valueOf()-(n.timeZoneOffset||0)*60*1e3))}for(let e of c){let t=u(e,n);i||=t.isTimeSpecified,a||=t.isTimeZoneSpecified,r.exrule(t.rrule)}return{rruleSet:r,isTimeSpecified:i,isTimeZoneSpecified:a}}function u(t,n){let r=!1,i=!1;function a(t){if(typeof t==`string`){let n=e(t);return n?(r||=!n.isTimeUnspecified,i||=n.timeZoneOffset!==null,new Date(n.marker.valueOf()-(n.timeZoneOffset||0)*60*1e3)):null}return t}return{rrule:new o(Object.assign(Object.assign({},t),{dtstart:a(t.dtstart),until:a(t.until),freq:m(t.freq),wkst:t.wkst==null?(n.weekDow-1+7)%7:m(t.wkst),byweekday:p(t.byweekday)})),isTimeSpecified:r,isTimeZoneSpecified:i}}function d(e){let t=a(e,{forceset:!0}),n=f(e);return Object.assign({rruleSet:t},n)}function f(t){let n=!1,r=!1;function i(t,i,a){let o=e(a);n||=!o.isTimeUnspecified,r||=o.timeZoneOffset!==null}return t.replace(/\b(DTSTART:)([^\n]*)/,i),t.replace(/\b(EXDATE:)([^\n]*)/,i),t.replace(/\b(UNTIL=)([^;\n]*)/,i),{isTimeSpecified:n,isTimeZoneSpecified:r}}function p(e){return Array.isArray(e)?e.map(m):m(e)}function m(e){return typeof e==`string`?o[e.toUpperCase()]:e}var h=r({name:`@fullcalendar/rrule`,recurringTypes:[c],eventRefiners:{rrule:n,exrule:n,exdate:n,duration:i}});export{h as default};