text: define(["exports", "../../../../../@polymer/polymer/polymer-element.js", "../../core/haxcms-site-store.js", "../../../../../@polymer/polymer/lib/utils/render-status.js"], function (_exports, _polymerElement, _haxcmsSiteStore, _renderStatus) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.ActiveWhenVisible = void 0;
  
    function _templateObject_11494ca0e53311e9a0cfefb808989d41() {
      var data = babelHelpers.taggedTemplateLiteral(["\n      <style>\n        :host {\n          display: block;\n        }\n        a {\n          height: 10px;\n          width: 10px;\n          float: left;\n          pointer-events: none;\n          background-color: transparent;\n        }\n      </style>\n      <div>\n        <a id=\"a\" href$=\"[[_a]]\" name$=\"#[[itemId]]\" aria-hidden></a>\n        <slot></slot>\n      </div>\n    "]);
  
      _templateObject_11494ca0e53311e9a0cfefb808989d41 = function _templateObject_11494ca0e53311e9a0cfefb808989d41() {
        return data;
      };
  
      return data;
    }
  
    /**
     * `active-when-visible`
     * `Title of the site`
     *
     * @customElement
     * @polymer
     * @demo demo/index.html
     */
    var ActiveWhenVisible =
    /*#__PURE__*/
    function (_PolymerElement) {
      babelHelpers.inherits(ActiveWhenVisible, _PolymerElement);
  
      function ActiveWhenVisible() {
        babelHelpers.classCallCheck(this, ActiveWhenVisible);
        return babelHelpers.possibleConstructorReturn(this, babelHelpers.getPrototypeOf(ActiveWhenVisible).apply(this, arguments));
      }
  
      babelHelpers.createClass(ActiveWhenVisible, [{
        key: "connectedCallback",
        value: function connectedCallback() {
          babelHelpers.get(babelHelpers.getPrototypeOf(ActiveWhenVisible.prototype), "connectedCallback", this).call(this); // setup the intersection observer
  
          (0, _renderStatus.afterNextRender)(this, function () {
            this.observer = new IntersectionObserver(this.handleIntersectionCallback.bind(this), {
              root: document.rootElement,
              rootMargin: this.rootMargin,
              threshold: this.thresholds
            });
            this.observer.observe(this);
          });
        }
      }, {
        key: "disconnectedCallback",
        value: function disconnectedCallback() {
          babelHelpers.get(babelHelpers.getPrototypeOf(ActiveWhenVisible.prototype), "disconnectedCallback", this).call(this);
        }
        /**
         * Handle this being visible
         */
  
      }, {
        key: "handleIntersectionCallback",
        value: function handleIntersectionCallback(entries) {
          var _this = this;
  
          var _iteratorNormalCompletion = true;
          var _didIteratorError = false;
          var _iteratorError = undefined;
  
          try {
            for (var _iterator = entries[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
              var entry = _step.value;
  
              if (Number(entry.intersectionRatio).toFixed(2) >= this.visibleLimit) {
                // now we care
                if (this.itemId) {
                  var item = _haxcmsSiteStore.store.findItem(this.itemId);
  
                  this._a = item.location.replace("pages/", "").replace("/index.html", "");
                  this.isVisible = true;
                  setTimeout(function () {
                    _this.$.a.click();
                  }, 25);
                }
              }
            }
          } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
          } finally {
            try {
              if (!_iteratorNormalCompletion && _iterator.return != null) {
                _iterator.return();
              }
            } finally {
              if (_didIteratorError) {
                throw _iteratorError;
              }
            }
          }
        }
      }], [{
        key: "tag",
  
        /**
         * Store the tag name to make it easier to obtain directly.
         * @notice function name must be here for tooling to operate correctly
         */
        get: function get() {
          return "active-when-visible";
        } // render function
  
      }, {
        key: "template",
        get: function get() {
          return (0, _polymerElement.html)(_templateObject_11494ca0e53311e9a0cfefb808989d41());
        }
        /**
         * Props
         */
  
      }, {
        key: "properties",
        get: function get() {
          return {
            itemId: {
              type: String
            },
            _a: {
              type: String
            },
            thresholds: {
              type: Array,
              value: [0.0, 0.25, 0.5, 0.75, 1.0]
            },
            rootMargin: {
              type: String,
              value: "0px"
            },
            visibleLimit: {
              type: Number,
              value: 0.5,
              reflectToAttribute: true
            },
            isVisible: {
              type: Boolean,
              value: false,
              notify: true
            }
          };
        }
      }]);
      return ActiveWhenVisible;
    }(_polymerElement.PolymerElement);
  
    _exports.ActiveWhenVisible = ActiveWhenVisible;
    window.customElements.define(ActiveWhenVisible.tag, ActiveWhenVisible);
  });