/** * angular-bootstrap-calendar - A pure AngularJS bootstrap themed responsive calendar that can display events and has views for year, month, week and day * @version v1.0.0 * @link https://github.com/mattlewis92/angular-bootstrap-calendar * @license MIT */ !function (e, t) { "object" == typeof exports && "object" == typeof module ? module.exports = t(require("angular"), require("moment"), function () { try { return require("interactjs") } catch (e) { } }()) : "function" == typeof define && define.amd ? define(["angular", "moment", "interact"], t) : "object" == typeof exports ? exports.angularBootstrapCalendarModuleName = t(require("angular"), require("moment"), function () { try { return require("interactjs") } catch (e) { } }()) : e.angularBootstrapCalendarModuleName = t(e.angular, e.moment, e.interact) }("undefined" != typeof self ? self : this, function (e, t, n) { return function (e) { function t(a) { if (n[a]) return n[a].exports; var r = n[a] = { i: a, l: !1, exports: {} }; return e[a].call(r.exports, r, r.exports, t), r.l = !0, r.exports } var n = {}; return t.m = e, t.c = n, t.d = function (e, n, a) { t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: a }) }, t.n = function (e) { var n = e && e.__esModule ? function () { return e.default } : function () { return e }; return t.d(n, "a", n), n }, t.o = function (e, t) { return Object.prototype.hasOwnProperty.call(e, t) }, t.p = "", t(t.s = 7) }([function (t, n) { t.exports = e }, function (e, t, n) { function a(e, t) { if (c(e)) return new Date(e.getTime()); if ("string" != typeof e) return new Date(e); var n = t || {}, a = n.additionalDigits; a = null == a ? u : Number(a); var s = r(e), v = i(s.date, a), p = v.year, f = v.restDateString, w = l(f, p); if (w) { var g, y = w.getTime(), h = 0; return s.time && (h = o(s.time)), s.timezone ? g = d(s.timezone) : (g = new Date(y + h).getTimezoneOffset(), g = new Date(y + h + g * m).getTimezoneOffset()), new Date(y + h + g * m) } return new Date(e) } function r(e) { var t, n = {}, a = e.split(p); if (f.test(a[0]) ? (n.date = null, t = a[0]) : (n.date = a[0], t = a[1]), t) { var r = A.exec(t); r ? (n.time = t.replace(r[1], ""), n.timezone = r[1]) : n.time = t } return n } function i(e, t) { var n, a = g[t], r = h[t]; if (n = y.exec(e) || r.exec(e)) { var i = n[1]; return { year: parseInt(i, 10), restDateString: e.slice(i.length) } } if (n = w.exec(e) || a.exec(e)) { var l = n[1]; return { year: 100 * parseInt(l, 10), restDateString: e.slice(l.length) } } return { year: null } } function l(e, t) { if (null === t) return null; var n, a, r, i; if (0 === e.length) return a = new Date(0), a.setUTCFullYear(t), a; if (n = D.exec(e)) return a = new Date(0), r = parseInt(n[1], 10) - 1, a.setUTCFullYear(t, r), a; if (n = S.exec(e)) { a = new Date(0); var l = parseInt(n[1], 10); return a.setUTCFullYear(t, 0, l), a } if (n = b.exec(e)) { a = new Date(0), r = parseInt(n[1], 10) - 1; var o = parseInt(n[2], 10); return a.setUTCFullYear(t, r, o), a } if (n = E.exec(e)) return i = parseInt(n[1], 10) - 1, s(t, i); if (n = x.exec(e)) { i = parseInt(n[1], 10) - 1; return s(t, i, parseInt(n[2], 10) - 1) } return null } function o(e) { var t, n, a; if (t = C.exec(e)) return (n = parseFloat(t[1].replace(",", "."))) % 24 * v; if (t = k.exec(e)) return n = parseInt(t[1], 10), a = parseFloat(t[2].replace(",", ".")), n % 24 * v + a * m; if (t = T.exec(e)) { n = parseInt(t[1], 10), a = parseInt(t[2], 10); var r = parseFloat(t[3].replace(",", ".")); return n % 24 * v + a * m + 1e3 * r } return null } function d(e) { var t, n; return (t = M.exec(e)) ? 0 : (t = V.exec(e)) ? (n = 60 * parseInt(t[2], 10), "+" === t[1] ? -n : n) : (t = $.exec(e), t ? (n = 60 * parseInt(t[2], 10) + parseInt(t[3], 10), "+" === t[1] ? -n : n) : 0) } function s(e, t, n) { t = t || 0, n = n || 0; var a = new Date(0); a.setUTCFullYear(e, 0, 4); var r = a.getUTCDay() || 7, i = 7 * t + n + 1 - r; return a.setUTCDate(a.getUTCDate() + i), a } var c = n(5), v = 36e5, m = 6e4, u = 2, p = /[T ]/, f = /:/, w = /^(\d{2})$/, g = [/^([+-]\d{2})$/, /^([+-]\d{3})$/, /^([+-]\d{4})$/], y = /^(\d{4})/, h = [/^([+-]\d{4})/, /^([+-]\d{5})/, /^([+-]\d{6})/], D = /^-(\d{2})$/, S = /^-?(\d{3})$/, b = /^-?(\d{2})-?(\d{2})$/, E = /^-?W(\d{2})$/, x = /^-?W(\d{2})-?(\d{1})$/, C = /^(\d{2}([.,]\d*)?)$/, k = /^(\d{2}):?(\d{2}([.,]\d*)?)$/, T = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/, A = /([Z+-].*)$/, M = /^(Z)$/, V = /^([+-])(\d{2})$/, $ = /^([+-])(\d{2}):?(\d{2})$/; e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e).getTime(), a = Number(t); return new Date(n + a) } var r = n(1); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e); return t.setHours(0, 0, 0, 0), t } var r = n(1); e.exports = a }, function (e, t, n) { "use strict"; function a(e) { var t = e.startDate, n = e.seconds, a = e.excluded, i = e.precision, l = void 0 === i ? "days" : i; if (a.length < 1) return 0; for (var o = x()(t, n - 1), d = H()(t), s = H()(x()(o, 0)), c = 0, v = t; v < o;)!function () { var e = H()(v); a.some(function (t) { return t === e }) && (c += r({ dayStart: d, dayEnd: s, day: e, precision: l, startDate: t, endDate: o })), v = y()(v, 1) }(); return c } function r(e) { var t = e.precision, n = e.day, a = e.dayStart, r = e.dayEnd, i = e.startDate, l = e.endDate; if ("minutes" === t) { if (n === a) return V()(O()(i), i) + 1; if (n === r) return V()(l, ee()(l)) + 1 } return ve } function i(e) { var t = e.event, n = e.offset, r = e.startOfWeekDate, i = e.excluded, l = e.precision, o = void 0 === l ? "days" : l, d = ve, s = _()(t.start, r); if (t.end) switch (o) { case "minutes": d = V()(t.end, s); break; default: d = k()(y()(t.end, 1), s) * ve }var c = n * ve; return c + d > me && (d = me - c), (d -= a({ startDate: s, seconds: d, excluded: i, precision: o })) / ve } function l(e) { var t = e.event, n = e.startOfWeek, r = e.excluded, i = void 0 === r ? [] : r, l = e.precision, o = void 0 === l ? "days" : l; if (t.start < n) return 0; var d = 0; switch (o) { case "days": d = k()(ee()(t.start), n) * ve; break; case "minutes": d = V()(t.start, n) }return (d -= a({ startDate: n, seconds: d, excluded: i, precision: o })) / ve } function o(e) { var t = e.event, n = e.periodStart, a = e.periodEnd, r = t.start, i = t.end || t.start; return r > n && r < a || (i > n && i < a || (r < n && i > a || (!(!G()(r, n) && !G()(r, a)) || !(!G()(i, n) && !G()(i, a))))) } function d(e) { var t = e.events, n = e.periodStart, a = e.periodEnd; return t.filter(function (e) { return o({ event: e, periodStart: n, periodEnd: a }) }) } function s(e) { var t = e.date, n = e.weekendDays, a = void 0 === n ? oe : n, r = ee()(new Date); return { date: t, isPast: t < r, isToday: U()(t, r), isFuture: t > r, isWeekend: a.indexOf(H()(t)) > -1 } } function c(e) { for (var t = e.viewDate, n = e.weekStartsOn, a = e.excluded, r = void 0 === a ? [] : a, i = e.weekendDays, l = le()(t, { weekStartsOn: n }), o = [], d = 0; d < de; d++)!function (e) { var t = y()(l, e); r.some(function (e) { return t.getDay() === e }) || o.push(s({ date: t, weekendDays: i })) }(d); return o } function v(e) { var t = e.events, n = void 0 === t ? [] : t, a = e.viewDate, r = e.weekStartsOn, o = e.excluded, s = void 0 === o ? [] : o, c = e.precision, v = void 0 === c ? "days" : c, m = e.absolutePositionedEvents, u = void 0 !== m && m; n || (n = []); var p = le()(a, { weekStartsOn: r }), f = W()(a, { weekStartsOn: r }), w = de - s.length, g = d({ events: n, periodStart: p, periodEnd: f }).map(function (e) { var t = l({ event: e, startOfWeek: p, excluded: s, precision: v }); return { event: e, offset: t, span: i({ event: e, offset: t, startOfWeekDate: p, excluded: s, precision: v }) } }).filter(function (e) { return e.offset < w }).filter(function (e) { return e.span > 0 }).map(function (e) { return { event: e.event, offset: e.offset, span: e.span, startsBeforeWeek: e.event.start < p, endsAfterWeek: (e.event.end || e.event.start) > f } }).sort(function (e, t) { var n = V()(e.event.start, t.event.start); return 0 === n ? V()(t.event.end || t.event.start, e.event.end || e.event.start) : n }), y = [], h = []; return g.forEach(function (e, t) { if (-1 === h.indexOf(e)) { h.push(e); var n = e.span + e.offset, a = g.slice(t + 1).filter(function (e) { if (e.offset >= n && n + e.span <= de && -1 === h.indexOf(e)) { var t = e.offset - n; return u || (e.offset = t), n += e.span + t, h.push(e), !0 } }); y.push({ row: [e].concat(a) }) } }), y } function m(e) { var t = e.events, n = void 0 === t ? [] : t, a = e.viewDate, r = e.weekStartsOn, i = e.excluded, l = void 0 === i ? [] : i, o = e.viewStart, c = void 0 === o ? re()(a) : o, v = e.viewEnd, m = void 0 === v ? I()(a) : v, u = e.weekendDays; n || (n = []); for (var p, f = le()(c, { weekStartsOn: r }), w = W()(m, { weekStartsOn: r }), g = d({ events: n, periodStart: f, periodEnd: w }), y = [], h = 0; h < k()(w, f) + 1; h++)!function (e) { var t; if (p ? (t = ee()(D()(p, se)), p.getTime() === t.getTime() && (t = ee()(D()(p, se + 1))), p = t) : t = p = f, !l.some(function (e) { return t.getDay() === e })) { var n = s({ date: t, weekendDays: u }), r = d({ events: g, periodStart: ee()(t), periodEnd: O()(t) }); n.inMonth = P()(t, a), n.events = r, n.badgeTotal = r.length, y.push(n) } }(); var S = [], b = de - l.length; if (b < de) for (var h = 0; h < y.length; h += b) { var E = y.slice(h, h + b), x = E.some(function (e) { return e.date.getMonth() === a.getMonth() }); x && (S = S.concat(E)) } else S = y; for (var C = Math.floor(S.length / b), T = [], h = 0; h < C; h++)T.push(h * b); return { rowOffsets: T, totalDaysVisibleInWeek: b, days: S } } function u(e) { var t = e.events, n = void 0 === t ? [] : t, a = e.viewDate, r = e.hourSegments, i = e.dayStart, l = e.dayEnd, o = e.eventWidth, s = e.segmentHeight; n || (n = []); var c = Q()(Z()(ee()(a), i.hour), i.minute), v = Q()(Z()(ne()(O()(a)), l.hour), l.minute), m = [], u = d({ events: n.filter(function (e) { return !e.allDay }), periodStart: c, periodEnd: v }).sort(function (e, t) { return e.start.valueOf() - t.start.valueOf() }).map(function (e) { var t = e.start, n = e.end || t, a = t < c, i = n > v, l = r * s / ce, d = 0; t > c && (d += A()(t, c)), d *= l; var u = a ? c : t, p = i ? v : n, f = A()(p, u); e.end ? f *= l : f = s; for (var w = d + f, g = m.filter(function (e) { var t = e.top, n = e.top + e.height; return d < n && n < w || t <= d && w <= n }), y = 0; g.some(function (e) { return e.left === y });)y += o; var h = { event: e, height: f, width: o, top: d, left: y, startsBeforeDay: a, endsAfterDay: i }; return f > 0 && m.push(h), h }).filter(function (e) { return e.height > 0 }); return { events: u, width: Math.max.apply(Math, u.map(function (e) { return e.left + e.width })), allDayEvents: d({ events: n.filter(function (e) { return e.allDay }), periodStart: ee()(c), periodEnd: O()(v) }) } } function p(e) { for (var t = e.viewDate, n = e.hourSegments, a = e.dayStart, r = e.dayEnd, i = [], l = Q()(Z()(ee()(t), a.hour), a.minute), o = Q()(Z()(ne()(O()(t)), r.hour), r.minute), d = ce / n, s = ee()(t), c = 0; c < se; c++) { for (var v = [], m = 0; m < n; m++) { var u = b()(D()(s, c), m * d); u >= l && u < o && v.push({ date: u, isStart: 0 === m }) } v.length > 0 && i.push({ segments: v }) } return i } function f(e, t) { function n(e, n) { t(e, n), a = !1 } var a = !0; return Array.isArray(e) ? (e.forEach(function (e) { e.start ? z()(e.start) || n(ue.StartPropertyNotDate, e) : n(ue.StartPropertyMissing, e), e.end && (z()(e.end) || n(ue.EndPropertyNotDate, e), e.start > e.end && n(ue.EndsBeforeStart, e)) }), a) : (t(ue.NotArray, e), !1) } Object.defineProperty(t, "__esModule", { value: !0 }), n.d(t, "DAYS_OF_WEEK", function () { return w }), n.d(t, "SECONDS_IN_DAY", function () { return ve }), n.d(t, "SECONDS_IN_WEEK", function () { return me }), t.getWeekViewEventOffset = l, t.getEventsInPeriod = d, t.getWeekViewHeader = c, t.getWeekView = v, t.getMonthView = m, t.getDayView = u, t.getDayViewHourGrid = p, n.d(t, "EventValidationErrorMessage", function () { return ue }), t.validateEvents = f; var w, g = n(23), y = n.n(g), h = n(24), D = n.n(h), S = n(25), b = n.n(S), E = n(26), x = n.n(E), C = n(27), k = n.n(C), T = n(30), A = n.n(T), M = n(31), V = n.n(M), $ = n(32), O = n.n($), R = n(33), I = n.n(R), N = n(34), W = n.n(N), j = n(35), H = n.n(j), F = n(5), z = n.n(F), Y = n(36), U = n.n(Y), B = n(37), P = n.n(B), L = n(38), G = n.n(L), q = n(40), _ = n.n(q), K = n(41), Z = n.n(K), J = n(42), Q = n.n(J), X = n(3), ee = n.n(X), te = n(43), ne = n.n(te), ae = n(44), re = n.n(ae), ie = n(45), le = n.n(ie); !function (e) { e[e.SUNDAY = 0] = "SUNDAY", e[e.MONDAY = 1] = "MONDAY", e[e.TUESDAY = 2] = "TUESDAY", e[e.WEDNESDAY = 3] = "WEDNESDAY", e[e.THURSDAY = 4] = "THURSDAY", e[e.FRIDAY = 5] = "FRIDAY", e[e.SATURDAY = 6] = "SATURDAY" }(w || (w = {})); var oe = [w.SUNDAY, w.SATURDAY], de = 7, se = 24, ce = 60, ve = 86400, me = ve * de, ue = { NotArray: "Events must be an array", StartPropertyMissing: "Event is missing the `start` property", StartPropertyNotDate: "Event `start` property should be a javascript date object. Do `new Date(event.start)` to fix it.", EndPropertyNotDate: "Event `end` property should be a javascript date object. Do `new Date(event.end)` to fix it.", EndsBeforeStart: "Event `start` property occurs after the `end`" } }, function (e, t) { function n(e) { return e instanceof Date } e.exports = n }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t); return n.getTime() - a.getTime() } var r = n(1); e.exports = a }, function (e, t, n) { "use strict"; function a(e) { e.keys().forEach(e) } n(8); var r = n(0), i = {}, l = n(9); l.keys().forEach(function (e) { var t = e.replace("./", ""), n = "mwl/" + t, a = t.replace(".html", ""); i[a] = { cacheTemplateName: n, template: l(e) } }), e.exports = r.module("mwl.calendar", []).config(["calendarConfig", function (e) { r.forEach(i, function (t, n) { e.templates[n] || (e.templates[n] = t.cacheTemplateName) }) }]).run(["$templateCache", "$interpolate", function (e, t) { r.forEach(i, function (n) { if (!e.get(n.cacheTemplateName)) { var a = n.template.replace("{{", t.startSymbol()).replace("}}", t.endSymbol()); e.put(n.cacheTemplateName, a) } }) }]).name, a(n(19)), a(n(58)), a(n(63)) }, function (e, t) { }, function (e, t, n) { function a(e) { return n(r(e)) } function r(e) { var t = i[e]; if (!(t + 1)) throw new Error("Cannot find module '" + e + "'."); return t } var i = { "./calendar.html": 10, "./calendarDayView.html": 11, "./calendarHourList.html": 12, "./calendarMonthCell.html": 13, "./calendarMonthCellEvents.html": 14, "./calendarMonthView.html": 15, "./calendarSlideBox.html": 16, "./calendarWeekView.html": 17, "./calendarYearView.html": 18 }; a.keys = function () { return Object.keys(i) }, a.resolve = r, e.exports = a, a.id = 9 }, function (e, t) { e.exports = "
The value passed to the view attribute of the calendar is not set
The value passed to view-date attribute of the calendar is not set
" }, function (e, t) { e.exports = '
-
' }, function (e, t) { e.exports = '
 
' }, function (e, t) { e.exports = '
' }, function (e, t) { e.exports = '
' }, function (e, t) { e.exports = '
' }, function (e, t) { e.exports = '
' }, function (e, t) { e.exports = '

' }, function (e, t) { e.exports = '
' }, function (e, t, n) { function a(e) { return n(r(e)) } function r(e) { var t = i[e]; if (!(t + 1)) throw new Error("Cannot find module '" + e + "'."); return t } var i = { "./mwlCalendar.js": 20, "./mwlCalendarDay.js": 21, "./mwlCalendarHourList.js": 22, "./mwlCalendarMonth.js": 46, "./mwlCalendarSlideBox.js": 47, "./mwlCalendarWeek.js": 48, "./mwlCalendarYear.js": 49, "./mwlCollapseFallback.js": 50, "./mwlDateModifier.js": 51, "./mwlDragSelect.js": 52, "./mwlDraggable.js": 53, "./mwlDroppable.js": 54, "./mwlDynamicDirectiveTemplate.js": 55, "./mwlElementDimensions.js": 56, "./mwlResizable.js": 57 }; a.keys = function () { return Object.keys(i) }, a.resolve = r, e.exports = a, a.id = 19 }, function (e, t, n) { "use strict"; var a = n(0), r = "Bootstrap calendar:"; a.module("mwl.calendar").controller("MwlCalendarCtrl", ["$scope", "$log", "$timeout", "$attrs", "$locale", "moment", "calendarTitle", "calendarHelper", function (e, t, n, i, l, o, d, s) { var c = this; c.changeView = function (e, t) { c.view = e, c.viewDate = t }, c.dateClicked = function (e) { var t = o(e).toDate(), n = { year: "month", month: "day", week: "day" }; !1 !== c.onViewChangeClick({ calendarDate: t, calendarNextView: n[c.view] }) && c.changeView(n[c.view], t) }, c.$onInit = function () { function v(e) { e.startsAt ? a.isDate(e.startsAt) || t.warn(r, "Event startsAt should be a javascript date object. Do `new Date(event.startsAt)` to fix it.", e) : t.warn(r, "Event is missing the startsAt field", e), e.endsAt && (a.isDate(e.endsAt) || t.warn(r, "Event endsAt should be a javascript date object. Do `new Date(event.endsAt)` to fix it.", e), o(e.startsAt).isAfter(o(e.endsAt)) && t.warn(r, "Event cannot start after it finishes", e)) } function m() { d[c.view] && a.isDefined(i.viewTitle) && (c.viewTitle = d[c.view](c.viewDate)), c.events.forEach(function (e, t) { v(e), e.calendarEventId = t }); var t = o(c.viewDate), r = !0; u.clone().startOf(c.view).isSame(t.clone().startOf(c.view)) && !u.isSame(t) && c.view === p && (r = !1), u = t, p = c.view, r && n(function () { e.$broadcast("calendar.refreshView") }) } c.slideBoxDisabled && t.warn(r, "The `slide-box-disabled` option is deprecated and will be removed in the next release. Instead set `cell-auto-open-disabled` to true"), c.events = c.events || [], c.excludedDays = c.excludedDays || []; var u = o(c.viewDate), p = c.view; s.loadTemplates().then(function () { c.templatesLoaded = !0; var t = !1; e.$watchGroup(["vm.viewDate", "vm.view", "vm.cellIsOpen", function () { return o.locale() + l.id }], function () { t ? m() : (t = !0, e.$watch("vm.events", m, !0)) }) }).catch(function (e) { t.error("Could not load all calendar templates", e) }) }, a.version.minor < 5 && c.$onInit() }]).directive("mwlCalendar", function () { return { template: '
', restrict: "E", scope: { events: "=", view: "=", viewTitle: "=?", viewDate: "=", cellIsOpen: "=?", cellAutoOpenDisabled: "=?", excludedDays: "=?", slideBoxDisabled: "=?", customTemplateUrls: "=?", draggableAutoScroll: "=?", onEventClick: "&", onEventTimesChanged: "&", onTimespanClick: "&", onDateRangeSelect: "&?", onViewChangeClick: "&", cellModifier: "&", dayViewStart: "@", dayViewSegmentSize: "@", dayViewEnd: "@", dayViewSplit: "@", dayViewEventChunkSize: "@", dayViewEventWidth: "@", templateScope: "=?", dayViewTimePosition: "@" }, controller: "MwlCalendarCtrl as vm", bindToController: !0 } }) }, function (e, t, n) { "use strict"; n(0).module("mwl.calendar").controller("MwlCalendarDayCtrl", ["$scope", "moment", "calendarHelper", "calendarEventTitle", function (e, t, n, a) { function r() { i.timeHidden = "hidden" === i.dayViewTimePosition, i.dayViewTimePositionOffset = "default" !== i.dayViewTimePosition ? 0 : 60, i.dayViewSplit = i.dayViewSplit || 30, i.dayViewHeight = n.getDayViewHeight(i.dayViewStart, i.dayViewEnd, i.dayViewSplit, i.dayViewSegmentSize); var e = n.getDayView(i.events, i.viewDate, i.dayViewStart, i.dayViewEnd, i.dayViewSplit, i.dayViewEventWidth, i.dayViewSegmentSize); i.allDayEvents = e.allDayEvents, i.nonAllDayEvents = e.events, i.viewWidth = e.width + 62 } var i = this; i.calendarEventTitle = a, e.$on("calendar.refreshView", r), e.$watchGroup(["vm.dayViewStart", "vm.dayViewEnd", "vm.dayViewSplit"], r), i.eventDragComplete = function (e, n) { var a = n * i.dayViewSplit, r = t(e.startsAt).add(a, "minutes"), l = t(e.endsAt).add(a, "minutes"); delete e.tempStartsAt, i.onEventTimesChanged({ calendarEvent: e, calendarNewEventStart: r.toDate(), calendarNewEventEnd: e.endsAt ? l.toDate() : null }) }, i.eventDragged = function (e, n) { var a = n * i.dayViewSplit; e.tempStartsAt = t(e.startsAt).add(a, "minutes").toDate() }, i.eventResizeComplete = function (e, n, a) { var r = a * i.dayViewSplit, l = t(e.startsAt), o = t(e.endsAt); "start" === n ? l.add(r, "minutes") : o.add(r, "minutes"), delete e.tempStartsAt, i.onEventTimesChanged({ calendarEvent: e, calendarNewEventStart: l.toDate(), calendarNewEventEnd: o.toDate() }) }, i.eventResized = function (e, n, a) { var r = a * i.dayViewSplit; "start" === n && (e.tempStartsAt = t(e.startsAt).add(r, "minutes").toDate()) } }]).directive("mwlCalendarDay", function () { return { template: '
', restrict: "E", require: "^mwlCalendar", scope: { events: "=", viewDate: "=", onEventClick: "=", onEventTimesChanged: "=", onTimespanClick: "=", onDateRangeSelect: "=", dayViewStart: "=", dayViewEnd: "=", dayViewSplit: "=", dayViewEventChunkSize: "=", dayViewSegmentSize: "=", dayViewEventWidth: "=", customTemplateUrls: "=?", cellModifier: "=", templateScope: "=", dayViewTimePosition: "=", draggableAutoScroll: "=" }, controller: "MwlCalendarDayCtrl as vm", bindToController: !0 } }) }, function (e, t, n) { "use strict"; var a = n(0), r = n(4); a.module("mwl.calendar").controller("MwlCalendarHourListCtrl", ["$scope", "$document", "moment", "calendarHelper", function (e, t, n, a) { function i() { l.dayViewSplit = parseInt(l.dayViewSplit); var e = (l.dayViewStart || "00:00").split(":"), t = (l.dayViewEnd || "23:59").split(":"); l.hourGrid = r.getDayViewHourGrid({ viewDate: "week" === l.view ? n(l.viewDate).startOf("week").toDate() : n(l.viewDate).toDate(), hourSegments: 60 / l.dayViewSplit, dayStart: { hour: e[0], minute: e[1] }, dayEnd: { hour: t[0], minute: t[1] } }), l.hourGrid.forEach(function (e) { e.segments.forEach(function (e) { if (e.date = n(e.date), e.nextSegmentDate = e.date.clone().add(l.dayViewSplit, "minutes"), "week" === l.view) { e.days = []; for (var t = 0; t < 7; t++) { var a = { date: n(e.date).add(t, "days") }; a.nextSegmentDate = a.date.clone().add(l.dayViewSplit, "minutes"), l.cellModifier({ calendarCell: a }), e.days.push(a) } } else l.cellModifier({ calendarCell: e }) }) }) } var l = this; l.scrollBarWidth = function () { var e = t[0].createElement("div"); e.style.visibility = "hidden", e.style.width = "100px", e.style.msOverflowStyle = "scrollbar", t[0].body.appendChild(e); var n = e.offsetWidth; e.style.overflow = "scroll"; var a = t[0].createElement("div"); a.style.width = "100%", e.appendChild(a); var r = a.offsetWidth; return e.parentNode.removeChild(e), n - r }(); var o = n.locale(); e.$on("calendar.refreshView", function () { o !== n.locale() && (o = n.locale(), i()) }), e.$watchGroup(["vm.dayViewStart", "vm.dayViewEnd", "vm.dayViewSplit", "vm.viewDate"], function () { i() }), l.eventDropped = function (e, t) { var r = n(t), i = a.adjustEndDateFromStartDiff(e.startsAt, r, e.endsAt); l.onEventTimesChanged({ calendarEvent: e, calendarDate: t, calendarNewEventStart: r.toDate(), calendarNewEventEnd: i ? i.toDate() : null }) }, l.onDragSelectStart = function (e, t) { l.dateRangeSelect || (l.dateRangeSelect = { active: !0, startDate: e, endDate: e, dayIndex: t }) }, l.onDragSelectMove = function (e) { l.dateRangeSelect && (l.dateRangeSelect.endDate = e) }, l.onDragSelectEnd = function (e) { l.dateRangeSelect && (l.dateRangeSelect.endDate = e, l.dateRangeSelect.endDate > l.dateRangeSelect.startDate && l.onDateRangeSelect({ calendarRangeStartDate: l.dateRangeSelect.startDate.toDate(), calendarRangeEndDate: l.dateRangeSelect.endDate.toDate() }), delete l.dateRangeSelect) } }]).directive("mwlCalendarHourList", function () { return { restrict: "E", template: '
', controller: "MwlCalendarHourListCtrl as vm", scope: { viewDate: "=", dayViewStart: "=", dayViewEnd: "=", dayViewSplit: "=", dayWidth: "=?", onTimespanClick: "=", onDateRangeSelect: "=", onEventTimesChanged: "=", customTemplateUrls: "=?", cellModifier: "=", templateScope: "=", view: "@" }, bindToController: !0 } }) }, function (e, t, n) { function a(e, t) { var n = r(e), a = Number(t); return n.setDate(n.getDate() + a), n } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = Number(t); return r(e, n * i) } var r = n(2), i = 36e5; e.exports = a }, function (e, t, n) { function a(e, t) { var n = Number(t); return r(e, n * i) } var r = n(2), i = 6e4; e.exports = a }, function (e, t, n) { function a(e, t) { var n = Number(t); return r(e, 1e3 * n) } var r = n(2); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t), o = l(n, a), d = Math.abs(i(n, a)); return n.setDate(n.getDate() - o * d), o * (d - (l(n, a) === -o)) } var r = n(1), i = n(28), l = n(29); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t), o = n.getTime() - n.getTimezoneOffset() * i, d = a.getTime() - a.getTimezoneOffset() * i; return Math.round((o - d) / l) } var r = n(3), i = 6e4, l = 864e5; e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = n.getTime(), i = r(t), l = i.getTime(); return a < l ? -1 : a > l ? 1 : 0 } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e, t) / i; return n > 0 ? Math.floor(n) : Math.ceil(n) } var r = n(6), i = 6e4; e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e, t) / 1e3; return n > 0 ? Math.floor(n) : Math.ceil(n) } var r = n(6); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e); return t.setHours(23, 59, 59, 999), t } var r = n(1); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e), n = t.getMonth(); return t.setFullYear(t.getFullYear(), n + 1, 0), t.setHours(23, 59, 59, 999), t } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = t ? Number(t.weekStartsOn) || 0 : 0, a = r(e), i = a.getDay(), l = 6 + (i < n ? -7 : 0) - (i - n); return a.setDate(a.getDate() + l), a.setHours(23, 59, 59, 999), a } var r = n(1); e.exports = a }, function (e, t, n) { function a(e) { return r(e).getDay() } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t); return n.getTime() === a.getTime() } var r = n(3); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t); return n.getFullYear() === a.getFullYear() && n.getMonth() === a.getMonth() } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = r(t); return n.getTime() === a.getTime() } var r = n(39); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e); return t.setMilliseconds(0), t } var r = n(1); e.exports = a }, function (e, t, n) { function a() { var e = Array.prototype.slice.call(arguments), t = e.map(function (e) { return r(e) }), n = Math.max.apply(null, t); return new Date(n) } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = Number(t); return n.setHours(a), n } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = r(e), a = Number(t); return n.setMinutes(a), n } var r = n(1); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e); return t.setSeconds(0, 0), t } var r = n(1); e.exports = a }, function (e, t, n) { function a(e) { var t = r(e); return t.setDate(1), t.setHours(0, 0, 0, 0), t } var r = n(1); e.exports = a }, function (e, t, n) { function a(e, t) { var n = t ? Number(t.weekStartsOn) || 0 : 0, a = r(e), i = a.getDay(), l = (i < n ? 7 : 0) + i - n; return a.setDate(a.getDate() - l), a.setHours(0, 0, 0, 0), a } var r = n(1); e.exports = a }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlCalendarMonthCtrl", ["$scope", "moment", "calendarHelper", "calendarConfig", "calendarEventTitle", function (e, t, n, r, i) { function l() { o.openRowIndex = null, o.openDayIndex = null, o.cellIsOpen && o.view && o.weekDays && o.view.forEach(function (e, n) { t(o.viewDate).startOf("day").isSame(e.date) && (o.openDayIndex = n, o.openRowIndex = Math.floor(n / o.weekDays.length)) }) } var o = this; o.calendarConfig = r, o.calendarEventTitle = i, o.openRowIndex = null, e.$on("calendar.refreshView", function () { o.weekDays = n.getWeekDayNames(o.excludedDays); var e = n.getMonthView(o.events, o.viewDate, o.cellModifier, o.excludedDays); o.view = e.days, o.monthOffsets = e.rowOffsets, o.cellAutoOpenDisabled ? l() : !o.cellAutoOpenDisabled && o.cellIsOpen && null === o.openRowIndex && (o.openDayIndex = null, o.view.forEach(function (e) { e.inMonth && t(o.viewDate).startOf("day").isSame(e.date) && o.dayClicked(e, !0) })) }), o.dayClicked = function (e, t, n) { if ((t || (o.onTimespanClick({ calendarDate: e.date.toDate(), calendarCell: e, $event: n }), !n || !n.defaultPrevented)) && !o.cellAutoOpenDisabled) { o.openRowIndex = null; var a = o.view.indexOf(e); a === o.openDayIndex ? (o.openDayIndex = null, o.cellIsOpen = !1) : (o.openDayIndex = a, o.openRowIndex = Math.floor(a / o.weekDays.length), o.cellIsOpen = !0) } }, o.highlightEvent = function (e, t) { o.view.forEach(function (n) { if (delete n.highlightClass, delete n.backgroundColor, t) { n.events.indexOf(e) > -1 && (n.backgroundColor = e.color ? e.color.secondary : "") } }) }, o.handleEventDrop = function (e, a, r) { var i = t(e.startsAt).year(t(a).year()).month(t(a).month()).date(t(a).date()), l = n.adjustEndDateFromStartDiff(e.startsAt, i, e.endsAt); o.onEventTimesChanged({ calendarEvent: e, calendarDate: a, calendarNewEventStart: i.toDate(), calendarNewEventEnd: l ? l.toDate() : null, calendarDraggedFromDate: r }) }, o.getWeekNumberLabel = function (e) { var t = e.date.clone().add(1, "day").isoWeek(); return "function" == typeof r.i18nStrings.weekNumber ? r.i18nStrings.weekNumber({ weekNumber: t }) : r.i18nStrings.weekNumber.replace("{week}", t) }, o.onDragSelectStart = function (e) { o.dateRangeSelect || (o.dateRangeSelect = { startDate: e.date, endDate: e.date }) }, o.onDragSelectMove = function (e) { o.dateRangeSelect && (o.dateRangeSelect.endDate = e.date) }, o.onDragSelectEnd = function (e) { o.dateRangeSelect && (o.dateRangeSelect.endDate = e.date, o.dateRangeSelect.endDate > o.dateRangeSelect.startDate && o.onDateRangeSelect({ calendarRangeStartDate: o.dateRangeSelect.startDate.clone().startOf("day").toDate(), calendarRangeEndDate: o.dateRangeSelect.endDate.clone().endOf("day").toDate() }), delete o.dateRangeSelect) }, o.$onInit = function () { o.cellAutoOpenDisabled && e.$watchGroup(["vm.cellIsOpen", "vm.viewDate"], l) }, a.version.minor < 5 && o.$onInit() }]).directive("mwlCalendarMonth", function () { return { template: '
', restrict: "E", require: "^mwlCalendar", scope: { events: "=", viewDate: "=", excludedDays: "=", onEventClick: "=", onEventTimesChanged: "=", onDateRangeSelect: "=", cellIsOpen: "=", cellAutoOpenDisabled: "=", onTimespanClick: "=", cellModifier: "=", slideBoxDisabled: "=", customTemplateUrls: "=?", templateScope: "=", draggableAutoScroll: "=" }, controller: "MwlCalendarMonthCtrl as vm", link: function (e, t, n, a) { e.vm.calendarCtrl = a }, bindToController: !0 } }) }, function (e, t, n) { "use strict"; n(0).module("mwl.calendar").controller("MwlCalendarSlideBoxCtrl", ["$scope", "$timeout", "calendarConfig", "calendarEventTitle", function (e, t, n, a) { var r = this; r.calendarConfig = n, r.calendarEventTitle = a, r.isCollapsed = !0, e.$watch("vm.isOpen", function (e) { t(function () { r.isCollapsed = !e }) }) }]).directive("mwlCalendarSlideBox", function () { return { restrict: "E", template: '
', replace: !0, controller: "MwlCalendarSlideBoxCtrl as vm", require: ["^?mwlCalendarMonth", "^?mwlCalendarYear"], link: function (e, t, n, a) { e.isMonthView = !!a[0], e.isYearView = !!a[1] }, scope: { isOpen: "=", events: "=", onEventClick: "=", cell: "=", customTemplateUrls: "=?", templateScope: "=", draggableAutoScroll: "=" }, bindToController: !0 } }) }, function (e, t, n) { "use strict"; n(0).module("mwl.calendar").controller("MwlCalendarWeekCtrl", ["$scope", "moment", "calendarHelper", "calendarConfig", "calendarEventTitle", function (e, t, n, a, r) { var i = this; i.showTimes = a.showTimesOnWeekView, i.calendarEventTitle = r, e.$on("calendar.refreshView", function () { i.dayViewSplit = i.dayViewSplit || 30, i.dayViewHeight = n.getDayViewHeight(i.dayViewStart, i.dayViewEnd, i.dayViewSplit), i.showTimes ? i.view = n.getWeekViewWithTimes(i.events, i.viewDate, i.dayViewStart, i.dayViewEnd, i.dayViewSplit) : i.view = n.getWeekView(i.events, i.viewDate, i.excludedDays) }), i.weekDragged = function (e, n, a) { var r = t(e.startsAt).add(n, "days"), l = t(e.endsAt).add(n, "days"); if (a) { var o = a * i.dayViewSplit; r = r.add(o, "minutes"), l = l.add(o, "minutes") } delete e.tempStartsAt, i.onEventTimesChanged({ calendarEvent: e, calendarNewEventStart: r.toDate(), calendarNewEventEnd: e.endsAt ? l.toDate() : null }) }, i.eventDropped = function (e, n) { var a = t(n).diff(t(e.startsAt), "days"); i.weekDragged(e, a) }, i.weekResized = function (e, n, a) { var r = t(e.startsAt), l = t(e.endsAt); "start" === n ? r.add(a, "days") : l.add(a, "days"), i.onEventTimesChanged({ calendarEvent: e, calendarNewEventStart: r.toDate(), calendarNewEventEnd: l.toDate() }) }, i.tempTimeChanged = function (e, n) { var a = n * i.dayViewSplit; e.tempStartsAt = t(e.startsAt).add(a, "minutes").toDate() } }]).directive("mwlCalendarWeek", function () { return { template: '
', restrict: "E", require: "^mwlCalendar", scope: { events: "=", viewDate: "=", excludedDays: "=", onEventClick: "=", onEventTimesChanged: "=", dayViewStart: "=", dayViewEnd: "=", dayViewSplit: "=", dayViewEventChunkSize: "=", onTimespanClick: "=", onDateRangeSelect: "=", customTemplateUrls: "=?", cellModifier: "=", templateScope: "=", draggableAutoScroll: "=" }, controller: "MwlCalendarWeekCtrl as vm", link: function (e, t, n, a) { e.vm.calendarCtrl = a }, bindToController: !0 } }) }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlCalendarYearCtrl", ["$scope", "moment", "calendarHelper", function (e, t, n) { function r() { i.openRowIndex = null, i.openMonthIndex = null, i.cellIsOpen && i.view && i.view.forEach(function (e, n) { t(i.viewDate).startOf("month").isSame(e.date) && (i.openMonthIndex = n, i.openRowIndex = Math.floor(n / 4)) }) } var i = this; i.openMonthIndex = null, e.$on("calendar.refreshView", function () { i.view = n.getYearView(i.events, i.viewDate, i.cellModifier), i.cellAutoOpenDisabled ? r() : !i.cellAutoOpenDisabled && i.cellIsOpen && null === i.openMonthIndex && (i.openMonthIndex = null, i.view.forEach(function (e) { t(i.viewDate).startOf("month").isSame(e.date) && i.monthClicked(e, !0) })) }), i.monthClicked = function (e, t, n) { if ((t || (i.onTimespanClick({ calendarDate: e.date.toDate(), calendarCell: e, $event: n }), !n || !n.defaultPrevented)) && !i.cellAutoOpenDisabled) { i.openRowIndex = null; var a = i.view.indexOf(e); a === i.openMonthIndex ? (i.openMonthIndex = null, i.cellIsOpen = !1) : (i.openMonthIndex = a, i.openRowIndex = Math.floor(a / 4), i.cellIsOpen = !0) } }, i.handleEventDrop = function (e, a) { var r = t(e.startsAt).year(t(a).year()).month(t(a).month()), l = n.adjustEndDateFromStartDiff(e.startsAt, r, e.endsAt); i.onEventTimesChanged({ calendarEvent: e, calendarDate: a, calendarNewEventStart: r.toDate(), calendarNewEventEnd: l ? l.toDate() : null }) }, i.$onInit = function () { i.cellAutoOpenDisabled && e.$watchGroup(["vm.cellIsOpen", "vm.viewDate"], r) }, a.version.minor < 5 && i.$onInit() }]).directive("mwlCalendarYear", function () { return { template: '
', restrict: "E", require: "^mwlCalendar", scope: { events: "=", viewDate: "=", onEventClick: "=", onEventTimesChanged: "=", cellIsOpen: "=", cellAutoOpenDisabled: "=", onTimespanClick: "=", cellModifier: "=", slideBoxDisabled: "=", customTemplateUrls: "=?", templateScope: "=" }, controller: "MwlCalendarYearCtrl as vm", link: function (e, t, n, a) { e.vm.calendarCtrl = a }, bindToController: !0 } }) }, function (e, t, n) { "use strict"; n(0).module("mwl.calendar").controller("MwlCollapseFallbackCtrl", ["$scope", "$attrs", "$element", function (e, t, n) { e.$watch(t.mwlCollapseFallback, function (e) { e ? n.addClass("ng-hide") : n.removeClass("ng-hide") }) }]).directive("mwlCollapseFallback", ["$injector", function (e) { return e.has("uibCollapseDirective") ? {} : { restrict: "A", controller: "MwlCollapseFallbackCtrl" } }]) }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlDateModifierCtrl", ["$element", "$attrs", "$scope", "moment", function (e, t, n, r) { function i() { if (a.isDefined(t.setToToday)) l.date = new Date; else if (a.isDefined(t.increment)) { if (l.date = r(l.date).add(1, l.increment), l.excludedDays && l.increment.indexOf("day") > -1) for (; l.excludedDays.indexOf(l.date.day()) > -1;)l.date.add(1, l.increment); l.date = l.date.toDate() } else if (a.isDefined(t.decrement)) { if (l.date = r(l.date).subtract(1, l.decrement), l.excludedDays && l.decrement.indexOf("day") > -1) for (; l.excludedDays.indexOf(l.date.day()) > -1;)l.date.subtract(1, l.decrement); l.date = l.date.toDate() } n.$apply() } var l = this; e.bind("click", i), n.$on("$destroy", function () { e.unbind("click", i) }) }]).directive("mwlDateModifier", function () { return { restrict: "A", controller: "MwlDateModifierCtrl as vm", scope: { date: "=", increment: "=", decrement: "=", excludedDays: "=?" }, bindToController: !0 } }) }, function (e, t, n) { "use strict"; n(0).module("mwl.calendar").controller("MwlDragSelectCtrl", ["$scope", "$element", "$parse", "$attrs", function (e, t, n, a) { function r(t) { return function (a) { t && 2 !== a.button && (n(t)(e), e.$apply()), a.preventDefault() } } function i() { t.on("mousedown", o), t.on("mousemove", d), t.on("mouseup", s) } function l() { t.off("mousedown", o), t.off("mousemove", d), t.off("mouseup", s) } var o = r(a.onDragSelectStart), d = r(a.onDragSelectMove), s = r(a.onDragSelectEnd); e.$watch(a.mwlDragSelect, function (e) { e ? i() : l() }), e.$on("$destroy", function () { l() }) }]).directive("mwlDragSelect", function () { return { restrict: "A", controller: "MwlDragSelectCtrl" } }) }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlDraggableCtrl", ["$element", "$scope", "$window", "$parse", "$attrs", "$timeout", "interact", function (e, t, n, r, i, l, o) { function d(e, t) { return e.css("-ms-transform", t).css("-webkit-transform", t).css("transform", t) } if (o) { var s, c; i.snapGrid && (c = r(i.snapGrid)(t), s = { targets: [o.createSnapGrid(c)] }); var v = r(i.autoScroll)(t); void 0 === v && (v = !0), o(e[0]).draggable({ autoScroll: v, snap: s, onstart: function (e) { a.element(e.target).addClass("dragging-active"), e.target.dropData = r(i.dropData)(t), e.target.style.pointerEvents = "none", i.onDragStart && (r(i.onDragStart)(t), t.$apply()) }, onmove: function (e) { var l = a.element(e.target), o = (parseFloat(l.attr("data-x")) || 0) + (e.dx || 0), s = (parseFloat(l.attr("data-y")) || 0) + (e.dy || 0); switch (r(i.axis)(t)) { case "x": s = 0; break; case "y": o = 0 }"static" === n.getComputedStyle(l[0]).position && l.css("position", "relative"), d(l, "translate(" + o + "px, " + s + "px)").css("z-index", 50).attr("data-x", o).attr("data-y", s), i.onDrag && (r(i.onDrag)(t, { x: o, y: s }), t.$apply()) }, onend: function (e) { var n = a.element(e.target), o = n.attr("data-x"), s = n.attr("data-y"); e.target.style.pointerEvents = "auto", i.onDragEnd && (r(i.onDragEnd)(t, { x: o, y: s }), t.$apply()), l(function () { d(n, "").css("z-index", "auto").removeAttr("data-x").removeAttr("data-y").removeClass("dragging-active") }) } }), t.$watch(i.mwlDraggable, function (t) { o(e[0]).draggable({ enabled: t }) }), t.$on("$destroy", function () { o(e[0]).unset() }) } }]).directive("mwlDraggable", function () { return { restrict: "A", controller: "MwlDraggableCtrl" } }) }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlDroppableCtrl", ["$element", "$scope", "$parse", "$attrs", "interact", function (e, t, n, r, i) { if (i) { var l = r.dropActiveClass || "drop-active", o = r.dropOverlap || "pointer"; i(e[0]).dropzone({ ondragenter: function (e) { a.element(e.target).addClass(l) }, ondragleave: function (e) { a.element(e.target).removeClass(l) }, ondropdeactivate: function (e) { a.element(e.target).removeClass(l) }, ondrop: function (e) { e.relatedTarget.dropData && (n(r.onDrop)(t, { dropData: e.relatedTarget.dropData }), t.$apply()) }, overlap: o }), t.$on("$destroy", function () { i(e[0]).unset() }) } }]).directive("mwlDroppable", function () { return { restrict: "A", controller: "MwlDroppableCtrl" } }) }, function (e, t, n) { "use strict"; var a = n(0); a.module("mwl.calendar").controller("MwlDynamicDirectiveTemplateCtrl", ["$compile", "$scope", "$attrs", "$element", "$templateCache", "$log", "calendarConfig", function (e, t, n, r, i, l, o) { t.$watch(n.overrides, function (d) { var s = o.templates[n.name]; d && a.isObject(d) && d[n.name] && (i.get(d[n.name]) ? s = d[n.name] : l.warn("Bootstrap Calendar", "The custom template for " + d[n.name] + ' was not found in the template cache. Please ensure it is pre-loaded via a script tag