import { C as w } from "../../Shared/base-PQGakkrl.js";
/*!
 * Waves v0.7.6
 * http://fian.my.id/Waves
 *
 * Copyright 2014-2018 Alfiana E. Sibuea and other contributors
 * Released under the MIT license
 * https://github.com/fians/Waves/blob/master/LICENSE
 */
(function(o, d) {
  typeof define == "function" && define.amd ? define([], function() {
    return o.Waves = d.call(o), o.Waves;
  }) : typeof exports == "object" ? module.exports = d.call(o) : (o || Window).Waves = d.call(o);
})(typeof global == "object" ? global : void 0, function() {
  var o = o || {}, d = document.querySelectorAll.bind(document), h = Object.prototype.toString, y = "ontouchstart" in window;
  function b(t) {
    return t !== null && t === t.window;
  }
  function g(t) {
    return b(t) ? t : t.nodeType === 9 && t.defaultView;
  }
  function v(t) {
    var e = typeof t;
    return e === "function" || e === "object" && !!t;
  }
  function N(t) {
    return v(t) && t.nodeType > 0;
  }
  function E(t) {
    var e = h.call(t);
    return e === "[object String]" ? d(t) : v(t) && /^\[object (Array|HTMLCollection|NodeList|Object)\]$/.test(e) && t.hasOwnProperty("length") ? t : N(t) ? [t] : [];
  }
  function A(t) {
    var e, a, n = { top: 0, left: 0 }, r = t && t.ownerDocument;
    return e = r.documentElement, typeof t.getBoundingClientRect < "u" && (n = t.getBoundingClientRect()), a = g(r), {
      top: n.top + a.pageYOffset - e.clientTop,
      left: n.left + a.pageXOffset - e.clientLeft
    };
  }
  function L(t) {
    var e = "";
    for (var a in t)
      t.hasOwnProperty(a) && (e += a + ":" + t[a] + ";");
    return e;
  }
  var s = {
    // Effect duration
    duration: 750,
    // Effect delay (check for scroll before showing effect)
    delay: 200,
    show: function(t, e, a) {
      if (t.button === 2)
        return !1;
      e = e || this;
      var n = document.createElement("div");
      n.className = "waves-ripple waves-rippling", e.appendChild(n);
      var r = A(e), i = 0, u = 0;
      "touches" in t && t.touches.length ? (i = t.touches[0].pageY - r.top, u = t.touches[0].pageX - r.left) : (i = t.pageY - r.top, u = t.pageX - r.left), u = u >= 0 ? u : 0, i = i >= 0 ? i : 0;
      var l = "scale(" + e.clientWidth / 100 * 3 + ")", f = "translate(0,0)";
      a && (f = "translate(" + a.x + "px, " + a.y + "px)"), n.setAttribute("data-hold", Date.now()), n.setAttribute("data-x", u), n.setAttribute("data-y", i), n.setAttribute("data-scale", l), n.setAttribute("data-translate", f);
      var c = {
        top: i + "px",
        left: u + "px"
      };
      n.classList.add("waves-notransition"), n.setAttribute("style", L(c)), n.classList.remove("waves-notransition"), c["-webkit-transform"] = l + " " + f, c["-moz-transform"] = l + " " + f, c["-ms-transform"] = l + " " + f, c["-o-transform"] = l + " " + f, c.transform = l + " " + f, c.opacity = "1";
      var m = t.type === "mousemove" ? 2500 : s.duration;
      c["-webkit-transition-duration"] = m + "ms", c["-moz-transition-duration"] = m + "ms", c["-o-transition-duration"] = m + "ms", c["transition-duration"] = m + "ms", n.setAttribute("style", L(c));
    },
    hide: function(t, e) {
      e = e || this;
      for (var a = e.getElementsByClassName("waves-rippling"), n = 0, r = a.length; n < r; n++)
        k(t, e, a[n]);
      y && (e.removeEventListener("touchend", s.hide), e.removeEventListener("touchcancel", s.hide)), e.removeEventListener("mouseup", s.hide), e.removeEventListener("mouseleave", s.hide);
    }
  }, T = {
    // Wrap <input> tag so it can perform the effect
    input: function(t) {
      var e = t.parentNode;
      if (!(e.tagName.toLowerCase() === "i" && e.classList.contains("waves-effect"))) {
        var a = document.createElement("i");
        a.className = t.className + " waves-input-wrapper", t.className = "waves-button-input", e.replaceChild(a, t), a.appendChild(t);
        var n = window.getComputedStyle(t, null), r = n.color, i = n.backgroundColor;
        a.setAttribute("style", "color:" + r + ";background:" + i), t.setAttribute("style", "background-color:rgba(0,0,0,0);");
      }
    },
    // Wrap <img> tag so it can perform the effect
    img: function(t) {
      var e = t.parentNode;
      if (!(e.tagName.toLowerCase() === "i" && e.classList.contains("waves-effect"))) {
        var a = document.createElement("i");
        e.replaceChild(a, t), a.appendChild(t);
      }
    }
  };
  function k(t, e, a) {
    if (a) {
      a.classList.remove("waves-rippling");
      var n = a.getAttribute("data-x"), r = a.getAttribute("data-y"), i = a.getAttribute("data-scale"), u = a.getAttribute("data-translate"), l = Date.now() - Number(a.getAttribute("data-hold")), f = 350 - l;
      f < 0 && (f = 0), t.type === "mousemove" && (f = 150);
      var c = t.type === "mousemove" ? 2500 : s.duration;
      setTimeout(function() {
        var m = {
          top: r + "px",
          left: n + "px",
          opacity: "0",
          // Duration
          "-webkit-transition-duration": c + "ms",
          "-moz-transition-duration": c + "ms",
          "-o-transition-duration": c + "ms",
          "transition-duration": c + "ms",
          "-webkit-transform": i + " " + u,
          "-moz-transform": i + " " + u,
          "-ms-transform": i + " " + u,
          "-o-transform": i + " " + u,
          transform: i + " " + u
        };
        a.setAttribute("style", L(m)), setTimeout(function() {
          try {
            e.removeChild(a);
          } catch {
            return !1;
          }
        }, c);
      }, f);
    }
  }
  var p = {
    /* uses an integer rather than bool so there's no issues with
     * needing to clear timeouts if another touch event occurred
     * within the 500ms. Cannot mouseup between touchstart and
     * touchend, nor in the 500ms after touchend. */
    touches: 0,
    allowEvent: function(t) {
      var e = !0;
      return /^(mousedown|mousemove)$/.test(t.type) && p.touches && (e = !1), e;
    },
    registerEvent: function(t) {
      var e = t.type;
      e === "touchstart" ? p.touches += 1 : /^(touchend|touchcancel)$/.test(e) && setTimeout(function() {
        p.touches && (p.touches -= 1);
      }, 500);
    }
  };
  function O(t) {
    if (p.allowEvent(t) === !1)
      return null;
    for (var e = null, a = t.target || t.srcElement; a.parentElement; ) {
      if (!(a instanceof SVGElement) && a.classList.contains("waves-effect")) {
        e = a;
        break;
      }
      a = a.parentElement;
    }
    return e;
  }
  function x(t) {
    var e = O(t);
    if (e !== null) {
      if (e.disabled || e.getAttribute("disabled") || e.classList.contains("disabled"))
        return;
      if (p.registerEvent(t), t.type === "touchstart" && s.delay) {
        var a = !1, n = setTimeout(function() {
          n = null, s.show(t, e);
        }, s.delay), r = function(l) {
          n && (clearTimeout(n), n = null, s.show(t, e)), a || (a = !0, s.hide(l, e)), u();
        }, i = function(l) {
          n && (clearTimeout(n), n = null), r(l), u();
        };
        e.addEventListener("touchmove", i, !1), e.addEventListener("touchend", r, !1), e.addEventListener("touchcancel", r, !1);
        var u = function() {
          e.removeEventListener("touchmove", i), e.removeEventListener("touchend", r), e.removeEventListener("touchcancel", r);
        };
      } else
        s.show(t, e), y && (e.addEventListener("touchend", s.hide, !1), e.addEventListener("touchcancel", s.hide, !1)), e.addEventListener("mouseup", s.hide, !1), e.addEventListener("mouseleave", s.hide, !1);
    }
  }
  return o.init = function(t) {
    var e = document.body;
    t = t || {}, "duration" in t && (s.duration = t.duration), "delay" in t && (s.delay = t.delay), y && (e.addEventListener("touchstart", x, !1), e.addEventListener("touchcancel", p.registerEvent, !1), e.addEventListener("touchend", p.registerEvent, !1)), e.addEventListener("mousedown", x, !1);
  }, o.attach = function(t, e) {
    t = E(t), h.call(e) === "[object Array]" && (e = e.join(" ")), e = e ? " " + e : "";
    for (var a, n, r = 0, i = t.length; r < i; r++)
      a = t[r], n = a.tagName.toLowerCase(), ["input", "img"].indexOf(n) !== -1 && (T[n](a), a = a.parentElement), a.className.indexOf("waves-effect") === -1 && (a.className += " waves-effect" + e);
  }, o.ripple = function(t, e) {
    t = E(t);
    var a = t.length;
    if (e = e || {}, e.wait = e.wait || 0, e.position = e.position || null, a) {
      for (var n, r, i, u = {}, l = 0, f = {
        type: "mousedown",
        button: 1
      }, c = function(C, S) {
        return function() {
          s.hide(C, S);
        };
      }; l < a; l++)
        if (n = t[l], r = e.position || {
          x: n.clientWidth / 2,
          y: n.clientHeight / 2
        }, i = A(n), u.x = i.left + r.x, u.y = i.top + r.y, f.pageX = u.x, f.pageY = u.y, s.show(f, n), e.wait >= 0 && e.wait !== null) {
          var m = {
            type: "mouseup",
            button: 1
          };
          setTimeout(c(m, n), e.wait);
        }
    }
  }, o.calm = function(t) {
    t = E(t);
    for (var e = {
      type: "mouseup",
      button: 1
    }, a = 0, n = t.length; a < n; a++)
      s.hide(e, t[a]);
  }, o.displayEffect = function(t) {
    console.error("Waves.displayEffect() has been deprecated and will be removed in future version. Please use Waves.init() to initialize Waves effect"), o.init(t);
  }, o;
});
const W = {
  init: (o) => {
    const d = w.getJsonMerge({ name: "waves", duration: 500, delay: 200 }, o);
    Window.Waves && Window.Waves.init(d);
  },
  bind: (o, d) => {
    const h = w.isObject(d.value) ? d.value : {};
    if (w.isBoolean(h.init) ? h.init : !0) {
      const b = w.isEmpty(d.modifiers);
      let g;
      if (b) {
        let v = "";
        if (!w.isEmpty(h.color))
          switch (h.color) {
            case "white":
              v = "light";
              break;
            case "black":
              v = "";
              break;
          }
        w.isEmpty(v) || (g = `waves-${v}`);
      } else
        g = ["button", "circle", "block", "float", "light", "classic"].filter((v) => d.modifiers[v]).map((v) => `waves-${v}`);
      Window.Waves && Window.Waves.attach(o, g);
    }
  }
}, $ = "clwaves", j = (o) => (W.init(o), {
  deep: !0,
  mounted: W.bind
}), X = {
  mounted: W.bind
};
export {
  j as directive,
  $ as name,
  X as wavesBind
};
//# sourceMappingURL=Waves.js.map
