'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-b7293b2f.js');
const media = require('./media-330605b2.js');

const sleep = milliseconds => new Promise(resolve => setTimeout(resolve, milliseconds));

const breakpointsCss = "";

const Breakpoints = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.luBreakpointDataUpdated = index.createEvent(this, "luBreakpointDataUpdated", 7);
    this.sm = media.BREAKPOINT_CONFIG.sm;
    this.md = media.BREAKPOINT_CONFIG.md;
    this.lg = media.BREAKPOINT_CONFIG.lg;
    this.xl = media.BREAKPOINT_CONFIG.xl;
  }
  widthChange(newSize) {
    let newBreakpoint = "xs";
    if (newSize >= this.sm) {
      newBreakpoint = "sm";
    }
    if (newSize >= this.md) {
      newBreakpoint = "md";
    }
    if (newSize >= this.lg) {
      newBreakpoint = "lg";
    }
    if (newSize >= this.xl) {
      newBreakpoint = "xl";
    }
    this.currentBreakpoint = newBreakpoint;
    this.luBreakpointDataUpdated.emit({
      breakpoint: newBreakpoint,
      height: this.currentHeight,
      width: this.currentWidth
    });
  }
  onResize() {
    this.currentWidth = document.body.clientWidth;
    this.currentHeight = document.body.clientHeight;
  }
  componentDidLoad() {
    // todo: Remove timeout once solution for Firefox timing issue is found.
    sleep(100).then(() => {
      this.onResize();
    });
  }
  static get watchers() { return {
    "currentWidth": ["widthChange"]
  }; }
};
Breakpoints.style = breakpointsCss;

exports.lu_breakpoints = Breakpoints;

//# sourceMappingURL=lu-breakpoints.cjs.entry.js.map