import { T as TailwindStyledElement, x } from '../../index-8c5a9941.js';
import { n, e } from '../../query-assigned-elements-1c8c9e90.js';
import { t } from '../../state-b9ca4e74.js';
import { c as customClassMap } from '../../index-5e194caf.js';
import '../lukso-icon/index.js';
import '../lukso-sanitize/index.js';
import '../../directive-2bb7789e.js';
import '../../style-map-1ee93d7f.js';

const style = ":host {\n    display: flex;\n    height: 100%\n}";

var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result)
    __defProp(target, key, result);
  return result;
};
let LuksoTerms = class extends TailwindStyledElement(style) {
  constructor() {
    super(...arguments);
    this.text = "";
    this.hasScrollButton = true;
    this.defaultStyles = `h-[56px] w-full sticky bottom-0 -mt-[56px]
    bg-gradient-to-b from-transparent to-neutral-100/80
    flex justify-center transition-opacity opacity-0`;
  }
  onScrollBottom() {
    const event = new CustomEvent("on-bottom-scroll", {
      bubbles: true,
      composed: true
    });
    this.dispatchEvent(event);
  }
  handleScroll() {
    const scrollContainer = this.shadowRoot.getElementById("scroll-container");
    const scrollHeight = scrollContainer.scrollHeight - scrollContainer.offsetHeight;
    const scrollTop = scrollContainer.scrollTop;
    if (scrollTop >= scrollHeight) {
      this.onScrollBottom();
      this.hasScrollButton = false;
    } else {
      this.hasScrollButton = true;
    }
  }
  handleBottomScroll() {
    const scrollEnd = this.shadowRoot.getElementById("scroll-end");
    scrollEnd && scrollEnd.scrollIntoView({
      behavior: "smooth",
      block: "nearest",
      inline: "start"
    });
  }
  render() {
    return x`<div
      id="scroll-container"
      class="border border-solid border-neutral-90 rounded-12 overflow-y-scroll relative scrollbar-none"
      @scroll=${this.handleScroll}
    >
      <div class="paragraph-inter-12-regular px-4 pt-3">
        <lukso-sanitize html-content=${this.text} is-pre></lukso-sanitize>
        <br />
        <br />
        <div id="scroll-end"></div>
      </div>
      <div
        class=${customClassMap({
      [this.defaultStyles]: true,
      "!opacity-100": this.hasScrollButton
    })}
      >
        <div
          data-testid="scroll-to-bottom"
          class="w-10 h-10 bg-neutral-100 rounded-full shadow-1xl flex items-center justify-center animate-bounce2 cursor-pointer"
          @click=${this.handleBottomScroll}
        >
          <lukso-icon name="arrow-down-lg"></lukso-icon>
        </div>
      </div>
    </div>`;
  }
};
__decorateClass([
  n({ type: String })
], LuksoTerms.prototype, "text", 2);
__decorateClass([
  t()
], LuksoTerms.prototype, "hasScrollButton", 2);
LuksoTerms = __decorateClass([
  e("lukso-terms")
], LuksoTerms);

export { LuksoTerms };
