import { _ as f, a as S, b as T, e as D } from "./tslib.es6-pPsSiLLK.mjs";
import { e as y, x as I, i as O } from "./query-assigned-elements-D930kELM.mjs";
import { s as w, T as P } from "./mwc-tab.css-DUOF704w.mjs";
import { B as x } from "./base-element-DUJkJh_y.mjs";
import { e as M } from "./event-options-C7DvXRgq.mjs";
import { i as g } from "./query-CDOd1Kwm.mjs";
import { a as K } from "./utils-Dr5MegQq.mjs";
import { o as W } from "./observer-DQ8OfVDQ.mjs";
import { n as F } from "./property-DJzm_oB9.mjs";
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
let R = class extends P {
};
R.styles = [w];
R = f([
  y("mwc-tab")
], R);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
function Y(n, e) {
  var t = n.matches || n.webkitMatchesSelector || n.msMatchesSelector;
  return t.call(n, e);
}
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var N = (
  /** @class */
  function() {
    function n(e) {
      e === void 0 && (e = {}), this.adapter = e;
    }
    return Object.defineProperty(n, "cssClasses", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "strings", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "numbers", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "defaultAdapter", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), n.prototype.init = function() {
    }, n.prototype.destroy = function() {
    }, n;
  }()
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var V = {
  ANIMATING: "mdc-tab-scroller--animating",
  SCROLL_AREA_SCROLL: "mdc-tab-scroller__scroll-area--scroll",
  SCROLL_TEST: "mdc-tab-scroller__test"
}, H = {
  AREA_SELECTOR: ".mdc-tab-scroller__scroll-area",
  CONTENT_SELECTOR: ".mdc-tab-scroller__scroll-content"
};
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var C = (
  /** @class */
  /* @__PURE__ */ function() {
    function n(e) {
      this.adapter = e;
    }
    return n;
  }()
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var j = (
  /** @class */
  function(n) {
    S(e, n);
    function e() {
      return n !== null && n.apply(this, arguments) || this;
    }
    return e.prototype.getScrollPositionRTL = function() {
      var t = this.adapter.getScrollAreaScrollLeft(), r = this.calculateScrollEdges().right;
      return Math.round(r - t);
    }, e.prototype.scrollToRTL = function(t) {
      var r = this.calculateScrollEdges(), o = this.adapter.getScrollAreaScrollLeft(), l = this.clampScrollValue(r.right - t);
      return {
        finalScrollPosition: l,
        scrollDelta: l - o
      };
    }, e.prototype.incrementScrollRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft(), o = this.clampScrollValue(r - t);
      return {
        finalScrollPosition: o,
        scrollDelta: o - r
      };
    }, e.prototype.getAnimatingScrollPosition = function(t) {
      return t;
    }, e.prototype.calculateScrollEdges = function() {
      var t = this.adapter.getScrollContentOffsetWidth(), r = this.adapter.getScrollAreaOffsetWidth();
      return {
        left: 0,
        right: t - r
      };
    }, e.prototype.clampScrollValue = function(t) {
      var r = this.calculateScrollEdges();
      return Math.min(Math.max(r.left, t), r.right);
    }, e;
  }(C)
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var B = (
  /** @class */
  function(n) {
    S(e, n);
    function e() {
      return n !== null && n.apply(this, arguments) || this;
    }
    return e.prototype.getScrollPositionRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft();
      return Math.round(t - r);
    }, e.prototype.scrollToRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft(), o = this.clampScrollValue(-t);
      return {
        finalScrollPosition: o,
        scrollDelta: o - r
      };
    }, e.prototype.incrementScrollRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft(), o = this.clampScrollValue(r - t);
      return {
        finalScrollPosition: o,
        scrollDelta: o - r
      };
    }, e.prototype.getAnimatingScrollPosition = function(t, r) {
      return t - r;
    }, e.prototype.calculateScrollEdges = function() {
      var t = this.adapter.getScrollContentOffsetWidth(), r = this.adapter.getScrollAreaOffsetWidth();
      return {
        left: r - t,
        right: 0
      };
    }, e.prototype.clampScrollValue = function(t) {
      var r = this.calculateScrollEdges();
      return Math.max(Math.min(r.right, t), r.left);
    }, e;
  }(C)
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var X = (
  /** @class */
  function(n) {
    S(e, n);
    function e() {
      return n !== null && n.apply(this, arguments) || this;
    }
    return e.prototype.getScrollPositionRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft();
      return Math.round(r - t);
    }, e.prototype.scrollToRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft(), o = this.clampScrollValue(t);
      return {
        finalScrollPosition: o,
        scrollDelta: r - o
      };
    }, e.prototype.incrementScrollRTL = function(t) {
      var r = this.adapter.getScrollAreaScrollLeft(), o = this.clampScrollValue(r + t);
      return {
        finalScrollPosition: o,
        scrollDelta: r - o
      };
    }, e.prototype.getAnimatingScrollPosition = function(t, r) {
      return t + r;
    }, e.prototype.calculateScrollEdges = function() {
      var t = this.adapter.getScrollContentOffsetWidth(), r = this.adapter.getScrollAreaOffsetWidth();
      return {
        left: t - r,
        right: 0
      };
    }, e.prototype.clampScrollValue = function(t) {
      var r = this.calculateScrollEdges();
      return Math.min(Math.max(r.right, t), r.left);
    }, e;
  }(C)
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var $ = (
  /** @class */
  function(n) {
    S(e, n);
    function e(t) {
      var r = n.call(this, T(T({}, e.defaultAdapter), t)) || this;
      return r.isAnimating = !1, r;
    }
    return Object.defineProperty(e, "cssClasses", {
      get: function() {
        return V;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "strings", {
      get: function() {
        return H;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "defaultAdapter", {
      get: function() {
        return {
          eventTargetMatchesSelector: function() {
            return !1;
          },
          addClass: function() {
          },
          removeClass: function() {
          },
          addScrollAreaClass: function() {
          },
          setScrollAreaStyleProperty: function() {
          },
          setScrollContentStyleProperty: function() {
          },
          getScrollContentStyleValue: function() {
            return "";
          },
          setScrollAreaScrollLeft: function() {
          },
          getScrollAreaScrollLeft: function() {
            return 0;
          },
          getScrollContentOffsetWidth: function() {
            return 0;
          },
          getScrollAreaOffsetWidth: function() {
            return 0;
          },
          computeScrollAreaClientRect: function() {
            return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
          },
          computeScrollContentClientRect: function() {
            return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
          },
          computeHorizontalScrollbarHeight: function() {
            return 0;
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.init = function() {
      var t = this.adapter.computeHorizontalScrollbarHeight();
      this.adapter.setScrollAreaStyleProperty("margin-bottom", -t + "px"), this.adapter.addScrollAreaClass(e.cssClasses.SCROLL_AREA_SCROLL);
    }, e.prototype.getScrollPosition = function() {
      if (this.isRTL())
        return this.computeCurrentScrollPositionRTL();
      var t = this.calculateCurrentTranslateX(), r = this.adapter.getScrollAreaScrollLeft();
      return r - t;
    }, e.prototype.handleInteraction = function() {
      this.isAnimating && this.stopScrollAnimation();
    }, e.prototype.handleTransitionEnd = function(t) {
      var r = t.target;
      !this.isAnimating || !this.adapter.eventTargetMatchesSelector(r, e.strings.CONTENT_SELECTOR) || (this.isAnimating = !1, this.adapter.removeClass(e.cssClasses.ANIMATING));
    }, e.prototype.incrementScroll = function(t) {
      t !== 0 && this.animate(this.getIncrementScrollOperation(t));
    }, e.prototype.incrementScrollImmediate = function(t) {
      if (t !== 0) {
        var r = this.getIncrementScrollOperation(t);
        r.scrollDelta !== 0 && (this.stopScrollAnimation(), this.adapter.setScrollAreaScrollLeft(r.finalScrollPosition));
      }
    }, e.prototype.scrollTo = function(t) {
      if (this.isRTL()) {
        this.scrollToImplRTL(t);
        return;
      }
      this.scrollToImpl(t);
    }, e.prototype.getRTLScroller = function() {
      return this.rtlScrollerInstance || (this.rtlScrollerInstance = this.rtlScrollerFactory()), this.rtlScrollerInstance;
    }, e.prototype.calculateCurrentTranslateX = function() {
      var t = this.adapter.getScrollContentStyleValue("transform");
      if (t === "none")
        return 0;
      var r = /\((.+?)\)/.exec(t);
      if (!r)
        return 0;
      var o = r[1], l = D(o.split(","), 6);
      l[0], l[1], l[2], l[3];
      var a = l[4];
      return l[5], parseFloat(a);
    }, e.prototype.clampScrollValue = function(t) {
      var r = this.calculateScrollEdges();
      return Math.min(Math.max(r.left, t), r.right);
    }, e.prototype.computeCurrentScrollPositionRTL = function() {
      var t = this.calculateCurrentTranslateX();
      return this.getRTLScroller().getScrollPositionRTL(t);
    }, e.prototype.calculateScrollEdges = function() {
      var t = this.adapter.getScrollContentOffsetWidth(), r = this.adapter.getScrollAreaOffsetWidth();
      return {
        left: 0,
        right: t - r
      };
    }, e.prototype.scrollToImpl = function(t) {
      var r = this.getScrollPosition(), o = this.clampScrollValue(t), l = o - r;
      this.animate({
        finalScrollPosition: o,
        scrollDelta: l
      });
    }, e.prototype.scrollToImplRTL = function(t) {
      var r = this.getRTLScroller().scrollToRTL(t);
      this.animate(r);
    }, e.prototype.getIncrementScrollOperation = function(t) {
      if (this.isRTL())
        return this.getRTLScroller().incrementScrollRTL(t);
      var r = this.getScrollPosition(), o = t + r, l = this.clampScrollValue(o), a = l - r;
      return {
        finalScrollPosition: l,
        scrollDelta: a
      };
    }, e.prototype.animate = function(t) {
      var r = this;
      t.scrollDelta !== 0 && (this.stopScrollAnimation(), this.adapter.setScrollAreaScrollLeft(t.finalScrollPosition), this.adapter.setScrollContentStyleProperty("transform", "translateX(" + t.scrollDelta + "px)"), this.adapter.computeScrollAreaClientRect(), requestAnimationFrame(function() {
        r.adapter.addClass(e.cssClasses.ANIMATING), r.adapter.setScrollContentStyleProperty("transform", "none");
      }), this.isAnimating = !0);
    }, e.prototype.stopScrollAnimation = function() {
      this.isAnimating = !1;
      var t = this.getAnimatingScrollPosition();
      this.adapter.removeClass(e.cssClasses.ANIMATING), this.adapter.setScrollContentStyleProperty("transform", "translateX(0px)"), this.adapter.setScrollAreaScrollLeft(t);
    }, e.prototype.getAnimatingScrollPosition = function() {
      var t = this.calculateCurrentTranslateX(), r = this.adapter.getScrollAreaScrollLeft();
      return this.isRTL() ? this.getRTLScroller().getAnimatingScrollPosition(r, t) : r - t;
    }, e.prototype.rtlScrollerFactory = function() {
      var t = this.adapter.getScrollAreaScrollLeft();
      this.adapter.setScrollAreaScrollLeft(t - 1);
      var r = this.adapter.getScrollAreaScrollLeft();
      if (r < 0)
        return this.adapter.setScrollAreaScrollLeft(t), new B(this.adapter);
      var o = this.adapter.computeScrollAreaClientRect(), l = this.adapter.computeScrollContentClientRect(), a = Math.round(l.right - o.right);
      return this.adapter.setScrollAreaScrollLeft(t), a === r ? new X(this.adapter) : new j(this.adapter);
    }, e.prototype.isRTL = function() {
      return this.adapter.getScrollContentStyleValue("direction") === "rtl";
    }, e;
  }(N)
);
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
class b extends x {
  constructor() {
    super(...arguments), this.mdcFoundationClass = $, this._scrollbarHeight = -1;
  }
  _handleInteraction() {
    this.mdcFoundation.handleInteraction();
  }
  _handleTransitionEnd(e) {
    this.mdcFoundation.handleTransitionEnd(e);
  }
  render() {
    return I`
      <div class="mdc-tab-scroller">
        <div class="mdc-tab-scroller__scroll-area"
            @wheel="${this._handleInteraction}"
            @touchstart="${this._handleInteraction}"
            @pointerdown="${this._handleInteraction}"
            @mousedown="${this._handleInteraction}"
            @keydown="${this._handleInteraction}"
            @transitionend="${this._handleTransitionEnd}">
          <div class="mdc-tab-scroller__scroll-content"><slot></slot></div>
        </div>
      </div>
      `;
  }
  createAdapter() {
    return Object.assign(Object.assign({}, K(this.mdcRoot)), { eventTargetMatchesSelector: (e, t) => Y(e, t), addScrollAreaClass: (e) => this.scrollAreaElement.classList.add(e), setScrollAreaStyleProperty: (e, t) => this.scrollAreaElement.style.setProperty(e, t), setScrollContentStyleProperty: (e, t) => this.scrollContentElement.style.setProperty(e, t), getScrollContentStyleValue: (e) => window.getComputedStyle(this.scrollContentElement).getPropertyValue(e), setScrollAreaScrollLeft: (e) => this.scrollAreaElement.scrollLeft = e, getScrollAreaScrollLeft: () => this.scrollAreaElement.scrollLeft, getScrollContentOffsetWidth: () => this.scrollContentElement.offsetWidth, getScrollAreaOffsetWidth: () => this.scrollAreaElement.offsetWidth, computeScrollAreaClientRect: () => this.scrollAreaElement.getBoundingClientRect(), computeScrollContentClientRect: () => this.scrollContentElement.getBoundingClientRect(), computeHorizontalScrollbarHeight: () => (this._scrollbarHeight === -1 && (this.scrollAreaElement.style.overflowX = "scroll", this._scrollbarHeight = this.scrollAreaElement.offsetHeight - this.scrollAreaElement.clientHeight, this.scrollAreaElement.style.overflowX = ""), this._scrollbarHeight) });
  }
  /**
   * Returns the current visual scroll position
   * @return {number}
   */
  getScrollPosition() {
    return this.mdcFoundation.getScrollPosition();
  }
  /**
   * Returns the width of the scroll content
   * @return {number}
   */
  getScrollContentWidth() {
    return this.scrollContentElement.offsetWidth;
  }
  /**
   * Increments the scroll value by the given amount
   * @param {number} scrollXIncrement The pixel value by which to increment the
   *     scroll value
   */
  incrementScrollPosition(e) {
    this.mdcFoundation.incrementScroll(e);
  }
  /**
   * Scrolls to the given pixel position
   * @param {number} scrollX The pixel value to scroll to
   */
  scrollToPosition(e) {
    this.mdcFoundation.scrollTo(e);
  }
}
f([
  g(".mdc-tab-scroller")
], b.prototype, "mdcRoot", void 0);
f([
  g(".mdc-tab-scroller__scroll-area")
], b.prototype, "scrollAreaElement", void 0);
f([
  g(".mdc-tab-scroller__scroll-content")
], b.prototype, "scrollContentElement", void 0);
f([
  M({ passive: !0 })
], b.prototype, "_handleInteraction", null);
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-LIcense-Identifier: Apache-2.0
 */
const G = O`.mdc-tab-scroller{overflow-y:hidden}.mdc-tab-scroller.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-scroller__test{position:absolute;top:-9999px;width:100px;height:100px;overflow-x:scroll}.mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:touch;display:flex;overflow-x:hidden}.mdc-tab-scroller__scroll-area::-webkit-scrollbar,.mdc-tab-scroller__test::-webkit-scrollbar{display:none}.mdc-tab-scroller__scroll-area--scroll{overflow-x:scroll}.mdc-tab-scroller__scroll-content{position:relative;display:flex;flex:1 0 auto;transform:none;will-change:transform}.mdc-tab-scroller--align-start .mdc-tab-scroller__scroll-content{justify-content:flex-start}.mdc-tab-scroller--align-end .mdc-tab-scroller__scroll-content{justify-content:flex-end}.mdc-tab-scroller--align-center .mdc-tab-scroller__scroll-content{justify-content:center}.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:auto}:host{display:flex}.mdc-tab-scroller{flex:1}`;
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
let _ = class extends b {
};
_.styles = [G];
_ = f([
  y("mwc-tab-scroller")
], _);
/**
 * @license
 * Copyright 2016 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var U = (
  /** @class */
  function() {
    function n(e) {
      e === void 0 && (e = {}), this.adapter = e;
    }
    return Object.defineProperty(n, "cssClasses", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "strings", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "numbers", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(n, "defaultAdapter", {
      get: function() {
        return {};
      },
      enumerable: !1,
      configurable: !0
    }), n.prototype.init = function() {
    }, n.prototype.destroy = function() {
    }, n;
  }()
);
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var i = {
  ARROW_LEFT_KEY: "ArrowLeft",
  ARROW_RIGHT_KEY: "ArrowRight",
  END_KEY: "End",
  ENTER_KEY: "Enter",
  HOME_KEY: "Home",
  SPACE_KEY: "Space",
  TAB_ACTIVATED_EVENT: "MDCTabBar:activated",
  TAB_SCROLLER_SELECTOR: ".mdc-tab-scroller",
  TAB_SELECTOR: ".mdc-tab"
}, d = {
  ARROW_LEFT_KEYCODE: 37,
  ARROW_RIGHT_KEYCODE: 39,
  END_KEYCODE: 35,
  ENTER_KEYCODE: 13,
  EXTRA_SCROLL_AMOUNT: 20,
  HOME_KEYCODE: 36,
  SPACE_KEYCODE: 32
};
/**
 * @license
 * Copyright 2018 Google Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
var p = /* @__PURE__ */ new Set();
p.add(i.ARROW_LEFT_KEY);
p.add(i.ARROW_RIGHT_KEY);
p.add(i.END_KEY);
p.add(i.HOME_KEY);
p.add(i.ENTER_KEY);
p.add(i.SPACE_KEY);
var m = /* @__PURE__ */ new Map();
m.set(d.ARROW_LEFT_KEYCODE, i.ARROW_LEFT_KEY);
m.set(d.ARROW_RIGHT_KEYCODE, i.ARROW_RIGHT_KEY);
m.set(d.END_KEYCODE, i.END_KEY);
m.set(d.HOME_KEYCODE, i.HOME_KEY);
m.set(d.ENTER_KEYCODE, i.ENTER_KEY);
m.set(d.SPACE_KEYCODE, i.SPACE_KEY);
var L = (
  /** @class */
  function(n) {
    S(e, n);
    function e(t) {
      var r = n.call(this, T(T({}, e.defaultAdapter), t)) || this;
      return r.useAutomaticActivation = !1, r;
    }
    return Object.defineProperty(e, "strings", {
      get: function() {
        return i;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "numbers", {
      get: function() {
        return d;
      },
      enumerable: !1,
      configurable: !0
    }), Object.defineProperty(e, "defaultAdapter", {
      get: function() {
        return {
          scrollTo: function() {
          },
          incrementScroll: function() {
          },
          getScrollPosition: function() {
            return 0;
          },
          getScrollContentWidth: function() {
            return 0;
          },
          getOffsetWidth: function() {
            return 0;
          },
          isRTL: function() {
            return !1;
          },
          setActiveTab: function() {
          },
          activateTabAtIndex: function() {
          },
          deactivateTabAtIndex: function() {
          },
          focusTabAtIndex: function() {
          },
          getTabIndicatorClientRectAtIndex: function() {
            return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
          },
          getTabDimensionsAtIndex: function() {
            return { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
          },
          getPreviousActiveTabIndex: function() {
            return -1;
          },
          getFocusedTabIndex: function() {
            return -1;
          },
          getIndexOfTabById: function() {
            return -1;
          },
          getTabListLength: function() {
            return 0;
          },
          notifyTabActivated: function() {
          }
        };
      },
      enumerable: !1,
      configurable: !0
    }), e.prototype.setUseAutomaticActivation = function(t) {
      this.useAutomaticActivation = t;
    }, e.prototype.activateTab = function(t) {
      var r = this.adapter.getPreviousActiveTabIndex();
      if (!(!this.indexIsInRange(t) || t === r)) {
        var o;
        r !== -1 && (this.adapter.deactivateTabAtIndex(r), o = this.adapter.getTabIndicatorClientRectAtIndex(r)), this.adapter.activateTabAtIndex(t, o), this.scrollIntoView(t), this.adapter.notifyTabActivated(t);
      }
    }, e.prototype.handleKeyDown = function(t) {
      var r = this.getKeyFromEvent(t);
      if (r !== void 0)
        if (this.isActivationKey(r) || t.preventDefault(), this.useAutomaticActivation) {
          if (this.isActivationKey(r))
            return;
          var o = this.determineTargetFromKey(this.adapter.getPreviousActiveTabIndex(), r);
          this.adapter.setActiveTab(o), this.scrollIntoView(o);
        } else {
          var l = this.adapter.getFocusedTabIndex();
          if (this.isActivationKey(r))
            this.adapter.setActiveTab(l);
          else {
            var o = this.determineTargetFromKey(l, r);
            this.adapter.focusTabAtIndex(o), this.scrollIntoView(o);
          }
        }
    }, e.prototype.handleTabInteraction = function(t) {
      this.adapter.setActiveTab(this.adapter.getIndexOfTabById(t.detail.tabId));
    }, e.prototype.scrollIntoView = function(t) {
      if (this.indexIsInRange(t)) {
        if (t === 0) {
          this.adapter.scrollTo(0);
          return;
        }
        if (t === this.adapter.getTabListLength() - 1) {
          this.adapter.scrollTo(this.adapter.getScrollContentWidth());
          return;
        }
        if (this.isRTL()) {
          this.scrollIntoViewImplRTL(t);
          return;
        }
        this.scrollIntoViewImpl(t);
      }
    }, e.prototype.determineTargetFromKey = function(t, r) {
      var o = this.isRTL(), l = this.adapter.getTabListLength() - 1, a = r === i.END_KEY, s = r === i.ARROW_LEFT_KEY && !o || r === i.ARROW_RIGHT_KEY && o, u = r === i.ARROW_RIGHT_KEY && !o || r === i.ARROW_LEFT_KEY && o, c = t;
      return a ? c = l : s ? c -= 1 : u ? c += 1 : c = 0, c < 0 ? c = l : c > l && (c = 0), c;
    }, e.prototype.calculateScrollIncrement = function(t, r, o, l) {
      var a = this.adapter.getTabDimensionsAtIndex(r), s = a.contentLeft - o - l, u = a.contentRight - o, c = u - d.EXTRA_SCROLL_AMOUNT, h = s + d.EXTRA_SCROLL_AMOUNT;
      return r < t ? Math.min(c, 0) : Math.max(h, 0);
    }, e.prototype.calculateScrollIncrementRTL = function(t, r, o, l, a) {
      var s = this.adapter.getTabDimensionsAtIndex(r), u = a - s.contentLeft - o, c = a - s.contentRight - o - l, h = c + d.EXTRA_SCROLL_AMOUNT, E = u - d.EXTRA_SCROLL_AMOUNT;
      return r > t ? Math.max(h, 0) : Math.min(E, 0);
    }, e.prototype.findAdjacentTabIndexClosestToEdge = function(t, r, o, l) {
      var a = r.rootLeft - o, s = r.rootRight - o - l, u = a + s, c = a < 0 || u < 0, h = s > 0 || u > 0;
      return c ? t - 1 : h ? t + 1 : -1;
    }, e.prototype.findAdjacentTabIndexClosestToEdgeRTL = function(t, r, o, l, a) {
      var s = a - r.rootLeft - l - o, u = a - r.rootRight - o, c = s + u, h = s > 0 || c > 0, E = u < 0 || c < 0;
      return h ? t + 1 : E ? t - 1 : -1;
    }, e.prototype.getKeyFromEvent = function(t) {
      return p.has(t.key) ? t.key : m.get(t.keyCode);
    }, e.prototype.isActivationKey = function(t) {
      return t === i.SPACE_KEY || t === i.ENTER_KEY;
    }, e.prototype.indexIsInRange = function(t) {
      return t >= 0 && t < this.adapter.getTabListLength();
    }, e.prototype.isRTL = function() {
      return this.adapter.isRTL();
    }, e.prototype.scrollIntoViewImpl = function(t) {
      var r = this.adapter.getScrollPosition(), o = this.adapter.getOffsetWidth(), l = this.adapter.getTabDimensionsAtIndex(t), a = this.findAdjacentTabIndexClosestToEdge(t, l, r, o);
      if (this.indexIsInRange(a)) {
        var s = this.calculateScrollIncrement(t, a, r, o);
        this.adapter.incrementScroll(s);
      }
    }, e.prototype.scrollIntoViewImplRTL = function(t) {
      var r = this.adapter.getScrollPosition(), o = this.adapter.getOffsetWidth(), l = this.adapter.getTabDimensionsAtIndex(t), a = this.adapter.getScrollContentWidth(), s = this.findAdjacentTabIndexClosestToEdgeRTL(t, l, r, o, a);
      if (this.indexIsInRange(s)) {
        var u = this.calculateScrollIncrementRTL(t, s, r, o, a);
        this.adapter.incrementScroll(u);
      }
    }, e;
  }(U)
);
/**
 * @license
 * Copyright 2018 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
class v extends x {
  constructor() {
    super(...arguments), this.mdcFoundationClass = L, this.activeIndex = 0, this._previousActiveIndex = -1;
  }
  _handleTabInteraction(e) {
    this.mdcFoundation.handleTabInteraction(e);
  }
  _handleKeydown(e) {
    this.mdcFoundation.handleKeyDown(e);
  }
  // TODO(sorvell): can scroller be optional for perf?
  render() {
    return I`
      <div class="mdc-tab-bar" role="tablist"
          @MDCTab:interacted="${this._handleTabInteraction}"
          @keydown="${this._handleKeydown}">
        <mwc-tab-scroller><slot></slot></mwc-tab-scroller>
      </div>
      `;
  }
  // TODO(sorvell): probably want to memoize this and use a `slotChange` event
  _getTabs() {
    return this.tabsSlot.assignedNodes({ flatten: !0 }).filter((e) => e instanceof P);
  }
  _getTab(e) {
    return this._getTabs()[e];
  }
  createAdapter() {
    return {
      scrollTo: (e) => this.scrollerElement.scrollToPosition(e),
      incrementScroll: (e) => this.scrollerElement.incrementScrollPosition(e),
      getScrollPosition: () => this.scrollerElement.getScrollPosition(),
      getScrollContentWidth: () => this.scrollerElement.getScrollContentWidth(),
      getOffsetWidth: () => this.mdcRoot.offsetWidth,
      isRTL: () => window.getComputedStyle(this.mdcRoot).getPropertyValue("direction") === "rtl",
      setActiveTab: (e) => this.mdcFoundation.activateTab(e),
      activateTabAtIndex: (e, t) => {
        const r = this._getTab(e);
        r !== void 0 && r.activate(t), this._previousActiveIndex = e;
      },
      deactivateTabAtIndex: (e) => {
        const t = this._getTab(e);
        t !== void 0 && t.deactivate();
      },
      focusTabAtIndex: (e) => {
        const t = this._getTab(e);
        t !== void 0 && t.focus();
      },
      // TODO(sorvell): tab may not be able to synchronously answer
      // `computeIndicatorClientRect` if an update is pending or it has not yet
      // updated. If this is necessary, LitElement may need a `forceUpdate`
      // method.
      getTabIndicatorClientRectAtIndex: (e) => {
        const t = this._getTab(e);
        return t !== void 0 ? t.computeIndicatorClientRect() : new DOMRect();
      },
      getTabDimensionsAtIndex: (e) => {
        const t = this._getTab(e);
        return t !== void 0 ? t.computeDimensions() : { rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 };
      },
      getPreviousActiveTabIndex: () => this._previousActiveIndex,
      getFocusedTabIndex: () => {
        const e = this._getTabs(), t = this.getRootNode().activeElement;
        return e.indexOf(t);
      },
      getIndexOfTabById: (e) => {
        const t = this._getTabs();
        for (let r = 0; r < t.length; r++)
          if (t[r].id === e)
            return r;
        return -1;
      },
      getTabListLength: () => this._getTabs().length,
      notifyTabActivated: (e) => {
        this.activeIndex = e, this.dispatchEvent(new CustomEvent(L.strings.TAB_ACTIVATED_EVENT, { detail: { index: e }, bubbles: !0, cancelable: !0 }));
      }
    };
  }
  firstUpdated() {
  }
  async getUpdateComplete() {
    const e = await super.getUpdateComplete();
    return await this.scrollerElement.updateComplete, this.mdcFoundation === void 0 && this.createFoundation(), e;
  }
  scrollIndexIntoView(e) {
    this.mdcFoundation.scrollIntoView(e);
  }
}
f([
  g(".mdc-tab-bar")
], v.prototype, "mdcRoot", void 0);
f([
  g("mwc-tab-scroller")
], v.prototype, "scrollerElement", void 0);
f([
  g("slot")
], v.prototype, "tabsSlot", void 0);
f([
  W(async function() {
    await this.updateComplete, this.activeIndex !== this._previousActiveIndex && this.mdcFoundation.activateTab(this.activeIndex);
  }),
  F({ type: Number })
], v.prototype, "activeIndex", void 0);
/**
 * @license
 * Copyright 2021 Google LLC
 * SPDX-LIcense-Identifier: Apache-2.0
 */
const k = O`.mdc-tab-bar{width:100%}.mdc-tab{height:48px}.mdc-tab--stacked{height:72px}:host{display:block}.mdc-tab-bar{flex:1}mwc-tab{--mdc-tab-height: 48px;--mdc-tab-stacked-height: 72px}`;
var z = Object.getOwnPropertyDescriptor, q = (n, e, t, r) => {
  for (var o = r > 1 ? void 0 : r ? z(e, t) : e, l = n.length - 1, a; l >= 0; l--)
    (a = n[l]) && (o = a(o) || o);
  return o;
};
let A = class extends v {
};
A.styles = [k];
A = q([
  y("cv-tab-bar")
], A);
const ct = A;
export {
  A as CovalentTabBar,
  ct as default
};
