import { e as h } from "./custom-element-eaccb8d2.mjs";
import { n as c } from "./plus-base-10eea8a6.mjs";
import { i as l } from "./query-59d2d374.mjs";
import { n as u } from "./static-5cfd1f40.mjs";
import { F as d } from "./floating-ui-5c56eab3.mjs";
class f extends d {
  constructor() {
    super();
  }
  listener() {
    this.options.target && document.addEventListener("click", (t) => {
      t.composedPath().includes(this.options.target) ? this.show() : this.hide();
    });
  }
}
var m = Object.defineProperty, b = Object.getOwnPropertyDescriptor, r = (i, t, o, n) => {
  for (var s = n > 1 ? void 0 : n ? b(t, o) : t, p = i.length - 1, a; p >= 0; p--)
    (a = i[p]) && (s = (n ? a(t, o, s) : a(s)) || s);
  return n && s && m(t, o, s), s;
};
let e = class extends f {
  constructor() {
    super(), this.position = "bottom-start", this.open = !1;
  }
  async update(i) {
    var t;
    super.update(i), await ((t = this.target) == null ? void 0 : t.then((o) => {
      this.options.target = o;
    })), this.options.target && (this.options.content = this.content, this.options.position = this.position, this.options.offset = 4, this.listener(), this.options.isOpened = (o) => {
      this.open != o && (this.open = o, this.emit("plus-sticky-box-change", { detail: { open: o } }));
    });
  }
  render() {
    return u`
      <div class="stickybox absolute z-[999] hidden max-h-40 min-w-64 overflow-y-auto !scroll-smooth  rounded border border-color-default bg-color-surface-base shadow-md">
        <slot></slot>
      </div>
    `;
  }
};
r([
  l(".stickybox")
], e.prototype, "content", 2);
r([
  c({ attribute: !1 })
], e.prototype, "target", 2);
r([
  c({ attribute: !1 })
], e.prototype, "position", 2);
r([
  c({ attribute: !1 })
], e.prototype, "open", 2);
e = r([
  h("plus-sticky-box")
], e);
export {
  f as S,
  e as a
};
