import e from "../PlBtnGhost/PlBtnGhost.js";
import "../PlBtnGhost/index.js";
import t from "../PlBtnGroup/PlBtnGroup.js";
import "../PlBtnGroup/index.js";
import n from "../PlBtnPrimary/PlBtnPrimary.js";
import "../PlBtnPrimary/index.js";
import r from "../PlDialogModal/PlDialogModal.js";
import "../PlDialogModal/index.js";
import i from "./pl-file-dialog.module.js";
import a from "./Remote.js";
import o from "./Local.js";
import { computed as s, createBlock as c, createCommentVNode as l, createElementVNode as u, createSlots as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeProps as h, normalizeClass as g, openBlock as _, ref as v, toDisplayString as y, unref as b, useTemplateRef as x, withCtx as S, withModifiers as C } from "vue";
import { notEmpty as w } from "@milaboratories/helpers";
var T = { style: { margin: "0 24px" } }, E = /* @__PURE__ */ m({
	__name: "PlFileDialog",
	props: {
		modelValue: { type: Boolean },
		extensions: { default: void 0 },
		multi: { type: Boolean },
		title: { default: void 0 },
		autoSelectStorage: {
			type: Boolean,
			default: !0
		},
		closeOnOutsideClick: {
			type: Boolean,
			default: !0
		}
	},
	emits: ["update:modelValue", "import:files"],
	setup(m, { emit: E }) {
		let D = E, O = m, k = v("local"), A = s(() => O.multi ? "Select Files to Import" : "Select File to Import"), j = [{
			label: "My Computer",
			value: "local"
		}, {
			label: "Remote",
			value: "remote"
		}], M = () => D("update:modelValue", !1), N = x("remote"), P = () => {
			N.value?.isReady && (D("import:files", w(N.value?.getFilesToImport())), M());
		}, F = (e) => {
			D("import:files", e), M();
		};
		return (s, v) => (_(), c(b(r), {
			"no-content-gutters": !0,
			"close-on-outside-click": m.closeOnOutsideClick,
			class: g(["pl-dialog-modal", b(i).component]),
			"model-value": m.modelValue,
			width: "688px",
			height: "720px",
			"onUpdate:modelValue": M,
			onClick: v[1] ||= C(() => {}, ["stop"])
		}, d({
			title: S(() => [f(y(m.title ?? A.value), 1)]),
			default: S(() => [
				u("div", T, [p(b(t), {
					modelValue: k.value,
					"onUpdate:modelValue": v[0] ||= (e) => k.value = e,
					options: j
				}, null, 8, ["modelValue"])]),
				k.value === "remote" ? (_(), c(a, h({
					key: 0,
					ref: "remote"
				}, s.$props, { submit: P }), null, 16)) : l("", !0),
				k.value === "local" ? (_(), c(o, h({
					key: 1,
					"import-files": F
				}, s.$props), null, 16)) : l("", !0)
			]),
			_: 2
		}, [k.value === "remote" ? {
			name: "actions",
			fn: S(() => [p(b(n), {
				style: { "min-width": "160px" },
				disabled: !N.value?.isReady,
				onClick: C(P, ["stop"])
			}, {
				default: S(() => [...v[2] ||= [f("Import", -1)]]),
				_: 1
			}, 8, ["disabled"]), p(b(e), {
				"justify-center": !1,
				onClick: C(M, ["stop"])
			}, {
				default: S(() => [...v[3] ||= [f("Cancel", -1)]]),
				_: 1
			})]),
			key: "0"
		} : void 0]), 1032, [
			"close-on-outside-click",
			"class",
			"model-value"
		]));
	}
});
export { E as default };

//# sourceMappingURL=PlFileDialog.vue2.js.map