!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],e):"object"==typeof exports?exports["openstack-uicore-foundation"]=e():t["openstack-uicore-foundation"]=e()}(this,(()=>(()=>{"use strict";var t={8362:t=>{t.exports=require("moment-timezone")}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}(()=>{i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e}})(),(()=>{i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}})(),(()=>{i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}})();var n={};return(()=>{i.r(n),i.d(n,{default:()=>s});var t=i(8362),e=i.n(t);const s=class{constructor(t,e=null){this._event=t,this._summit=e}set summit(t){this._summit=t}get summit(){return this._summit}getId(){return this._event.id}isPublished(){return this._event.hasOwnProperty("is_published")&&this._event.is_published}getMinutesDuration(t){if(this._event.hasOwnProperty("start_date")&&this._event.hasOwnProperty("end_date")&&null!=this._event.start_date&&null!=this._event.end_date){let t=e()(1e3*this._event.start_date).tz(this._summit.time_zone.name);return e()(1e3*this._event.end_date).tz(this._summit.time_zone.name).diff(t,"minutes")}return this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):t}canMove(t,i,n,s){let r=this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):s;this.isPublished()&&(r=this.getMinutesDuration());let a=e().tz(i+" "+n.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name),m=e().tz(i+" "+n.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name);m=m.add(r,"minutes");for(let i of t.filter((t=>t.id!==this.getId()))){let t=e()(1e3*i.start_date).tz(this._summit.time_zone.name),n=e()(1e3*i.end_date).tz(this._summit.time_zone.name);if(t.isBefore(m)&&n.isAfter(a))return!1}return!0}calculateNewDates(t,i,n){return n=this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):n,[e().tz(t+" "+i.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name),e().tz(t+" "+i.format("HH:mm"),"YYYY-MM-DD HH:mm",this._summit.time_zone.name).add(n,"minutes")]}isValidEndDate(t){if(!t)return!0;const i=e().tz(1e3*t,this._summit.time_zone.name),n=e().tz(1e3*this._summit.end_date,this._summit.time_zone.name),s=e().tz(1e3*this._event.start_date,this._summit.time_zone.name);return i.isSameOrBefore(n)&&i.isAfter(s)}isValidStartDate(t){if(!t)return!0;const i=e().tz(1e3*t,this._summit.time_zone.name),n=this._event.hasOwnProperty("duration")&&this._event.duration>0?parseInt(this._event.duration/60):0,s=e().tz(1e3*this._summit.start_date,this._summit.time_zone.name),r=this._event.end_date?e().tz(1e3*this._event.end_date,this._summit.time_zone.name):n>0?e().tz(1e3*t,this._summit.time_zone.name).add(n,"minutes"):null;return i.isSameOrAfter(s)&&e().isMoment(r)&&i.isBefore(r)}isValidTitle(t){return""!==t.trim()}isValid(){return this.isValidTitle(this._event.title)&&this.isValidStartDate(this._event.start_date)&&this.isValidEndDate(this._event.end_date)}}})(),n})()));
//# sourceMappingURL=summit-event.js.map