var n = Object.defineProperty;
var d = (s, e, t) => e in s ? n(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var o = (s, e, t) => d(s, typeof e != "symbol" ? e + "" : e, t);
const r = {
  EXACT: 0
};
class g {
  constructor(e, t, i = "drop") {
    o(this, "getInstance");
    o(this, "dropClassName");
    o(this, "onDropHandler");
    o(this, "onDrop", (e) => {
      const t = this.getInstance();
      this.onDropHandler && this.dragTarget && t && this.onDropHandler(e, this.dragTarget, t), this.removeMouseDownWidget();
    });
    o(this, "onDragOver", (e) => {
      const t = this.getInstance(), i = t == null ? void 0 : t.getTargetAtClientPoint(e.clientX, e.clientY);
      t && i && this.displayMouseDropPosition(t, i), e.preventDefault();
    });
    o(this, "removeMouseDownWidget", () => {
      const e = this.getInstance();
      e && this.mouseDropWidget && this.domNode && (e.removeContentWidget(this.mouseDropWidget), this.mouseDropWidget = null);
    });
    o(this, "props", {
      onDragOver: this.onDragOver,
      onDropCapture: this.onDrop,
      onDragLeaveCapture: this.removeMouseDownWidget
    });
    o(this, "domNode", null);
    o(this, "mouseDropWidget", null);
    o(this, "dragTarget", null);
    o(this, "buildMouseDropWidget", () => (this.domNode || (this.domNode = document.createElement("div"), this.domNode.className = this.dropClassName, this.domNode.style.pointerEvents = "none", this.domNode.style.borderLeft = "2px solid #ccc", this.domNode.innerHTML = "&nbsp;"), {
      getId: () => "drag",
      getDomNode: () => this.domNode,
      getPosition: () => {
        var e;
        return {
          position: ((e = this.dragTarget) == null ? void 0 : e.position) ?? null,
          preference: [r.EXACT, r.EXACT]
        };
      }
    }));
    o(this, "displayMouseDropPosition", (e, t) => {
      this.dragTarget = t, this.mouseDropWidget ? e.layoutContentWidget(this.mouseDropWidget) : (this.mouseDropWidget = this.buildMouseDropWidget(), e.addContentWidget(this.mouseDropWidget));
    });
    this.dropClassName = i, this.onDropHandler = e, this.getInstance = t;
  }
}
export {
  g as MonacoDragNDropProvider
};
//# sourceMappingURL=MonacoDragAndDropProvider.js.map
