/*! For license information please see dav-settings-personal-availability.js.LICENSE.txt */ !function(){var t,n={13836:function(t,n,e){"use strict";var r=e(20144),a=e(9944),o=e(69643),i=e.n(o),s=e(81063),l=e(4820),d=e(56580),c=e.n(d),u=e(79753),p=e(22200),A=c()((function(t){return l.default.defaults.headers["X-Requested-With"]="XMLHttpRequest",s.getPatcher().patch("request",l.default),s.createClient((0,u.generateRemoteUrl)("dav/".concat(t,"/").concat((0,p.getCurrentUser)().uid)))})),v=e(18350),f=e.n(v),m=(0,e(17499).getLoggerBuilder)().setApp("dav").detectUser().build(),y=e(7582),b=e(245),C=e(72045);function g(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function h(t){for(var n=1;nt.length)&&(n=t.length);for(var e=0,r=new Array(n);e\n\t\t\t\n\t\t\t \n\t\t\t\t\n\t\t\t \n\t\t\t'});case 3:return o=t.sent,t.next=6,(0,y.parseXML)(o.data);case 6:if(i=t.sent){t.next=9;break}return t.abrupt("return",void 0);case 9:if(s=null==i||null===(n=i.multistatus)||void 0===n||null===(e=n.response[0])||void 0===e||null===(r=e.propstat)||void 0===r?void 0:r.prop["calendar-availability"]){t.next=12;break}return t.abrupt("return",void 0);case 12:return l=f().parse(s),d=new(f().Component)(l),c=d.getFirstSubcomponent("vavailability"),(p=d.getFirstSubcomponent("vtimezone"))&&(u=p.getFirstProperty("tzid").getFirstValue()),v=c.getAllSubcomponents("available"),b={MO:[],TU:[],WE:[],TH:[],FR:[],SA:[],SU:[]},v.forEach((function(t){var n=t.getFirstProperty("dtstart").getFirstValue().toJSDate(),e=t.getFirstProperty("dtend").getFirstValue().toJSDate(),r=t.getFirstProperty("rrule");"WEEKLY"===r.getFirstValue().freq?r.getFirstValue().getComponent("BYDAY").forEach((function(t){b[t].push({start:n,end:e})})):m.warn("rrule not supported",{rrule:r.toICALString()})})),t.abrupt("return",{slots:b,timezoneId:u});case 21:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function E(t,n){return _.apply(this,arguments)}function _(){return(_=O(regeneratorRuntime.mark((function t(n,e){var r,a,o,i,s,l,d,c;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=w(Object.keys(n).flatMap((function(t){return n[t].map((function(n){return h(h({},n),{},{day:t})}))}))),(a=new(f().Component)("vcalendar")).addPropertyWithValue("prodid","Nextcloud DAV app"),(o=(0,b.Fq)(e))?(i=new(f().Component)(f().parse(o)),a.addSubcomponent(i)):((s=new(f().Component)("vtimezone")).addPropertyWithValue("tzid",e),a.addSubcomponent(s)),l=new(f().Component)("vavailability"),d=r.reduce((function(t,n){var e,r=[n.start.getHours(),n.start.getMinutes(),n.end.getHours(),n.end.getMinutes()].join("-");return h(h({},t),{},x({},r,[].concat(w(null!==(e=t[r])&&void 0!==e?e:[]),[n])))}),{}),Object.keys(d).map((function(t){var n=d[t],r=n[0].start,a=n[0].end,o=n.map((function(t){return t.day})).filter((function(t,n,e){return e.indexOf(t)===n})),i=new(f().Component)("available");return i.addPropertyWithValue("dtstart",f().Time.fromJSDate(r,!1)).setParameter("tzid",e),i.addPropertyWithValue("dtend",f().Time.fromJSDate(a,!1)).setParameter("tzid",e),i.addPropertyWithValue("uid",(0,C.Z)()),i.addPropertyWithValue("rrule",{freq:"WEEKLY",byday:o}),i})).map(l.addSubcomponent.bind(l)),a.addSubcomponent(l),m.debug("New availability ical created",{asObject:a,asString:a.toString()}),c=A("calendars"),t.next=13,c.customRequest("inbox",{method:"PROPPATCH",data:'\n\t\t\t\n\t\t\t \n\t\t\t\t\n\t\t\t\t '.concat(a.toString(),"\n\t\t\t\t\n\t\t\t \n\t\t\t")});case 13:case"end":return t.stop()}}),t)})))).apply(this,arguments)}var j=e(55586),B=e.n(j),T=e(48254),z=e.n(T);function $(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=new Array(n);e=o)&&Object.keys(r.O).every((function(t){return r.O[t](e[l])}))?e.splice(l--,1):(s=!1,o0&&t[c-1][2]>o;c--)t[c]=t[c-1];t[c]=[e,a,o]},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},r.j=347,function(){r.b=document.baseURI||self.location.href;var t={347:0};r.O.j=function(n){return 0===t[n]};var n=function(n,e){var a,o,i=e[0],s=e[1],l=e[2],d=0;if(i.some((function(n){return 0!==t[n]}))){for(a in s)r.o(s,a)&&(r.m[a]=s[a]);if(l)var c=l(r)}for(n&&n(e);d