diff --git a/.gitignore b/.gitignore index 587f2f57..01f9be8f 100644 --- a/.gitignore +++ b/.gitignore @@ -211,6 +211,7 @@ docs/COMFYUI_FRONTEND_IMPROVEMENTS.md .github/agents/badge-card-qa.agent.md .mjr_index_directory_override .mjr_output_directory_override +.mjr_input_directory_override coverage/ ComfyUI-Majoor-AssetsManager_release.zip diff --git a/dist/chunks/FloatingViewer-C_N3LZxW.js b/dist/chunks/FloatingViewer-38MC8yxJ.js similarity index 99% rename from dist/chunks/FloatingViewer-C_N3LZxW.js rename to dist/chunks/FloatingViewer-38MC8yxJ.js index 4e3ab198..eef467a2 100644 --- a/dist/chunks/FloatingViewer-C_N3LZxW.js +++ b/dist/chunks/FloatingViewer-38MC8yxJ.js @@ -1,12 +1,12 @@ -import { Zt as e, g as t, y as n } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { B as r, C as i, I as a, M as o, O as s, P as c, R as l, V as u, j as d, m as f, o as p, r as m, rt as h, v as g, w as _, x as v } from "./events-DrYpMD-I.js"; -import { a as y, i as b, o as x, s as S } from "./graphTraversal-BIYmTTPW.js"; -import { _ as C, g as w, m as T, n as E, p as ee, r as D, w as O } from "./Viewer-DXsFcJRb.js"; -import { r as k, v as A } from "./SidebarWorkflowSection-BEJKYrrz.js"; -import { _ as j, a as M, c as N, d as P, f as F, g as I, h as L, i as te, l as R, m as z, o as ne, p as B, r as re, s as V, t as ie, u as H, v as U } from "./openMajoorSettings-CjYabCh7.js"; -import { a as W, n as ae, r as oe } from "./model3dRenderer-CWRtZrSS.js"; -import { i as se, o as ce, r as le, t as ue } from "./geninfoParser-DS9m_bHm.js"; -import { t as de } from "./genInfo-D0BtEEbx.js"; +import { $t as e, g as t, y as n } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { B as r, C as i, I as a, M as o, O as s, P as c, R as l, V as u, j as d, m as f, o as p, r as m, rt as h, v as g, w as _, x as v } from "./events-CoI83paj.js"; +import { a as y, i as b, o as x, s as S } from "./graphTraversal-C94Q5bJN.js"; +import { _ as C, g as w, m as T, n as E, p as ee, r as D, w as O } from "./Viewer-DWgaGos-.js"; +import { r as k, v as A } from "./SidebarWorkflowSection-DpoPGJrq.js"; +import { _ as j, a as M, c as N, d as P, f as F, g as I, h as L, i as te, l as R, m as z, o as ne, p as B, r as re, s as V, t as ie, u as H, v as U } from "./openMajoorSettings-CxqtW_yN.js"; +import { a as W, n as ae, r as oe } from "./model3dRenderer-e5uWwIMW.js"; +import { i as se, o as ce, r as le, t as ue } from "./geninfoParser-Bwtqk4p6.js"; +import { t as de } from "./genInfo-y4P7FXnU.js"; //#region ui/features/viewer/floatingViewerConstants.ts var G = Object.freeze({ SIMPLE: "simple", @@ -169,7 +169,7 @@ function Ee(e, t = null, { kind: n = "" } = {}) { } catch (e) { console.debug?.(e); } - if (!(!i || e?.paused)) { + if (i && !e?.paused) { try { let t = e; if (typeof t?.requestVideoFrameCallback == "function") { @@ -186,7 +186,7 @@ function Ee(e, t = null, { kind: n = "" } = {}) { } } }, P = () => { - M(), !(!i || e?.paused) && N(); + M(), i && !e?.paused && N(); }, F = (e) => { try { e?.stopPropagation?.(); @@ -200,7 +200,7 @@ function Ee(e, t = null, { kind: n = "" } = {}) { } D(); }, L = (t, n) => { - if (F(n), !(!a || !(e instanceof HTMLVideoElement))) { + if (F(n), a && e instanceof HTMLVideoElement) { try { e.pause?.(); } catch (e) { @@ -334,7 +334,7 @@ function J(e, t) { return n.className = `mjr-mfv-label label-${t}`, n.textContent = e, n; } function je(e) { - if (!(!e || typeof e.play != "function")) try { + if (e && typeof e.play == "function") try { let t = e.play(); t && typeof t.catch == "function" && t.catch(() => {}); } catch (e) { @@ -342,7 +342,7 @@ function je(e) { } } function Me(e) { - if (!(!e || typeof e.play != "function")) try { + if (e && typeof e.play == "function") try { let t = e.play(); t && typeof t.catch == "function" && t.catch(() => { try { @@ -646,7 +646,7 @@ var Xe = class { return this._body = c, t.appendChild(c), this._el = t, this._applyExpandedState(), t; } _applyExpandedState() { - if (!(!this._el || !this._body)) { + if (this._el && this._body) { if (this._el.classList.toggle("is-collapsible", this._collapsible), this._el.classList.toggle("is-collapsed", this._collapsible && !this._expanded), this._toggleBtn) { let e = this._expanded ? "pi pi-chevron-down" : "pi pi-chevron-right"; this._toggleBtn.textContent = ""; @@ -939,7 +939,7 @@ function ft(e) { index: o }); } - !a || c.has(a.index) || te(a.widget, X(e.value), t) && (c.add(a.index), l += 1); + a && !c.has(a.index) && te(a.widget, X(e.value), t) && (c.add(a.index), l += 1); } return u(), { ok: l > 0, @@ -1725,7 +1725,7 @@ function Zt(e) { ], r = /* @__PURE__ */ new Set(), i = []; for (let [e, t] of n) { let n = le(t?.name || t?.value || t || ""); - if (!(!n || r.has(n)) && (r.add(n), i.push(`${e}: ${n}`), i.length >= 3)) break; + if (n && !r.has(n) && (r.add(n), i.push(`${e}: ${n}`), i.length >= 3)) break; } return i.join(" | "); } @@ -2414,7 +2414,7 @@ function En(e, t) { ].map((t) => Tn(e[`_media${t}`])).filter(Boolean)); for (let r of t) { let t = Tn(r); - if (!(!t || n.has(t))) { + if (t && !n.has(t)) { try { URL.revokeObjectURL(t); } catch {} @@ -2515,9 +2515,9 @@ function Mn(e, ...t) { return Array.from(new Set([String(e || ""), ...t].join(" ").split(/\s+/).filter(Boolean))).join(" "); } function Nn(e, t) { - if (!(!e || !t)) for (let n of Array.from(e.attributes || [])) { + if (e && t) for (let n of Array.from(e.attributes || [])) { let e = String(n?.name || ""); - if (!(!e || e === "class" || e === "style")) try { + if (e && e !== "class" && e !== "style") try { t.setAttribute(e, n.value); } catch (e) { console.debug?.(e); @@ -2745,7 +2745,7 @@ function Wn(e) { }, 250); } function Gn(e) { - !e._isPopped || e._popoutRestoreGuard || (e._popoutRestoreGuard = !0, window.setTimeout(() => { + e._isPopped && !e._popoutRestoreGuard && (e._popoutRestoreGuard = !0, window.setTimeout(() => { try { e.popIn({ closePopupWindow: !1 }); } finally { @@ -3487,7 +3487,7 @@ var dr = 0, fr = class { let i = Math.max(0, Math.min(.92, Number(r) || 0)); if (!(i > 0)) return; e.save(), e.fillStyle = `rgba(0,0,0,${i})`, e.fillRect(0, 0, t.width, t.height), e.globalCompositeOperation = "destination-out"; - for (let t of n) !t || !(t.w > 1 && t.h > 1) || e.fillRect(t.x, t.y, t.w, t.h); + for (let t of n) t && t.w > 1 && t.h > 1 && e.fillRect(t.x, t.y, t.w, t.h); e.restore(); } catch (e) { console.debug?.(e); @@ -3550,7 +3550,7 @@ var dr = 0, fr = class { _bindLayoutObserver() { this._unbindLayoutObserver(); let e = this._contentEl; - if (!(!e || typeof ResizeObserver > "u")) try { + if (e && typeof ResizeObserver < "u") try { this._layoutObserver = new ResizeObserver(() => { this._applyTransform(); }), this._layoutObserver.observe(e); @@ -3881,7 +3881,7 @@ var dr = 0, fr = class { return i.childNodes.length ? r : null; } _appendIdeogramGenInfoCards(e, t) { - if (!(!e || !t)) { + if (e && t) { t.highLevelDescription && e.appendChild(this._buildGenInfoCard({ title: "High Level Description", accent: "#4CAF50", @@ -3967,7 +3967,7 @@ var dr = 0, fr = class { return a.className = "mjr-mfv-gen-field-value", a.textContent = n, r.appendChild(i), r.appendChild(a), r; } _bindGenInfoCopy(e, t) { - !e || typeof t != "function" || (e.title = "Click to copy", e.addEventListener("click", async (n) => { + e && typeof t == "function" && (e.title = "Click to copy", e.addEventListener("click", async (n) => { n.stopPropagation(); let r = String(t() || "").trim(); if (r) try { diff --git a/dist/chunks/LiveStreamTracker-Dmm_Hfn2.js b/dist/chunks/LiveStreamTracker-Cpl6O_E6.js similarity index 97% rename from dist/chunks/LiveStreamTracker-Dmm_Hfn2.js rename to dist/chunks/LiveStreamTracker-Cpl6O_E6.js index f445db0e..59a606a4 100644 --- a/dist/chunks/LiveStreamTracker-Dmm_Hfn2.js +++ b/dist/chunks/LiveStreamTracker-Cpl6O_E6.js @@ -1,5 +1,5 @@ -import { J as e, o as t, r as n } from "./events-DrYpMD-I.js"; -import { t as r } from "./floatingViewerManager-Crq2oCKD.js"; +import { J as e, o as t, r as n } from "./events-CoI83paj.js"; +import { t as r } from "./floatingViewerManager-XH4AFW4G.js"; //#region ui/features/viewer/LiveStreamTracker.ts var i = !1, a = null, o = null, s = null, c = null, l = null, u = null, d = null, f = null, p = 0, m = 0, h = !1, g = 400, _ = "kj_preview_override", v = /* @__PURE__ */ new Set([ "image/jpeg", diff --git a/dist/chunks/NodeStreamController-DpGjUOfx.js b/dist/chunks/NodeStreamController-DaqaPtXc.js similarity index 99% rename from dist/chunks/NodeStreamController-DpGjUOfx.js rename to dist/chunks/NodeStreamController-DaqaPtXc.js index dbc2fc09..8f7408c2 100644 --- a/dist/chunks/NodeStreamController-DpGjUOfx.js +++ b/dist/chunks/NodeStreamController-DaqaPtXc.js @@ -1,4 +1,4 @@ -import { a as e, n as t, r as n, s as r } from "./graphTraversal-BIYmTTPW.js"; +import { a as e, n as t, r as n, s as r } from "./graphTraversal-C94Q5bJN.js"; import { KnownNodesAdapter as i, t as a } from "./KnownNodesAdapter-D3kDh32d.js"; //#region ui/features/viewer/nodeStream/NodeStreamRegistry.ts var o = [], s = !1; @@ -454,7 +454,7 @@ function Ce(e) { } if (!(e.depth >= F)) for (let t of ye(e.node)) { let n = String(t?.id ?? ""); - !n || i.has(n) || (i.add(n), r.push({ + n && !i.has(n) && (i.add(n), r.push({ node: t, depth: e.depth + 1 })); @@ -493,7 +493,7 @@ function Z({ force: e = !1 } = {}) { return; } let i = we(r); - !e && n === M && i === j || (M = n, j = i, D(r)); + (e || n !== M || i !== j) && (M = n, j = i, D(r)); } function Q() { let e = T; diff --git a/dist/chunks/SidebarWorkflowSection-BEJKYrrz.js b/dist/chunks/SidebarWorkflowSection-DpoPGJrq.js similarity index 72% rename from dist/chunks/SidebarWorkflowSection-BEJKYrrz.js rename to dist/chunks/SidebarWorkflowSection-DpoPGJrq.js index b8c71558..5e766638 100644 --- a/dist/chunks/SidebarWorkflowSection-BEJKYrrz.js +++ b/dist/chunks/SidebarWorkflowSection-DpoPGJrq.js @@ -1,11 +1,11 @@ -import { $ as e, At as t, Bt as n, Ct as r, Dt as i, Et as a, I as o, It as s, K as c, Mt as l, N as u, Nt as d, O as f, Ot as p, Pt as m, Q as h, Qt as g, R as _, Rt as v, S as y, St as b, T as x, Tt as S, Ut as C, Vt as ee, Wt as te, X as w, Xt as T, Y as ne, Yt as re, Z as ie, Zt as E, an as ae, at as oe, ct as se, et as ce, ht as le, it as ue, jt as de, k as D, kt as fe, lt as pe, nt as me, on as he, p as ge, qt as _e, rt as ve, st as ye, tt as be, ut as xe, w as Se, wt as Ce, xt as we, zt as Te } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { Ct as Ee, K as De, N as Oe, T as ke, c as Ae, d as je, f as Me, h as Ne, j as Pe, l as Fe, m as O, o as k, p as Ie, pt as Le, s as A, tt as Re, u as ze, x as Be, y as Ve } from "./events-DrYpMD-I.js"; -import { F as He, K as Ue, P as We, Y as Ge, f as Ke, m as qe, p as Je } from "./Viewer-DXsFcJRb.js"; -import { t as Ye } from "./floatingViewerManager-Crq2oCKD.js"; -import { A as Xe, C as j, D as Ze, E as M, G as Qe, J as $e, K as et, N as tt, O as N, R as nt, S as rt, T as P, U as F, V as I, Y as it, _ as at, a as ot, b as st, c as ct, d as lt, dt as L, f as ut, ft as R, g as dt, h as ft, i as pt, j as mt, k as z, l as ht, lt as B, m as gt, n as _t, nt as vt, o as yt, p as bt, r as xt, rt as V, s as St, t as Ct, u as wt, ut as Tt, y as Et, z as Dt } from "./mjr-primevue-BlSRoWcG.js"; -import { t as Ot } from "./mjr-vue-vendor-Bb2CVJXl.js"; -import { t as kt } from "./viewerOpenRequest-sWnzQpJQ.js"; -import { a as At, i as jt, n as Mt, o as Nt, r as Pt, t as Ft } from "./geninfoParser-DS9m_bHm.js"; +import { $ as e, $t as t, At as n, Bt as r, Ct as i, Dt as a, Et as o, Ft as s, Gt as c, Ht as l, I as u, It as d, K as f, Kt as p, Mt as m, N as h, Nt as g, O as _, Ot as v, Pt as y, Q as b, Qt as x, R as S, Rt as C, S as ee, St as te, T as ne, Tt as w, Ut as T, Vt as E, X as re, Y as D, Yt as ie, Z as ae, Zt as oe, at as se, cn as ce, ct as le, dt as ue, en as de, et as fe, gt as pe, it as me, jt as he, k as ge, kt as _e, lt as ve, nt as ye, ot as be, p as xe, rt as Se, sn as Ce, tt as we, ut as Te, w as Ee, wt as De } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { Ct as Oe, K as ke, N as Ae, T as je, c as Me, d as Ne, f as Pe, h as Fe, j as Ie, l as Le, m as O, o as k, p as Re, pt as ze, s as A, tt as Be, u as Ve, x as He, y as Ue } from "./events-CoI83paj.js"; +import { F as We, K as Ge, P as Ke, Y as qe, f as Je, m as Ye, p as Xe } from "./Viewer-DWgaGos-.js"; +import { t as Ze } from "./floatingViewerManager-XH4AFW4G.js"; +import { A as Qe, C as j, D as $e, E as M, G as et, J as tt, K as nt, N as rt, O as N, R as it, S as at, T as P, U as F, V as I, Y as ot, _ as st, a as ct, b as lt, c as ut, d as dt, dt as L, f as ft, ft as R, g as pt, h as mt, i as ht, j as gt, k as z, l as _t, lt as B, m as vt, n as yt, nt as bt, o as xt, p as St, r as Ct, rt as V, s as wt, t as Tt, u as Et, ut as Dt, y as Ot, z as kt } from "./mjr-primevue-BOf2ACk_.js"; +import { t as At } from "./mjr-vue-vendor-BKZZuiuB.js"; +import { t as jt } from "./viewerOpenRequest-CwB6clm0.js"; +import { a as Mt, i as Nt, n as Pt, o as Ft, r as It, t as Lt } from "./geninfoParser-Bwtqk4p6.js"; //#region ui/app/settings/settingsUtils.ts var H = (e, t) => { if (typeof e == "boolean") return e; @@ -28,30 +28,30 @@ var H = (e, t) => { }, U = (e, t) => { let n = Number(e); return Number.isFinite(n) ? n : Number(t); -}, It = (e, t, n) => { +}, Rt = (e, t, n) => { let r = typeof e == "string" ? e.trim() : String(e ?? ""); return t.includes(r) ? r : n; -}, Lt = (e) => e === "__proto__" || e === "prototype" || e === "constructor", Rt = (e, t) => { +}, zt = (e) => e === "__proto__" || e === "prototype" || e === "constructor", Bt = (e, t) => { let n = { ...e }; return !t || typeof t != "object" || Object.keys(t).forEach((r) => { - if (Lt(r)) return; + if (zt(r)) return; let i = t[r]; - i && typeof i == "object" && !Array.isArray(i) ? n[r] = Rt(e[r] || {}, i) : i !== void 0 && (n[r] = i); + i && typeof i == "object" && !Array.isArray(i) ? n[r] = Bt(e[r] || {}, i) : i !== void 0 && (n[r] = i); }), n; -}, zt = Object.freeze({ +}, Vt = Object.freeze({ small: 80, medium: 120, large: 180 -}), Bt = Object.freeze([ +}), Ht = Object.freeze([ "small", "medium", "large" -]), Vt = (e, t) => Math.max(60, Math.min(600, Math.round(U(e, t)))), Ht = (e = {}) => { +]), Ut = (e, t) => Math.max(60, Math.min(600, Math.round(U(e, t)))), Wt = (e = {}) => { let t = Number(e?.minSize); - if (Number.isFinite(t)) return Vt(t, A.GRID_MIN_SIZE); - let n = It(String(e?.minSizePreset || "").toLowerCase(), Bt, ""); - return n ? zt[n] : Vt(e?.minSize, A.GRID_MIN_SIZE); -}, Ut = (e = {}) => Vt(e?.minSize, A.FEED_GRID_MIN_SIZE), Wt = (e) => { + if (Number.isFinite(t)) return Ut(t, A.GRID_MIN_SIZE); + let n = Rt(String(e?.minSizePreset || "").toLowerCase(), Ht, ""); + return n ? Vt[n] : Ut(e?.minSize, A.GRID_MIN_SIZE); +}, Gt = (e = {}) => Ut(e?.minSize, A.FEED_GRID_MIN_SIZE), Kt = (e) => { let t = Math.round(U(e, A.GRID_MIN_SIZE)); return t <= 100 ? "small" : t >= 150 ? "large" : "medium"; }, W = { @@ -63,7 +63,7 @@ var H = (e, t) => { grid: { pageSize: A.DEFAULT_PAGE_SIZE, minSize: A.GRID_MIN_SIZE, - minSizePreset: Wt(A.GRID_MIN_SIZE), + minSizePreset: Kt(A.GRID_MIN_SIZE), gap: A.GRID_GAP, showExtBadge: A.GRID_SHOW_BADGES_EXTENSION, showRatingBadge: A.GRID_SHOW_BADGES_RATING, @@ -164,6 +164,7 @@ var H = (e, t) => { }, paths: { outputDirectory: "", + inputDirectory: "", indexDirectory: "", workflowRoots: "" }, @@ -212,16 +213,16 @@ var H = (e, t) => { tokenConfigured: !1, tokenHint: "" } -}, Gt = () => { +}, qt = () => { try { - let e = Ne.get(he); + let e = Fe.get(ce); if (!e) return { ...W }; let t = JSON.parse(e), n = t && typeof t == "object" && Number.isInteger(t.version) && t.data && typeof t.data == "object"; - if (!n && !(t && typeof t == "object" && !Array.isArray(t))) return { ...W }; + if (!n && (!t || typeof t != "object" || Array.isArray(t))) return { ...W }; if (n && Number(t.version) > 1) return console.warn("[Majoor] settings schema version is newer than this build, using defaults"), { ...W }; let r = n ? t.data : t, i = /* @__PURE__ */ new Set(/* @__PURE__ */ "debug.grid.infiniteScroll.siblings.autoScan.scan.watcher.status.viewer.rtHydrate.observability.feed.sidebar.probeBackend.i18n.paths.db.ratingTagsSync.cache.search.ai.executionGrouping.workflowMinimap.ui.security.safety".split(".")), a = {}; if (r && typeof r == "object") for (let [e, t] of Object.entries(r)) i.has(e) && (a[e] = t); - let o = Rt(W, a); + let o = Bt(W, a); if (!n) try { G(o); } catch (e) { @@ -239,24 +240,24 @@ var H = (e, t) => { version: 1, data: t }; - if (!Ne.set("mjrSettings", JSON.stringify(n))) throw Error("SettingsStore rejected the write"); + if (!Fe.set("mjrSettings", JSON.stringify(n))) throw Error("SettingsStore rejected the write"); } catch (e) { console.warn("[Majoor] settings save failed", e); try { let e = Date.now(); - e - (Number(window?._mjrSettingsSaveFailAt || 0) || 0) > 3e4 && (window._mjrSettingsSaveFailAt = e, Ue(O("dialog.settingsSaveFailed", "Majoor: Failed to save settings (browser storage full or blocked)."))); + e - (Number(window?._mjrSettingsSaveFailAt || 0) || 0) > 3e4 && (window._mjrSettingsSaveFailAt = e, Ge(O("dialog.settingsSaveFailed", "Majoor: Failed to save settings (browser storage full or blocked)."))); } catch (e) { console.debug?.(e); } try { - Ge("mjr-settings-save-failed", { error: String(e?.message || e || "") }, { warnPrefix: "[Majoor]" }); + qe("mjr-settings-save-failed", { error: String(e?.message || e || "") }, { warnPrefix: "[Majoor]" }); } catch (e) { console.debug?.(e); } } }, K = (e) => { let t = Number(A.MAX_PAGE_SIZE) || 2e3, n = Math.max(50, Math.min(t, Number(e.grid?.pageSize) || A.DEFAULT_PAGE_SIZE)); - k.DEFAULT_PAGE_SIZE = n, k.AUTO_SCAN_ON_STARTUP = !!e.autoScan?.onStartup, k.EXECUTION_GROUPING_ENABLED = !!(e.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), k.STATUS_POLL_INTERVAL = Math.max(1e3, Number(e.status?.pollInterval) || A.STATUS_POLL_INTERVAL), k.DEBUG_SAFE_CALL = !!e.debug?.safeCall, k.DEBUG_SAFE_LISTENERS = !!e.debug?.safeListeners, k.DEBUG_VIEWER = !!e.debug?.viewer, k.GRID_MIN_SIZE = Ht(e.grid), k.FEED_GRID_MIN_SIZE = Ut(e.feed), k.GRID_GAP = Math.max(0, Math.min(40, Math.round(U(e.grid?.gap, A.GRID_GAP)))), k.GRID_SHOW_BADGES_EXTENSION = !!(e.grid?.showExtBadge ?? A.GRID_SHOW_BADGES_EXTENSION), k.GRID_SHOW_BADGES_RATING = !!(e.grid?.showRatingBadge ?? A.GRID_SHOW_BADGES_RATING), k.GRID_SHOW_BADGES_TAGS = !!(e.grid?.showTagsBadge ?? A.GRID_SHOW_BADGES_TAGS), k.GRID_SHOW_DETAILS = !!(e.grid?.showDetails ?? A.GRID_SHOW_DETAILS), k.GRID_SHOW_DETAILS_FILENAME = !!(e.grid?.showFilename ?? A.GRID_SHOW_DETAILS_FILENAME), k.GRID_SHOW_DETAILS_DATE = !!(e.grid?.showDate ?? A.GRID_SHOW_DETAILS_DATE), k.GRID_SHOW_DETAILS_DIMENSIONS = !!(e.grid?.showDimensions ?? A.GRID_SHOW_DETAILS_DIMENSIONS), k.GRID_SHOW_DETAILS_GENTIME = !!(e.grid?.showGenTime ?? A.GRID_SHOW_DETAILS_GENTIME), k.GRID_SHOW_HOVER_INFO = !!(e.grid?.showHoverInfo ?? A.GRID_SHOW_HOVER_INFO), k.GRID_SHOW_WORKFLOW_DOT = !!(e.grid?.showWorkflowDot ?? A.GRID_SHOW_WORKFLOW_DOT); + k.DEFAULT_PAGE_SIZE = n, k.AUTO_SCAN_ON_STARTUP = !!e.autoScan?.onStartup, k.EXECUTION_GROUPING_ENABLED = !!(e.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), k.STATUS_POLL_INTERVAL = Math.max(1e3, Number(e.status?.pollInterval) || A.STATUS_POLL_INTERVAL), k.DEBUG_SAFE_CALL = !!e.debug?.safeCall, k.DEBUG_SAFE_LISTENERS = !!e.debug?.safeListeners, k.DEBUG_VIEWER = !!e.debug?.viewer, k.GRID_MIN_SIZE = Wt(e.grid), k.FEED_GRID_MIN_SIZE = Gt(e.feed), k.GRID_GAP = Math.max(0, Math.min(40, Math.round(U(e.grid?.gap, A.GRID_GAP)))), k.GRID_SHOW_BADGES_EXTENSION = !!(e.grid?.showExtBadge ?? A.GRID_SHOW_BADGES_EXTENSION), k.GRID_SHOW_BADGES_RATING = !!(e.grid?.showRatingBadge ?? A.GRID_SHOW_BADGES_RATING), k.GRID_SHOW_BADGES_TAGS = !!(e.grid?.showTagsBadge ?? A.GRID_SHOW_BADGES_TAGS), k.GRID_SHOW_DETAILS = !!(e.grid?.showDetails ?? A.GRID_SHOW_DETAILS), k.GRID_SHOW_DETAILS_FILENAME = !!(e.grid?.showFilename ?? A.GRID_SHOW_DETAILS_FILENAME), k.GRID_SHOW_DETAILS_DATE = !!(e.grid?.showDate ?? A.GRID_SHOW_DETAILS_DATE), k.GRID_SHOW_DETAILS_DIMENSIONS = !!(e.grid?.showDimensions ?? A.GRID_SHOW_DETAILS_DIMENSIONS), k.GRID_SHOW_DETAILS_GENTIME = !!(e.grid?.showGenTime ?? A.GRID_SHOW_DETAILS_GENTIME), k.GRID_SHOW_HOVER_INFO = !!(e.grid?.showHoverInfo ?? A.GRID_SHOW_HOVER_INFO), k.GRID_SHOW_WORKFLOW_DOT = !!(e.grid?.showWorkflowDot ?? A.GRID_SHOW_WORKFLOW_DOT); { let t = String(e.grid?.workflowGroupBy ?? A.WORKFLOW_GRID_GROUP_BY).toLowerCase(); k.WORKFLOW_GRID_GROUP_BY = [ @@ -303,54 +304,54 @@ var H = (e, t) => { } k.VIEWER_VIDEO_GRADE_THROTTLE_FPS = Math.max(1, Math.min(60, Math.round(U(e.viewer?.videoGradeThrottleFps, A.VIEWER_VIDEO_GRADE_THROTTLE_FPS)))), k.VIEWER_SCOPES_FPS = Math.max(1, Math.min(60, Math.round(U(e.viewer?.scopesFps, A.VIEWER_SCOPES_FPS)))), k.VIEWER_META_TTL_MS = Math.max(1e3, Math.min(6e5, Math.round(U(e.viewer?.metaTtlMs, A.VIEWER_META_TTL_MS)))), k.VIEWER_META_MAX_ENTRIES = Math.max(50, Math.min(5e3, Math.round(U(e.viewer?.metaMaxEntries, A.VIEWER_META_MAX_ENTRIES)))), k.WORKFLOW_MINIMAP_ENABLED = !!(e.workflowMinimap?.enabled ?? A.WORKFLOW_MINIMAP_ENABLED), k.RT_HYDRATE_CONCURRENCY = Math.max(1, Math.min(16, Math.round(U(e.rtHydrate?.concurrency, A.RT_HYDRATE_CONCURRENCY)))), k.RT_HYDRATE_QUEUE_MAX = Math.max(10, Math.min(5e3, Math.round(U(e.rtHydrate?.queueMax, A.RT_HYDRATE_QUEUE_MAX)))), k.RT_HYDRATE_SEEN_MAX = Math.max(1e3, Math.min(2e5, Math.round(U(e.rtHydrate?.seenMax, A.RT_HYDRATE_SEEN_MAX)))), k.RT_HYDRATE_PRUNE_BUDGET = Math.max(10, Math.min(1e4, Math.round(U(e.rtHydrate?.pruneBudget, A.RT_HYDRATE_PRUNE_BUDGET)))), k.RT_HYDRATE_SEEN_TTL_MS = Math.max(5e3, Math.min(216e5, Math.round(U(e.rtHydrate?.seenTtlMs, A.RT_HYDRATE_SEEN_TTL_MS)))), k.DELETE_CONFIRMATION = !!e.safety?.confirmDeletion, k.DEBUG_VERBOSE_ERRORS = !!e.observability?.verboseErrors, k.WATCHER_MAX_PENDING = Math.max(10, Math.min(5e3, Math.round(U(e.watcher?.maxPending, 500)))), k.WATCHER_MIN_SIZE = Math.max(0, Math.min(1e6, Math.round(U(e.watcher?.minSize, 100)))), k.WATCHER_MAX_SIZE = Math.max(1e5, Math.min(17179869184, Math.round(U(e.watcher?.maxSize, 4294967296)))), k.DB_TIMEOUT_MS = Math.max(1e3, Math.min(3e4, Math.round(U(e.db?.timeoutMs, 5e3)))), k.DB_MAX_CONNECTIONS = Math.max(1, Math.min(100, Math.round(U(e.db?.maxConnections, 10)))), k.DB_QUERY_TIMEOUT_MS = Math.max(500, Math.min(1e4, Math.round(U(e.db?.queryTimeoutMs, 1e3)))), k.SIDEBAR_ASSET_BADGE_ENABLED = !!(e.sidebar?.assetBadgeEnabled ?? A.SIDEBAR_ASSET_BADGE_ENABLED), k.SEARCH_REQUEST_LIMIT = Math.max(10, Math.min(A.MAX_PAGE_SIZE || 2e3, Math.round(U(e.search?.maxResults, A.SEARCH_DEFAULT_LIMIT)))); }; -async function Kt() { +async function Jt() { try { - let e = await ue(); + let e = await se(); if (!e?.ok) return; let t = e.data?.prefs; if (!t || typeof t != "object") return; - let n = Gt(); + let n = qt(); if (n.security = n.security || {}, n.security.safeMode = H(t.safe_mode, n.security.safeMode), n.security.allowWrite = H(t.allow_write, n.security.allowWrite), n.security.requireAuth = H(t.require_auth, n.security.requireAuth), n.security.allowRemoteWrite = H(t.allow_remote_write, n.security.allowRemoteWrite), n.security.allowInsecureTokenTransport = H(t.allow_insecure_token_transport, n.security.allowInsecureTokenTransport), n.security.allowDelete = H(t.allow_delete, n.security.allowDelete), n.security.allowRename = H(t.allow_rename, n.security.allowRename), n.security.allowOpenInFolder = H(t.allow_open_in_folder, n.security.allowOpenInFolder), n.security.allowResetIndex = H(t.allow_reset_index, n.security.allowResetIndex), n.security.tokenConfigured = H(t.token_configured, n.security.tokenConfigured), n.security.tokenHint = String(t.token_hint || "").trim(), !String(n.security.apiToken || "").trim()) try { - let e = await _(), t = String(e?.data?.token || "").trim(); - e?.ok && t && T(t); + let e = await S(), t = String(e?.data?.token || "").trim(); + e?.ok && t && x(t); } catch (e) { console.debug?.(e); } - G(n), K(n), Ge("mjr-settings-changed", { key: "security" }, { warnPrefix: "[Majoor]" }); + G(n), K(n), qe("mjr-settings-changed", { key: "security" }, { warnPrefix: "[Majoor]" }); } catch (e) { console.warn("[Majoor] failed to sync backend security settings", e); } } -async function qt() { +async function Yt() { try { - let e = await ye(); + let e = await le(); if (!e?.ok) return; let t = e.data?.prefs; if (!t || typeof t != "object") return; - let n = Gt(); - n.ai = n.ai || {}, n.ai.vectorSearchEnabled = H(t.enabled, n.ai.vectorSearchEnabled ?? !0), n.ai.vectorCaptionOnIndex = H(t.caption_on_index ?? t.captionOnIndex, n.ai.vectorCaptionOnIndex ?? !1), n.ai.vectorIndexOnScan = H(t.index_on_scan ?? t.indexOnScan, n.ai.vectorIndexOnScan ?? !1), n.ai.vectorUnloadAfterUse = H(t.unload_after_use ?? t.unloadAfterUse, n.ai.vectorUnloadAfterUse ?? !1), n.ai.vectorConcurrency = Math.max(1, Math.min(16, Math.floor(Number(t.concurrency ?? n.ai.vectorConcurrency ?? 1) || 1))), G(n), K(n), Ge("mjr-settings-changed", { key: "ai.vectorSearch" }, { warnPrefix: "[Majoor]" }); + let n = qt(); + n.ai = n.ai || {}, n.ai.vectorSearchEnabled = H(t.enabled, n.ai.vectorSearchEnabled ?? !0), n.ai.vectorCaptionOnIndex = H(t.caption_on_index ?? t.captionOnIndex, n.ai.vectorCaptionOnIndex ?? !1), n.ai.vectorIndexOnScan = H(t.index_on_scan ?? t.indexOnScan, n.ai.vectorIndexOnScan ?? !1), n.ai.vectorUnloadAfterUse = H(t.unload_after_use ?? t.unloadAfterUse, n.ai.vectorUnloadAfterUse ?? !1), n.ai.vectorConcurrency = Math.max(1, Math.min(16, Math.floor(Number(t.concurrency ?? n.ai.vectorConcurrency ?? 1) || 1))), G(n), K(n), qe("mjr-settings-changed", { key: "ai.vectorSearch" }, { warnPrefix: "[Majoor]" }); } catch (e) { console.warn("[Majoor] failed to sync backend vector search settings", e); } } -async function Jt() { +async function Xt() { try { - let e = await ne(); + let e = await D(); if (!e?.ok) return; let t = e.data?.prefs; if (!t || typeof t != "object") return; - let n = Gt(); - n.executionGrouping = n.executionGrouping || {}, n.executionGrouping.enabled = H(t.enabled, n.executionGrouping.enabled ?? A.EXECUTION_GROUPING_ENABLED), G(n), K(n), Ge("mjr-settings-changed", { key: "executionGrouping.enabled" }, { warnPrefix: "[Majoor]" }); + let n = qt(); + n.executionGrouping = n.executionGrouping || {}, n.executionGrouping.enabled = H(t.enabled, n.executionGrouping.enabled ?? A.EXECUTION_GROUPING_ENABLED), G(n), K(n), qe("mjr-settings-changed", { key: "executionGrouping.enabled" }, { warnPrefix: "[Majoor]" }); } catch (e) { console.warn("[Majoor] failed to sync backend execution grouping settings", e); } } //#endregion //#region ui/app/settings/settingsRuntime.ts -var Yt = "mjr-runtime-status-dashboard", Xt = 3e4; -function Zt() { +var Zt = "mjr-runtime-status-dashboard", Qt = 3e4; +function $t() { try { - let e = Gt(), t = String(e?.observability?.runtimeDashboardMode || W.observability.runtimeDashboardMode); + let e = qt(), t = String(e?.observability?.runtimeDashboardMode || W.observability.runtimeDashboardMode); return [ "autoHide30", "always", @@ -360,28 +361,28 @@ function Zt() { return "autoHide30"; } } -function Qt() { +function en() { try { - document.getElementById(Yt)?.remove?.(); + document.getElementById(Zt)?.remove?.(); } catch (e) { console.debug?.(e); } } -function $t() { +function tn() { try { window.__MJR_RUNTIME_STATUS_HIDE_TIMEOUT__ && (clearTimeout(window.__MJR_RUNTIME_STATUS_HIDE_TIMEOUT__), window.__MJR_RUNTIME_STATUS_HIDE_TIMEOUT__ = null); } catch (e) { console.debug?.(e); } } -function en(e, t) { +function nn(e, t) { let n = t === "auth" ? "__mjrAuthLine" : "__mjrMetricsLine"; if (e?.[n]) return e[n]; let r = document.createElement("div"); return r.style.whiteSpace = "nowrap", r.style.lineHeight = "1.35", t === "auth" && (r.style.marginTop = "4px", r.style.fontWeight = "600"), e.appendChild(r), e[n] = r, r; } -function tn(e) { - let t = String(e?.token_hint || "").trim(), n = re(), r = t || (n ? "(session)" : ""), i = e?.allow_write !== !1, a = e?.require_auth === !0, o = e?.token_configured === !0; +function rn(e) { + let t = String(e?.token_hint || "").trim(), n = oe(), r = t || (n ? "(session)" : ""), i = e?.allow_write !== !1, a = e?.require_auth === !0, o = e?.token_configured === !0; return i ? n ? { text: O("runtime.writeAuthActive", "Write auth: active {tokenHint}", { tokenHint: r || "(session)" }), color: "#7ee0a0" @@ -402,10 +403,10 @@ function tn(e) { color: "#ff9b9b" }; } -function nn() { +function an() { try { - if (Zt() === "hidden" || window.__MJR_RUNTIME_STATUS_HIDDEN__) return Qt(), null; - let e = document.querySelector(".mjr-assets-manager.mjr-am-container"), t = document.getElementById(Yt); + if ($t() === "hidden" || window.__MJR_RUNTIME_STATUS_HIDDEN__) return en(), null; + let e = document.querySelector(".mjr-assets-manager.mjr-am-container"), t = document.getElementById(Zt); if (!e) { try { t?.remove?.(); @@ -420,18 +421,18 @@ function nn() { } catch (e) { console.debug?.(e); } - let n = document.getElementById(Yt); - return n ? n.parentElement !== e && e.appendChild(n) : (n = document.createElement("div"), n.id = Yt, n.style.position = "absolute", n.style.bottom = "10px", n.style.right = "10px", n.style.zIndex = "9999", n.style.padding = "6px 10px", n.style.borderRadius = "10px", n.style.border = "1px solid rgba(255,255,255,0.16)", n.style.background = "rgba(0,0,0,0.45)", n.style.backdropFilter = "blur(4px)", n.style.color = "var(--content-fg, #fff)", n.style.fontSize = "11px", n.style.pointerEvents = "none", n.style.display = "flex", n.style.flexDirection = "column", e.appendChild(n)), n; + let n = document.getElementById(Zt); + return n ? n.parentElement !== e && e.appendChild(n) : (n = document.createElement("div"), n.id = Zt, n.style.position = "absolute", n.style.bottom = "10px", n.style.right = "10px", n.style.zIndex = "9999", n.style.padding = "6px 10px", n.style.borderRadius = "10px", n.style.border = "1px solid rgba(255,255,255,0.16)", n.style.background = "rgba(0,0,0,0.45)", n.style.backdropFilter = "blur(4px)", n.style.color = "var(--content-fg, #fff)", n.style.fontSize = "11px", n.style.pointerEvents = "none", n.style.display = "flex", n.style.flexDirection = "column", e.appendChild(n)), n; } catch { return null; } } -async function rn() { - let e = nn(); +async function on() { + let e = an(); if (!e) return !1; - let t = en(e, "metrics"), n = en(e, "auth"); + let t = nn(e, "metrics"), n = nn(e, "auth"); try { - let [r, i] = await Promise.all([ve(), ue()]), a = O("runtime.unavailable", "Runtime: unavailable"); + let [r, i] = await Promise.all([me(), se()]), a = O("runtime.unavailable", "Runtime: unavailable"); if (!r?.ok || !r?.data) t.textContent = a; else { let e = r.data.db || {}, n = r.data.index || {}, i = r.data.watcher || {}, o = Number(e.active_connections || 0), s = Number(n.enrichment_queue_length || 0), c = Number(i.pending_files || 0); @@ -445,27 +446,27 @@ async function rn() { pending: c }); } - let o = tn(i?.data?.prefs || null); + let o = rn(i?.data?.prefs || null); return n.textContent = o.text, n.style.color = o.color, e.title = `${a}\n${o.text}`, !0; } catch { return t.textContent = O("runtime.unavailable", "Runtime: unavailable"), n.textContent = O("runtime.writeAuthUnknown", "Write auth: unknown"), n.style.color = "#c8ced8", e.title = `${O("runtime.unavailable", "Runtime: unavailable")}\n${n.textContent}`, !0; } } -function an() { +function sn() { try { - let e = Zt(); + let e = $t(); if (e === "hidden") { - window.__MJR_RUNTIME_STATUS_HIDDEN__ = !0, $t(), Qt(); + window.__MJR_RUNTIME_STATUS_HIDDEN__ = !0, tn(), en(); return; } window.__MJR_RUNTIME_STATUS_SETTINGS_LISTENER__ || (window.__MJR_RUNTIME_STATUS_SETTINGS_LISTENER__ = (e) => { if (e?.detail?.key !== "observability.runtimeDashboardMode") return; - let t = Zt(); - window.__MJR_RUNTIME_STATUS_HIDDEN__ = t === "hidden", $t(), Qt(), t !== "hidden" && an(); - }, window.addEventListener?.("mjr-settings-changed", window.__MJR_RUNTIME_STATUS_SETTINGS_LISTENER__)), window.__MJR_RUNTIME_STATUS_HIDDEN__ = !1, $t(), e === "autoHide30" && (window.__MJR_RUNTIME_STATUS_HIDE_TIMEOUT__ = setTimeout(() => { - window.__MJR_RUNTIME_STATUS_HIDDEN__ = !0, Qt(); - }, Xt)), rn().catch(() => {}), window.__MJR_RUNTIME_STATUS_INFLIGHT__ ?? (window.__MJR_RUNTIME_STATUS_INFLIGHT__ = !1), window.__MJR_RUNTIME_STATUS_MISS_COUNT__ ?? (window.__MJR_RUNTIME_STATUS_MISS_COUNT__ = 0), window.__MJR_RUNTIME_STATUS_INTERVAL__ || (window.__MJR_RUNTIME_STATUS_INTERVAL__ = setInterval(() => { - window.__MJR_RUNTIME_STATUS_INFLIGHT__ || (window.__MJR_RUNTIME_STATUS_INFLIGHT__ = !0, rn().then((e) => { + let t = $t(); + window.__MJR_RUNTIME_STATUS_HIDDEN__ = t === "hidden", tn(), en(), t !== "hidden" && sn(); + }, window.addEventListener?.("mjr-settings-changed", window.__MJR_RUNTIME_STATUS_SETTINGS_LISTENER__)), window.__MJR_RUNTIME_STATUS_HIDDEN__ = !1, tn(), e === "autoHide30" && (window.__MJR_RUNTIME_STATUS_HIDE_TIMEOUT__ = setTimeout(() => { + window.__MJR_RUNTIME_STATUS_HIDDEN__ = !0, en(); + }, Qt)), on().catch(() => {}), window.__MJR_RUNTIME_STATUS_INFLIGHT__ ?? (window.__MJR_RUNTIME_STATUS_INFLIGHT__ = !1), window.__MJR_RUNTIME_STATUS_MISS_COUNT__ ?? (window.__MJR_RUNTIME_STATUS_MISS_COUNT__ = 0), window.__MJR_RUNTIME_STATUS_INTERVAL__ || (window.__MJR_RUNTIME_STATUS_INTERVAL__ = setInterval(() => { + window.__MJR_RUNTIME_STATUS_INFLIGHT__ || (window.__MJR_RUNTIME_STATUS_INFLIGHT__ = !0, on().then((e) => { if (e) { window.__MJR_RUNTIME_STATUS_MISS_COUNT__ = 0; return; @@ -481,8 +482,8 @@ function an() { } //#endregion //#region ui/utils/debounce.ts -var on = 300; -function sn(e, t = on) { +var cn = 300; +function ln(e, t = cn) { let n, r = (...r) => { clearTimeout(n), n = setTimeout(() => e(...r), t); }; @@ -494,36 +495,36 @@ function sn(e, t = on) { } //#endregion //#region ui/app/settings/settingsGrid.ts -var q = "Majoor", cn = "Majoor Assets Manager"; -function ln(e, t, n) { +var q = "Majoor", un = "Majoor Assets Manager"; +function dn(e, t, n) { let r = (e, t) => [ - cn, + un, e, t ], i = (e) => [ - cn, + un, O("cat.cards", "Cards"), e ], a = (e) => [ - cn, + un, O("cat.badges", "Badges"), e ], o = (e) => [ - cn, + un, O("cat.badges", "Badges"), e ], s = (e, t) => { let n = String(e || "").trim(); return /^[0-9a-fA-F]{6}$/.test(n) && (n = `#${n}`), /^#[0-9a-fA-F]{6}$/.test(n) ? n.toUpperCase() : t; }; - t.grid?.minSizePreset || (t.grid = t.grid || {}, t.grid.minSizePreset = Wt(t.grid.minSize), G(t)), e({ + t.grid?.minSizePreset || (t.grid = t.grid || {}, t.grid.minSizePreset = Kt(t.grid.minSize), G(t)), e({ id: `${q}.Cards.ThumbSize`, category: i(O("setting.grid.cardSize.group", "Card size")), name: O("setting.grid.cardSize.name", "Majoor: Card Size"), tooltip: O("setting.grid.cardSize.desc", "Choose the card size preset used by the grid layout."), type: "combo", defaultValue: (() => { - let e = It(String(t.grid?.minSizePreset || "").toLowerCase(), Bt, Wt(t.grid?.minSize)), n = { + let e = Rt(String(t.grid?.minSizePreset || "").toLowerCase(), Ht, Kt(t.grid?.minSize)), n = { small: O("setting.grid.cardSize.small", "Small"), medium: O("setting.grid.cardSize.medium", "Medium"), large: O("setting.grid.cardSize.large", "Large") @@ -537,7 +538,7 @@ function ln(e, t, n) { ], onChange: (e) => { let r = String(e || "").trim().toLowerCase(), i = O("setting.grid.cardSize.small", "Small").toLowerCase(), a = O("setting.grid.cardSize.medium", "Medium").toLowerCase(), o = O("setting.grid.cardSize.large", "Large").toLowerCase(), s = "medium"; - r === i || r === "small" || r === "petit" ? s = "small" : r === o || r === "large" || r === "grand" ? s = "large" : (r === a || r === "medium" || r === "moyen") && (s = "medium"), t.grid.minSizePreset = s, t.grid.minSize = zt[s], G(t), K(t), n("grid.minSizePreset"); + r === i || r === "small" || r === "petit" ? s = "small" : r === o || r === "large" || r === "grand" ? s = "large" : (r === a || r === "medium" || r === "moyen") && (s = "medium"), t.grid.minSizePreset = s, t.grid.minSize = Vt[s], G(t), K(t), n("grid.minSizePreset"); } }), e({ id: `${q}.Cards.CustomThumbSize`, @@ -553,7 +554,7 @@ function ln(e, t, n) { }, onChange: (e) => { let r = Math.max(60, Math.min(600, Math.round(Number(e) || 120))); - t.grid.minSize = r, t.grid.minSizePreset = Wt(r), G(t), K(t), n("grid.minSize"); + t.grid.minSize = r, t.grid.minSizePreset = Kt(r), G(t), K(t), n("grid.minSize"); } }), e({ id: `${q}.Grid.ShowDetails`, @@ -900,15 +901,15 @@ function ln(e, t, n) { } //#endregion //#region ui/app/settings/settingsViewer.ts -var un = "Majoor", dn = "Majoor Assets Manager"; -function fn(t, n, r) { +var fn = "Majoor", pn = "Majoor Assets Manager"; +function mn(e, n, r) { let a = (e, t) => [ - dn, + pn, e, t ], o = (e) => a(O("cat.viewer", "Viewer"), e), s = (e) => a(O("cat.floatingViewer", "Floating Viewer"), e); - t({ - id: `${un}.Viewer.AllowPanAtZoom1`, + e({ + id: `${fn}.Viewer.AllowPanAtZoom1`, category: o(O("setting.viewer.pan.name").replace("Majoor: ", "")), name: O("setting.viewer.pan.name"), tooltip: O("setting.viewer.pan.desc"), @@ -917,8 +918,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.allowPanAtZoom1 = !!e, G(n), K(n), r("viewer.allowPanAtZoom1"); } - }), t({ - id: `${un}.Viewer.DisableWebGL`, + }), e({ + id: `${fn}.Viewer.DisableWebGL`, category: o("Disable WebGL Video"), name: "Disable WebGL Video", tooltip: "Use CPU rendering (Canvas 2D) for video playback. Fixes 'black screen' issues on incompatible hardware/browsers.", @@ -927,8 +928,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.disableWebGL = !!e, G(n), K(n), r("viewer.disableWebGL"); } - }), t({ - id: `${un}.Viewer.PauseDuringExecution`, + }), e({ + id: `${fn}.Viewer.PauseDuringExecution`, category: o(O("setting.viewer.pauseExecution.name").replace("Majoor: ", "")), name: O("setting.viewer.pauseExecution.name"), tooltip: O("setting.viewer.pauseExecution.desc"), @@ -937,8 +938,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.pauseDuringExecution = !!e, G(n), K(n), r("viewer.pauseDuringExecution"); } - }), t({ - id: `${un}.Viewer.FloatingPauseDuringExecution`, + }), e({ + id: `${fn}.Viewer.FloatingPauseDuringExecution`, category: s(O("setting.viewer.floatingPauseExecution.name").replace("Majoor: ", "")), name: O("setting.viewer.floatingPauseExecution.name"), tooltip: O("setting.viewer.floatingPauseExecution.desc"), @@ -947,25 +948,25 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.floatingPauseDuringExecution = !!e, G(n), K(n), r("viewer.floatingPauseDuringExecution"); } - }), t({ - id: `${un}.Browser.ShowFolders`, + }), e({ + id: `${fn}.Browser.ShowFolders`, category: o("Browser"), name: "Show folders in Input / Output panels", tooltip: "When enabled, subdirectories under the Input and Output roots are shown as folder cards in the browser grid. Disable to see only files.", type: "boolean", defaultValue: !!(n.browser?.showFolders ?? !1), onChange: async (e) => { - let t = !!e, i = !!(n.browser?.showFolders ?? !1); - n.browser = n.browser || {}, n.browser.showFolders = t, G(n), K(n), r("browser.showFolders"); + let a = !!e, o = !!(n.browser?.showFolders ?? !1); + n.browser = n.browser || {}, n.browser.showFolders = a, G(n), K(n), r("browser.showFolders"); try { - let e = await b(t); + let e = await i(a); if (!e?.ok) throw Error(e?.error || "Failed to update show folders setting"); } catch (e) { - n.browser.showFolders = i, G(n), K(n), r("browser.showFolders"), E(e?.message || "Failed to update show folders setting", "error"); + n.browser.showFolders = o, G(n), K(n), r("browser.showFolders"), t(e?.message || "Failed to update show folders setting", "error"); } } - }), t({ - id: `${un}.Viewer.MfvLiveDefault`, + }), e({ + id: `${fn}.Viewer.MfvLiveDefault`, category: s(O("setting.viewer.mfvLiveDefault.name").replace("Majoor: ", "")), name: O("setting.viewer.mfvLiveDefault.name"), tooltip: O("setting.viewer.mfvLiveDefault.desc"), @@ -974,8 +975,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.mfvLiveDefault = !!e, G(n), K(n), r("viewer.mfvLiveDefault"); } - }), t({ - id: `${un}.Viewer.MfvPreviewDefault`, + }), e({ + id: `${fn}.Viewer.MfvPreviewDefault`, category: s(O("setting.viewer.mfvPreviewDefault.name").replace("Majoor: ", "")), name: O("setting.viewer.mfvPreviewDefault.name"), tooltip: O("setting.viewer.mfvPreviewDefault.desc"), @@ -984,8 +985,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.mfvPreviewDefault = !!e, G(n), K(n), r("viewer.mfvPreviewDefault"); } - }), t({ - id: `${un}.Viewer.MfvTopbarButton`, + }), e({ + id: `${fn}.Viewer.MfvTopbarButton`, category: s("Top bar Viewer button"), name: "Show Viewer button in the top bar", tooltip: "Show a Viewer toggle button in the ComfyUI top bar next to the queue controls. Disable to hide it (the V shortcut keeps working).", @@ -994,8 +995,8 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.mfvTopbarButton = !!e, G(n), K(n), r("viewer.mfvTopbarButton"); } - }), t({ - id: `${un}.Viewer.MfvSidebarPosition`, + }), e({ + id: `${fn}.Viewer.MfvSidebarPosition`, category: s("Node Parameters sidebar position"), name: "Node Parameters sidebar position", tooltip: "Position of the Node Parameters sidebar in the Floating Viewer (right, left, or bottom).", @@ -1014,8 +1015,8 @@ function fn(t, n, r) { ].includes(e) ? e : "right"; n.viewer = n.viewer || {}, n.viewer.mfvSidebarPosition = t, G(n), K(n), r("viewer.mfvSidebarPosition"); } - }), t({ - id: `${un}.Viewer.MfvPreviewMethod`, + }), e({ + id: `${fn}.Viewer.MfvPreviewMethod`, category: s(O("setting.viewer.mfvPreviewMethod.name").replace("Majoor: ", "")), name: O("setting.viewer.mfvPreviewMethod.name"), tooltip: O("setting.viewer.mfvPreviewMethod.desc"), @@ -1038,8 +1039,8 @@ function fn(t, n, r) { ].includes(e) ? e : A.MFV_PREVIEW_METHOD; n.viewer = n.viewer || {}, n.viewer.mfvPreviewMethod = t, G(n), K(n), r("viewer.mfvPreviewMethod"); } - }), t({ - id: `${un}.Viewer.MfvKjPreviewOverrideEnabled`, + }), e({ + id: `${fn}.Viewer.MfvKjPreviewOverrideEnabled`, category: s(O("setting.viewer.mfvKjPreviewOverride.name").replace("Majoor: ", "")), name: O("setting.viewer.mfvKjPreviewOverride.name"), tooltip: O("setting.viewer.mfvKjPreviewOverride.desc"), @@ -1048,36 +1049,36 @@ function fn(t, n, r) { onChange: (e) => { n.viewer = n.viewer || {}, n.viewer.mfvKjPreviewOverrideEnabled = !!e, G(n), K(n), r("viewer.mfvKjPreviewOverrideEnabled"); } - }), t({ - id: `${un}.Viewer.LtxavRgbFallback`, + }), e({ + id: `${fn}.Viewer.LtxavRgbFallback`, category: s("LTXAV preview fallback"), name: "Majoor: LTXAV RGB Preview Fallback (experimental)", tooltip: "Reuse LTXV RGB projection for LTXAV when native latent preview is unavailable. Experimental; quality may be approximate.", type: "boolean", defaultValue: !!n.viewer?.ltxavRgbFallback, onChange: async (e) => { - let t = !!e, a = !!n.viewer?.ltxavRgbFallback; - n.viewer = n.viewer || {}, n.viewer.ltxavRgbFallback = t, G(n), K(n), r("viewer.ltxavRgbFallback"); + let i = !!e, a = !!n.viewer?.ltxavRgbFallback; + n.viewer = n.viewer || {}, n.viewer.ltxavRgbFallback = i, G(n), K(n), r("viewer.ltxavRgbFallback"); try { - let e = await i(t); + let e = await _e(i); if (!e?.ok) throw Error(e?.error || "Failed to update LTXAV RGB preview fallback setting"); } catch (e) { - n.viewer.ltxavRgbFallback = a, G(n), K(n), r("viewer.ltxavRgbFallback"), E(e?.message || "Failed to update LTXAV RGB preview fallback setting", "error"); + n.viewer.ltxavRgbFallback = a, G(n), K(n), r("viewer.ltxavRgbFallback"), t(e?.message || "Failed to update LTXAV RGB preview fallback setting", "error"); } } }); try { - e().then((e) => { + fe().then((e) => { if (!e?.ok) return; - let t = !!e?.data?.prefs?.enabled, i = Gt(); + let t = !!e?.data?.prefs?.enabled, i = qt(); i.viewer = i.viewer || {}, !!i.viewer.ltxavRgbFallback !== t && (i.viewer.ltxavRgbFallback = t, Object.assign(n, i), G(i), K(i), r("viewer.ltxavRgbFallback")); }).catch(() => {}); } catch (e) { console.debug?.(e); } - ((e, i, a, s) => { - t({ - id: `${un}.WorkflowMinimap.${e}`, + ((t, i, a, s) => { + e({ + id: `${fn}.WorkflowMinimap.${t}`, category: o(O(a).replace("Majoor: ", "")), name: O(a), tooltip: O(s), @@ -1091,253 +1092,253 @@ function fn(t, n, r) { } //#endregion //#region ui/app/settings/settingsScanning.ts -var pn = "Majoor", mn = "Majoor Assets Manager"; -function hn(e, t, i) { +var hn = "Majoor", gn = "Majoor Assets Manager"; +function _n(n, i, a) { let o = (e, t) => [ - mn, + gn, e, t ]; - e({ - id: `${pn}.ExecutionGrouping.Enabled`, + n({ + id: `${hn}.ExecutionGrouping.Enabled`, category: o(O("cat.scanning"), "Execution grouping"), name: "Execution job/stack grouping", tooltip: "Enable or disable all live job_id / stack_id tracking, grouping, and stack finalization logic.", type: "boolean", - defaultValue: !!(t.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), + defaultValue: !!(i.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), onChange: async (e) => { - let n = !!(t.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), a = !!e; - t.executionGrouping = t.executionGrouping || {}, t.executionGrouping.enabled = a, G(t), K(t), i("executionGrouping.enabled"); + let n = !!(i.executionGrouping?.enabled ?? A.EXECUTION_GROUPING_ENABLED), r = !!e; + i.executionGrouping = i.executionGrouping || {}, i.executionGrouping.enabled = r, G(i), K(i), a("executionGrouping.enabled"); try { - let e = await r(a); + let e = await De(r); if (!e?.ok) throw Error(e?.error || "Failed to update execution grouping setting"); - t.executionGrouping.enabled = !!e?.data?.prefs?.enabled, G(t), K(t), i("executionGrouping.enabled"); + i.executionGrouping.enabled = !!e?.data?.prefs?.enabled, G(i), K(i), a("executionGrouping.enabled"); } catch (e) { - t.executionGrouping.enabled = n, G(t), K(t), i("executionGrouping.enabled"), E(e?.message || "Failed to update execution grouping setting", "error"); + i.executionGrouping.enabled = n, G(i), K(i), a("executionGrouping.enabled"), t(e?.message || "Failed to update execution grouping setting", "error"); } } - }), e({ - id: `${pn}.AutoScan.OnStartup`, + }), n({ + id: `${hn}.AutoScan.OnStartup`, category: o(O("cat.scanning"), O("setting.scan.startup.name").replace("Majoor: ", "")), name: O("setting.scan.startup.name"), tooltip: O("setting.scan.startup.desc"), type: "boolean", - defaultValue: !!t.autoScan?.onStartup, + defaultValue: !!i.autoScan?.onStartup, onChange: (e) => { - t.autoScan = t.autoScan || {}, t.autoScan.onStartup = !!e, G(t), K(t), i("autoScan.onStartup"); + i.autoScan = i.autoScan || {}, i.autoScan.onStartup = !!e, G(i), K(i), a("autoScan.onStartup"); } - }), e({ - id: `${pn}.Scan.FastMode`, + }), n({ + id: `${hn}.Scan.FastMode`, category: o(O("cat.scanning"), "Scan mode"), name: "Fast scan mode", tooltip: "Use fast scan mode for manual backfill scans (skip heavier metadata work during scan).", type: "boolean", - defaultValue: !!(t.scan?.fastMode ?? !0), + defaultValue: !!(i.scan?.fastMode ?? !0), onChange: (e) => { - t.scan = t.scan || {}, t.scan.fastMode = !!e, G(t), i("scan.fastMode"); + i.scan = i.scan || {}, i.scan.fastMode = !!e, G(i), a("scan.fastMode"); } - }), e({ - id: `${pn}.Scan.JpegXL`, + }), n({ + id: `${hn}.Scan.JpegXL`, category: o(O("cat.scanning"), "Image formats"), name: "JPEG XL (JXL) support (Experimental)", tooltip: "Index and preview .jxl images. Preview generation requires JPEG XL support in Pillow or FFmpeg. Run a new scan after enabling.", type: "boolean", - defaultValue: !!t.scan?.jxlEnabled, + defaultValue: !!i.scan?.jxlEnabled, onChange: async (e) => { - let n = !!t.scan?.jxlEnabled, r = !!e; - t.scan = t.scan || {}, t.scan.jxlEnabled = r, G(t), i("scan.jxlEnabled"); + let n = !!i.scan?.jxlEnabled, r = !!e; + i.scan = i.scan || {}, i.scan.jxlEnabled = r, G(i), a("scan.jxlEnabled"); try { - let e = await a(r); + let e = await v(r); if (!e?.ok) throw Error(e?.error || "Failed to update JPEG XL support"); } catch (e) { - t.scan.jxlEnabled = n, G(t), i("scan.jxlEnabled"), E(e?.message || "Failed to update JPEG XL support", "error"); + i.scan.jxlEnabled = n, G(i), a("scan.jxlEnabled"), t(e?.message || "Failed to update JPEG XL support", "error"); } } - }), h().then((e) => { - e?.ok && (t.scan = t.scan || {}, t.scan.jxlEnabled = !!e?.data?.prefs?.enabled, G(t), i("scan.jxlEnabled")); - }).catch(() => {}), e({ - id: `${pn}.RtHydrate.Concurrency`, + }), e().then((e) => { + e?.ok && (i.scan = i.scan || {}, i.scan.jxlEnabled = !!e?.data?.prefs?.enabled, G(i), a("scan.jxlEnabled")); + }).catch(() => {}), n({ + id: `${hn}.RtHydrate.Concurrency`, category: o(O("cat.scanning"), "Hydration"), name: "Hydrate Concurrency", tooltip: "Maximum concurrent hydration requests for rating/tags.", type: "number", - defaultValue: Number(t.rtHydrate?.concurrency || A.RT_HYDRATE_CONCURRENCY || 5), + defaultValue: Number(i.rtHydrate?.concurrency || A.RT_HYDRATE_CONCURRENCY || 5), attrs: { min: 1, max: 20, step: 1 }, onChange: (e) => { - t.rtHydrate = t.rtHydrate || {}, t.rtHydrate.concurrency = Math.max(1, Math.min(20, Math.round(U(e, A.RT_HYDRATE_CONCURRENCY || 5)))), G(t), K(t), i("rtHydrate.concurrency"); + i.rtHydrate = i.rtHydrate || {}, i.rtHydrate.concurrency = Math.max(1, Math.min(20, Math.round(U(e, A.RT_HYDRATE_CONCURRENCY || 5)))), G(i), K(i), a("rtHydrate.concurrency"); } }); let s = (e, t, n, r) => { let i = Math.round(U(e, t)); return Math.max(n, Math.min(r, i)); }, c = (e = {}) => { - let n = []; - if (t.watcher = t.watcher || {}, typeof e.debounce_ms == "number") { - let r = Math.max(50, Math.min(5e3, Math.round(e.debounce_ms))); - t.watcher.debounceMs !== r && (t.watcher.debounceMs = r, n.push("watcher.debounceMs")); + let t = []; + if (i.watcher = i.watcher || {}, typeof e.debounce_ms == "number") { + let n = Math.max(50, Math.min(5e3, Math.round(e.debounce_ms))); + i.watcher.debounceMs !== n && (i.watcher.debounceMs = n, t.push("watcher.debounceMs")); } if (typeof e.dedupe_ttl_ms == "number") { - let r = Math.max(100, Math.min(3e4, Math.round(e.dedupe_ttl_ms))); - t.watcher.dedupeTtlMs !== r && (t.watcher.dedupeTtlMs = r, n.push("watcher.dedupeTtlMs")); + let n = Math.max(100, Math.min(3e4, Math.round(e.dedupe_ttl_ms))); + i.watcher.dedupeTtlMs !== n && (i.watcher.dedupeTtlMs = n, t.push("watcher.dedupeTtlMs")); } - n.length && (G(t), n.forEach((e) => i(e))); - }, l = async () => { + t.length && (G(i), t.forEach((e) => a(e))); + }, u = async () => { try { - let e = await se(); + let e = await ve(); if (!e?.ok) return; c(e.data || {}); } catch (e) { console.debug?.(e); } }; - e({ - id: `${pn}.Watcher.Enabled`, + n({ + id: `${hn}.Watcher.Enabled`, category: o(O("cat.scanning"), O("setting.watcher.enabled.label", "Enable watcher")), name: O("setting.watcher.name"), tooltip: O("setting.watcher.desc") + " (env: MJR_ENABLE_WATCHER)", type: "boolean", - defaultValue: !!t.watcher?.enabled, + defaultValue: !!i.watcher?.enabled, onChange: async (e) => { - t.watcher = t.watcher || {}, t.watcher.enabled = !!e, G(t), i("watcher.enabled"); + i.watcher = i.watcher || {}, i.watcher.enabled = !!e, G(i), a("watcher.enabled"); try { - let n = await v(!!e); - n?.ok || (t.watcher.enabled = !e, G(t), i("watcher.enabled"), E(n?.error || O("toast.failedToggleWatcher", "Failed to toggle watcher"), "error")); + let n = await r(!!e); + n?.ok || (i.watcher.enabled = !e, G(i), a("watcher.enabled"), t(n?.error || O("toast.failedToggleWatcher", "Failed to toggle watcher"), "error")); } catch { - t.watcher.enabled = !e, G(t), i("watcher.enabled"); + i.watcher.enabled = !e, G(i), a("watcher.enabled"); } } - }), e({ - id: `${pn}.Watcher.DebounceDelay`, + }), n({ + id: `${hn}.Watcher.DebounceDelay`, category: o(O("cat.scanning"), O("setting.watcher.debounce.label", "Watcher debounce delay")), name: O("setting.watcher.debounce.name"), tooltip: O("setting.watcher.debounce.desc") + " (env: MJR_WATCHER_DEBOUNCE_MS)", type: "number", - defaultValue: t.watcher?.debounceMs ?? A.WATCHER_DEBOUNCE_MS, + defaultValue: i.watcher?.debounceMs ?? A.WATCHER_DEBOUNCE_MS, attrs: { min: 50, max: 6e4, step: 50 }, onChange: async (e) => { - let r = A.WATCHER_DEBOUNCE_MS, a = s(e, r, 50, 6e4), o = t.watcher?.debounceMs ?? r; - if (a !== o) { - t.watcher = t.watcher || {}, t.watcher.debounceMs = a, G(t); + let n = A.WATCHER_DEBOUNCE_MS, r = s(e, n, 50, 6e4), o = i.watcher?.debounceMs ?? n; + if (r !== o) { + i.watcher = i.watcher || {}, i.watcher.debounceMs = r, G(i); try { - let e = await n({ debounce_ms: a }); + let e = await l({ debounce_ms: r }); if (!e?.ok) throw Error(e?.error || O("setting.watcher.debounce.error")); - let r = Math.round(Number(e?.data?.debounce_ms ?? a)); - t.watcher.debounceMs = r, G(t), i("watcher.debounceMs"); + let t = Math.round(Number(e?.data?.debounce_ms ?? r)); + i.watcher.debounceMs = t, G(i), a("watcher.debounceMs"); } catch (e) { - t.watcher.debounceMs = o, G(t), i("watcher.debounceMs"), E(e?.message || O("setting.watcher.debounce.error"), "error"); + i.watcher.debounceMs = o, G(i), a("watcher.debounceMs"), t(e?.message || O("setting.watcher.debounce.error"), "error"); } } } - }), e({ - id: `${pn}.Watcher.DedupeWindow`, + }), n({ + id: `${hn}.Watcher.DedupeWindow`, category: o(O("cat.scanning"), O("setting.watcher.dedupe.label", "Watcher dedupe window")), name: O("setting.watcher.dedupe.name"), tooltip: O("setting.watcher.dedupe.desc") + " (env: MJR_WATCHER_DEDUPE_TTL_MS)", type: "number", - defaultValue: t.watcher?.dedupeTtlMs ?? A.WATCHER_DEDUPE_TTL_MS, + defaultValue: i.watcher?.dedupeTtlMs ?? A.WATCHER_DEDUPE_TTL_MS, attrs: { min: 100, max: 12e4, step: 100 }, onChange: async (e) => { - let r = A.WATCHER_DEDUPE_TTL_MS, a = s(e, r, 100, 12e4), o = t.watcher?.dedupeTtlMs ?? r; - if (a !== o) { - t.watcher = t.watcher || {}, t.watcher.dedupeTtlMs = a, G(t); + let n = A.WATCHER_DEDUPE_TTL_MS, r = s(e, n, 100, 12e4), o = i.watcher?.dedupeTtlMs ?? n; + if (r !== o) { + i.watcher = i.watcher || {}, i.watcher.dedupeTtlMs = r, G(i); try { - let e = await n({ dedupe_ttl_ms: a }); + let e = await l({ dedupe_ttl_ms: r }); if (!e?.ok) throw Error(e?.error || O("setting.watcher.dedupe.error")); - let r = Math.round(Number(e?.data?.dedupe_ttl_ms ?? a)); - t.watcher.dedupeTtlMs = r, G(t), i("watcher.dedupeTtlMs"); + let t = Math.round(Number(e?.data?.dedupe_ttl_ms ?? r)); + i.watcher.dedupeTtlMs = t, G(i), a("watcher.dedupeTtlMs"); } catch (e) { - t.watcher.dedupeTtlMs = o, G(t), i("watcher.dedupeTtlMs"), E(e?.message || O("setting.watcher.dedupe.error"), "error"); + i.watcher.dedupeTtlMs = o, G(i), a("watcher.dedupeTtlMs"), t(e?.message || O("setting.watcher.dedupe.error"), "error"); } } } - }), e({ - id: `${pn}.Watcher.MaxPending`, + }), n({ + id: `${hn}.Watcher.MaxPending`, category: o(O("cat.scanning"), "Watcher queue"), name: "Watcher: max pending files", tooltip: "Maximum number of pending watcher files kept in memory.", type: "number", - defaultValue: Number(t.watcher?.maxPending ?? 500), + defaultValue: Number(i.watcher?.maxPending ?? 500), attrs: { min: 10, max: 5e3, step: 10 }, onChange: (e) => { - t.watcher = t.watcher || {}, t.watcher.maxPending = Math.max(10, Math.min(5e3, Math.round(U(e, 500)))), G(t), K(t), i("watcher.maxPending"); + i.watcher = i.watcher || {}, i.watcher.maxPending = Math.max(10, Math.min(5e3, Math.round(U(e, 500)))), G(i), K(i), a("watcher.maxPending"); } - }), e({ - id: `${pn}.Watcher.MinSize`, + }), n({ + id: `${hn}.Watcher.MinSize`, category: o(O("cat.scanning"), "Watcher file size"), name: "Watcher: min size (bytes)", tooltip: "Minimum file size indexed by watcher.", type: "number", - defaultValue: Number(t.watcher?.minSize ?? 100), + defaultValue: Number(i.watcher?.minSize ?? 100), attrs: { min: 0, max: 1e6, step: 100 }, onChange: (e) => { - t.watcher = t.watcher || {}, t.watcher.minSize = Math.max(0, Math.min(1e6, Math.round(U(e, 100)))), G(t), K(t), i("watcher.minSize"); + i.watcher = i.watcher || {}, i.watcher.minSize = Math.max(0, Math.min(1e6, Math.round(U(e, 100)))), G(i), K(i), a("watcher.minSize"); } - }), e({ - id: `${pn}.Watcher.MaxSize`, + }), n({ + id: `${hn}.Watcher.MaxSize`, category: o(O("cat.scanning"), "Watcher file size"), name: "Watcher: max size (bytes)", tooltip: "Maximum file size indexed by watcher.", type: "number", - defaultValue: Number(t.watcher?.maxSize ?? 4294967296), + defaultValue: Number(i.watcher?.maxSize ?? 4294967296), attrs: { min: 1e5, max: 17179869184, step: 1e5 }, onChange: (e) => { - t.watcher = t.watcher || {}, t.watcher.maxSize = Math.max(1e5, Math.min(17179869184, Math.round(U(e, 4294967296)))), G(t), K(t), i("watcher.maxSize"); + i.watcher = i.watcher || {}, i.watcher.maxSize = Math.max(1e5, Math.min(17179869184, Math.round(U(e, 4294967296)))), G(i), K(i), a("watcher.maxSize"); } }); try { - l().catch(() => {}); + u().catch(() => {}); } catch (e) { console.debug?.(e); } - e({ - id: `${pn}.RatingTagsSync.Enabled`, + n({ + id: `${hn}.RatingTagsSync.Enabled`, category: o(O("cat.scanning"), O("setting.sync.rating.name").replace("Majoor: ", "")), name: O("setting.sync.rating.name"), tooltip: O("setting.sync.rating.desc"), type: "boolean", - defaultValue: !!t.ratingTagsSync?.enabled, + defaultValue: !!i.ratingTagsSync?.enabled, onChange: (e) => { - t.ratingTagsSync = t.ratingTagsSync || {}, t.ratingTagsSync.enabled = !!e, G(t), i("ratingTagsSync.enabled"); + i.ratingTagsSync = i.ratingTagsSync || {}, i.ratingTagsSync.enabled = !!e, G(i), a("ratingTagsSync.enabled"); } }); } //#endregion //#region ui/app/settings/settingsFeed.ts -var gn = "Majoor", _n = "Majoor Assets Manager"; -function vn(e, t, n) { +var vn = "Majoor", yn = "Majoor Assets Manager"; +function bn(e, t, n) { let r = (e) => [ - _n, + yn, O("cat.feed", "Generated Feed"), e ], i = () => { t.feed = t.feed || {}; }; e({ - id: `${gn}.Feed.CardSize`, + id: `${vn}.Feed.CardSize`, category: r("Card size"), name: "Feed card size (px)", tooltip: "Set the minimum card width used by the Generated Feed layout (60-600 px).", @@ -1352,7 +1353,7 @@ function vn(e, t, n) { i(), t.feed.minSize = Math.max(60, Math.min(600, Math.round(Number(e) || 120))), G(t), K(t), n("feed.minSize"); } }), e({ - id: `${gn}.Feed.ShowInfo`, + id: `${vn}.Feed.ShowInfo`, category: r("Show info section"), name: "Show card info section", tooltip: "Show or hide the entire info section (filename, metadata, dots) below thumbnails in the Generated Feed.", @@ -1362,7 +1363,7 @@ function vn(e, t, n) { i(), t.feed.showInfo = !!e, G(t), K(t), n("feed.showInfo"); } }), e({ - id: `${gn}.Feed.ShowFilename`, + id: `${vn}.Feed.ShowFilename`, category: r("Show filename"), name: "Show filename", tooltip: "Display the filename on feed cards.", @@ -1372,7 +1373,7 @@ function vn(e, t, n) { i(), t.feed.showFilename = !!e, G(t), K(t), n("feed.showFilename"); } }), e({ - id: `${gn}.Feed.ShowDimensions`, + id: `${vn}.Feed.ShowDimensions`, category: r("Show dimensions"), name: "Show dimensions", tooltip: "Display resolution (WxH) and duration on feed cards.", @@ -1382,7 +1383,7 @@ function vn(e, t, n) { i(), t.feed.showDimensions = !!e, G(t), K(t), n("feed.showDimensions"); } }), e({ - id: `${gn}.Feed.ShowDate`, + id: `${vn}.Feed.ShowDate`, category: r("Show date/time"), name: "Show date/time", tooltip: "Display date and time on feed cards.", @@ -1392,7 +1393,7 @@ function vn(e, t, n) { i(), t.feed.showDate = !!e, G(t), K(t), n("feed.showDate"); } }), e({ - id: `${gn}.Feed.ShowGenTime`, + id: `${vn}.Feed.ShowGenTime`, category: r("Show generation time"), name: "Show generation time", tooltip: "Display the generation time badge on feed cards.", @@ -1402,7 +1403,7 @@ function vn(e, t, n) { i(), t.feed.showGenTime = !!e, G(t), K(t), n("feed.showGenTime"); } }), e({ - id: `${gn}.Feed.ShowWorkflowDot`, + id: `${vn}.Feed.ShowWorkflowDot`, category: r("Show workflow dot"), name: "Show workflow indicator", tooltip: "Display the workflow availability dot on feed cards.", @@ -1412,7 +1413,7 @@ function vn(e, t, n) { i(), t.feed.showWorkflowDot = !!e, G(t), K(t), n("feed.showWorkflowDot"); } }), e({ - id: `${gn}.Feed.ShowExtBadge`, + id: `${vn}.Feed.ShowExtBadge`, category: r("Show format badges"), name: "Show format badges", tooltip: "Display format badges (e.g. JPG, MP4) on feed card thumbnails.", @@ -1422,7 +1423,7 @@ function vn(e, t, n) { i(), t.feed.showExtBadge = !!e, G(t), K(t), n("feed.showExtBadge"); } }), e({ - id: `${gn}.Feed.ShowRatingBadge`, + id: `${vn}.Feed.ShowRatingBadge`, category: r("Show rating badges"), name: "Show ratings", tooltip: "Display star ratings on feed card thumbnails.", @@ -1432,7 +1433,7 @@ function vn(e, t, n) { i(), t.feed.showRatingBadge = !!e, G(t), K(t), n("feed.showRatingBadge"); } }), e({ - id: `${gn}.Feed.ShowTagsBadge`, + id: `${vn}.Feed.ShowTagsBadge`, category: r("Show tags badges"), name: "Show tags", tooltip: "Display tag indicators on feed card thumbnails.", @@ -1445,7 +1446,7 @@ function vn(e, t, n) { } //#endregion //#region ui/app/settings/settingsSecurity.ts -var yn = "Majoor", bn = "Majoor Assets Manager", xn = 16, Sn = { +var xn = "Majoor", Sn = "Majoor Assets Manager", Cn = 16, wn = { safeMode: !1, allowWrite: !0, allowDelete: !0, @@ -1453,54 +1454,54 @@ var yn = "Majoor", bn = "Majoor Assets Manager", xn = 16, Sn = { allowOpenInFolder: !0, allowResetIndex: !0 }; -function Cn(e) { +function Tn(e) { return !!e; } -function wn(e, t) { - return Cn(e) === Cn(t); +function En(e, t) { + return Tn(e) === Tn(t); } -function Tn(e) { +function Dn(e) { return typeof e == "string" ? e.trim() : ""; } -function En(e) { +function On(e) { let t = String(e || "").trim().toLowerCase(); return t === "localhost" || t === "127.0.0.1" || t === "::1"; } -function Dn() { +function kn() { return globalThis.location || globalThis.window?.location || null; } -function On() { - let e = Dn(); +function An() { + let e = kn(); if (!e) return !1; let t = String(e.protocol || "").toLowerCase(), n = String(e.hostname || "").trim(); - return t === "http:" && !En(n); + return t === "http:" && !On(n); } -function kn(e) { +function jn(e) { let t = globalThis.crypto; if (!t?.getRandomValues) throw Error("Secure token generation requires crypto.getRandomValues()."); return t.getRandomValues(e); } -function An(e) { - let t = Math.max(4, Number(e) || 0), n = new Uint8Array(t); - return kn(n), Array.from(n, (e) => e.toString(16).padStart(2, "0")).join(""); -} -function jn() { - return `mjr_${An(18)}`; -} function Mn(e) { - return String(e?.apiToken || "").trim().length >= xn && H(e?.allowWrite, !0) && H(e?.requireAuth, !1) && !H(e?.allowRemoteWrite, !1); + let t = Math.max(4, Number(e) || 0), n = new Uint8Array(t); + return jn(n), Array.from(n, (e) => e.toString(16).padStart(2, "0")).join(""); } -function Nn(e) { +function Nn() { + return `mjr_${Mn(18)}`; +} +function Pn(e) { + return String(e?.apiToken || "").trim().length >= Cn && H(e?.allowWrite, !0) && H(e?.requireAuth, !1) && !H(e?.allowRemoteWrite, !1); +} +function Fn(e) { let t = String((e && typeof e == "object" ? e : {}).apiToken || "").trim(); return { - apiToken: t.length >= xn ? t : jn(), + apiToken: t.length >= Cn ? t : Nn(), allowWrite: !0, requireAuth: !0, allowRemoteWrite: !1, - allowInsecureTokenTransport: On() + allowInsecureTokenTransport: An() }; } -function Pn(e) { +function In(e) { let t = e || {}; return { safe_mode: H(t.safeMode, !1), @@ -1515,44 +1516,44 @@ function Pn(e) { ...String(t.apiToken || "").trim() ? { api_token: String(t.apiToken || "").trim() } : {} }; } -function Fn(e) { - return l(Pn(e)); +function Ln(e) { + return y(In(e)); } -function In(e) { +function Rn(e) { let t = String(e?.security?.tokenHint || "").trim(); return t ? O("setting.sec.token.placeholderConfigured", "Token configured on server ({tokenHint}). Leave blank to keep the current server token.", { tokenHint: t }) : e?.security?.tokenConfigured ? O("setting.sec.token.placeholderConfiguredGeneric", "Token configured on server. Leave blank to keep the current server token.") : O("setting.sec.token.placeholder", "Auto-generated for this browser session."); } -function Ln(e, t, n) { - let r = (e, t) => [ - bn, +function zn(e, n, r) { + let i = (e, t) => [ + Sn, e, t ]; e({ - id: `${yn}.Safety.ConfirmDeletion`, - category: r(O("cat.security"), "Confirm before deleting"), + id: `${xn}.Safety.ConfirmDeletion`, + category: i(O("cat.security"), "Confirm before deleting"), name: "Confirm before deleting", tooltip: "Show a confirmation dialog before deleting files. Disabling this allows instant deletion.", type: "boolean", - defaultValue: t.safety?.confirmDeletion !== !1, + defaultValue: n.safety?.confirmDeletion !== !1, onChange: (e) => { - wn(t.safety?.confirmDeletion !== !1, e) || (t.safety = t.safety || {}, t.safety.confirmDeletion = !!e, G(t), K(t), n("safety.confirmDeletion")); + En(n.safety?.confirmDeletion !== !1, e) || (n.safety = n.safety || {}, n.safety.confirmDeletion = !!e, G(n), K(n), r("safety.confirmDeletion")); } }); - let i = (i, a, o, s = "cat.security") => { + let a = (t, a, o, s = "cat.security") => { e({ - id: `${yn}.Security.${i}`, - category: r(O(s), O(a).replace("Majoor: ", "")), + id: `${xn}.Security.${t}`, + category: i(O(s), O(a).replace("Majoor: ", "")), name: O(a), tooltip: O(o), type: "boolean", - defaultValue: H(t.security?.[i], Sn[i] ?? !1), + defaultValue: H(n.security?.[t], wn[t] ?? !1), onChange: (e) => { - if (!wn(t.security?.[i], e)) { - t.security = t.security || {}, t.security[i] = !!e, G(t), n(`security.${i}`); + if (!En(n.security?.[t], e)) { + n.security = n.security || {}, n.security[t] = !!e, G(n), r(`security.${t}`); try { - Fn(t.security).then((e) => { - e?.ok && e.data?.prefs ? Kt() : e && e.ok === !1 && console.warn("[Majoor] backend security settings update failed", e.error || e); + Ln(n.security).then((e) => { + e?.ok && e.data?.prefs ? Jt() : e && e.ok === !1 && console.warn("[Majoor] backend security settings update failed", e.error || e); }).catch(() => {}); } catch (e) { console.debug?.(e); @@ -1561,233 +1562,273 @@ function Ln(e, t, n) { } }); }; - i("safeMode", "setting.sec.safe.name", "setting.sec.safe.desc"), i("allowWrite", "setting.sec.write.name", "setting.sec.write.desc"), i("allowDelete", "setting.sec.del.name", "setting.sec.del.desc"), i("allowRename", "setting.sec.ren.name", "setting.sec.ren.desc"), i("allowOpenInFolder", "setting.sec.open.name", "setting.sec.open.desc"), i("allowResetIndex", "setting.sec.reset.name", "setting.sec.reset.desc"), e({ - id: `${yn}.Security.RemoteLanPreset`, - category: r(O("cat.remote"), O("setting.sec.remoteLanPreset.name").replace("Majoor: ", "")), + a("safeMode", "setting.sec.safe.name", "setting.sec.safe.desc"), a("allowWrite", "setting.sec.write.name", "setting.sec.write.desc"), a("allowDelete", "setting.sec.del.name", "setting.sec.del.desc"), a("allowRename", "setting.sec.ren.name", "setting.sec.ren.desc"), a("allowOpenInFolder", "setting.sec.open.name", "setting.sec.open.desc"), a("allowResetIndex", "setting.sec.reset.name", "setting.sec.reset.desc"), e({ + id: `${xn}.Security.RemoteLanPreset`, + category: i(O("cat.remote"), O("setting.sec.remoteLanPreset.name").replace("Majoor: ", "")), name: O("setting.sec.remoteLanPreset.name"), tooltip: O("setting.sec.remoteLanPreset.desc"), type: "boolean", - defaultValue: Mn(t.security), + defaultValue: Pn(n.security), onChange: (e) => { - if (t.security = t.security || {}, wn(t.security.remoteLanPreset, e)) return; - if (t.security.remoteLanPreset = !!e, !e) { - G(t), n("security.remoteLanPreset"); + if (n.security = n.security || {}, En(n.security.remoteLanPreset, e)) return; + if (n.security.remoteLanPreset = !!e, !e) { + G(n), r("security.remoteLanPreset"); return; } - let r; + let i; try { - r = Nn(t.security); + i = Fn(n.security); } catch (e) { - E(e?.message || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"); + t(e?.message || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"); return; } - Object.assign(t.security, r), t.security.tokenConfigured = !0, t.security.tokenHint = String(r.apiToken || "").trim() ? `...${String(r.apiToken).trim().slice(-4)}` : "", r.apiToken && T(r.apiToken), G(t), n("security.remoteLanPreset"), n("security.apiToken"), n("security.allowWrite"), n("security.requireAuth"), n("security.allowRemoteWrite"), n("security.allowInsecureTokenTransport"); + Object.assign(n.security, i), n.security.tokenConfigured = !0, n.security.tokenHint = String(i.apiToken || "").trim() ? `...${String(i.apiToken).trim().slice(-4)}` : "", i.apiToken && x(i.apiToken), G(n), r("security.remoteLanPreset"), r("security.apiToken"), r("security.allowWrite"), r("security.requireAuth"), r("security.allowRemoteWrite"), r("security.allowInsecureTokenTransport"); try { - Fn(t.security).then((e) => { - e?.ok && e.data?.prefs ? (Kt(), E(O("toast.remoteLanPresetApplied", "Recommended remote LAN setup applied. This browser session is now authorized for Majoor write operations."), "success")) : e && e.ok === !1 && (E(e.error || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"), console.warn("[Majoor] backend remote LAN preset update failed", e.error || e)); + Ln(n.security).then((e) => { + e?.ok && e.data?.prefs ? (Jt(), t(O("toast.remoteLanPresetApplied", "Recommended remote LAN setup applied. This browser session is now authorized for Majoor write operations."), "success")) : e && e.ok === !1 && (t(e.error || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"), console.warn("[Majoor] backend remote LAN preset update failed", e.error || e)); }).catch((e) => { - E(e?.message || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"); + t(e?.message || O("toast.remoteLanPresetFailed", "Failed to apply the recommended remote LAN setup."), "error"); }); } catch (e) { console.debug?.(e); } } }), e({ - id: `${yn}.Security.ApiToken`, - category: r(O("cat.remote"), O("setting.sec.token.name").replace("Majoor: ", "")), + id: `${xn}.Security.ApiToken`, + category: i(O("cat.remote"), O("setting.sec.token.name").replace("Majoor: ", "")), name: O("setting.sec.token.name", "Majoor: API Token"), tooltip: O("setting.sec.token.desc", "Store the API token used for write operations. Majoor sends it via X-MJR-Token and Authorization headers."), type: "text", - defaultValue: t.security?.apiToken || "", - attrs: { placeholder: In(t) }, + defaultValue: n.security?.apiToken || "", + attrs: { placeholder: Rn(n) }, onChange: (e) => { - t.security = t.security || {}; - let r = Tn(e); - if (Tn(t.security.apiToken) !== r && (t.security.apiToken = r, t.security.apiToken && (t.security.tokenConfigured = !0, t.security.tokenHint = `...${t.security.apiToken.slice(-4)}`, T(t.security.apiToken)), G(t), n("security.apiToken"), t.security.apiToken)) try { - l({ api_token: t.security.apiToken }).then((e) => { - e?.ok && e.data?.prefs ? Kt() : e && e.ok === !1 && console.warn("[Majoor] backend token update failed", e.error || e); + n.security = n.security || {}; + let t = Dn(e); + if (Dn(n.security.apiToken) !== t && (n.security.apiToken = t, n.security.apiToken && (n.security.tokenConfigured = !0, n.security.tokenHint = `...${n.security.apiToken.slice(-4)}`, x(n.security.apiToken)), G(n), r("security.apiToken"), n.security.apiToken)) try { + y({ api_token: n.security.apiToken }).then((e) => { + e?.ok && e.data?.prefs ? Jt() : e && e.ok === !1 && console.warn("[Majoor] backend token update failed", e.error || e); }).catch(() => {}); } catch (e) { console.debug?.(e); } } - }), i("requireAuth", "setting.sec.requireAuth.name", "setting.sec.requireAuth.desc", "cat.remote"), i("allowRemoteWrite", "setting.sec.remote.name", "setting.sec.remote.desc", "cat.remote"), i("allowInsecureTokenTransport", "setting.sec.insecureTransport.name", "setting.sec.insecureTransport.desc", "cat.remote"); + }), a("requireAuth", "setting.sec.requireAuth.name", "setting.sec.requireAuth.desc", "cat.remote"), a("allowRemoteWrite", "setting.sec.remote.name", "setting.sec.remote.desc", "cat.remote"), a("allowInsecureTokenTransport", "setting.sec.insecureTransport.name", "setting.sec.insecureTransport.desc", "cat.remote"); } //#endregion //#region ui/app/settings/settingsAdvanced.ts -var J = "Majoor", Rn = "Majoor Assets Manager"; -function zn(e, n, r, i) { - let a = (e, t) => [ - Rn, +var J = "Majoor", Bn = "Majoor Assets Manager"; +function Vn(e, r, i, c) { + let l = (e, t) => [ + Bn, e, t - ], o = String(n.paths?.outputDirectory || ""), l = null, u = 0, f = null; + ], u = String(r.paths?.outputDirectory || ""), d = null, p = 0, h = null; e({ id: `${J}.Paths.OutputDirectory`, - category: a(O("cat.advanced"), "Paths / Output"), + category: l(O("cat.advanced"), "Paths / Output"), name: "Majoor: Generation Output Directory", tooltip: "Override the ComfyUI generation output directory used by Majoor (equivalent to --output-directory). Leave empty to keep the current backend default.", type: "text", - defaultValue: String(n.paths?.outputDirectory || ""), + defaultValue: String(r.paths?.outputDirectory || ""), attrs: { placeholder: "D:\\\\____COMFY_OUTPUTS" }, onChange: async (e) => { - let t = String(e || "").trim(); - n.paths = n.paths || {}, n.paths.outputDirectory = t, G(n); + let n = String(e || "").trim(); + r.paths = r.paths || {}, r.paths.outputDirectory = n, G(r); try { - l &&= (clearTimeout(l), null); + d &&= (clearTimeout(d), null); } catch (e) { console.debug?.(e); } - l = setTimeout(async () => { - l = null; - let e = ++u; + d = setTimeout(async () => { + d = null; + let e = ++p; try { - f?.abort?.(); + h?.abort?.(); } catch (e) { console.debug?.(e); } - f = typeof AbortController < "u" ? new AbortController() : null; + h = typeof AbortController < "u" ? new AbortController() : null; try { - let i = await fe(t, f ? { signal: f.signal } : {}); - if (e !== u) return; - if (!i?.ok) throw Error(i?.error || O("toast.failedSetOutputDirectory", "Failed to set output directory")); - let a = String(i?.data?.output_directory || t).trim(); - n.paths.outputDirectory = a, o = a, G(n), r("paths.outputDirectory"); - } catch (t) { - if (e !== u || String(t?.name || "") === "AbortError" || String(t?.code || "") === "ABORTED") return; - n.paths.outputDirectory = o, G(n), r("paths.outputDirectory"), E(t?.message || O("toast.failedSetOutputDirectory", "Failed to set output directory"), "error"); + let t = await he(n, h ? { signal: h.signal } : {}); + if (e !== p) return; + if (!t?.ok) throw Error(t?.error || O("toast.failedSetOutputDirectory", "Failed to set output directory")); + let a = String(t?.data?.output_directory || n).trim(); + r.paths.outputDirectory = a, u = a, G(r), i("paths.outputDirectory"); + } catch (n) { + if (e !== p || String(n?.name || "") === "AbortError" || String(n?.code || "") === "ABORTED") return; + r.paths.outputDirectory = u, G(r), i("paths.outputDirectory"), t(n?.message || O("toast.failedSetOutputDirectory", "Failed to set output directory"), "error"); } }, 700); } }); try { - be().then((e) => { + ye().then((e) => { if (!e?.ok) return; let t = String(e?.data?.output_directory || "").trim(); - n.paths = n.paths || {}, n.paths.outputDirectory !== t && (n.paths.outputDirectory = t, o = t, G(n), r("paths.outputDirectory")); + r.paths = r.paths || {}, r.paths.outputDirectory !== t && (r.paths.outputDirectory = t, u = t, G(r), i("paths.outputDirectory")); }).catch(() => {}); } catch (e) { console.debug?.(e); } - let m = String(n.paths?.indexDirectory || ""), h = null, _ = 0, v = null; + let _ = String(r.paths?.inputDirectory || ""), v = null, y = 0, x = null, S = (e) => { + r.paths = r.paths || {}, r.paths.inputDirectory = e, G(r), ke(c, `${J}.Paths.InputDirectory`, e), i("paths.inputDirectory"); + }; + e({ + id: `${J}.Paths.InputDirectory`, + category: l(O("cat.advanced"), "Paths / Input"), + name: "Majoor: Input Directory", + tooltip: "Override the folder indexed by the Inputs tab. Leave empty to use ComfyUI's input directory (--input-directory). Run a scan after changing it.", + type: "text", + defaultValue: String(r.paths?.inputDirectory || ""), + attrs: { placeholder: "D:\\ComfyUI\\input" }, + onChange: (e) => { + let n = String(e || "").trim(); + if (n === String(r.paths?.inputDirectory || "")) return; + r.paths = r.paths || {}, r.paths.inputDirectory = n, G(r), v && clearTimeout(v); + let i = ++y; + x?.abort(), v = setTimeout(async () => { + v = null, x = typeof AbortController < "u" ? new AbortController() : null; + try { + let e = await a(n, x ? { signal: x.signal } : {}); + if (i !== y) return; + if (!e?.ok) throw Error(e?.error || "Failed to set input directory"); + let t = String(e?.data?.input_directory ?? n).trim(); + _ = t, S(t); + } catch (e) { + if (i !== y || e?.name === "AbortError" || e?.code === "ABORTED") return; + S(_), t(e?.message || "Failed to set input directory", "error"); + } + }, 700); + } + }); + try { + b().then((e) => { + if (!e?.ok || y !== 0) return; + let t = String(e?.data?.input_directory || "").trim(); + _ = t, S(t); + }).catch(() => {}); + } catch (e) { + console.debug?.(e); + } + let ee = String(r.paths?.indexDirectory || ""), ne = null, E = 0, D = null; e({ id: `${J}.Paths.IndexDirectory`, - category: a(O("cat.advanced"), "Paths / Index"), + category: l(O("cat.advanced"), "Paths / Index"), name: "Majoor: Index Database Directory", tooltip: "Override the Majoor index database directory. Use this to keep the SQLite index on a different local disk. Requires restart.", type: "text", - defaultValue: String(n.paths?.indexDirectory || ""), + defaultValue: String(r.paths?.indexDirectory || ""), attrs: { placeholder: "D:\\MajoorIndex" }, onChange: async (e) => { - let t = String(e || "").trim(); - n.paths = n.paths || {}, n.paths.indexDirectory = t, G(n); + let n = String(e || "").trim(); + r.paths = r.paths || {}, r.paths.indexDirectory = n, G(r); try { - h &&= (clearTimeout(h), null); + ne &&= (clearTimeout(ne), null); } catch (e) { console.debug?.(e); } - h = setTimeout(async () => { - h = null; - let e = ++_; + ne = setTimeout(async () => { + ne = null; + let e = ++E; try { - v?.abort?.(); + D?.abort?.(); } catch (e) { console.debug?.(e); } - v = typeof AbortController < "u" ? new AbortController() : null; + D = typeof AbortController < "u" ? new AbortController() : null; try { - let i = await S(t, v ? { signal: v.signal } : {}); - if (e !== _) return; - if (!i?.ok) throw Error(i?.error || O("toast.failedSetIndexDirectory", "Failed to set index directory")); - let a = String(i?.data?.index_directory || t).trim(), o = a !== m; - n.paths.indexDirectory = a, m = a, G(n), r("paths.indexDirectory"), o && E(O("toast.indexDirectorySavedRestart", "Index directory saved. Restart ComfyUI to apply."), "success", void 0, { history: { trackId: "settings:index-directory-saved" } }); - } catch (t) { - if (e !== _ || String(t?.name || "") === "AbortError" || String(t?.code || "") === "ABORTED") return; - n.paths.indexDirectory = m, G(n), r("paths.indexDirectory"), E(t?.message || O("toast.failedSetIndexDirectory", "Failed to set index directory"), "error"); + let a = await o(n, D ? { signal: D.signal } : {}); + if (e !== E) return; + if (!a?.ok) throw Error(a?.error || O("toast.failedSetIndexDirectory", "Failed to set index directory")); + let s = String(a?.data?.index_directory || n).trim(), c = s !== ee; + r.paths.indexDirectory = s, ee = s, G(r), i("paths.indexDirectory"), c && t(O("toast.indexDirectorySavedRestart", "Index directory saved. Restart ComfyUI to apply."), "success", void 0, { history: { trackId: "settings:index-directory-saved" } }); + } catch (n) { + if (e !== E || String(n?.name || "") === "AbortError" || String(n?.code || "") === "ABORTED") return; + r.paths.indexDirectory = ee, G(r), i("paths.indexDirectory"), t(n?.message || O("toast.failedSetIndexDirectory", "Failed to set index directory"), "error"); } }, 700); } }); try { - ie().then((e) => { + ae().then((e) => { if (!e?.ok) return; let t = String(e?.data?.index_directory || "").trim(); - n.paths = n.paths || {}, n.paths.indexDirectory !== t && (n.paths.indexDirectory = t, m = t, G(n), r("paths.indexDirectory")); + r.paths = r.paths || {}, r.paths.indexDirectory !== t && (r.paths.indexDirectory = t, ee = t, G(r), i("paths.indexDirectory")); }).catch(() => {}); } catch (e) { console.debug?.(e); } - let y = String(n.paths?.workflowRoots || ""), b = null, x = 0, C = null; + let oe = String(r.paths?.workflowRoots || ""), se = null, ce = 0, le = null; e({ id: `${J}.Paths.WorkflowRoots`, - category: a(O("cat.advanced"), "Paths / Workflows"), + category: l(O("cat.advanced"), "Paths / Workflows"), name: "Majoor: Workflow Roots", tooltip: "Folders scanned by the Workflow tab. Use one folder per line, or separate folders with semicolons. Leave empty to use ComfyUI defaults and MJR_AM_WORKFLOW_DIRECTORY.", type: "text", - defaultValue: String(n.paths?.workflowRoots || ""), + defaultValue: String(r.paths?.workflowRoots || ""), attrs: { placeholder: "D:\\\\ComfyUI\\\\user\\\\default\\\\workflows" }, onChange: async (e) => { - let t = String(e || "").trim(); - n.paths = n.paths || {}, n.paths.workflowRoots = t, G(n); + let n = String(e || "").trim(); + r.paths = r.paths || {}, r.paths.workflowRoots = n, G(r); try { - b &&= (clearTimeout(b), null); + se &&= (clearTimeout(se), null); } catch (e) { console.debug?.(e); } - b = setTimeout(async () => { - b = null; - let e = ++x; + se = setTimeout(async () => { + se = null; + let e = ++ce; try { - C?.abort?.(); + le?.abort?.(); } catch (e) { console.debug?.(e); } - C = typeof AbortController < "u" ? new AbortController() : null; + le = typeof AbortController < "u" ? new AbortController() : null; try { - let i = await s(t, C ? { signal: C.signal } : {}); - if (e !== x) return; - if (!i?.ok) throw Error(i?.error || O("toast.failedSetWorkflowRoots", "Failed to set workflow roots")); - let a = String(i?.data?.workflow_roots_text || t).trim(); - n.paths.workflowRoots = a, y = a, G(n), r("paths.workflowRoots"), E(O("toast.workflowRootsSaved", "Workflow roots saved"), "success", 1800); - } catch (t) { - if (e !== x || String(t?.name || "") === "AbortError" || String(t?.code || "") === "ABORTED") return; - n.paths.workflowRoots = y, G(n), r("paths.workflowRoots"), E(t?.message || O("toast.failedSetWorkflowRoots", "Failed to set workflow roots"), "error"); + let a = await C(n, le ? { signal: le.signal } : {}); + if (e !== ce) return; + if (!a?.ok) throw Error(a?.error || O("toast.failedSetWorkflowRoots", "Failed to set workflow roots")); + let o = String(a?.data?.workflow_roots_text || n).trim(); + r.paths.workflowRoots = o, oe = o, G(r), i("paths.workflowRoots"), t(O("toast.workflowRootsSaved", "Workflow roots saved"), "success", 1800); + } catch (n) { + if (e !== ce || String(n?.name || "") === "AbortError" || String(n?.code || "") === "ABORTED") return; + r.paths.workflowRoots = oe, G(r), i("paths.workflowRoots"), t(n?.message || O("toast.failedSetWorkflowRoots", "Failed to set workflow roots"), "error"); } }, 700); } }); try { - xe().then((e) => { + ue().then((e) => { if (!e?.ok) return; let t = String(e?.data?.workflow_roots_text || "").trim(); - n.paths = n.paths || {}, n.paths.workflowRoots !== t && (n.paths.workflowRoots = t, y = t, G(n), r("paths.workflowRoots")); + r.paths = r.paths || {}, r.paths.workflowRoots !== t && (r.paths.workflowRoots = t, oe = t, G(r), i("paths.workflowRoots")); }).catch(() => {}); } catch (e) { console.debug?.(e); } - let te = Fe().map((e) => e.code), T = ["auto", ...te]; + let fe = Le().map((e) => e.code), pe = ["auto", ...fe]; e({ id: `${J}.Language`, - category: a(O("cat.advanced"), O("setting.language.name", "Language")), + category: l(O("cat.advanced"), O("setting.language.name", "Language")), name: O("setting.language.name", "Majoor: Language"), tooltip: "Use auto to detect and follow ComfyUI language. Or choose a fixed language for Majoor only.", type: "combo", - defaultValue: n.i18n?.followComfyLanguage ? "auto" : Ae(), - options: T, + defaultValue: r.i18n?.followComfyLanguage ? "auto" : Me(), + options: pe, onChange: (e) => { - if (n.i18n = n.i18n || {}, e === "auto") { - n.i18n.followComfyLanguage = !0, je(!0), ze(i), G(n), r("language"); + if (r.i18n = r.i18n || {}, e === "auto") { + r.i18n.followComfyLanguage = !0, Ne(!0), Ve(c), G(r), i("language"); return; } - te.includes(e) && (n.i18n.followComfyLanguage = !1, je(!1), Me(e), G(n), r("language")); + fe.includes(e) && (r.i18n.followComfyLanguage = !1, Ne(!1), Pe(e), G(r), i("language")); } }), e({ id: `${J}.ProbeBackend.Mode`, - category: a(O("cat.advanced"), O("setting.probe.mode.name").replace("Majoor: ", "")), + category: l(O("cat.advanced"), O("setting.probe.mode.name").replace("Majoor: ", "")), name: O("setting.probe.mode.name"), tooltip: O("setting.probe.mode.desc") + " (env: MAJOOR_MEDIA_PROBE_BACKEND)", type: "combo", - defaultValue: n.probeBackend?.mode || W.probeBackend.mode, + defaultValue: r.probeBackend?.mode || W.probeBackend.mode, options: [ "auto", "exiftool", @@ -1795,206 +1836,206 @@ function zn(e, n, r, i) { "both" ], onChange: (e) => { - let i = It(e, [ + let t = Rt(e, [ "auto", "exiftool", "ffprobe", "both" ], W.probeBackend.mode); - n.probeBackend = n.probeBackend || {}, n.probeBackend.mode = i, G(n), K(n), r("probeBackend.mode"), t(i).catch(() => {}); + r.probeBackend = r.probeBackend || {}, r.probeBackend.mode = t, G(r), K(r), i("probeBackend.mode"), m(t).catch(() => {}); } }), e({ id: `${J}.MetadataFallback.Image`, - category: a(O("cat.advanced"), "Metadata"), + category: l(O("cat.advanced"), "Metadata"), name: "Majoor: Metadata Fallback (Images)", tooltip: "Enable Pillow fallback when ExifTool is missing or fails.", type: "boolean", - defaultValue: n.metadataFallback?.image ?? W.metadataFallback.image, + defaultValue: r.metadataFallback?.image ?? W.metadataFallback.image, onChange: async (e) => { - let t = !!e, i = !!(n.metadataFallback?.image ?? W.metadataFallback.image); - n.metadataFallback = n.metadataFallback || {}, n.metadataFallback.image = t, G(n), r("metadataFallback.image"); + let a = !!e, o = !!(r.metadataFallback?.image ?? W.metadataFallback.image); + r.metadataFallback = r.metadataFallback || {}, r.metadataFallback.image = a, G(r), i("metadataFallback.image"); try { - let e = await p({ - image: t, - media: n.metadataFallback?.media ?? W.metadataFallback.media + let e = await n({ + image: a, + media: r.metadataFallback?.media ?? W.metadataFallback.media }); if (!e?.ok) throw Error(e?.error || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings")); } catch (e) { - n.metadataFallback.image = i, G(n), r("metadataFallback.image"), E(e?.message || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings"), "error"); + r.metadataFallback.image = o, G(r), i("metadataFallback.image"), t(e?.message || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings"), "error"); } } }), e({ id: `${J}.MetadataFallback.Media`, - category: a(O("cat.advanced"), "Metadata"), + category: l(O("cat.advanced"), "Metadata"), name: "Majoor: Metadata Fallback (Audio/Video)", tooltip: "Enable hachoir fallback when ffprobe is missing or fails.", type: "boolean", - defaultValue: n.metadataFallback?.media ?? W.metadataFallback.media, + defaultValue: r.metadataFallback?.media ?? W.metadataFallback.media, onChange: async (e) => { - let t = !!e, i = !!(n.metadataFallback?.media ?? W.metadataFallback.media); - n.metadataFallback = n.metadataFallback || {}, n.metadataFallback.media = t, G(n), r("metadataFallback.media"); + let a = !!e, o = !!(r.metadataFallback?.media ?? W.metadataFallback.media); + r.metadataFallback = r.metadataFallback || {}, r.metadataFallback.media = a, G(r), i("metadataFallback.media"); try { - let e = await p({ - image: n.metadataFallback?.image ?? W.metadataFallback.image, - media: t + let e = await n({ + image: r.metadataFallback?.image ?? W.metadataFallback.image, + media: a }); if (!e?.ok) throw Error(e?.error || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings")); } catch (e) { - n.metadataFallback.media = i, G(n), r("metadataFallback.media"), E(e?.message || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings"), "error"); + r.metadataFallback.media = o, G(r), i("metadataFallback.media"), t(e?.message || O("toast.failedUpdateMetadataFallback", "Failed to update metadata fallback settings"), "error"); } } }); try { - ce().then((e) => { + we().then((e) => { if (!e?.ok || !e?.data?.prefs) return; - let t = e.data.prefs || {}, i = !!(t.image ?? W.metadataFallback.image), a = !!(t.media ?? W.metadataFallback.media); - n.metadataFallback = n.metadataFallback || {}; + let t = e.data.prefs || {}, n = !!(t.image ?? W.metadataFallback.image), a = !!(t.media ?? W.metadataFallback.media); + r.metadataFallback = r.metadataFallback || {}; let o = !1; - n.metadataFallback.image !== i && (n.metadataFallback.image = i, o = !0), n.metadataFallback.media !== a && (n.metadataFallback.media = a, o = !0), o && (G(n), r("metadataFallback")); + r.metadataFallback.image !== n && (r.metadataFallback.image = n, o = !0), r.metadataFallback.media !== a && (r.metadataFallback.media = a, o = !0), o && (G(r), i("metadataFallback")); }).catch(() => {}); } catch (e) { console.debug?.(e); } e({ id: `${J}.Db.Timeout`, - category: a(O("cat.advanced"), "Database"), + category: l(O("cat.advanced"), "Database"), name: "DB Timeout (ms)", tooltip: "Client-side DB timeout preference (stored locally).", type: "number", - defaultValue: Number(n.db?.timeoutMs || 5e3), + defaultValue: Number(r.db?.timeoutMs || 5e3), attrs: { min: 1e3, max: 3e4, step: 1e3 }, onChange: (e) => { - n.db = n.db || {}, n.db.timeoutMs = Math.max(1e3, Math.min(3e4, Math.round(U(e, 5e3)))), G(n), K(n), r("db.timeoutMs"); + r.db = r.db || {}, r.db.timeoutMs = Math.max(1e3, Math.min(3e4, Math.round(U(e, 5e3)))), G(r), K(r), i("db.timeoutMs"); } }), e({ id: `${J}.Db.MaxConnections`, - category: a(O("cat.advanced"), "Database"), + category: l(O("cat.advanced"), "Database"), name: "DB Max Connections", tooltip: "Client-side DB max connections preference (stored locally).", type: "number", - defaultValue: Number(n.db?.maxConnections || 10), + defaultValue: Number(r.db?.maxConnections || 10), attrs: { min: 1, max: 100, step: 1 }, onChange: (e) => { - n.db = n.db || {}, n.db.maxConnections = Math.max(1, Math.min(100, Math.round(U(e, 10)))), G(n), K(n), r("db.maxConnections"); + r.db = r.db || {}, r.db.maxConnections = Math.max(1, Math.min(100, Math.round(U(e, 10)))), G(r), K(r), i("db.maxConnections"); } }), e({ id: `${J}.Db.QueryTimeout`, - category: a(O("cat.advanced"), "Database"), + category: l(O("cat.advanced"), "Database"), name: "DB Query Timeout (ms)", tooltip: "Client-side DB query timeout preference (stored locally).", type: "number", - defaultValue: Number(n.db?.queryTimeoutMs || 1e3), + defaultValue: Number(r.db?.queryTimeoutMs || 1e3), attrs: { min: 500, max: 1e4, step: 500 }, onChange: (e) => { - n.db = n.db || {}, n.db.queryTimeoutMs = Math.max(500, Math.min(1e4, Math.round(U(e, 1e3)))), G(n), K(n), r("db.queryTimeoutMs"); + r.db = r.db || {}, r.db.queryTimeoutMs = Math.max(500, Math.min(1e4, Math.round(U(e, 1e3)))), G(r), K(r), i("db.queryTimeoutMs"); } }), e({ id: `${J}.Observability.Enabled`, - category: a(O("cat.advanced"), O("setting.obs.enabled.name").replace("Majoor: ", "")), + category: l(O("cat.advanced"), O("setting.obs.enabled.name").replace("Majoor: ", "")), name: O("setting.obs.enabled.name"), tooltip: O("setting.obs.enabled.desc"), type: "boolean", - defaultValue: !!n.observability?.enabled, + defaultValue: !!r.observability?.enabled, onChange: (e) => { - n.observability = n.observability || {}, n.observability.enabled = !!e, G(n), K(n), r("observability.enabled"); + r.observability = r.observability || {}, r.observability.enabled = !!e, G(r), K(r), i("observability.enabled"); } }), e({ id: `${J}.Observability.RuntimeDashboardMode`, - category: a(O("cat.advanced"), "Runtime metrics badge"), + category: l(O("cat.advanced"), "Runtime metrics badge"), name: "Majoor: Runtime metrics badge", tooltip: "Controls the small DB/enrichment/watcher metrics badge in the Assets Manager panel.", type: "combo", - defaultValue: n.observability?.runtimeDashboardMode || W.observability.runtimeDashboardMode, + defaultValue: r.observability?.runtimeDashboardMode || W.observability.runtimeDashboardMode, options: [ "autoHide30", "always", "hidden" ], onChange: (e) => { - let t = It(e, [ + let t = Rt(e, [ "autoHide30", "always", "hidden" ], W.observability.runtimeDashboardMode); - n.observability = n.observability || {}, n.observability.runtimeDashboardMode = t, G(n), r("observability.runtimeDashboardMode"); + r.observability = r.observability || {}, r.observability.runtimeDashboardMode = t, G(r), i("observability.runtimeDashboardMode"); } }), e({ id: `${J}.Observability.VerboseErrors`, - category: a(O("cat.advanced"), "Verbose error logging"), + category: l(O("cat.advanced"), "Verbose error logging"), name: "Verbose error logging", tooltip: "Show detailed error messages in toasts and console. Useful for debugging.", type: "boolean", - defaultValue: !!n.observability?.verboseErrors, + defaultValue: !!r.observability?.verboseErrors, onChange: (e) => { - n.observability = n.observability || {}, n.observability.verboseErrors = !!e, G(n), K(n), r("observability.verboseErrors"); + r.observability = r.observability || {}, r.observability.verboseErrors = !!e, G(r), K(r), i("observability.verboseErrors"); } }), e({ id: `${J}.Observability.VerboseRouteRegistrationLogs`, - category: a(O("cat.advanced"), "Logs"), + category: l(O("cat.advanced"), "Logs"), name: "Majoor: Verbose route registration logs", tooltip: "When disabled, Majoor prints a compact startup summary instead of listing every registered API route. Takes effect on the next backend restart.", type: "boolean", - defaultValue: !!(n.observability?.verboseRouteRegistrationLogs ?? W.observability?.verboseRouteRegistrationLogs ?? !1), + defaultValue: !!(r.observability?.verboseRouteRegistrationLogs ?? W.observability?.verboseRouteRegistrationLogs ?? !1), onChange: async (e) => { - let t = !!e, i = !!(n.observability?.verboseRouteRegistrationLogs ?? W.observability?.verboseRouteRegistrationLogs ?? !1); - n.observability = n.observability || {}, n.observability.verboseRouteRegistrationLogs = t, G(n), r("observability.verboseRouteRegistrationLogs"); + let n = !!e, a = !!(r.observability?.verboseRouteRegistrationLogs ?? W.observability?.verboseRouteRegistrationLogs ?? !1); + r.observability = r.observability || {}, r.observability.verboseRouteRegistrationLogs = n, G(r), i("observability.verboseRouteRegistrationLogs"); try { - let e = await de(t); + let e = await g(n); if (!e?.ok) throw Error(e?.error || "Failed to update route logging settings"); } catch (e) { - n.observability.verboseRouteRegistrationLogs = i, G(n), r("observability.verboseRouteRegistrationLogs"), E(e?.message || "Failed to update route logging settings", "error"); + r.observability.verboseRouteRegistrationLogs = a, G(r), i("observability.verboseRouteRegistrationLogs"), t(e?.message || "Failed to update route logging settings", "error"); } } }), (async () => { try { - let e = !!(await me())?.data?.prefs?.enabled; - n.observability = n.observability || {}, n.observability.verboseRouteRegistrationLogs !== e && (n.observability.verboseRouteRegistrationLogs = e, G(n), r("observability.verboseRouteRegistrationLogs")); + let e = !!(await Se())?.data?.prefs?.enabled; + r.observability = r.observability || {}, r.observability.verboseRouteRegistrationLogs !== e && (r.observability.verboseRouteRegistrationLogs = e, G(r), i("observability.verboseRouteRegistrationLogs")); } catch (e) { console.debug?.(e); } })(), e({ id: `${J}.Observability.VerboseStartupLogs`, - category: a(O("cat.advanced"), "Logs"), + category: l(O("cat.advanced"), "Logs"), name: "Majoor: Verbose startup logs", tooltip: "When disabled, Majoor suppresses most informational bootstrap logs during backend startup while keeping warnings and errors. Takes effect on the next backend restart.", type: "boolean", - defaultValue: !!(n.observability?.verboseStartupLogs ?? W.observability?.verboseStartupLogs ?? !1), + defaultValue: !!(r.observability?.verboseStartupLogs ?? W.observability?.verboseStartupLogs ?? !1), onChange: async (e) => { - let t = !!e, i = !!(n.observability?.verboseStartupLogs ?? W.observability?.verboseStartupLogs ?? !1); - n.observability = n.observability || {}, n.observability.verboseStartupLogs = t, G(n), r("observability.verboseStartupLogs"); + let n = !!e, a = !!(r.observability?.verboseStartupLogs ?? W.observability?.verboseStartupLogs ?? !1); + r.observability = r.observability || {}, r.observability.verboseStartupLogs = n, G(r), i("observability.verboseStartupLogs"); try { - let e = await d(t); + let e = await s(n); if (!e?.ok) throw Error(e?.error || "Failed to update startup logging settings"); } catch (e) { - n.observability.verboseStartupLogs = i, G(n), r("observability.verboseStartupLogs"), E(e?.message || "Failed to update startup logging settings", "error"); + r.observability.verboseStartupLogs = a, G(r), i("observability.verboseStartupLogs"), t(e?.message || "Failed to update startup logging settings", "error"); } } }), (async () => { try { - let e = !!(await oe())?.data?.prefs?.enabled; - n.observability = n.observability || {}, n.observability.verboseStartupLogs !== e && (n.observability.verboseStartupLogs = e, G(n), r("observability.verboseStartupLogs")); + let e = !!(await be())?.data?.prefs?.enabled; + r.observability = r.observability || {}, r.observability.verboseStartupLogs !== e && (r.observability.verboseStartupLogs = e, G(r), i("observability.verboseStartupLogs")); } catch (e) { console.debug?.(e); } })(); { - let t = "HuggingFace Token", i = "", o = null, s = 0, l = !!n.ai?.huggingFaceTokenVisible, u = () => { + let n = "HuggingFace Token", a = "", o = null, s = 0, c = !!r.ai?.huggingFaceTokenVisible, u = () => { try { let e = Array.from(document.querySelectorAll("input[data-mjr-hf-token=\"1\"]")); for (let t of e) try { - t.type = l ? "text" : "password"; + t.type = c ? "text" : "password"; } catch (e) { console.debug?.(e); } @@ -2017,18 +2058,18 @@ function zn(e, n, r, i) { }; e({ id: `${J}.AI.HuggingFaceTokenVisible`, - category: a(O("cat.advanced"), t), + category: l(O("cat.advanced"), n), name: "Show HuggingFace token", tooltip: "Show or hide the HuggingFace token while editing.", type: "boolean", - defaultValue: l, + defaultValue: c, onChange: (e) => { let t = !!e; - l = t, n.ai = n.ai || {}, n.ai.huggingFaceTokenVisible = t, G(n), r("ai.huggingFaceTokenVisible"), setTimeout(u, 0); + c = t, r.ai = r.ai || {}, r.ai.huggingFaceTokenVisible = t, G(r), i("ai.huggingFaceTokenVisible"), setTimeout(u, 0); } }), e({ id: `${J}.AI.HuggingFaceToken`, - category: a(O("cat.advanced"), t), + category: l(O("cat.advanced"), n), name: "HuggingFace Token", tooltip: [ "Optional token for HuggingFace Hub downloads (higher rate limits).", @@ -2039,14 +2080,14 @@ function zn(e, n, r, i) { defaultValue: "", attrs: { placeholder: "Paste HuggingFace token (hf_...)", - type: l ? "text" : "password", + type: c ? "text" : "password", autocomplete: "new-password", name: "mjr_huggingface_token", "data-mjr-hf-token": "1" }, onChange: (e) => { - let t = String(e || "").trim(); - if (t !== i) { + let n = String(e || "").trim(); + if (n !== a) { try { o &&= (clearTimeout(o), null); } catch (e) { @@ -2056,45 +2097,45 @@ function zn(e, n, r, i) { o = null; let e = ++s; try { - let n = await Ce(t); + let r = await w(n); if (e !== s) return; - if (!n?.ok) throw Error(n?.error || "Failed to update HuggingFace token"); - i = t, r("ai.huggingFaceToken"), t ? E("HuggingFace token saved", "success") : E("HuggingFace token cleared", "success", void 0, { noHistory: !0 }); - } catch (t) { + if (!r?.ok) throw Error(r?.error || "Failed to update HuggingFace token"); + a = n, i("ai.huggingFaceToken"), n ? t("HuggingFace token saved", "success") : t("HuggingFace token cleared", "success", void 0, { noHistory: !0 }); + } catch (n) { if (e !== s) return; - E(t?.message || "Failed to update HuggingFace token", "error"); + t(n?.message || "Failed to update HuggingFace token", "error"); } }, 900); } } }), setTimeout(u, 0), (async () => { try { - let e = (await w())?.data?.prefs || {}, t = !!e?.has_token, n = String(e?.token_hint || "").trim(), r = t ? `Configured ${n || "(saved)"}` : "Paste HuggingFace token (hf_...)"; + let e = (await re())?.data?.prefs || {}, t = !!e?.has_token, n = String(e?.token_hint || "").trim(), r = t ? `Configured ${n || "(saved)"}` : "Paste HuggingFace token (hf_...)"; d(r); } catch (e) { console.debug?.(e); } })(), e({ id: `${J}.AI.VerboseLogs`, - category: a(O("cat.advanced"), t), + category: l(O("cat.advanced"), n), name: "Majoor: Verbose AI logs", tooltip: "Enable detailed HuggingFace/SigLIP2/X-CLIP logs and progress bars during model download/loading.", type: "boolean", - defaultValue: !!(n.ai?.verboseAiLogs ?? W.ai?.verboseAiLogs ?? !1), + defaultValue: !!(r.ai?.verboseAiLogs ?? W.ai?.verboseAiLogs ?? !1), onChange: async (e) => { - let t = !!e, i = !!(n.ai?.verboseAiLogs ?? W.ai?.verboseAiLogs ?? !1); - n.ai = n.ai || {}, n.ai.verboseAiLogs = t, G(n), r("ai.verboseAiLogs"); + let n = !!e, a = !!(r.ai?.verboseAiLogs ?? W.ai?.verboseAiLogs ?? !1); + r.ai = r.ai || {}, r.ai.verboseAiLogs = n, G(r), i("ai.verboseAiLogs"); try { - let e = await we(t); + let e = await te(n); if (!e?.ok) throw Error(e?.error || "Failed to update AI logging settings"); } catch (e) { - n.ai.verboseAiLogs = i, G(n), r("ai.verboseAiLogs"), E(e?.message || "Failed to update AI logging settings", "error"); + r.ai.verboseAiLogs = a, G(r), i("ai.verboseAiLogs"), t(e?.message || "Failed to update AI logging settings", "error"); } } }), (async () => { try { - let e = !!(await c())?.data?.prefs?.enabled; - n.ai = n.ai || {}, n.ai.verboseAiLogs !== e && (n.ai.verboseAiLogs = e, G(n), r("ai.verboseAiLogs")); + let e = !!(await f())?.data?.prefs?.enabled; + r.ai = r.ai || {}, r.ai.verboseAiLogs !== e && (r.ai.verboseAiLogs = e, G(r), i("ai.verboseAiLogs")); } catch (e) { console.debug?.(e); } @@ -2102,21 +2143,21 @@ function zn(e, n, r, i) { } e({ id: `${J}.AI.VectorStats`, - category: a(O("cat.advanced"), "AI / Vector Search"), + category: l(O("cat.advanced"), "AI / Vector Search"), name: "Vector Index Status", tooltip: "Current status of the SigLIP2/X-CLIP vector index used for semantic search", type: "text", defaultValue: "Loading vector status..." }), (async () => { try { - let e = await _e(); + let e = await ie(); e?.ok ? console.debug?.("[Majoor] Vector status:", `${e.data?.total || 0} assets indexed | Model: ${e.data?.model || "N/A"}`) : console.debug?.("[Majoor] Vector status unavailable"); } catch (e) { console.debug?.("[Majoor] Vector status fetch failed", e); } })(), e({ id: `${J}.AI.VectorBackfillAction`, - category: a(O("cat.advanced"), "AI / Vector Search"), + category: l(O("cat.advanced"), "AI / Vector Search"), name: "Vector Index Action", tooltip: [ "Compute CLIP embeddings for all assets that don't have them yet.", @@ -2132,7 +2173,7 @@ function zn(e, n, r, i) { options: ["Idle", "Run backfill now"], onChange: async (e) => { if (String(e || "") !== "Run backfill now") return; - let t = { history: { + let n = { history: { trackId: "vector-backfill:advanced-settings", title: "Vector Backfill", source: "all", @@ -2140,19 +2181,19 @@ function zn(e, n, r, i) { forceStore: !0 } }; try { - E(O("toast.vectorBackfillStarting", "Starting vector backfill... This may take a while."), "info", void 0, { history: { - ...t.history, + t(O("toast.vectorBackfillStarting", "Starting vector backfill... This may take a while."), "info", void 0, { history: { + ...n.history, status: "started", detail: "Starting vector backfill... This may take a while." } }); - let e = await ee(64, { onProgress: (e) => { - let n = String(e?.status || "running").toLowerCase() || "running", r = e?.progress || e?.result || {}, i = Number(r?.candidates ?? r?.processed ?? 0), a = Number(r?.indexed ?? 0), o = Number(r?.skipped ?? 0), s = Number(r?.errors ?? 0), c = Math.max(i, a + o + s), l = c > 0 ? Math.round((a + o + s) / c * 100) : null, u = n === "queued" ? "Vector backfill queued" : `Candidates ${i}, indexed ${a}, skipped ${o}, errors ${s}`; - g({ + let e = await T(64, { onProgress: (e) => { + let t = String(e?.status || "running").toLowerCase() || "running", r = e?.progress || e?.result || {}, i = Number(r?.candidates ?? r?.processed ?? 0), a = Number(r?.indexed ?? 0), o = Number(r?.skipped ?? 0), s = Number(r?.errors ?? 0), c = Math.max(i, a + o + s), l = c > 0 ? Math.round((a + o + s) / c * 100) : null, u = t === "queued" ? "Vector backfill queued" : `Candidates ${i}, indexed ${a}, skipped ${o}, errors ${s}`; + de({ summary: "Vector Backfill", detail: u - }, n === "failed" ? "error" : n === "succeeded" ? "success" : "info", 0, { history: { - ...t.history, - status: n, + }, t === "failed" ? "error" : t === "succeeded" ? "success" : "info", 0, { history: { + ...n.history, + status: t, detail: u, progress: { current: a + o + s, @@ -2161,64 +2202,64 @@ function zn(e, n, r, i) { indexed: a, skipped: o, errors: s, - label: n + label: t } } }); } }); if (e?.ok) { - let n = e.data || {}, r = String(n?.status || "").toLowerCase(), i = !!n?.pending || [ + let r = e.data || {}, i = String(r?.status || "").toLowerCase(), a = !!r?.pending || [ "queued", "running", "pending" - ].includes(r), a = n?.progress || {}, o = Number(n?.processed ?? a?.candidates ?? 0), s = Number(n?.indexed ?? a?.indexed ?? 0), c = Number(n?.skipped ?? a?.skipped ?? 0); - if (i) { - let e = String(n?.job_id || "").trim(); - E(O("toast.vectorBackfillRunning", "Vector backfill still running in background{job}.", { job: e ? ` (job ${e.slice(0, 8)})` : "" }), "info", void 0, { history: { - ...t.history, + ].includes(i), o = r?.progress || {}, s = Number(r?.processed ?? o?.candidates ?? 0), c = Number(r?.indexed ?? o?.indexed ?? 0), l = Number(r?.skipped ?? o?.skipped ?? 0); + if (a) { + let e = String(r?.job_id || "").trim(); + t(O("toast.vectorBackfillRunning", "Vector backfill still running in background{job}.", { job: e ? ` (job ${e.slice(0, 8)})` : "" }), "info", void 0, { history: { + ...n.history, status: "running", detail: `Vector backfill still running in background${e ? ` (${e.slice(0, 8)})` : ""}.`, progress: { - current: s + c, - total: Math.max(o, s + c), - percent: Math.max(o, s + c) > 0 ? Math.round((s + c) / Math.max(o, s + c) * 100) : null, - indexed: s, - skipped: c, + current: c + l, + total: Math.max(s, c + l), + percent: Math.max(s, c + l) > 0 ? Math.round((c + l) / Math.max(s, c + l) * 100) : null, + indexed: c, + skipped: l, label: "running" } } }); } else { let e = O("toast.vectorBackfillComplete", "Vector backfill complete! Processed: {processed}, Indexed: {indexed}, Skipped: {skipped}", { - processed: o, - indexed: s, - skipped: c + processed: s, + indexed: c, + skipped: l }); - E(e, "success", void 0, { history: { - ...t.history, + t(e, "success", void 0, { history: { + ...n.history, status: "succeeded", - detail: `Processed ${o}, indexed ${s}, skipped ${c}`, + detail: `Processed ${s}, indexed ${c}, skipped ${l}`, progress: { - current: o, - total: o, - percent: o > 0 ? 100 : null, - indexed: s, - skipped: c, + current: s, + total: s, + percent: s > 0 ? 100 : null, + indexed: c, + skipped: l, label: "done" } } }); } try { - let e = await _e(); + let e = await ie(); e?.ok && console.debug?.("[Majoor] Vector stats after backfill:", e.data); } catch (e) { console.debug?.("[Majoor] Failed to refresh vector stats:", e); } } else throw Error(e?.error || O("toast.vectorBackfillFailedGeneric", "Backfill failed")); } catch (e) { - let n = e?.message || String(e || O("status.unknown", "unknown")); - E(O("toast.vectorBackfillFailedDetail", "Vector backfill failed: {error}", { error: n }), "error", void 0, { history: { - ...t.history, + let r = e?.message || String(e || O("status.unknown", "unknown")); + t(O("toast.vectorBackfillFailedDetail", "Vector backfill failed: {error}", { error: r }), "error", void 0, { history: { + ...n.history, status: "failed", - detail: n + detail: r } }), console.error("[Majoor] Vector backfill error:", e); } } @@ -2226,127 +2267,127 @@ function zn(e, n, r, i) { } //#endregion //#region ui/app/settings/settingsSearch.ts -var Bn = "Majoor", Vn = "Majoor Assets Manager"; -function Hn(e, t, n) { - let r = (e, t) => [ - Vn, +var Hn = "Majoor", Un = "Majoor Assets Manager"; +function Wn(e, n, r) { + let i = (e, t) => [ + Un, e, t ]; e({ - id: `${Bn}.AI.VectorSearchEnabled`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorSearchEnabled`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.enabled.name", "Enable AI semantic search"), tooltip: O("setting.ai.vector.enabled.desc", "Enable/disable AI vector search features (SigLIP2/X-CLIP: description search, prompt alignment, AI tag suggestions, smart collections)."), type: "boolean", - defaultValue: !!(t.ai?.vectorSearchEnabled ?? !0), + defaultValue: !!(n.ai?.vectorSearchEnabled ?? !0), onChange: async (e) => { - t.ai = t.ai || {}; - let r = !!(t.ai.vectorSearchEnabled ?? !0), i = !!e; - t.ai.vectorSearchEnabled = i, G(t), K(t), n("ai.vectorSearchEnabled"); + n.ai = n.ai || {}; + let i = !!(n.ai.vectorSearchEnabled ?? !0), a = !!e; + n.ai.vectorSearchEnabled = a, G(n), K(n), r("ai.vectorSearchEnabled"); try { - let e = await m(i); + let e = await d(a); if (!e?.ok) { - t.ai.vectorSearchEnabled = r, G(t), K(t), n("ai.vectorSearchEnabled"), E(e?.error || "Failed to update AI vector search setting", "error"); + n.ai.vectorSearchEnabled = i, G(n), K(n), r("ai.vectorSearchEnabled"), t(e?.error || "Failed to update AI vector search setting", "error"); return; } - E(i ? "AI semantic search enabled" : "AI semantic search disabled", "info", 2200); + t(a ? "AI semantic search enabled" : "AI semantic search disabled", "info", 2200); } catch (e) { - t.ai.vectorSearchEnabled = r, G(t), K(t), n("ai.vectorSearchEnabled"), E(e?.message || "Failed to update AI vector search setting", "error"); + n.ai.vectorSearchEnabled = i, G(n), K(n), r("ai.vectorSearchEnabled"), t(e?.message || "Failed to update AI vector search setting", "error"); } } }), e({ - id: `${Bn}.AI.VectorCaptionOnIndex`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorCaptionOnIndex`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.captionOnIndex.name", "Generate AI captions during indexing"), tooltip: O("setting.ai.vector.captionOnIndex.desc", "Allow automatic vector indexing and backfill to run Florence-2 captions for image assets. This is slower and can use significant VRAM/CPU; leave it off for faster grid startup."), type: "boolean", - defaultValue: !!(t.ai?.vectorCaptionOnIndex ?? !1), + defaultValue: !!(n.ai?.vectorCaptionOnIndex ?? !1), onChange: async (e) => { - t.ai = t.ai || {}; - let r = !!(t.ai.vectorCaptionOnIndex ?? !1), i = !!e; - t.ai.vectorCaptionOnIndex = i, G(t), K(t), n("ai.vectorCaptionOnIndex"); + n.ai = n.ai || {}; + let i = !!(n.ai.vectorCaptionOnIndex ?? !1), a = !!e; + n.ai.vectorCaptionOnIndex = a, G(n), K(n), r("ai.vectorCaptionOnIndex"); try { - let e = await m({ caption_on_index: i }); + let e = await d({ caption_on_index: a }); if (!e?.ok) { - t.ai.vectorCaptionOnIndex = r, G(t), K(t), n("ai.vectorCaptionOnIndex"), E(e?.error || "Failed to update AI caption indexing setting", "error"); + n.ai.vectorCaptionOnIndex = i, G(n), K(n), r("ai.vectorCaptionOnIndex"), t(e?.error || "Failed to update AI caption indexing setting", "error"); return; } - i && E("AI captions during indexing enabled", "info", 2600); + a && t("AI captions during indexing enabled", "info", 2600); } catch (e) { - t.ai.vectorCaptionOnIndex = r, G(t), K(t), n("ai.vectorCaptionOnIndex"), E(e?.message || "Failed to update AI caption indexing setting", "error"); + n.ai.vectorCaptionOnIndex = i, G(n), K(n), r("ai.vectorCaptionOnIndex"), t(e?.message || "Failed to update AI caption indexing setting", "error"); } } }), e({ - id: `${Bn}.AI.VectorIndexOnScan`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorIndexOnScan`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.indexOnScan.name", "Index vectors during scans"), tooltip: O("setting.ai.vector.indexOnScan.desc", "Compute SigLIP/X-CLIP embeddings while assets are scanned. Disable to avoid surprise VRAM use; run vector backfill manually when needed."), type: "boolean", - defaultValue: !!(t.ai?.vectorIndexOnScan ?? !1), + defaultValue: !!(n.ai?.vectorIndexOnScan ?? !1), onChange: async (e) => { - t.ai = t.ai || {}; - let r = !!(t.ai.vectorIndexOnScan ?? !1), i = !!e; - t.ai.vectorIndexOnScan = i, G(t), K(t), n("ai.vectorIndexOnScan"); + n.ai = n.ai || {}; + let i = !!(n.ai.vectorIndexOnScan ?? !1), a = !!e; + n.ai.vectorIndexOnScan = a, G(n), K(n), r("ai.vectorIndexOnScan"); try { - let e = await m({ index_on_scan: i }); + let e = await d({ index_on_scan: a }); if (!e?.ok) { - t.ai.vectorIndexOnScan = r, G(t), K(t), n("ai.vectorIndexOnScan"), E(e?.error || "Failed to update vector scan indexing", "error"); + n.ai.vectorIndexOnScan = i, G(n), K(n), r("ai.vectorIndexOnScan"), t(e?.error || "Failed to update vector scan indexing", "error"); return; } - E(i ? "Vector indexing during scans enabled" : "Vector indexing during scans disabled", "info", 2400); + t(a ? "Vector indexing during scans enabled" : "Vector indexing during scans disabled", "info", 2400); } catch (e) { - t.ai.vectorIndexOnScan = r, G(t), K(t), n("ai.vectorIndexOnScan"), E(e?.message || "Failed to update vector scan indexing", "error"); + n.ai.vectorIndexOnScan = i, G(n), K(n), r("ai.vectorIndexOnScan"), t(e?.message || "Failed to update vector scan indexing", "error"); } } }), e({ - id: `${Bn}.AI.VectorConcurrency`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorConcurrency`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.concurrency.name", "Vector indexing concurrency"), tooltip: O("setting.ai.vector.concurrency.desc", "Maximum concurrent vector embedding workers. Use 1 to minimize transient VRAM spikes."), type: "number", - defaultValue: Number(t.ai?.vectorConcurrency || 1), + defaultValue: Number(n.ai?.vectorConcurrency || 1), attrs: { min: 1, max: 16, step: 1 }, onChange: async (e) => { - t.ai = t.ai || {}; - let r = Number(t.ai.vectorConcurrency || 1), i = Math.max(1, Math.min(16, Math.floor(Number(e) || 1))); - t.ai.vectorConcurrency = i, G(t), K(t), n("ai.vectorConcurrency"); + n.ai = n.ai || {}; + let i = Number(n.ai.vectorConcurrency || 1), a = Math.max(1, Math.min(16, Math.floor(Number(e) || 1))); + n.ai.vectorConcurrency = a, G(n), K(n), r("ai.vectorConcurrency"); try { - let e = await m({ concurrency: i }); - e?.ok || (t.ai.vectorConcurrency = r, G(t), K(t), n("ai.vectorConcurrency"), E(e?.error || "Failed to update vector concurrency", "error")); + let e = await d({ concurrency: a }); + e?.ok || (n.ai.vectorConcurrency = i, G(n), K(n), r("ai.vectorConcurrency"), t(e?.error || "Failed to update vector concurrency", "error")); } catch (e) { - t.ai.vectorConcurrency = r, G(t), K(t), n("ai.vectorConcurrency"), E(e?.message || "Failed to update vector concurrency", "error"); + n.ai.vectorConcurrency = i, G(n), K(n), r("ai.vectorConcurrency"), t(e?.message || "Failed to update vector concurrency", "error"); } } }), e({ - id: `${Bn}.AI.VectorUnloadAfterUse`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorUnloadAfterUse`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.unloadAfterUse.name", "Unload AI models after use"), tooltip: O("setting.ai.vector.unloadAfterUse.desc", "Unload Majoor SigLIP/X-CLIP/Florence models after heavy AI actions and call torch CUDA cache cleanup. This frees VRAM but makes the next AI action slower."), type: "boolean", - defaultValue: !!(t.ai?.vectorUnloadAfterUse ?? !1), + defaultValue: !!(n.ai?.vectorUnloadAfterUse ?? !1), onChange: async (e) => { - t.ai = t.ai || {}; - let r = !!(t.ai.vectorUnloadAfterUse ?? !1), i = !!e; - t.ai.vectorUnloadAfterUse = i, G(t), K(t), n("ai.vectorUnloadAfterUse"); + n.ai = n.ai || {}; + let i = !!(n.ai.vectorUnloadAfterUse ?? !1), a = !!e; + n.ai.vectorUnloadAfterUse = a, G(n), K(n), r("ai.vectorUnloadAfterUse"); try { - let e = await m({ unload_after_use: i }); + let e = await d({ unload_after_use: a }); if (!e?.ok) { - t.ai.vectorUnloadAfterUse = r, G(t), K(t), n("ai.vectorUnloadAfterUse"), E(e?.error || "Failed to update model unload setting", "error"); + n.ai.vectorUnloadAfterUse = i, G(n), K(n), r("ai.vectorUnloadAfterUse"), t(e?.error || "Failed to update model unload setting", "error"); return; } - E(i ? "AI model unload after use enabled" : "AI model unload after use disabled", "info", 2400); + t(a ? "AI model unload after use enabled" : "AI model unload after use disabled", "info", 2400); } catch (e) { - t.ai.vectorUnloadAfterUse = r, G(t), K(t), n("ai.vectorUnloadAfterUse"), E(e?.message || "Failed to update model unload setting", "error"); + n.ai.vectorUnloadAfterUse = i, G(n), K(n), r("ai.vectorUnloadAfterUse"), t(e?.message || "Failed to update model unload setting", "error"); } } }), e({ - id: `${Bn}.AI.VectorUnloadNow`, - category: r(O("cat.search", "Search"), "AI"), + id: `${Hn}.AI.VectorUnloadNow`, + category: i(O("cat.search", "Search"), "AI"), name: O("setting.ai.vector.unloadNow.name", "Memory purge now"), tooltip: O("setting.ai.vector.unloadNow.desc", "Immediately unload Majoor AI vector/caption models, ask ComfyUI to unload loaded models, and clear torch CUDA cache when idle."), type: "combo", @@ -2354,30 +2395,30 @@ function Hn(e, t, n) { defaultValue: "Idle", onChange: async (e) => { if (String(e || "") === "Unload now") try { - let e = await Te(); - E(e?.ok ? "Majoor AI model cache unloaded" : e?.error || "Failed to unload Majoor AI model cache", e?.ok ? "info" : "error", 2600); + let e = await E(); + t(e?.ok ? "Majoor AI model cache unloaded" : e?.error || "Failed to unload Majoor AI model cache", e?.ok ? "info" : "error", 2600); } catch (e) { - E(e?.message || "Failed to unload Majoor AI model cache", "error"); + t(e?.message || "Failed to unload Majoor AI model cache", "error"); } } }), e({ - id: `${Bn}.Search.MaxResults`, - category: r(O("cat.search", "Search")), + id: `${Hn}.Search.MaxResults`, + category: i(O("cat.search", "Search")), name: O("setting.search.maxResults.name", "Max search results (client)"), tooltip: O("setting.search.maxResults.desc", "Maximum number of results requested per search. The backend still enforces MAJOOR_SEARCH_MAX_LIMIT; increase that env var if you need a higher hard cap."), type: "number", - defaultValue: Number(t.search?.maxResults || A.SEARCH_DEFAULT_LIMIT), + defaultValue: Number(n.search?.maxResults || A.SEARCH_DEFAULT_LIMIT), attrs: { min: 10, max: A.MAX_PAGE_SIZE || 2e3, step: 1 }, onChange: (e) => { - t.search = t.search || {}, t.search.maxResults = Math.max(10, Math.min(A.MAX_PAGE_SIZE || 2e3, Number(e) || A.SEARCH_DEFAULT_LIMIT)), G(t), K(t), n("search.maxResults"); + n.search = n.search || {}, n.search.maxResults = Math.max(10, Math.min(A.MAX_PAGE_SIZE || 2e3, Number(e) || A.SEARCH_DEFAULT_LIMIT)), G(n), K(n), r("search.maxResults"); } }), e({ - id: `${Bn}.EnvVars.Reference`, - category: r(O("cat.advanced"), "Environment variables"), + id: `${Hn}.EnvVars.Reference`, + category: i(O("cat.advanced"), "Environment variables"), name: "Environment variables reference", tooltip: [ "Set these env vars before starting ComfyUI to override defaults:", @@ -2412,7 +2453,7 @@ function Hn(e, t, n) { } //#endregion //#region ui/app/settings/SettingsPanel.ts -var Un = "Majoor Assets Manager", Wn = /^\s*Majoor:\s*/i, Gn = Object.freeze({ +var Gn = "Majoor Assets Manager", Kn = /^\s*Majoor:\s*/i, qn = Object.freeze({ ASSETS_PANEL: "Assets Panel", GENERATED_FEED: "Generated Feed", VIEWER: "Viewer & Floating Viewer", @@ -2421,7 +2462,7 @@ var Un = "Majoor Assets Manager", Wn = /^\s*Majoor:\s*/i, Gn = Object.freeze({ GENERAL: "General", ADVANCED: "Advanced", SECURITY: "Security" -}), Kn = /* @__PURE__ */ new Set([ +}), Jn = /* @__PURE__ */ new Set([ "grid.starColor", "grid.badgeImageColor", "grid.badgeVideoColor", @@ -2432,70 +2473,70 @@ var Un = "Majoor Assets Manager", Wn = /^\s*Majoor:\s*/i, Gn = Object.freeze({ "ui.cardSelectionColor", "ui.ratingColor", "ui.tagColor" -]), qn = "Majoor.General.ResetAllSettings", Jn = "mjr-settings-reset-btn", Yn = null, Xn = null; -function Zn(e) { +]), Yn = "Majoor.General.ResetAllSettings", Xn = "mjr-settings-reset-btn", Zn = null, Qn = null; +function $n(e) { let t = String(e || "").trim(); - return !t || t === qn || t === "Majoor.Language" ? Gn.GENERAL : /^Majoor\.(Safety|Security)\./.test(t) ? Gn.SECURITY : /^Majoor\.(Paths|Db|ProbeBackend|MetadataFallback|Observability)\./.test(t) || t === "Majoor.EnvVars.Reference" ? Gn.ADVANCED : /^Majoor\.(Viewer|WorkflowMinimap)\./.test(t) ? Gn.VIEWER : /^Majoor\.Feed\./.test(t) ? Gn.GENERATED_FEED : /^Majoor\.(AutoScan|Scan|Watcher|ExecutionGrouping|RatingTagsSync)\./.test(t) || t === "Majoor.RtHydrate.Concurrency" ? Gn.INDEXING : /^Majoor\.AI\.(HuggingFaceTokenVisible|HuggingFaceToken|VerboseLogs|VectorStats|VectorBackfillAction|VectorSearchEnabled|VectorCaptionOnIndex|VectorIndexOnScan|VectorConcurrency|VectorUnloadAfterUse|VectorUnloadNow)$/.test(t) || /^Majoor\.Search\./.test(t) ? Gn.SEARCH_AI : /^Majoor\.(Grid|Cards|Badges|Sidebar|InfiniteScroll|General)\./.test(t) ? Gn.ASSETS_PANEL : Gn.GENERAL; + return !t || t === Yn || t === "Majoor.Language" ? qn.GENERAL : /^Majoor\.(Safety|Security)\./.test(t) ? qn.SECURITY : /^Majoor\.(Paths|Db|ProbeBackend|MetadataFallback|Observability)\./.test(t) || t === "Majoor.EnvVars.Reference" ? qn.ADVANCED : /^Majoor\.(Viewer|WorkflowMinimap)\./.test(t) ? qn.VIEWER : /^Majoor\.Feed\./.test(t) ? qn.GENERATED_FEED : /^Majoor\.(AutoScan|Scan|Watcher|ExecutionGrouping|RatingTagsSync)\./.test(t) || t === "Majoor.RtHydrate.Concurrency" ? qn.INDEXING : /^Majoor\.AI\.(HuggingFaceTokenVisible|HuggingFaceToken|VerboseLogs|VectorStats|VectorBackfillAction|VectorSearchEnabled|VectorCaptionOnIndex|VectorIndexOnScan|VectorConcurrency|VectorUnloadAfterUse|VectorUnloadNow)$/.test(t) || /^Majoor\.Search\./.test(t) ? qn.SEARCH_AI : /^Majoor\.(Grid|Cards|Badges|Sidebar|InfiniteScroll|General)\./.test(t) ? qn.ASSETS_PANEL : qn.GENERAL; } -function Qn(e) { - let t = Array.isArray(e?.category) ? e.category.filter(Boolean) : [], n = Zn(e?.id), r = String(t[1] || t[0] || "").trim(), i = String(t[2] || "").trim(), a = String(e?.name || "").replace(Wn, "").trim(); +function er(e) { + let t = Array.isArray(e?.category) ? e.category.filter(Boolean) : [], n = $n(e?.id), r = String(t[1] || t[0] || "").trim(), i = String(t[2] || "").trim(), a = String(e?.name || "").replace(Kn, "").trim(); return [ - Un, + Gn, n, i || r || a || n ]; } -var $n = !1, er = null, tr = null, nr = !1, rr = /* @__PURE__ */ new Set(); -function ir(e) { +var tr = !1, nr = null, rr = null, ir = !1, ar = /* @__PURE__ */ new Set(); +function or(e) { if (!e || typeof e != "object") return null; let t = { ...e }; try { - typeof t.name == "string" && (t.name = t.name.replace(Wn, "").trim()); + typeof t.name == "string" && (t.name = t.name.replace(Kn, "").trim()); } catch (e) { console.debug?.(e); } try { - t.category = Qn(t); + t.category = er(t); } catch { - t.category = [Un, Gn.GENERAL]; + t.category = [Gn, qn.GENERAL]; } return !t.tooltip && typeof t.name == "string" && t.name.trim() && (t.tooltip = t.name.trim()), t; } -function ar(e, t, n) { +function sr(e, t, n) { let r = String(t?.id || "").trim(); - if (!r || rr.has(r)) return !1; - rr.add(r); + if (!r || ar.has(r)) return !1; + ar.add(r); try { - return De(e, r, n); + return ke(e, r, n); } finally { - rr.delete(r); + ar.delete(r); } } -function or(e, t) { +function cr(e, t) { if (!t || typeof t != "object") return t; let n = { ...t }; - ar(e, n, n.defaultValue); + sr(e, n, n.defaultValue); let r = n.onChange; return n.onChange = (t, ...i) => { - if (ar(e, n, t), typeof r == "function") return r(t, ...i); + if (sr(e, n, t), typeof r == "function") return r(t, ...i); n.defaultValue = t; }, n; } -function sr(e) { +function lr(e) { try { return JSON.parse(JSON.stringify(e || {})); } catch { return { ...W }; } } -function cr(e, t, n, { wrapForComfy: r = !0 } = {}) { +function ur(e, t, n, { wrapForComfy: r = !0 } = {}) { let i = [], a = (e) => { - let n = ir(e); - n && i.push(r ? or(t, n) : n); + let n = or(e); + n && i.push(r ? cr(t, n) : n); }; - return ln(a, e, n), vn(a, e, n), fn(a, e, n), hn(a, e, n), Ln(a, e, n), zn(a, e, n, t), Hn(a, e, n), i; + return dn(a, e, n), bn(a, e, n), mn(a, e, n), _n(a, e, n), zn(a, e, n), Vn(a, e, n, t), Wn(a, e, n), i; } -function lr(e, t) { +function dr(e, t) { if (e === t) return !0; try { return JSON.stringify(e) === JSON.stringify(t); @@ -2503,97 +2544,97 @@ function lr(e, t) { return !1; } } -function ur(e) { +function fr(e) { return e ? e.querySelector(".form-input") || e.querySelector(".p-inputgroup") || e.querySelector(".setting-input") || e.querySelector("[class*='input']") : null; } -function dr(e, t) { +function pr(e, t) { let n = document.createElement("button"); - return n.type = "button", n.className = Jn, n.textContent = e, n.title = t, n.style.marginLeft = "8px", n.style.minWidth = e.length > 2 ? "auto" : "24px", n.style.height = "24px", n.style.padding = e.length > 2 ? "0 10px" : "0", n.style.borderRadius = "6px", n.style.border = "1px solid var(--border-color, #555)", n.style.background = "var(--comfy-input-bg, #2b2b2b)", n.style.color = "var(--input-text, inherit)", n.style.cursor = "pointer", n.style.fontSize = "12px", n.style.lineHeight = "22px", n.style.flexShrink = "0", n; + return n.type = "button", n.className = Xn, n.textContent = e, n.title = t, n.style.marginLeft = "8px", n.style.minWidth = e.length > 2 ? "auto" : "24px", n.style.height = "24px", n.style.padding = e.length > 2 ? "0 10px" : "0", n.style.borderRadius = "6px", n.style.border = "1px solid var(--border-color, #555)", n.style.background = "var(--comfy-input-bg, #2b2b2b)", n.style.color = "var(--input-text, inherit)", n.style.cursor = "pointer", n.style.fontSize = "12px", n.style.lineHeight = "22px", n.style.flexShrink = "0", n; } -function fr(e, t, n) { - String(e?.id || "").trim() && (ar(n, e, t), typeof e?.onChange == "function" && e.onChange(t)); +function mr(e, t, n) { + String(e?.id || "").trim() && (sr(n, e, t), typeof e?.onChange == "function" && e.onChange(t)); } -function pr(e, t, n, r) { - let i = !lr(Oe(r, t.id, t.defaultValue), n); +function hr(e, t, n, r) { + let i = !dr(Ae(r, t.id, t.defaultValue), n); e.disabled = !i, e.style.opacity = i ? "1" : "0.45"; } -function mr() { - if (typeof document > "u" || !Xn) return; - let { app: e, definitions: t, defaultValues: n } = Xn, r = document.querySelector(`[data-setting-id="${qn}"]`), i = ur(r); +function gr() { + if (typeof document > "u" || !Qn) return; + let { app: e, definitions: t, defaultValues: n } = Qn, r = document.querySelector(`[data-setting-id="${Yn}"]`), i = fr(r); if (r && i && !r.getAttribute("data-mjr-reset-injected")) { r.setAttribute("data-mjr-reset-injected", "true"), i.innerHTML = ""; - let a = dr("Reset all settings", "Reset all Majoor settings to defaults"); + let a = pr("Reset all settings", "Reset all Majoor settings to defaults"); a.onclick = (r) => { r.preventDefault(), r.stopPropagation(); - for (let r of t) r.id !== qn && n.has(r.id) && fr(r, n.get(r.id), e); - mr(); + for (let r of t) r.id !== Yn && n.has(r.id) && mr(r, n.get(r.id), e); + gr(); }, i.appendChild(a); } for (let r of t) { - if (!r?.id || r.id === qn || !n.has(r.id)) continue; + if (!r?.id || r.id === Yn || !n.has(r.id)) continue; let t = document.querySelector(`[data-setting-id="${r.id}"]`); if (!t || t.getAttribute("data-mjr-reset-injected")) continue; - let i = ur(t); + let i = fr(t); if (!i) continue; t.setAttribute("data-mjr-reset-injected", "true"); - let a = dr("Reset", "Reset this setting to default"); - pr(a, r, n.get(r.id), e), a.onclick = (t) => { + let a = pr("Reset", "Reset this setting to default"); + hr(a, r, n.get(r.id), e), a.onclick = (t) => { t.preventDefault(), t.stopPropagation(); let i = n.get(r.id); - fr(r, i, e), pr(a, r, i, e); + mr(r, i, e), hr(a, r, i, e); }, i.appendChild(a); } } -function hr(e, t, n) { - typeof document > "u" || typeof MutationObserver > "u" || (Xn = { +function _r(e, t, n) { + typeof document < "u" && typeof MutationObserver < "u" && (Qn = { app: e, definitions: t, - defaultValues: new Map(n.filter((e) => e?.id && e.id !== qn).map((e) => [e.id, e.defaultValue])) - }, mr(), !Yn && (Yn = new MutationObserver(() => mr()), Yn.observe(document.body, { + defaultValues: new Map(n.filter((e) => e?.id && e.id !== Yn).map((e) => [e.id, e.defaultValue])) + }, gr(), !Zn && (Zn = new MutationObserver(() => gr()), Zn.observe(document.body, { childList: !0, subtree: !0 }))); } -function gr(e, t, { initRuntime: n = !1 } = {}) { - if (tr) typeof t == "function" && tr.onAppliedListeners.add(t), e && !tr.app && (tr.app = e); +function vr(e, t, { initRuntime: n = !1 } = {}) { + if (rr) typeof t == "function" && rr.onAppliedListeners.add(t), e && !rr.app && (rr.app = e); else { - let n = Gt(); - n.i18n = n.i18n || {}, typeof n.i18n.followComfyLanguage == "boolean" ? je(!!n.i18n.followComfyLanguage) : (n.i18n.followComfyLanguage = !0, je(!0), G(n)); + let n = qt(); + n.i18n = n.i18n || {}, typeof n.i18n.followComfyLanguage == "boolean" ? Ne(!!n.i18n.followComfyLanguage) : (n.i18n.followComfyLanguage = !0, Ne(!0), G(n)); let r = /* @__PURE__ */ new Set(); typeof t == "function" && r.add(t); let i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), o = () => { if (!i.size) return; let e = Array.from(i); i.clear(); - for (let t of e) Ge("mjr-settings-changed", { key: t }, { warnPrefix: "[Majoor]" }); + for (let t of e) qe("mjr-settings-changed", { key: t }, { warnPrefix: "[Majoor]" }); }, s = () => { if (!a.size) return; let e = Array.from(a); a.clear(); - for (let t of e) Ge("mjr-settings-changed", { key: t }, { warnPrefix: "[Majoor]" }); - }, c = sn(o, 120), l = sn(s, 450), u = (e) => { + for (let t of e) qe("mjr-settings-changed", { key: t }, { warnPrefix: "[Majoor]" }); + }, c = ln(o, 120), l = ln(s, 450), u = (e) => { typeof e == "string" && i.add(e), c(); }, d = (e) => { typeof e == "string" && a.add(e), l(); }, f = () => { - let e = Gt(); + let e = qt(); Object.assign(n, e), K(n), u("storage"); }, p = (e) => { - !e || e.key !== "mjrSettings" || e.newValue !== e.oldValue && f(); + e && e.key === "mjrSettings" && e.newValue !== e.oldValue && f(); }; - if (!$n) { - if (er && typeof window < "u") try { - window.removeEventListener("storage", er); + if (!tr) { + if (nr && typeof window < "u") try { + window.removeEventListener("storage", nr); } catch (e) { console.debug?.(e); } try { - window.addEventListener("storage", p), $n = !0, er = p; + window.addEventListener("storage", p), tr = !0, nr = p; } catch (e) { console.debug?.(e); } } - tr = { + rr = { app: e, notifyApplied: (e) => { for (let t of r) try { @@ -2601,48 +2642,48 @@ function gr(e, t, { initRuntime: n = !1 } = {}) { } catch (e) { console.debug?.(e); } - Kn.has(String(e || "")) ? d(e) : u(e); + Jn.has(String(e || "")) ? d(e) : u(e); }, onAppliedListeners: r, refreshFromStorage: f, settings: n }; } - if (n && !nr) { - let t = e || tr.app, n = tr.settings; - ze(t), K(n), Ie(t), Kt(), qt(), Jt(), n?.watcher && typeof n.watcher.enabled == "boolean" && v(!!n.watcher.enabled).catch(() => {}), an(), nr = !0; + if (n && !ir) { + let t = e || rr.app, n = rr.settings; + Ve(t), K(n), Re(t), Jt(), Yt(), Xt(), n?.watcher && typeof n.watcher.enabled == "boolean" && r(!!n.watcher.enabled).catch(() => {}), sn(), ir = !0; } - return tr; + return rr; } -var _r = (e, t) => gr(e, t, { initRuntime: !0 }).settings, vr = (e, t) => { - let n = gr(e, t, { initRuntime: !1 }); - Object.assign(n.settings, Gt()); - let r = e || n.app, i = cr(n.settings, r, n.notifyApplied), a = cr(sr(W), r, () => {}, { wrapForComfy: !1 }); - return i.unshift(or(r, { - id: qn, +var yr = (e, t) => vr(e, t, { initRuntime: !0 }).settings, br = (e, t) => { + let n = vr(e, t, { initRuntime: !1 }); + Object.assign(n.settings, qt()); + let r = e || n.app, i = ur(n.settings, r, n.notifyApplied), a = ur(lr(W), r, () => {}, { wrapForComfy: !1 }); + return i.unshift(cr(r, { + id: Yn, category: [ - Un, - Gn.GENERAL, + Gn, + qn.GENERAL, "Reset" ], name: "Reset all settings to defaults", tooltip: "Reset every Majoor Assets Manager setting to its default value.", type: "text", defaultValue: "" - })), hr(r, i, a), i; + })), _r(r, i, a), i; }; try { - let e = Gt(); - e?.watcher && typeof e.watcher.enabled == "boolean" && pe().then((e) => { - let t = !!e?.ok && !!e?.data?.enabled, n = Gt(); - n.watcher = n.watcher || {}, typeof t == "boolean" && t !== !!n.watcher.enabled && (n.watcher.enabled = t, G(n), Ge("mjr-settings-changed", { key: "watcher.enabled" }, { warnPrefix: "[Majoor]" })); + let e = qt(); + e?.watcher && typeof e.watcher.enabled == "boolean" && Te().then((e) => { + let t = !!e?.ok && !!e?.data?.enabled, n = qt(); + n.watcher = n.watcher || {}, typeof t == "boolean" && t !== !!n.watcher.enabled && (n.watcher.enabled = t, G(n), qe("mjr-settings-changed", { key: "watcher.enabled" }, { warnPrefix: "[Majoor]" })); }).catch(() => {}); } catch (e) { console.debug?.(e); } //#endregion //#region ui/features/contextmenu/gridContextMenuState.ts -function yr() { +function xr() { return { open: !1, x: 0, @@ -2651,11 +2692,11 @@ function yr() { title: "" }; } -var Y = vt({ +var Y = bt({ portalOwnerId: "", mountedPortalIds: [], - main: yr(), - submenu: yr(), + main: xr(), + submenu: xr(), tags: { open: !1, x: 0, @@ -2663,52 +2704,52 @@ var Y = vt({ asset: null, onChanged: null } -}), br = 1; -function xr(e) { +}), Sr = 1; +function Cr(e) { e && (e.open = !1, e.x = 0, e.y = 0, e.items = [], e.title = ""); } -function Sr(e = "") { +function wr(e = "") { try { window.dispatchEvent(new CustomEvent("mjr-close-all-menus", { detail: { source: String(e || "") } })); } catch (e) { console.debug?.(e); } } -function Cr() { - let e = `mjr-grid-context-menu-portal-${br++}`; +function Tr() { + let e = `mjr-grid-context-menu-portal-${Sr++}`; return Y.mountedPortalIds.push(e), Y.portalOwnerId ||= e, e; } -function wr(e) { +function Er(e) { let t = Y.mountedPortalIds.filter((t) => t !== e); Y.mountedPortalIds.splice(0, Y.mountedPortalIds.length, ...t), Y.portalOwnerId === e && (Y.portalOwnerId = Y.mountedPortalIds[0] || ""); } -function Tr(e) { +function Dr(e) { return String(Y.portalOwnerId || "") === String(e || ""); } -function Er({ x: e = 0, y: t = 0, items: n = [], title: r = "" } = {}) { - Sr("grid"), jr(), kr(), Y.main.open = !0, Y.main.x = Number(e) || 0, Y.main.y = Number(t) || 0, Y.main.items = Array.isArray(n) ? n.filter(Boolean) : [], Y.main.title = String(r || ""); -} -function Dr() { - xr(Y.main), kr(); -} function Or({ x: e = 0, y: t = 0, items: n = [], title: r = "" } = {}) { - Y.submenu.open = !0, Y.submenu.x = Number(e) || 0, Y.submenu.y = Number(t) || 0, Y.submenu.items = Array.isArray(n) ? n.filter(Boolean) : [], Y.submenu.title = String(r || ""); + wr("grid"), Nr(), jr(), Y.main.open = !0, Y.main.x = Number(e) || 0, Y.main.y = Number(t) || 0, Y.main.items = Array.isArray(n) ? n.filter(Boolean) : [], Y.main.title = String(r || ""); } function kr() { - xr(Y.submenu); + Cr(Y.main), jr(); } -function Ar({ x: e = 0, y: t = 0, asset: n = null, onChanged: r = null } = {}) { - Dr(), Y.tags.open = !!n, Y.tags.x = Number(e) || 0, Y.tags.y = Number(t) || 0, Y.tags.asset = n || null, Y.tags.onChanged = typeof r == "function" ? r : null; +function Ar({ x: e = 0, y: t = 0, items: n = [], title: r = "" } = {}) { + Y.submenu.open = !0, Y.submenu.x = Number(e) || 0, Y.submenu.y = Number(t) || 0, Y.submenu.items = Array.isArray(n) ? n.filter(Boolean) : [], Y.submenu.title = String(r || ""); } function jr() { + Cr(Y.submenu); +} +function Mr({ x: e = 0, y: t = 0, asset: n = null, onChanged: r = null } = {}) { + kr(), Y.tags.open = !!n, Y.tags.x = Number(e) || 0, Y.tags.y = Number(t) || 0, Y.tags.asset = n || null, Y.tags.onChanged = typeof r == "function" ? r : null; +} +function Nr() { Y.tags.open = !1, Y.tags.x = 0, Y.tags.y = 0, Y.tags.asset = null, Y.tags.onChanged = null; } -function Mr() { - Dr(), jr(); +function Pr() { + kr(), Nr(); } //#endregion //#region ui/features/dnd/utils/constants.ts -var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "application/x-comfy-asset-info", Ir = /* @__PURE__ */ new Set([ +var Fr = "application/x-mjr-asset", Ir = "application/x-mjr-assets", Lr = "application/x-comfy-asset-info", Rr = /* @__PURE__ */ new Set([ ".png", ".jpg", ".jpeg", @@ -2719,14 +2760,14 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli ".tiff", ".avif", ".jxl" -]), Lr = /* @__PURE__ */ new Set([ +]), zr = /* @__PURE__ */ new Set([ ".mp4", ".mov", ".mkv", ".webm", ".avi", ".m4v" -]), Rr = /* @__PURE__ */ new Set([ +]), Br = /* @__PURE__ */ new Set([ ".wav", ".mp3", ".flac", @@ -2734,7 +2775,7 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli ".m4a", ".aac", ".opus" -]), zr = /* @__PURE__ */ new Set([ +]), Vr = /* @__PURE__ */ new Set([ ".obj", ".fbx", ".glb", @@ -2744,23 +2785,23 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli ".splat", ".ksplat", ".spz" -]), Br = (e) => { - if (!e) return !1; - let t = e.lastIndexOf("."); - return t !== -1 && Ir.has(e.slice(t).toLowerCase()); -}, Vr = (e) => e ? String(e.kind || "").toLowerCase() === "image" || Br(e.filename) : !1, Hr = (e) => { - if (!e) return !1; - let t = e.lastIndexOf("."); - return t !== -1 && Lr.has(e.slice(t).toLowerCase()); -}, Ur = (e) => e ? String(e.kind || "").toLowerCase() === "video" || Hr(e.filename) : !1, Wr = (e) => { +]), Hr = (e) => { if (!e) return !1; let t = e.lastIndexOf("."); return t !== -1 && Rr.has(e.slice(t).toLowerCase()); -}, Gr = (e) => e ? String(e.kind || "").toLowerCase() === "audio" || Wr(e.filename) : !1, Kr = (e) => { +}, Ur = (e) => e ? String(e.kind || "").toLowerCase() === "image" || Hr(e.filename) : !1, Wr = (e) => { if (!e) return !1; let t = e.lastIndexOf("."); return t !== -1 && zr.has(e.slice(t).toLowerCase()); -}, qr = (e) => e ? String(e.kind || "").toLowerCase() === "model3d" || Kr(e.filename) : !1, Jr = (e) => Vr(e) || Ur(e) || Gr(e) || qr(e) || String(e?.kind || "").toLowerCase() === "workflow", Yr = { +}, Gr = (e) => e ? String(e.kind || "").toLowerCase() === "video" || Wr(e.filename) : !1, Kr = (e) => { + if (!e) return !1; + let t = e.lastIndexOf("."); + return t !== -1 && Br.has(e.slice(t).toLowerCase()); +}, qr = (e) => e ? String(e.kind || "").toLowerCase() === "audio" || Kr(e.filename) : !1, Jr = (e) => { + if (!e) return !1; + let t = e.lastIndexOf("."); + return t !== -1 && Vr.has(e.slice(t).toLowerCase()); +}, Yr = (e) => e ? String(e.kind || "").toLowerCase() === "model3d" || Jr(e.filename) : !1, Xr = (e) => Ur(e) || Gr(e) || qr(e) || Yr(e) || String(e?.kind || "").toLowerCase() === "workflow", Zr = { mp4: "video/mp4", mov: "video/quicktime", webm: "video/webm", @@ -2770,45 +2811,45 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli obj: "model/obj", stl: "model/stl", ply: "application/ply" -}, Xr = (e) => Yr[String(e || "").split(".").pop()?.toLowerCase()] ?? "application/octet-stream", Zr = (e, t) => { - if (typeof e != "string") return !1; - let n = e.trim().toLowerCase(); - if (!n) return !1; - let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); - return r ? t && r === String(t).toLowerCase() ? !0 : Lr.has(`.${r}`) : !1; -}, Qr = (e, t, n) => { - if (!e || e.type !== "combo" || !e.options) return !1; - let r = Array.isArray(e.options.values) && e.options.values || e.options.values && Array.isArray(e.options.values.values) && e.options.values.values || null; - return Array.isArray(r) ? r.some((e) => n(typeof e == "string" ? e : e?.content ?? e?.value ?? e?.text, t)) : !1; -}, $r = (e, t) => Qr(e, t, Zr), ei = (e, t) => { - if (typeof e != "string") return !1; - let n = e.trim().toLowerCase(); - if (!n) return !1; - let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); - return r ? t && r === String(t).toLowerCase() ? !0 : Ir.has(`.${r}`) : !1; -}, ti = (e, t) => Qr(e, t, ei), ni = (e, t) => { - if (typeof e != "string") return !1; - let n = e.trim().toLowerCase(); - if (!n) return !1; - let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); - return r ? t && r === String(t).toLowerCase() ? !0 : Rr.has(`.${r}`) : !1; -}, ri = (e, t) => Qr(e, t, ni), ii = (e, t) => { +}, Qr = (e) => Zr[String(e || "").split(".").pop()?.toLowerCase()] ?? "application/octet-stream", $r = (e, t) => { if (typeof e != "string") return !1; let n = e.trim().toLowerCase(); if (!n) return !1; let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); return r ? t && r === String(t).toLowerCase() ? !0 : zr.has(`.${r}`) : !1; -}, ai = (e, t) => Qr(e, t, ii), oi = /* @__PURE__ */ new WeakMap(), si = (e) => { +}, ei = (e, t, n) => { + if (!e || e.type !== "combo" || !e.options) return !1; + let r = Array.isArray(e.options.values) && e.options.values || e.options.values && Array.isArray(e.options.values.values) && e.options.values.values || null; + return Array.isArray(r) ? r.some((e) => n(typeof e == "string" ? e : e?.content ?? e?.value ?? e?.text, t)) : !1; +}, ti = (e, t) => ei(e, t, $r), ni = (e, t) => { + if (typeof e != "string") return !1; + let n = e.trim().toLowerCase(); + if (!n) return !1; + let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); + return r ? t && r === String(t).toLowerCase() ? !0 : Rr.has(`.${r}`) : !1; +}, ri = (e, t) => ei(e, t, ni), ii = (e, t) => { + if (typeof e != "string") return !1; + let n = e.trim().toLowerCase(); + if (!n) return !1; + let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); + return r ? t && r === String(t).toLowerCase() ? !0 : Br.has(`.${r}`) : !1; +}, ai = (e, t) => ei(e, t, ii), oi = (e, t) => { + if (typeof e != "string") return !1; + let n = e.trim().toLowerCase(); + if (!n) return !1; + let r = (n.split(/[?#]/)[0].split(".").pop() || "").toLowerCase(); + return r ? t && r === String(t).toLowerCase() ? !0 : Vr.has(`.${r}`) : !1; +}, si = (e, t) => ei(e, t, oi), ci = /* @__PURE__ */ new WeakMap(), li = (e) => { if (!e || typeof e != "object") return { node: null, prev: null }; - let t = oi.get(e); + let t = ci.get(e); return t || (t = { node: null, prev: null - }, oi.set(e, t)), t; -}, ci = (e, t, n) => { + }, ci.set(e, t)), t; +}, ui = (e, t, n) => { let r = e?.canvas?.canvas || document.querySelector("canvas"), i = e?.canvas?.graph, a = e?.canvas?.ds; if (!r || !i || !a) return null; let o = r.getBoundingClientRect(); @@ -2823,14 +2864,14 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli if (t.flags && t.flags.collapsed && (r = 30), d >= t.pos[0] && f >= t.pos[1] && d <= t.pos[0] + n && f <= t.pos[1] + r) return t; } return null; -}, li = (e, t, n) => { - let r = si(e); - !t || r.node === t || (ui(e, n), r.node = t, r.prev = { +}, di = (e, t, n) => { + let r = li(e); + t && r.node !== t && (fi(e, n), r.node = t, r.prev = { color: t.color, bgcolor: t.bgcolor }, t.bgcolor = "#3355ff", t.color = "#a9c4ff", n(e)); -}, ui = (e, t) => { - let n = si(e); +}, fi = (e, t) => { + let n = li(e); if (n.node) { try { n.prev && (n.node.color = n.prev.color, n.node.bgcolor = n.prev.bgcolor); @@ -2839,7 +2880,7 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli } n.node = null, n.prev = null, t(e); } -}, di = (e, t) => { +}, pi = (e, t) => { if (!e || e.type !== "combo" || !e.options) return; let n = e.options.values, r = e.options; if (typeof n != "function") { @@ -2853,7 +2894,7 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli value: t }), r.values = n); } -}, fi = /* @__PURE__ */ new Set([ +}, mi = /* @__PURE__ */ new Set([ "number", "int", "float", @@ -2862,34 +2903,34 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli "checkbox", "button", "hidden" -]), pi = [ +]), hi = [ "output", "save", "export", "folder", "dir" -], mi = ["file", "path"], hi = [ +], gi = ["file", "path"], _i = [ "path", "file", "input", "src", "source" -], gi = (e, t, n) => { +], vi = (e, t, n) => { let r = e?.widgets; if (!Array.isArray(r) || !r.length) return null; let i = String(t || "").toLowerCase().replace(/^\./, ""), a = String(e?.type || "").toLowerCase(), o = n.knownNodeIncludes.some((e) => a.includes(e)), s = []; for (let e of r) { if (!e) continue; let t = String(e?.type || "").toLowerCase(), r = e?.value; - if (fi.has(t) || typeof r == "number" || typeof r == "boolean") continue; + if (mi.has(t) || typeof r == "number" || typeof r == "boolean") continue; let a = t === "text" || t === "string" || t === "combo", c = typeof e?.callback == "function" && typeof r == "string"; if (!a && !c) continue; let l = String(e?.name || e?.label || "").toLowerCase().trim(), u = 0; n.exactNames.has(l) && (u += 100), l === "file" && o && t === "combo" && n.comboChecker(e, i) && (u += 100); - let d = n.mediaTerms.some((e) => l.includes(e)), f = hi.some((e) => l.includes(e)); - d && f && (u += 80), mi.some((e) => l.includes(e)) && (u += 35); + let d = n.mediaTerms.some((e) => l.includes(e)), f = _i.some((e) => l.includes(e)); + d && f && (u += 80), gi.some((e) => l.includes(e)) && (u += 35); for (let { terms: e, score: t } of n.extraTerms) e.some((e) => l.includes(e)) && (u += t); - pi.some((e) => l.includes(e)) && (u -= 90), n.exactSingleNames.has(l) && (typeof r == "string" && r.trim() === "" || n.looksLikeFn(r, i) ? u += 25 : u -= 10), o && (u += 15); + hi.some((e) => l.includes(e)) && (u -= 90), n.exactSingleNames.has(l) && (typeof r == "string" && r.trim() === "" || n.looksLikeFn(r, i) ? u += 25 : u -= 10), o && (u += 15); let p = typeof r == "string" && r.trim() === ""; p && (u += 3), t === "combo" && n.comboChecker(e, i) && (u += 12), s.push({ w: e, @@ -2908,7 +2949,7 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli console.debug?.(e); } return c.w; -}, _i = { +}, yi = { exactNames: /* @__PURE__ */ new Set([ "video_path", "input_video", @@ -2951,10 +2992,10 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli score: 45 }], exactSingleNames: /* @__PURE__ */ new Set(["video"]), - looksLikeFn: Zr, - comboChecker: $r, + looksLikeFn: $r, + comboChecker: ti, scoreKey: "__mjrVideoPickScore" -}, vi = { +}, bi = { exactNames: /* @__PURE__ */ new Set([ "image", "image_path", @@ -3009,10 +3050,10 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli score: 35 }], exactSingleNames: /* @__PURE__ */ new Set(["image", "face"]), - looksLikeFn: ei, - comboChecker: ti, + looksLikeFn: ni, + comboChecker: ri, scoreKey: "__mjrImagePickScore" -}, yi = { +}, xi = { exactNames: /* @__PURE__ */ new Set([ "audio_path", "input_audio", @@ -3060,10 +3101,10 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli score: 45 }], exactSingleNames: /* @__PURE__ */ new Set(["audio", "voice"]), - looksLikeFn: ni, - comboChecker: ri, + looksLikeFn: ii, + comboChecker: ai, scoreKey: "__mjrAudioPickScore" -}, bi = { +}, Si = { exactNames: /* @__PURE__ */ new Set([ "model_path", "input_model", @@ -3122,13 +3163,13 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli "mesh", "geometry" ]), - looksLikeFn: ii, - comboChecker: ai, + looksLikeFn: oi, + comboChecker: si, scoreKey: "__mjrModel3DPickScore" -}, xi = (e, t, n) => { +}, Ci = (e, t, n) => { let r = String(t?.kind || "").toLowerCase(); - return gi(e, n, r === "model3d" ? bi : r === "audio" ? yi : r === "image" ? vi : _i); -}, Si = (e, t, n, r) => { + return vi(e, n, r === "model3d" ? Si : r === "audio" ? xi : r === "image" ? bi : yi); +}, wi = (e, t, n, r) => { if (!t || !t.inputs || !t.inputs.length) return null; let i = e?.canvas?.canvas || document.querySelector("canvas"), a = e?.canvas?.ds; if (!i || !a) return null; @@ -3141,15 +3182,15 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli }; } return null; -}, Ci = (e) => { +}, Ti = (e) => { let t = e?.canvas?.canvas || document.querySelector("canvas"); return t ? t.getBoundingClientRect() : null; -}, wi = (e, t) => { - let n = Ci(e); +}, Ei = (e, t) => { + let n = Ti(e); if (!n) return !1; let r = t.clientX, i = t.clientY; return r >= n.left && r <= n.right && i >= n.top && i <= n.bottom; -}, Ti = (e) => { +}, Di = (e) => { try { e?.graph?.setDirtyCanvas?.(!0, !0); } catch (e) { @@ -3160,21 +3201,21 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli } catch (e) { console.debug?.(e); } -}, Ei = (e) => { +}, Oi = (e) => { let t = String(e?.filename || ""), n = t.lastIndexOf("."); return n >= 0 ? t.slice(n).toLowerCase() : ""; -}, Di = (e) => { - let t = String(e?.kind || "").toLowerCase(), n = Ei(e); - return t === "image" || Ir.has(n) ? ["LoadImage"] : t === "video" || Lr.has(n) ? [ +}, ki = (e) => { + let t = String(e?.kind || "").toLowerCase(), n = Oi(e); + return t === "image" || Rr.has(n) ? ["LoadImage"] : t === "video" || zr.has(n) ? [ "LoadVideo", "VHS_LoadVideo", "VideoLoader" - ] : t === "audio" || Rr.has(n) ? [ + ] : t === "audio" || Br.has(n) ? [ "LoadAudio", "VHS_LoadAudioUpload", "VHS_LoadAudio", "AudioLoader" - ] : t === "model3d" || zr.has(n) ? [ + ] : t === "model3d" || Vr.has(n) ? [ "Load3D", "LoadModel", "LoadMesh", @@ -3183,9 +3224,9 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli "LoadSTL", "LoadPLY" ] : []; -}, Oi = (e, t) => { +}, Ai = (e, t) => { if (e) { - e.type === "combo" && di(e, t), e.value = t; + e.type === "combo" && pi(e, t), e.value = t; try { e.callback?.(e.value); } catch (e) { @@ -3197,41 +3238,41 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli console.debug?.(e); } } -}, ki = (e) => { +}, ji = (e) => { let t = e?.canvas?.canvas || document.querySelector("canvas"), n = t?.getBoundingClientRect?.(), r = n ? Number(n.width || n.right - n.left) : 0, i = n ? Number(n.height || n.bottom - n.top) : 0, a = Number(r || t?.width || 800), o = Number(i || t?.height || 600); if (!n) return [Math.max(0, a / 2), Math.max(0, o / 2)]; let s = n && Number(n.left) || 0, c = n && Number(n.top) || 0; - return Ai(e, s + Math.max(0, a / 2), c + Math.max(0, o / 2)); -}, Ai = (e, t, n) => { + return Mi(e, s + Math.max(0, a / 2), c + Math.max(0, o / 2)); +}, Mi = (e, t, n) => { let r = (e?.canvas?.canvas || document.querySelector("canvas"))?.getBoundingClientRect?.(), i = e?.canvas?.ds || {}, a = Number(i.scale) || 1, o = i.offset || [0, 0], s = Array.isArray(o) ? Number(o[0]) || 0 : Number(o?.x) || 0, c = Array.isArray(o) ? Number(o[1]) || 0 : Number(o?.y) || 0; - return !r || !Number.isFinite(Number(t)) || !Number.isFinite(Number(n)) ? ki(e) : [(Number(t) - r.left) / a - s, (Number(n) - r.top) / a - c]; -}, ji = (e, t = null) => { - if (Number.isFinite(Number(t?.clientX)) && Number.isFinite(Number(t?.clientY))) return Ai(e, t.clientX, t.clientY); + return !r || !Number.isFinite(Number(t)) || !Number.isFinite(Number(n)) ? ji(e) : [(Number(t) - r.left) / a - s, (Number(n) - r.top) / a - c]; +}, Ni = (e, t = null) => { + if (Number.isFinite(Number(t?.clientX)) && Number.isFinite(Number(t?.clientY))) return Mi(e, t.clientX, t.clientY); try { let n = e?.canvas?.convertEventToCanvasOffset?.(t); if (Array.isArray(n)) return [Number(n[0]) || 0, Number(n[1]) || 0]; } catch (e) { console.debug?.(e); } - return Ai(e, t?.clientX, t?.clientY); -}, Mi = ({ app: e, payload: t, relativePath: n, event: r = null, droppedExt: i = "", position: a = null }) => { + return Mi(e, t?.clientX, t?.clientY); +}, Pi = ({ app: e, payload: t, relativePath: n, event: r = null, droppedExt: i = "", position: a = null }) => { let o = e?.graph ?? e?.canvas?.graph ?? null; if (!o || typeof o.add != "function") return !1; let s = null; - for (let n of Di(t)) try { - if (s = Be(n, e), s) break; + for (let n of ki(t)) try { + if (s = He(n, e), s) break; } catch (e) { console.debug?.(e); } if (!s) return !1; - s.pos = Array.isArray(a) ? [Number(a[0]) || 0, Number(a[1]) || 0] : ji(e, r), o.add(s); - let c = xi(s, t, i); - return c && Oi(c, n), Ti(e), !0; -}, Ni = ({ app: e, items: t = [], event: n = null, gap: r = 90 }) => { + s.pos = Array.isArray(a) ? [Number(a[0]) || 0, Number(a[1]) || 0] : Ni(e, r), o.add(s); + let c = Ci(s, t, i); + return c && Ai(c, n), Di(e), !0; +}, Fi = ({ app: e, items: t = [], event: n = null, gap: r = 90 }) => { let i = Array.isArray(t) ? t.filter(Boolean) : []; if (!i.length) return 0; - let a = ji(e, n), o = 0; - for (let t of i) Mi({ + let a = Ni(e, n), o = 0; + for (let t of i) Pi({ app: e, payload: t.payload, relativePath: t.relativePath, @@ -3240,27 +3281,27 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli position: [a[0] + o * Number(r || 90), a[1]] }) && (o += 1); return o; -}, Pi = Oi, Fi = ({ app: e, payload: t, relativePath: n, targetNode: r, inputSlotIndex: i, event: a = null }) => { +}, Ii = Ai, Li = ({ app: e, payload: t, relativePath: n, targetNode: r, inputSlotIndex: i, event: a = null }) => { let o = e?.graph ?? e?.canvas?.graph ?? null; if (!o || typeof o.add != "function" || !r) return !1; let s = null; - for (let n of Di(t)) try { - if (s = Be(n, e), s) break; + for (let n of ki(t)) try { + if (s = He(n, e), s) break; } catch (e) { console.debug?.(e); } if (!s) return !1; let c = Number(r.pos[0]) || 0, l = Number(r.pos[1]) || 0, u = Array.isArray(s.size) && Number(s.size[0]) || 220; s.pos = [c - u - 60, l + Number(i) * 20], o.add(s); - let d = Ei(t), f = xi(s, t, d); - f && Oi(f, n); + let d = Oi(t), f = Ci(s, t, d); + f && Ai(f, n); try { s.connect(0, r, i); } catch (e) { console.debug?.(e); } - return Ti(e), !0; -}, Ii = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => { + return Di(e), !0; +}, Ri = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => { let a = { index: !!r, files: [{ @@ -3268,12 +3309,12 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli subfolder: n.subfolder || "", dest_subfolder: "", type: n.type || "output", - root_id: Ee(n) || void 0 + root_id: Oe(n) || void 0 }] }; return i && (a.purpose = i), e(t, a); -}, Li = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => { - let a = await Ii({ +}, zi = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => { + let a = await Ri({ post: e, endpoint: t, payload: n, @@ -3288,41 +3329,41 @@ var Nr = "application/x-mjr-asset", Pr = "application/x-mjr-assets", Fr = "appli name: o?.name || null, subfolder: o?.subfolder || "" } : null; -}, Ri = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => (await Li({ +}, Bi = async ({ post: e, endpoint: t, payload: n, index: r = !0, purpose: i = null }) => (await zi({ post: e, endpoint: t, payload: n, index: r, purpose: i -}))?.relativePath || null, zi = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, Bi = /^[0-9a-f]{20,}$/i; -function Vi(...e) { +}))?.relativePath || null, Vi = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i, Hi = /^[0-9a-f]{20,}$/i; +function Ui(...e) { for (let t of e) { let e = String(t || "").trim(); if (e) return e; } return ""; } -function Hi(e) { - let t = String(e || "").trim(); - return !!t && (zi.test(t) || Bi.test(t)); -} -function Ui(e) { - return String(e?.type || e?.class_type || e?.comfyClass || e?.classType || "").trim(); -} function Wi(e) { - return Vi(e?.properties?.subgraph_name, e?.title, e?.properties?.title, e?.properties?.name, e?.properties?.label, e?.name, e?.subgraph?.name, e?.subgraph_instance?.name); + let t = String(e || "").trim(); + return !!t && (Vi.test(t) || Hi.test(t)); } function Gi(e) { - let t = Ui(e), n = Wi(e); - return n && (!t || Hi(t) || n !== t) ? n : t && !Hi(t) ? t : n || (t ? "Subgraph" : String(e?.id || "Node").trim() || "Node"); + return String(e?.type || e?.class_type || e?.comfyClass || e?.classType || "").trim(); } function Ki(e) { - let t = Ui(e); - return t && !Hi(t) ? t : t ? "Subgraph" : "Node"; + return Ui(e?.properties?.subgraph_name, e?.title, e?.properties?.title, e?.properties?.name, e?.properties?.label, e?.name, e?.subgraph?.name, e?.subgraph_instance?.name); +} +function qi(e) { + let t = Gi(e), n = Ki(e); + return n && (!t || Wi(t) || n !== t) ? n : t && !Wi(t) ? t : n || (t ? "Subgraph" : String(e?.id || "Node").trim() || "Node"); +} +function Ji(e) { + let t = Gi(e); + return t && !Wi(t) ? t : t ? "Subgraph" : "Node"; } //#endregion //#region ui/components/sidebar/utils/minimap.ts -var qi = 6, Ji = 1, Yi = 64, Xi = 74, Zi = 42, Qi = [ +var Yi = 6, Xi = 1, Zi = 64, Qi = 74, $i = 42, ea = [ ["sampler", "#8e5cff"], ["ksampler", "#8e5cff"], ["loader", "#4f8cff"], @@ -3339,20 +3380,20 @@ var qi = 6, Ji = 1, Yi = 64, Xi = 74, Zi = 42, Qi = [ ["save", "#4aa37c"], ["preview", "#4aa37c"], ["api", "#3aa6a6"] -], $i = (e, t, n) => { +], ta = (e, t, n) => { let r = Number(e); return Number.isFinite(r) ? Math.max(t, Math.min(n, r)) : t; -}, ea = (e, t = !1) => { +}, na = (e, t = !1) => { let n = String(e || "").toUpperCase(); return n.includes("IMAGE") ? "rgba(145,198,99,0.9)" : n.includes("LATENT") ? "rgba(89,178,118,0.9)" : n.includes("MODEL") ? "rgba(112,155,255,0.9)" : n.includes("CONDITIONING") ? "rgba(191,123,226,0.9)" : n.includes("CLIP") ? "rgba(220,178,77,0.9)" : n.includes("VAE") ? "rgba(72,184,214,0.9)" : n.includes("MASK") ? "rgba(190,190,190,0.88)" : n.includes("STRING") || n.includes("TEXT") ? "rgba(230,230,230,0.86)" : n.includes("INT") || n.includes("FLOAT") || n.includes("NUMBER") ? "rgba(130,210,220,0.88)" : t ? "rgba(170,220,255,0.82)" : "rgba(255,255,255,0.72)"; -}, ta = (e, t, n) => { +}, ra = (e, t, n) => { let r = String(t || "").replace(/\s+/g, " ").trim(), i = Math.max(1, Number(n) || 1); if (!r || e.measureText(r).width <= i) return r; let a = r; for (; a.length > 3 && e.measureText(`${a}...`).width > i;) a = a.slice(0, -1); return a.length > 3 ? `${a}...` : r.slice(0, 3); }; -function na(e, t, n = null) { +function ia(e, t, n = null) { if (!e) return; let r = e.getContext?.("2d"); if (!r) return; @@ -3366,7 +3407,7 @@ function na(e, t, n = null) { showNodeLabels: !1, expandSubgraphs: !0, ...n && typeof n == "object" ? n : {} - }, a = i.expandSubgraphs === !1 ? t : ra(t), o = Array.isArray(a?.nodes) ? a.nodes : [], s = Array.isArray(a?.groups) && a.groups || Array.isArray(a?.extra?.groups) && a.extra.groups || Array.isArray(a?.extra?.groupNodes) && a.extra.groupNodes || Array.isArray(a?.extra?.group_nodes) && a.extra.group_nodes || [], c = Array.isArray(a?.links) && a.links || Array.isArray(a?.extra?.links) && a.extra.links || [], l = Math.max(1, e.clientWidth || e.width || 1), u = Math.max(1, e.clientHeight || e.height || 1); + }, a = i.expandSubgraphs === !1 ? t : aa(t), o = Array.isArray(a?.nodes) ? a.nodes : [], s = Array.isArray(a?.groups) && a.groups || Array.isArray(a?.extra?.groups) && a.extra.groups || Array.isArray(a?.extra?.groupNodes) && a.extra.groupNodes || Array.isArray(a?.extra?.group_nodes) && a.extra.group_nodes || [], c = Array.isArray(a?.links) && a.links || Array.isArray(a?.extra?.links) && a.extra.links || [], l = Math.max(1, e.clientWidth || e.width || 1), u = Math.max(1, e.clientHeight || e.height || 1); if ((!o || o.length === 0) && (!s || s.length === 0)) return r.clearRect(0, 0, l, u), null; let d = (e, t) => { if (!e || typeof e != "string") return `rgba(255,255,255,${t})`; @@ -3403,7 +3444,7 @@ function na(e, t, n = null) { let t = e?.bgcolor || e?.color || null; if (t) return t; let n = String(e?.category || e?.type || e?.comfyClass || e?.class_type || e?.title || "").toLowerCase(); - for (let [e, t] of Qi) if (n.includes(e)) return t; + for (let [e, t] of ea) if (n.includes(e)) return t; let r = 0; for (let e = 0; e < n.length; e += 1) r = r * 31 + n.charCodeAt(e) | 0; return `hsl(${Math.abs(r) % 360} 42% 42%)`; @@ -3412,7 +3453,7 @@ function na(e, t, n = null) { if (n) { for (let [e, r] of Object.entries(n)) if (!(Array.isArray(r) || r && typeof r == "object") && (t.push([e, r]), t.length >= 3)) return t; } - let r = Array.isArray(e?.widgets_values) ? e.widgets_values : [], i = Array.isArray(e?.widgets) ? e.widgets : [], a = Array.isArray(e?.inputs) ? e.inputs : [], o = a.filter((e) => e?.widget === !0 || e?.widget && typeof e.widget == "object" || typeof e?.widget == "string" && e.widget.trim()), s = a.filter((e) => e?.link == null && da(e?.type)), c = (o.length ? o : s.length ? s : a).map((e) => String(e?.label || e?.localized_name || e?.name || e?.widget?.name || e?.widget?.label || "").trim()); + let r = Array.isArray(e?.widgets_values) ? e.widgets_values : [], i = Array.isArray(e?.widgets) ? e.widgets : [], a = Array.isArray(e?.inputs) ? e.inputs : [], o = a.filter((e) => e?.widget === !0 || e?.widget && typeof e.widget == "object" || typeof e?.widget == "string" && e.widget.trim()), s = a.filter((e) => e?.link == null && pa(e?.type)), c = (o.length ? o : s.length ? s : a).map((e) => String(e?.label || e?.localized_name || e?.name || e?.widget?.name || e?.widget?.label || "").trim()); return r.forEach((e, n) => { let r = i[n]?.name || i[n]?.label || c[n] || `p${n + 1}`; t.push([r, e]); @@ -3455,14 +3496,14 @@ function na(e, t, n = null) { outputs: C, inputCount: S.length || (e?.inputs && typeof e.inputs == "object" ? Object.keys(e.inputs).length : 0), outputCount: C.length, - label: Gi(e).replace(/\s+/g, " ").trim() + label: qi(e).replace(/\s+/g, " ").trim() }), n && h.set(n, m[m.length - 1]); } if (i.showGroups) for (let e of s || []) { let t = Array.isArray(e?.bounding) && e.bounding.length >= 4 ? e.bounding : null, n = t ? [Number(t[0]), Number(t[1])] : g(e?.pos), r = t ? [Number(t[2]), Number(t[3])] : _(e?.size); if (!n || !r) continue; let i = Number(n[0]), a = Number(n[1]), o = Math.max(1, Number(r[0])), s = Math.max(1, Number(r[1])); - !Number.isFinite(i) || !Number.isFinite(a) || !Number.isFinite(o) || !Number.isFinite(s) || m.push({ + Number.isFinite(i) && Number.isFinite(a) && Number.isFinite(o) && Number.isFinite(s) && m.push({ kind: "group", x: i, y: a, @@ -3475,21 +3516,21 @@ function na(e, t, n = null) { if (!m.length) return r.clearRect(0, 0, l, u), null; let v = m[0].x, y = m[0].y, b = m[0].x + m[0].w, x = m[0].y + m[0].h; for (let e of m) v = Math.min(v, e.x), y = Math.min(y, e.y), b = Math.max(b, e.x + e.w), x = Math.max(x, e.y + e.h); - let S = Math.max(1, b - v), C = Math.max(1, x - y), ee = v + S / 2, te = y + C / 2, w = i.view && typeof i.view == "object" ? i.view : Object.create(null), T = $i(w.zoom ?? 1, Ji, Yi), ne = Math.max(1, S / T), re = Math.max(1, C / T), ie = ne / 2, E = re / 2, ae = ne >= S ? ee : $i(w.centerX ?? ee, v + ie, b - ie), oe = re >= C ? te : $i(w.centerY ?? te, y + E, x - E), se = ae - ie, ce = oe - E, le = qi, ue = Math.min((l - 12) / ne, (u - 12) / re), de = w.hoveredNodeId !== null && w.hoveredNodeId !== void 0 ? String(w.hoveredNodeId) : null; + let S = Math.max(1, b - v), C = Math.max(1, x - y), ee = v + S / 2, te = y + C / 2, ne = i.view && typeof i.view == "object" ? i.view : Object.create(null), w = ta(ne.zoom ?? 1, Xi, Zi), T = Math.max(1, S / w), E = Math.max(1, C / w), re = T / 2, D = E / 2, ie = T >= S ? ee : ta(ne.centerX ?? ee, v + re, b - re), ae = E >= C ? te : ta(ne.centerY ?? te, y + D, x - D), oe = ie - re, se = ae - D, ce = Yi, le = Math.min((l - 12) / T, (u - 12) / E), ue = ne.hoveredNodeId !== null && ne.hoveredNodeId !== void 0 ? String(ne.hoveredNodeId) : null; r.clearRect(0, 0, l, u), r.fillStyle = "rgba(0,0,0,0.22)", r.fillRect(0, 0, l, u); - let D = (e, t) => ({ - x: le + (e - se) * ue, - y: le + (t - ce) * ue + let de = (e, t) => ({ + x: ce + (e - oe) * le, + y: ce + (t - se) * le }), fe = (e, t) => ({ - x: $i(se + (Number(e) - le) / ue, v, b), - y: $i(ce + (Number(t) - le) / ue, y, x) + x: ta(oe + (Number(e) - ce) / le, v, b), + y: ta(se + (Number(t) - ce) / le, y, x) }), pe = (e) => ({ - x: le + (e.x - se) * ue, - y: le + (e.y - ce) * ue, - w: Math.max(1, e.w * ue), - h: Math.max(1, e.h * ue) + x: ce + (e.x - oe) * le, + y: ce + (e.y - se) * le, + w: Math.max(1, e.w * le), + h: Math.max(1, e.h * le) }), me = (e) => Math.max(10, Math.min(24, Math.floor(Number(e) * .2))), he = (e, t, n) => { - let r = pe(e), i = me(r.h), a = n === "output" ? e.outputs : e.inputs, o = Math.max(1, Array.isArray(a) ? a.length : Number(e[`${n}Count`]) || 0), s = $i(t, 0, Math.max(0, o - 1)); + let r = pe(e), i = me(r.h), a = n === "output" ? e.outputs : e.inputs, o = Math.max(1, Array.isArray(a) ? a.length : Number(e[`${n}Count`]) || 0), s = ta(t, 0, Math.max(0, o - 1)); return r.y + i + (r.h - i) * (s + 1) / (o + 1); }, ge = (e) => Array.isArray(e) && e.length >= 5 ? { originId: e[1], @@ -3507,7 +3548,7 @@ function na(e, t, n = null) { let t = String(e || "").toUpperCase(); return t.includes("IMAGE") ? "rgba(145,198,99,0.38)" : t.includes("LATENT") ? "rgba(89,178,118,0.38)" : t.includes("MODEL") ? "rgba(112,155,255,0.38)" : t.includes("CONDITIONING") ? "rgba(191,123,226,0.38)" : t.includes("CLIP") ? "rgba(220,178,77,0.38)" : t.includes("VAE") ? "rgba(72,184,214,0.38)" : t.includes("MASK") ? "rgba(190,190,190,0.36)" : "rgba(255,255,255,0.2)"; }, ve = () => { - if (i.showLinks && !(!c || c.length === 0)) { + if (i.showLinks && c && c.length !== 0) { r.save(), r.globalAlpha = 1, r.lineWidth = 1; for (let e of c) { let t = ge(e), n = t?.originId, i = t?.targetId; @@ -3526,7 +3567,7 @@ function na(e, t, n = null) { r.restore(); } }, ye = (e) => { - let { x: t, y: n, w: a, h: o } = pe(e), s = e.kind === "node", c = e.kind === "group", l = !!e.bypassed, u = !!e.errored, f = c ? .18 : l && i.renderBypassState ? .14 : .62, p = c ? .55 : l && i.renderBypassState ? .32 : .8, m = d(e.fill, f), h = d(e.stroke, p), g = s && i.showNodeLabels && a >= Xi && o >= Zi, _ = Math.max(2, Math.min(g ? 7 : 8, Math.floor(Math.min(a, o) * .08))), v = s ? me(o) : 0; + let { x: t, y: n, w: a, h: o } = pe(e), s = e.kind === "node", c = e.kind === "group", l = !!e.bypassed, u = !!e.errored, f = c ? .18 : l && i.renderBypassState ? .14 : .62, p = c ? .55 : l && i.renderBypassState ? .32 : .8, m = d(e.fill, f), h = d(e.stroke, p), g = s && i.showNodeLabels && a >= Qi && o >= $i, _ = Math.max(2, Math.min(g ? 7 : 8, Math.floor(Math.min(a, o) * .08))), v = s ? me(o) : 0; if (r.save(), r.globalAlpha = 1, typeof m == "string" && (m.startsWith("#") || m.startsWith("rgb") || m.startsWith("hsl")) ? (r.fillStyle = m, r.globalAlpha = f) : (r.fillStyle = typeof m == "string" ? m : "rgba(82,88,96,0.72)", r.globalAlpha = f), typeof r.roundRect == "function" ? (r.beginPath(), r.roundRect(t, n, a, o, _), r.fill()) : r.fillRect(t, n, a, o), r.restore(), s && (r.save(), r.fillStyle = d(e.stroke || e.fill, l ? .34 : .9), typeof r.roundRect == "function" ? (r.beginPath(), r.roundRect(t, n, a, v, [ _, _, @@ -3547,11 +3588,11 @@ function na(e, t, n = null) { r.save(), r.strokeStyle = "rgba(0,0,0,0.48)", r.lineWidth = 1; for (let i = 0; i < n; i += 1) { let n = he(e, i, "input"); - r.fillStyle = ea(e.inputs?.[i]?.type, !1), r.beginPath(), r.arc(t, n, g ? 3 : 2.2, 0, Math.PI * 2), r.fill(), r.stroke(); + r.fillStyle = na(e.inputs?.[i]?.type, !1), r.beginPath(), r.arc(t, n, g ? 3 : 2.2, 0, Math.PI * 2), r.fill(), r.stroke(); } for (let n = 0; n < i; n += 1) { let i = he(e, n, "output"); - r.fillStyle = ea(e.outputs?.[n]?.type, !0), r.beginPath(), r.arc(t + a, i, g ? 3 : 2.2, 0, Math.PI * 2), r.fill(), r.stroke(); + r.fillStyle = na(e.outputs?.[n]?.type, !0), r.beginPath(), r.arc(t + a, i, g ? 3 : 2.2, 0, Math.PI * 2), r.fill(), r.stroke(); } r.restore(); } @@ -3563,7 +3604,7 @@ function na(e, t, n = null) { } r.strokeStyle = "rgba(244,67,54,0.95)", r.lineWidth = 1.5, r.strokeRect(t - .5, n - .5, a + 1, o + 1); } - if (s && de && String(e.id || "") === de) { + if (s && ue && String(e.id || "") === ue) { try { r.setLineDash([]); } catch (e) { @@ -3594,12 +3635,12 @@ function na(e, t, n = null) { let i = Math.max(24, a * .34); for (let a = 0; a < Math.min(8, e.inputs?.length || 0); a += 1) { let o = e.inputs[a], s = String(o?.label || o?.localized_name || o?.name || "").trim(); - s && r.fillText(ta(r, s, i), t + 7, he(e, a, "input") + n * .35, i); + s && r.fillText(ra(r, s, i), t + 7, he(e, a, "input") + n * .35, i); } for (let o = 0; o < Math.min(8, e.outputs?.length || 0); o += 1) { let s = e.outputs[o], c = String(s?.label || s?.localized_name || s?.name || "").trim(); if (!c) continue; - let l = ta(r, c, i); + let l = ra(r, c, i); r.fillText(l, t + a - 7 - Math.min(i, r.measureText(l).width), he(e, o, "output") + n * .35, i); } r.restore(); @@ -3609,9 +3650,9 @@ function na(e, t, n = null) { ve(); for (let e of m.filter((e) => e.kind === "node")) ye(e); if (i.showViewport) try { - let e = ke(); + let e = je(); if (e) { - let t = D(e.x0, e.y0), n = D(e.x1, e.y1), i = Math.min(t.x, n.x), a = Math.min(t.y, n.y), o = Math.abs(n.x - t.x), s = Math.abs(n.y - t.y); + let t = de(e.x0, e.y0), n = de(e.x1, e.y1), i = Math.min(t.x, n.x), a = Math.min(t.y, n.y), o = Math.abs(n.x - t.x), s = Math.abs(n.y - t.y); r.save(), r.globalAlpha = 1, r.strokeStyle = "rgba(255,255,255,0.9)", r.lineWidth = 1, r.strokeRect(i, a, o, s), r.restore(); } } catch (e) { @@ -3627,18 +3668,18 @@ function na(e, t, n = null) { height: C }, resolvedView: { - zoom: T, - centerX: ae, - centerY: oe, - visibleW: ne, - visibleH: re, - viewMinX: se, - viewMinY: ce, - pad: le, - renderScale: ue + zoom: w, + centerX: ie, + centerY: ae, + visibleW: T, + visibleH: E, + viewMinX: oe, + viewMinY: se, + pad: ce, + renderScale: le }, canvasToWorld: fe, - worldToCanvas: D, + worldToCanvas: de, hitTestNode: (e, t) => { let n = fe(e, t); for (let e = m.length - 1; e >= 0; --e) { @@ -3649,16 +3690,16 @@ function na(e, t, n = null) { } }; } -function ra(e, t = null) { +function aa(e, t = null) { if (!e || typeof e != "object") return e; - let n = Array.isArray(e.nodes) ? e.nodes.filter(Boolean) : [], r = ia(e, t); + let n = Array.isArray(e.nodes) ? e.nodes.filter(Boolean) : [], r = oa(e, t); if (!n.length) return e; let i = [], a = Array.isArray(e.links) ? [...e.links] : [], o = [...Array.isArray(e.groups) ? e.groups : [], ...Array.isArray(e.extra?.groups) ? e.extra.groups : []]; for (let e of n) { i.push(e); - let t = aa(e, r); + let t = sa(e, r); if (!t || !Array.isArray(t.nodes) || !t.nodes.length) continue; - let n = sa(e, ra(t, r)); + let n = la(e, aa(t, r)); i.push(...n.nodes), a.push(...n.links), n.group && o.push(n.group); } return { @@ -3672,16 +3713,16 @@ function ra(e, t = null) { } }; } -function ia(e, t = null) { +function oa(e, t = null) { let n = [ ...Array.isArray(e?.definitions?.subgraphs) ? e.definitions.subgraphs : [], ...Array.isArray(e?.subgraphs) ? e.subgraphs : [], ...Array.isArray(e?.rootGraph?.subgraphs) ? e.rootGraph.subgraphs : [] ], r = new Map(t || []); - for (let e of n) for (let t of oa(e)) t != null && r.set(String(t), e); + for (let e of n) for (let t of ca(e)) t != null && r.set(String(t), e); return r; } -function aa(e, t) { +function sa(e, t) { let n = [ e?.type, e?.comfyClass, @@ -3709,7 +3750,7 @@ function aa(e, t) { e?.subgraph_graph ].find((e) => e && typeof e == "object" && Array.isArray(e.nodes)) || null; } -function oa(e) { +function ca(e) { return [ e?.id, e?.name, @@ -3721,9 +3762,9 @@ function oa(e) { e?.properties?.subgraphId ].filter((e) => e != null && String(e).trim()); } -function sa(e, t) { - let n = String(e?.id ?? e?.ID ?? ""), r = la(e?.pos) || [0, 0], i = ua(e?.size) || [260, 180], a = t.nodes.filter(Boolean), o = ca(a), s = Math.min(22, Math.max(8, i[0] * .08)), c = Math.min(34, Math.max(18, i[1] * .18)), l = Math.min(18, Math.max(8, i[1] * .08)), u = Math.max(40, i[0] - s * 2), d = Math.max(34, i[1] - c - l), f = Math.min(1, u / o.width, d / o.height), p = r[0] + s + (u - o.width * f) / 2, m = r[1] + c + (d - o.height * f) / 2, h = a.map((r) => { - let i = la(r?.pos) || [o.minX, o.minY], a = ua(r?.size) || [140, 60]; +function la(e, t) { + let n = String(e?.id ?? e?.ID ?? ""), r = da(e?.pos) || [0, 0], i = fa(e?.size) || [260, 180], a = t.nodes.filter(Boolean), o = ua(a), s = Math.min(22, Math.max(8, i[0] * .08)), c = Math.min(34, Math.max(18, i[1] * .18)), l = Math.min(18, Math.max(8, i[1] * .08)), u = Math.max(40, i[0] - s * 2), d = Math.max(34, i[1] - c - l), f = Math.min(1, u / o.width, d / o.height), p = r[0] + s + (u - o.width * f) / 2, m = r[1] + c + (d - o.height * f) / 2, h = a.map((r) => { + let i = da(r?.pos) || [o.minX, o.minY], a = fa(r?.size) || [140, 60]; return { ...r, id: `${n}::${r?.id ?? r?.ID ?? ""}`, @@ -3763,12 +3804,12 @@ function sa(e, t) { } }; } -function ca(e) { +function ua(e) { let t = Infinity, n = Infinity, r = -Infinity, i = -Infinity; for (let a of e) { - let e = la(a?.pos); + let e = da(a?.pos); if (!e) continue; - let o = ua(a?.size) || [140, 60]; + let o = fa(a?.size) || [140, 60]; t = Math.min(t, e[0]), n = Math.min(n, e[1]), r = Math.max(r, e[0] + o[0]), i = Math.max(i, e[1] + o[1]); } return Number.isFinite(t) ? { @@ -3783,7 +3824,7 @@ function ca(e) { height: 1 }; } -function la(e) { +function da(e) { if (Array.isArray(e) && e.length >= 2) return [Number(e[0]), Number(e[1])]; if (e && typeof e == "object") { let t = e[0] ?? e[0] ?? e.x ?? e.left ?? null, n = e[1] ?? e[1] ?? e.y ?? e.top ?? null; @@ -3791,7 +3832,7 @@ function la(e) { } return null; } -function ua(e) { +function fa(e) { if (Array.isArray(e) && e.length >= 2) return [Number(e[0]), Number(e[1])]; if (e && typeof e == "object") { let t = e[0] ?? e[0] ?? e.w ?? e.width ?? null, n = e[1] ?? e[1] ?? e.h ?? e.height ?? null; @@ -3799,12 +3840,12 @@ function ua(e) { } return null; } -function da(e) { +function pa(e) { if (Array.isArray(e)) return !0; let t = String(e || "").trim().toUpperCase(); return t === "INT" || t === "FLOAT" || t === "STRING" || t === "BOOLEAN" || t === "BOOL" || t === "COMBO" || t === "ENUM"; } -function fa(e, t = null) { +function ma(e, t = null) { if (!e || typeof e != "object") return null; let n = { maxNodes: 220, @@ -3875,7 +3916,7 @@ function fa(e, t = null) { } //#endregion //#region ui/features/workflows/workflowPickerState.ts -var X = vt({ +var X = bt({ open: !1, mode: "workflow", title: "", @@ -3884,17 +3925,17 @@ var X = vt({ items: [], resolve: null }); -function pa({ title: e = "Select workflow", sourceAsset: t = null } = {}) { - return ha(null), X.open = !0, X.mode = "workflow", X.title = String(e || "Select workflow"), X.sourceAsset = t || null, X.workflow = null, X.items = [], new Promise((e) => { +function ha({ title: e = "Select workflow", sourceAsset: t = null } = {}) { + return _a(null), X.open = !0, X.mode = "workflow", X.title = String(e || "Select workflow"), X.sourceAsset = t || null, X.workflow = null, X.items = [], new Promise((e) => { X.resolve = e; }); } -function ma({ title: e = "Select asset", workflow: t = null, items: n = [] } = {}) { - return ha(null), X.open = !0, X.mode = "asset", X.title = String(e || "Select asset"), X.sourceAsset = null, X.workflow = t || null, X.items = Array.isArray(n) ? n.filter(Boolean) : [], new Promise((e) => { +function ga({ title: e = "Select asset", workflow: t = null, items: n = [] } = {}) { + return _a(null), X.open = !0, X.mode = "asset", X.title = String(e || "Select asset"), X.sourceAsset = null, X.workflow = t || null, X.items = Array.isArray(n) ? n.filter(Boolean) : [], new Promise((e) => { X.resolve = e; }); } -function ha(e = null) { +function _a(e = null) { let t = X.resolve; if (X.open = !1, X.mode = "workflow", X.title = "", X.sourceAsset = null, X.workflow = null, X.items = [], X.resolve = null, typeof t == "function") try { t(e || null); @@ -3904,41 +3945,41 @@ function ha(e = null) { } //#endregion //#region ui/vue/majoorPrimeVue.ts -var ga = { - Button: ut, - Checkbox: lt, - InputText: wt, - Textarea: ht, - Select: St, - ToggleButton: yt, - Badge: bt, - Tag: ot, - Dialog: pt, - Menu: xt, - Listbox: _t, - Tree: Ct, - VirtualScroller: ct +var va = { + Button: ft, + Checkbox: dt, + InputText: Et, + Textarea: _t, + Select: wt, + ToggleButton: xt, + Badge: St, + Tag: ct, + Dialog: ht, + Menu: Ct, + Listbox: yt, + Tree: Tt, + VirtualScroller: ut }; -function _a(e) { - return e.use(dt, { +function ya(e) { + return e.use(pt, { ripple: !1, unstyled: !0, zIndex: { overlay: 10100 } - }), e.use(ft), e.use(gt), Object.entries(ga).forEach(([t, n]) => { + }), e.use(mt), e.use(vt), Object.entries(va).forEach(([t, n]) => { e.component(`M${t}`, n); }), e; } //#endregion //#region ui/vue/createVueApp.ts -function va(e, t = void 0) { - let n = Ot(), r = at(e, t); - return r.use(n), _a(r), { +function ba(e, t = void 0) { + let n = At(), r = st(e, t); + return r.use(n), ya(r), { app: r, pinia: n }; } -var ya = /* @__PURE__ */ new Map(); -function ba(e, t, n) { +var xa = /* @__PURE__ */ new Map(); +function Sa(e, t, n) { try { window.dispatchEvent(new CustomEvent("mjr:keepalive-attached", { detail: { mountKey: String(e || "_mjrVueApp"), @@ -3947,31 +3988,31 @@ function ba(e, t, n) { } })); } catch {} } -function xa(e) { +function Ca(e) { let t = document.createElement("div"); return t.dataset.mjrKeepAliveHost = String(e || "_mjrVueApp"), t.style.height = "100%", t.style.width = "100%", t.style.minHeight = "0", t.style.display = "flex", t.style.flexDirection = "column", t.style.overflow = "hidden", t; } -function Sa(e, t) { - !e || !t || (e.style.height = "100%", e.style.minHeight = "0", e.style.display = "flex", e.style.flexDirection = "column", e.style.overflow = "hidden", (e.firstChild !== t || e.childNodes.length !== 1) && (e.replaceChildren(t), ba(t?.dataset?.mjrKeepAliveHost, t, e))); +function wa(e, t) { + e && t && (e.style.height = "100%", e.style.minHeight = "0", e.style.display = "flex", e.style.flexDirection = "column", e.style.overflow = "hidden", (e.firstChild !== t || e.childNodes.length !== 1) && (e.replaceChildren(t), Sa(t?.dataset?.mjrKeepAliveHost, t, e))); } -function Ca(e, t, n = "_mjrVueApp", { attachIfExists: r = !0 } = {}) { +function Ta(e, t, n = "_mjrVueApp", { attachIfExists: r = !0 } = {}) { if (!e) return !1; - let i = ya.get(n), a = !1; + let i = xa.get(n), a = !1; if (!i) { - let e = xa(n), { app: r } = va(t); + let e = Ca(n), { app: r } = ba(t); r.mount(e), i = { app: r, host: e, container: null - }, ya.set(n, i), a = !0; + }, xa.set(n, i), a = !0; } - return (a || r) && (Sa(e, i.host), i.container = e), a; + return (a || r) && (wa(e, i.host), i.container = e), a; } -function wa(e = "_mjrVueApp") { - return ya.has(e); +function Ea(e = "_mjrVueApp") { + return xa.has(e); } -function Ta(e, t = "_mjrVueApp") { - let n = ya.get(t); +function Da(e, t = "_mjrVueApp") { + let n = xa.get(t); if (n?.app) { try { n.app.unmount(); @@ -3979,30 +4020,30 @@ function Ta(e, t = "_mjrVueApp") { try { n.host?.remove?.(); } catch {} - ya.delete(t); + xa.delete(t); } } //#endregion //#region ui/utils/format.ts -function Ea(e) { +function Oa(e) { if (!e) return null; let t = Number(e); if (!isNaN(t)) return /* @__PURE__ */ new Date(t * 1e3); let n = new Date(e); return isNaN(n.getTime()) ? null : n; } -function Da(e) { - let t = Ea(e); +function ka(e) { + let t = Oa(e); return t ? `${t.getDate().toString().padStart(2, "0")}/${(t.getMonth() + 1).toString().padStart(2, "0")}` : ""; } -function Oa(e) { - let t = Ea(e); +function Aa(e) { + let t = Oa(e); return t ? `${t.getHours().toString().padStart(2, "0")}:${t.getMinutes().toString().padStart(2, "0")}` : ""; } -function ka(e) { +function ja(e) { return e ? e < 60 ? `${Math.round(e)}s` : `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : ""; } -var Aa = { +var Ma = { version: 1, parser_family_version: "geninfo-catalog-v1", sections: [ @@ -4095,25 +4136,25 @@ var Aa = { } ] }; -function ja() { +function Na() { let e = {}; - for (let t of Aa.sections) { + for (let t of Ma.sections) { e[t.key] = t.searchField, e[t.searchField] = t.searchField; for (let n of t.aliases || []) e[String(n).toLowerCase()] = t.searchField; } return e; } -function Ma(e) { +function Pa(e) { let t = String(e || "").trim().toLowerCase(); - return ja()[t] || ""; + return Na()[t] || ""; } -function Na(e) { +function Fa(e) { let t = String(e || "").trim().toLowerCase(); - return t && Aa.sections.find((e) => e.key === t) || null; + return t && Ma.sections.find((e) => e.key === t) || null; } //#endregion //#region ui/vue/components/panel/sidebar/SidebarFileInfoSection.vue?vue&type=script&setup=true&lang.ts -var Pa = { +var Ia = { key: 0, class: "mjr-sidebar-section", style: { @@ -4122,11 +4163,11 @@ var Pa = { "border-radius": "8px", padding: "10px" } -}, Fa = { style: { +}, La = { style: { display: "flex", "flex-direction": "column", gap: "6px" -} }, Ia = ["title"], La = ["title"], Ra = /* @__PURE__ */ tt({ +} }, Ra = ["title"], za = ["title"], Ba = /* @__PURE__ */ rt({ __name: "SidebarFileInfoSection", props: { asset: {} }, setup(e) { @@ -4179,16 +4220,16 @@ var Pa = { tooltip: "Image/video resolution in pixels" }), e.duration && e.duration > 0 && f.push({ label: "Duration", - value: ka(e.duration), + value: ja(e.duration), tooltip: "Video duration" }); - let p = Je(e); + let p = Xe(e); p != null && f.push({ label: "FPS", - value: Ke(p), + value: Je(p), tooltip: "Native frame rate" }); - let m = qe(e, p); + let m = Ye(e, p); f.push({ label: "Frames", value: m == null ? "N/A" : String(Math.max(0, Math.floor(m))), @@ -4222,16 +4263,16 @@ var Pa = { value: String(i(u.color_space, c.color_space, c.colorspace) || "N/A"), tooltip: "Encoded color space" }); - let h = He(e.generation_time_ms ?? e.metadata?.generation_time_ms ?? 0); + let h = We(e.generation_time_ms ?? e.metadata?.generation_time_ms ?? 0); h > 0 && f.push({ label: "Generation Time", value: `${(Number(h) / 1e3).toFixed(1)}s`, tooltip: "Time taken to generate this asset (workflow execution time)", - valueStyle: `color: ${We(h)}; font-weight: 600;` + valueStyle: `color: ${Ke(h)}; font-weight: 600;` }); let g = e.generation_time || e.file_creation_time || e.mtime || e.created_at; if (g) { - let e = Da(g), t = Oa(g); + let e = ka(g), t = Aa(g); e && f.push({ label: "Date", value: e, @@ -4276,14 +4317,14 @@ var Pa = { tooltip: "ComfyUI workflow identifier (from workflow.id in extra_data)" }), f.filter((e) => a(e.value)); }); - return (e, t) => c.value.length ? (I(), z("div", Pa, [t[0] ||= M("div", { style: { + return (e, t) => c.value.length ? (I(), z("div", Ia, [t[0] ||= M("div", { style: { "font-size": "12px", "font-weight": "700", color: "#607d8b", "margin-bottom": "8px", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, " File Info ", -1), M("div", Fa, [(I(!0), z(j, null, F(c.value, (e) => (I(), z("div", { + } }, " File Info ", -1), M("div", La, [(I(!0), z(j, null, F(c.value, (e) => (I(), z("div", { key: e.label, style: { display: "flex", @@ -4298,12 +4339,12 @@ var Pa = { opacity: "0.68", "min-width": "92px" } - }, R(e.label), 9, Ia), M("div", { + }, R(e.label), 9, Ra), M("div", { style: L(e.valueStyle || "font-size: 12px; text-align: right; word-break: break-word"), title: String(e.value || "") - }, R(e.value), 13, La)]))), 128))])])) : N("", !0); + }, R(e.value), 13, za)]))), 128))])])) : N("", !0); } -}), za = /* @__PURE__ */ new Set([ +}), Va = /* @__PURE__ */ new Set([ "png", "jpg", "jpeg", @@ -4320,31 +4361,31 @@ var Pa = { "hdr", "svg" ]); -function Ba(e) { +function Ha(e) { let t = String(e?.filename || e?.name || e?.filepath || e?.path || "").trim().toLowerCase(); return !t || !t.includes(".") ? "" : t.split(".").pop() || ""; } -function Va(e) { - return String(e?.kind || "").trim().toLowerCase() === "image" || String(e?.mime || e?.mimetype || "").trim().toLowerCase().startsWith("image/") ? !0 : za.has(Ba(e)); +function Ua(e) { + return String(e?.kind || "").trim().toLowerCase() === "image" || String(e?.mime || e?.mimetype || "").trim().toLowerCase().startsWith("image/") ? !0 : Va.has(Ha(e)); } -function Ha(e) { - let t = Ba(e); +function Wa(e) { + let t = Ha(e); return t === "jpg" || t === "jpeg"; } -function Ua() { +function Ga() { try { - return !!(Gt()?.ai?.vectorSearchEnabled ?? !0); + return !!(qt()?.ai?.vectorSearchEnabled ?? !0); } catch { return !0; } } -function Wa(e) { +function Ka(e) { return e >= .75 ? "#4CAF50" : e >= .5 ? "#8BC34A" : e >= .3 ? "#FF9800" : "#F44336"; } -function Ga(e) { +function qa(e) { return e >= .85 ? "Excellent" : e >= .7 ? "Good" : e >= .5 ? "Fair" : e >= .3 ? "Low" : "Very Low"; } -function Ka(e) { +function Ja(e) { let t = String(e || "").trim(); if (!t) return ""; let n = []; @@ -4354,21 +4395,21 @@ function Ka(e) { } return (n.length ? n.join(" ") : t).replace(/\s+/g, " ").replace(/:{2,}\s*$/, "").trim(); } -function qa(e) { +function Ya(e) { let t = String(e?.filename || "").trim(); if (!t) return []; let n = String(e?.subfolder || "").trim(), r = String(e?.folder_type || "input").trim().toLowerCase(), i = [], a = (e) => { if (!e) return; - let r = Le(t, n, e); + let r = ze(t, n, e); r && !i.includes(r) && i.push(r); }; return (r === "input" || r === "output") && a(r), a("input"), a("output"), i; } -function Ja(e) { +function Xa(e) { let t = String(e?.filepath || "").trim(), n = String(e?.filename || "").trim(); return !t || t === n ? "" : t; } -function Ya(e) { +function Za(e) { let t = String(e || "").trim(); if (!t) return !1; if (t.startsWith("/")) return !0; @@ -4382,7 +4423,7 @@ function Ya(e) { function Z(e) { return e == null || e === "" ? "-" : String(e); } -function Xa(e, t) { +function Qa(e, t) { let n = String(e?.pass_stage || e?.stage || e?.kind || "").trim().toLowerCase(); if (n === "txt2img" || n === "text_to_image" || n === "text-to-image") return O("sidebar.generation.stageTextToImage", "Text-to-Image"); if (n === "img2img" || n === "image_to_image" || n === "image-to-image") return O("sidebar.generation.stageImageToImage", "Image-to-Image"); @@ -4394,34 +4435,34 @@ function Xa(e, t) { let i = Number(e?.denoise); return t === 0 || i === 1 ? O("sidebar.generation.stageBase", "Base") : Number.isFinite(i) && i < 1 ? O("sidebar.generation.stageRefineUpscale", "Refine / Upscale") : O("sidebar.generation.stagePassN", "Pass {n}", { n: t + 1 }); } -function Za(e) { +function $a(e) { let t = []; return e?.metadata_raw && t.push(e.metadata_raw), e?.workflow && t.push(e.workflow), e?.metadata_raw?.workflow && t.push(e.metadata_raw.workflow), e?.metadata_raw?.raw_ffprobe?.format?.tags && t.push(e.metadata_raw.raw_ffprobe.format.tags), e?.metadata_raw?.ffprobe?.format?.tags && t.push(e.metadata_raw.ffprobe.format.tags), e?.geninfo && typeof e.geninfo == "object" && t.push({ geninfo: e.geninfo }), e?.metadata && (typeof e.metadata == "object" || typeof e.metadata == "string") && t.push(e.metadata), e?.prompt && (typeof e.prompt == "object" || typeof e.prompt == "string") && t.push(e.prompt), e?.exif && t.push(e.exif), e && typeof e == "object" && t.push(e), t; } -function Qa(e, t) { +function eo(e, t) { for (let [n, r] of Object.entries(t)) r != null && r !== "" && (e[n] === void 0 || e[n] === null || e[n] === "") && (e[n] = r); } -function $a(e) { - let t = Za(e), n = {}; +function to(e) { + let t = $a(e), n = {}; for (let e of t) { - let t = jt(e); - !t || typeof t != "object" || Qa(n, t); + let t = Nt(e); + t && typeof t == "object" && eo(n, t); } return Object.keys(n).length ? n : null; } -function eo(e) { +function no(e) { try { if (!e || typeof e != "object") return !1; - if (e.is_override || typeof e.workflow_notes == "string" && e.workflow_notes.trim() || typeof e.notes == "string" && e.notes.trim() || Array.isArray(e.custom_info) && e.custom_info.length > 0 || e.engine && typeof e.engine == "object" && e.engine.type || Nt(e.prompt) || typeof (e.negative_prompt || e.negativePrompt) == "string" && Nt(e.negative_prompt || e.negativePrompt) || e.models || e.model || e.checkpoint || e.loras || e.ltx_director && typeof e.ltx_director == "object" || e.ideogram && typeof e.ideogram == "object" || e.sampler || e.sampler_name || e.steps || e.cfg || e.cfg_scale || e.cfg_high_noise || e.cfg_low_noise || e.scheduler || Array.isArray(e.chained_passes) && e.chained_passes.length > 0 || Array.isArray(e.all_samplers) && e.all_samplers.length > 0 || e.seed || e.denoise || e.denoising || e.clip_skip || e.voice || e.language || e.temperature || e.top_k || e.top_p || e.repetition_penalty || e.max_new_tokens || e.device || e.voice_preset || e.instruct || e.dtype || e.attn_implementation || e.enable_chunking !== void 0 || e.max_chars_per_chunk || e.chunk_combination_method || e.silence_between_chunks_ms || e.enable_audio_cache !== void 0 || e.batch_size !== void 0 || e.use_torch_compile !== void 0 || e.use_cuda_graphs !== void 0 || e.compile_mode || typeof e.lyrics == "string" && e.lyrics.trim()) return !0; + if (e.is_override || typeof e.workflow_notes == "string" && e.workflow_notes.trim() || typeof e.notes == "string" && e.notes.trim() || Array.isArray(e.custom_info) && e.custom_info.length > 0 || e.engine && typeof e.engine == "object" && e.engine.type || Ft(e.prompt) || typeof (e.negative_prompt || e.negativePrompt) == "string" && Ft(e.negative_prompt || e.negativePrompt) || e.models || e.model || e.checkpoint || e.loras || e.ltx_director && typeof e.ltx_director == "object" || e.ideogram && typeof e.ideogram == "object" || e.sampler || e.sampler_name || e.steps || e.cfg || e.cfg_scale || e.cfg_high_noise || e.cfg_low_noise || e.scheduler || Array.isArray(e.chained_passes) && e.chained_passes.length > 0 || Array.isArray(e.all_samplers) && e.all_samplers.length > 0 || e.seed || e.denoise || e.denoising || e.clip_skip || e.voice || e.language || e.temperature || e.top_k || e.top_p || e.repetition_penalty || e.max_new_tokens || e.device || e.voice_preset || e.instruct || e.dtype || e.attn_implementation || e.enable_chunking !== void 0 || e.max_chars_per_chunk || e.chunk_combination_method || e.silence_between_chunks_ms || e.enable_audio_cache !== void 0 || e.batch_size !== void 0 || e.use_torch_compile !== void 0 || e.use_cuda_graphs !== void 0 || e.compile_mode || typeof e.lyrics == "string" && e.lyrics.trim()) return !0; } catch { return !1; } return !1; } function Q(e) { - return e ? typeof e == "string" ? Pt(e) : typeof e == "object" ? Pt(e.name || e.value || "") : "" : ""; + return e ? typeof e == "string" ? It(e) : typeof e == "object" ? It(e.name || e.value || "") : "" : ""; } -function to(e, t, n, r) { +function ro(e, t, n, r) { let i = String(r || "").trim(); if (!i) return; let a = `${n}::${i}`; @@ -4430,16 +4471,16 @@ function to(e, t, n, r) { value: i })); } -function no(e) { +function io(e) { let t = `${String(e?.source || "").toLowerCase()} ${String(e?.name || e?.lora_name || "").toLowerCase()}`; return t.includes("high_noise") || t.includes("high noise") ? "high_noise" : t.includes("low_noise") || t.includes("low noise") ? "low_noise" : ""; } -function ro(e) { +function ao(e) { let t = [], n = Array.isArray(e.model_groups) ? e.model_groups : []; if (n.length) return n.forEach((e) => { if (!e || typeof e != "object") return; - let n = Q(e.model), r = Array.isArray(e.loras) ? e.loras.map((e) => Mt(e)).filter(Boolean) : []; - !n && !r.length || t.push({ + let n = Q(e.model), r = Array.isArray(e.loras) ? e.loras.map((e) => Pt(e)).filter(Boolean) : []; + (n || r.length) && t.push({ key: String(e.key || "").trim() || `group-${t.length + 1}`, label: String(e.label || "").trim() || `Group ${t.length + 1}`, model: n, @@ -4456,14 +4497,14 @@ function ro(e) { label: O("sidebar.generation.lowNoise", "Low Noise"), model: Q(r.unet_low_noise) }].forEach((e) => { - let n = i.filter((t) => no(t) === e.key).map((e) => Mt(e)).filter(Boolean); - !e.model && !n.length || t.push({ + let n = i.filter((t) => io(t) === e.key).map((e) => Pt(e)).filter(Boolean); + (e.model || n.length) && t.push({ ...e, loras: n }); }), t; } -function io(e, t) { +function oo(e, t) { return t == null ? null : { label: e, value: t ? O("state.on", "on") : O("state.off", "off") @@ -4472,74 +4513,74 @@ function io(e, t) { function $(e) { return e != null && String(e).trim() !== ""; } -function ao(e) { +function so(e) { let t = String(e || "").toLowerCase(); return t.includes("high") ? "#52ffe8" : t.includes("low") ? "#42A5F5" : t.includes("refine") ? "#AB47BC" : t.includes("upscale") ? "#66BB6A" : t.includes("interpolation") || t.includes("video") ? "#dace26" : "#9C27B0"; } -function oo(e) { +function co(e) { return String(e || "").trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""); } -function so(e, t) { +function lo(e, t) { let n = String(t || e || "").trim(), r = String(e || n).toLowerCase(), i = r.match(/^pass_(\d+)$/); return i ? O("sidebar.generation.stagePassN", "Pass {n}", { n: Number(i[1]) }) : r.includes("high") ? "High" : r.includes("low") ? "Low" : r.includes("refine") ? "Refiner" : r.includes("upscale") ? "Upscale" : r.includes("text_to_image") || r.includes("image_to_image") || r === "base" ? "Base" : n || "Branch"; } -function co(e, t) { +function uo(e, t) { let n = new Set(t.map((e) => String(e).toLowerCase())); return e.find((e) => n.has(String(e.label || "").toLowerCase())) || null; } -function lo(e, t) { +function fo(e, t) { return $(t) ? { label: e, value: t } : null; } -function uo(e) { +function po(e) { let t = String(e || "").toLowerCase(); return t.includes("high_noise") || t.includes("high-noise") || t.includes("high noise") ? "high" : t.includes("low_noise") || t.includes("low-noise") || t.includes("low noise") ? "low" : ""; } -function fo(e) { +function mo(e) { return Array.isArray(e) || e && typeof e == "object" ? !1 : $(e) && String(e).trim() !== "-"; } -function po(e) { +function ho(e) { return typeof e == "number" ? Math.abs(e - Math.round(e)) < 1e-9 ? String(Math.round(e)) : e.toFixed(2).replace(/0+$/g, "").replace(/\.$/, "") : String(e ?? "").trim(); } -function mo(e) { +function go(e) { if (!$(e)) return null; let t = Number(e); return !Number.isFinite(t) || t <= 0 ? null : e; } -function ho(e, t) { - let n = mo(e.seed); +function _o(e, t) { + let n = go(e.seed); if (n !== null) return n; let r = [Array.isArray(e.chained_passes) ? e.chained_passes : [], Array.isArray(e.all_samplers) ? e.all_samplers : []]; for (let e of r) for (let t of e) { - let e = mo(t?.seed_val ?? t?.seed); + let e = go(t?.seed_val ?? t?.seed); if (e !== null) return e; } for (let e of t || []) { - let t = mo(co(e.fields || [], ["Seed"])?.value); + let t = go(uo(e.fields || [], ["Seed"])?.value); if (t !== null) return t; } return null; } -function go(e, t) { - if (!t || !fo(t.value)) return; - let n = `${String(t.label || "").toLowerCase()}::${po(t.value)}`; - e.some((e) => `${String(e.label || "").toLowerCase()}::${po(e.value)}` === n) || e.push({ +function vo(e, t) { + if (!t || !mo(t.value)) return; + let n = `${String(t.label || "").toLowerCase()}::${ho(t.value)}`; + e.some((e) => `${String(e.label || "").toLowerCase()}::${ho(e.value)}` === n) || e.push({ ...t, - value: po(t.value) + value: ho(t.value) }); } -function _o(e, t, n, r) { +function yo(e, t, n, r) { let i = /* @__PURE__ */ new Map(), a = (e, t) => { - let n = oo(e || t || "branch") || "branch"; + let n = co(e || t || "branch") || "branch"; n.includes("high") && (n = "high"), n.includes("low") && (n = "low"); let r = i.get(n); if (r) return r; let a = { key: n, - label: so(n, t), - accent: ao(n), + label: lo(n, t), + accent: so(n), modelFields: [], samplingFields: [], loras: [] @@ -4547,7 +4588,7 @@ function _o(e, t, n, r) { return i.set(n, a), a; }, o = (e, t, n) => { let r = String(n || "").trim(); - r && (e.modelFields.some((e) => String(e.label || "").toLowerCase() === String(t || "").toLowerCase() && Pt(e.value) === Pt(r)) || e.modelFields.push({ + r && (e.modelFields.some((e) => String(e.label || "").toLowerCase() === String(t || "").toLowerCase() && It(e.value) === It(r)) || e.modelFields.push({ label: t, value: r })); @@ -4562,7 +4603,7 @@ function _o(e, t, n, r) { } let c = e.models && typeof e.models == "object" ? e.models : null; if (c) { - let t = Q(c.unet), n = uo(t), r = Q(c.checkpoint || (n ? null : c.unet) || e.model || e.checkpoint), i = Q(c.unet_high_noise) || (n === "high" ? t : ""), l = Q(c.unet_low_noise) || (n === "low" ? t : ""), u = Q(c.clip), d = Q(c.vae), f = Array.isArray(e.loras) ? e.loras.map((e) => Mt(e)).filter(Boolean) : [], p = !!(i || l), m = !p && (r || u || d || f.length) ? a("base", "Base") : null, h = p && (u || d) ? a("shared", "Shared") : null, g = i ? a("high", "High") : null, _ = l ? a("low", "Low") : null; + let t = Q(c.unet), n = po(t), r = Q(c.checkpoint || (n ? null : c.unet) || e.model || e.checkpoint), i = Q(c.unet_high_noise) || (n === "high" ? t : ""), l = Q(c.unet_low_noise) || (n === "low" ? t : ""), u = Q(c.clip), d = Q(c.vae), f = Array.isArray(e.loras) ? e.loras.map((e) => Pt(e)).filter(Boolean) : [], p = !!(i || l), m = !p && (r || u || d || f.length) ? a("base", "Base") : null, h = p && (u || d) ? a("shared", "Shared") : null, g = i ? a("high", "High") : null, _ = l ? a("low", "Low") : null; if (m) { r && o(m, e.model || e.checkpoint || c.checkpoint ? "Model" : "UNet", r), u && o(m, "CLIP", u), d && o(m, "VAE", d); for (let e of f) s(m, e); @@ -4570,22 +4611,22 @@ function _o(e, t, n, r) { h && (u && o(h, "CLIP", u), d && o(h, "VAE", d)), g && o(g, "UNet", i), _ && o(_, "UNet", l); } let l = i.get("high") || i.get("high_noise"), u = i.get("low") || i.get("low_noise"), d = [ - co(n, ["Sampler"]), - co(n, ["Scheduler"]), - co(n, ["Steps"]), - co(n, ["Seed"]) - ].filter(Boolean), f = lo("CFG", e.cfg_high_noise), p = lo("CFG", e.cfg_low_noise); - l && [...d, ...f ? [f] : []].forEach((e) => go(l.samplingFields, e)), u && [...d, ...p ? [p] : []].forEach((e) => go(u.samplingFields, e)); - let m = (r || []).some((e) => oo(e.label).includes("upscale")), h = (r || []).length === 2 && (r || []).every((e) => ["base", "pass_2"].includes(oo(e.label))); + uo(n, ["Sampler"]), + uo(n, ["Scheduler"]), + uo(n, ["Steps"]), + uo(n, ["Seed"]) + ].filter(Boolean), f = fo("CFG", e.cfg_high_noise), p = fo("CFG", e.cfg_low_noise); + l && [...d, ...f ? [f] : []].forEach((e) => vo(l.samplingFields, e)), u && [...d, ...p ? [p] : []].forEach((e) => vo(u.samplingFields, e)); + let m = (r || []).some((e) => co(e.label).includes("upscale")), h = (r || []).length === 2 && (r || []).every((e) => ["base", "pass_2"].includes(co(e.label))); for (let [e, t] of (r || []).entries()) { - let n = oo(t.label); + let n = co(t.label); if (!n) continue; - let i = (r || []).filter((e) => oo(e.label) === oo(t.label)).length, o = oo(t.stage), s = o ? (r || []).filter((e) => oo(e.stage) === o).length : 0, c = co(t.fields || [], ["Model"]), d = uo(c?.value); + let i = (r || []).filter((e) => co(e.label) === co(t.label)).length, o = co(t.stage), s = o ? (r || []).filter((e) => co(e.stage) === o).length : 0, c = uo(t.fields || [], ["Model"]), d = po(c?.value); ["high", "low"].includes(n) || (d ? n = d : s > 1 || i > 1 ? n = `pass_${e + 1}` : h ? n = e === 0 ? "high" : "low" : n === "base" && l && u ? n = "high" : ["text_to_image", "image_to_image"].includes(n) && (n = m ? "low" : "base")), n.includes("upscale") && m && (n = "high"); let f = a(n, t.label); if (!/^pass_\d+$/i.test(n) && c && String(c.value || "") !== "-") { - let e = Pt(c.value); - f.modelFields.some((t) => Pt(t.value) === e) || f.modelFields.push(c); + let e = It(c.value); + f.modelFields.some((t) => It(t.value) === e) || f.modelFields.push(c); } for (let e of t.fields || []) [ "Sampler", @@ -4596,11 +4637,11 @@ function _o(e, t, n, r) { "Seed", "Start", "End" - ].includes(String(e.label || "")) && go(f.samplingFields, e); + ].includes(String(e.label || "")) && vo(f.samplingFields, e); } return Array.from(i.values()).filter((e) => e.modelFields.length || e.samplingFields.length || e.loras.length); } -function vo(e, t, n, r) { +function bo(e, t, n, r) { let i = [], a = (e, t, n, r) => { let a = r.filter((e) => e && $(e.value) && String(e.value) !== "-"); a.length && i.push({ @@ -4611,24 +4652,24 @@ function vo(e, t, n, r) { }); }; for (let n of t || []) { - let t = oo(n.label), r = (n.fields || []).some((e) => { + let t = co(n.label), r = (n.fields || []).some((e) => { let t = String(e?.label || "").toLowerCase(), n = String(e?.value || "").toLowerCase(); return t.includes("upscaler") || n.includes("upscale") || n.includes("upscaler") || /(?:^|[_\s-])to[_\s-]?\d{3,5}(?:[_\s.-]|$)/i.test(n); }); t.includes("upscale") && (e.upscaler || r) && a("upscale", "Upscale", "#66BB6A", n.fields || []), (t.includes("interpolation") || t.includes("rife") || t.includes("film")) && a("interpolation", "Interpolation", "#26C6DA", n.fields || []); } a("audio", "MMAudio", "#26A69A", [ - lo("Voice", e.voice), - lo("Language", e.language), - lo("Temperature", e.temperature), - lo("Lyrics Strength", e.lyrics_strength) + fo("Voice", e.voice), + fo("Language", e.language), + fo("Temperature", e.temperature), + fo("Lyrics Strength", e.lyrics_strength) ].filter(Boolean)), a("interpolation", "Interpolation", "#26C6DA", [ - lo("Engine", e.interpolation_engine || e.frame_interpolation || e.interpolator), - lo("Source FPS", e.source_fps || e.input_fps), - lo("Final FPS", e.final_fps || e.output_fps || e.fps) + fo("Engine", e.interpolation_engine || e.frame_interpolation || e.interpolator), + fo("Source FPS", e.source_fps || e.input_fps), + fo("Final FPS", e.final_fps || e.output_fps || e.fps) ].filter(Boolean)); for (let e of n || []) i.push({ - key: oo(e.title) || `module_${i.length}`, + key: co(e.title) || `module_${i.length}`, title: e.title, accent: e.color || "#2196F3", fields: [{ @@ -4636,32 +4677,32 @@ function vo(e, t, n, r) { value: e.content }] }); - r && !i.some((e) => String(e.title).toLowerCase() === String(r).toLowerCase()) && a("workflow_engine", r, "#2196F3", [lo("Engine", r)].filter(Boolean)); + r && !i.some((e) => String(e.title).toLowerCase() === String(r).toLowerCase()) && a("workflow_engine", r, "#2196F3", [fo("Engine", r)].filter(Boolean)); let o = /* @__PURE__ */ new Set(); return i.filter((e) => { let t = `${e.key}:${e.title}:${JSON.stringify(e.fields)}`; return !o.has(t) && (o.add(t), !0); }); } -function yo(e) { +function xo(e) { return new Set(Array.isArray(e.override_fields) ? e.override_fields.map((e) => String(e || "").trim()).filter(Boolean) : []); } -function bo(e, ...t) { +function So(e, ...t) { return t.some((t) => e.has(t)); } -function xo(e) { +function Co(e) { return Array.isArray(e) ? e.filter((e) => e && typeof e == "object").map((e, t) => ({ title: String(e.title || O("sidebar.generation.customInfoN", "Custom Info {n}", { n: t + 1 })).trim(), content: String(e.content ?? e.value ?? "").trim(), color: /^#[0-9a-fA-F]{6}$/.test(String(e.color || "").trim()) ? String(e.color).trim() : "#2196F3" })).filter((e) => e.content) : []; } -function So(e) { +function wo(e) { if (!e || typeof e != "object") return null; let t = [], n = (e, n) => { $(n) && t.push({ label: e, - value: po(n) + value: ho(n) }); }; n("FPS", e.frame_rate), n("Frames", e.duration_frames), n("Duration", e.duration_seconds), ($(e.width) || $(e.height)) && t.push({ @@ -4670,7 +4711,7 @@ function So(e) { }); let r = Array.isArray(e.segments) ? e.segments.map((e, t) => { if (!e || typeof e != "object") return null; - let n = Nt(e.prompt || e.text || ""), r = String(e.filename || e.imageFile || e.videoFile || e.audioFile || "").trim(), i = String(e.filepath || e.path || r).trim(), a = String(e.in || e.in_label || e.start || e.start_frame || "").trim(), o = String(e.out || e.out_label || e.end || e.end_frame || "").trim(); + let n = Ft(e.prompt || e.text || ""), r = String(e.filename || e.imageFile || e.videoFile || e.audioFile || "").trim(), i = String(e.filepath || e.path || r).trim(), a = String(e.in || e.in_label || e.start || e.start_frame || "").trim(), o = String(e.out || e.out_label || e.end || e.end_frame || "").trim(); if (!n && !r && !a && !o) return null; let s = String(e.type || "").trim().toLowerCase(), c = s === "video" || /\.(mp4|mov|webm|mkv|avi|m4v)$/i.test(r), l = s === "audio" || /\.(mp3|wav|flac|ogg|m4a|aac|opus)$/i.test(r); return { @@ -4684,14 +4725,14 @@ function So(e) { type: String(e.type || "").trim(), isVideo: c, isAudio: l, - previewCandidates: r ? qa({ + previewCandidates: r ? Ya({ filename: r, filepath: i, folder_type: String(e.folder_type || e.folderType || "input").trim(), subfolder: String(e.subfolder || "").trim() }) : [] }; - }).filter(Boolean) : [], i = Nt(e.global_prompt || e.globalPrompt || ""); + }).filter(Boolean) : [], i = Ft(e.global_prompt || e.globalPrompt || ""); return !i && !r.length && !t.length ? null : { title: String(e.title || "LTX Director").trim(), globalPrompt: i, @@ -4699,12 +4740,12 @@ function So(e) { segments: r }; } -function Co(e) { +function To(e) { if (!e || typeof e != "object") return null; - let t = e.payload && typeof e.payload == "object" ? e.payload : e, n = typeof e.json == "string" && e.json.trim() ? e.json.trim() : JSON.stringify(t, null, 2), r = Nt(e.high_level_description || e.highLevelDescription || t.high_level_description || ""), i = Nt(e.background || t.background || ""), a = [], o = (e, t) => { + let t = e.payload && typeof e.payload == "object" ? e.payload : e, n = typeof e.json == "string" && e.json.trim() ? e.json.trim() : JSON.stringify(t, null, 2), r = Ft(e.high_level_description || e.highLevelDescription || t.high_level_description || ""), i = Ft(e.background || t.background || ""), a = [], o = (e, t) => { $(t) && a.push({ label: e, - value: po(t) + value: ho(t) }); }; o("Style", t.style), o("Photo Style", t.photo_style || t["style.photo"]), o("Medium", t.medium), o("Lighting", t.lighting), o("Aesthetics", t.aesthetics), o("BG Brightness", t.bg_brightness), ($(t.width) || $(t.height)) && a.push({ @@ -4738,8 +4779,8 @@ function Co(e) { colorPalette: c.map((e) => String(e || "").trim()).filter(Boolean) }; } -function wo(e) { - let t = $a(e), n = { +function Eo(e) { + let t = to(e), n = { kind: "empty", title: O("sidebar.generation.title", "Generation"), workflowType: "", @@ -4755,7 +4796,7 @@ function wo(e) { showAlignment: !1, captionLabel: O("sidebar.generation.imageDescription", "Image Description"), emptyCaptionText: O("sidebar.generation.noImageDescription", "No image description yet."), - isImageAsset: Va(e), + isImageAsset: Ua(e), lyrics: "", modelFields: [], modelGroups: [], @@ -4778,26 +4819,26 @@ function wo(e) { ltxDirector: null, ideogram: null }; - if (!t || typeof t == "object" && Object.keys(t).length === 0 || !eo(t)) { + if (!t || typeof t == "object" && Object.keys(t).length === 0 || !no(t)) { let t = e?.metadata_raw?.geninfo_status || e?.geninfo_status; return t && typeof t == "object" && t.kind === "media_pipeline" ? { ...n, kind: "media-only", mediaOnlyMessage: O("sidebar.generation.mediaOnlyPipeline", "This file looks like a media-only pipeline (e.g. LoadVideo/VideoCombine) and does not contain generation parameters.") - } : Va(e) || Ha(e) ? { + } : Ua(e) || Wa(e) ? { ...n, kind: "caption-only", showAlignment: !1 } : n; } - let r = t, i = So(r.ltx_director), a = Co(r.ideogram), o = yo(r), s = r.engine && typeof r.engine == "object" ? r.engine : null, c = !!(r.is_override || s?.mode === "override" || s?.parser_version === "geninfo-override-v1" || s?.source === "majoor_geninfo"), l = Ft(r), u = At(typeof r.prompt == "string" ? r.prompt : null, typeof (r.negative_prompt || r.negativePrompt) == "string" ? r.negative_prompt || r.negativePrompt : null), d = Array.isArray(r.all_positive_prompts) && r.all_positive_prompts.length > 1 ? r.all_positive_prompts.map((e, t) => { - let n = At(typeof e == "string" ? e : "", typeof r.all_negative_prompts?.[t] == "string" ? r.all_negative_prompts[t] : ""); + let r = t, i = wo(r.ltx_director), a = To(r.ideogram), o = xo(r), s = r.engine && typeof r.engine == "object" ? r.engine : null, c = !!(r.is_override || s?.mode === "override" || s?.parser_version === "geninfo-override-v1" || s?.source === "majoor_geninfo"), l = Lt(r), u = Mt(typeof r.prompt == "string" ? r.prompt : null, typeof (r.negative_prompt || r.negativePrompt) == "string" ? r.negative_prompt || r.negativePrompt : null), d = Array.isArray(r.all_positive_prompts) && r.all_positive_prompts.length > 1 ? r.all_positive_prompts.map((e, t) => { + let n = Mt(typeof e == "string" ? e : "", typeof r.all_negative_prompts?.[t] == "string" ? r.all_negative_prompts[t] : ""); return { label: O("sidebar.generation.promptN", "Prompt {n}", { n: t + 1 }), - positive: Nt(n.positive), - negative: Nt(n.negative) + positive: Ft(n.positive), + negative: Ft(n.negative) }; - }).filter((e) => e.positive) : [], f = [], p = /* @__PURE__ */ new Set(), m = r.models && typeof r.models == "object" ? r.models : null, h = ro(r), g = new Set(h.map((e) => String(e.model || "").trim()).filter(Boolean)), _ = Array.isArray(r.all_checkpoints) && r.all_checkpoints.length > 1 ? r.all_checkpoints : null; + }).filter((e) => e.positive) : [], f = [], p = /* @__PURE__ */ new Set(), m = r.models && typeof r.models == "object" ? r.models : null, h = ao(r), g = new Set(h.map((e) => String(e.model || "").trim()).filter(Boolean)), _ = Array.isArray(r.all_checkpoints) && r.all_checkpoints.length > 1 ? r.all_checkpoints : null; if (m) { let e = new Set([ Q(m.unet_high_noise), @@ -4806,11 +4847,11 @@ function wo(e) { ].filter(Boolean)); if (_) _.forEach((e, t) => { let n = Q(e); - to(f, p, O("sidebar.generation.checkpointN", "Checkpoint {n}", { n: t + 1 }), n); + ro(f, p, O("sidebar.generation.checkpointN", "Checkpoint {n}", { n: t + 1 }), n); }); else { let t = Q(m.checkpoint); - t && !e.has(t) && to(f, p, O("sidebar.generation.checkpoint", "Checkpoint"), t); + t && !e.has(t) && ro(f, p, O("sidebar.generation.checkpoint", "Checkpoint"), t); } [ ["UNet", Q(m.unet)], @@ -4819,37 +4860,37 @@ function wo(e) { ["CLIP", Q(m.clip)], ["VAE", Q(m.vae)] ].forEach(([t, n]) => { - e.has(n) || to(f, p, t, n); + e.has(n) || ro(f, p, t, n); }); - } else (r.model || r.checkpoint) && to(f, p, O("sidebar.generation.model", "Model"), Pt(r.model || r.checkpoint)); + } else (r.model || r.checkpoint) && ro(f, p, O("sidebar.generation.model", "Model"), It(r.model || r.checkpoint)); if (Array.isArray(r.loras) && r.loras.length > 0) { - let e = r.loras.map((e) => Mt(e)).filter(Boolean).join("\n"); - e && to(f, p, r.loras.length > 1 ? O("sidebar.generation.loras", "LoRAs") : "LoRA", e); + let e = r.loras.map((e) => Pt(e)).filter(Boolean).join("\n"); + e && ro(f, p, r.loras.length > 1 ? O("sidebar.generation.loras", "LoRAs") : "LoRA", e); } - !m && r.clip && to(f, p, "CLIP", Pt(r.clip)), !m && r.vae && to(f, p, "VAE", Pt(r.vae)), !m && r.unet && to(f, p, "UNet", Pt(r.unet)), !m && r.diffusion && to(f, p, "Diffusion", Pt(r.diffusion)), !m && r.upscaler && to(f, p, O("sidebar.generation.upscaler", "Upscaler"), Pt(r.upscaler)), m && r.clip && to(f, p, "CLIP", Pt(r.clip)), m && r.vae && to(f, p, "VAE", Pt(r.vae)); + !m && r.clip && ro(f, p, "CLIP", It(r.clip)), !m && r.vae && ro(f, p, "VAE", It(r.vae)), !m && r.unet && ro(f, p, "UNet", It(r.unet)), !m && r.diffusion && ro(f, p, "Diffusion", It(r.diffusion)), !m && r.upscaler && ro(f, p, O("sidebar.generation.upscaler", "Upscaler"), It(r.upscaler)), m && r.clip && ro(f, p, "CLIP", It(r.clip)), m && r.vae && ro(f, p, "VAE", It(r.vae)); for (let e of f) { let t = String(e.label || "").toLowerCase(); - (t.includes("checkpoint") || t === "model") && (e.override = bo(o, "checkpoint", "model")), t === "clip" && (e.override = bo(o, "clip")), t === "vae" && (e.override = bo(o, "vae")), t.includes("lora") && (e.override = bo(o, "loras")); + (t.includes("checkpoint") || t === "model") && (e.override = So(o, "checkpoint", "model")), t === "clip" && (e.override = So(o, "clip")), t === "vae" && (e.override = So(o, "vae")), t.includes("lora") && (e.override = So(o, "loras")); } let v = []; $(r.seed) && v.push({ label: O("sidebar.generation.seed", "Seed"), value: r.seed, - override: bo(o, "seed") + override: So(o, "seed") }), (r.sampler || r.sampler_name) && v.push({ label: O("sidebar.generation.sampler", "Sampler"), value: r.sampler || r.sampler_name, - override: bo(o, "sampler", "sampler_name") + override: So(o, "sampler", "sampler_name") }), $(r.steps) && v.push({ label: O("sidebar.generation.steps", "Steps"), value: r.steps, - override: bo(o, "steps") + override: So(o, "steps") }); let y = $(r.cfg) ? r.cfg : r.cfg_scale; $(y) && v.push({ label: O("sidebar.generation.cfgScale", "CFG Scale"), value: y, - override: bo(o, "cfg", "cfg_scale") + override: So(o, "cfg", "cfg_scale") }), r.cfg_high_noise !== void 0 && r.cfg_high_noise !== null && v.push({ label: O("sidebar.generation.cfgHighNoise", "CFG High Noise"), value: r.cfg_high_noise @@ -4859,17 +4900,17 @@ function wo(e) { }), r.scheduler && v.push({ label: O("sidebar.generation.scheduler", "Scheduler"), value: r.scheduler, - override: bo(o, "scheduler") + override: So(o, "scheduler") }); let b = $(r.denoise) ? r.denoise : r.denoising; $(b) && v.push({ label: O("sidebar.generation.denoise", "Denoise"), value: b, - override: bo(o, "denoise", "denoising") + override: So(o, "denoise", "denoising") }); let x = []; Array.isArray(r.chained_passes) && r.chained_passes.length > 1 ? x = r.chained_passes.filter((e) => e && typeof e == "object").map((e, t) => ({ - label: Xa(e, t), + label: Qa(e, t), stage: String(e?.pass_stage || "").trim(), fields: [ { @@ -4910,7 +4951,7 @@ function wo(e) { } ] })) : Array.isArray(r.all_samplers) && r.all_samplers.length > 1 && (x = r.all_samplers.filter((e) => e && typeof e == "object").map((e, t) => ({ - label: Xa(e, t), + label: Qa(e, t), stage: String(e?.pass_stage || "").trim(), fields: [ { @@ -4991,13 +5032,13 @@ function wo(e) { label: O("sidebar.generation.compileMode", "Compile Mode"), value: r.compile_mode }), [ - io(O("sidebar.generation.torchCompile", "Torch Compile"), r.use_torch_compile), - io(O("sidebar.generation.cudaGraphs", "CUDA Graphs"), r.use_cuda_graphs), - io(O("sidebar.generation.xVectorOnly", "X-Vector Only"), r.x_vector_only_mode) + oo(O("sidebar.generation.torchCompile", "Torch Compile"), r.use_torch_compile), + oo(O("sidebar.generation.cudaGraphs", "CUDA Graphs"), r.use_cuda_graphs), + oo(O("sidebar.generation.xVectorOnly", "X-Vector Only"), r.x_vector_only_mode) ].filter(Boolean).forEach((e) => C.push(e)); let ee = []; [ - io(O("sidebar.generation.chunking", "Chunking"), r.enable_chunking), + oo(O("sidebar.generation.chunking", "Chunking"), r.enable_chunking), r.max_chars_per_chunk !== void 0 && r.max_chars_per_chunk !== null ? { label: O("sidebar.generation.maxCharsChunk", "Max Chars/Chunk"), value: r.max_chars_per_chunk @@ -5010,7 +5051,7 @@ function wo(e) { label: O("sidebar.generation.silenceBetweenChunks", "Silence Between Chunks (ms)"), value: r.silence_between_chunks_ms } : null, - io(O("sidebar.generation.audioCache", "Audio Cache"), r.enable_audio_cache), + oo(O("sidebar.generation.audioCache", "Audio Cache"), r.enable_audio_cache), r.batch_size !== void 0 && r.batch_size !== null ? { label: O("sidebar.generation.batchSize", "Batch Size"), value: r.batch_size @@ -5021,33 +5062,33 @@ function wo(e) { label: O("sidebar.generation.lyricsStrength", "Lyrics Strength"), value: r.lyrics_strength }); - let w = []; - $(b) && !v.some((e) => e.label === "Denoise") && w.push({ + let ne = []; + $(b) && !v.some((e) => e.label === "Denoise") && ne.push({ label: O("sidebar.generation.denoise", "Denoise"), value: b - }), $(r.clip_skip) && w.push({ + }), $(r.clip_skip) && ne.push({ label: O("sidebar.generation.clipSkip", "Clip Skip"), value: r.clip_skip }); - let T = [], ne = String(r.workflow_notes || r.notes || "").trim(); - ne && T.push({ + let w = [], T = String(r.workflow_notes || r.notes || "").trim(); + T && w.push({ label: O("sidebar.generation.workflowNotes", "Workflow Notes"), - value: ne, - override: bo(o, "workflow_notes", "notes") + value: T, + override: So(o, "workflow_notes", "notes") }); - let re = xo(r.custom_info), ie = _o(r, h, v, x), E = vo(r, x, re, l.workflowType), ae = ho(r, x), oe = Array.isArray(r.inputs) ? r.inputs.filter((e) => e && typeof e == "object" && e.filename).map((e, t) => ({ + let E = Co(r.custom_info), re = yo(r, h, v, x), D = bo(r, x, E, l.workflowType), ie = _o(r, x), ae = Array.isArray(r.inputs) ? r.inputs.filter((e) => e && typeof e == "object" && e.filename).map((e, t) => ({ id: `${e.filename}-${t}`, filename: String(e.filename || "").trim(), subfolder: String(e.subfolder || "").trim(), type: String(e.folder_type || "input").trim().toLowerCase(), root_id: String(e.root_id || e.rootId || "").trim(), kind: String(e.kind || e.media_kind || e.type || "").trim().toLowerCase(), - filepath: Ja(e), + filepath: Xa(e), role: String(e.role || "").trim(), roleLabel: String(e.role || "").trim().replace(/_/g, " "), isVideo: String(e.type || "").toLowerCase() === "video" || /\.(mp4|mov|webm)$/i.test(String(e.filename || "")), isAudio: String(e.type || "").toLowerCase() === "audio" || /\.(wav|mp3|flac|ogg|m4a|aac|opus)$/i.test(String(e.filename || "")), - previewCandidates: qa(e) + previewCandidates: Ya(e) })) : []; return { ...n, @@ -5059,15 +5100,15 @@ function wo(e) { isTruncated: !!(e?.geninfo?._truncated || e?.metadata?._truncated || e?.prompt?._truncated), positivePrompt: d.length || a ? "" : String(u.positive || "").trim(), negativePrompt: d.length ? "" : String(u.negative || "").trim(), - positivePromptOverride: bo(o, "prompt", "positive", "positive_prompt"), - negativePromptOverride: bo(o, "negative_prompt", "negative", "negativePrompt"), + positivePromptOverride: So(o, "prompt", "positive", "positive_prompt"), + negativePromptOverride: So(o, "negative_prompt", "negative", "negativePrompt"), promptTabs: d, showAlignment: !!e?.id && (!!String(u.positive || "").trim() || d.length > 0), - isImageAsset: Va(e), + isImageAsset: Ua(e), lyrics: String(r.lyrics || "").trim(), modelFields: f, modelGroups: h, - branchCards: ie, + branchCards: re, pipelineTabs: x, samplingFields: v, ttsFields: S, @@ -5075,21 +5116,21 @@ function wo(e) { ttsInstruction: String(r.instruct || "").trim(), ttsRuntimeFields: ee, audioFields: te, - seed: ae, - imageFields: w, - inputFiles: oe, + seed: ie, + imageFields: ne, + inputFiles: ae, isOverride: c, overrideLabel: c ? "Gen Info Override" : "", - notesFields: T, - customInfoBlocks: re, - moduleBlocks: E, + notesFields: w, + customInfoBlocks: E, + moduleBlocks: D, ltxDirector: i, ideogram: a }; } //#endregion //#region ui/vue/components/panel/sidebar/GenerationInputThumb.vue?vue&type=script&setup=true&lang.ts -var To = ["title"], Eo = ["src"], Do = { +var Do = ["title"], Oo = ["src"], ko = { key: 1, style: { width: "100%", @@ -5104,14 +5145,14 @@ var To = ["title"], Eo = ["src"], Do = { padding: "6px", "text-align": "center" } -}, Oo = { style: { +}, Ao = { style: { "font-size": "8px", "font-weight": "700", "max-width": "54px", "white-space": "nowrap", overflow: "hidden", "text-overflow": "ellipsis" -} }, ko = ["src"], Ao = { +} }, jo = ["src"], Mo = { key: 3, style: { position: "absolute", @@ -5127,7 +5168,7 @@ var To = ["title"], Eo = ["src"], Do = { overflow: "hidden", "text-overflow": "ellipsis" } -}, jo = { +}, No = { key: 4, title: "Video file", style: { @@ -5137,59 +5178,59 @@ var To = ["title"], Eo = ["src"], Do = { "font-size": "16px", "pointer-events": "none" } -}, Mo = /* @__PURE__ */ tt({ +}, Po = /* @__PURE__ */ rt({ __name: "GenerationInputThumb", props: { inputFile: {} }, setup(e) { - let t = e, n = V(0), r = V(!1), i = null; - function a() { - return i ||= import("./floatingViewerManager-Crq2oCKD.js").then((e) => e.n), i; - } + let n = e, r = V(0), i = V(!1), a = null; function o() { - return (Array.isArray(t.inputFile?.previewCandidates) ? t.inputFile.previewCandidates : [])[n.value] || ""; + return a ||= import("./floatingViewerManager-XH4AFW4G.js").then((e) => e.n), a; } function s() { - let e = Array.isArray(t.inputFile?.previewCandidates) ? t.inputFile.previewCandidates : []; - n.value < e.length - 1 && (n.value += 1); + return (Array.isArray(n.inputFile?.previewCandidates) ? n.inputFile.previewCandidates : [])[r.value] || ""; } - async function c(e) { + function c() { + let e = Array.isArray(n.inputFile?.previewCandidates) ? n.inputFile.previewCandidates : []; + r.value < e.length - 1 && (r.value += 1); + } + async function l(e) { e?.stopPropagation?.(); - let n = String(t.inputFile?.filepath || t.inputFile?.filename || "").trim(); - if (n) try { - await navigator.clipboard.writeText(n), r.value = !0, setTimeout(() => { - r.value = !1; + let t = String(n.inputFile?.filepath || n.inputFile?.filename || "").trim(); + if (t) try { + await navigator.clipboard.writeText(t), i.value = !0, setTimeout(() => { + i.value = !1; }, 350); } catch (e) { console.debug?.(e); } } - function l(e) { - e?.stopPropagation?.(), h(); + function u(e) { + e?.stopPropagation?.(), g(); } - function u() { - let e = t.inputFile || {}, n = String(e.filepath || "").trim(); + function d() { + let e = n.inputFile || {}, t = String(e.filepath || "").trim(); return { filename: e.filename || "", name: e.filename || "", - filepath: n, - path: n, + filepath: t, + path: t, subfolder: e.subfolder || "", type: e.type || "input", source: e.type || "input", - kind: d(e), + kind: f(e), root_id: e.root_id || "", - preview_url: o() + preview_url: s() }; } - function d(e = t.inputFile || {}) { - let n = String(e.kind || "").trim().toLowerCase(); - if (n === "image" || n === "video" || n === "audio" || n === "model3d") return n; + function f(e = n.inputFile || {}) { + let t = String(e.kind || "").trim().toLowerCase(); + if (t === "image" || t === "video" || t === "audio" || t === "model3d") return t; if (e.isVideo) return "video"; if (e.isAudio) return "audio"; let r = String(e.filename || "").toLowerCase(); return /\.(mp4|mov|webm|mkv|avi|m4v)$/i.test(r) ? "video" : /\.(wav|mp3|flac|ogg|m4a|aac|opus)$/i.test(r) ? "audio" : /\.(glb|gltf|obj|stl|ply|fbx)$/i.test(r) ? "model3d" : "image"; } - function f(e, t, n, { disabled: r = !1 } = {}) { + function p(e, t, n, { disabled: r = !1 } = {}) { return { id: `mjr-generation-source-${String(e).toLowerCase().replace(/[^a-z0-9]+/g, "-")}`, type: "item", @@ -5201,107 +5242,107 @@ var To = ["title"], Eo = ["src"], Do = { action: n }; } - function p() { + function m() { return { id: "mjr-generation-source-separator", type: "separator" }; } - function m() { - return Ya(o()) || !!t.inputFile?.filename || !!t.inputFile?.filepath; - } function h() { - let e = u(); - if (kt({ + return Za(s()) || !!n.inputFile?.filename || !!n.inputFile?.filepath; + } + function g() { + let e = d(); + if (jt({ asset: e, index: 0 })) return; - let t = o(); - if (Ya(t)) try { + let t = s(); + if (Za(t)) try { window.open(t, "_blank", "noopener,noreferrer"); } catch (e) { console.debug?.(e); } } - async function g() { + async function _() { try { - let { floatingViewerManager: e } = await a(); + let { floatingViewerManager: e } = await o(); await e.openAssets({ - assets: [u()], + assets: [d()], index: 0 }); } catch (e) { - console.debug?.(e), E(O("toast.viewerOpenFailed", "Failed to open viewer."), "error"); + console.debug?.(e), t(O("toast.viewerOpenFailed", "Failed to open viewer."), "error"); } } - async function _() { - let e = await le(u()); - if (!e?.ok) { - E(e?.error || O("toast.openFolderFailed", "Failed to open folder."), "error"); - return; - } - E(O("toast.openedInFolder", "Opened in folder"), "info", 1600); - } async function v() { - let e = u(), t = { + let e = await pe(d()); + if (!e?.ok) { + t(e?.error || O("toast.openFolderFailed", "Failed to open folder."), "error"); + return; + } + t(O("toast.openedInFolder", "Opened in folder"), "info", 1600); + } + async function y() { + let e = d(), n = { filename: e.filename, subfolder: e.subfolder, type: e.type || "input", root_id: e.root_id || void 0, kind: e.kind - }, n = await Li({ - post: D, - endpoint: Re.STAGE_TO_INPUT, - payload: t, + }, r = await zi({ + post: ge, + endpoint: Be.STAGE_TO_INPUT, + payload: n, index: !1 }); - if (!n?.relativePath) { - E(O("toast.loadAssetFailed", "Failed to load asset."), "error"); + if (!r?.relativePath) { + t(O("toast.loadAssetFailed", "Failed to load asset."), "error"); return; } - if (!Ni({ - app: Pe(), + if (!Fi({ + app: Ie(), items: [{ - payload: t, - relativePath: n.relativePath, - droppedExt: String(t.filename || "").split(".").pop() || "" + payload: n, + relativePath: r.relativePath, + droppedExt: String(n.filename || "").split(".").pop() || "" }], event: null })) { - E(O("toast.loadAssetFailed", "Failed to load asset."), "error"); + t(O("toast.loadAssetFailed", "Failed to load asset."), "error"); return; } - let r = e.kind ? e.kind.charAt(0).toUpperCase() + e.kind.slice(1) : "Asset"; - E(O("toast.assetLoadedToCanvas", "{kind} loader added to canvas.", { kind: r }), "success", 1800); + let i = e.kind ? e.kind.charAt(0).toUpperCase() + e.kind.slice(1) : "Asset"; + t(O("toast.assetLoadedToCanvas", "{kind} loader added to canvas.", { kind: i }), "success", 1800); } - function y(e) { + function b(e) { e?.preventDefault?.(), e?.stopPropagation?.(); - let n = d(), r = n === "video" ? O("ctx.loadVideo", "Load video") : n === "audio" ? O("ctx.loadAudio", "Load audio") : n === "model3d" ? O("ctx.loadModel3d", "Load 3D model") : O("ctx.loadImage", "Load image"); - Er({ + let t = f(), r = t === "video" ? O("ctx.loadVideo", "Load video") : t === "audio" ? O("ctx.loadAudio", "Load audio") : t === "model3d" ? O("ctx.loadModel3d", "Load 3D model") : O("ctx.loadImage", "Load image"); + Or({ x: e?.clientX || 0, y: e?.clientY || 0, items: [ - f(O("ctx.openInViewer", "Open in viewer"), "pi pi-eye", h, { disabled: !m() }), - f(O("ctx.openInFloatingViewer", "Open in Floating Viewer"), "pi pi-window-maximize", g, { disabled: !m() }), - f(O("ctx.openInFolder", "Open in folder"), "pi pi-folder-open", _, { disabled: !t.inputFile?.filepath }), - p(), - f(r, "pi pi-plus-circle", v, { disabled: !t.inputFile?.filename }), - f(O("ctx.copyPath", "Copy path"), "pi pi-copy", c, { disabled: !(t.inputFile?.filepath || t.inputFile?.filename) }) + p(O("ctx.openInViewer", "Open in viewer"), "pi pi-eye", g, { disabled: !h() }), + p(O("ctx.openInFloatingViewer", "Open in Floating Viewer"), "pi pi-window-maximize", _, { disabled: !h() }), + p(O("ctx.openInFolder", "Open in folder"), "pi pi-folder-open", v, { disabled: !n.inputFile?.filepath }), + m(), + p(r, "pi pi-plus-circle", y, { disabled: !n.inputFile?.filename }), + p(O("ctx.copyPath", "Copy path"), "pi pi-copy", l, { disabled: !(n.inputFile?.filepath || n.inputFile?.filename) }) ] }); } - function b(e) { + function x(e) { e.target?.play?.().catch?.(() => {}); } - function x(e) { + function S(e) { try { e.target?.pause?.(); } catch (e) { console.debug?.(e); } } - function S() { - return !!t.inputFile?.isAudio; + function C() { + return !!n.inputFile?.isAudio; } return (t, n) => (I(), z("div", { title: `${e.inputFile.filename} (click to copy, double-click to open in new tab)`, @@ -5316,15 +5357,15 @@ var To = ["title"], Eo = ["src"], Do = { display: "flex", alignItems: "center", justifyContent: "center", - outline: r.value ? "2px solid rgba(76, 175, 80, 0.9)" : "", - outlineOffset: r.value ? "1px" : "" + outline: i.value ? "2px solid rgba(76, 175, 80, 0.9)" : "", + outlineOffset: i.value ? "1px" : "" }), - onClick: c, - onDblclick: l, - onContextmenu: y + onClick: l, + onDblclick: u, + onContextmenu: b }, [e.inputFile.isVideo ? (I(), z("video", { key: 0, - src: o(), + src: s(), muted: "", loop: "", playsinline: "", @@ -5334,31 +5375,31 @@ var To = ["title"], Eo = ["src"], Do = { height: "100%", "object-fit": "cover" }, - onError: s, - onMouseover: b, - onMouseout: x - }, null, 40, Eo)) : S() ? (I(), z("div", Do, [n[0] ||= M("div", { style: { + onError: c, + onMouseover: x, + onMouseout: S + }, null, 40, Oo)) : C() ? (I(), z("div", ko, [n[0] ||= M("div", { style: { "font-size": "18px", "line-height": "1" - } }, "♪", -1), M("div", Oo, R(e.inputFile.filename), 1)])) : (I(), z("img", { + } }, "♪", -1), M("div", Ao, R(e.inputFile.filename), 1)])) : (I(), z("img", { key: 2, - src: o(), + src: s(), style: { width: "100%", height: "100%", "object-fit": "cover" }, - onError: s - }, null, 40, ko)), e.inputFile.role && e.inputFile.role !== "secondary" ? (I(), z("div", Ao, R(e.inputFile.roleLabel), 1)) : e.inputFile.isVideo ? (I(), z("div", jo, " Play ")) : N("", !0)], 44, To)); + onError: c + }, null, 40, jo)), e.inputFile.role && e.inputFile.role !== "secondary" ? (I(), z("div", Mo, R(e.inputFile.roleLabel), 1)) : e.inputFile.isVideo ? (I(), z("div", No, " Play ")) : N("", !0)], 44, Do)); } -}), No = { +}), Fo = { key: 0, style: { display: "flex", "flex-direction": "column", gap: "12px" } -}, Po = { +}, Io = { key: 0, style: { display: "flex", @@ -5373,44 +5414,31 @@ var To = ["title"], Eo = ["src"], Do = { fontSize: "11px", color: "var(--fg-color, #ccc)" } -}, Fo = { style: { opacity: "0.85" } }, Io = { style: { +}, Lo = { style: { opacity: "0.85" } }, Ro = { style: { display: "flex", "align-items": "center", gap: "8px", "flex-wrap": "wrap", "justify-content": "flex-end" -} }, Lo = ["title"], Ro = ["title"], zo = { style: { +} }, zo = ["title"], Bo = ["title"], Vo = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "10px" -} }, Bo = { style: { +} }, Ho = { style: { "font-size": "11px", "font-weight": "700", color: "#00BCD4", "text-transform": "uppercase", "letter-spacing": "0.6px" -} }, Vo = { style: { +} }, Uo = { style: { "font-size": "11px", color: "var(--fg-color, rgba(255,255,255,0.9))", "font-weight": "600" -} }, Ho = { style: { - "font-size": "11px", - "font-weight": "600", - color: "#FF9800", - "text-transform": "uppercase", - "letter-spacing": "0.5px", - "margin-bottom": "8px" -} }, Uo = { style: { - "font-size": "12px", - color: "var(--fg-color, rgba(255,255,255,0.9))", - "line-height": "1.5", - "white-space": "pre-wrap", - "word-break": "break-word" } }, Wo = { style: { "font-size": "11px", "font-weight": "600", - color: "#9E9E9E", + color: "#FF9800", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "8px" @@ -5421,18 +5449,31 @@ var To = ["title"], Eo = ["src"], Do = { "white-space": "pre-wrap", "word-break": "break-word" } }, Ko = { style: { + "font-size": "11px", + "font-weight": "600", + color: "#9E9E9E", + "text-transform": "uppercase", + "letter-spacing": "0.5px", + "margin-bottom": "8px" +} }, qo = { style: { + "font-size": "12px", + color: "var(--fg-color, rgba(255,255,255,0.9))", + "line-height": "1.5", + "white-space": "pre-wrap", + "word-break": "break-word" +} }, Jo = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "8px", "margin-bottom": "10px" -} }, qo = { style: { +} }, Yo = { style: { "font-size": "11px", "font-weight": "800", color: "#26C6DA", "text-transform": "uppercase", "letter-spacing": "0.5px" -} }, Jo = { +} }, Xo = { key: 0, style: { display: "grid", @@ -5440,18 +5481,18 @@ var To = ["title"], Eo = ["src"], Do = { gap: "8px", "margin-bottom": "10px" } -}, Yo = { style: { +}, Zo = { style: { "font-size": "9px", "font-weight": "800", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, Xo = { style: { +} }, Qo = { style: { "font-size": "12px", color: "var(--fg-color,#eee)", "font-weight": "650", "word-break": "break-word" -} }, Zo = { +} }, $o = { key: 1, style: { border: "1px solid rgba(76,175,80,0.36)", @@ -5460,32 +5501,32 @@ var To = ["title"], Eo = ["src"], Do = { padding: "10px", "margin-bottom": "10px" } -}, Qo = ["title"], $o = { +}, es = ["title"], ts = { key: 2, style: { display: "flex", "flex-direction": "column", gap: "8px" } -}, es = { style: { +}, ns = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "8px", "margin-bottom": "7px" -} }, ts = { style: { +} }, rs = { style: { "font-size": "10px", "font-weight": "800", color: "#26C6DA", "text-transform": "uppercase", "letter-spacing": "0.45px" -} }, ns = { style: { +} }, is = { style: { display: "flex", "align-items": "center", gap: "5px", "flex-wrap": "wrap", "justify-content": "flex-end" -} }, rs = { +} }, as = { key: 0, style: { "font-size": "10px", @@ -5496,7 +5537,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "2px 6px", "font-weight": "700" } -}, is = { +}, os = { key: 1, style: { "font-size": "10px", @@ -5507,15 +5548,15 @@ var To = ["title"], Eo = ["src"], Do = { padding: "2px 6px", "font-weight": "700" } -}, as = { style: { +}, ss = { style: { display: "flex", gap: "10px", "align-items": "flex-start", "min-width": "0" -} }, os = { style: { +} }, cs = { style: { "min-width": "0", flex: "1" -} }, ss = ["title", "onClick"], cs = { +} }, ls = ["title", "onClick"], us = { key: 1, style: { "font-size": "10px", @@ -5525,19 +5566,19 @@ var To = ["title"], Eo = ["src"], Do = { gap: "6px", "flex-wrap": "wrap" } -}, ls = { key: 0 }, us = { key: 1 }, ds = { style: { +}, ds = { key: 0 }, fs = { key: 1 }, ps = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "8px", "margin-bottom": "10px" -} }, fs = { style: { +} }, ms = { style: { "font-size": "11px", "font-weight": "800", color: "#FFB300", "text-transform": "uppercase", "letter-spacing": "0.5px" -} }, ps = { +} }, hs = { key: 0, style: { display: "grid", @@ -5545,18 +5586,18 @@ var To = ["title"], Eo = ["src"], Do = { gap: "8px", "margin-bottom": "10px" } -}, ms = { style: { +}, gs = { style: { "font-size": "9px", "font-weight": "800", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, hs = { style: { +} }, _s = { style: { "font-size": "12px", color: "var(--fg-color,#eee)", "font-weight": "650", "word-break": "break-word" -} }, gs = { +} }, vs = { key: 1, style: { border: "1px solid rgba(76,175,80,0.34)", @@ -5565,7 +5606,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "10px", "margin-bottom": "10px" } -}, _s = ["title"], vs = { +}, ys = ["title"], bs = { key: 2, style: { border: "1px solid rgba(33,150,243,0.32)", @@ -5574,7 +5615,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "10px", "margin-bottom": "10px" } -}, ys = ["title"], bs = { +}, xs = ["title"], Ss = { key: 3, style: { display: "flex", @@ -5582,19 +5623,19 @@ var To = ["title"], Eo = ["src"], Do = { gap: "8px", "margin-bottom": "10px" } -}, xs = { style: { +}, Cs = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "8px", "margin-bottom": "7px" -} }, Ss = { style: { +} }, ws = { style: { "font-size": "10px", "font-weight": "800", color: "#FFCA28", "text-transform": "uppercase", "letter-spacing": "0.45px" -} }, Cs = { +} }, Ts = { key: 0, style: { "font-size": "10px", @@ -5605,7 +5646,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "2px 6px", "font-weight": "700" } -}, ws = ["title", "onClick"], Ts = { +}, Es = ["title", "onClick"], Ds = { key: 1, style: { display: "flex", @@ -5613,35 +5654,35 @@ var To = ["title"], Eo = ["src"], Do = { gap: "5px", "margin-top": "8px" } -}, Es = ["title", "onClick"], Ds = { style: { +}, Os = ["title", "onClick"], ks = { style: { border: "1px solid rgba(255,179,0,0.30)", "border-radius": "6px", background: "rgba(0,0,0,0.16)", overflow: "hidden" -} }, Os = ["title"], ks = { style: { +} }, As = ["title"], js = { style: { "font-size": "11px", "font-weight": "600", color: "#4CAF50", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, As = { style: { +} }, Ms = { style: { display: "flex", "flex-wrap": "wrap", gap: "6px", "margin-bottom": "10px" -} }, js = { style: { +} }, Ns = { style: { "font-size": "10px", "font-weight": "700", color: "#4CAF50", "letter-spacing": "0.4px" -} }, Ms = ["onClick"], Ns = { style: { +} }, Ps = ["onClick"], Fs = { style: { "font-size": "10px", "font-weight": "700", color: "#F44336", "letter-spacing": "0.4px", "margin-top": "4px" -} }, Ps = ["onClick"], Fs = { style: { +} }, Is = ["onClick"], Ls = { style: { display: "flex", "justify-content": "space-between", "align-items": "center", @@ -5651,7 +5692,7 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "8px" -} }, Is = ["title"], Ls = ["title"], Rs = { style: { +} }, Rs = ["title"], zs = ["title"], Bs = { style: { display: "flex", "justify-content": "space-between", "align-items": "center", @@ -5661,7 +5702,7 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "8px" -} }, zs = ["title"], Bs = ["title"], Vs = { style: { +} }, Vs = ["title"], Hs = ["title"], Us = { style: { "font-size": "11px", "font-weight": "600", color: "#00BCD4", @@ -5670,17 +5711,17 @@ var To = ["title"], Eo = ["src"], Do = { display: "flex", "align-items": "center", "justify-content": "space-between" -} }, Hs = ["title"], Us = { style: { +} }, Ws = ["title"], Gs = { style: { display: "flex", "align-items": "center", gap: "10px" -} }, Ws = { style: { +} }, Ks = { style: { flex: "1", height: "8px", background: "rgba(255,255,255,0.1)", "border-radius": "4px", overflow: "hidden" -} }, Gs = { +} }, qs = { key: 0, style: { "font-size": "10px", @@ -5690,7 +5731,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "6px 8px", background: "rgba(255,255,255,0.04)" } -}, Ks = { style: { +}, Js = { style: { "font-size": "10px", "font-weight": "600", color: "rgba(0, 188, 212, 0.75)", @@ -5701,35 +5742,35 @@ var To = ["title"], Eo = ["src"], Do = { "align-items": "center", "justify-content": "space-between", gap: "8px" -} }, qs = ["title"], Js = { style: { +} }, Ys = ["title"], Xs = { style: { display: "flex", "align-items": "center", gap: "6px" -} }, Ys = ["title"], Xs = { style: { +} }, Zs = ["title"], Qs = { style: { "font-size": "11px", "font-weight": "600", color: "#9C27B0", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, Zs = { style: { +} }, $s = { style: { display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(190px, 1fr))", gap: "10px" -} }, Qs = { style: { +} }, ec = { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.58)", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, $s = ["onClick"], ec = { +} }, tc = ["onClick"], nc = { key: 0, style: { display: "flex", "flex-direction": "column", gap: "5px" } -}, tc = ["onClick"], nc = { style: { +}, rc = ["onClick"], ic = { style: { display: "flex", "justify-content": "space-between", "align-items": "center", @@ -5739,90 +5780,90 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "8px" -} }, rc = { style: { +} }, ac = { style: { "font-size": "12px", color: "var(--fg-color, rgba(255,255,255,0.9))", "line-height": "1.5", "white-space": "pre-wrap", "word-break": "break-word" -} }, ic = { style: { +} }, oc = { style: { "font-size": "11px", "font-weight": "600", color: "#FF9800", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, ac = { style: { +} }, sc = { style: { display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(130px, 1fr))", gap: "8px" -} }, oc = ["onClick"], sc = { style: { +} }, cc = ["onClick"], lc = { style: { "font-size": "11px", "font-weight": "600", color: "#9C27B0", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, cc = { style: { +} }, uc = { style: { display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(220px, 1fr))", gap: "10px" -} }, lc = { style: { +} }, dc = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "10px" -} }, uc = { style: { +} }, fc = { style: { display: "flex", "flex-direction": "column", gap: "4px" -} }, dc = ["onClick"], fc = { +} }, pc = ["onClick"], mc = { key: 0, style: { display: "flex", "flex-direction": "column", gap: "6px" } -}, pc = { style: { +}, hc = { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.58)", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, mc = { style: { +} }, gc = { style: { display: "flex", "flex-direction": "column", gap: "5px" -} }, hc = ["onClick"], gc = { style: { +} }, _c = ["onClick"], vc = { style: { display: "grid", "grid-template-columns": "auto 1fr", gap: "8px 12px", "align-items": "start" -} }, _c = ["title"], vc = ["title"], yc = ["title", "onClick"], bc = { style: { +} }, yc = ["title"], bc = ["title"], xc = ["title", "onClick"], Sc = { style: { "font-size": "11px", "font-weight": "600", color: "#4CAF50", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, xc = ["title", "onClick"], Sc = { style: { +} }, Cc = ["title", "onClick"], wc = { style: { "font-size": "11px", "font-weight": "600", color: "#26C6DA", "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "10px" -} }, Cc = { style: { +} }, Tc = { style: { display: "grid", "grid-template-columns": "repeat(auto-fit, minmax(190px, 1fr))", gap: "10px" -} }, wc = { style: { +} }, Ec = { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.58)", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, Tc = ["title", "onClick"], Ec = { style: { +} }, Dc = ["title", "onClick"], Oc = { style: { display: "flex", "justify-content": "space-between", "align-items": "center", @@ -5832,22 +5873,22 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.5px", "margin-bottom": "8px" -} }, Dc = ["title"], Oc = { style: { +} }, kc = ["title"], Ac = { style: { "font-size": "11px", "font-weight": "700", color: "#E91E63", "text-transform": "uppercase", "letter-spacing": "1px" -} }, kc = ["title"], Ac = ["title"], jc = { style: { +} }, jc = ["title"], Mc = ["title"], Nc = { style: { display: "flex", gap: "8px", "flex-wrap": "wrap" -} }, Mc = /* @__PURE__ */ tt({ +} }, Pc = /* @__PURE__ */ rt({ __name: "SidebarGenerationSection", props: { asset: {} }, setup(e) { - let t = e, n = V(0), r = V(0), i = V(""), a = V(O("action.copy", "Copy")), o = V(O("action.generate", "Generate")), s = V(!1), c = V(u()), l = 0; - function u() { + let t = e, n = V(0), r = V(0), i = V(""), a = V(O("action.copy", "Copy")), o = V(O("action.generate", "Generate")), s = V(!1), l = V(d()), u = 0; + function d() { return { scoreText: "...", scoreColor: "#888", @@ -5860,21 +5901,21 @@ var To = ["title"], Eo = ["src"], Do = { aiStatusText: O("sidebar.generation.aiDisabledEnv", "AI features are disabled (enable vector search env var).") }; } - function d(e, t) { + function f(e, t) { let n = String(e || "").trim().replace(/^#/, ""); return /^[0-9a-fA-F]{6}$/.test(n) ? `rgba(${Number.parseInt(n.slice(0, 2), 16)}, ${Number.parseInt(n.slice(2, 4), 16)}, ${Number.parseInt(n.slice(4, 6), 16)}, ${t})` : `rgba(255,255,255,${t})`; } - function f(e, { emphasis: t = !1, startAlpha: n = .16, endAlpha: r = .08 } = {}) { + function m(e, { emphasis: t = !1, startAlpha: n = .16, endAlpha: r = .08 } = {}) { return { - background: t ? `linear-gradient(135deg, ${d(e, n)} 0%, ${d(e, r)} 100%)` : "var(--comfy-menu-bg, rgba(0,0,0,0.3))", + background: t ? `linear-gradient(135deg, ${f(e, n)} 0%, ${f(e, r)} 100%)` : "var(--comfy-menu-bg, rgba(0,0,0,0.3))", borderLeft: `3px solid ${e}`, - border: t ? `1px solid ${d(e, .45)}` : "1px solid var(--border-color, rgba(255,255,255,0.12))", - boxShadow: t ? `0 0 0 1px ${d(e, .15)} inset` : "none", + border: t ? `1px solid ${f(e, .45)}` : "1px solid var(--border-color, rgba(255,255,255,0.12))", + boxShadow: t ? `0 0 0 1px ${f(e, .15)} inset` : "none", borderRadius: "6px", padding: "12px" }; } - function p() { + function h() { return { background: "linear-gradient(135deg, rgba(233, 30, 99, 0.15) 0%, rgba(156, 39, 176, 0.15) 100%)", border: "2px solid #E91E63", @@ -5886,7 +5927,7 @@ var To = ["title"], Eo = ["src"], Do = { gap: "12px" }; } - function m() { + function g() { return { display: "inline-flex", alignItems: "center", @@ -5903,66 +5944,66 @@ var To = ["title"], Eo = ["src"], Do = { whiteSpace: "nowrap" }; } - let h = P(() => wo(t.asset)), g = P(() => Ua()), _ = P(() => h.value.kind === "full" || h.value.kind === "caption-only"), v = P(() => Ka(i.value) || h.value.emptyCaptionText), y = P(() => g.value && h.value.isImageAsset && !!t.asset?.id), b = P(() => g.value && !!Ka(v.value) && v.value !== h.value.emptyCaptionText), x = P(() => h.value.branchCards.filter((e) => e.modelFields.length || e.loras.length)), S = P(() => h.value.branchCards.filter((e) => e.samplingFields.length)); - P(() => h.value.branchCards.filter((e) => e.loras.length)); - let ee = P(() => { - let e = [], t = (e, t) => Na(e)?.title || t; - return !x.value.length && h.value.modelFields.length && e.push({ + let _ = P(() => Eo(t.asset)), v = P(() => Ga()), y = P(() => _.value.kind === "full" || _.value.kind === "caption-only"), b = P(() => Ja(i.value) || _.value.emptyCaptionText), x = P(() => v.value && _.value.isImageAsset && !!t.asset?.id), S = P(() => v.value && !!Ja(b.value) && b.value !== _.value.emptyCaptionText), C = P(() => _.value.branchCards.filter((e) => e.modelFields.length || e.loras.length)), ee = P(() => _.value.branchCards.filter((e) => e.samplingFields.length)); + P(() => _.value.branchCards.filter((e) => e.loras.length)); + let te = P(() => { + let e = [], t = (e, t) => Fa(e)?.title || t; + return !C.value.length && _.value.modelFields.length && e.push({ key: "model", title: t("model", O("sidebar.generation.modelLora", "Model & LoRA")), accent: "#9C27B0", emphasis: !0, - fields: h.value.modelFields - }), !S.value.length && h.value.samplingFields.length && e.push({ + fields: _.value.modelFields + }), !ee.value.length && _.value.samplingFields.length && e.push({ key: "sampling", title: t("sampler", O("sidebar.generation.sampling", "Sampling")), accent: "#FF9800", emphasis: !0, - fields: h.value.samplingFields - }), (h.value.ttsFields.length || h.value.workflowType.toLowerCase() === "tts") && e.push({ + fields: _.value.samplingFields + }), (_.value.ttsFields.length || _.value.workflowType.toLowerCase() === "tts") && e.push({ key: "tts", title: "TTS", accent: "#26A69A", emphasis: !0, - fields: h.value.ttsFields - }), h.value.ttsEngineFields.length && e.push({ + fields: _.value.ttsFields + }), _.value.ttsEngineFields.length && e.push({ key: "tts-engine", title: "TTS Engine", accent: "#00897B", emphasis: !1, - fields: h.value.ttsEngineFields - }), h.value.ttsRuntimeFields.length && e.push({ + fields: _.value.ttsEngineFields + }), _.value.ttsRuntimeFields.length && e.push({ key: "tts-runtime", title: "TTS Runtime", accent: "#00796B", emphasis: !1, - fields: h.value.ttsRuntimeFields - }), h.value.audioFields.length && e.push({ + fields: _.value.ttsRuntimeFields + }), _.value.audioFields.length && e.push({ key: "audio", title: O("sidebar.generation.audio", "Audio"), accent: "#00BCD4", emphasis: !1, - fields: h.value.audioFields - }), h.value.imageFields.length && e.push({ + fields: _.value.audioFields + }), _.value.imageFields.length && e.push({ key: "image", title: O("sidebar.generation.image", "Image"), accent: "#2196F3", emphasis: !1, - fields: h.value.imageFields + fields: _.value.imageFields }), e; }); - function w(e, t, n = 450) { + function ne(e, t, n = 450) { if (!e) return; let r = e.style.background; e.style.background = t, setTimeout(() => { e.style.background = r || ""; }, n); } - function T(e, t = !0) { + function w(e, t = !0) { return { - background: t ? `linear-gradient(135deg, ${d(e, .16)} 0%, ${d(e, .08)} 100%)` : "var(--comfy-menu-bg, rgba(0,0,0,0.3))", - border: `1px solid ${d(e, .42)}`, - boxShadow: `0 0 0 1px ${d(e, .14)} inset`, + background: t ? `linear-gradient(135deg, ${f(e, .16)} 0%, ${f(e, .08)} 100%)` : "var(--comfy-menu-bg, rgba(0,0,0,0.3))", + border: `1px solid ${f(e, .42)}`, + boxShadow: `0 0 0 1px ${f(e, .14)} inset`, borderRadius: "8px", padding: "12px", display: "flex", @@ -5970,26 +6011,26 @@ var To = ["title"], Eo = ["src"], Do = { gap: "10px" }; } - function ne(e) { + function T(e) { return "#CE6DE0"; } - function re(e) { + function E(e) { let t = String(e?.key || "").toLowerCase(); return t.includes("high") ? "#FFC107" : t.includes("low") ? "#FFB300" : t.includes("base") ? "#FF9800" : t.includes("upscale") || t.includes("refine") ? "#FFCA28" : t.includes("pass") ? "#FDD835" : "#FF9800"; } - function ie(e) { + function re(e) { return e === "high_noise" ? "#FF7043" : e === "low_noise" ? "#29B6F6" : "#AB47BC"; } - async function E(e, t = null, n = "rgba(76, 175, 80, 0.35)") { + async function D(e, t = null, n = "rgba(76, 175, 80, 0.35)") { let r = String(e ?? "").trim(); - if (!(!r || r === "-")) try { - await navigator.clipboard.writeText(r), w(t, n); + if (r && r !== "-") try { + await navigator.clipboard.writeText(r), ne(t, n); } catch (e) { console.debug?.(e); } } - function ae() { - c.value = { + function ie() { + l.value = { scoreText: "AI OFF", scoreColor: "#9E9E9E", qualityText: O("status.disabled", "Disabled"), @@ -6001,31 +6042,31 @@ var To = ["title"], Eo = ["src"], Do = { aiStatusText: O("sidebar.generation.aiDisabledSettings", "AI features are disabled in settings.") }; } - function oe() { - c.value = u(); + function ae() { + l.value = d(); } - async function se() { - l += 1; - let e = l; - if (!h.value.showAlignment || !t.asset?.id) { - oe(); - return; - } - if (!g.value) { + async function oe() { + u += 1; + let e = u; + if (!_.value.showAlignment || !t.asset?.id) { ae(); return; } - oe(); + if (!v.value) { + ie(); + return; + } + ae(); try { - let n = await te(t.asset.id); - if (e !== l) return; + let n = await p(t.asset.id); + if (e !== u) return; if (!n?.ok && (String(n?.code || "").toUpperCase() === "SERVICE_UNAVAILABLE" || /vector search is not enabled/i.test(String(n?.error || "")))) { - ae(); + ie(); return; } let r = n?.ok && n.data != null ? Number(n.data) : null; if (!Number.isFinite(r)) { - c.value = { + l.value = { scoreText: "N/A", scoreColor: "#888", qualityText: O("status.na", "N/A"), @@ -6038,11 +6079,11 @@ var To = ["title"], Eo = ["src"], Do = { }; return; } - let i = Math.round(r * 100), a = Wa(r); - c.value = { + let i = Math.round(r * 100), a = Ka(r); + l.value = { scoreText: `${i}%`, scoreColor: a, - qualityText: Ga(r), + qualityText: qa(r), qualityColor: a, qualityBackground: `${a}33`, fillWidth: `${i}%`, @@ -6051,8 +6092,8 @@ var To = ["title"], Eo = ["src"], Do = { aiStatusText: "" }; } catch (t) { - if (console.debug?.(t), e !== l) return; - c.value = { + if (console.debug?.(t), e !== u) return; + l.value = { scoreText: "-", scoreColor: "#888", qualityText: O("status.unavailable", "Unavailable"), @@ -6065,11 +6106,11 @@ var To = ["title"], Eo = ["src"], Do = { }; } } - async function ce() { - if (!(!y.value || s.value)) { + async function se() { + if (x.value && !s.value) { s.value = !0, o.value = O("status.generating", "Generating..."); try { - let e = await C(t.asset.id); + let e = await c(t.asset.id); e?.ok && (i.value = String(e?.data || "").trim()); } catch (e) { console.debug?.(e); @@ -6078,29 +6119,29 @@ var To = ["title"], Eo = ["src"], Do = { } } } - async function le() { - if (b.value) try { - await navigator.clipboard.writeText(v.value), a.value = O("viewer.copySuccessShort", "Copied!"), setTimeout(() => { + async function ce() { + if (S.value) try { + await navigator.clipboard.writeText(b.value), a.value = O("viewer.copySuccessShort", "Copied!"), setTimeout(() => { a.value = O("action.copy", "Copy"); }, 900); } catch (e) { console.debug?.(e); } } - return et(() => t.asset, () => { + return nt(() => t.asset, () => { n.value = 0, r.value = 0, i.value = String(t.asset?.enhanced_caption || "").trim(), a.value = O("action.copy", "Copy"), o.value = O("action.generate", "Generate"); - }, { immediate: !0 }), et(() => [ + }, { immediate: !0 }), nt(() => [ t.asset?.id, - h.value.kind, - h.value.showAlignment, - g.value + _.value.kind, + _.value.showAlignment, + v.value ], () => { - se(); + oe(); }, { immediate: !0 }), (e, t) => { - let r = Qe("MButton"); - return h.value.kind === "empty" ? N("", !0) : (I(), z("div", No, [ - h.value.workflowType ? (I(), z("div", Po, [M("span", Fo, R(B(O)("viewer.workflow", "Workflow")), 1), M("div", Io, [M("span", { - title: B(O)("sidebar.generation.workflowEngine", "Workflow engine: {value}", { value: h.value.workflowType }), + let r = et("MButton"); + return _.value.kind === "empty" ? N("", !0) : (I(), z("div", Fo, [ + _.value.workflowType ? (I(), z("div", Io, [M("span", Lo, R(B(O)("viewer.workflow", "Workflow")), 1), M("div", Ro, [M("span", { + title: B(O)("sidebar.generation.workflowEngine", "Workflow engine: {value}", { value: _.value.workflowType }), style: { background: "#2196F3", color: "white", @@ -6110,9 +6151,9 @@ var To = ["title"], Eo = ["src"], Do = { "font-size": "10px", "letter-spacing": "0.2px" } - }, R(h.value.workflowLabel || h.value.workflowType), 9, Lo), h.value.workflowBadge ? (I(), z("span", { + }, R(_.value.workflowLabel || _.value.workflowType), 9, zo), _.value.workflowBadge ? (I(), z("span", { key: 0, - title: B(O)("sidebar.generation.apiProvider", "API provider: {value}", { value: h.value.workflowBadge }), + title: B(O)("sidebar.generation.apiProvider", "API provider: {value}", { value: _.value.workflowBadge }), style: { background: "rgba(255,255,255,0.08)", color: "var(--fg-color, #eee)", @@ -6123,41 +6164,41 @@ var To = ["title"], Eo = ["src"], Do = { "font-size": "10px", "letter-spacing": "0.2px" } - }, R(h.value.workflowBadge), 9, Ro)) : N("", !0)])])) : N("", !0), - h.value.isOverride ? (I(), z("div", { + }, R(_.value.workflowBadge), 9, Bo)) : N("", !0)])])) : N("", !0), + _.value.isOverride ? (I(), z("div", { key: 1, - style: L(f("#00BCD4", { + style: L(m("#00BCD4", { emphasis: !0, startAlpha: .14, endAlpha: .08 })) - }, [M("div", zo, [M("span", Bo, R(B(O)("sidebar.generation.override", "Override")), 1), M("span", Vo, R(h.value.overrideLabel), 1)])], 4)) : N("", !0), - h.value.isTruncated ? (I(), z("div", { + }, [M("div", Vo, [M("span", Ho, R(B(O)("sidebar.generation.override", "Override")), 1), M("span", Uo, R(_.value.overrideLabel), 1)])], 4)) : N("", !0), + _.value.isTruncated ? (I(), z("div", { key: 2, - style: L(f("#FF9800", { + style: L(m("#FF9800", { emphasis: !0, startAlpha: .12, endAlpha: .08 })) - }, [M("div", Ho, R(B(O)("sidebar.generation.metadataTruncated", "Metadata Truncated")), 1), M("div", Uo, R(B(O)("sidebar.generation.metadataTruncatedBody", "Generation data is incomplete because it exceeded the size limit.")), 1)], 4)) : N("", !0), - h.value.kind === "media-only" ? (I(), z("div", { + }, [M("div", Wo, R(B(O)("sidebar.generation.metadataTruncated", "Metadata Truncated")), 1), M("div", Go, R(B(O)("sidebar.generation.metadataTruncatedBody", "Generation data is incomplete because it exceeded the size limit.")), 1)], 4)) : N("", !0), + _.value.kind === "media-only" ? (I(), z("div", { key: 3, - style: L(f("#9E9E9E", { + style: L(m("#9E9E9E", { emphasis: !0, startAlpha: .1, endAlpha: .06 })) - }, [M("div", Wo, R(B(O)("sidebar.generation.generationData", "Generation Data")), 1), M("div", Go, R(h.value.mediaOnlyMessage), 1)], 4)) : N("", !0), - h.value.kind === "full" ? (I(), z(j, { key: 4 }, [ - h.value.ltxDirector ? (I(), z("div", { + }, [M("div", Ko, R(B(O)("sidebar.generation.generationData", "Generation Data")), 1), M("div", qo, R(_.value.mediaOnlyMessage), 1)], 4)) : N("", !0), + _.value.kind === "full" ? (I(), z(j, { key: 4 }, [ + _.value.ltxDirector ? (I(), z("div", { key: 0, - style: L(f("#26C6DA", { + style: L(m("#26C6DA", { emphasis: !0, startAlpha: .15, endAlpha: .08 })) }, [ - M("div", Ko, [M("div", qo, R(h.value.ltxDirector.title || "LTX Director"), 1), t[8] ||= M("span", { style: { + M("div", Jo, [M("div", Yo, R(_.value.ltxDirector.title || "LTX Director"), 1), t[8] ||= M("span", { style: { "font-size": "10px", "font-weight": "700", color: "#26C6DA", @@ -6166,7 +6207,7 @@ var To = ["title"], Eo = ["src"], Do = { "border-radius": "999px", padding: "2px 8px" } }, " Director ", -1)]), - h.value.ltxDirector.fields.length ? (I(), z("div", Jo, [(I(!0), z(j, null, F(h.value.ltxDirector.fields, (e) => (I(), z("div", { + _.value.ltxDirector.fields.length ? (I(), z("div", Xo, [(I(!0), z(j, null, F(_.value.ltxDirector.fields, (e) => (I(), z("div", { key: `ltx-field-${e.label}`, style: { border: "1px solid rgba(255,255,255,0.10)", @@ -6175,8 +6216,8 @@ var To = ["title"], Eo = ["src"], Do = { padding: "7px 8px", "min-width": "0" } - }, [M("div", Yo, R(e.label), 1), M("div", Xo, R(e.value), 1)]))), 128))])) : N("", !0), - h.value.ltxDirector.globalPrompt ? (I(), z("div", Zo, [t[9] ||= M("div", { style: { + }, [M("div", Zo, R(e.label), 1), M("div", Qo, R(e.value), 1)]))), 128))])) : N("", !0), + _.value.ltxDirector.globalPrompt ? (I(), z("div", $o, [t[9] ||= M("div", { style: { "font-size": "10px", "font-weight": "800", color: "#66BB6A", @@ -6193,9 +6234,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[0] ||= (e) => E(h.value.ltxDirector.globalPrompt, e.currentTarget) - }, R(h.value.ltxDirector.globalPrompt), 9, Qo)])) : N("", !0), - h.value.ltxDirector.segments.length ? (I(), z("div", $o, [(I(!0), z(j, null, F(h.value.ltxDirector.segments, (e) => (I(), z("div", { + onClick: t[0] ||= (e) => D(_.value.ltxDirector.globalPrompt, e.currentTarget) + }, R(_.value.ltxDirector.globalPrompt), 9, es)])) : N("", !0), + _.value.ltxDirector.segments.length ? (I(), z("div", ts, [(I(!0), z(j, null, F(_.value.ltxDirector.segments, (e) => (I(), z("div", { key: e.key, style: { border: "1px solid rgba(38,198,218,0.30)", @@ -6203,7 +6244,7 @@ var To = ["title"], Eo = ["src"], Do = { background: "rgba(38,198,218,0.075)", padding: "10px" } - }, [M("div", es, [M("div", ts, R(e.label), 1), M("div", ns, [e.inLabel ? (I(), z("span", rs, " in " + R(e.inLabel), 1)) : N("", !0), e.outLabel ? (I(), z("span", is, " out " + R(e.outLabel), 1)) : N("", !0)])]), M("div", as, [e.filename ? (I(), Ze(Mo, { + }, [M("div", ns, [M("div", rs, R(e.label), 1), M("div", is, [e.inLabel ? (I(), z("span", as, " in " + R(e.inLabel), 1)) : N("", !0), e.outLabel ? (I(), z("span", os, " out " + R(e.outLabel), 1)) : N("", !0)])]), M("div", ss, [e.filename ? (I(), $e(Po, { key: 0, "input-file": { filename: e.filename, @@ -6214,7 +6255,7 @@ var To = ["title"], Eo = ["src"], Do = { isAudio: e.isAudio, previewCandidates: e.previewCandidates } - }, null, 8, ["input-file"])) : N("", !0), M("div", os, [e.prompt ? (I(), z("div", { + }, null, 8, ["input-file"])) : N("", !0), M("div", cs, [e.prompt ? (I(), z("div", { key: 0, title: B(O)("action.clickToCopy", "Click to copy"), style: { @@ -6225,18 +6266,18 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (t) => E(e.prompt, t.currentTarget) - }, R(e.prompt), 9, ss)) : N("", !0), e.filename || e.type ? (I(), z("div", cs, [e.type ? (I(), z("span", ls, R(e.type), 1)) : N("", !0), e.filename ? (I(), z("span", us, R(e.filename), 1)) : N("", !0)])) : N("", !0)])])]))), 128))])) : N("", !0) + onClick: (t) => D(e.prompt, t.currentTarget) + }, R(e.prompt), 9, ls)) : N("", !0), e.filename || e.type ? (I(), z("div", us, [e.type ? (I(), z("span", ds, R(e.type), 1)) : N("", !0), e.filename ? (I(), z("span", fs, R(e.filename), 1)) : N("", !0)])) : N("", !0)])])]))), 128))])) : N("", !0) ], 4)) : N("", !0), - h.value.ideogram ? (I(), z("div", { + _.value.ideogram ? (I(), z("div", { key: 1, - style: L(f("#FFB300", { + style: L(m("#FFB300", { emphasis: !0, startAlpha: .15, endAlpha: .08 })) }, [ - M("div", ds, [M("div", fs, R(h.value.ideogram.title || "Ideogram 4"), 1), t[10] ||= M("span", { style: { + M("div", ps, [M("div", ms, R(_.value.ideogram.title || "Ideogram 4"), 1), t[10] ||= M("span", { style: { "font-size": "10px", "font-weight": "700", color: "#FFCA28", @@ -6245,7 +6286,7 @@ var To = ["title"], Eo = ["src"], Do = { "border-radius": "999px", padding: "2px 8px" } }, " Prompt JSON ", -1)]), - h.value.ideogram.fields.length ? (I(), z("div", ps, [(I(!0), z(j, null, F(h.value.ideogram.fields, (e) => (I(), z("div", { + _.value.ideogram.fields.length ? (I(), z("div", hs, [(I(!0), z(j, null, F(_.value.ideogram.fields, (e) => (I(), z("div", { key: `ideogram-field-${e.label}`, style: { border: "1px solid rgba(255,255,255,0.10)", @@ -6254,8 +6295,8 @@ var To = ["title"], Eo = ["src"], Do = { padding: "7px 8px", "min-width": "0" } - }, [M("div", ms, R(e.label), 1), M("div", hs, R(e.value), 1)]))), 128))])) : N("", !0), - h.value.ideogram.highLevelDescription ? (I(), z("div", gs, [t[11] ||= M("div", { style: { + }, [M("div", gs, R(e.label), 1), M("div", _s, R(e.value), 1)]))), 128))])) : N("", !0), + _.value.ideogram.highLevelDescription ? (I(), z("div", vs, [t[11] ||= M("div", { style: { "font-size": "10px", "font-weight": "800", color: "#81C784", @@ -6272,9 +6313,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[1] ||= (e) => E(h.value.ideogram.highLevelDescription, e.currentTarget) - }, R(h.value.ideogram.highLevelDescription), 9, _s)])) : N("", !0), - h.value.ideogram.background ? (I(), z("div", vs, [t[12] ||= M("div", { style: { + onClick: t[1] ||= (e) => D(_.value.ideogram.highLevelDescription, e.currentTarget) + }, R(_.value.ideogram.highLevelDescription), 9, ys)])) : N("", !0), + _.value.ideogram.background ? (I(), z("div", bs, [t[12] ||= M("div", { style: { "font-size": "10px", "font-weight": "800", color: "#64B5F6", @@ -6291,9 +6332,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[2] ||= (e) => E(h.value.ideogram.background, e.currentTarget) - }, R(h.value.ideogram.background), 9, ys)])) : N("", !0), - h.value.ideogram.elements.length ? (I(), z("div", bs, [(I(!0), z(j, null, F(h.value.ideogram.elements, (e) => (I(), z("div", { + onClick: t[2] ||= (e) => D(_.value.ideogram.background, e.currentTarget) + }, R(_.value.ideogram.background), 9, xs)])) : N("", !0), + _.value.ideogram.elements.length ? (I(), z("div", Ss, [(I(!0), z(j, null, F(_.value.ideogram.elements, (e) => (I(), z("div", { key: e.key, style: { border: "1px solid rgba(255,179,0,0.30)", @@ -6302,7 +6343,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "10px" } }, [ - M("div", xs, [M("div", Ss, R(e.label), 1), e.bbox ? (I(), z("span", Cs, " bbox " + R(e.bbox), 1)) : N("", !0)]), + M("div", Cs, [M("div", ws, R(e.label), 1), e.bbox ? (I(), z("span", Ts, " bbox " + R(e.bbox), 1)) : N("", !0)]), e.description ? (I(), z("div", { key: 0, title: B(O)("action.clickToCopy", "Click to copy"), @@ -6314,9 +6355,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (t) => E(e.description, t.currentTarget) - }, R(e.description), 9, ws)) : N("", !0), - e.palette.length ? (I(), z("div", Ts, [(I(!0), z(j, null, F(e.palette, (t) => (I(), z("span", { + onClick: (t) => D(e.description, t.currentTarget) + }, R(e.description), 9, Es)) : N("", !0), + e.palette.length ? (I(), z("div", Ds, [(I(!0), z(j, null, F(e.palette, (t) => (I(), z("span", { key: `${e.key}-${t}`, title: t, style: L({ @@ -6326,10 +6367,10 @@ var To = ["title"], Eo = ["src"], Do = { border: "1px solid rgba(255,255,255,0.28)", background: t }), - onClick: (e) => E(t, e.currentTarget) - }, null, 12, Es))), 128))])) : N("", !0) + onClick: (e) => D(t, e.currentTarget) + }, null, 12, Os))), 128))])) : N("", !0) ]))), 128))])) : N("", !0), - M("details", Ds, [t[13] ||= M("summary", { style: { + M("details", ks, [t[13] ||= M("summary", { style: { cursor: "pointer", padding: "8px 10px", "font-size": "10px", @@ -6351,19 +6392,19 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[3] ||= (e) => E(h.value.ideogram.json, e.currentTarget) - }, R(h.value.ideogram.json), 9, Os)]) + onClick: t[3] ||= (e) => D(_.value.ideogram.json, e.currentTarget) + }, R(_.value.ideogram.json), 9, As)]) ], 4)) : N("", !0), - !h.value.ltxDirector && !h.value.ideogram && h.value.promptTabs.length ? (I(), z("div", { + !_.value.ltxDirector && !_.value.ideogram && _.value.promptTabs.length ? (I(), z("div", { key: 2, - style: L(f("#4CAF50", { + style: L(m("#4CAF50", { emphasis: !0, startAlpha: .16, endAlpha: .1 })) }, [ - M("div", ks, R(B(O)("sidebar.generation.promptPipeline", "Prompt Pipeline ({count} variants)", { count: h.value.promptTabs.length })), 1), - M("div", As, [(I(!0), z(j, null, F(h.value.promptTabs, (e, t) => (I(), Ze(r, { + M("div", js, R(B(O)("sidebar.generation.promptPipeline", "Prompt Pipeline ({count} variants)", { count: _.value.promptTabs.length })), 1), + M("div", Ms, [(I(!0), z(j, null, F(_.value.promptTabs, (e, t) => (I(), $e(r, { key: e.label, type: "button", severity: "secondary", @@ -6383,10 +6424,10 @@ var To = ["title"], Eo = ["src"], Do = { }), onClick: (e) => n.value = t }, { - default: $e(() => [Xe(R(e.label), 1)]), + default: tt(() => [Qe(R(e.label), 1)]), _: 2 }, 1032, ["style", "onClick"]))), 128))]), - (I(!0), z(j, null, F(h.value.promptTabs, (e, t) => it((I(), z("div", { + (I(!0), z(j, null, F(_.value.promptTabs, (e, t) => ot((I(), z("div", { key: `${e.label}-panel`, style: { display: "flex", @@ -6399,7 +6440,7 @@ var To = ["title"], Eo = ["src"], Do = { padding: "10px" } }, [ - M("div", js, R(B(O)("sidebar.generation.positive", "POSITIVE")), 1), + M("div", Ns, R(B(O)("sidebar.generation.positive", "POSITIVE")), 1), M("div", { style: { "font-size": "12px", @@ -6408,9 +6449,9 @@ var To = ["title"], Eo = ["src"], Do = { "line-height": "1.35", cursor: "pointer" }, - onClick: (t) => E(e.positive, t.currentTarget) - }, R(e.positive), 9, Ms), - e.negative ? (I(), z(j, { key: 0 }, [M("div", Ns, R(B(O)("sidebar.generation.negative", "NEGATIVE")), 1), M("div", { + onClick: (t) => D(e.positive, t.currentTarget) + }, R(e.positive), 9, Ps), + e.negative ? (I(), z(j, { key: 0 }, [M("div", Fs, R(B(O)("sidebar.generation.negative", "NEGATIVE")), 1), M("div", { style: { "font-size": "12px", color: "var(--fg-color, #ddd)", @@ -6418,21 +6459,21 @@ var To = ["title"], Eo = ["src"], Do = { "line-height": "1.35", cursor: "pointer" }, - onClick: (t) => E(e.negative, t.currentTarget) - }, R(e.negative), 9, Ps)], 64)) : N("", !0) - ])), [[st, n.value === t]])), 128)) - ], 4)) : !h.value.ltxDirector && !h.value.ideogram && h.value.positivePrompt ? (I(), z("div", { + onClick: (t) => D(e.negative, t.currentTarget) + }, R(e.negative), 9, Is)], 64)) : N("", !0) + ])), [[lt, n.value === t]])), 128)) + ], 4)) : !_.value.ltxDirector && !_.value.ideogram && _.value.positivePrompt ? (I(), z("div", { key: 3, - style: L(f("#4CAF50", { + style: L(m("#4CAF50", { emphasis: !0, startAlpha: .16, endAlpha: .1 })) - }, [M("div", Fs, [M("span", null, R(B(O)("sidebar.generation.positivePrompt", "Positive Prompt")), 1), h.value.positivePromptOverride ? (I(), z("span", { + }, [M("div", Ls, [M("span", null, R(B(O)("sidebar.generation.positivePrompt", "Positive Prompt")), 1), _.value.positivePromptOverride ? (I(), z("span", { key: 0, - style: L(m()), + style: L(g()), title: B(O)("sidebar.generation.overrideTooltip", "This field was forced by Majoor Gen Info Override") - }, R(B(O)("sidebar.generation.override", "override")), 13, Is)) : N("", !0)]), M("div", { + }, R(B(O)("sidebar.generation.override", "override")), 13, Rs)) : N("", !0)]), M("div", { title: B(O)("action.clickToCopy", "Click to copy"), style: { "font-size": "12px", @@ -6442,20 +6483,20 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[4] ||= (e) => E(h.value.positivePrompt, e.currentTarget) - }, R(h.value.positivePrompt), 9, Ls)], 4)) : N("", !0), - !h.value.ltxDirector && !h.value.ideogram && !h.value.promptTabs.length && h.value.negativePrompt ? (I(), z("div", { + onClick: t[4] ||= (e) => D(_.value.positivePrompt, e.currentTarget) + }, R(_.value.positivePrompt), 9, zs)], 4)) : N("", !0), + !_.value.ltxDirector && !_.value.ideogram && !_.value.promptTabs.length && _.value.negativePrompt ? (I(), z("div", { key: 4, - style: L(f("#F44336", { + style: L(m("#F44336", { emphasis: !0, startAlpha: .16, endAlpha: .1 })) - }, [M("div", Rs, [M("span", null, R(B(O)("sidebar.generation.negativePrompt", "Negative Prompt")), 1), h.value.negativePromptOverride ? (I(), z("span", { + }, [M("div", Bs, [M("span", null, R(B(O)("sidebar.generation.negativePrompt", "Negative Prompt")), 1), _.value.negativePromptOverride ? (I(), z("span", { key: 0, - style: L(m()), + style: L(g()), title: B(O)("sidebar.generation.overrideTooltip", "This field was forced by Majoor Gen Info Override") - }, R(B(O)("sidebar.generation.override", "override")), 13, zs)) : N("", !0)]), M("div", { + }, R(B(O)("sidebar.generation.override", "override")), 13, Vs)) : N("", !0)]), M("div", { title: B(O)("action.clickToCopy", "Click to copy"), style: { "font-size": "12px", @@ -6465,10 +6506,10 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[5] ||= (e) => E(h.value.negativePrompt, e.currentTarget) - }, R(h.value.negativePrompt), 9, Bs)], 4)) : N("", !0) + onClick: t[5] ||= (e) => D(_.value.negativePrompt, e.currentTarget) + }, R(_.value.negativePrompt), 9, Hs)], 4)) : N("", !0) ], 64)) : N("", !0), - _.value ? (I(), z("div", { + y.value ? (I(), z("div", { key: 5, style: { background: "linear-gradient(135deg, rgba(0, 188, 212, 0.14) 0%, rgba(33, 150, 243, 0.10) 100%)", @@ -6479,45 +6520,45 @@ var To = ["title"], Eo = ["src"], Do = { "flex-direction": "column", gap: "10px" }, - class: Tt({ "mjr-ai-disabled-block": !g.value }) + class: Dt({ "mjr-ai-disabled-block": !v.value }) }, [ - h.value.showAlignment ? (I(), z(j, { key: 0 }, [ - M("div", Vs, [M("span", { title: B(O)("sidebar.generation.promptAlignmentTooltip", "How closely the generated image matches the prompt (SigLIP2 score)") }, R(B(O)("sidebar.generation.promptAlignment", "Prompt Alignment")), 9, Hs)]), - M("div", Us, [ - M("div", Ws, [M("div", { style: L({ + _.value.showAlignment ? (I(), z(j, { key: 0 }, [ + M("div", Us, [M("span", { title: B(O)("sidebar.generation.promptAlignmentTooltip", "How closely the generated image matches the prompt (SigLIP2 score)") }, R(B(O)("sidebar.generation.promptAlignment", "Prompt Alignment")), 9, Ws)]), + M("div", Gs, [ + M("div", Ks, [M("div", { style: L({ height: "100%", - width: c.value.fillWidth, - background: c.value.fillColor, + width: l.value.fillWidth, + background: l.value.fillColor, borderRadius: "4px", transition: "width 0.6s ease, background 0.4s ease" }) }, null, 4)]), M("span", { style: L({ fontSize: "13px", fontWeight: "700", - color: c.value.scoreColor, + color: l.value.scoreColor, minWidth: "60px", textAlign: "right", fontFamily: "'Consolas', 'Monaco', monospace" - }) }, R(c.value.scoreText), 5), + }) }, R(l.value.scoreText), 5), M("span", { style: L({ fontSize: "9px", fontWeight: "700", padding: "2px 6px", borderRadius: "3px", - background: c.value.qualityBackground, - color: c.value.qualityColor, + background: l.value.qualityBackground, + color: l.value.qualityColor, textTransform: "uppercase", letterSpacing: "0.5px" - }) }, R(c.value.qualityText), 5) + }) }, R(l.value.qualityText), 5) ]), - c.value.aiStatusVisible ? (I(), z("div", Gs, R(c.value.aiStatusText), 1)) : N("", !0) + l.value.aiStatusVisible ? (I(), z("div", qs, R(l.value.aiStatusText), 1)) : N("", !0) ], 64)) : N("", !0), - M("div", Ks, [M("span", { title: B(O)("sidebar.generation.aiCaptionTooltip", "AI caption generated by Florence-2") }, R(h.value.captionLabel), 9, qs), M("div", Js, [mt(r, { + M("div", Js, [M("span", { title: B(O)("sidebar.generation.aiCaptionTooltip", "AI caption generated by Florence-2") }, R(_.value.captionLabel), 9, Ys), M("div", Xs, [gt(r, { type: "button", class: "mjr-ai-control", severity: "secondary", text: "", - disabled: !y.value || s.value, + disabled: !x.value || s.value, style: L([{ border: "1px solid rgba(0,188,212,0.45)", background: "rgba(0,188,212,0.12)", @@ -6528,19 +6569,19 @@ var To = ["title"], Eo = ["src"], Do = { padding: "2px 8px", cursor: "pointer" }, { - opacity: y.value ? "1" : "0.6", - cursor: y.value ? "pointer" : "default" + opacity: x.value ? "1" : "0.6", + cursor: x.value ? "pointer" : "default" }]), - onClick: rt(ce, ["stop"]) + onClick: at(se, ["stop"]) }, { - default: $e(() => [Xe(R(o.value), 1)]), + default: tt(() => [Qe(R(o.value), 1)]), _: 1 - }, 8, ["disabled", "style"]), mt(r, { + }, 8, ["disabled", "style"]), gt(r, { type: "button", class: "mjr-ai-control", severity: "secondary", text: "", - disabled: !b.value, + disabled: !S.value, style: L([{ border: "1px solid rgba(0,188,212,0.45)", background: "rgba(0,188,212,0.12)", @@ -6551,16 +6592,16 @@ var To = ["title"], Eo = ["src"], Do = { padding: "2px 8px", cursor: "pointer" }, { - opacity: b.value ? "1" : "0.6", - cursor: b.value ? "pointer" : "default" + opacity: S.value ? "1" : "0.6", + cursor: S.value ? "pointer" : "default" }]), - onClick: rt(le, ["stop"]) + onClick: at(ce, ["stop"]) }, { - default: $e(() => [Xe(R(a.value), 1)]), + default: tt(() => [Qe(R(a.value), 1)]), _: 1 }, 8, ["disabled", "style"])])]), M("div", { - title: g.value ? B(O)("sidebar.generation.copyCaptionTooltip", "Click to copy caption") : B(O)("sidebar.generation.aiCaptionDisabled", "AI caption controls are disabled"), + title: v.value ? B(O)("sidebar.generation.copyCaptionTooltip", "Click to copy caption") : B(O)("sidebar.generation.aiCaptionDisabled", "AI caption controls are disabled"), style: L({ marginTop: "4px", padding: "8px", @@ -6572,26 +6613,26 @@ var To = ["title"], Eo = ["src"], Do = { lineHeight: "1.45", whiteSpace: "pre-wrap", wordBreak: "break-word", - cursor: b.value ? "copy" : "default" + cursor: S.value ? "copy" : "default" }), - onClick: le - }, R(v.value), 13, Ys) + onClick: ce + }, R(b.value), 13, Zs) ], 2)) : N("", !0), - x.value.length ? (I(), z("div", { + C.value.length ? (I(), z("div", { key: 6, - style: L(f("#9C27B0", { + style: L(m("#9C27B0", { emphasis: !0, startAlpha: .18, endAlpha: .1 })) - }, [M("div", Xs, R(B(O)("sidebar.generation.models", "Models")), 1), M("div", Zs, [(I(!0), z(j, null, F(x.value, (e) => (I(), z("div", { + }, [M("div", Qs, R(B(O)("sidebar.generation.models", "Models")), 1), M("div", $s, [(I(!0), z(j, null, F(C.value, (e) => (I(), z("div", { key: `models-top-${e.key}`, - style: L(T(ne(e), !0)) + style: L(w(T(e), !0)) }, [ M("div", { style: L({ fontSize: "10px", fontWeight: "800", - color: ne(e), + color: T(e), letterSpacing: "0.6px", textTransform: "uppercase" }) }, R(e.label), 5), @@ -6603,7 +6644,7 @@ var To = ["title"], Eo = ["src"], Do = { gap: "3px", "min-width": "0" } - }, [M("span", Qs, R(t.label), 1), M("span", { + }, [M("span", ec, R(t.label), 1), M("span", { style: { "font-size": "12px", color: "var(--fg-color, rgba(255,255,255,0.96))", @@ -6611,9 +6652,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (e) => E(t.value, e.currentTarget) - }, R(t.value || "-"), 9, $s)]))), 128)), - e.loras.length ? (I(), z("div", ec, [t[14] ||= M("span", { style: { + onClick: (e) => D(t.value, e.currentTarget) + }, R(t.value || "-"), 9, tc)]))), 128)), + e.loras.length ? (I(), z("div", nc, [t[14] ||= M("span", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.58)", @@ -6632,29 +6673,29 @@ var To = ["title"], Eo = ["src"], Do = { border: "1px solid rgba(255,255,255,0.08)", cursor: "pointer" }, - onClick: (e) => E(t, e.currentTarget) - }, R(t), 9, tc))), 128))])) : N("", !0) + onClick: (e) => D(t, e.currentTarget) + }, R(t), 9, rc))), 128))])) : N("", !0) ], 4))), 128))])], 4)) : N("", !0), - h.value.lyrics ? (I(), z("div", { + _.value.lyrics ? (I(), z("div", { key: 7, - style: L(f("#00BCD4", { emphasis: !1 })) - }, [M("div", nc, [M("span", null, R(B(O)("sidebar.generation.lyrics", "Lyrics")), 1)]), M("div", rc, R(h.value.lyrics), 1)], 4)) : N("", !0), - h.value.branchCards.length ? (I(), z(j, { key: 8 }, [ + style: L(m("#00BCD4", { emphasis: !1 })) + }, [M("div", ic, [M("span", null, R(B(O)("sidebar.generation.lyrics", "Lyrics")), 1)]), M("div", ac, R(_.value.lyrics), 1)], 4)) : N("", !0), + _.value.branchCards.length ? (I(), z(j, { key: 8 }, [ N("", !0), - S.value.length ? (I(), z("div", { + ee.value.length ? (I(), z("div", { key: 1, - style: L(f("#FF9800", { + style: L(m("#FF9800", { emphasis: !0, startAlpha: .16, endAlpha: .1 })) - }, [M("div", ic, R(B(O)("sidebar.generation.sampling", "Sampling")), 1), M("div", ac, [(I(!0), z(j, null, F(S.value, (e) => (I(), z("div", { + }, [M("div", oc, R(B(O)("sidebar.generation.sampling", "Sampling")), 1), M("div", sc, [(I(!0), z(j, null, F(ee.value, (e) => (I(), z("div", { key: `sampling-${e.key}`, - style: L(T(re(e), !0)) + style: L(w(E(e), !0)) }, [M("div", { style: L({ fontSize: "10px", fontWeight: "800", - color: re(e), + color: E(e), letterSpacing: "0.6px", textTransform: "uppercase" }) }, R(e.label), 5), (I(!0), z(j, null, F(e.samplingFields, (t) => (I(), z("div", { @@ -6674,38 +6715,38 @@ var To = ["title"], Eo = ["src"], Do = { "text-align": "right", cursor: "pointer" }, - onClick: (e) => E(t.value, e.currentTarget) - }, R(t.value), 9, oc)]))), 128))], 4))), 128))])], 4)) : N("", !0), + onClick: (e) => D(t.value, e.currentTarget) + }, R(t.value), 9, cc)]))), 128))], 4))), 128))])], 4)) : N("", !0), N("", !0) - ], 64)) : h.value.modelGroups.length ? (I(), z("div", { + ], 64)) : _.value.modelGroups.length ? (I(), z("div", { key: 9, - style: L(f("#9C27B0", { + style: L(m("#9C27B0", { emphasis: !0, startAlpha: .18, endAlpha: .1 })) - }, [M("div", sc, R(B(O)("sidebar.generation.models", "Models")), 1), M("div", cc, [(I(!0), z(j, null, F(h.value.modelGroups, (e) => (I(), z("div", { + }, [M("div", lc, R(B(O)("sidebar.generation.models", "Models")), 1), M("div", uc, [(I(!0), z(j, null, F(_.value.modelGroups, (e) => (I(), z("div", { key: `model-group-${e.key}`, - style: L(T(ie(e.key), !0)) + style: L(w(re(e.key), !0)) }, [ - M("div", lc, [M("div", { style: L({ + M("div", dc, [M("div", { style: L({ fontSize: "10px", fontWeight: "800", - color: ie(e.key), + color: re(e.key), letterSpacing: "0.6px", textTransform: "uppercase" }) }, R(e.label), 5), M("span", { style: L({ fontSize: "9px", fontWeight: "700", color: "#fff", - background: d(ie(e.key), .22), - border: `1px solid ${d(ie(e.key), .48)}`, + background: f(re(e.key), .22), + border: `1px solid ${f(re(e.key), .48)}`, borderRadius: "999px", padding: "2px 8px", letterSpacing: "0.4px", textTransform: "uppercase" }) }, R(e.loras?.length || 0) + " LoRA ", 5)]), - M("div", uc, [t[15] ||= M("div", { style: { + M("div", fc, [t[15] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.58)", @@ -6719,9 +6760,9 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (t) => E(e.model, t.currentTarget) - }, R(e.model || "-"), 9, dc)]), - e.loras?.length ? (I(), z("div", fc, [M("div", pc, R(B(O)("sidebar.generation.loraStack", "LoRA Stack")), 1), M("div", mc, [(I(!0), z(j, null, F(e.loras, (t, n) => (I(), z("div", { + onClick: (t) => D(e.model, t.currentTarget) + }, R(e.model || "-"), 9, pc)]), + e.loras?.length ? (I(), z("div", mc, [M("div", hc, R(B(O)("sidebar.generation.loraStack", "LoRA Stack")), 1), M("div", gc, [(I(!0), z(j, null, F(e.loras, (t, n) => (I(), z("div", { key: `${e.key}-lora-${n}`, style: { "font-size": "12px", @@ -6734,12 +6775,12 @@ var To = ["title"], Eo = ["src"], Do = { border: "1px solid rgba(255,255,255,0.08)", cursor: "pointer" }, - onClick: (e) => E(t, e.currentTarget) - }, R(t), 9, hc))), 128))])])) : N("", !0) + onClick: (e) => D(t, e.currentTarget) + }, R(t), 9, _c))), 128))])])) : N("", !0) ], 4))), 128))])], 4)) : N("", !0), - (I(!0), z(j, null, F(ee.value, (e) => (I(), z("div", { + (I(!0), z(j, null, F(te.value, (e) => (I(), z("div", { key: e.key, - style: L(f(e.accent, { emphasis: e.emphasis })) + style: L(m(e.accent, { emphasis: e.emphasis })) }, [M("div", { style: L({ fontSize: "11px", fontWeight: "600", @@ -6747,7 +6788,7 @@ var To = ["title"], Eo = ["src"], Do = { textTransform: "uppercase", letterSpacing: "0.5px", marginBottom: "10px" - }) }, R(e.title), 5), M("div", gc, [(I(!0), z(j, null, F(e.fields, (t) => (I(), z(j, { key: `${e.key}-${t.label}` }, [M("div", { + }) }, R(e.title), 5), M("div", vc, [(I(!0), z(j, null, F(e.fields, (t) => (I(), z(j, { key: `${e.key}-${t.label}` }, [M("div", { title: t.label, style: { "font-size": "11px", @@ -6759,9 +6800,9 @@ var To = ["title"], Eo = ["src"], Do = { } }, [M("span", null, R(t.label) + ":", 1), t.override ? (I(), z("span", { key: 0, - style: L(m()), + style: L(g()), title: B(O)("sidebar.generation.overrideTooltip", "This field was forced by Majoor Gen Info Override") - }, R(B(O)("sidebar.generation.override", "override")), 13, vc)) : N("", !0)], 8, _c), M("div", { + }, R(B(O)("sidebar.generation.override", "override")), 13, bc)) : N("", !0)], 8, yc), M("div", { title: `${t.label}: ${t.value}`, style: { "font-size": "12px", @@ -6770,12 +6811,12 @@ var To = ["title"], Eo = ["src"], Do = { "white-space": "pre-wrap", cursor: "pointer" }, - onClick: (e) => E(t.value, e.currentTarget) - }, R(t.value), 9, yc)], 64))), 128))])], 4))), 128)), - h.value.notesFields.length ? (I(), z("div", { + onClick: (e) => D(t.value, e.currentTarget) + }, R(t.value), 9, xc)], 64))), 128))])], 4))), 128)), + _.value.notesFields.length ? (I(), z("div", { key: 10, - style: L(f("#4CAF50", { emphasis: !1 })) - }, [M("div", bc, R(B(O)("sidebar.generation.notes", "Notes")), 1), (I(!0), z(j, null, F(h.value.notesFields, (e) => (I(), z("div", { + style: L(m("#4CAF50", { emphasis: !1 })) + }, [M("div", Sc, R(B(O)("sidebar.generation.notes", "Notes")), 1), (I(!0), z(j, null, F(_.value.notesFields, (e) => (I(), z("div", { key: e.label, title: `${e.label}: ${e.value}`, style: { @@ -6786,18 +6827,18 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (t) => E(e.value, t.currentTarget) - }, R(e.value), 9, xc))), 128))], 4)) : N("", !0), - h.value.moduleBlocks.length ? (I(), z("div", { + onClick: (t) => D(e.value, t.currentTarget) + }, R(e.value), 9, Cc))), 128))], 4)) : N("", !0), + _.value.moduleBlocks.length ? (I(), z("div", { key: 11, - style: L(f("#26C6DA", { + style: L(m("#26C6DA", { emphasis: !0, startAlpha: .14, endAlpha: .08 })) - }, [M("div", Sc, R(B(O)("sidebar.generation.modules", "Modules")), 1), M("div", Cc, [(I(!0), z(j, null, F(h.value.moduleBlocks, (e) => (I(), z("div", { + }, [M("div", wc, R(B(O)("sidebar.generation.modules", "Modules")), 1), M("div", Tc, [(I(!0), z(j, null, F(_.value.moduleBlocks, (e) => (I(), z("div", { key: `module-${e.key}-${e.title}`, - style: L(T(e.accent, !1)) + style: L(w(e.accent, !1)) }, [M("div", { style: L({ fontSize: "10px", fontWeight: "800", @@ -6812,7 +6853,7 @@ var To = ["title"], Eo = ["src"], Do = { gap: "3px", "min-width": "0" } - }, [M("span", wc, R(t.label), 1), M("span", { + }, [M("span", Ec, R(t.label), 1), M("span", { title: `${t.label}: ${t.value}`, style: { "font-size": "12px", @@ -6822,12 +6863,12 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: (e) => E(t.value, e.currentTarget) - }, R(t.value), 9, Tc)]))), 128))], 4))), 128))])], 4)) : N("", !0), - h.value.ttsInstruction ? (I(), z("div", { + onClick: (e) => D(t.value, e.currentTarget) + }, R(t.value), 9, Dc)]))), 128))], 4))), 128))])], 4)) : N("", !0), + _.value.ttsInstruction ? (I(), z("div", { key: 12, - style: L(f("#26A69A", { emphasis: !1 })) - }, [M("div", Ec, [M("span", null, R(B(O)("sidebar.generation.ttsInstruction", "TTS Instruction")), 1)]), M("div", { + style: L(m("#26A69A", { emphasis: !1 })) + }, [M("div", Oc, [M("span", null, R(B(O)("sidebar.generation.ttsInstruction", "TTS Instruction")), 1)]), M("div", { title: B(O)("action.clickToCopy", "Click to copy"), style: { "font-size": "12px", @@ -6837,13 +6878,13 @@ var To = ["title"], Eo = ["src"], Do = { "word-break": "break-word", cursor: "pointer" }, - onClick: t[6] ||= (e) => E(h.value.ttsInstruction, e.currentTarget) - }, R(h.value.ttsInstruction), 9, Dc)], 4)) : N("", !0), - h.value.seed !== null && h.value.seed !== void 0 && h.value.seed !== "" ? (I(), z("div", { + onClick: t[6] ||= (e) => D(_.value.ttsInstruction, e.currentTarget) + }, R(_.value.ttsInstruction), 9, kc)], 4)) : N("", !0), + _.value.seed !== null && _.value.seed !== void 0 && _.value.seed !== "" ? (I(), z("div", { key: 13, - style: L(p()) - }, [M("div", Oc, R(B(O)("sidebar.generation.seed", "SEED")), 1), M("div", { - title: B(O)("sidebar.generation.copySeedTooltip", "Click to copy seed: {seed}", { seed: h.value.seed }), + style: L(h()) + }, [M("div", Ac, R(B(O)("sidebar.generation.seed", "SEED")), 1), M("div", { + title: B(O)("sidebar.generation.copySeedTooltip", "Click to copy seed: {seed}", { seed: _.value.seed }), style: { "font-size": "18px", "font-weight": "700", @@ -6855,11 +6896,11 @@ var To = ["title"], Eo = ["src"], Do = { "border-radius": "4px", transition: "background 0.2s" }, - onClick: t[7] ||= (e) => E(h.value.seed, e.currentTarget, "rgba(76, 175, 80, 0.4)") - }, R(h.value.seed), 9, kc)], 4)) : N("", !0), - h.value.inputFiles.length ? (I(), z("div", { + onClick: t[7] ||= (e) => D(_.value.seed, e.currentTarget, "rgba(76, 175, 80, 0.4)") + }, R(_.value.seed), 9, jc)], 4)) : N("", !0), + _.value.inputFiles.length ? (I(), z("div", { key: 14, - style: L(f("#4CAF50", { + style: L(m("#4CAF50", { emphasis: !0, startAlpha: .16, endAlpha: .1 @@ -6874,14 +6915,14 @@ var To = ["title"], Eo = ["src"], Do = { "letter-spacing": "0.5px", "margin-bottom": "8px" } - }, R(B(O)("sidebar.generation.sourceFiles", "Source Files")), 9, Ac), M("div", jc, [(I(!0), z(j, null, F(h.value.inputFiles, (e) => (I(), Ze(Mo, { + }, R(B(O)("sidebar.generation.sourceFiles", "Source Files")), 9, Mc), M("div", Nc, [(I(!0), z(j, null, F(_.value.inputFiles, (e) => (I(), $e(Po, { key: e.id, "input-file": e }, null, 8, ["input-file"]))), 128))])], 4)) : N("", !0) ])); }; } -}), Nc = { +}), Fc = { key: 0, class: "mjr-sidebar-section", style: { @@ -6891,14 +6932,14 @@ var To = ["title"], Eo = ["src"], Do = { padding: "12px", "min-width": "300px" } -}, Pc = { style: { "margin-bottom": "12px" } }, Fc = { style: { +}, Ic = { style: { "margin-bottom": "12px" } }, Lc = { style: { "font-size": "16px", "font-weight": "800", color: "rgba(255,255,255,0.94)", "line-height": "1.25", overflow: "hidden", "text-overflow": "ellipsis" -} }, Ic = ["title"], Lc = { +} }, Rc = ["title"], zc = { key: 1, style: { display: "flex", @@ -6908,16 +6949,16 @@ var To = ["title"], Eo = ["src"], Do = { "min-width": "0" }, "aria-label": "Workflow metadata badges" -}, Rc = ["title"], zc = { style: { +}, Bc = ["title"], Vc = { style: { overflow: "hidden", "text-overflow": "ellipsis", "white-space": "nowrap" -} }, Bc = { style: { +} }, Hc = { style: { display: "flex", "flex-wrap": "wrap", gap: "8px", "margin-bottom": "10px" -} }, Vc = { style: { +} }, Uc = { style: { padding: "4px 9px", "border-radius": "999px", background: "rgba(33,150,243,0.14)", @@ -6927,7 +6968,7 @@ var To = ["title"], Eo = ["src"], Do = { color: "#90CAF9", "text-transform": "uppercase", "letter-spacing": "0.4px" -} }, Hc = { +} }, Wc = { key: 0, style: { padding: "4px 9px", @@ -6938,26 +6979,13 @@ var To = ["title"], Eo = ["src"], Do = { "font-weight": "600", color: "rgba(255,255,255,0.82)" } -}, Uc = { style: { +}, Gc = { style: { display: "grid", "grid-template-columns": "repeat(2, minmax(0, 1fr))", gap: "8px", "margin-bottom": "12px" -} }, Wc = { - key: 0, - style: { - padding: "8px 10px", - "border-radius": "10px", - background: "rgba(255,255,255,0.04)", - border: "1px solid rgba(255,255,255,0.10)" - } -}, Gc = { style: { - "font-size": "13px", - "font-weight": "750", - color: "rgba(255,255,255,0.92)", - "margin-top": "3px" } }, Kc = { - key: 1, + key: 0, style: { padding: "8px 10px", "border-radius": "10px", @@ -6970,7 +6998,7 @@ var To = ["title"], Eo = ["src"], Do = { color: "rgba(255,255,255,0.92)", "margin-top": "3px" } }, Jc = { - key: 2, + key: 1, style: { padding: "8px 10px", "border-radius": "10px", @@ -6983,7 +7011,7 @@ var To = ["title"], Eo = ["src"], Do = { color: "rgba(255,255,255,0.92)", "margin-top": "3px" } }, Xc = { - key: 3, + key: 2, style: { padding: "8px 10px", "border-radius": "10px", @@ -6991,18 +7019,31 @@ var To = ["title"], Eo = ["src"], Do = { border: "1px solid rgba(255,255,255,0.10)" } }, Zc = { style: { + "font-size": "13px", + "font-weight": "750", + color: "rgba(255,255,255,0.92)", + "margin-top": "3px" +} }, Qc = { + key: 3, + style: { + padding: "8px 10px", + "border-radius": "10px", + background: "rgba(255,255,255,0.04)", + border: "1px solid rgba(255,255,255,0.10)" + } +}, $c = { style: { "font-size": "12px", "font-weight": "650", color: "rgba(255,255,255,0.84)", "margin-top": "3px" -} }, Qc = { +} }, el = { key: 0, style: { "font-size": "11px", color: "rgba(255,255,255,0.54)", "margin-top": "2px" } -}, $c = { +}, tl = { key: 0, style: { "margin-bottom": "12px", @@ -7011,14 +7052,14 @@ var To = ["title"], Eo = ["src"], Do = { background: "rgba(244,67,54,0.08)", border: "1px solid rgba(244,67,54,0.25)" } -}, el = { +}, nl = { key: 1, style: { display: "flex", "flex-wrap": "wrap", gap: "5px" } -}, tl = { +}, rl = { key: 1, style: { "margin-bottom": "12px", @@ -7027,7 +7068,7 @@ var To = ["title"], Eo = ["src"], Do = { background: "rgba(255,255,255,0.035)", border: "1px solid rgba(255,255,255,0.10)" } -}, nl = { +}, il = { key: 0, style: { "font-size": "12px", @@ -7035,12 +7076,12 @@ var To = ["title"], Eo = ["src"], Do = { color: "rgba(255,255,255,0.82)", "white-space": "pre-wrap" } -}, rl = { style: { +}, al = { style: { display: "grid", "grid-template-columns": "repeat(3, minmax(0, 1fr))", gap: "8px", "margin-bottom": "12px" -} }, il = { +} }, ol = { key: 2, style: { "margin-bottom": "12px", @@ -7049,71 +7090,61 @@ var To = ["title"], Eo = ["src"], Do = { background: "rgba(76,175,80,0.07)", border: "1px solid rgba(76,175,80,0.22)" } -}, al = { style: { +}, sl = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "8px", "margin-bottom": "7px" -} }, ol = { style: { +} }, cl = { style: { "font-size": "11px", color: "rgba(255,255,255,0.62)" -} }, sl = { +} }, ll = { key: 0, style: { display: "flex", "flex-direction": "column", gap: "6px" } -}, cl = { +}, ul = { key: 0, style: { display: "flex", "flex-wrap": "wrap", gap: "5px" } -}, ll = { +}, dl = { key: 1, style: { display: "flex", "flex-wrap": "wrap", gap: "5px" } -}, ul = { +}, fl = { key: 1, style: { "font-size": "12px", color: "rgba(255,255,255,0.78)" } -}, dl = { +}, pl = { key: 2, style: { "margin-top": "7px", "font-size": "11px", color: "rgba(255,255,255,0.58)" } -}, fl = { +}, ml = { key: 3, style: { "margin-top": "8px", "font-size": "11px", color: "rgba(255,255,255,0.62)" } -}, pl = { key: 0 }, ml = { style: { +}, hl = { key: 0 }, gl = { style: { display: "grid", "grid-template-columns": "repeat(3, minmax(0, 1fr))", gap: "8px", "margin-bottom": "12px" -} }, hl = { style: { - padding: "8px 10px", - "border-radius": "10px", - background: "rgba(255,255,255,0.04)", - border: "1px solid rgba(255,255,255,0.10)" -} }, gl = { style: { - "font-size": "18px", - "font-weight": "700", - color: "rgba(255,255,255,0.94)", - "margin-top": "2px" } }, _l = { style: { padding: "8px 10px", "border-radius": "10px", @@ -7134,7 +7165,17 @@ var To = ["title"], Eo = ["src"], Do = { "font-weight": "700", color: "rgba(255,255,255,0.94)", "margin-top": "2px" -} }, xl = { +} }, xl = { style: { + padding: "8px 10px", + "border-radius": "10px", + background: "rgba(255,255,255,0.04)", + border: "1px solid rgba(255,255,255,0.10)" +} }, Sl = { style: { + "font-size": "18px", + "font-weight": "700", + color: "rgba(255,255,255,0.94)", + "margin-top": "2px" +} }, Cl = { key: 3, style: { "margin-bottom": "12px", @@ -7143,41 +7184,41 @@ var To = ["title"], Eo = ["src"], Do = { background: "rgba(255,255,255,0.03)", border: "1px solid rgba(255,255,255,0.10)" } -}, Sl = { style: { +}, wl = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "10px", "margin-bottom": "8px", "min-width": "0" -} }, Cl = { style: { +} }, Tl = { style: { "min-width": "0", flex: "1 1 auto" -} }, wl = ["title"], Tl = ["title"], El = { style: { +} }, El = ["title"], Dl = ["title"], Ol = { style: { display: "flex", gap: "8px", "align-items": "center" -} }, Dl = ["placeholder"], Ol = { +} }, kl = ["placeholder"], Al = { key: 4, class: "mjr-workflow-tree-wrap" -}, kl = { class: "mjr-workflow-tree-node" }, Al = { class: "mjr-workflow-tree-node-name" }, jl = { +}, jl = { class: "mjr-workflow-tree-node" }, Ml = { class: "mjr-workflow-tree-node-name" }, Nl = { key: 0, class: "mjr-workflow-tree-node-type" -}, Ml = { class: "mjr-menu-item-hint" }, Nl = { +}, Pl = { class: "mjr-menu-item-hint" }, Fl = { key: 0, class: "mjr-section-hint" -}, Pl = { style: { +}, Il = { style: { display: "flex", "align-items": "center", "justify-content": "space-between", gap: "10px", "margin-top": "8px" -} }, Fl = { style: { +} }, Ll = { style: { display: "flex", "flex-wrap": "wrap", gap: "6px", "align-items": "center" -} }, Il = { +} }, Rl = { key: 5, style: { display: "grid", @@ -7187,23 +7228,23 @@ var To = ["title"], Eo = ["src"], Do = { "margin-top": "10px", "margin-bottom": "10px" } -}, Ll = { style: { +}, zl = { style: { display: "flex", "flex-direction": "column", gap: "2px", "min-width": "0" -} }, Rl = { style: { +} }, Bl = { style: { "font-size": "13px", "font-weight": "600" -} }, zl = { style: { +} }, Vl = { style: { "font-size": "11px", color: "rgba(255,255,255,0.58)" -} }, Bl = { style: { +} }, Hl = { style: { display: "flex", gap: "10px", "align-items": "stretch", "margin-top": "10px" -} }, Vl = { style: { +} }, Ul = { style: { display: "flex", "justify-content": "space-between", "align-items": "center", @@ -7211,7 +7252,7 @@ var To = ["title"], Eo = ["src"], Do = { "margin-top": "8px", "font-size": "11px", color: "rgba(255,255,255,0.58)" -} }, Hl = ["open"], Ul = { style: { +} }, Wl = ["open"], Gl = { style: { background: "rgba(0,0,0,0.5)", padding: "10px", "border-radius": "6px", @@ -7221,11 +7262,11 @@ var To = ["title"], Eo = ["src"], Do = { margin: "10px 0 0 0", color: "#90CAF9", "font-family": "'Consolas', 'Monaco', monospace" -} }, Wl = 1, Gl = 8, Kl = 250, ql = /* @__PURE__ */ tt({ +} }, Kl = 1, ql = 8, Jl = 250, Yl = /* @__PURE__ */ rt({ __name: "SidebarWorkflowSection", props: { asset: {} }, setup(e) { - let t = e, n = Object.freeze({ + let n = e, r = Object.freeze({ nodeColors: !0, showLinks: !0, showGroups: !0, @@ -7234,12 +7275,12 @@ var To = ["title"], Eo = ["src"], Do = { showViewport: !0, showNodeLabels: !1, size: "comfortable" - }), r = Object.freeze({ + }), i = Object.freeze({ zoom: 1, centerX: null, centerY: null, hoveredNodeId: null - }), i = Object.freeze([ + }), a = Object.freeze([ { key: "compact", label: "Compact", @@ -7255,23 +7296,23 @@ var To = ["title"], Eo = ["src"], Do = { label: "Expanded", height: 220 } - ]), a = V(null), s = V(""), c = V(!1), l = V(!1), d = V(null), p = V(!1), m = V(null), h = V([]), g = V(null), _ = V(!1), v = V(!1), b = V(ue()), S = V({ ...r }), C = V("crosshair"), ee = V(""), te = null, w = null, T = null; - function ne(e, t, n) { + ]), o = V(null), s = V(""), c = V(!1), l = V(!1), d = V(null), f = V(!1), p = V(null), m = V([]), g = V(null), v = V(!1), y = V(!1), b = V(ce()), x = V({ ...i }), S = V("crosshair"), C = V(""), te = null, w = null, T = null; + function E(e, t, n) { let r = Number(e); return Number.isFinite(r) ? Math.max(t, Math.min(n, r)) : t; } function re(e) { - !e || typeof e != "object" || (S.value = { - ...S.value, - zoom: ne(e.zoom ?? S.value.zoom, Wl, Gl), + e && typeof e == "object" && (x.value = { + ...x.value, + zoom: E(e.zoom ?? x.value.zoom, Kl, ql), centerX: Number.isFinite(Number(e.centerX)) ? Number(e.centerX) : null, centerY: Number.isFinite(Number(e.centerY)) ? Number(e.centerY) : null }); } - function ie() { - S.value = { ...r }, ee.value = ""; + function D() { + x.value = { ...i }, C.value = ""; } - function oe(e) { + function ie(e) { let t = e?.metadata_raw ?? null; if (!t) return null; if (typeof t == "object") return t; @@ -7287,19 +7328,19 @@ var To = ["title"], Eo = ["src"], Do = { } return null; } - function se(e) { + function ae(e) { try { let t = Object.entries(e || {}); if (!t.length) return !1; let n = 0; - for (let [, e] of t.slice(0, 50)) if (!(!e || typeof e != "object") && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; + for (let [, e] of t.slice(0, 50)) if (e && typeof e == "object" && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; } catch { return !1; } return !1; } - function ce(e) { - let t = oe(e), n = e?.workflow || e?.Workflow || e?.comfy_workflow || t?.workflow || t?.Workflow || t?.comfy_workflow || null; + function oe(e) { + let t = ie(e), n = e?.workflow || e?.Workflow || e?.comfy_workflow || t?.workflow || t?.Workflow || t?.comfy_workflow || null; if (!n) return null; if (typeof n == "object") return n; if (typeof n == "string") { @@ -7313,58 +7354,58 @@ var To = ["title"], Eo = ["src"], Do = { } return null; } - function le(e) { - let t = oe(e), n = e?.prompt || e?.Prompt || t?.prompt || t?.Prompt || null; + function se(e) { + let t = ie(e), n = e?.prompt || e?.Prompt || t?.prompt || t?.Prompt || null; if (!n) return null; - if (typeof n == "object") return se(n) ? n : null; + if (typeof n == "object") return ae(n) ? n : null; if (typeof n == "string") { let e = n.trim(); if (!e) return null; try { let t = JSON.parse(e); - return se(t) ? t : null; + return ae(t) ? t : null; } catch { return null; } } return null; } - function ue() { + function ce() { try { - let e = Gt?.()?.workflowMinimap; + let e = qt?.()?.workflowMinimap; if (e && typeof e == "object") return { - ...n, + ...r, ...e }; } catch (e) { console.debug?.(e); } try { - let e = localStorage?.getItem?.(ae); - if (!e) return { ...n }; + let e = localStorage?.getItem?.(Ce); + if (!e) return { ...r }; let t = JSON.parse(e); - if (!t || typeof t != "object") return { ...n }; - let r = { - ...n, + if (!t || typeof t != "object") return { ...r }; + let n = { + ...r, ...t }; try { - let e = Gt(); + let e = qt(); e.workflowMinimap = { ...e.workflowMinimap, - ...r - }, G(e), localStorage?.removeItem?.(ae); + ...n + }, G(e), localStorage?.removeItem?.(Ce); } catch (e) { console.debug?.(e); } - return r; + return n; } catch { - return { ...n }; + return { ...r }; } } - function de(e) { + function le(e) { try { - let t = Gt(); + let t = qt(); t.workflowMinimap = { ...t.workflowMinimap, ...e @@ -7373,35 +7414,35 @@ var To = ["title"], Eo = ["src"], Do = { console.debug?.(e); } } - let D = P(() => { - let e = ce(t.asset) || ce(d.value), n = le(t.asset) || le(d.value); - return !e && !n ? null : e || fa(n); - }), fe = P(() => String(t.asset?.filepath || t.asset?.path || t.asset?.file_info?.filepath || "").trim()), pe = P(() => { - if (fe.value.toLowerCase().endsWith(".json")) return !0; - let e = String(t.asset?.kind || "").trim().toLowerCase(), n = String(t.asset?.source || "").trim().toLowerCase(); - return e === "workflow" || n === "workflow"; - }), me = P(() => String(t.asset?.display_name || t.asset?.name || t.asset?.filename || t.asset?.title || "Workflow").trim()), he = P(() => String(t.asset?.task || t.asset?.workflow_task || "").trim()), _e = P(() => String(t.asset?.model_family || t.asset?.workflow_model_family || "").trim()), ve = P(() => String(t.asset?.provider || t.asset?.workflow_provider || "").trim()), ye = P(() => String(t.asset?.runs_on || t.asset?.runsOn || "").trim().toLowerCase()), be = P(() => { - let e = ye.value, t = ve.value; + let ue = P(() => { + let e = oe(n.asset) || oe(d.value), t = se(n.asset) || se(d.value); + return !e && !t ? null : e || ma(t); + }), de = P(() => String(n.asset?.filepath || n.asset?.path || n.asset?.file_info?.filepath || "").trim()), fe = P(() => { + if (de.value.toLowerCase().endsWith(".json")) return !0; + let e = String(n.asset?.kind || "").trim().toLowerCase(), t = String(n.asset?.source || "").trim().toLowerCase(); + return e === "workflow" || t === "workflow"; + }), pe = P(() => String(n.asset?.display_name || n.asset?.name || n.asset?.filename || n.asset?.title || "Workflow").trim()), me = P(() => String(n.asset?.task || n.asset?.workflow_task || "").trim()), he = P(() => String(n.asset?.model_family || n.asset?.workflow_model_family || "").trim()), ge = P(() => String(n.asset?.provider || n.asset?.workflow_provider || "").trim()), _e = P(() => String(n.asset?.runs_on || n.asset?.runsOn || "").trim().toLowerCase()), ve = P(() => { + let e = _e.value, t = ge.value; return e === "api" && t ? `API · ${t}` : e ? t && t.toLowerCase() !== e ? `${e} · ${t}` : e : t; - }), xe = P(() => String(t.asset?.notes || "").trim()), Ce = P(() => [ - t.asset?.detected_task ? `detected: ${t.asset.detected_task}` : "", - t.asset?.detected_model_family ? t.asset.detected_model_family : "", - t.asset?.detected_provider ? t.asset.detected_provider : "" - ].filter(Boolean).join(" · ")), we = P(() => Re(t.asset?.missing_nodes || t.asset?.missingNodes)), Te = P(() => Re(t.asset?.missing_models || t.asset?.missingModels)), Ee = P(() => Re(t.asset?.tags || t.asset?.workflow_tags || t.asset?.tags_json)), De = P(() => Ee.value.slice(0, 3)), Oe = P(() => Math.max(0, Ee.value.length - De.value.length)), ke = P(() => Re(m.value?.missing_nodes)), Ae = P(() => Re(m.value?.missing_models)), je = P(() => Re(m.value?.warnings)), Me = P(() => { - let e = m.value; + }), ye = P(() => String(n.asset?.notes || "").trim()), be = P(() => [ + n.asset?.detected_task ? `detected: ${n.asset.detected_task}` : "", + n.asset?.detected_model_family ? n.asset.detected_model_family : "", + n.asset?.detected_provider ? n.asset.detected_provider : "" + ].filter(Boolean).join(" · ")), Se = P(() => ze(n.asset?.missing_nodes || n.asset?.missingNodes)), we = P(() => ze(n.asset?.missing_models || n.asset?.missingModels)), Te = P(() => ze(n.asset?.tags || n.asset?.workflow_tags || n.asset?.tags_json)), De = P(() => Te.value.slice(0, 3)), Oe = P(() => Math.max(0, Te.value.length - De.value.length)), ke = P(() => ze(p.value?.missing_nodes)), Ae = P(() => ze(p.value?.missing_models)), je = P(() => ze(p.value?.warnings)), Me = P(() => { + let e = p.value; return e ? `${Number(e.node_count || 0)} nodes | ${Number(e.subgraph_count || 0)} subgraphs | ${Array.isArray(e.required_nodes) ? e.required_nodes.length : 0} node types` : ""; }), Ne = P(() => { - let e = h.value?.[0]; + let e = m.value?.[0]; return e ? String(e.filename || "").replace(/\.json$/i, "") : ""; }), Pe = P(() => { let e = g.value; return e ? `${Number(e.changed?.length || 0)} changed | ${Number(e.added?.length || 0)} added | ${Number(e.removed?.length || 0)} removed` : ""; }), Fe = P(() => { - let e = Number(t.asset?.usage_count || t.asset?.usageCount || 0); + let e = Number(n.asset?.usage_count || n.asset?.usageCount || 0); return !Number.isFinite(e) || e <= 0 ? "" : `${Math.floor(e)} use${e === 1 ? "" : "s"}`; - }), k = P(() => ze(t.asset?.last_loaded_at || t.asset?.lastLoadedAt)), Ie = P(() => ze(t.asset?.mtime || t.asset?.modified_at || t.asset?.updated_at)), Le = P(() => { + }), Ie = P(() => A(n.asset?.last_loaded_at || n.asset?.lastLoadedAt)), Le = P(() => A(n.asset?.mtime || n.asset?.modified_at || n.asset?.updated_at)), k = P(() => { let e = []; - t.asset?.favorite && e.push({ + n.asset?.favorite && e.push({ key: "favorite", label: "Favorite", icon: "pi pi-star-fill", @@ -7411,9 +7452,9 @@ var To = ["title"], Eo = ["src"], Do = { label: Fe.value, icon: "pi pi-play-circle", tone: "usage" - }), k.value && e.push({ + }), Ie.value && e.push({ key: "last-loaded", - label: `Loaded ${k.value}`, + label: `Loaded ${Ie.value}`, icon: "pi pi-clock", tone: "loaded" }); @@ -7430,25 +7471,25 @@ var To = ["title"], Eo = ["src"], Do = { tone: "tag" }), e; }); - function A(e) { + function Re(e) { let t = "display:inline-flex;align-items:center;gap:5px;max-width:100%;padding:4px 8px;border-radius:999px;font-size:10px;font-weight:750;line-height:1.1;overflow:hidden"; return e === "favorite" ? `${t};background:rgba(255,193,7,0.15);border:1px solid rgba(255,193,7,0.34);color:#ffe082` : e === "usage" ? `${t};background:rgba(33,150,243,0.14);border:1px solid rgba(33,150,243,0.30);color:#90caf9` : e === "loaded" ? `${t};background:rgba(76,175,80,0.13);border:1px solid rgba(76,175,80,0.28);color:#a5d6a7` : `${t};background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.14);color:rgba(255,255,255,0.82)`; } - function Re(e) { + function ze(e) { if (Array.isArray(e)) return e.map((e) => String(e || "").trim()).filter(Boolean); if (typeof e == "string") { let t = e.trim(); if (!t) return []; try { let e = JSON.parse(t); - if (Array.isArray(e)) return Re(e); + if (Array.isArray(e)) return ze(e); } catch { return t.split(/[,\n]/).map((e) => e.trim()).filter(Boolean); } } return []; } - function ze(e) { + function A(e) { let t = Number(e); if (!Number.isFinite(t) || t <= 0) return ""; let n = t > 1e10 ? t : t * 1e3; @@ -7459,12 +7500,12 @@ var To = ["title"], Eo = ["src"], Do = { } } async function Be() { - if (D.value) return; - let e = fe.value; + if (ue.value) return; + let e = de.value; if (e && !l.value) { l.value = !0; try { - let t = await y(e, { timeoutMs: 25e3 }); + let t = await ee(e, { timeoutMs: 25e3 }); if (!t?.ok) return; let n = t?.data?.workflow || t?.workflow || null, r = t?.data?.prompt || t?.prompt || null; if (!n && !r) return; @@ -7479,125 +7520,125 @@ var To = ["title"], Eo = ["src"], Do = { } } } - let He = P(() => t.asset?.has_generation_data ? "Complete" : "Partial"), Ue = P(() => D.value ? JSON.stringify(D.value, null, 2) : ""), We = P(() => String(t.asset?.category || t.asset?.subfolder || t.asset?.folder || "").trim().replace(/^\/+|\/+$/g, "")), Ge = P(() => We.value ? We.value.split(/[\\/]+/).filter(Boolean) : []), Ke = P(() => Ge.value.at(-1) || We.value || "Root"), qe = P(() => Ge.value.slice(-1)); + let Ve = P(() => n.asset?.has_generation_data ? "Complete" : "Partial"), He = P(() => ue.value ? JSON.stringify(ue.value, null, 2) : ""), We = P(() => String(n.asset?.category || n.asset?.subfolder || n.asset?.folder || "").trim().replace(/^\/+|\/+$/g, "")), Ge = P(() => We.value ? We.value.split(/[\\/]+/).filter(Boolean) : []), Ke = P(() => Ge.value.at(-1) || We.value || "Root"), qe = P(() => Ge.value.slice(-1)); function Je(e, t) { let n = e?.id ?? e?.key ?? t + 1; return String(e?.title || e?._meta?.title || e?.type || e?.class_type || e?.name || `Node ${n}`); } - function tt(e) { + function Ye(e) { return String(e?.type || e?.class_type || e?.name || "").trim(); } - function rt() { + function Xe() { s.value = We.value; } - async function at() { - if (!pe.value) return; - let e = String(t.asset?.filepath || t.asset?.path || t.asset?.file_info?.filepath || "").trim(); + async function rt() { + if (!fe.value) return; + let e = String(n.asset?.filepath || n.asset?.path || n.asset?.file_info?.filepath || "").trim(); if (!e) { - E(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); + t(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = String(s.value || "").trim(); - if (n !== We.value) { + let r = String(s.value || "").trim(); + if (r !== We.value) { c.value = !0; try { - let t = await f({ + let n = await _({ filepath: e, - category: n + category: r }, { timeoutMs: 3e4 }); - if (!t?.ok) { - E(t?.error || O("toast.workflowMoveFailed", "Failed to move workflow."), "error"); + if (!n?.ok) { + t(n?.error || O("toast.workflowMoveFailed", "Failed to move workflow."), "error"); return; } - s.value = String(t?.data?.workflow?.category || n || "").trim(), E(O("toast.workflowCategoryUpdated", "Workflow category updated"), "success", 1800); + s.value = String(n?.data?.workflow?.category || r || "").trim(), t(O("toast.workflowCategoryUpdated", "Workflow category updated"), "success", 1800); } catch { - E(O("toast.workflowMoveFailed", "Failed to move workflow."), "error"); + t(O("toast.workflowMoveFailed", "Failed to move workflow."), "error"); } finally { c.value = !1; } } } - async function ot() { - let e = fe.value; + async function at() { + let e = de.value; if (!e) { - E(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); + t(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = await Se({ + let r = await Ee({ filepath: e, limit: 12 }, { timeoutMs: 15e3 }); - if (!n?.ok) { - E(n?.error || O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + if (!r?.ok) { + t(r?.error || O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - let r = Array.isArray(n.data) ? n.data : []; - if (!r.length) { - E(O("toast.workflowThumbnailNoCandidates", "No linked outputs are available for this workflow yet."), "warning", 2600); + let i = Array.isArray(r.data) ? r.data : []; + if (!i.length) { + t(O("toast.workflowThumbnailNoCandidates", "No linked outputs are available for this workflow yet."), "warning", 2600); return; } - let i = await ma({ + let a = await ga({ title: O("ctx.setWorkflowThumbnail", "Set workflow thumbnail"), - workflow: t.asset, - items: r + workflow: n.asset, + items: i }); - if (!i?.filepath) return; - let a = await u({ + if (!a?.filepath) return; + let o = await h({ filepath: e, - source_filepath: i.filepath + source_filepath: a.filepath }, { timeoutMs: 3e4 }); - if (!a?.ok) { - E(a?.error || O("toast.workflowSaveFailed", "Failed to save workflow."), "error"); + if (!o?.ok) { + t(o?.error || O("toast.workflowSaveFailed", "Failed to save workflow."), "error"); return; } - E(O("toast.workflowUpdated", "Workflow updated"), "success", 1800), window?.dispatchEvent?.(new CustomEvent("mjr:reload-grid", { detail: { reason: "workflow-thumbnail-sidebar" } })); + t(O("toast.workflowUpdated", "Workflow updated"), "success", 1800), window?.dispatchEvent?.(new CustomEvent("mjr:reload-grid", { detail: { reason: "workflow-thumbnail-sidebar" } })); } async function st() { - if (await Be(), !D.value) { - E(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + if (await Be(), !ue.value) { + t(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } try { - await Ye.openAssets({ + await Ze.openAssets({ assets: [{ - ...t.asset, - workflow: D.value, - Workflow: D.value + ...n.asset, + workflow: ue.value, + Workflow: ue.value }], index: 0, mode: "graph" }); } catch (e) { - console.debug?.(e), E(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + console.debug?.(e), t(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); } } async function ct() { - let e = fe.value; + let e = de.value; if (!e) { - E(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); + t(O("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - p.value = !0, m.value = null, h.value = [], g.value = null; + f.value = !0, p.value = null, m.value = [], g.value = null; try { - let [t, n] = await Promise.all([o(e, { timeoutMs: 2e4 }), x(e, { timeoutMs: 15e3 })]); - if (!t?.ok) { - E(t?.error || O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + let [n, r] = await Promise.all([u(e, { timeoutMs: 2e4 }), ne(e, { timeoutMs: 15e3 })]); + if (!n?.ok) { + t(n?.error || O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - m.value = t.data || {}, h.value = Array.isArray(n?.data?.versions) ? n.data.versions : []; - let r = h.value[0]; - if (r?.filepath) { - let t = await ge(e, r.filepath, { timeoutMs: 15e3 }); + p.value = n.data || {}, m.value = Array.isArray(r?.data?.versions) ? r.data.versions : []; + let i = m.value[0]; + if (i?.filepath) { + let t = await xe(e, i.filepath, { timeoutMs: 15e3 }); t?.ok && (g.value = t.data || null); } } catch (e) { - console.debug?.(e), E(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + console.debug?.(e), t(O("toast.workflowLoadFailed", "Failed to load workflow."), "error"); } finally { - p.value = !1; + f.value = !1; } } - let lt = P(() => (Array.isArray(D.value?.nodes) ? D.value.nodes : []).slice(0, Kl).map((e, t) => { - let n = e?.id ?? e?.key ?? t + 1, r = tt(e); + let lt = P(() => (Array.isArray(ue.value?.nodes) ? ue.value.nodes : []).slice(0, Jl).map((e, t) => { + let n = e?.id ?? e?.key ?? t + 1, r = Ye(e); return { key: String(n), label: Je(e, t), @@ -7608,7 +7649,7 @@ var To = ["title"], Eo = ["src"], Do = { } }; })), ut = P(() => Math.max(0, Number(dt.value.nodes || 0) - lt.value.length)), dt = P(() => { - let e = D.value; + let e = ue.value; return e ? { nodes: Array.isArray(e?.nodes) ? e.nodes.length : 0, links: Array.isArray(e?.links) && e.links.length || Array.isArray(e?.extra?.links) && e.extra.links.length || 0, @@ -7622,8 +7663,8 @@ var To = ["title"], Eo = ["src"], Do = { }; }), ft = P(() => { let e = String(b.value?.size || "comfortable"); - return i.find((t) => t.key === e) || i[1]; - }), pt = P(() => `${ft.value.height}px`), ht = P(() => [ + return a.find((t) => t.key === e) || a[1]; + }), pt = P(() => `${ft.value.height}px`), mt = P(() => [ { key: "showNodeLabels", label: "Node Labels", @@ -7660,22 +7701,22 @@ var To = ["title"], Eo = ["src"], Do = { iconClass: "pi pi-window-maximize" } ]); - function gt() { - let e = a.value, t = D.value; + function ht() { + let e = o.value, t = ue.value; if (!e || !t) return; let n = Math.max(1, e.clientWidth || 320), r = Math.max(1, e.clientHeight || 120), i = Math.max(1, Math.min(2, window.devicePixelRatio || 1)); e.width = Math.floor(n * i), e.height = Math.floor(r * i); - let o = e.getContext("2d"); - o && o.setTransform(i, 0, 0, i, 0, 0), w = na(e, t, { + let a = e.getContext("2d"); + a && a.setTransform(i, 0, 0, i, 0, 0), w = ia(e, t, { ...b.value, - view: S.value + view: x.value }) || null, re(w?.resolvedView); } function _t(e) { - Ve(e); + Ue(e); } function vt(e) { - let t = a.value; + let t = o.value; if (!t) return null; let n = t.getBoundingClientRect?.(); return n ? { @@ -7691,23 +7732,23 @@ var To = ["title"], Eo = ["src"], Do = { }; } function bt(e) { - let t = vt(e), n = t && w?.hitTestNode ? w.hitTestNode(t.x, t.y) : null, r = n?.id !== null && n?.id !== void 0 ? String(n.id) : null, i = S.value.hoveredNodeId !== null && S.value.hoveredNodeId !== void 0 ? String(S.value.hoveredNodeId) : null; - ee.value = n?.label || "", r !== i && (S.value = { - ...S.value, + let t = vt(e), n = t && w?.hitTestNode ? w.hitTestNode(t.x, t.y) : null, r = n?.id !== null && n?.id !== void 0 ? String(n.id) : null, i = x.value.hoveredNodeId !== null && x.value.hoveredNodeId !== void 0 ? String(x.value.hoveredNodeId) : null; + C.value = n?.label || "", r !== i && (x.value = { + ...x.value, hoveredNodeId: r - }, gt()); + }, ht()); } function xt(e) { - e && (_t(e), S.value = { - ...S.value, + e && (_t(e), x.value = { + ...x.value, centerX: Number(e.x), centerY: Number(e.y) - }, gt()); + }, ht()); } function St(e) { if (Number(e?.button ?? 0) !== 0) return; let t = yt(e); - t && (T = e.pointerId ?? 1, C.value = "grabbing", a.value?.setPointerCapture?.(T), xt(t.world), bt(e), e.preventDefault?.(), e.stopPropagation?.()); + t && (T = e.pointerId ?? 1, S.value = "grabbing", o.value?.setPointerCapture?.(T), xt(t.world), bt(e), e.preventDefault?.(), e.stopPropagation?.()); } function Ct(e) { if (T !== null && e.pointerId === T) { @@ -7718,59 +7759,59 @@ var To = ["title"], Eo = ["src"], Do = { bt(e); } function wt(e) { - T !== null && e?.pointerId === T && (a.value?.releasePointerCapture?.(T), T = null, C.value = "crosshair"), e?.type === "pointerleave" && (ee.value = "", S.value.hoveredNodeId !== null && (S.value = { - ...S.value, + T !== null && e?.pointerId === T && (o.value?.releasePointerCapture?.(T), T = null, S.value = "crosshair"), e?.type === "pointerleave" && (C.value = "", x.value.hoveredNodeId !== null && (x.value = { + ...x.value, hoveredNodeId: null - }, gt())); + }, ht())); } - function Ot(e) { + function Tt(e) { let t = yt(e), n = w?.resolvedView; if (!t || !n) return; - let r = ne(Number(e?.deltaY) || 0, -240, 240), i = Math.exp(-r * .0025), a = ne((Number(S.value.zoom) || 1) * i, Wl, Gl); - if (Math.abs(a - (Number(S.value.zoom) || 1)) < .001) { + let r = E(Number(e?.deltaY) || 0, -240, 240), i = Math.exp(-r * .0025), a = E((Number(x.value.zoom) || 1) * i, Kl, ql); + if (Math.abs(a - (Number(x.value.zoom) || 1)) < .001) { e.preventDefault?.(), e.stopPropagation?.(); return; } - let o = Math.max(1, Number(w?.bounds?.width || 1) / a), s = Math.max(1, Number(w?.bounds?.height || 1) / a), c = ne((Number(t.world.x) - Number(n.viewMinX || 0)) / Math.max(1, Number(n.visibleW || 1)), 0, 1), l = ne((Number(t.world.y) - Number(n.viewMinY || 0)) / Math.max(1, Number(n.visibleH || 1)), 0, 1); - S.value = { - ...S.value, + let o = Math.max(1, Number(w?.bounds?.width || 1) / a), s = Math.max(1, Number(w?.bounds?.height || 1) / a), c = E((Number(t.world.x) - Number(n.viewMinX || 0)) / Math.max(1, Number(n.visibleW || 1)), 0, 1), l = E((Number(t.world.y) - Number(n.viewMinY || 0)) / Math.max(1, Number(n.visibleH || 1)), 0, 1); + x.value = { + ...x.value, zoom: a, centerX: Number(t.world.x) + (.5 - c) * o, centerY: Number(t.world.y) + (.5 - l) * s - }, gt(), bt(e), e.preventDefault?.(), e.stopPropagation?.(); + }, ht(), bt(e), e.preventDefault?.(), e.stopPropagation?.(); } - function kt(e) { + function Et(e) { let t = yt(e); - ie(), t && _t(t.world), gt(), e.preventDefault?.(), e.stopPropagation?.(); + D(), t && _t(t.world), ht(), e.preventDefault?.(), e.stopPropagation?.(); } function At(e) { b.value = { ...b.value, [e]: !b.value?.[e] - }, de(b.value); + }, le(b.value); } function jt(e) { - i.some((t) => t.key === e) && (b.value = { + a.some((t) => t.key === e) && (b.value = { ...b.value, size: e - }, de(b.value)); + }, le(b.value)); } - return Dt(() => { - a.value && typeof ResizeObserver == "function" && (te = new ResizeObserver(() => gt()), te.observe(a.value)), rt(), Be(), gt(); - }), et(D, () => { - ie(), gt(); - }, { flush: "post" }), et(fe, () => { + return kt(() => { + o.value && typeof ResizeObserver == "function" && (te = new ResizeObserver(() => ht()), te.observe(o.value)), Xe(), Be(), ht(); + }), nt(ue, () => { + D(), ht(); + }, { flush: "post" }), nt(de, () => { d.value = null, Be(); - }, { immediate: !0 }), et(We, () => { - rt(); - }), et(b, () => { - gt(); + }, { immediate: !0 }), nt(We, () => { + Xe(); + }), nt(b, () => { + ht(); }, { deep: !0, flush: "post" - }), et(_, () => { - gt(); - }, { flush: "post" }), nt(() => { + }), nt(v, () => { + ht(); + }, { flush: "post" }), it(() => { try { te?.disconnect?.(); } catch (e) { @@ -7778,8 +7819,8 @@ var To = ["title"], Eo = ["src"], Do = { } te = null, T = null; }), (e, t) => { - let n = Qe("MButton"), r = Qe("MTree"); - return D.value ? (I(), z("div", Nc, [ + let n = et("MButton"), r = et("MTree"); + return ue.value ? (I(), z("div", Fc, [ t[18] ||= M("div", { style: { "font-size": "13px", "font-weight": "600", @@ -7788,9 +7829,9 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.5px" } }, " ComfyUI Workflow ", -1), - M("div", Pc, [ - M("div", Fc, R(me.value), 1), - fe.value ? (I(), z("div", { + M("div", Ic, [ + M("div", Lc, R(pe.value), 1), + de.value ? (I(), z("div", { key: 0, style: { "font-size": "11px", @@ -7800,44 +7841,44 @@ var To = ["title"], Eo = ["src"], Do = { "text-overflow": "ellipsis", "white-space": "nowrap" }, - title: fe.value - }, R(fe.value), 9, Ic)) : N("", !0), - Le.value.length ? (I(), z("div", Lc, [(I(!0), z(j, null, F(Le.value, (e) => (I(), z("span", { + title: de.value + }, R(de.value), 9, Rc)) : N("", !0), + k.value.length ? (I(), z("div", zc, [(I(!0), z(j, null, F(k.value, (e) => (I(), z("span", { key: e.key, - style: L(A(e.tone)), + style: L(Re(e.tone)), title: e.label }, [M("i", { - class: Tt(e.icon), + class: Dt(e.icon), style: { "font-size": "10px", flex: "0 0 auto" } - }, null, 2), M("span", zc, R(e.label), 1)], 12, Rc))), 128))])) : N("", !0) + }, null, 2), M("span", Vc, R(e.label), 1)], 12, Bc))), 128))])) : N("", !0) ]), - M("div", Bc, [M("div", Vc, R(He.value), 1), dt.value.source ? (I(), z("div", Hc, R(dt.value.source), 1)) : N("", !0)]), - M("div", Uc, [ - he.value ? (I(), z("div", Wc, [t[3] ||= M("div", { style: { + M("div", Hc, [M("div", Uc, R(Ve.value), 1), dt.value.source ? (I(), z("div", Wc, R(dt.value.source), 1)) : N("", !0)]), + M("div", Gc, [ + me.value ? (I(), z("div", Kc, [t[3] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Task", -1), M("div", Gc, R(he.value), 1)])) : N("", !0), - _e.value ? (I(), z("div", Kc, [t[4] ||= M("div", { style: { + } }, "Task", -1), M("div", qc, R(me.value), 1)])) : N("", !0), + he.value ? (I(), z("div", Jc, [t[4] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Model", -1), M("div", qc, R(_e.value), 1)])) : N("", !0), - be.value ? (I(), z("div", Jc, [t[5] ||= M("div", { style: { + } }, "Model", -1), M("div", Yc, R(he.value), 1)])) : N("", !0), + ve.value ? (I(), z("div", Xc, [t[5] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Runs on", -1), M("div", Yc, R(be.value), 1)])) : N("", !0), - Fe.value || Ie.value ? (I(), z("div", Xc, [ + } }, "Runs on", -1), M("div", Zc, R(ve.value), 1)])) : N("", !0), + Fe.value || Le.value ? (I(), z("div", Qc, [ t[6] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", @@ -7845,11 +7886,11 @@ var To = ["title"], Eo = ["src"], Do = { "text-transform": "uppercase", "letter-spacing": "0.4px" } }, "Library", -1), - M("div", Zc, R(Fe.value || Ie.value), 1), - Fe.value && Ie.value ? (I(), z("div", Qc, R(Ie.value), 1)) : N("", !0) + M("div", $c, R(Fe.value || Le.value), 1), + Fe.value && Le.value ? (I(), z("div", el, R(Le.value), 1)) : N("", !0) ])) : N("", !0) ]), - we.value.length || Te.value.length ? (I(), z("div", $c, [ + Se.value.length || we.value.length ? (I(), z("div", tl, [ t[7] ||= M("div", { style: { "font-size": "10px", "font-weight": "800", @@ -7858,15 +7899,15 @@ var To = ["title"], Eo = ["src"], Do = { "letter-spacing": "0.4px", "margin-bottom": "6px" } }, "Missing dependencies", -1), - we.value.length ? (I(), z("div", { + Se.value.length ? (I(), z("div", { key: 0, style: L({ display: "flex", flexWrap: "wrap", gap: "5px", - marginBottom: Te.value.length ? "7px" : "0" + marginBottom: we.value.length ? "7px" : "0" }) - }, [(I(!0), z(j, null, F(we.value, (e) => (I(), z("span", { + }, [(I(!0), z(j, null, F(Se.value, (e) => (I(), z("span", { key: `node-${e}`, style: { padding: "3px 7px", @@ -7877,7 +7918,7 @@ var To = ["title"], Eo = ["src"], Do = { color: "#ffcdd2" } }, R(e), 1))), 128))], 4)) : N("", !0), - Te.value.length ? (I(), z("div", el, [(I(!0), z(j, null, F(Te.value, (e) => (I(), z("span", { + we.value.length ? (I(), z("div", nl, [(I(!0), z(j, null, F(we.value, (e) => (I(), z("span", { key: `model-${e}`, style: { padding: "3px 7px", @@ -7889,16 +7930,16 @@ var To = ["title"], Eo = ["src"], Do = { } }, R(e), 1))), 128))])) : N("", !0) ])) : N("", !0), - xe.value || Ce.value ? (I(), z("div", tl, [xe.value ? (I(), z("div", nl, R(xe.value), 1)) : N("", !0), Ce.value ? (I(), z("div", { + ye.value || be.value ? (I(), z("div", rl, [ye.value ? (I(), z("div", il, R(ye.value), 1)) : N("", !0), be.value ? (I(), z("div", { key: 1, style: L({ fontSize: "11px", color: "rgba(255,255,255,0.48)", - marginTop: xe.value ? "7px" : "0" + marginTop: ye.value ? "7px" : "0" }) - }, R(Ce.value), 5)) : N("", !0)])) : N("", !0), - M("div", rl, [ - mt(n, { + }, R(be.value), 5)) : N("", !0)])) : N("", !0), + M("div", al, [ + gt(n, { type: "button", severity: "secondary", text: "", @@ -7916,12 +7957,12 @@ var To = ["title"], Eo = ["src"], Do = { "justify-content": "center", gap: "7px" }, - onClick: ot + onClick: at }, { - default: $e(() => [t[8] ||= M("i", { class: "pi pi-image" }, null, -1), M("span", null, R(B(O)("ctx.setWorkflowThumbnail", "Set workflow thumbnail")), 1)]), + default: tt(() => [t[8] ||= M("i", { class: "pi pi-image" }, null, -1), M("span", null, R(B(O)("ctx.setWorkflowThumbnail", "Set workflow thumbnail")), 1)]), _: 1 }), - mt(n, { + gt(n, { type: "button", severity: "secondary", text: "", @@ -7941,15 +7982,15 @@ var To = ["title"], Eo = ["src"], Do = { }, onClick: st }, { - default: $e(() => [t[9] ||= M("i", { class: "pi pi-search" }, null, -1), M("span", null, R(B(O)("ctx.inspect", "Inspect")), 1)]), + default: tt(() => [t[9] ||= M("i", { class: "pi pi-search" }, null, -1), M("span", null, R(B(O)("ctx.inspect", "Inspect")), 1)]), _: 1 }), - mt(n, { + gt(n, { type: "button", severity: "secondary", text: "", rounded: "", - disabled: p.value, + disabled: f.value, style: { height: "34px", "border-radius": "9px", @@ -7965,19 +8006,19 @@ var To = ["title"], Eo = ["src"], Do = { }, onClick: ct }, { - default: $e(() => [M("i", { class: Tt(p.value ? "pi pi-spin pi-spinner" : "pi pi-check-circle") }, null, 2), M("span", null, R(p.value ? "Checking" : "Validate"), 1)]), + default: tt(() => [M("i", { class: Dt(f.value ? "pi pi-spin pi-spinner" : "pi pi-check-circle") }, null, 2), M("span", null, R(f.value ? "Checking" : "Validate"), 1)]), _: 1 }, 8, ["disabled"]) ]), - m.value ? (I(), z("div", il, [ - M("div", al, [t[10] ||= M("div", { style: { + p.value ? (I(), z("div", ol, [ + M("div", sl, [t[10] ||= M("div", { style: { "font-size": "10px", "font-weight": "800", color: "#a5d6a7", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Workflow diagnostics", -1), M("div", ol, R(Me.value), 1)]), - ke.value.length || Ae.value.length ? (I(), z("div", sl, [ke.value.length ? (I(), z("div", cl, [(I(!0), z(j, null, F(ke.value, (e) => (I(), z("span", { + } }, "Workflow diagnostics", -1), M("div", cl, R(Me.value), 1)]), + ke.value.length || Ae.value.length ? (I(), z("div", ll, [ke.value.length ? (I(), z("div", ul, [(I(!0), z(j, null, F(ke.value, (e) => (I(), z("span", { key: `diag-node-${e}`, style: { padding: "3px 7px", @@ -7987,7 +8028,7 @@ var To = ["title"], Eo = ["src"], Do = { "font-weight": "700", color: "#ffcdd2" } - }, " Missing node: " + R(e), 1))), 128))])) : N("", !0), Ae.value.length ? (I(), z("div", ll, [(I(!0), z(j, null, F(Ae.value, (e) => (I(), z("span", { + }, " Missing node: " + R(e), 1))), 128))])) : N("", !0), Ae.value.length ? (I(), z("div", dl, [(I(!0), z(j, null, F(Ae.value, (e) => (I(), z("span", { key: `diag-model-${e}`, style: { padding: "3px 7px", @@ -7997,34 +8038,34 @@ var To = ["title"], Eo = ["src"], Do = { "font-weight": "700", color: "#ffe0b2" } - }, " Missing model: " + R(e), 1))), 128))])) : N("", !0)])) : (I(), z("div", ul, " No missing dependencies detected by the current ComfyUI runtime. ")), - je.value.length ? (I(), z("div", dl, R(je.value.join(" | ")), 1)) : N("", !0), - Ne.value || Pe.value ? (I(), z("div", fl, [Xe(" Latest version: " + R(Ne.value || "none"), 1), Pe.value ? (I(), z("span", pl, " | Diff: " + R(Pe.value), 1)) : N("", !0)])) : N("", !0) + }, " Missing model: " + R(e), 1))), 128))])) : N("", !0)])) : (I(), z("div", fl, " No missing dependencies detected by the current ComfyUI runtime. ")), + je.value.length ? (I(), z("div", pl, R(je.value.join(" | ")), 1)) : N("", !0), + Ne.value || Pe.value ? (I(), z("div", ml, [Qe(" Latest version: " + R(Ne.value || "none"), 1), Pe.value ? (I(), z("span", hl, " | Diff: " + R(Pe.value), 1)) : N("", !0)])) : N("", !0) ])) : N("", !0), - M("div", ml, [ - M("div", hl, [t[11] ||= M("div", { style: { + M("div", gl, [ + M("div", _l, [t[11] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Nodes", -1), M("div", gl, R(dt.value.nodes), 1)]), - M("div", _l, [t[12] ||= M("div", { style: { + } }, "Nodes", -1), M("div", vl, R(dt.value.nodes), 1)]), + M("div", yl, [t[12] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Links", -1), M("div", vl, R(dt.value.links), 1)]), - M("div", yl, [t[13] ||= M("div", { style: { + } }, "Links", -1), M("div", bl, R(dt.value.links), 1)]), + M("div", xl, [t[13] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", "text-transform": "uppercase", "letter-spacing": "0.4px" - } }, "Groups", -1), M("div", bl, R(dt.value.groups), 1)]) + } }, "Groups", -1), M("div", Sl, R(dt.value.groups), 1)]) ]), - pe.value ? (I(), z("div", xl, [M("div", Sl, [M("div", Cl, [t[14] ||= M("div", { style: { + fe.value ? (I(), z("div", Cl, [M("div", wl, [M("div", Tl, [t[14] ||= M("div", { style: { "font-size": "10px", "font-weight": "700", color: "rgba(255,255,255,0.55)", @@ -8041,7 +8082,7 @@ var To = ["title"], Eo = ["src"], Do = { "white-space": "nowrap", "max-width": "100%" } - }, R(Ke.value), 9, wl)]), qe.value.length ? (I(), z("div", { + }, R(Ke.value), 9, El)]), qe.value.length ? (I(), z("div", { key: 0, title: We.value, style: { @@ -8069,7 +8110,7 @@ var To = ["title"], Eo = ["src"], Do = { "text-overflow": "ellipsis", "white-space": "nowrap" } - }, R(e), 1))), 128))], 8, Tl)) : N("", !0)]), M("div", El, [it(M("input", { + }, R(e), 1))), 128))], 8, Dl)) : N("", !0)]), M("div", Ol, [ot(M("input", { "onUpdate:modelValue": t[0] ||= (e) => s.value = e, type: "text", placeholder: B(O)("dialog.workflowCategory", "Workflow category"), @@ -8083,7 +8124,7 @@ var To = ["title"], Eo = ["src"], Do = { color: "rgba(255,255,255,0.92)", "font-size": "12px" } - }, null, 8, Dl), [[Et, s.value]]), mt(n, { + }, null, 8, kl), [[Ot, s.value]]), gt(n, { type: "button", severity: "secondary", text: "", @@ -8100,14 +8141,14 @@ var To = ["title"], Eo = ["src"], Do = { fontWeight: "700", whiteSpace: "nowrap" }), - onClick: at + onClick: rt }, { - default: $e(() => [Xe(R(c.value ? "Saving..." : "Move"), 1)]), + default: tt(() => [Qe(R(c.value ? "Saving..." : "Move"), 1)]), _: 1 }, 8, ["disabled", "style"])])])) : N("", !0), - lt.value.length ? (I(), z("div", Ol, [ + lt.value.length ? (I(), z("div", Al, [ t[15] ||= M("div", { class: "mjr-section-title" }, " Workflow Nodes ", -1), - mt(r, { + gt(r, { value: lt.value, class: "mjr-workflow-tree", "scroll-height": "180px", @@ -8120,16 +8161,16 @@ var To = ["title"], Eo = ["src"], Do = { nodeLabel: { class: "mjr-workflow-tree-label" } } }, { - default: $e(({ node: e }) => [M("span", kl, [ - M("span", Al, R(e.label), 1), - e.data?.type ? (I(), z("span", jl, R(e.data.type), 1)) : N("", !0), - M("span", Ml, "#" + R(e.data?.id), 1) + default: tt(({ node: e }) => [M("span", jl, [ + M("span", Ml, R(e.label), 1), + e.data?.type ? (I(), z("span", Nl, R(e.data.type), 1)) : N("", !0), + M("span", Pl, "#" + R(e.data?.id), 1) ])]), _: 1 }, 8, ["value"]), - ut.value ? (I(), z("div", Nl, " +" + R(ut.value) + " more nodes ", 1)) : N("", !0) + ut.value ? (I(), z("div", Fl, " +" + R(ut.value) + " more nodes ", 1)) : N("", !0) ])) : N("", !0), - M("div", Pl, [M("div", Fl, [(I(!0), z(j, null, F(B(i), (e) => (I(), Ze(n, { + M("div", Il, [M("div", Ll, [(I(!0), z(j, null, F(B(a), (e) => (I(), $e(n, { key: e.key, type: "button", severity: "secondary", @@ -8149,13 +8190,13 @@ var To = ["title"], Eo = ["src"], Do = { }), onClick: (t) => jt(e.key) }, { - default: $e(() => [Xe(R(e.label), 1)]), + default: tt(() => [Qe(R(e.label), 1)]), _: 2 }, 1032, [ "title", "style", "onClick" - ]))), 128))]), mt(n, { + ]))), 128))]), gt(n, { type: "button", class: "mjr-btn mjr-icon-btn", severity: "secondary", @@ -8174,12 +8215,12 @@ var To = ["title"], Eo = ["src"], Do = { color: "rgba(255,255,255,0.9)", cursor: "pointer" }, - onClick: t[1] ||= (e) => _.value = !_.value + onClick: t[1] ||= (e) => v.value = !v.value }, { - default: $e(() => [...t[16] ||= [M("i", { class: "pi pi-sliders-h" }, null, -1)]]), + default: tt(() => [...t[16] ||= [M("i", { class: "pi pi-sliders-h" }, null, -1)]]), _: 1 }, 8, ["title"])]), - _.value ? (I(), z("div", Il, [(I(!0), z(j, null, F(ht.value, (e) => (I(), Ze(n, { + v.value ? (I(), z("div", Rl, [(I(!0), z(j, null, F(mt.value, (e) => (I(), $e(n, { key: e.key, type: "button", severity: "secondary", @@ -8198,7 +8239,7 @@ var To = ["title"], Eo = ["src"], Do = { }), onClick: (t) => At(e.key) }, { - default: $e(() => [ + default: tt(() => [ M("span", { style: L({ width: "22px", height: "22px", @@ -8217,24 +8258,24 @@ var To = ["title"], Eo = ["src"], Do = { }) }, null, 4)], 4), M("i", { - class: Tt(e.iconClass), + class: Dt(e.iconClass), style: { "font-size": "18px", opacity: "0.9", width: "18px" } }, null, 2), - M("div", Ll, [M("div", Rl, R(e.label), 1), M("div", zl, R(b.value?.[e.key] ? "On" : "Off"), 1)]) + M("div", zl, [M("div", Bl, R(e.label), 1), M("div", Vl, R(b.value?.[e.key] ? "On" : "Off"), 1)]) ]), _: 2 }, 1032, ["style", "onClick"]))), 128))])) : N("", !0), - M("div", Bl, [M("canvas", { + M("div", Hl, [M("canvas", { ref_key: "canvasRef", - ref: a, + ref: o, style: L({ width: "100%", height: pt.value, - cursor: C.value, + cursor: S.value, touchAction: "none", borderRadius: "10px", marginTop: "0", @@ -8247,23 +8288,23 @@ var To = ["title"], Eo = ["src"], Do = { onPointerup: wt, onPointercancel: wt, onPointerleave: wt, - onWheel: Ot, - onDblclick: kt + onWheel: Tt, + onDblclick: Et }, null, 36)]), - M("div", Vl, [M("span", null, R(ee.value || "Click/drag to navigate | wheel to zoom"), 1), M("span", null, R(Math.round((S.value.zoom || 1) * 100)) + "% | " + R(ft.value.label), 1)]), + M("div", Ul, [M("span", null, R(C.value || "Click/drag to navigate | wheel to zoom"), 1), M("span", null, R(Math.round((x.value.zoom || 1) * 100)) + "% | " + R(ft.value.label), 1)]), M("details", { - open: v.value, + open: y.value, style: { "margin-top": "10px" }, - onToggle: t[2] ||= (e) => v.value = e.target.open + onToggle: t[2] ||= (e) => y.value = e.target.open }, [t[17] ||= M("summary", { style: { cursor: "pointer", color: "var(--mjr-muted, rgba(255,255,255,0.65))", "font-size": "12px", "user-select": "none" - } }, " Show raw JSON ", -1), M("pre", Ul, R(Ue.value), 1)], 40, Hl) + } }, " Show raw JSON ", -1), M("pre", Gl, R(He.value), 1)], 40, Wl) ])) : N("", !0); }; } }); //#endregion -export { Gt as $, li as A, Cr as B, Ri as C, Pi as D, Fi as E, Xr as F, Er as G, kr as H, Jr as I, wr as J, Or as K, Fr as L, Si as M, ci as N, wi as O, xi as P, K as Q, Nr as R, Ki as S, Ni as T, Y as U, Mr as V, Tr as W, _r as X, vr as Y, sn as Z, X as _, ja as a, Gi as b, ka as c, wa as d, G as et, Ca as f, pa as g, ma as h, Ra as i, ui as j, Ti as k, Oa as l, ha as m, Mc as n, Ma as o, Ta as p, Ar as q, wo as r, Da as s, ql as t, va as u, na as v, Li as w, Ui as x, fa as y, Pr as z }; +export { qt as $, di as A, Tr as B, Bi as C, Ii as D, Li as E, Qr as F, Or as G, jr as H, Xr as I, Er as J, Ar as K, Lr as L, wi as M, ui as N, Ei as O, Ci as P, K as Q, Fr as R, Ji as S, Fi as T, Y as U, Pr as V, Dr as W, yr as X, br as Y, ln as Z, X as _, Na as a, qi as b, ja as c, Ea as d, G as et, Ta as f, ha as g, ga as h, Ba as i, fi as j, Di as k, Aa as l, _a as m, Pc as n, Pa as o, Da as p, Mr as q, Eo as r, ka as s, Yl as t, ba as u, ia as v, zi as w, Gi as x, ma as y, Ir as z }; diff --git a/dist/chunks/TagsEditor-BiRWztXF.js b/dist/chunks/TagsEditor-BXjsZ3IO.js similarity index 92% rename from dist/chunks/TagsEditor-BiRWztXF.js rename to dist/chunks/TagsEditor-BXjsZ3IO.js index a39d9c89..47f84ab0 100644 --- a/dist/chunks/TagsEditor-BiRWztXF.js +++ b/dist/chunks/TagsEditor-BXjsZ3IO.js @@ -1,7 +1,7 @@ -import { F as e, Zt as t, v as n } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { St as r, m as i, n as a } from "./events-DrYpMD-I.js"; -import { Y as o } from "./Viewer-DXsFcJRb.js"; -import { A as s, C as c, E as l, G as u, J as d, K as f, L as ee, N as p, R as te, T as m, U as ne, V as h, Y as g, b as _, ft as v, j as y, k as b, lt as x, rt as S, ut as C, z as w } from "./mjr-primevue-BlSRoWcG.js"; +import { $t as e, F as t, v as n } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { St as r, m as i, n as a } from "./events-CoI83paj.js"; +import { Y as o } from "./Viewer-DWgaGos-.js"; +import { A as s, C as c, E as l, G as u, J as d, K as f, L as ee, N as p, R as te, T as m, U as ne, V as h, Y as g, b as _, ft as v, j as y, k as b, lt as x, rt as S, ut as C, z as w } from "./mjr-primevue-BOf2ACk_.js"; //#region ui/vue/components/common/TagsEditor.vue?vue&type=script&setup=true&lang.ts var T = ["aria-busy"], E = ["aria-label"], re = { key: 0, @@ -111,7 +111,7 @@ var T = ["aria-busy"], E = ["aria-label"], re = { q = o; let s = null; try { - s = await e(N.asset, a, o ? { signal: o.signal } : {}); + s = await t(N.asset, a, o ? { signal: o.signal } : {}); } catch (e) { console.error("Failed to update tags:", e); } @@ -123,8 +123,8 @@ var T = ["aria-busy"], E = ["aria-label"], re = { } break; } - let e = [...J]; - I.value = e, P("update:modelValue", e), t(s?.error || i("toast.tagsUpdateFailed", "Failed to update tags"), "error"), G = !1, q = null, U.value = !1; + let t = [...J]; + I.value = t, P("update:modelValue", t), e(s?.error || i("toast.tagsUpdateFailed", "Failed to update tags"), "error"), G = !1, q = null, U.value = !1; return; } try { @@ -140,18 +140,18 @@ var T = ["aria-busy"], E = ["aria-label"], re = { } catch (e) { console.debug?.(e); } - if (K || (I.value = [...c]), fe(c), t(i("toast.tagsUpdated", "Tags updated"), "success", 1e3), !K) break; + if (K || (I.value = [...c]), fe(c), e(i("toast.tagsUpdated", "Tags updated"), "success", 1e3), !K) break; K = !1; } if (n >= 10) { - let e = [...J]; - I.value = e; + let t = [...J]; + I.value = t; try { - N.asset.tags = [...e]; + N.asset.tags = [...t]; } catch (e) { console.debug?.(e); } - P("update:modelValue", e), t(i("toast.tagsUpdateFailed", "Failed to update tags"), "error"); + P("update:modelValue", t), e(i("toast.tagsUpdateFailed", "Failed to update tags"), "error"); } G = !1, q = null, U.value = !1; } @@ -174,14 +174,14 @@ var T = ["aria-busy"], E = ["aria-label"], re = { console.debug?.(e); } }); - function $(e) { + function $(t) { if (N.disabled) return; - let n = se(e); + let n = se(t); if (!n) return; let r = A(n); if (r && !I.value.some((e) => A(e) === r)) { if (I.value.length >= D) { - t(i("toast.maxTagsReached", "Maximum number of tags reached"), "warning"); + e(i("toast.maxTagsReached", "Maximum number of tags reached"), "warning"); return; } I.value = [...I.value, n], Q(); diff --git a/dist/chunks/Viewer-DXsFcJRb.js b/dist/chunks/Viewer-DWgaGos-.js similarity index 94% rename from dist/chunks/Viewer-DXsFcJRb.js rename to dist/chunks/Viewer-DWgaGos-.js index d41f2610..ca63d36e 100644 --- a/dist/chunks/Viewer-DXsFcJRb.js +++ b/dist/chunks/Viewer-DWgaGos-.js @@ -1,9 +1,9 @@ -import { H as e, P as t, Zt as n, _ as r, _t as i, c as a, d as o, g as s, ht as c, n as l, o as u, r as d, s as f, x as p, y as m } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { Ct as h, D as g, a as _, ct as v, h as y, i as b, j as x, k as S, m as C, n as w, o as T, pt as E, r as D, rt as O, t as k } from "./events-DrYpMD-I.js"; -import { T as A, nt as j, rt as M } from "./mjr-primevue-BlSRoWcG.js"; -import { n as N, r as ee } from "./mjr-vue-vendor-Bb2CVJXl.js"; +import { $t as e, H as t, P as n, _ as r, c as i, d as a, g as o, gt as s, n as c, o as l, r as u, s as d, vt as f, x as p, y as m } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { Ct as h, D as g, a as _, ct as v, h as y, i as b, j as x, k as S, m as C, n as w, o as T, pt as E, r as D, rt as O, t as k } from "./events-CoI83paj.js"; +import { T as A, nt as j, rt as M } from "./mjr-primevue-BOf2ACk_.js"; +import { n as N, r as ee } from "./mjr-vue-vendor-BKZZuiuB.js"; import { n as P, r as te, t as F } from "./state-DPiaUMw1.js"; -import { a as ne, c as re, i as ie, o as ae, r as oe, s as se } from "./model3dRenderer-CWRtZrSS.js"; +import { a as ne, c as re, i as ie, o as ae, r as oe, s as se } from "./model3dRenderer-e5uWwIMW.js"; //#region ui/utils/events.ts function ce(e, t, { target: n = null, warnPrefix: r = "[Majoor]" } = {}) { let i = n || (typeof window < "u" ? window : null); @@ -404,7 +404,7 @@ var le = async (e, t = "Majoor", n = {}) => { let r = document.createElement(e); return Object.entries(t || {}).forEach(([e, t]) => { let n = String(e || ""); - if (!(!n || V.has(n))) { + if (n && !V.has(n)) { if (e === "style" && t && typeof t == "object") { Object.assign(r.style, t); return; @@ -739,7 +739,7 @@ function ze(e, t = [], { assetKey: n = null, preserveHiddenCount: r = !1 } = {}) let i = Number(e?.hiddenPngSiblings || 0) || 0; e.seenKeys = /* @__PURE__ */ new Set(), e.assetIdSet = /* @__PURE__ */ new Set(), e.filenameCounts = /* @__PURE__ */ new Map(), e.nonImageSiblingKeys = /* @__PURE__ */ new Set(), e.stemMap = /* @__PURE__ */ new Map(), e.renderedFilenameMap = /* @__PURE__ */ new Map(), e.hiddenPngSiblings = r ? i : 0, typeof n == "function" && (e.assetKeyFn = n); let a = Re(e); - for (let r of Array.isArray(t) ? t : []) if (!(!r || typeof r != "object")) { + for (let r of Array.isArray(t) ? t : []) if (r && typeof r == "object") { try { let e = r?.id == null ? "" : String(r.id); e && a.assetIdSet.add(e); @@ -1366,15 +1366,15 @@ function yt(e) { kind: e.kind || "" } : null; } -async function bt({ x: e, y: t, assets: r }) { +async function bt({ x: t, y: n, assets: r }) { let i = Array.isArray(r) ? r.map(yt).filter(Boolean) : []; if (!i.length) { - n(C("toast.noValidAssetsSelected", "No valid assets selected."), "warning"); + e(C("toast.noValidAssetsSelected", "No valid assets selected."), "warning"); return; } _t({ - x: Number(e) || 0, - y: Number(t) || 0, + x: Number(t) || 0, + y: Number(n) || 0, assets: i }); } @@ -1403,23 +1403,23 @@ function wt(e) { function Tt() { for (let e of Array.from(St.keys())) wt(e); } -function Et(e, r, { onSuccess: i, onFailure: a, successMessage: s = null, errorMessage: c = null, warnPrefix: l = "[RatingUpdater]" } = {}) { - if (!e) return; - wt(e); +function Et(t, r, { onSuccess: i, onFailure: o, successMessage: s = null, errorMessage: c = null, warnPrefix: l = "[RatingUpdater]" } = {}) { + if (!t) return; + wt(t); let u = new AbortController(), d = setTimeout(async () => { - St.delete(String(e)); + St.delete(String(t)); try { - let o = await t(e, r, { signal: u.signal }); - if (!o?.ok) { - n(o?.error || c || "Failed to update rating", "error"), a?.(o); + let a = await n(t, r, { signal: u.signal }); + if (!a?.ok) { + e(a?.error || c || "Failed to update rating", "error"), o?.(a); return; } - s && n(s, "success", 1500), i?.(o); + s && e(s, "success", 1500), i?.(a); } catch (e) { - o(e, l, { showToast: !0 }), a?.(e); + a(e, l, { showToast: !0 }), o?.(e); } }, xt); - St.set(String(e), { + St.set(String(t), { timer: d, controller: u }); @@ -2179,7 +2179,7 @@ function Qt(e, t = {}) { console.debug?.(e); } }, Le = () => { - if (!(!a || !r)) try { + if (a && r) try { let t = Number(e?.duration); if (!Number.isFinite(t) || t <= 0) { y.style.backgroundImage = "", b.replaceChildren(); @@ -2716,7 +2716,7 @@ function Qt(e, t = {}) { } catch (e) { console.debug?.(e); } - if (!(!(q._ppReverse || !e?.paused) || ve.signal?.aborted)) { + if (!(!q._ppReverse && e?.paused || ve.signal?.aborted)) { try { if (typeof e?.requestVideoFrameCallback == "function" && !q._ppReverse) { et.rvfcId = e.requestVideoFrameCallback(nt); @@ -2734,7 +2734,7 @@ function Qt(e, t = {}) { } } }, rt = () => { - tt(), !(!(q._ppReverse || !e?.paused) || ve.signal?.aborted) && nt(0, { mediaTime: Number(e?.currentTime) || 0 }); + tt(), !(!q._ppReverse && e?.paused || ve.signal?.aborted) && nt(0, { mediaTime: Number(e?.currentTime) || 0 }); }; K.push(tt), K.push(Z(e, "play", () => { X(Fe), rt(); @@ -3132,10 +3132,10 @@ function xn(e) { return !1; } } -function Sn(e, n, r) { +function Sn(e, t, r) { let i = e?.id; try { - e.rating = n; + e.rating = t; } catch (e) { console.debug?.(e); } @@ -3145,24 +3145,24 @@ function Sn(e, n, r) { console.debug?.(e); } if (i) { - Et(String(i), n, { - successMessage: n > 0 ? `Rating set to ${n} stars` : "Rating cleared", + Et(String(i), t, { + successMessage: t > 0 ? `Rating set to ${t} stars` : "Rating cleared", errorMessage: "Failed to update rating", warnPrefix: "[ViewerContextMenu]", onSuccess: () => { ce(k, { assetId: String(i), - rating: n + rating: t }, { warnPrefix: "[ViewerContextMenu]" }); }, onFailure: (e) => { - o(e, "[ViewerContextMenu] Rating update", { showToast: !0 }); + a(e, "[ViewerContextMenu] Rating update", { showToast: !0 }); } }); return; } - t(e, n).catch((e) => { - o(e, "[ViewerContextMenu] Rating update", { showToast: !0 }); + n(e, t).catch((e) => { + a(e, "[ViewerContextMenu] Rating update", { showToast: !0 }); }); } function Cn(e) { @@ -3186,39 +3186,39 @@ function wn(e, t, n) { Sn(e, 0, t); }, { disabled: !n })), r; } -function Tn({ asset: t, event: r, getCurrentViewUrl: a, onAssetChanged: s }) { - let l = typeof a == "function" ? a(t) : O(t), u = !!(t?.id || t?.filepath); +function Tn({ asset: n, event: r, getCurrentViewUrl: i, onAssetChanged: o }) { + let c = typeof i == "function" ? i(n) : O(n), l = !!(n?.id || n?.filepath); return [ yn(C("ctx.openInNewTab", "Open in New Tab"), "pi pi-external-link", null, async () => { - xn(l) && window.open(l, "_blank", "noopener,noreferrer"); + xn(c) && window.open(c, "_blank", "noopener,noreferrer"); }), yn(C("ctx.copyPath", "Copy path"), "pi pi-copy", mn.COPY_PATH, async () => { - let e = t?.filepath ? String(t.filepath) : ""; - if (!e) { - n(C("toast.noFilePath"), "error"); + let t = n?.filepath ? String(n.filepath) : ""; + if (!t) { + e(C("toast.noFilePath"), "error"); return; } try { - await navigator.clipboard.writeText(e), n(C("toast.pathCopied"), "success", 2e3); - } catch (e) { - console.error("[ViewerContextMenu] Copy failed:", e), n(C("toast.pathCopyFailed"), "error"); + await navigator.clipboard.writeText(t), e(C("toast.pathCopied"), "success", 2e3); + } catch (t) { + console.error("[ViewerContextMenu] Copy failed:", t), e(C("toast.pathCopyFailed"), "error"); } }), yn(C("ctx.downloadOriginal", "Download Original"), "pi pi-download", mn.DOWNLOAD, async () => { - if (!t || !t.filepath) return; - let e = v(t.filepath), r = document.createElement("a"); - r.href = e, r.download = t.filename, document.body.appendChild(r), r.click(), document.body.removeChild(r), n(C("toast.downloadingFile", "Downloading {filename}...", { filename: t.filename }), "info", 3e3); - }, { disabled: !t?.filepath }), + if (!n || !n.filepath) return; + let t = v(n.filepath), r = document.createElement("a"); + r.href = t, r.download = n.filename, document.body.appendChild(r), r.click(), document.body.removeChild(r), e(C("toast.downloadingFile", "Downloading {filename}...", { filename: n.filename }), "info", 3e3); + }, { disabled: !n?.filepath }), yn(C("ctx.openInFolder", "Open in folder"), "pi pi-folder-open", mn.OPEN_IN_FOLDER, async () => { - let e = await c(t); - e?.ok ? n(C("toast.openedInFolder"), "info", 2e3) : n(e?.error || C("toast.openFolderFailed"), "error"); - }, { disabled: !(t?.id || t?.filepath) }), + let t = await s(n); + t?.ok ? e(C("toast.openedInFolder"), "info", 2e3) : e(t?.error || C("toast.openFolderFailed"), "error"); + }, { disabled: !(n?.id || n?.filepath) }), yn(C("ctx.addToCollection", "Add to collection"), "pi pi-bookmark", mn.ADD_TO_COLLECTION, async () => { try { await bt({ x: r?.clientX, y: r?.clientY, - assets: [t] + assets: [n] }); } catch (e) { console.error("[ViewerContextMenu] Add to collection failed:", e); @@ -3229,15 +3229,15 @@ function Tn({ asset: t, event: r, getCurrentViewUrl: a, onAssetChanged: s }) { dn({ x: (Number(r?.clientX) || 0) + 6, y: (Number(r?.clientY) || 0) + 6, - asset: t, + asset: n, onChanged: ((...e) => { - let n = e[0]; - t.tags = n, ce(w, { - assetId: String(t.id), - tags: n + let t = e[0]; + n.tags = t, ce(w, { + assetId: String(n.id), + tags: t }, { warnPrefix: "[ViewerContextMenu]" }); try { - s?.(); + o?.(); } catch (e) { console.debug?.(e); } @@ -3246,21 +3246,21 @@ function Tn({ asset: t, event: r, getCurrentViewUrl: a, onAssetChanged: s }) { }, { closeOnSelect: !1 }), bn(), yn(C("ctx.setRating", "Set rating"), "pi pi-star", `${mn.RATING_SUBMENU} >`, null, { - disabled: !u, + disabled: !l, closeOnSelect: !1, - submenu: wn(t, s, u) + submenu: wn(n, o, l) }), yn(C("ctx.refreshMetadata", "Refresh metadata"), "pi pi-sync", "R", async () => { - if (t?.id) try { - let e = await p(t.id, { refresh: !0 }); - if (!e?.ok || !e?.data) { - n(e?.error || C("toast.metadataRefreshFailed", "Failed to refresh metadata."), "error"); + if (n?.id) try { + let t = await p(n.id, { refresh: !0 }); + if (!t?.ok || !t?.data) { + e(t?.error || C("toast.metadataRefreshFailed", "Failed to refresh metadata."), "error"); return; } - let r = e.data; + let r = t.data; try { ce(_, { - assetId: String(t.id), + assetId: String(n.id), info: r }, { warnPrefix: "[ViewerContextMenu]" }); } catch (e) { @@ -3269,45 +3269,45 @@ function Tn({ asset: t, event: r, getCurrentViewUrl: a, onAssetChanged: s }) { let i = [], a = Cn(r?.size_bytes); a && i.push(a), r?.mime && i.push(r.mime); let o = i.length ? ` (${i.join(", ")})` : ""; - n(C("toast.metadataRefreshed", "Metadata refreshed{suffix}", { suffix: o }), "success", 3e3); + e(C("toast.metadataRefreshed", "Metadata refreshed{suffix}", { suffix: o }), "success", 3e3); } catch (e) { - o(e, "[ViewerContextMenu] Metadata refresh", { showToast: !0 }); + a(e, "[ViewerContextMenu] Metadata refresh", { showToast: !0 }); } - }, { disabled: !t?.id }), + }, { disabled: !n?.id }), bn(), yn(C("ctx.rename", "Rename"), "pi pi-pencil", mn.RENAME, async () => { - if (!(t?.id || t?.filepath)) return; - let e = t.filename || "", r = ut(await L(C("dialog.rename.title", "Rename file"), e), e); - if (!r || r === e) return; - let a = st(r); - if (!a.valid) { - n(a.reason, "error"); + if (!(n?.id || n?.filepath)) return; + let t = n.filename || "", r = ut(await L(C("dialog.rename.title", "Rename file"), t), t); + if (!r || r === t) return; + let i = st(r); + if (!i.valid) { + e(i.reason, "error"); return; } try { - let e = await i(t, r); - if (e?.ok) { - let i = e?.data?.asset; - i && typeof i == "object" ? Object.assign(t, i) : (t.filename = r, t.filepath = t.filepath.replace(/[^\\/]+$/, r), t.path &&= String(t.path).replace(/[^\\/]+$/, r), t.file_info && typeof t.file_info == "object" && (t.file_info.filename = r, t.file_info.filepath && (t.file_info.filepath = String(t.file_info.filepath).replace(/[^\\/]+$/, r)), t.file_info.path && (t.file_info.path = String(t.file_info.path).replace(/[^\\/]+$/, r)))), n(C("toast.fileRenamedSuccess"), "success"); + let t = await f(n, r); + if (t?.ok) { + let i = t?.data?.asset; + i && typeof i == "object" ? Object.assign(n, i) : (n.filename = r, n.filepath = n.filepath.replace(/[^\\/]+$/, r), n.path &&= String(n.path).replace(/[^\\/]+$/, r), n.file_info && typeof n.file_info == "object" && (n.file_info.filename = r, n.file_info.filepath && (n.file_info.filepath = String(n.file_info.filepath).replace(/[^\\/]+$/, r)), n.file_info.path && (n.file_info.path = String(n.file_info.path).replace(/[^\\/]+$/, r)))), e(C("toast.fileRenamedSuccess"), "success"); try { window.dispatchEvent(new CustomEvent("mjr:reload-grid", { detail: { reason: "viewer-rename" } })); } catch (e) { console.debug?.(e); } - s?.(); - } else n(e?.error || C("toast.fileRenameFailed"), "error"); - } catch (e) { - n(C("toast.errorRenaming", "Error renaming file: {error}", { error: e?.message || String(e || "") }), "error"); + o?.(); + } else e(t?.error || C("toast.fileRenameFailed"), "error"); + } catch (t) { + e(C("toast.errorRenaming", "Error renaming file: {error}", { error: t?.message || String(t || "") }), "error"); } - }, { disabled: !(t?.id || t?.filepath) }), + }, { disabled: !(n?.id || n?.filepath) }), yn(C("ctx.delete", "Delete"), "pi pi-trash", mn.DELETE, async () => { - if ((t?.id || t?.filepath) && await mt(1, t?.filename)) try { - let r = await e(t); - r?.ok ? (n(C("toast.fileDeletedSuccess"), "success"), s?.()) : n(r?.error || C("toast.fileDeleteFailed"), "error"); - } catch (e) { - n(C("toast.errorDeleting", "Error deleting file: {error}", { error: e?.message || String(e || "") }), "error"); + if ((n?.id || n?.filepath) && await mt(1, n?.filename)) try { + let r = await t(n); + r?.ok ? (e(C("toast.fileDeletedSuccess"), "success"), o?.()) : e(r?.error || C("toast.fileDeleteFailed"), "error"); + } catch (t) { + e(C("toast.errorDeleting", "Error deleting file: {error}", { error: t?.message || String(t || "") }), "error"); } - }, { disabled: !(t?.id || t?.filepath) }) + }, { disabled: !(n?.id || n?.filepath) }) ]; } function En({ overlayEl: e, getCurrentAsset: t, getCurrentViewUrl: n, onAssetChanged: r } = {}) { @@ -4853,7 +4853,7 @@ function Wn(e) { } return null; } -function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, computeOneToOneZoom: o, setZoom: s, scheduleOverlayRedraw: c, scheduleApplyGrade: l, syncToolsUIFromState: u, applyDistractionFreeUI: d, navigateViewerAssets: p, closeViewer: m, renderBadges: h, updateAssetRating: g, safeDispatchCustomEvent: _, ASSET_RATING_CHANGED_EVENT: v, probeTooltip: y, loupeWrap: b, getVideoControls: x, lifecycle: S, renderGenInfoPanel: T } = {}) { +function Gn({ overlay: t, _content: n, singleView: r, state: i, VIEWER_MODES: a, computeOneToOneZoom: o, setZoom: s, scheduleOverlayRedraw: c, scheduleApplyGrade: l, syncToolsUIFromState: u, applyDistractionFreeUI: f, navigateViewerAssets: p, closeViewer: m, renderBadges: h, updateAssetRating: g, safeDispatchCustomEvent: _, ASSET_RATING_CHANGED_EVENT: v, probeTooltip: y, loupeWrap: b, getVideoControls: x, lifecycle: S, renderGenInfoPanel: T } = {}) { let E = S?.unsubs || [], D = null, O = null, k = () => { try { D && clearTimeout(D); @@ -4861,63 +4861,63 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, console.debug?.(e); } D = null, O = null; - }, A = (e, t) => { + }, A = (t, n) => { k(), O = { - assetId: e, - rating: t + assetId: t, + rating: n }, D = setTimeout(async () => { - let e = O; - if (D = null, O = null, e?.assetId) try { - let t = await g?.(e.assetId, e.rating); - if (!t?.ok) { - n(t?.error || C("toast.ratingUpdateFailed"), "error"); + let t = O; + if (D = null, O = null, t?.assetId) try { + let n = await g?.(t.assetId, t.rating); + if (!n?.ok) { + e(n?.error || C("toast.ratingUpdateFailed"), "error"); return; } - n(C("toast.ratingSetN", { n: e.rating }), "success", 1500), _?.(v, { - assetId: String(e.assetId), - rating: e.rating + e(C("toast.ratingSetN", { n: t.rating }), "success", 1500), _?.(v, { + assetId: String(t.assetId), + rating: t.rating }, { warnPrefix: "[Viewer]" }); } catch { - n(C("toast.ratingUpdateError"), "error"); + e(C("toast.ratingUpdateError"), "error"); } }, 300); }, j = () => { try { - document.fullscreenElement ? document?.exitFullscreen?.() : e?.requestFullscreen?.(); + document.fullscreenElement ? document?.exitFullscreen?.() : t?.requestFullscreen?.(); } catch (e) { console.debug?.(e); } - }, M = (t) => { + }, M = (n) => { let g = () => { try { - t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation?.(); + n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation?.(); } catch (e) { console.debug?.(e); } }, v = i?.mode === a?.SINGLE, S = i?.assets?.[i?.currentIndex], E = () => { try { - return !!t?.target?.closest?.(".mjr-viewer-playerbar"); + return !!n?.target?.closest?.(".mjr-viewer-playerbar"); } catch { return !1; } }, D = () => { - let e = String(t?.key || ""); + let e = String(n?.key || ""); return e === " " || e === "Spacebar" || e === "ArrowLeft" || e === "ArrowRight" || e === "Home" || e === "End" || e === "[" || e === "{" || e === "]" || e === "}" || e === "\\" || e === "|" || e === "i" || e === "I" || e === "o" || e === "O"; }; - if (f()) return; + if (d()) return; try { - if (e?.style?.display === "none") return; + if (t?.style?.display === "none") return; } catch (e) { console.debug?.(e); } try { - let e = t?.target; + let e = n?.target; if (e && (e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.isContentEditable) && !(v && S?.kind === "video" && E() && D())) { - if (t.key === "f" || t.key === "F") { + if (n.key === "f" || n.key === "F") { g(), j(); return; } - t.key === "Escape" && (g(), Q.tags.open ? fn() : X(m)); + n.key === "Escape" && (g(), Q.tags.open ? fn() : X(m)); return; } } catch (e) { @@ -4969,36 +4969,36 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, } catch { return !0; } - }, N = (e, { absolute: t = !1 } = {}) => { + }, N = (t, { absolute: n = !1 } = {}) => { try { let r = k(); if (!r) return !1; - if (t) { - let t = r.setPlaybackRate?.(e); - return Number.isFinite(Number(t)) ? (i.playbackRate = Number(t), n(C("toast.playbackRate", "Playback {rate}x", { rate: Number(t).toFixed(2) }), "info", 1200), !0) : !1; + if (n) { + let n = r.setPlaybackRate?.(t); + return Number.isFinite(Number(n)) ? (i.playbackRate = Number(n), e(C("toast.playbackRate", "Playback {rate}x", { rate: Number(n).toFixed(2) }), "info", 1200), !0) : !1; } - let a = r.adjustPlaybackRate?.(e); - return Number.isFinite(Number(a)) ? (i.playbackRate = Number(a), n(C("toast.playbackRate", "Playback {rate}x", { rate: Number(a).toFixed(2) }), "info", 1200), !0) : !1; + let a = r.adjustPlaybackRate?.(t); + return Number.isFinite(Number(a)) ? (i.playbackRate = Number(a), e(C("toast.playbackRate", "Playback {rate}x", { rate: Number(a).toFixed(2) }), "info", 1200), !0) : !1; } catch { return !1; } }; - if ((t.ctrlKey || t.metaKey) && (t.key === "c" || t.key === "C")) try { - let e = Wn(S); - if (e) { - g(), navigator.clipboard?.writeText?.(e).then(() => n(C("toast.promptCopied", "Prompt copied to clipboard"), "success", 1500)).catch(() => n(C("toast.copyFailed", "Copy failed"), "error", 1500)); + if ((n.ctrlKey || n.metaKey) && (n.key === "c" || n.key === "C")) try { + let t = Wn(S); + if (t) { + g(), navigator.clipboard?.writeText?.(t).then(() => e(C("toast.promptCopied", "Prompt copied to clipboard"), "success", 1500)).catch(() => e(C("toast.copyFailed", "Copy failed"), "error", 1500)); return; } } catch (e) { console.debug?.(e); } - if (v && !t.altKey && !t.ctrlKey && !t.metaKey && (t.key === "0" || t.key === "1" || t.key === "2" || t.key === "3" || t.key === "4" || t.key === "5")) { - g(), O(t.key); + if (v && !n.altKey && !n.ctrlKey && !n.metaKey && (n.key === "0" || n.key === "1" || n.key === "2" || n.key === "3" || n.key === "4" || n.key === "5")) { + g(), O(n.key); return; } - switch (t.key) { + switch (n.key) { case "1": { - if (!t.altKey) break; + if (!n.altKey) break; let e = X(o); if (e == null) break; g(); @@ -5041,8 +5041,8 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, case "T": if (!S?.id) break; g(), dn({ - x: Number(i?._lastPointerX) || Math.round((e?.clientWidth || 0) / 2), - y: Number(i?._lastPointerY) || Math.round((e?.clientHeight || 0) / 2), + x: Number(i?._lastPointerX) || Math.round((t?.clientWidth || 0) / 2), + y: Number(i?._lastPointerY) || Math.round((t?.clientHeight || 0) / 2), asset: S, onChanged: ((...e) => { let t = e[0]; @@ -5066,7 +5066,7 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, case "i": case "I": if (v && S?.kind === "video" && k()?.setInPoint?.()) { - g(), n(C("toast.inPointSet", "In point set"), "info", 1200); + g(), e(C("toast.inPointSet", "In point set"), "info", 1200); break; } g(); @@ -5085,7 +5085,7 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, case "o": case "O": if (v && S?.kind === "video" && k()?.setOutPoint?.()) { - g(), n(C("toast.outPointSet", "Out point set"), "info", 1200); + g(), e(C("toast.outPointSet", "Out point set"), "info", 1200); break; } break; @@ -5124,7 +5124,7 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, } catch (e) { console.debug?.(e); } - X(u), X(d), X(T); + X(u), X(f), X(T); break; case "c": case "C": { @@ -5173,7 +5173,7 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, case "Tab": g(); try { - e?.contains?.(document.activeElement) || e?.focus?.(); + t?.contains?.(document.activeElement) || t?.focus?.(); } catch (e) { console.debug?.(e); } @@ -5182,14 +5182,14 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, g(), Q.tags.open ? fn() : X(m); break; case "ArrowLeft": - if (v && t.target?.closest?.(".mjr-viewer-playerbar")) { + if (v && n.target?.closest?.(".mjr-viewer-playerbar")) { g(), M(-1); break; } g(), X(() => p?.(-1)); break; case "ArrowRight": - if (v && t.target?.closest?.(".mjr-viewer-playerbar")) { + if (v && n.target?.closest?.(".mjr-viewer-playerbar")) { g(), M(1); break; } @@ -5197,15 +5197,15 @@ function Gn({ overlay: e, _content: t, singleView: r, state: i, VIEWER_MODES: a, break; case "[": case "{": - g(), N(-.25) || n(C("toast.playbackVideoOnly"), "warning", 1400); + g(), N(-.25) || e(C("toast.playbackVideoOnly"), "warning", 1400); break; case "]": case "}": - g(), N(.25) || n(C("toast.playbackVideoOnly"), "warning", 1400); + g(), N(.25) || e(C("toast.playbackVideoOnly"), "warning", 1400); break; case "\\": case "|": - g(), N(1, { absolute: !0 }) || n(C("toast.playbackVideoOnly"), "warning", 1400); + g(), N(1, { absolute: !0 }) || e(C("toast.playbackVideoOnly"), "warning", 1400); break; case "+": case "=": @@ -5309,7 +5309,7 @@ function qn(e, t, { threshold: n = .15, correctionCooldownMs: r = 250 } = {}) { }, m = (e, { force: t = !1 } = {}) => { if (!s) try { let i = Number(e?.currentTime) || 0, a = e?.paused === !1, c = p(), l = Math.max(0, Number(r) || 0), d = t || !a || !u || c - u >= l, f = !1; - for (let t of o) if (!(!t || t === e)) try { + for (let t of o) if (t && t !== e) try { Math.abs((Number(t.currentTime) || 0) - i) > n && d && (s = !0, t.currentTime = i, s = !1, f = !0); } catch { s = !1; @@ -5346,7 +5346,7 @@ function qn(e, t, { threshold: n = .15, correctionCooldownMs: r = 250 } = {}) { } let _ = (t = {}) => m(e, t), v = (t, n = e) => { if (!s) { - for (let e of o) if (!(!e || e === n)) try { + for (let e of o) if (e && e !== n) try { if (t) f(e); else { try { @@ -5362,7 +5362,7 @@ function qn(e, t, { threshold: n = .15, correctionCooldownMs: r = 250 } = {}) { } }, y = (t = e) => { if (!s) { - for (let e of o) if (!(!e || e === t)) try { + for (let e of o) if (e && e !== t) try { e.muted = !!t.muted, e.volume = Number(t.volume) || 0; } catch (e) { console.debug?.(e); @@ -5370,7 +5370,7 @@ function qn(e, t, { threshold: n = .15, correctionCooldownMs: r = 250 } = {}) { } }, b = (t = e) => { if (!s) { - for (let e of o) if (!(!e || e === t)) try { + for (let e of o) if (e && e !== t) try { e.playbackRate = Number(t.playbackRate) || 1; } catch (e) { console.debug?.(e); @@ -6176,7 +6176,7 @@ function Zn({ state: e, VIEWER_MODES: t, APP_CONFIG: n, getAssetMetadata: r, get console.debug?.(e); } }, d = (e, t) => { - if (!(!e || !t || typeof t != "object")) { + if (e && t && typeof t == "object") { try { t.rating !== void 0 && (e.rating = t.rating); } catch (e) { @@ -6234,7 +6234,10 @@ function Zn({ state: e, VIEWER_MODES: t, APP_CONFIG: n, getAssetMetadata: r, get l = new AbortController(); let a = l.signal; try { - if (i === t?.SINGLE) return n && await f([n], { signal: a }), void 0; + if (i === t?.SINGLE) { + n && await f([n], { signal: a }); + return; + } let o = (Array.isArray(e?.assets) ? e.assets.slice(0, 4) : []).slice(); r && o.push(r), await f(o, { signal: a }); } catch (e) { @@ -6656,7 +6659,7 @@ function $n({ overlay: e, content: t, singleView: n, abView: r, sideView: i, sta return; } let o = n.button === 0, c = n.button === 1; - if (!(!o && !c)) { + if (o || c) { try { let e = n.target; if (e && (e.tagName === "INPUT" || e.tagName === "TEXTAREA" || e.tagName === "SELECT" || e.isContentEditable)) return; @@ -6739,7 +6742,7 @@ function $n({ overlay: e, content: t, singleView: n, abView: r, sideView: i, sta y(); } }, N = (n) => { - if (!(!e || e.style.display === "none")) { + if (e && e.style.display !== "none") { try { if (!t?.contains?.(n.target)) return; } catch (e) { @@ -7713,7 +7716,7 @@ function dr({ canvas: e, audioEl: t, mode: n, pauseDuringExecution: r = null } = a = null; return; } - if (!m && !(!l || !f) && !(e - p < h)) { + if (!m && l && f && !(e - p < h)) { p = e; try { _(), l.getByteFrequencyData(u), l.getByteTimeDomainData(d), f.draw(u, d, e); @@ -8590,7 +8593,7 @@ function br(e, t) { //#endregion //#region ui/features/viewer/viewerInstanceManager.ts function xr(e) { - let t = d(); + let t = u(); if (t.length) { let e = t[t.length - 1]; for (let n of t) if (n !== e) { @@ -8613,7 +8616,7 @@ function xr(e) { } } let n = e(); - return l(n), n._mjrViewerAPI; + return c(n), n._mjrViewerAPI; } //#endregion //#region ui/features/viewer/playerBarManager.ts @@ -9348,7 +9351,7 @@ function Br({ state: e, buildAssetViewURL: t, onNavigate: n, onCompare: r }) { return !1; } }, _ = (e, t = 1.08) => { - if (!(!e || g())) { + if (e && !g()) { try { e._mjrFilmstripBounce?.cancel?.(); } catch (e) { @@ -9744,13 +9747,13 @@ var Wr = null, Gr = null, Kr = null, qr = null, Jr = null, Yr = null; function Xr() { Wr || import("./abCompare-BXOoRlmV.js").then((e) => { Wr = e; - }), Gr || import("./sideBySide-BqUyrNow.js").then((e) => { + }), Gr || import("./sideBySide-BM4KMMX-.js").then((e) => { Gr = e; - }), Kr || import("./model3dRenderer-CWRtZrSS.js").then((e) => e.t).then((e) => { + }), Kr || import("./model3dRenderer-e5uWwIMW.js").then((e) => e.t).then((e) => { Kr = e; }), qr || import("./scopes-Dx5cTyCY.js").then((e) => { qr = e; - }), Jr || import("./genInfo-D0BtEEbx.js").then((e) => e.n).then((e) => { + }), Jr || import("./genInfo-y4P7FXnU.js").then((e) => e.n).then((e) => { Jr = e; }), Yr || import("./frameExport-tksSZ7sb.js").then((e) => { Yr = e; @@ -9763,11 +9766,11 @@ var $ = { }; function Zr() { Xr(), Er(); - let e = Vr(), n = In(e), i = n.unsubs || [], o = te(); - o.mode = $.SINGLE; + let e = Vr(), t = In(e), a = t.unsubs || [], s = te(); + s.mode = $.SINGLE; try { let e = Nn(); - e && typeof e == "object" && (typeof e.analysisMode == "string" && (o.analysisMode = e.analysisMode || "none"), typeof e.loupeEnabled == "boolean" && (o.loupeEnabled = e.loupeEnabled), typeof e.probeEnabled == "boolean" && (o.probeEnabled = e.probeEnabled), typeof e.hudEnabled == "boolean" && (o.hudEnabled = e.hudEnabled), typeof e.genInfoOpen == "boolean" && (o.genInfoOpen = e.genInfoOpen), typeof e.audioVisualizerMode == "string" && (o.audioVisualizerMode = e.audioVisualizerMode || "artistic"), typeof e.abWipePercent == "number" && Number.isFinite(e.abWipePercent) && e.abWipePercent >= 0 && e.abWipePercent <= 100 && (o._abWipePercent = e.abWipePercent)); + e && typeof e == "object" && (typeof e.analysisMode == "string" && (s.analysisMode = e.analysisMode || "none"), typeof e.loupeEnabled == "boolean" && (s.loupeEnabled = e.loupeEnabled), typeof e.probeEnabled == "boolean" && (s.probeEnabled = e.probeEnabled), typeof e.hudEnabled == "boolean" && (s.hudEnabled = e.hudEnabled), typeof e.genInfoOpen == "boolean" && (s.genInfoOpen = e.genInfoOpen), typeof e.audioVisualizerMode == "string" && (s.audioVisualizerMode = e.audioVisualizerMode || "artistic"), typeof e.abWipePercent == "number" && Number.isFinite(e.abWipePercent) && e.abWipePercent >= 0 && e.abWipePercent <= 100 && (s._abWipePercent = e.abWipePercent)); } catch (e) { console.debug?.(e); } @@ -9785,52 +9788,52 @@ function Zr() { "hdr", "svg", "apng" - ]), l = null, d = null; + ]), u = null, d = null; function f() { try { - return l?.mediaTransform?.() || ""; + return u?.mediaTransform?.() || ""; } catch { return ""; } } function h() { try { - l?.clampPanToBounds?.(); + u?.clampPanToBounds?.(); } catch (e) { console.debug?.(e); } } function g() { try { - l?.applyTransform?.(); + u?.applyTransform?.(); } catch (e) { console.debug?.(e); } } function _(e, t) { try { - l?.setZoom?.(e, t); + u?.setZoom?.(e, t); } catch (e) { console.debug?.(e); } } function v() { try { - l?.updatePanCursor?.(); + u?.updatePanCursor?.(); } catch (e) { console.debug?.(e); } } function y() { try { - return l?.getPrimaryMedia?.() || null; + return u?.getPrimaryMedia?.() || null; } catch { return null; } } function x(e) { try { - return l?.getMediaNaturalSize?.(e) || { + return u?.getMediaNaturalSize?.(e) || { w: 0, h: 0 }; @@ -9843,21 +9846,21 @@ function Zr() { } function S() { try { - return l?.getViewportRect?.() || null; + return u?.getViewportRect?.() || null; } catch { return null; } } function E() { try { - return l?.computeOneToOneZoom?.() ?? null; + return u?.computeOneToOneZoom?.() ?? null; } catch { return null; } } function D() { try { - l?.updateMediaNaturalSize?.(); + u?.updateMediaNaturalSize?.(); } catch (e) { console.debug?.(e); } @@ -9879,11 +9882,11 @@ function Zr() { function M() { let e = !1; try { - let t = o.mode === $.AB_COMPARE ? V : o.mode === $.SIDE_BY_SIDE ? H : B, n = Array.from(t?.querySelectorAll?.(".mjr-viewer-audio-viz") || []); + let t = s.mode === $.AB_COMPARE ? V : s.mode === $.SIDE_BY_SIDE ? H : B, n = Array.from(t?.querySelectorAll?.(".mjr-viewer-audio-viz") || []); for (let t of n) try { let n = t?._mjrProc || null; if (!n?.setMode) continue; - n.setMode(o.audioVisualizerMode), e = !0; + n.setMode(s.audioVisualizerMode), e = !0; } catch (e) { console.debug?.(e); } @@ -9907,8 +9910,8 @@ function Zr() { try { N = Un({ VIEWER_MODES: $, - state: o, - lifecycle: n, + state: s, + lifecycle: t, getCanAB: () => Xe(), onToggleFullscreen: () => { try { @@ -9930,7 +9933,7 @@ function Zr() { onMode: (e) => { try { if (e === $.AB_COMPARE && !Xe() || e === $.SIDE_BY_SIDE && !Y()) return; - o.mode = e, Qe(); + s.mode = e, Qe(); try { N?.syncToolsUIFromState?.(); } catch (e) { @@ -9942,9 +9945,9 @@ function Zr() { }, onZoomIn: () => { try { - _((Number(o.zoom) || 1) + .25, { - clientX: o._lastPointerX, - clientY: o._lastPointerY + _((Number(s.zoom) || 1) + .25, { + clientX: s._lastPointerX, + clientY: s._lastPointerY }); } catch (e) { console.debug?.(e); @@ -9952,9 +9955,9 @@ function Zr() { }, onZoomOut: () => { try { - _((Number(o.zoom) || 1) - .25, { - clientX: o._lastPointerX, - clientY: o._lastPointerY + _((Number(s.zoom) || 1) - .25, { + clientX: s._lastPointerX, + clientY: s._lastPointerY }); } catch (e) { console.debug?.(e); @@ -9971,9 +9974,9 @@ function Zr() { try { let e = () => { let e = E(); - return e != null && (_(Math.abs((Number(o.zoom) || 1) - e) < .01 ? 1 : e, { - clientX: o._lastPointerX, - clientY: o._lastPointerY + return e != null && (_(Math.abs((Number(s.zoom) || 1) - e) < .01 ? 1 : e, { + clientX: s._lastPointerX, + clientY: s._lastPointerY }), !0); }; if (e()) return; @@ -9999,7 +10002,7 @@ function Zr() { }, onCompareModeChanged: () => { try { - o.mode === $.AB_COMPARE && (et(), st()); + s.mode === $.AB_COMPARE && (et(), st()); } catch (e) { console.debug?.(e); } @@ -10020,7 +10023,7 @@ function Zr() { }, onAudioVizModeChanged: () => { try { - let e = o.assets[o.currentIndex]; + let e = s.assets[s.currentIndex]; if (String(e?.kind || "") !== "audio") return; M() || (et(), st()); } catch (e) { @@ -10034,7 +10037,7 @@ function Zr() { console.debug?.(e); } try { - Pn(o); + Pn(s); } catch (e) { console.debug?.(e); } @@ -10044,20 +10047,20 @@ function Zr() { console.debug?.(e); } try { - if (o.mode === $.AB_COMPARE) { - let e = String(o.abCompareMode || "wipe"); + if (s.mode === $.AB_COMPARE) { + let e = String(s.abCompareMode || "wipe"); e !== "wipe" && e !== "wipeV" && V?._mjrDiffRequest?.(); } } catch (e) { console.debug?.(e); } try { - o.probeEnabled || (me.style.display = "none"); + s.probeEnabled || (me.style.display = "none"); } catch (e) { console.debug?.(e); } try { - o.loupeEnabled || (he.style.display = "none"); + s.loupeEnabled || (he.style.display = "none"); } catch (e) { console.debug?.(e); } @@ -10082,24 +10085,24 @@ function Zr() { console.debug?.(e); } let { contentRow: z, content: fe, singleView: B, abView: V, sideView: H, overlayLayer: pe, gridCanvas: U, probeTooltip: me, loupeWrap: he, loupeCanvas: ge, genInfoOverlay: _e, genInfoTitle: W, genInfoBody: G, genInfoOverlayLeft: K, genInfoTitleLeft: ve, genInfoBodyLeft: ye, footer: q, prevBtn: be, indexInfo: xe, nextBtn: Se, navBar: Ce, playerBarHost: we, filmstrip: Te } = Hr({ - state: o, + state: s, buildAssetViewURL: O, onNavigate: (e) => { try { - o.compareAsset != null && (o.compareAsset = null, o.mode = $.SINGLE), o.currentIndex = e, Qe(); + s.compareAsset != null && (s.compareAsset = null, s.mode = $.SINGLE), s.currentIndex = e, Qe(); } catch (e) { console.debug?.(e); } }, onCompare: (e) => { try { - let t = Array.isArray(o.assets) ? o.assets : [], n = t[e]; - if (!n || n === t[o.currentIndex]) return; - if (n === o.compareAsset) { - o.compareAsset = null, o.mode = $.SINGLE, Qe(); + let t = Array.isArray(s.assets) ? s.assets : [], n = t[e]; + if (!n || n === t[s.currentIndex]) return; + if (n === s.compareAsset) { + s.compareAsset = null, s.mode = $.SINGLE, Qe(); return; } - t.length === 2 ? (o.compareAsset = t[1 - o.currentIndex], o.mode = De() ? $.SIDE_BY_SIDE : $.AB_COMPARE) : (o.compareAsset = n, o.mode = Y() ? $.SIDE_BY_SIDE : $.AB_COMPARE), Qe(); + t.length === 2 ? (s.compareAsset = t[1 - s.currentIndex], s.mode = De() ? $.SIDE_BY_SIDE : $.AB_COMPARE) : (s.compareAsset = n, s.mode = Y() ? $.SIDE_BY_SIDE : $.AB_COMPARE), Qe(); } catch (e) { console.debug?.(e); } @@ -10108,9 +10111,9 @@ function Zr() { e.appendChild(P), e.appendChild(z); function Ee() { try { - if (o.compareAsset) return o.compareAsset; - let e = Array.isArray(o.assets) ? o.assets : []; - if (e.length === 2) return e[1 - (o.currentIndex || 0)] || null; + if (s.compareAsset) return s.compareAsset; + let e = Array.isArray(s.assets) ? s.assets : []; + if (e.length === 2) return e[1 - (s.currentIndex || 0)] || null; } catch (e) { console.debug?.(e); } @@ -10118,7 +10121,7 @@ function Zr() { } function De() { try { - let e = o.assets?.[o.currentIndex] || null; + let e = s.assets?.[s.currentIndex] || null; return (Kr?.isModel3DAsset?.(e) ?? !1) || (Kr?.isModel3DAsset?.(Ee()) ?? !1); } catch (e) { console.debug?.(e); @@ -10130,10 +10133,10 @@ function Zr() { requestClose: () => ee() }); let Oe = Zn({ - state: o, + state: s, VIEWER_MODES: $, APP_CONFIG: T, - getAssetMetadata: s, + getAssetMetadata: o, getAssetsBatch: r }), ke = 3e5, Ae = /* @__PURE__ */ new Map(), je = () => { try { @@ -10181,19 +10184,19 @@ function Zr() { } }; try { - l = $n({ + u = $n({ overlay: e, content: fe, singleView: B, abView: V, sideView: H, - state: o, + state: s, VIEWER_MODES: $, scheduleOverlayRedraw: J, - lifecycle: n + lifecycle: t }); } catch { - l = null; + u = null; } let Fe = (e, t, n) => { try { @@ -10230,13 +10233,13 @@ function Zr() { let Le = Jn({ gridCanvas: U, content: fe, - state: o, + state: s, VIEWER_MODES: $, getPrimaryMedia: () => { try { - if (o?.mode === $.SINGLE) return B?.querySelector?.(".mjr-viewer-media") || null; - if (o?.mode === $.AB_COMPARE) return V?.querySelector?.(".mjr-viewer-media") || null; - if (o?.mode === $.SIDE_BY_SIDE) return H?.querySelector?.(".mjr-viewer-media") || null; + if (s?.mode === $.SINGLE) return B?.querySelector?.(".mjr-viewer-media") || null; + if (s?.mode === $.AB_COMPARE) return V?.querySelector?.(".mjr-viewer-media") || null; + if (s?.mode === $.SIDE_BY_SIDE) return H?.querySelector?.(".mjr-viewer-media") || null; } catch (e) { console.debug?.(e); } @@ -10247,23 +10250,23 @@ function Zr() { }), Re = () => { let t = (() => { try { - let e = Number(o?._panHintAt) || 0; + let e = Number(s?._panHintAt) || 0; return e > 0 && Date.now() - e < 900; } catch { return !1; } })(); try { - let e = o?.mode === $.SINGLE && !!o?.hudEnabled, n = String(o?.scopesMode || "off") !== "off", r = !!o?.overlayMaskEnabled; - U.style.display = o.gridMode === 0 && !r && !t && !e && !n ? "none" : ""; + let e = s?.mode === $.SINGLE && !!s?.hudEnabled, n = String(s?.scopesMode || "off") !== "off", r = !!s?.overlayMaskEnabled; + U.style.display = s.gridMode === 0 && !r && !t && !e && !n ? "none" : ""; } catch (e) { console.debug?.(e); } let n = Le.ensureCanvasSize(); if (n.w > 0 && n.h > 0) { if ((() => { - let e = o?.mode === $.SINGLE && !!o?.hudEnabled; - return (Number(o.gridMode) || 0) !== 0 || !!o?.overlayMaskEnabled || e; + let e = s?.mode === $.SINGLE && !!s?.hudEnabled; + return (Number(s.gridMode) || 0) !== 0 || !!s?.overlayMaskEnabled || e; })()) Le.redrawGrid(n); else try { let e = U.getContext("2d"); @@ -10274,7 +10277,7 @@ function Zr() { if (t) try { let e = U.getContext("2d"); if (e) { - let t = fe?.getBoundingClientRect?.(), r = Number(o?._panHintX), i = Number(o?._panHintY), a = t && Number.isFinite(r) ? r - t.left : n.w / 2, s = t && Number.isFinite(i) ? i - t.top : n.h * .78, c = Math.max(10, Math.min(n.w - 10, a)), l = Math.max(10, Math.min(n.h - 10, s)); + let t = fe?.getBoundingClientRect?.(), r = Number(s?._panHintX), i = Number(s?._panHintY), a = t && Number.isFinite(r) ? r - t.left : n.w / 2, o = t && Number.isFinite(i) ? i - t.top : n.h * .78, c = Math.max(10, Math.min(n.w - 10, a)), l = Math.max(10, Math.min(n.h - 10, o)); e.save(), e.font = "12px var(--comfy-font, ui-sans-serif, system-ui)", e.textAlign = "center", e.textBaseline = "middle"; let u = "Zoom in to pan", d = e.measureText(u), f = Math.min(n.w - 20, Math.max(140, d.width + 26)); e.fillStyle = "rgba(0,0,0,0.65)", e.strokeStyle = "rgba(255,255,255,0.18)", e.lineWidth = 1, e.beginPath(); @@ -10285,26 +10288,26 @@ function Zr() { console.debug?.(e); } try { - let t = String(o?.scopesMode || "off"); + let t = String(s?.scopesMode || "off"); if (t !== "off") { let r = U.getContext("2d"); if (r) { let i = B; - o?.mode === $.AB_COMPARE ? i = V : o?.mode === $.SIDE_BY_SIDE && (i = H); + s?.mode === $.AB_COMPARE ? i = V : s?.mode === $.SIDE_BY_SIDE && (i = H); let a = i?.querySelector?.("canvas.mjr-viewer-media") || e?.querySelector?.("canvas.mjr-viewer-media"); a && a instanceof HTMLCanvasElement && qr?.drawScopesLight?.(r, { w: n.w, h: n.h }, a, { mode: t, - channel: o?.channel + channel: s?.channel }); } } } catch (e) { console.debug?.(e); } - if (o.mode !== $.SINGLE) { + if (s.mode !== $.SINGLE) { try { me.style.display = "none"; } catch (e) { @@ -10336,20 +10339,20 @@ function Zr() { } }, Be = () => { try { - o._genInfoAbort?.abort?.(); + s._genInfoAbort?.abort?.(); } catch (e) { console.debug?.(e); } - o._genInfoAbort = null; + s._genInfoAbort = null; try { - o._genInfoReqId = (Number(o._genInfoReqId) || 0) + 1; + s._genInfoReqId = (Number(s._genInfoReqId) || 0) + 1; } catch (e) { console.debug?.(e); } }, Ve = async (e, { signal: t } = {}) => { try { return await Jr?.ensureViewerMetadataAsset?.(e, { - getAssetMetadata: s, + getAssetMetadata: o, getFileMetadataScoped: m, metadataCache: Oe, signal: t @@ -10392,12 +10395,12 @@ function Zr() { return !1; } }, Ke = async () => { - let t = Xe(), n = Y(), r = o.mode, i = !!o?.genInfoOpen && !o?.distractionFree, a = o?.assets?.[o?.currentIndex] || null, s = i && (r === $.AB_COMPARE && t || r === $.SIDE_BY_SIDE && n), c = s && r === $.SIDE_BY_SIDE && !o?.compareAsset && (o?.assets?.length ?? 0) > 2; + let t = Xe(), n = Y(), r = s.mode, i = !!s?.genInfoOpen && !s?.distractionFree, a = s?.assets?.[s?.currentIndex] || null, o = i && (r === $.AB_COMPARE && t || r === $.SIDE_BY_SIDE && n), c = o && r === $.SIDE_BY_SIDE && !s?.compareAsset && (s?.assets?.length ?? 0) > 2; try { - if (_e.style.display = i ? "flex" : "none", K.style.display = s ? "flex" : "none", e.style.paddingRight = i ? wr : "0px", e.style.paddingLeft = s ? wr : "0px", !i) { + if (_e.style.display = i ? "flex" : "none", K.style.display = o ? "flex" : "none", e.style.paddingRight = i ? wr : "0px", e.style.paddingLeft = o ? wr : "0px", !i) { Be(); try { - o._genInfoRenderSignature = ""; + s._genInfoRenderSignature = ""; } catch (e) { console.debug?.(e); } @@ -10418,49 +10421,49 @@ function Zr() { } let l = ""; try { - let e = Array.isArray(o?.assets) ? o.assets : [], t = o?.compareAsset ? Ue(o.compareAsset) : "", n = e.slice(0, 4).map(Ue).join("|"); + let e = Array.isArray(s?.assets) ? s.assets : [], t = s?.compareAsset ? Ue(s.compareAsset) : "", n = e.slice(0, 4).map(Ue).join("|"); l = [ "open", r, - Number(o?.currentIndex) || 0, + Number(s?.currentIndex) || 0, Ue(a), t, n, - s ? "dual" : "single", + o ? "dual" : "single", c ? "grid" : "" ].join("::"); - let i = o?._genInfoAbort?.signal; - if (l && o?._genInfoRenderSignature === l && i && !i.aborted && We()) return; - o._genInfoRenderSignature = l; + let i = s?._genInfoAbort?.signal; + if (l && s?._genInfoRenderSignature === l && i && !i.aborted && We()) return; + s._genInfoRenderSignature = l; } catch (e) { console.debug?.(e); } Be(); - let u = (Number(o?._genInfoReqId) || 0) + 1; + let u = (Number(s?._genInfoReqId) || 0) + 1; try { - o._genInfoReqId = u; + s._genInfoReqId = u; } catch (e) { console.debug?.(e); } let d = new AbortController(); - o._genInfoAbort = d; + s._genInfoAbort = d; let f = ({ left: e = null, leftExtra: t = null, right: n = null, rightExtra: r = null, single: i = null } = {}) => { try { - if (o._genInfoReqId !== u) return; + if (s._genInfoReqId !== u) return; ze(G); } catch (e) { console.debug?.(e); } try { - if (o._genInfoReqId !== u) return; + if (s._genInfoReqId !== u) return; ze(ye); } catch (e) { console.debug?.(e); } - if (o._genInfoReqId !== u) return; + if (s._genInfoReqId !== u) return; let a = () => { try { - o?.genInfoOpen || (o.genInfoOpen = !0), o._genInfoRenderSignature = "", Ke(); + s?.genInfoOpen || (s.genInfoOpen = !0), s._genInfoRenderSignature = "", Ke(); } catch (e) { console.debug?.(e); } @@ -10514,7 +10517,7 @@ function Zr() { console.debug?.(e); } }; - if (s) { + if (o) { if (e && (ve.textContent = e.title || "Asset A", l(ye, t ? "Asset A" : "", e.asset, e.loading)), t && l(ye, "Asset C", t.asset, t.loading), n && (W.textContent = n.title || "Asset B", l(G, r ? "Asset B" : "", n.asset, n.loading)), r && l(G, "Asset D", r.asset, r.loading), !c && e?.asset && n?.asset && !e.loading && !n.loading) try { let t = br(e.asset, n.asset); t && G.insertBefore(t, G.firstChild || null); @@ -10529,10 +10532,10 @@ function Zr() { return; } let e = null, t = null, n = null, i = null, l = null; - s ? r === $.SIDE_BY_SIDE ? o?.compareAsset ? (e = a, t = o.compareAsset) : (e = o.assets[0] || null, t = o.assets[1] || null, c && (n = o.assets[2] || null, i = o.assets[3] || null)) : (e = a, t = o?.compareAsset || (o.assets.length === 2 ? o.assets[1 - o.currentIndex] : null)) : l = a; + o ? r === $.SIDE_BY_SIDE ? s?.compareAsset ? (e = a, t = s.compareAsset) : (e = s.assets[0] || null, t = s.assets[1] || null, c && (n = s.assets[2] || null, i = s.assets[3] || null)) : (e = a, t = s?.compareAsset || (s.assets.length === 2 ? s.assets[1 - s.currentIndex] : null)) : l = a; let p = (e) => e ? Oe?.getCached?.(e.id)?.data || e : null; if (f({ - left: s ? { + left: o ? { title: c ? "Assets A & C" : "Asset A", asset: p(e), loading: He(p(e)) @@ -10541,7 +10544,7 @@ function Zr() { asset: p(n), loading: He(p(n)) } : null, - right: s ? { + right: o ? { title: c ? "Assets B & D" : "Asset B", asset: p(t), loading: He(p(t)) @@ -10550,23 +10553,23 @@ function Zr() { asset: p(i), loading: He(p(i)) } : null, - single: s ? null : { + single: o ? null : { title: "Generation Info", asset: p(l), loading: He(p(l)) } - }), o._genInfoReqId !== u) return; - if (s) { - let r = e ? await Ve(e, { signal: d.signal }) : null, a = t ? await Ve(t, { signal: d.signal }) : null, s = n ? await Ve(n, { signal: d.signal }) : null, l = i ? await Ve(i, { signal: d.signal }) : null; - if (o._genInfoReqId !== u) return; + }), s._genInfoReqId !== u) return; + if (o) { + let r = e ? await Ve(e, { signal: d.signal }) : null, a = t ? await Ve(t, { signal: d.signal }) : null, o = n ? await Ve(n, { signal: d.signal }) : null, l = i ? await Ve(i, { signal: d.signal }) : null; + if (s._genInfoReqId !== u) return; f({ left: { title: c ? "Assets A & C" : "Asset A", asset: r, loading: !1 }, - leftExtra: c && s ? { - asset: s, + leftExtra: c && o ? { + asset: o, loading: !1 } : null, right: { @@ -10581,7 +10584,7 @@ function Zr() { }); } else { let e = l ? await Ve(l, { signal: d.signal }) : null; - if (o._genInfoReqId !== u) return; + if (s._genInfoReqId !== u) return; f({ single: { title: "Generation Info", asset: e, @@ -10595,7 +10598,7 @@ function Zr() { function Je(e) { try { return !qe && Yr && (qe = Yr.createFrameExporter({ - state: o, + state: s, VIEWER_MODES: $, singleView: B, abView: V, @@ -10645,9 +10648,9 @@ function Zr() { console.debug?.(e); } return n; - }, n = o.mode === $.SINGLE, r = o.mode === $.AB_COMPARE && Xe(), i = o.mode === $.SIDE_BY_SIDE && Y(); + }, n = s.mode === $.SINGLE, r = s.mode === $.AB_COMPARE && Xe(), i = s.mode === $.SIDE_BY_SIDE && Y(); if ((r || i) && ie) { - let e = o.assets?.[o.currentIndex] || null, n = i && o.compareAsset != null, a = r ? o.compareAsset == null ? o.assets?.[0] || null : e : n ? e : o.assets?.[0] || null, s = r ? o.compareAsset == null ? o.assets?.[1] || null : o.compareAsset : n ? o.compareAsset : o.assets?.[Math.max(0, (o.assets?.length || 1) - 1)] || null, c = t(a, { showName: !1 }), l = t(s, { showName: !1 }); + let e = s.assets?.[s.currentIndex] || null, n = i && s.compareAsset != null, a = r ? s.compareAsset == null ? s.assets?.[0] || null : e : n ? e : s.assets?.[0] || null, o = r ? s.compareAsset == null ? s.assets?.[1] || null : s.compareAsset : n ? s.compareAsset : s.assets?.[Math.max(0, (s.assets?.length || 1) - 1)] || null, c = t(a, { showName: !1 }), l = t(o, { showName: !1 }); try { c && ne.appendChild(c); } catch (e) { @@ -10660,7 +10663,7 @@ function Zr() { } return; } - let a = n ? [o.assets[o.currentIndex]].filter(Boolean) : Array.isArray(o.assets) ? o.assets.slice(0, 4) : []; + let a = n ? [s.assets[s.currentIndex]].filter(Boolean) : Array.isArray(s.assets) ? s.assets.slice(0, 4) : []; for (let e of a) { let r = t(e, { showName: !n }); if (r) try { @@ -10671,14 +10674,14 @@ function Zr() { } }; function Xe() { - return (o.assets.length === 2 || o.compareAsset != null) && !De(); + return (s.assets.length === 2 || s.compareAsset != null) && !De(); } function Y() { - let e = o.assets.length; - return e >= 2 && e <= 4 || e >= 1 && o.compareAsset != null; + let e = s.assets.length; + return e >= 2 && e <= 4 || e >= 1 && s.compareAsset != null; } function Ze() { - let t = !!o?.distractionFree; + let t = !!s?.distractionFree; try { P.style.display = t ? "none" : ""; } catch (e) { @@ -10701,24 +10704,24 @@ function Zr() { } } function Qe() { - o.zoom = 1, o.panX = 0, o.panY = 0, o.targetZoom = 1; + s.zoom = 1, s.panX = 0, s.panY = 0, s.targetZoom = 1; try { - o.mode !== $.AB_COMPARE && o.mode !== $.SIDE_BY_SIDE && o.compareAsset != null && (o.compareAsset = null); + s.mode !== $.AB_COMPARE && s.mode !== $.SIDE_BY_SIDE && s.compareAsset != null && (s.compareAsset = null); } catch (e) { console.debug?.(e); } - let e = o.assets[o.currentIndex], t = o.mode === $.AB_COMPARE && Xe(), n = o.mode === $.SIDE_BY_SIDE && Y(), r = t && o.compareAsset != null, i = n && o.compareAsset != null, a = t ? (r ? e : o.assets?.[0]) || null : n ? (i ? e : o.assets?.[0]) || null : e || null, s = t ? (r ? o.compareAsset : o.assets?.[1]) || null : n ? i ? o.compareAsset : Array.isArray(o.assets) && o.assets.length >= 2 ? o.assets[o.assets.length - 1] : null : null; + let e = s.assets[s.currentIndex], t = s.mode === $.AB_COMPARE && Xe(), n = s.mode === $.SIDE_BY_SIDE && Y(), r = t && s.compareAsset != null, i = n && s.compareAsset != null, a = t ? (r ? e : s.assets?.[0]) || null : n ? (i ? e : s.assets?.[0]) || null : e || null, o = t ? (r ? s.compareAsset : s.assets?.[1]) || null : n ? i ? s.compareAsset : Array.isArray(s.assets) && s.assets.length >= 2 ? s.assets[s.assets.length - 1] : null : null; try { F.textContent = a?.filename || ""; } catch (e) { console.debug?.(e); } try { - ae && re && s && s !== a ? (ae.style.display = "flex", oe && (oe.style.display = "flex"), re.textContent = s?.filename || "", se && le && L && (se.style.display = "flex", le.appendChild(L), L.style.justifyContent = "flex-start"), R && (R.style.justifyContent = "center", R.style.paddingLeft = "84px"), I && (I.style.flex = "0 0 auto"), ue && (ue.style.flex = "0 0 auto"), F && (F.style.textAlign = "left")) : ae && re && (ae.style.display = "none", oe && (oe.style.display = "none"), re.textContent = "", se && (se.style.display = "none"), ue && L && de && (ue.insertBefore(L, de), L.style.justifyContent = "center"), R && (R.style.justifyContent = "center", R.style.paddingLeft = "12px"), I && (I.style.flex = "1 1 auto"), ue && (ue.style.flex = ""), F && (F.style.textAlign = "center")); + ae && re && o && o !== a ? (ae.style.display = "flex", oe && (oe.style.display = "flex"), re.textContent = o?.filename || "", se && le && L && (se.style.display = "flex", le.appendChild(L), L.style.justifyContent = "flex-start"), R && (R.style.justifyContent = "center", R.style.paddingLeft = "84px"), I && (I.style.flex = "0 0 auto"), ue && (ue.style.flex = "0 0 auto"), F && (F.style.textAlign = "left")) : ae && re && (ae.style.display = "none", oe && (oe.style.display = "none"), re.textContent = "", se && (se.style.display = "none"), ue && L && de && (ue.insertBefore(L, de), L.style.justifyContent = "center"), R && (R.style.justifyContent = "center", R.style.paddingLeft = "12px"), I && (I.style.flex = "1 1 auto"), ue && (ue.style.flex = ""), F && (F.style.textAlign = "center")); } catch (e) { console.debug?.(e); } - o.mode === $.AB_COMPARE && Xe() ? xe.textContent = "2 selected" : o.mode === $.SIDE_BY_SIDE && Y() ? xe.textContent = o.compareAsset == null ? `${o.assets.length} selected` : "2 selected" : xe.textContent = `${o.currentIndex + 1} / ${o.assets.length}`, o.mode === $.AB_COMPARE && !Xe() && (o.mode = Y() ? $.SIDE_BY_SIDE : $.SINGLE), o.mode === $.SIDE_BY_SIDE && !Y() && (o.mode = $.SINGLE); + s.mode === $.AB_COMPARE && Xe() ? xe.textContent = "2 selected" : s.mode === $.SIDE_BY_SIDE && Y() ? xe.textContent = s.compareAsset == null ? `${s.assets.length} selected` : "2 selected" : xe.textContent = `${s.currentIndex + 1} / ${s.assets.length}`, s.mode === $.AB_COMPARE && !Xe() && (s.mode = Y() ? $.SIDE_BY_SIDE : $.SINGLE), s.mode === $.SIDE_BY_SIDE && !Y() && (s.mode = $.SINGLE); try { N?.syncModeButtons?.({ canAB: Xe, @@ -10727,30 +10730,30 @@ function Zr() { } catch (e) { console.debug?.(e); } - B.style.display = o.mode === $.SINGLE ? "flex" : "none", V.style.display = o.mode === $.AB_COMPARE ? "block" : "none", H.style.display = o.mode === $.SIDE_BY_SIDE ? "flex" : "none"; + B.style.display = s.mode === $.SINGLE ? "flex" : "none", V.style.display = s.mode === $.AB_COMPARE ? "block" : "none", H.style.display = s.mode === $.SIDE_BY_SIDE ? "flex" : "none"; try { - o.mode !== $.SINGLE && (Fn(B), B.replaceChildren()); + s.mode !== $.SINGLE && (Fn(B), B.replaceChildren()); } catch (e) { console.debug?.(e); } try { - o.mode !== $.AB_COMPARE && (Fn(V), V.replaceChildren()); + s.mode !== $.AB_COMPARE && (Fn(V), V.replaceChildren()); } catch (e) { console.debug?.(e); } try { - o.mode !== $.SIDE_BY_SIDE && (Fn(H), H.replaceChildren()); + s.mode !== $.SIDE_BY_SIDE && (Fn(H), H.replaceChildren()); } catch (e) { console.debug?.(e); } Ye(); - let c = o.mode === $.AB_COMPARE && Xe() || o.mode === $.SIDE_BY_SIDE && Y(); + let c = s.mode === $.AB_COMPARE && Xe() || s.mode === $.SIDE_BY_SIDE && Y(); try { be.style.display = c ? "none" : "", Se.style.display = c ? "none" : ""; } catch (e) { console.debug?.(e); } - et(), tt(o.assets, o.currentIndex), st(); + et(), tt(s.assets, s.currentIndex), st(); try { N?.syncToolsUIFromState?.(); } catch (e) { @@ -10784,14 +10787,14 @@ function Zr() { console.debug?.(e); } try { - let e = o.mode === $.SINGLE; + let e = s.mode === $.SINGLE; Te.sync({ isSingle: e }); } catch (e) { console.debug?.(e); } } function et() { - let e = o.assets[o.currentIndex]; + let e = s.assets[s.currentIndex]; if (!e) return; let t = O(e); if (!t) { @@ -10809,26 +10812,26 @@ function Zr() { } return; } - if (o.mode === $.SINGLE) { + if (s.mode === $.SINGLE) { try { Fn(B); } catch (e) { console.debug?.(e); } - B.innerHTML = "", o._mediaW = 0, o._mediaH = 0; + B.innerHTML = "", s._mediaW = 0, s._mediaH = 0; let n = A(e, t); B.appendChild(n); - } else o.mode === $.AB_COMPARE ? Xe() && Wr?.renderABCompareView?.({ + } else s.mode === $.AB_COMPARE ? Xe() && Wr?.renderABCompareView?.({ abView: V, - state: o, + state: s, currentAsset: e, viewUrl: t, buildAssetViewURL: O, createCompareMediaElement: j, destroyMediaProcessorsIn: Fn - }) : o.mode === $.SIDE_BY_SIDE && Y() && Gr?.renderSideBySideView?.({ + }) : s.mode === $.SIDE_BY_SIDE && Y() && Gr?.renderSideBySideView?.({ sideView: H, - state: o, + state: s, currentAsset: e, viewUrl: t, buildAssetViewURL: O, @@ -10840,9 +10843,9 @@ function Zr() { let { preloadAdjacentAssets: tt, preloadImageForAsset: nt, trackPreloadRef: rt } = pr({ buildAssetViewURL: O, IMAGE_PRELOAD_EXTENSIONS: c, - state: o + state: s }), { destroyPlayerBar: at, syncPlayerBar: ot } = Sr({ - state: o, + state: s, APP_CONFIG: T, VIEWER_MODES: $, overlay: e, @@ -10862,11 +10865,11 @@ function Zr() { viewerInfoCacheGet: Me, viewerInfoCacheSet: Ne }), st = () => ot(), ct = T.VIEWER_MAX_PROC_PIXELS ?? 12e6, lt = () => ({ - exposureEV: Number(o.exposureEV) || 0, - gamma: Math.max(.1, Math.min(3, Number(o.gamma) || 1)), - channel: o.channel || "rgb", - analysisMode: o.analysisMode || "none", - zebraThreshold: Math.max(0, Math.min(1, Number(o.zebraThreshold) || .95)) + exposureEV: Number(s.exposureEV) || 0, + gamma: Math.max(.1, Math.min(3, Number(s.gamma) || 1)), + channel: s.channel || "rgb", + analysisMode: s.analysisMode || "none", + zebraThreshold: Math.max(0, Math.min(1, Number(s.zebraThreshold) || .95)) }), ut = () => { let t = lt(); try { @@ -10881,7 +10884,7 @@ function Zr() { console.debug?.(e); } try { - o?.mode === $.AB_COMPARE && V?._mjrDiffRequest?.(); + s?.mode === $.AB_COMPARE && V?._mjrDiffRequest?.(); } catch (e) { console.debug?.(e); } @@ -10897,7 +10900,7 @@ function Zr() { try { d = fr({ overlay: e, - state: o, + state: s, mediaTransform: f, updateMediaNaturalSize: D, clampPanToBounds: h, @@ -10916,10 +10919,10 @@ function Zr() { } catch { d = null; } - i.push(Z(be, "click", () => { - o.currentIndex > 0 && (o.currentIndex--, Qe()); - })), i.push(Z(Se, "click", () => { - o.currentIndex < o.assets.length - 1 && (o.currentIndex++, Qe()); + a.push(Z(be, "click", () => { + s.currentIndex > 0 && (s.currentIndex--, Qe()); + })), a.push(Z(Se, "click", () => { + s.currentIndex < s.assets.length - 1 && (s.currentIndex++, Qe()); })); let mt = null, ht = () => { try { @@ -10942,9 +10945,9 @@ function Zr() { console.debug?.(e); } }, _t = (e) => { - if (!Array.isArray(o.assets) || o.assets.length === 0) return !1; - let t = o.currentIndex + e; - return t < 0 || t >= o.assets.length ? !1 : (o.currentIndex = t, Qe(), !0); + if (!Array.isArray(s.assets) || s.assets.length === 0) return !1; + let t = s.currentIndex + e; + return t < 0 || t >= s.assets.length ? !1 : (s.currentIndex = t, Qe(), !0); }, vt = (t) => { if (e.style.display === "none") return; try { @@ -10971,7 +10974,7 @@ function Zr() { let n = Number(t.deltaX) || 0, r = Number(t.deltaY) || 0; if (t.shiftKey && r && _t(r > 0 ? 1 : -1) || Math.abs(n) > Math.abs(r) && Math.abs(n) > 30 && _t(n > 0 ? 1 : -1) || !r) return; let i = Math.exp(-r * .0015); - _((Number(o.zoom) || 1) * i, { + _((Number(s.zoom) || 1) * i, { clientX: t.clientX, clientY: t.clientY }); @@ -10987,7 +10990,7 @@ function Zr() { }, bt = Yn({ overlay: e, content: fe, - state: o, + state: s, VIEWER_MODES: $, getPrimaryMedia: y, getMediaNaturalSize: x, @@ -10996,13 +10999,13 @@ function Zr() { probeTooltip: me, loupeWrap: he, onLoupeRedraw: Xn({ - state: o, + state: s, loupeCanvas: ge, loupeWrap: he, getMediaNaturalSize: x, positionOverlayBox: yt }).redraw, - lifecycle: n + lifecycle: t }); try { if (!fe._mjrOverlayResizeBound && "ResizeObserver" in window) { @@ -11013,7 +11016,7 @@ function Zr() { } let t = new ResizeObserver(() => { try { - o._viewportCache = null; + s._viewportCache = null; } catch (e) { console.debug?.(e); } @@ -11024,7 +11027,7 @@ function Zr() { } catch (e) { console.debug?.(e); } - e._mjrResizeObserver = t, i.push(() => { + e._mjrResizeObserver = t, a.push(() => { try { t.disconnect(); } catch (e) { @@ -11039,7 +11042,7 @@ function Zr() { overlay: e, content: fe, singleView: B, - state: o, + state: s, VIEWER_MODES: $, computeOneToOneZoom: E, setZoom: _, @@ -11050,7 +11053,7 @@ function Zr() { navigateViewerAssets: _t, closeViewer: Tt, renderBadges: Ye, - updateAssetRating: t, + updateAssetRating: n, safeDispatchCustomEvent: ce, ASSET_RATING_CHANGED_EVENT: k, probeTooltip: me, @@ -11058,12 +11061,12 @@ function Zr() { renderGenInfoPanel: Ke, getVideoControls: () => { try { - return o?._videoControlsMounted || null; + return s?._videoControlsMounted || null; } catch { return null; } }, - lifecycle: n + lifecycle: t }), St = [], Ct = () => { try { for (let e of St) X(e); @@ -11134,7 +11137,7 @@ function Zr() { try { St.push(Z(fe, "mousemove", (e) => { try { - o._lastPointerX = e.clientX, o._lastPointerY = e.clientY; + s._lastPointerX = e.clientX, s._lastPointerY = e.clientY; } catch (e) { console.debug?.(e); } @@ -11152,11 +11155,11 @@ function Zr() { } }; try { - e._mjrBadgeSyncBound ||= (i.push(Z(window, k, (e) => { + e._mjrBadgeSyncBound ||= (a.push(Z(window, k, (e) => { try { let t = e?.detail?.assetId, n = e?.detail?.rating; if (t == null) return; - for (let e of o.assets || []) e?.id != null && String(e.id) === String(t) && (e.rating = n); + for (let e of s.assets || []) e?.id != null && String(e.id) === String(t) && (e.rating = n); try { Oe?.deleteCached?.(t); } catch (e) { @@ -11166,11 +11169,11 @@ function Zr() { } catch (e) { console.debug?.(e); } - }, { passive: !0 })), i.push(Z(window, w, (e) => { + }, { passive: !0 })), a.push(Z(window, w, (e) => { try { let t = e?.detail?.assetId, n = e?.detail?.tags; if (t == null) return; - for (let e of o.assets || []) e?.id != null && String(e.id) === String(t) && (e.tags = n); + for (let e of s.assets || []) e?.id != null && String(e.id) === String(t) && (e.tags = n); try { Oe?.deleteCached?.(t); } catch (e) { @@ -11186,13 +11189,13 @@ function Zr() { } function Tt() { try { - let e = o.assets?.[o.currentIndex]; + let e = s.assets?.[s.currentIndex]; e?.id && ce(b, { assetId: String(e.id) }, { warnPrefix: "[ViewerRuntime]" }); } catch (e) { console.debug?.(e); } try { - o.distractionFree = !1, Ze(); + s.distractionFree = !1, Ze(); } catch (e) { console.debug?.(e); } @@ -11207,19 +11210,19 @@ function Zr() { console.debug?.(e); } try { - o._scopesVideoAbort?.abort?.(); + s._scopesVideoAbort?.abort?.(); } catch (e) { console.debug?.(e); } - o._scopesVideoAbort = null; + s._scopesVideoAbort = null; try { - o._panHintTimer && clearTimeout(o._panHintTimer); + s._panHintTimer && clearTimeout(s._panHintTimer); } catch (e) { console.debug?.(e); } - o._panHintTimer = null; + s._panHintTimer = null; try { - o._panHintAt = 0; + s._panHintAt = 0; } catch (e) { console.debug?.(e); } @@ -11321,7 +11324,7 @@ function Zr() { console.debug?.(e); } try { - o.genInfoOpen = !1; + s.genInfoOpen = !1; } catch (e) { console.debug?.(e); } @@ -11342,33 +11345,33 @@ function Zr() { } e.style.display = "none", e.style.pointerEvents = "none", Ct(); try { - document.body.style.overflow = o._prevBodyOverflow ?? ""; + document.body.style.overflow = s._prevBodyOverflow ?? ""; } catch { document.body.style.overflow = ""; } try { - o._prevFocusedElement && typeof o._prevFocusedElement.focus == "function" && o._prevFocusedElement.focus(), o._prevFocusedElement = null; + s._prevFocusedElement && typeof s._prevFocusedElement.focus == "function" && s._prevFocusedElement.focus(), s._prevFocusedElement = null; } catch (e) { console.debug?.(e); } - let t = o?._prevHotkeyScope; - a(t || "panel"), o._prevHotkeyScope = null; + let t = s?._prevHotkeyScope; + i(t || "panel"), s._prevHotkeyScope = null; } let Et = { open(t, n = 0, r = null) { - wt(), o.assets = Array.isArray(t) ? t : [t], o.currentIndex = Math.max(0, Math.min(n, o.assets.length - 1)), o.distractionFree = !1; + wt(), s.assets = Array.isArray(t) ? t : [t], s.currentIndex = Math.max(0, Math.min(n, s.assets.length - 1)), s.distractionFree = !1; try { Te.rebuild(); } catch (e) { console.debug?.(e); } - o.zoom = 1, o.panX = 0, o.panY = 0, o.targetZoom = 1, o._userInteracted = !1, o._panHintAt = 0; + s.zoom = 1, s.panX = 0, s.panY = 0, s.targetZoom = 1, s._userInteracted = !1, s._panHintAt = 0; try { - o._panHintTimer && clearTimeout(o._panHintTimer); + s._panHintTimer && clearTimeout(s._panHintTimer); } catch (e) { console.debug?.(e); } - o._panHintTimer = null, o._lastPointerX = null, o._lastPointerY = null, o._mediaW = 0, o._mediaH = 0, o.compareAsset = r, o.gridMode = 0, Be(), o._probe = null; + s._panHintTimer = null, s._lastPointerX = null, s._lastPointerY = null, s._mediaW = 0, s._mediaH = 0, s.compareAsset = r, s.gridMode = 0, Be(), s._probe = null; try { me.style.display = "none"; } catch (e) { @@ -11381,17 +11384,17 @@ function Zr() { } e.style.display = "flex", e.style.pointerEvents = "auto"; try { - o._prevFocusedElement = document.activeElement; + s._prevFocusedElement = document.activeElement; } catch { - o._prevFocusedElement = null; + s._prevFocusedElement = null; } e.focus(); try { - o._prevBodyOverflow = document.body.style.overflow; + s._prevBodyOverflow = document.body.style.overflow; } catch { - o._prevBodyOverflow = ""; + s._prevBodyOverflow = ""; } - document.body.style.overflow = "hidden", o._prevHotkeyScope = u().scope || null, a("viewer"), Qe(); + document.body.style.overflow = "hidden", s._prevHotkeyScope = l().scope || null, i("viewer"), Qe(); try { gt(); } catch (e) { @@ -11408,10 +11411,10 @@ function Zr() { Tt(); }, setMode(e) { - Object.values($).includes(e) && (o.mode = e, Qe()); + Object.values($).includes(e) && (s.mode = e, Qe()); }, setCompareAsset(e) { - o.compareAsset = e, Qe(); + s.compareAsset = e, Qe(); }, dispose() { try { @@ -11490,12 +11493,12 @@ function Zr() { console.debug?.(e); } try { - o._preloadRefs?.clear?.(); + s._preloadRefs?.clear?.(); } catch (e) { console.debug?.(e); } try { - o._preloadedAssetKeys?.clear?.(); + s._preloadedAssetKeys?.clear?.(); } catch (e) { console.debug?.(e); } @@ -11515,7 +11518,7 @@ function Zr() { try { En({ overlayEl: e, - getCurrentAsset: () => o.assets[o.currentIndex], + getCurrentAsset: () => s.assets[s.currentIndex], getCurrentViewUrl: (e) => O(e), onAssetChanged: () => { try { diff --git a/dist/chunks/ViewerPortal-B9LowB2g.js b/dist/chunks/ViewerPortal-DUddpoV3.js similarity index 96% rename from dist/chunks/ViewerPortal-B9LowB2g.js rename to dist/chunks/ViewerPortal-DUddpoV3.js index d3092cd8..81f2fe67 100644 --- a/dist/chunks/ViewerPortal-B9LowB2g.js +++ b/dist/chunks/ViewerPortal-DUddpoV3.js @@ -1,9 +1,9 @@ -import { a as e, i as t } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { r as n } from "./events-DrYpMD-I.js"; -import { a as r, c as i, i as a, l as o, o as s, s as c, t as l, u } from "./Viewer-DXsFcJRb.js"; -import { i as d, r as f } from "./floatingViewerManager-Crq2oCKD.js"; -import { B as p, C as m, D as h, E as g, G as _, J as v, K as y, L as b, N as x, O as S, T as C, U as w, V as T, dt as E, ft as D, j as O, k, lt as A, rt as j, ut as M, w as N, z as P } from "./mjr-primevue-BlSRoWcG.js"; -import { t as F } from "./TagsEditor-BiRWztXF.js"; +import { a as e, i as t } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { r as n } from "./events-CoI83paj.js"; +import { a as r, c as i, i as a, l as o, o as s, s as c, t as l, u } from "./Viewer-DWgaGos-.js"; +import { i as d, r as f } from "./floatingViewerManager-XH4AFW4G.js"; +import { B as p, C as m, D as h, E as g, G as _, J as v, K as y, L as b, N as x, O as S, T as C, U as w, V as T, dt as E, ft as D, j as O, k, lt as A, rt as j, ut as M, w as N, z as P } from "./mjr-primevue-BOf2ACk_.js"; +import { t as F } from "./TagsEditor-BXjsZ3IO.js"; //#endregion //#region ui/vue/components/viewer/FloatingViewerHost.vue var I = /* @__PURE__ */ x({ @@ -112,7 +112,7 @@ var I = /* @__PURE__ */ x({ }); } async function J(e, t, n = "main") { - if (!(!e || e.type !== "item" || e.disabled)) { + if (e && e.type === "item" && !e.disabled) { if (Array.isArray(e.submenu) && e.submenu.length) { q(e, t); return; diff --git a/dist/chunks/events-DrYpMD-I.js b/dist/chunks/events-CoI83paj.js similarity index 99% rename from dist/chunks/events-DrYpMD-I.js rename to dist/chunks/events-CoI83paj.js index 709bba3b..38f7f076 100644 --- a/dist/chunks/events-DrYpMD-I.js +++ b/dist/chunks/events-CoI83paj.js @@ -1,4 +1,4 @@ -import { a as e, n as t, s as n } from "./graphTraversal-BIYmTTPW.js"; +import { a as e, n as t, s as n } from "./graphTraversal-C94Q5bJN.js"; //#region ui/utils/ids.ts function r(e) { try { @@ -106,6 +106,7 @@ var m = 200, h = 0, g = { COLLECT_FILES: "/mjr/am/collect-files", TOOLS_STATUS: "/mjr/am/tools/status", SETTINGS_OUTPUT_DIRECTORY: "/mjr/am/settings/output-directory", + SETTINGS_INPUT_DIRECTORY: "/mjr/am/settings/input-directory", SETTINGS_INDEX_DIRECTORY: "/mjr/am/settings/index-directory", SETTINGS_WORKFLOW_ROOTS: "/mjr/am/settings/workflow-roots", SETTINGS_METADATA_FALLBACK: "/mjr/am/settings/metadata-fallback", @@ -1163,7 +1164,7 @@ function U() { } function W(e, t, n) { let r = B.get(String(e || "")); - if (!(!r || !r.size)) for (let i of Array.from(r)) try { + if (r && r.size) for (let i of Array.from(r)) try { i(t, n, e); } catch (e) { console.debug?.(e); diff --git a/dist/chunks/floatingViewerManager-Crq2oCKD.js b/dist/chunks/floatingViewerManager-XH4AFW4G.js similarity index 92% rename from dist/chunks/floatingViewerManager-Crq2oCKD.js rename to dist/chunks/floatingViewerManager-XH4AFW4G.js index 26eaaf43..2bd8e910 100644 --- a/dist/chunks/floatingViewerManager-Crq2oCKD.js +++ b/dist/chunks/floatingViewerManager-XH4AFW4G.js @@ -1,6 +1,6 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; -import { _ as t, d as n, o as r, s as i, t as a } from "./viewerRuntimeHosts-DyiuTSfr.js"; -import { o, r as s, z as c } from "./events-DrYpMD-I.js"; +import { _ as t, d as n, o as r, s as i, t as a } from "./viewerRuntimeHosts-BBd8uK6j.js"; +import { o, r as s, z as c } from "./events-CoI83paj.js"; //#region ui/features/panel/panelRuntimeRefs.ts var l = null; function u(e) { @@ -98,11 +98,11 @@ var te = /* @__PURE__ */ e({ teardownFloatingViewerManager: () => we }), v = null, y = null; async function ne() { - return v || (y ||= import("./FloatingViewer-C_N3LZxW.js").then((e) => (v = e.FloatingViewer, v)), y); + return v || (y ||= import("./FloatingViewer-38MC8yxJ.js").then((e) => (v = e.FloatingViewer, v)), y); } var b = null, re = null; async function ie() { - if (!b) return re ||= import("./NodeStreamController-DpGjUOfx.js").then((e) => { + if (!b) return re ||= import("./NodeStreamController-DaqaPtXc.js").then((e) => { b = e.setNodeStreamActive; }), re; } @@ -180,7 +180,7 @@ function se() { } } function F(e) { - typeof window > "u" || window.dispatchEvent(new CustomEvent(s.MFV_VISIBILITY_CHANGED, { detail: { visible: !!e } })); + typeof window < "u" && window.dispatchEvent(new CustomEvent(s.MFV_VISIBILITY_CHANGED, { detail: { visible: !!e } })); } function I(e) { e && (e.setLiveActive(T), e.setPreviewActive(E), e.setNodeStreamActive?.(D)); @@ -310,7 +310,7 @@ function B(e) { } } function V() { - k || typeof window > "u" || (window.addEventListener(s.SELECTION_CHANGED, B), k = !0); + k || typeof window < "u" && (window.addEventListener(s.SELECTION_CHANGED, B), k = !0); } function H() { typeof window < "u" && window.removeEventListener(s.SELECTION_CHANGED, B), k = !1, N(); @@ -409,7 +409,7 @@ var Y = { }, async upsertWithContent(e) { let t = await M(), n = !!t.isVisible; - !n && o.MFV_LIVE_AUTO_OPEN === !1 || (t.show(), I(t), V(), ce(t, e), n || F(!0)); + (n || o.MFV_LIVE_AUTO_OPEN !== !1) && (t.show(), I(t), V(), ce(t, e), n || F(!0)); }, setLiveActive(e) { T = !!e, S?.setLiveActive(T); @@ -433,7 +433,7 @@ var Y = { async feedPreviewBlob(e, t = {}) { if (!Y.canAcceptPreviewBlob()) return; let n = await M(), r = !!n.isVisible; - !r && o.MFV_PREVIEW_AUTO_OPEN === !1 || (n.isVisible || n.show(), I(n), n.loadPreviewBlob(e, ...Object.keys(t).length ? [t] : []), r || F(!0)); + (r || o.MFV_PREVIEW_AUTO_OPEN !== !1) && (n.isVisible || n.show(), I(n), n.loadPreviewBlob(e, ...Object.keys(t).length ? [t] : []), r || F(!0)); }, toggleNodeStream() { Y.setNodeStreamActive(!D); @@ -458,7 +458,7 @@ var Y = { async feedNodeStream(e) { if (!D) return; let t = await M(), n = !!t.isVisible; - !n && o.MFV_NODE_STREAM_AUTO_OPEN === !1 || (t.isVisible || (t.show(), V()), I(t), L(t), ce(t, e), n || F(!0)); + (n || o.MFV_NODE_STREAM_AUTO_OPEN !== !1) && (t.isVisible || (t.show(), V()), I(t), L(t), ce(t, e), n || F(!0)); } }, X = !1, pe = () => Y.open(), me = () => Y.close(), he = () => Y.toggle(), Z = () => Y.toggleLive(), ge = () => Y.togglePreview(), _e = () => Y.toggleNodeStream(), ve = () => Y.popOut(), ye = () => { try { @@ -520,7 +520,7 @@ var Q = (e) => { } }; function $() { - X || typeof window > "u" || !window?.addEventListener || (window.addEventListener(s.MFV_OPEN, pe), window.addEventListener(s.MFV_CLOSE, me), window.addEventListener(s.MFV_TOGGLE, he), window.addEventListener(s.MFV_LIVE_TOGGLE, Z), window.addEventListener(s.MFV_PREVIEW_TOGGLE, ge), window.addEventListener(s.MFV_NODESTREAM_TOGGLE, _e), window.addEventListener(s.MFV_POPOUT, ve), window.addEventListener(s.SETTINGS_CHANGED, be), window.addEventListener("keydown", Q, !0), window.addEventListener("beforeunload", ye), X = !0); + X || typeof window < "u" && window?.addEventListener && (window.addEventListener(s.MFV_OPEN, pe), window.addEventListener(s.MFV_CLOSE, me), window.addEventListener(s.MFV_TOGGLE, he), window.addEventListener(s.MFV_LIVE_TOGGLE, Z), window.addEventListener(s.MFV_PREVIEW_TOGGLE, ge), window.addEventListener(s.MFV_NODESTREAM_TOGGLE, _e), window.addEventListener(s.MFV_POPOUT, ve), window.addEventListener(s.SETTINGS_CHANGED, be), window.addEventListener("keydown", Q, !0), window.addEventListener("beforeunload", ye), X = !0); } function Ce() { if (typeof window > "u" || !window?.removeEventListener) { diff --git a/dist/chunks/genInfo-D0BtEEbx.js b/dist/chunks/genInfo-y4P7FXnU.js similarity index 98% rename from dist/chunks/genInfo-D0BtEEbx.js rename to dist/chunks/genInfo-y4P7FXnU.js index 5ffea8e9..2884583d 100644 --- a/dist/chunks/genInfo-D0BtEEbx.js +++ b/dist/chunks/genInfo-y4P7FXnU.js @@ -1,8 +1,8 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; -import { m as t, o as n } from "./events-DrYpMD-I.js"; -import { h as r } from "./Viewer-DXsFcJRb.js"; -import { i, n as a, r as o, t as s, u as c } from "./SidebarWorkflowSection-BEJKYrrz.js"; -import { D as l, E as u, N as d, O as f, T as p, V as m, dt as h, ft as g, k as _, lt as v } from "./mjr-primevue-BlSRoWcG.js"; +import { m as t, o as n } from "./events-CoI83paj.js"; +import { h as r } from "./Viewer-DWgaGos-.js"; +import { i, n as a, r as o, t as s, u as c } from "./SidebarWorkflowSection-DpoPGJrq.js"; +import { D as l, E as u, N as d, O as f, T as p, V as m, dt as h, ft as g, k as _, lt as v } from "./mjr-primevue-BOf2ACk_.js"; //#region ui/vue/components/viewer/ViewerMetadataBlock.vue?vue&type=script&setup=true&lang.ts var y = { style: { display: "flex", @@ -109,7 +109,7 @@ var y = { style: { let t = Object.entries(e || {}); if (!t.length) return !1; let n = 0; - for (let [, e] of t.slice(0, 50)) if (!(!e || typeof e != "object") && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; + for (let [, e] of t.slice(0, 50)) if (e && typeof e == "object" && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; } catch { return !1; } diff --git a/dist/chunks/geninfoParser-DS9m_bHm.js b/dist/chunks/geninfoParser-Bwtqk4p6.js similarity index 98% rename from dist/chunks/geninfoParser-DS9m_bHm.js rename to dist/chunks/geninfoParser-Bwtqk4p6.js index 7087c759..168f551a 100644 --- a/dist/chunks/geninfoParser-DS9m_bHm.js +++ b/dist/chunks/geninfoParser-Bwtqk4p6.js @@ -22,7 +22,7 @@ function t(e) { let t = Object.entries(e || {}); if (!t.length) return !1; let n = 0; - for (let [, e] of t.slice(0, 50)) if (!(!e || typeof e != "object") && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; + for (let [, e] of t.slice(0, 50)) if (e && typeof e == "object" && (e.inputs && typeof e.inputs == "object" && (n += 1), n >= 2)) return !0; return !1; } catch { return !1; @@ -195,7 +195,7 @@ function l(e, t, n) { } function u(e, t) { let n = Number(e), r = Number(t); - if (!(!Number.isFinite(n) || !Number.isFinite(r))) return n + r; + if (Number.isFinite(n) && Number.isFinite(r)) return n + r; } function d(e, t) { if (e == null || e === "") return ""; @@ -227,7 +227,7 @@ function p(e, t, n) { } function m(e) { let t = {}; - for (let [n, r] of Object.entries(e || {})) r != null && r !== "" && (Array.isArray(r) && r.length === 0 || r && typeof r == "object" && !Array.isArray(r) && Object.keys(r).length === 0 || (t[n] = r)); + for (let [n, r] of Object.entries(e || {})) r != null && r !== "" && (Array.isArray(r) && r.length === 0 || (!r || typeof r != "object" || Array.isArray(r) || Object.keys(r).length !== 0) && (t[n] = r)); return t; } function h(e) { @@ -495,7 +495,7 @@ function R(r) { let i = r.geninfo || r.GenInfo || r.generation || null; if (i && typeof i == "object") { let e = {}, t = /* @__PURE__ */ new Set(), n = (e, n) => { - if (!(!n || typeof n != "object") && (n.confidence === "override" || n.source === "majoor_geninfo")) for (let n of Array.isArray(e) ? e : [e]) t.add(n); + if (n && typeof n == "object" && (n.confidence === "override" || n.source === "majoor_geninfo")) for (let n of Array.isArray(e) ? e : [e]) t.add(n); }, a = i.positive?.value ?? i.positive?.text ?? null, o = i.negative?.value ?? i.negative?.text ?? null; typeof a == "string" && a.trim() && (e.prompt = a), typeof o == "string" && o.trim() && (e.negative_prompt = o), n("prompt", i.positive), n("negative_prompt", i.negative); let s = i.checkpoint?.name ?? i.checkpoint ?? null; @@ -669,7 +669,7 @@ function H(e, t) { return null; } function U(e, t) { - if (!(!t || typeof t != "object")) { + if (t && typeof t == "object") { for (let [n, r] of Object.entries(t)) if (r != null && r !== "") { if (Array.isArray(r) && Array.isArray(e[n])) { e[n] = G(e[n], r); diff --git a/dist/chunks/graphTraversal-BIYmTTPW.js b/dist/chunks/graphTraversal-C94Q5bJN.js similarity index 98% rename from dist/chunks/graphTraversal-BIYmTTPW.js rename to dist/chunks/graphTraversal-C94Q5bJN.js index c4c959c7..3ad188eb 100644 --- a/dist/chunks/graphTraversal-BIYmTTPW.js +++ b/dist/chunks/graphTraversal-C94Q5bJN.js @@ -25,7 +25,7 @@ function a(e, t = e?.graph) { return r ? `${r}:${n}` : n; } function o(e, t, n, r) { - !n || typeof n != "object" || t.has(n) || (t.add(n), e.push({ + n && typeof n == "object" && !t.has(n) && (t.add(n), e.push({ graph: n, label: r })); diff --git a/dist/chunks/mjr-primevue-BlSRoWcG.js b/dist/chunks/mjr-primevue-BOf2ACk_.js similarity index 99% rename from dist/chunks/mjr-primevue-BlSRoWcG.js rename to dist/chunks/mjr-primevue-BOf2ACk_.js index 2ee7a90f..63e2fda5 100644 --- a/dist/chunks/mjr-primevue-BlSRoWcG.js +++ b/dist/chunks/mjr-primevue-BOf2ACk_.js @@ -908,7 +908,7 @@ function vn(e, n, i = t) { }; } let C = b ? Array(e.length).fill(mn) : mn, w = (e) => { - if (!(!(m.flags & 1) || !m.dirty && !e)) { + if (m.flags & 1 && (m.dirty || e)) { if (n) { let t = m.run(); if (e || o || y || (b ? t.some((e, t) => oe(e, C[t])) : oe(t, C))) { @@ -2442,8 +2442,8 @@ function _a(e, i) { m & 8 ? (u & 16 && ye(l, i, a), d !== l && p(n, d)) : u & 16 ? m & 16 ? me(l, d, n, r, i, a, o, s, c) : ye(l, i, a, !0) : (u & 8 && p(n, ""), m & 16 && T(d, n, r, i, a, o, s, c)); }, pe = (e, t, r, i, a, o, s, c, l) => { e ||= n, t ||= n; - let u = e.length, d = t.length, f = Math.min(u, d), p; - for (p = 0; p < f; p++) { + let u = e.length, d = t.length, f = Math.min(u, d), p = 0; + for (; p < f; p++) { let n = t[p] = l ? Ka(t[p]) : Ga(t[p]); v(e[p], n, r, null, a, o, s, c, l); } @@ -3033,7 +3033,7 @@ var bo = vo ? (e) => vo.createHTML(e) : (e) => e, xo = "http://www.w3.org/2000/s }, insertStaticContent(e, t, n, r, i, a) { let o = n ? n.previousSibling : t.lastChild; - if (i && (i === a || i.nextSibling)) for (; t.insertBefore(i.cloneNode(!0), n), !(i === a || !(i = i.nextSibling));); + if (i && (i === a || i.nextSibling)) for (; t.insertBefore(i.cloneNode(!0), n), i !== a && (i = i.nextSibling);); else { wo.innerHTML = bo(r === "svg" ? `` : r === "mathml" ? `` : e); let i = wo.content; @@ -3318,7 +3318,7 @@ function ys(e, t) { } var bs = (e) => e.charCodeAt(0) === 111 && e.charCodeAt(1) === 110 && e.charCodeAt(2) > 96 && e.charCodeAt(2) < 123, xs = (e, t, n, r, i, s) => { let c = i === "svg"; - t === "class" ? Ko(e, r, c) : t === "style" ? $o(e, n, r) : a(t) ? o(t) || fs(e, t, n, r, s) : (t[0] === "." ? (t = t.slice(1), !0) : t[0] === "^" ? (t = t.slice(1), !1) : Ss(e, t, r, c)) ? (cs(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && ss(e, t, r, c, s, t !== "value")) : e._isVueCE && (Cs(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !g(r))) ? cs(e, T(t), r, s, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), ss(e, t, r, c)); + t === "class" ? Ko(e, r, c) : t === "style" ? $o(e, n, r) : a(t) ? o(t) || fs(e, t, n, r, s) : (t[0] === "." ? (t = t.slice(1), 1) : t[0] === "^" ? (t = t.slice(1), 0) : Ss(e, t, r, c)) ? (cs(e, t, r), !e.tagName.includes("-") && (t === "value" || t === "checked" || t === "selected") && ss(e, t, r, c, s, t !== "value")) : e._isVueCE && (Cs(e, t) || e._def.__asyncLoader && (/[A-Z]/.test(t) || !g(r))) ? cs(e, T(t), r, s, t) : (t === "true-value" ? e._trueValue = r : t === "false-value" && (e._falseValue = r), ss(e, t, r, c)); }; function Ss(e, t, n, r) { if (r) return !!(t === "innerHTML" || t === "textContent" || t in e && bs(t) && h(n)); @@ -3407,7 +3407,7 @@ function Ms(e, t, n) { } function Ns(e, t) { let n = e.multiple, r = d(t); - if (!(n && !r && !p(t))) { + if (!n || r || p(t)) { for (let i = 0, a = e.options.length; i < a; i++) { let a = e.options[i], o = Ps(a); if (n) { @@ -4818,7 +4818,7 @@ function ru(e) { el: i, css: r, unload: function() { - !s || !n.value || (E(), Vc(i.value) && s.head.removeChild(i.value), n.value = !1, i.value = null); + s && n.value && (E(), Vc(i.value) && s.head.removeChild(i.value), n.value = !1, i.value = null); }, load: ie, isLoaded: /* @__PURE__ */ Gt(n) @@ -6420,7 +6420,7 @@ var Qd = Vd.extend("ripple", { }, onMouseDown: function(e) { var t = this, n = e.currentTarget, r = this.getInk(n); - if (!(!r || getComputedStyle(r, null).display === "none")) { + if (r && getComputedStyle(r, null).display !== "none") { if (!this.isUnstyled() && Dc(r, "p-ink-active"), r.setAttribute("data-p-ink-active", "false"), !Xc(r) && !nl(r)) { var i = Math.max(Rc(n), $c(n)); r.style.height = i + "px", r.style.width = i + "px"; @@ -11262,7 +11262,7 @@ var ag = { bindOutsideClickListener: function() { var e = this; this.outsideClickListener || (this.outsideClickListener = function(t) { - var n = e.container && !e.container.contains(t.target), r = !(e.target && (e.target === t.target || e.target.contains(t.target))); + var n = e.container && !e.container.contains(t.target), r = !e.target || e.target !== t.target && !e.target.contains(t.target); e.overlayVisible && n && r ? e.hide() : !e.popup && n && r && (e.focusedOptionIndex = -1); }, document.addEventListener("click", this.outsideClickListener, !0)); }, diff --git a/dist/chunks/mjr-vue-vendor-Bb2CVJXl.js b/dist/chunks/mjr-vue-vendor-BKZZuiuB.js similarity index 99% rename from dist/chunks/mjr-vue-vendor-Bb2CVJXl.js rename to dist/chunks/mjr-vue-vendor-BKZZuiuB.js index b674e80b..ada95ffc 100644 --- a/dist/chunks/mjr-vue-vendor-Bb2CVJXl.js +++ b/dist/chunks/mjr-vue-vendor-BKZZuiuB.js @@ -1,4 +1,4 @@ -import { $ as e, F as t, I as n, K as r, L as i, Q as a, T as o, X as s, Z as c, et as l, nt as u, ot as d, rt as f, st as p, tt as m } from "./mjr-primevue-BlSRoWcG.js"; +import { $ as e, F as t, I as n, K as r, L as i, Q as a, T as o, X as s, Z as c, et as l, nt as u, ot as d, rt as f, st as p, tt as m } from "./mjr-primevue-BOf2ACk_.js"; //#region node_modules/pinia/dist/pinia.js var h = typeof window < "u", g, _ = (e) => g = e, v = () => t() && n(y) || g, y = Symbol(); function b(e) { diff --git a/dist/chunks/model3dRenderer-CWRtZrSS.js b/dist/chunks/model3dRenderer-e5uWwIMW.js similarity index 98% rename from dist/chunks/model3dRenderer-CWRtZrSS.js rename to dist/chunks/model3dRenderer-e5uWwIMW.js index ea57cd05..f18032c2 100644 --- a/dist/chunks/model3dRenderer-CWRtZrSS.js +++ b/dist/chunks/model3dRenderer-e5uWwIMW.js @@ -1,9 +1,9 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; -import { m as t, mt as n, o as r, r as i } from "./events-DrYpMD-I.js"; +import { m as t, mt as n, o as r, r as i } from "./events-CoI83paj.js"; import { n as a } from "./state-DPiaUMw1.js"; //#region ui/features/viewer/model3dCore.ts function o(e, t) { - if (!(!e || typeof t != "function")) try { + if (e && typeof t == "function") try { e.traverse?.((e) => { (e?.isMesh || e?.isPoints || e?.isLine) && t(e); }); @@ -1093,7 +1093,7 @@ function F(e, a, o = {}) { let n = Math.max(1e-4, (Number(e) || 1) / Math.max(1, Number(t) || 1)), r = Ce * n; V.left = -r / 2, V.right = r / 2, V.top = Ce / 2, V.bottom = -Ce / 2, V.updateProjectionMatrix(); }, Be = () => { - if (!(!G || !H || !K)) { + if (G && H && K) { if (q === A.ORTHOGRAPHIC) { let e = _.getBoundingClientRect(); Ce = m(V, H, K, Math.max(1e-4, (e.width || 1) / Math.max(1, e.height || 1))) || Ce, z = V; @@ -1147,7 +1147,7 @@ function F(e, a, o = {}) { } }); }, Ue = (e) => { - !Se || !I || (u(Te), l(I, Se, e, we, Te), Fe()); + Se && I && (u(Te), l(I, Se, e, we, Te), Fe()); }, We = (e) => { if (!G) return; let t = ce[e] || [ @@ -1201,9 +1201,9 @@ function F(e, a, o = {}) { P.progressSlider.max = String(e); } catch {} }, Je = () => { - !X || !Z.length || (je ? (X.timeScale = 0, je = !1, P.playBtn.textContent = t("model3d.play", "Play")) : (X.timeScale = Ae, Q[$]?.isRunning?.() ? (je = !0, P.playBtn.textContent = t("model3d.pause", "Pause")) : qe($))); + X && Z.length && (je ? (X.timeScale = 0, je = !1, P.playBtn.textContent = t("model3d.play", "Play")) : (X.timeScale = Ae, Q[$]?.isRunning?.() ? (je = !0, P.playBtn.textContent = t("model3d.pause", "Pause")) : qe($))); }, Ye = (e, t) => { - !e || e.length === 0 || !I || (Z = e, X = new I.AnimationMixer(t), ke = new I.Clock(), Q = Array(e.length).fill(null), P.animSel.innerHTML = "", e.forEach((e, t) => { + e && e.length !== 0 && I && (Z = e, X = new I.AnimationMixer(t), ke = new I.Clock(), Q = Array(e.length).fill(null), P.animSel.innerHTML = "", e.forEach((e, t) => { let n = document.createElement("option"); n.value = String(t), n.textContent = e.name || `Animation ${t + 1}`, P.animSel.appendChild(n); }), P.animSel.style.display = e.length > 1 ? "" : "none", P.bar.style.display = "flex", M.style.bottom = "54px", qe(0), P.playBtn.addEventListener("click", (e) => { @@ -1597,7 +1597,7 @@ function F(e, a, o = {}) { } Fe(); let de = () => { - if (!(F || ye || !L || !R || !z)) { + if (!F && !ye && L && R && z) { try { if (H?.update?.(), X && ke) { let e = ke.getDelta(); diff --git a/dist/chunks/openMajoorSettings-CjYabCh7.js b/dist/chunks/openMajoorSettings-CxqtW_yN.js similarity index 98% rename from dist/chunks/openMajoorSettings-CjYabCh7.js rename to dist/chunks/openMajoorSettings-CxqtW_yN.js index 60ca2179..89be18ba 100644 --- a/dist/chunks/openMajoorSettings-CjYabCh7.js +++ b/dist/chunks/openMajoorSettings-CxqtW_yN.js @@ -1,6 +1,6 @@ -import { A as e, E as t, J as n, R as r, S as i, Y as a, b as o, j as s, m as c } from "./events-DrYpMD-I.js"; -import { a as l, n as u } from "./graphTraversal-BIYmTTPW.js"; -import { S as d, Y as f, b as p, x as m, y as h } from "./SidebarWorkflowSection-BEJKYrrz.js"; +import { A as e, E as t, J as n, R as r, S as i, Y as a, b as o, j as s, m as c } from "./events-CoI83paj.js"; +import { a as l, n as u } from "./graphTraversal-C94Q5bJN.js"; +import { S as d, Y as f, b as p, x as m, y as h } from "./SidebarWorkflowSection-DpoPGJrq.js"; //#region ui/features/viewer/floatingViewerProgress.ts var g = "progress-update", _ = "__MJR_MFV_PROGRESS_SERVICE__"; function ee() { @@ -100,7 +100,7 @@ var te = class { return r ? (this._attachApi(r), r) : null; } _attachApi(e) { - !e || typeof e.addEventListener != "function" || this._api !== e && (this.dispose({ + e && typeof e.addEventListener == "function" && this._api !== e && (this.dispose({ resetPatchedQueuePrompt: !1, keepState: !0 }), this._api = e, this._patchQueuePrompt(e), this._attachApiListeners(e)); @@ -340,7 +340,7 @@ function k(e) { let t = fe(e), n = e?.properties && typeof e.properties == "object" ? e.properties : null; if (Array.isArray(e?._mjrSubgraphProxyParams)) for (let n of e._mjrSubgraphProxyParams) { let e = String(n?.label || n?.key || "").trim(); - !e || t.some(([t]) => String(t) === e) || t.push([e, n?.value]); + e && !t.some(([t]) => String(t) === e) && t.push([e, n?.value]); } if (n) for (let [e, r] of Object.entries(n)) ge(e) || r != null && typeof r != "object" && t.push([e, r]); return t.slice(0, 160); @@ -370,7 +370,7 @@ function A(e) { }); } function pe(e) { - return !!(e && typeof e == "object" && !Array.isArray(e) && !j(e)); + return !(!e || typeof e != "object" || Array.isArray(e) || j(e)); } function me(e) { if (Array.isArray(e)) return e; @@ -415,7 +415,7 @@ function P(e) { let n = []; for (let e of ["required", "optional"]) { let r = t[e]; - if (!(!r || typeof r != "object")) for (let [e, t] of Object.entries(r)) I(t) && n.push(e); + if (r && typeof r == "object") for (let [e, t] of Object.entries(r)) I(t) && n.push(e); } return n.length ? n : N(e); } @@ -642,7 +642,7 @@ function Oe(e, t) { let d = u.find(([e]) => V(e) === V(c)) || u.find(([e]) => V(e) === "value") || (u.length === 1 ? u[0] : null); if (!d) continue; let f = `${String(s)}:${je(t, c, d[0])}`, p = a.get(f) || a.get(String(s)) || Me(l, d[0], c); - i.size && !i.has(V(p)) || o.push({ + (!i.size || i.has(V(p))) && o.push({ label: p, value: d[1], innerNodeId: s, @@ -666,7 +666,7 @@ function Ae(e) { let n = Array.isArray(e) ? e[1] : e?.origin_id ?? e?.originId ?? e?.from; if (String(n) !== "-10") continue; let i = Number(Array.isArray(e) ? e[2] : e?.origin_slot ?? e?.originSlot ?? e?.fromSlot), a = Array.isArray(e) ? e[3] : e?.target_id ?? e?.targetId ?? e?.to, o = Number(Array.isArray(e) ? e[4] : e?.target_slot ?? e?.targetSlot ?? e?.toSlot), s = Number.isFinite(i) ? t[i] : null, c = String(s?.label || s?.localized_name || s?.name || "").trim(); - !c || a == null || V(c) !== "value" && (r.set(String(a), c), Number.isFinite(o) && r.set(`${String(a)}:${o}`, c)); + c && a != null && V(c) !== "value" && (r.set(String(a), c), Number.isFinite(o) && r.set(`${String(a)}:${o}`, c)); } return r; } diff --git a/dist/chunks/sideBySide-BqUyrNow.js b/dist/chunks/sideBySide-BM4KMMX-.js similarity index 96% rename from dist/chunks/sideBySide-BqUyrNow.js rename to dist/chunks/sideBySide-BM4KMMX-.js index 41808dda..b5c05882 100644 --- a/dist/chunks/sideBySide-BqUyrNow.js +++ b/dist/chunks/sideBySide-BM4KMMX-.js @@ -1,5 +1,5 @@ -import { i as e } from "./model3dRenderer-CWRtZrSS.js"; -import { i as t, o as n } from "./geninfoParser-DS9m_bHm.js"; +import { i as e } from "./model3dRenderer-e5uWwIMW.js"; +import { i as t, o as n } from "./geninfoParser-Bwtqk4p6.js"; //#region ui/features/viewer/sideBySide.ts function r(e) { if (!e) return null; @@ -143,7 +143,7 @@ function o(e) { for (let t = 0; t < r.length; t++) { if (t === e) continue; let a = r[t], o = a._mjr3D.camera, s = a._mjr3D.controls; - !o || !s || (o.position.copy(n.position), o.quaternion.copy(n.quaternion), n.zoom !== void 0 && (o.zoom = n.zoom), o.updateProjectionMatrix(), s.target.copy(i.target), s.update()); + o && s && (o.position.copy(n.position), o.quaternion.copy(n.quaternion), n.zoom !== void 0 && (o.zoom = n.zoom), o.updateProjectionMatrix(), s.target.copy(i.target), s.update()); } } catch (e) { console.debug?.(e); diff --git a/dist/chunks/viewerOpenRequest-sWnzQpJQ.js b/dist/chunks/viewerOpenRequest-CwB6clm0.js similarity index 91% rename from dist/chunks/viewerOpenRequest-sWnzQpJQ.js rename to dist/chunks/viewerOpenRequest-CwB6clm0.js index dacaaf4d..a5a54063 100644 --- a/dist/chunks/viewerOpenRequest-sWnzQpJQ.js +++ b/dist/chunks/viewerOpenRequest-CwB6clm0.js @@ -1,6 +1,6 @@ import { t as e } from "./rolldown-runtime-Dy4uBu1J.js"; -import { r as t } from "./events-DrYpMD-I.js"; -import { t as n } from "./Viewer-DXsFcJRb.js"; +import { r as t } from "./events-CoI83paj.js"; +import { t as n } from "./Viewer-DWgaGos-.js"; //#region ui/features/viewer/viewerOpenRequest.ts var r = /* @__PURE__ */ e({ requestViewerOpen: () => o }); function i(e) { diff --git a/dist/chunks/viewerRuntimeHosts-DyiuTSfr.js b/dist/chunks/viewerRuntimeHosts-BBd8uK6j.js similarity index 84% rename from dist/chunks/viewerRuntimeHosts-DyiuTSfr.js rename to dist/chunks/viewerRuntimeHosts-BBd8uK6j.js index bd604177..03532c1a 100644 --- a/dist/chunks/viewerRuntimeHosts-DyiuTSfr.js +++ b/dist/chunks/viewerRuntimeHosts-BBd8uK6j.js @@ -1,12 +1,12 @@ -import { Ct as e, St as t, _t as n, gt as r, ht as i, k as a, m as o, nt as s, o as c, tt as l, vt as u, xt as d } from "./events-DrYpMD-I.js"; +import { Ct as e, St as t, _t as n, gt as r, ht as i, k as a, m as o, nt as s, o as c, tt as l, vt as u, xt as d } from "./events-CoI83paj.js"; //#region ui/app/settingsStore.ts var f = "mjrSettings", p = "mjrMinimapSettings", m = /* @__PURE__ */ new Set([ "POST", "PUT", "DELETE", "PATCH" -]), h = 2e4, g = 3e5, _ = 3, v = 400, y = 1e4, b = "/mjr/am/settings/security/bootstrap-token", x = "/mjr/am/", S = /* @__PURE__ */ new Map(); -function ee(e) { +]), h = 2e4, ee = 3e5, g = 3, _ = 400, v = 1e4, y = "/mjr/am/settings/security/bootstrap-token", b = "/mjr/am/", x = /* @__PURE__ */ new Map(); +function S(e) { return new Promise((t) => setTimeout(t, e)); } function C(e) { @@ -26,10 +26,10 @@ function te(e) { } } function w(e) { - return te(e).startsWith(x); + return te(e).startsWith(b); } function T(e) { - return te(e) === b; + return te(e) === y; } function ne(e) { try { @@ -64,27 +64,27 @@ function re(e) { }; } } -function E(e, t) { +function ie(e, t) { if (!e || typeof e != "object") return e; let { requestId: n, retryAfterSeconds: r } = re(t); return n && !("request_id" in e) && (e.request_id = n), r !== null && !("retry_after" in e) && (e.retry_after = r), e; } -function D(e = {}) { +function ae(e = {}) { try { let t = Number(e?.timeoutMs); - return Number.isFinite(t) ? Math.max(1e3, Math.min(g, Math.floor(t))) : h; + return Number.isFinite(t) ? Math.max(1e3, Math.min(ee, Math.floor(t))) : h; } catch { return h; } } -function ie(e = {}) { +function oe(e = {}) { let t = e?.signal || null; if (typeof AbortController > "u") return { signal: t || void 0, - timeoutMs: D(e), + timeoutMs: ae(e), cleanup: () => {} }; - let n = D(e), r = new AbortController(), i = null, a = () => { + let n = ae(e), r = new AbortController(), i = null, a = () => { try { i &&= (clearTimeout(i), null); } catch (e) { @@ -129,24 +129,24 @@ function ie(e = {}) { } }; } -function ae(e, t, n = {}) { +function se(e, t, n = {}) { let r = String(e || "GET").trim().toUpperCase(), i = String(t || "").trim(); - return !r || !i ? "" : `${r}:${i}:timeout=${D(n)}`; + return !r || !i ? "" : `${r}:${i}:timeout=${ae(n)}`; } -function oe(e, t) { +function ce(e, t) { let n = String(e || "").trim(); if (!n) return t(); - if (S.has(n)) return S.get(n); + if (x.has(n)) return x.get(n); let r = Promise.resolve().then(() => t()).finally(() => { try { - S.delete(n); + x.delete(n); } catch (e) { console.debug?.(e); } }); - return S.set(n, r), r; + return x.set(n, r), r; } -function se(e, t, n) { +function le(e, t, n) { if (C(t)) try { e instanceof Headers ? e.has("X-Requested-With") || e.set("X-Requested-With", "XMLHttpRequest") : e["X-Requested-With"] ||= "XMLHttpRequest"; } catch (e) { @@ -158,14 +158,14 @@ function se(e, t, n) { console.debug?.(e); } } -function ce(e, t) { +function ue(e, t) { if (t) try { e instanceof Headers ? (e.has("X-MJR-Token") || e.set("X-MJR-Token", t), e.has("Authorization") || e.set("Authorization", `Bearer ${t}`)) : ("X-MJR-Token" in e || (e["X-MJR-Token"] = t), "Authorization" in e || (e.Authorization = `Bearer ${t}`)); } catch (e) { console.debug?.(e); } } -async function le(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailure: a, fetchAPI: o, options: s, retryCount: c }) { +async function de(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailure: a, fetchAPI: o, options: s, retryCount: c }) { let l = e.headers.get("content-type") || ""; if (!l.includes("application/json")) return !r && C(n) && w(t) && !T(t) && Number(e.status || 0) === 401 && await i({ force: !0, @@ -173,7 +173,7 @@ async function le(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailu }) ? await o(t, { ...s, _authRetryDone: !0 - }, c) : E({ + }, c) : ie({ ok: !1, error: `Server returned non-JSON response (${e.status})`, code: "INVALID_RESPONSE", @@ -182,7 +182,7 @@ async function le(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailu data: null }, e); let u = await e.json().catch((e) => (console.debug?.("[MJR API] JSON parse error:", e), null)); - if (typeof u != "object" || !u || Array.isArray(u) || typeof u.ok != "boolean") return E({ + if (typeof u != "object" || !u || Array.isArray(u) || typeof u.ok != "boolean") return ie({ ok: !1, error: "Invalid response structure", code: "INVALID_RESPONSE", @@ -199,11 +199,11 @@ async function le(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailu } catch (e) { console.debug?.(e); } - E(u, e); + ie(u, e); let d = Number(u?.status || e.status || 0), f = d === 429 || d === 503 || d === 504; - if (!u?.ok && f && n === "GET" && c < _ && !s?.signal?.aborted) { + if (!u?.ok && f && n === "GET" && c < g && !s?.signal?.aborted) { let e = Number(u?.retry_after); - return await ee(Number.isFinite(e) ? Math.min(y, Math.max(0, e * 1e3)) : v * (c + 1)), await o(t, s, c + 1); + return await S(Number.isFinite(e) ? Math.min(v, Math.max(0, e * 1e3)) : _ * (c + 1)), await o(t, s, c + 1); } return !r && C(n) && !T(t) && !u?.ok && (String(u?.code || "").toUpperCase() === "AUTH_REQUIRED" || Number(u?.status || 0) === 401) && await i({ force: !0, @@ -213,12 +213,12 @@ async function le(e, t, n, r, { ensureWriteAuthToken: i, normalizeWriteAuthFailu _authRetryDone: !0 }, c) : (C(n) && w(t) && !T(t) && (u = a(u)), u); } -function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureWriteAuthToken: n = async () => "", normalizeWriteAuthFailure: r = (e) => e, trackApiCall: i = null } = {}) { +function fe({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureWriteAuthToken: n = async () => "", normalizeWriteAuthFailure: r = (e) => e, trackApiCall: i = null } = {}) { async function a(o, s = {}, c = 0) { - let l = typeof performance < "u" ? performance.now() : Date.now(), u = ie(s), d = null; + let l = typeof performance < "u" ? performance.now() : Date.now(), u = oe(s), d = null; try { let i = (s.method || "GET").toUpperCase(), l = !!s?._authRetryDone, f = typeof Headers < "u" ? new Headers(s.headers || {}) : { ...s.headers }; - se(f, i, !!e()); + le(f, i, !!e()); let p = t(); if (!p && C(i) && w(o) && !T(o)) { try { @@ -228,7 +228,7 @@ function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureW } p = t(); } - ce(f, p); + ue(f, p); let m = { ...s, headers: f, @@ -239,7 +239,7 @@ function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureW } catch (e) { console.debug?.(e); } - return d = await le(await fetch(o, m), o, i, l, { + return d = await de(await fetch(o, m), o, i, l, { ensureWriteAuthToken: n, normalizeWriteAuthFailure: r, fetchAPI: a, @@ -264,9 +264,9 @@ function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureW console.debug?.(e); } let t = String(s?.method || "GET").toUpperCase(); - if ((t === "GET" || t === "HEAD") && c < _ && ne(e)) { + if ((t === "GET" || t === "HEAD") && c < g && ne(e)) { try { - await ee(v * (c + 1)); + await S(_ * (c + 1)); } catch (e) { console.debug?.(e); } @@ -294,7 +294,7 @@ function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureW } } async function o(e, t = {}) { - return oe(t?.dedupe === !1 || t?.signal ? "" : String(t?.dedupeKey || "").trim() || ae("GET", e, t), () => a(e, { + return ce(t?.dedupe === !1 || t?.signal ? "" : String(t?.dedupeKey || "").trim() || se("GET", e, t), () => a(e, { ...t, method: "GET" })); @@ -318,7 +318,7 @@ function ue({ readObsEnabled: e = () => !1, readAuthToken: t = () => "", ensureW } //#endregion //#region ui/utils/ttlCache.ts -function O({ ttlMs: e = 0, maxSize: t = 100, now: n = () => Date.now() } = {}) { +function E({ ttlMs: e = 0, maxSize: t = 100, now: n = () => Date.now() } = {}) { let r = /* @__PURE__ */ new Map(); function i() { try { @@ -406,21 +406,21 @@ function O({ ttlMs: e = 0, maxSize: t = 100, now: n = () => Date.now() } = {}) { } //#endregion //#region ui/features/panel/messages/toastHistory.ts -var de = "mjr_toast_history_v1", fe = "mjr_toast_history_last_read_v1", pe = 60, me = "mjr:toast-history-changed", k = null; -function A(e) { +var pe = "mjr_toast_history_v1", me = "mjr_toast_history_last_read_v1", he = 60, ge = "mjr:toast-history-changed", D = null; +function O(e) { return String(e || "").trim(); } -function he(e) { - let t = A(e).toLowerCase(); +function _e(e) { + let t = O(e).toLowerCase(); return t === "warn" ? "warning" : t === "danger" ? "error" : t || "info"; } -function ge(e) { +function ve(e) { let t = Number(e); return Number.isFinite(t) ? t : null; } -function _e(e) { +function ye(e) { if (!e || typeof e != "object") return null; - let t = Number(e.percent), n = Number.isFinite(t) ? Math.max(0, Math.min(100, Math.round(t))) : null, r = Number(e.current), i = Number(e.total), a = Number.isFinite(r) ? Math.max(0, Math.floor(r)) : null, o = Number.isFinite(i) ? Math.max(0, Math.floor(i)) : null, s = Number(e.indexed), c = Number(e.skipped), l = Number(e.errors), u = Number.isFinite(s) ? Math.max(0, Math.floor(s)) : null, d = Number.isFinite(c) ? Math.max(0, Math.floor(c)) : null, f = Number.isFinite(l) ? Math.max(0, Math.floor(l)) : null, p = A(e.label); + let t = Number(e.percent), n = Number.isFinite(t) ? Math.max(0, Math.min(100, Math.round(t))) : null, r = Number(e.current), i = Number(e.total), a = Number.isFinite(r) ? Math.max(0, Math.floor(r)) : null, o = Number.isFinite(i) ? Math.max(0, Math.floor(i)) : null, s = Number(e.indexed), c = Number(e.skipped), l = Number(e.errors), u = Number.isFinite(s) ? Math.max(0, Math.floor(s)) : null, d = Number.isFinite(c) ? Math.max(0, Math.floor(c)) : null, f = Number.isFinite(l) ? Math.max(0, Math.floor(l)) : null, p = O(e.label); return n === null && a === null && o === null && u === null && d === null && f === null && !p ? null : { percent: n, current: a, @@ -431,106 +431,106 @@ function _e(e) { label: p }; } -function ve(e, t, n) { +function be(e, t, n) { return e && t ? `${e}: ${t}` : t || e || n || ""; } -function j(e, t = "info", n = null) { +function k(e, t = "info", n = null) { if (!e || typeof e != "object") return null; - let r = A(e.title || e.summary), i = A(e.detail), a = A(e.message || ve(r, i, A(e.fallbackMessage))); + let r = O(e.title || e.summary), i = O(e.detail), a = O(e.message || be(r, i, O(e.fallbackMessage))); if (!a) return null; - let o = ge(e.durationMs ?? e.duration ?? n), s = Number(e.createdAt), c = Number.isFinite(s) && s > 0 ? s : Date.now(), l = typeof e.persistent == "boolean" ? e.persistent : !(Number.isFinite(o) && (o ?? 0) > 0); + let o = ve(e.durationMs ?? e.duration ?? n), s = Number(e.createdAt), c = Number.isFinite(s) && s > 0 ? s : Date.now(), l = typeof e.persistent == "boolean" ? e.persistent : !(Number.isFinite(o) && (o ?? 0) > 0); return { - id: A(e.id) || d(`th-${c}-`, 4), + id: O(e.id) || d(`th-${c}-`, 4), message: a, title: r, detail: i, - type: he(e.type || t), + type: _e(e.type || t), createdAt: c, durationMs: o, persistent: l, - source: A(e.source), - trackId: A(e.trackId), - status: A(e.status), - operation: A(e.operation), - progress: _e(e.progress), + source: O(e.source), + trackId: O(e.trackId), + status: O(e.status), + operation: O(e.operation), + progress: ye(e.progress), forceStore: !!e.forceStore, - actionLabel: A(e.actionLabel), - actionUrl: A(e.actionUrl) + actionLabel: O(e.actionLabel), + actionUrl: O(e.actionUrl) }; } -function M() { - if (k === null) try { - let e = localStorage.getItem(de), t = e ? JSON.parse(e) : []; - k = Array.isArray(t) ? t.map((e) => { - if (e && typeof e == "object") return j(e); - let t = A(e); - return t ? j({ message: t }) : null; +function A() { + if (D === null) try { + let e = localStorage.getItem(pe), t = e ? JSON.parse(e) : []; + D = Array.isArray(t) ? t.map((e) => { + if (e && typeof e == "object") return k(e); + let t = O(e); + return t ? k({ message: t }) : null; }).filter(Boolean) : []; } catch { - k = []; + D = []; } } -function ye() { - try { - localStorage.setItem(de, JSON.stringify(k)); - } catch {} -} -function be() { - try { - window.dispatchEvent(new CustomEvent(me)); - } catch {} -} function xe() { try { - return Number(localStorage.getItem(fe)) || 0; + localStorage.setItem(pe, JSON.stringify(D)); + } catch {} +} +function j() { + try { + window.dispatchEvent(new CustomEvent(ge)); + } catch {} +} +function Se() { + try { + return Number(localStorage.getItem(me)) || 0; } catch { return 0; } } -function Se(e) { +function Ce(e) { try { - localStorage.setItem(fe, String(Number(e) || 0)); + localStorage.setItem(me, String(Number(e) || 0)); } catch {} } -function Ce(e, t, n) { - M(); - let r = j(e && typeof e == "object" ? e : { - message: A(e), +function we(e, t, n) { + A(); + let r = k(e && typeof e == "object" ? e : { + message: O(e), type: t, durationMs: n }, t, n); if (!r || !r.forceStore && !r.trackId && r.type === "info" && Number.isFinite(r.durationMs) && r.durationMs != null && r.durationMs > 0 && r.durationMs < 2500) return; let i = String(r.trackId || "").trim(); if (i) { - let e = k.findIndex((e) => String(e?.trackId || "").trim() === i); + let e = D.findIndex((e) => String(e?.trackId || "").trim() === i); if (e >= 0) { - let t = k[e] || {}; - k.splice(e, 1), r.id = String(t.id || r.id || "").trim() || r.id; + let t = D[e] || {}; + D.splice(e, 1), r.id = String(t.id || r.id || "").trim() || r.id; } } - k.unshift(r), k.length > pe && (k = k.slice(0, pe)), ye(), be(); -} -function we() { - return M(), k.map((e) => ({ ...e })); + D.unshift(r), D.length > he && (D = D.slice(0, he)), xe(), j(); } function Te() { - M(); - let e = xe(); - return k.filter((t) => t.createdAt > e).length; + return A(), D.map((e) => ({ ...e })); } function Ee() { - Se(Date.now()), be(); + A(); + let e = Se(); + return D.filter((t) => t.createdAt > e).length; } function De() { - M(), k = [], ye(), Se(Date.now()), be(); + Ce(Date.now()), j(); +} +function Oe() { + A(), D = [], xe(), Ce(Date.now()), j(); } //#endregion //#region ui/app/toast.ts -function Oe(e) { +function ke(e) { let t = String(e || "info").trim().toLowerCase(); return t === "warn" ? "warning" : t === "danger" ? "error" : t === "success" || t === "warning" || t === "error" ? t : "info"; } -function ke(e) { +function M(e) { if (typeof e == "string") return e; if (e && typeof e == "object") { let t = String(e.summary || "").trim(), n = String(e.detail || e.message || "").trim(); @@ -556,12 +556,12 @@ function Ae(e, t, n, r) { actionLabel: String(i?.actionLabel || "").trim(), actionUrl: String(i?.actionUrl || "").trim() }; - return e && typeof e == "object" ? (a.title = String(i?.title || e.summary || "").trim(), a.detail = String(i?.detail || e.detail || e.message || "").trim(), a.message = ke(e), a) : (a.title = String(i?.title || "").trim(), a.detail = String(i?.detail || "").trim(), a.message = ke(e), a); + return e && typeof e == "object" ? (a.title = String(i?.title || e.summary || "").trim(), a.detail = String(i?.detail || e.detail || e.message || "").trim(), a.message = M(e), a) : (a.title = String(i?.title || "").trim(), a.detail = String(i?.detail || "").trim(), a.message = M(e), a); } function je(e, t = "info", n, r) { try { let i = Ae(e, t, n, r); - i.forceStore = !0, Ce(i, t, n ?? void 0); + i.forceStore = !0, we(i, t, n ?? void 0); } catch {} } function Me(e) { @@ -701,8 +701,8 @@ function Ne(e) { return t; } function N(e, t = "info", n, r) { - if (t = Oe(t), e = Ne(e), n ??= Me(t), !r?.noHistory) try { - Ce(Ae(e, t, n, r), t, n ?? void 0); + if (t = ke(t), e = Ne(e), n ??= Me(t), !r?.noHistory) try { + we(Ae(e, t, n, r), t, n ?? void 0); } catch {} let i = !(Number.isFinite(Number(n)) && Number(n) > 0); try { @@ -736,13 +736,13 @@ function N(e, t = "info", n, r) { } console.warn("[Majoor Toast] Native toast API unavailable", { type: t, - message: ke(e), + message: M(e), duration: i ? 0 : n }); } //#endregion //#region ui/api/clientAuth.ts -var Pe = 2e3, Fe = 15e3, Ie = 8e3, P = "token", F = null, I = null, Le = null, Re = "", L = O({ +var Pe = 2e3, Fe = 15e3, Ie = 8e3, P = "token", F = null, I = null, Le = null, Re = "", L = E({ ttlMs: Pe, maxSize: 1 }); @@ -1021,31 +1021,38 @@ async function vt(e = !1) { async function yt() { return J(l.SETTINGS_OUTPUT_DIRECTORY); } -async function bt(e, t = {}) { - let n = String(e ?? "").trim(); - return Y(l.SETTINGS_OUTPUT_DIRECTORY, { output_directory: n }, t); +async function bt() { + return J(l.SETTINGS_INPUT_DIRECTORY); } -async function xt() { - return J(l.SETTINGS_INDEX_DIRECTORY); +async function xt(e, t = {}) { + let n = String(e ?? "").trim(); + return Y(l.SETTINGS_INPUT_DIRECTORY, { input_directory: n }, t); } async function St(e, t = {}) { let n = String(e ?? "").trim(); - return Y(l.SETTINGS_INDEX_DIRECTORY, { index_directory: n }, t); + return Y(l.SETTINGS_OUTPUT_DIRECTORY, { output_directory: n }, t); } -async function Ct(e = {}) { - return J(l.SETTINGS_WORKFLOW_ROOTS, e); +async function Ct() { + return J(l.SETTINGS_INDEX_DIRECTORY); } async function wt(e, t = {}) { + let n = String(e ?? "").trim(); + return Y(l.SETTINGS_INDEX_DIRECTORY, { index_directory: n }, t); +} +async function Tt(e = {}) { + return J(l.SETTINGS_WORKFLOW_ROOTS, e); +} +async function Et(e, t = {}) { let n = Array.isArray(e) ? e.map((e) => String(e ?? "").trim()).filter(Boolean) : String(e ?? "").trim(); return Y(l.SETTINGS_WORKFLOW_ROOTS, { workflow_roots: n }, t); } -async function Tt() { +async function Dt() { return J("/mjr/am/settings/security"); } -async function Et(e) { +async function Ot(e) { return Y("/mjr/am/settings/security", e && typeof e == "object" ? e : {}); } -async function Dt() { +async function kt() { let e = await Y("/mjr/am/settings/security/bootstrap-token", {}); if (e?.ok) try { let t = String(e?.data?.token || "").trim(); @@ -1055,14 +1062,14 @@ async function Dt() { } return e; } -async function Ot(e) { +async function At(e) { if (e && typeof e == "object") { let n = String(e.filepath || e.path || e?.file_info?.filepath || "").trim(); return n ? Y("/mjr/am/open-in-folder", { filepath: n }) : Y("/mjr/am/open-in-folder", { asset_id: t(e.id) }); } return Y("/mjr/am/open-in-folder", { asset_id: t(e) }); } -async function kt(e) { +async function jt(e) { let t = ""; return t = e && typeof e == "object" ? String(e.filepath || e.path || e?.file_info?.filepath || "").trim() : String(e || "").trim(), t ? Y(l.COLLECT_FILES, { filepath: t }) : { ok: !1, @@ -1071,14 +1078,14 @@ async function kt(e) { code: "INVALID_INPUT" }; } -async function At({ op: e = "", path: t = "", name: n = "", destination: r = "", recursive: i = !0 } = {}, a = {}) { +async function Mt({ op: e = "", path: t = "", name: n = "", destination: r = "", recursive: i = !0 } = {}, a = {}) { let o = { op: String(e || "").trim().toLowerCase(), path: String(t || "").trim() }; return n != null && String(n).trim() && (o.name = String(n).trim()), r != null && String(r).trim() && (o.destination = String(r).trim()), o.op === "delete" && (o.recursive = !!i), Y(l.BROWSER_FOLDER_OP, o, a); } -async function jt(e = {}) { +async function Nt(e = {}) { let t = (e, t) => e == null ? t : !!e, n = String(e.scope || "output").trim().toLowerCase() || "output", r = e.customRootId ?? e.custom_root_id ?? e.rootId ?? e.root_id ?? e.customRoot ?? null, i = { scope: n, reindex: t(e.reindex, !0), @@ -1096,55 +1103,55 @@ async function jt(e = {}) { }; return r && (i.custom_root_id = String(r)), Y(l.INDEX_RESET, i); } -async function Mt({ scope: e = "output", customRootId: t = "" } = {}) { +async function Pt({ scope: e = "output", customRootId: t = "" } = {}) { let n = String(e || "output").trim().toLowerCase() || "output", r = String(t || "").trim(), i = { scope: n }; return r && (i.custom_root_id = r), Y(l.WATCHER_SCOPE, i); } -async function Nt(e = {}) { +async function Ft(e = {}) { return J(l.WATCHER_STATUS, e); } -async function Pt(e = !0) { +async function It(e = !0) { return Y(l.WATCHER_TOGGLE, { enabled: !!e }); } -async function Ft() { +async function Lt() { return J(l.WATCHER_SETTINGS); } -async function It(e = {}) { +async function Rt(e = {}) { return Y(l.WATCHER_SETTINGS, e); } -async function Lt(e = {}) { +async function zt(e = {}) { return J(l.TOOLS_STATUS, e); } -async function Rt(e = {}) { +async function Bt(e = {}) { return J(l.STATUS, e); } -async function zt() { +async function Vt() { return Y("/mjr/am/db/force-delete", {}); } -async function Bt(e = {}) { +async function Ht(e = {}) { return J(l.DB_BACKUPS, e); } -async function Vt() { +async function Ut() { return Y(l.DB_BACKUP_SAVE, {}); } -async function Ht({ name: e = "", useLatest: t = !1 } = {}) { +async function Wt({ name: e = "", useLatest: t = !1 } = {}) { let n = {}; return e && (n.name = String(e)), t && (n.use_latest = !0), Y(l.DB_BACKUP_RESTORE, n); } -async function Ut(e = 250) { +async function Gt(e = 250) { return Y("/mjr/am/duplicates/analyze", { limit: Math.max(10, Math.min(5e3, Number(e) || 250)) }); } -async function Wt({ scope: e = "output", customRootId: t = "", maxGroups: n = 6, maxPairs: r = 10 } = {}, i = {}) { +async function Kt({ scope: e = "output", customRootId: t = "", maxGroups: n = 6, maxPairs: r = 10 } = {}, i = {}) { let a = `/mjr/am/duplicates/alerts?scope=${encodeURIComponent(String(e || "output"))}`; return t && (a += `&custom_root_id=${encodeURIComponent(String(t))}`), a += `&max_groups=${encodeURIComponent(String(Math.max(1, Number(n) || 6)))}`, a += `&max_pairs=${encodeURIComponent(String(Math.max(1, Number(r) || 10)))}`, J(a, i); } -async function Gt(e, t = []) { +async function qt(e, t = []) { return Y("/mjr/am/duplicates/merge-tags", { keep_asset_id: Number(e) || 0, merge_asset_ids: Array.isArray(t) ? t.map((e) => Number(e) || 0).filter((e) => e > 0) : [] }); } -async function Kt(e) { +async function Jt(e) { let n, r; if (e && typeof e == "object") { n = t(e.id); @@ -1152,13 +1159,13 @@ async function Kt(e) { r = n ? { asset_id: n } : { filepath: i }; } else n = t(e), r = { asset_id: n }; let i = await Y("/mjr/am/asset/delete", r); - return i?.ok && n && Jt([n]), i; + return i?.ok && n && Xt([n]), i; } -async function qt(e) { +async function Yt(e) { let n = Array.isArray(e) ? e.map((e) => t(e)).filter(Boolean) : [], r = await Y("/mjr/am/assets/delete", { ids: n }); - return r?.ok && Jt(n), r; + return r?.ok && Xt(n), r; } -function Jt(e) { +function Xt(e) { try { let t = (Array.isArray(e) ? e : [e]).map((e) => String(e || "").trim()).filter(Boolean); if (!t.length) return; @@ -1167,7 +1174,7 @@ function Jt(e) { console.debug?.(e); } } -async function Yt(e, n) { +async function Zt(e, n) { let r; if (e && typeof e == "object") { r = t(e.id); @@ -1179,7 +1186,7 @@ async function Yt(e, n) { new_name: n }); if (a?.ok && r) try { - let e = await Pn(r); + let e = await In(r); e?.ok && e?.data && (a.data = { ...a.data || {}, asset: e.data @@ -1195,7 +1202,7 @@ async function Yt(e, n) { new_name: n }); if (i?.ok && r) try { - let e = await Pn(r); + let e = await In(r); e?.ok && e?.data && (i.data = { ...i.data || {}, asset: e.data @@ -1205,7 +1212,7 @@ async function Yt(e, n) { } return i; } -async function Xt() { +async function Qt() { let e = typeof AbortController < "u" ? new AbortController() : null, t = null; try { return e && (t = setTimeout(() => e.abort(), 1e4)), await J("/mjr/am/collections", e ? { signal: e.signal } : {}); @@ -1213,26 +1220,26 @@ async function Xt() { t && clearTimeout(t); } } -async function Zt(e) { +async function $t(e) { return Y("/mjr/am/collections", { name: String(e || "").trim() }); } -async function Qt(e) { +async function en(e) { let t = String(e || "").trim(); return Y(`/mjr/am/collections/${encodeURIComponent(t)}/delete`, {}); } -async function $t(e, t) { +async function tn(e, t) { let n = String(e || "").trim(), r = Array.isArray(t) ? t : []; return Y(`/mjr/am/collections/${encodeURIComponent(n)}/add`, { assets: r }); } -async function en(e, t) { +async function nn(e, t) { let n = String(e || "").trim(), r = Array.isArray(t) ? t : []; return Y(`/mjr/am/collections/${encodeURIComponent(n)}/remove`, { filepaths: r }); } -async function tn(e) { +async function rn(e) { let t = String(e || "").trim(); return J(`/mjr/am/collections/${encodeURIComponent(t)}/assets`); } -async function nn(e, t = 20) { +async function an(e, t = 20) { let n = String(e || "").trim(); if (!n) return { ok: !1, @@ -1256,7 +1263,7 @@ async function nn(e, t = 20) { dateExact: r?.dateExact ?? null }), J(c, { timeoutMs: 12e4 }); } -async function rn(e, t = 20) { +async function on(e, t = 20) { let n = String(e || "").trim(); if (!n) return { ok: !1, @@ -1265,24 +1272,24 @@ async function rn(e, t = 20) { let r = t && typeof t == "object" ? t : { topK: Number(t) }, i = Math.max(1, Math.min(200, Number(r?.topK ?? 20) || 20)), a = String(r?.scope || "").trim(), o = String(r?.customRootId || "").trim(), s = `${l.VECTOR_SIMILAR}/${encodeURIComponent(n)}?top_k=${i}`; return a && (s += `&scope=${encodeURIComponent(a)}`), o && (s += `&custom_root_id=${encodeURIComponent(o)}`), J(s, { dedupeKey: `vec:${n}:${i}:${a}:${o}` }); } -async function an(e) { +async function sn(e) { let t = String(e || "").trim(); return t ? J(`${l.VECTOR_ALIGNMENT}/${encodeURIComponent(t)}`) : { ok: !1, error: "Missing asset ID" }; } -async function on(e) { +async function cn(e) { let t = String(e || "").trim(); return t ? Y(`${l.VECTOR_INDEX}/${encodeURIComponent(t)}`, {}) : { ok: !1, error: "Missing asset ID" }; } -async function sn() { +async function ln() { return J(l.VECTOR_STATS); } -async function cn(e = 64, t = {}) { +async function un(e = 64, t = {}) { let n = Math.max(1, Math.min(200, e)), r = typeof t?.onProgress == "function" ? t.onProgress : null, i = String(t?.scope || "").trim().toLowerCase(), a = String(t?.customRootId ?? t?.custom_root_id ?? "").trim(), o = `${l.VECTOR_BACKFILL}?batch_size=${n}&async=1`; i && (o += `&scope=${encodeURIComponent(i)}`), a && (o += `&custom_root_id=${encodeURIComponent(a)}`); let s = await Y(o, {}, { timeoutMs: 3e4 }); @@ -1298,16 +1305,16 @@ async function cn(e = 64, t = {}) { "running", "pending" ].includes(u)) return s; - let f = Number(t?.pollIntervalMs), p = Number(t?.pollTimeoutMs), m = Number.isFinite(f) ? Math.max(500, Math.min(1e4, Math.floor(f))) : gn, h = Number.isFinite(p) ? Math.max(1e4, Math.min(vn, Math.floor(p))) : _n, g = Date.now(), _ = null; - for (; Date.now() - g < h;) { - await ee(m); + let f = Number(t?.pollIntervalMs), p = Number(t?.pollTimeoutMs), m = Number.isFinite(f) ? Math.max(500, Math.min(1e4, Math.floor(f))) : vn, h = Number.isFinite(p) ? Math.max(1e4, Math.min(bn, Math.floor(p))) : yn, ee = Date.now(), g = null; + for (; Date.now() - ee < h;) { + await S(m); let e = await J(`${l.VECTOR_BACKFILL_STATUS}?backfill_id=${encodeURIComponent(d)}`, { timeoutMs: 3e4 }); if (!e?.ok) { - _ = e; + g = e; continue; } let t = e?.data || {}, n = String(t?.status || "").toLowerCase(); - _ = e; + g = e; try { r?.(t); } catch (e) { @@ -1327,14 +1334,14 @@ async function cn(e = 64, t = {}) { status: 500 }; } - let v = await J(`${l.VECTOR_BACKFILL_STATUS}?backfill_id=${encodeURIComponent(d)}`, { timeoutMs: 3e4 }), y = v?.data || _?.data || {}, b = String(y?.status || "").toLowerCase(); - if (v?.ok && [ + let _ = await J(`${l.VECTOR_BACKFILL_STATUS}?backfill_id=${encodeURIComponent(d)}`, { timeoutMs: 3e4 }), v = _?.data || g?.data || {}, y = String(v?.status || "").toLowerCase(); + if (_?.ok && [ "queued", "running", "pending" - ].includes(b)) { + ].includes(y)) { try { - r?.(y); + r?.(v); } catch (e) { console.debug?.(e); } @@ -1343,45 +1350,45 @@ async function cn(e = 64, t = {}) { code: "PENDING", status: 202, data: { - ...y, + ...v, pending: !0, timed_out: !0, poll_timeout_ms: h, - backfill_id: String(y?.backfill_id || d), - status: b || "running" + backfill_id: String(v?.backfill_id || d), + status: y || "running" }, meta: { pending: !0 } }; } - return v?.ok && b === "failed" ? { + return _?.ok && y === "failed" ? { ok: !1, - error: String(y?.error || "Vector backfill failed"), - code: String(y?.code || "DB_ERROR"), - data: y, + error: String(v?.error || "Vector backfill failed"), + code: String(v?.code || "DB_ERROR"), + data: v, status: 500 } : { ok: !1, error: `Vector backfill polling timed out after ${h}ms`, code: "TIMEOUT", - data: y || null, + data: v || null, status: 408 }; } -async function ln(e) { +async function dn(e) { let t = String(e || "").trim(); return t ? Y(`${l.VECTOR_CAPTION}/${encodeURIComponent(t)}`, {}) : { ok: !1, error: "Missing asset ID" }; } -async function un(e, { topK: t = 50, scope: n = "output", customRootId: r = "", subfolder: i = null, kind: a = null, hasWorkflow: o = null, minRating: c = null, minSizeMB: u = null, maxSizeMB: d = null, minWidth: f = null, minHeight: p = null, maxWidth: m = null, maxHeight: h = null, workflowType: g = null, workflowId: _ = null, dateRange: v = null, dateExact: y = null } = {}) { - let b = String(e || "").trim(); - if (!b) return { +async function fn(e, { topK: t = 50, scope: n = "output", customRootId: r = "", subfolder: i = null, kind: a = null, hasWorkflow: o = null, minRating: c = null, minSizeMB: u = null, maxSizeMB: d = null, minWidth: f = null, minHeight: p = null, maxWidth: m = null, maxHeight: h = null, workflowType: ee = null, workflowId: g = null, dateRange: _ = null, dateExact: v = null } = {}) { + let y = String(e || "").trim(); + if (!y) return { ok: !1, error: "Empty query" }; - let x = `${l.HYBRID_SEARCH}?q=${encodeURIComponent(b)}&top_k=${Math.max(1, Math.min(200, t))}&scope=${encodeURIComponent(n)}`; - return r && (x += `&custom_root_id=${encodeURIComponent(r)}`), x = s(x, { + let b = `${l.HYBRID_SEARCH}?q=${encodeURIComponent(y)}&top_k=${Math.max(1, Math.min(200, t))}&scope=${encodeURIComponent(n)}`; + return r && (b += `&custom_root_id=${encodeURIComponent(r)}`), b = s(b, { subfolder: i, kind: a, hasWorkflow: o, @@ -1392,92 +1399,92 @@ async function un(e, { topK: t = 50, scope: n = "output", customRootId: r = "", minHeight: p, maxWidth: m, maxHeight: h, - workflowType: g, - workflowId: _, - dateRange: v, - dateExact: y - }), J(x, { timeoutMs: 12e4 }); + workflowType: ee, + workflowId: g, + dateRange: _, + dateExact: v + }), J(b, { timeoutMs: 12e4 }); } -async function dn(e = 8) { +async function pn(e = 8) { return Y(l.VECTOR_SUGGEST_COLLECTIONS, { k: Math.max(2, Math.min(20, e)) }); } //#endregion //#region ui/api/client.ts -var fn = 3e4, pn = "__MJR_API_CLIENT__", mn = 2e3, hn = 200, gn = 1e3, _n = 18e5, vn = 432e5, H = "settings", yn = "available-tags", U = O({ - ttlMs: mn, +var mn = 3e4, hn = "__MJR_API_CLIENT__", gn = 2e3, _n = 200, vn = 1e3, yn = 18e5, bn = 432e5, H = "settings", xn = "available-tags", U = E({ + ttlMs: gn, maxSize: 1 -}), W = O({ - ttlMs: mn, +}), W = E({ + ttlMs: gn, maxSize: 1 -}), G = O({ - ttlMs: () => Cn(), +}), G = E({ + ttlMs: () => Tn(), maxSize: 1 -}), bn = /* @__PURE__ */ new Set([ +}), Sn = /* @__PURE__ */ new Set([ "1", "true", "yes", "on" -]), xn = /* @__PURE__ */ new Set([ +]), Cn = /* @__PURE__ */ new Set([ "0", "false", "no", "off" ]); -function Sn(e, t = !1) { +function wn(e, t = !1) { if (typeof e == "boolean") return e; if (typeof e == "number") return e !== 0; if (typeof e == "string") { let t = e.trim().toLowerCase(); - if (bn.has(t)) return !0; - if (xn.has(t)) return !1; + if (Sn.has(t)) return !0; + if (Cn.has(t)) return !1; } return !!t; } -function Cn() { +function Tn() { try { let e = localStorage?.getItem?.("mjrSettings") || "{}", t = JSON.parse(e), n = t?.cache?.tagsTTLms ?? t?.cache?.tagsTTL ?? t?.cache?.tags_ttl_ms ?? null, r = Number(n); - return Number.isFinite(r) ? Math.max(1e3, Math.min(6e5, Math.floor(r))) : fn; + return Number.isFinite(r) ? Math.max(1e3, Math.min(6e5, Math.floor(r))) : mn; } catch { - return fn; + return mn; } } -function wn() { +function En() { U.clear(); } -function Tn() { +function Dn() { W.clear(); } function K() { G.clear(); } -function En(e) { +function On(e) { return String(e ?? "").trim().toLowerCase() || ""; } -function Dn(e) { +function kn(e) { let t = [], n = /* @__PURE__ */ new Set(); for (let r of Array.isArray(e) ? e : []) { let e = String(r ?? "").trim(); if (!e) continue; - let i = En(e); - !i || n.has(i) || (n.add(i), t.push(e)); + let i = On(e); + i && !n.has(i) && (n.add(i), t.push(e)); } return t; } try { let e = typeof window < "u" ? window : null; - e && !e[pn] && (e[pn] = { initialized: !0 }, e.addEventListener?.("storage", (e) => { + e && !e[hn] && (e[hn] = { initialized: !0 }, e.addEventListener?.("storage", (e) => { try { - e?.key === "mjrSettings" && (wn(), Tn(), K(), Ze()); + e?.key === "mjrSettings" && (En(), Dn(), K(), Ze()); } catch (e) { console.debug?.(e); } }), e.addEventListener?.("mjr-settings-changed", () => { - wn(), Tn(), K(), Ze(); + En(), Dn(), K(), Ze(); })); } catch (e) { console.debug?.(e); } -var On = () => { +var An = () => { let e = U.get(H); if (e !== void 0) return e; let t = Date.now(); @@ -1489,33 +1496,33 @@ var On = () => { } catch { return U.set(H, !1, { at: t }), !1; } -}, kn = () => { +}, jn = () => { let e = W.get(H); if (e !== void 0) return e; let t = Date.now(); try { let e = localStorage?.getItem?.(f); if (!e) return W.set(H, !0, { at: t }), !0; - let n = JSON.parse(e)?.ratingTagsSync?.enabled, r = n == null || Sn(n, !0); + let n = JSON.parse(e)?.ratingTagsSync?.enabled, r = n == null || wn(n, !0); return W.set(H, r, { at: t }), r; } catch { return W.set(H, !0, { at: t }), !0; } -}, q = ue({ - readObsEnabled: On, +}, q = fe({ + readObsEnabled: An, readAuthToken: z, ensureWriteAuthToken: Xe, normalizeWriteAuthFailure: Je -}), An = q.fetchAPI; +}), Mn = q.fetchAPI; async function J(e, t = {}) { return q.get(e, t); } async function Y(e, t, n = {}) { return q.post(e, t, n); } -async function jn(n, r, i = {}) { - let a = kn(), o = n && typeof n == "object" ? n : null, s = o ? o.id : n, c = t(s), l = { rating: Math.max(0, Math.min(5, Number(r) || 0)) }; - return c ? l.asset_id = c : o && (l.filepath = o.filepath || o.path || o?.file_info?.filepath || "", l.type = o.type || "output", l.root_id = e(o)), An("/mjr/am/asset/rating", { +async function Nn(n, r, i = {}) { + let a = jn(), o = n && typeof n == "object" ? n : null, s = o ? o.id : n, c = t(s), l = { rating: Math.max(0, Math.min(5, Number(r) || 0)) }; + return c ? l.asset_id = c : o && (l.filepath = o.filepath || o.path || o?.file_info?.filepath || "", l.type = o.type || "output", l.root_id = e(o)), Mn("/mjr/am/asset/rating", { ...i, method: "POST", headers: { @@ -1525,10 +1532,10 @@ async function jn(n, r, i = {}) { body: JSON.stringify(l) }); } -async function Mn(n, r, i = {}) { - let a = kn(), o = n && typeof n == "object" ? n : null, s = o ? o.id : n, c = t(s), u = String(o?.kind || o?.type || "").trim().toLowerCase() === "workflow", d = String(o?.filepath || o?.path || o?.file_info?.filepath || "").trim(), f = { tags: Array.isArray(r) ? r : [] }; +async function Pn(n, r, i = {}) { + let a = jn(), o = n && typeof n == "object" ? n : null, s = o ? o.id : n, c = t(s), u = String(o?.kind || o?.type || "").trim().toLowerCase() === "workflow", d = String(o?.filepath || o?.path || o?.file_info?.filepath || "").trim(), f = { tags: Array.isArray(r) ? r : [] }; u && d ? f.filepath = d : c ? f.asset_id = c : o && (f.filepath = o.filepath || o.path || o?.file_info?.filepath || "", f.type = o.type || "output", f.root_id = e(o)); - let p = await An(u && d ? l.WORKFLOWS_TAGS : "/mjr/am/asset/tags", { + let p = await Mn(u && d ? l.WORKFLOWS_TAGS : "/mjr/am/asset/tags", { ...i, method: "POST", headers: { @@ -1539,8 +1546,8 @@ async function Mn(n, r, i = {}) { }); return p?.ok && K(), p; } -async function Nn() { - let e = G.get(yn); +async function Fn() { + let e = G.get(xn); if (Array.isArray(e)) return { ok: !0, data: e, @@ -1550,22 +1557,22 @@ async function Nn() { }; let t = await J("/mjr/am/tags"); if (t?.ok && Array.isArray(t.data)) { - let e = Dn(t.data); - return G.set(yn, e), { + let e = kn(t.data); + return G.set(xn, e), { ...t, data: e }; } return t; } -async function Pn(e, n = {}) { +async function In(e, n = {}) { let r = encodeURIComponent(t(e)); return J(`/mjr/am/asset/${r}`, { ...n, dedupeKey: n?.dedupeKey || `meta:${r}` }); } -async function Fn(e, n = {}) { +async function Ln(e, n = {}) { let r = t(e); if (!r) return { ok: !1, @@ -1578,11 +1585,11 @@ async function Fn(e, n = {}) { let { refresh: a, ...o } = n; return J(i, o); } -async function In(e, t = {}) { +async function Rn(e, t = {}) { let n = Array.isArray(e) ? e : [], r = []; for (let e of n) { let t = Number(e); - if (Number.isFinite(t) && (r.push(Math.trunc(t)), r.length >= hn)) break; + if (Number.isFinite(t) && (r.push(Math.trunc(t)), r.length >= _n)) break; } return r.length ? Y("/mjr/am/assets/batch", { asset_ids: r }, t) : { ok: !0, @@ -1591,7 +1598,7 @@ async function In(e, t = {}) { code: "OK" }; } -async function Ln(e, t = {}) { +async function zn(e, t = {}) { let n = i(e); return n ? J(n, t) : { ok: !1, @@ -1600,7 +1607,7 @@ async function Ln(e, t = {}) { code: "INVALID_INPUT" }; } -async function Rn(e, t = {}) { +async function Bn(e, t = {}) { let r = n(e); return r ? J(r, t) : { ok: !1, @@ -1609,7 +1616,7 @@ async function Rn(e, t = {}) { code: "INVALID_INPUT" }; } -async function zn(e, t = {}) { +async function Vn(e, t = {}) { let n = u(e); return n ? J(n, t) : { ok: !1, @@ -1618,7 +1625,7 @@ async function zn(e, t = {}) { code: "INVALID_INPUT" }; } -async function Bn(e, t = "", n = {}) { +async function Hn(e, t = "", n = {}) { let i = r(e, t); return i ? J(i, n) : { ok: !1, @@ -1627,7 +1634,7 @@ async function Bn(e, t = "", n = {}) { code: "INVALID_INPUT" }; } -async function Vn({ workflow: e = null, name: t = "", category: n = "", overwrite: r = !1, filepath: i = "", task: a = "", model_family: o = "", provider: s = "", runs_on: c = "", notes: u = "" } = {}, d = {}) { +async function Un({ workflow: e = null, name: t = "", category: n = "", overwrite: r = !1, filepath: i = "", task: a = "", model_family: o = "", provider: s = "", runs_on: c = "", notes: u = "" } = {}, d = {}) { return Y(l.WORKFLOWS_SAVE, { workflow: e, name: t, @@ -1641,32 +1648,32 @@ async function Vn({ workflow: e = null, name: t = "", category: n = "", overwrit notes: u }, d); } -async function Hn({ filepath: e = "", name: t = "" } = {}, n = {}) { +async function Wn({ filepath: e = "", name: t = "" } = {}, n = {}) { return Y(l.WORKFLOWS_DUPLICATE, { filepath: e, name: t }, n); } -async function Un({ filepath: e = "", name: t = "", category: n = "" } = {}, r = {}) { +async function Gn({ filepath: e = "", name: t = "", category: n = "" } = {}, r = {}) { return Y(l.WORKFLOWS_MOVE, { filepath: e, name: t, category: n }, r); } -async function Wn({ filepath: e = "" } = {}, t = {}) { +async function Kn({ filepath: e = "" } = {}, t = {}) { return Y(l.WORKFLOWS_DELETE, { filepath: e }, t); } -async function Gn({ filepath: e = "" } = {}, t = {}) { +async function qn({ filepath: e = "" } = {}, t = {}) { return Y(l.WORKFLOWS_MARK_LOADED, { filepath: e }, t); } -async function Kn({ filepath: e = "", favorite: t = !1 } = {}, n = {}) { +async function Jn({ filepath: e = "", favorite: t = !1 } = {}, n = {}) { return Y(l.WORKFLOWS_FAVORITE, { filepath: e, favorite: !!t }, n); } -async function qn({ filepath: e = "", task: t = "", model_family: n = "", provider: r = "", runs_on: i = "", notes: a = "" } = {}, o = {}) { +async function Yn({ filepath: e = "", task: t = "", model_family: n = "", provider: r = "", runs_on: i = "", notes: a = "" } = {}, o = {}) { return Y(l.WORKFLOWS_INFO, { filepath: e, task: t, @@ -1676,24 +1683,24 @@ async function qn({ filepath: e = "", task: t = "", model_family: n = "", provid notes: a }, o); } -async function Jn({ filepath: e = "", limit: t = 12 } = {}, n = {}) { +async function Xn({ filepath: e = "", limit: t = 12 } = {}, n = {}) { let r = Math.max(1, Math.min(50, Number(t) || 12)); return J(`${l.WORKFLOWS_THUMBNAIL_CANDIDATES}?filepath=${encodeURIComponent(String(e || "").trim())}&limit=${encodeURIComponent(String(r))}`, n); } -async function Yn(e = {}) { +async function Zn(e = {}) { return J(l.WORKFLOWS_MODEL_FAMILIES, e); } -async function Xn({ q: e = "*", limit: t = 100, offset: n = 0, sort: r = "mtime" } = {}, i = {}) { +async function Qn({ q: e = "*", limit: t = 100, offset: n = 0, sort: r = "mtime" } = {}, i = {}) { let a = Math.max(1, Math.min(500, Number(t) || 100)), o = Math.max(0, Number(n) || 0); return J(`${l.LIST}?scope=workflow&q=${encodeURIComponent(String(e || "*"))}&limit=${encodeURIComponent(String(a))}&offset=${encodeURIComponent(String(o))}&sort=${encodeURIComponent(String(r || "mtime"))}`, i); } -async function Zn({ filepath: e = "", source_filepath: t = "" } = {}, n = {}) { +async function $n({ filepath: e = "", source_filepath: t = "" } = {}, n = {}) { return Y(l.WORKFLOWS_THUMBNAIL_SET, { filepath: e, source_filepath: t }, n); } -async function Qn({ type: e = "output", filename: t = "", subfolder: n = "", root_id: r = "", rootId: i = "", filepath: a = "" } = {}, o = {}) { +async function er({ type: e = "output", filename: t = "", subfolder: n = "", root_id: r = "", rootId: i = "", filepath: a = "" } = {}, o = {}) { let s = String(e || "output").trim().toLowerCase() || "output", c = String(t || "").trim(), l = String(n || "").trim(), u = String(r || i || "").trim(), d = String(a || "").trim(); if (!c) return { ok: !1, @@ -1704,7 +1711,7 @@ async function Qn({ type: e = "output", filename: t = "", subfolder: n = "", roo let f = `/mjr/am/metadata?type=${encodeURIComponent(s)}&filename=${encodeURIComponent(c)}`; return d && (f += `&filepath=${encodeURIComponent(d)}`), l && (f += `&subfolder=${encodeURIComponent(l)}`), u && (f += `&root_id=${encodeURIComponent(u)}`), J(f, o); } -async function $n({ filepath: e = "", root_id: t = "", subfolder: n = "" } = {}, r = {}) { +async function tr({ filepath: e = "", root_id: t = "", subfolder: n = "" } = {}, r = {}) { try { if (globalThis.__mjrFolderInfoSupported === !1) return { ok: !1, @@ -1739,12 +1746,12 @@ async function $n({ filepath: e = "", root_id: t = "", subfolder: n = "" } = {}, } //#endregion //#region ui/utils/logging.ts -function er(e, ...t) { +function nr(e, ...t) { try { c.DEBUG_VERBOSE_ERRORS && console.debug(e, ...t); } catch {} } -function tr(e, t = "Majoor", { showToast: n = !1, toastType: r = "error" } = {}) { +function rr(e, t = "Majoor", { showToast: n = !1, toastType: r = "error" } = {}) { let i = e?.message || String(e || "Unknown error"); try { c.DEBUG_VERBOSE_ERRORS ? console.error(`[Majoor][${t}]`, i, e) : console.debug(`[Majoor][${t}]`, i); @@ -1764,48 +1771,48 @@ var X = { scope: null, ratingHotkeysActive: !1 }; -function nr() { +function ir() { return X; } -function rr(e) { +function ar(e) { X.scope = e == null ? null : String(e); } -function ir() { +function or() { return !!X.suspended; } -function ar(e) { +function sr(e) { X.ratingHotkeysActive = !!e; } //#endregion //#region ui/features/viewer/viewerRuntimeHosts.ts -var Z = null, Q = null, or = ".mjr-viewer-overlay", sr = ".mjr-mfv"; -function cr(e) { +var Z = null, Q = null, cr = ".mjr-viewer-overlay", lr = ".mjr-mfv"; +function ur(e) { return !!e && typeof e.appendChild == "function"; } -function lr() { +function dr() { return typeof document > "u" ? null : document?.body || null; } -function ur() { +function fr() { return typeof document > "u" ? null : document?.body || document?.documentElement || null; } -function dr(e) { - return cr(e) ? e === lr() || typeof e?.isConnected != "boolean" || e.isConnected : !1; +function pr(e) { + return ur(e) ? e === dr() || typeof e?.isConnected != "boolean" || e.isConnected : !1; } -function fr(e) { - return cr(e) ? e : null; +function mr(e) { + return ur(e) ? e : null; } function $(e) { - return dr(e) ? e : lr(); + return pr(e) ? e : dr(); } -function pr(e) { - let t = ur(); - return dr(t) ? t : $(e); +function hr(e) { + let t = fr(); + return pr(t) ? t : $(e); } -function mr(e, t, n = $) { +function gr(e, t, n = $) { let r = [], i = /* @__PURE__ */ new Set(); for (let a of [ n(t), - lr(), + dr(), t ]) { if (!a || i.has(a)) continue; @@ -1816,33 +1823,33 @@ function mr(e, t, n = $) { } catch (e) { console.debug?.(e); } - for (let e of t) !e || r.includes(e) || r.push(e); + for (let e of t) e && !r.includes(e) && r.push(e); } return r; } -function hr(e, t, n = $) { +function _r(e, t, n = $) { let r = n(t); if (!r) return; - let i = mr(e, t, n); + let i = gr(e, t, n); for (let e of i) if (e && e.parentNode !== r) try { r.appendChild(e); } catch (e) { console.debug?.(e); } } -function gr(e) { - return Z = fr(e), hr(or, Z), () => _r(e); -} -function _r(e) { - (!e || Z === e) && (Z = null); -} function vr(e) { - return Q = fr(e), hr(sr, Q, pr), () => yr(e); + return Z = mr(e), _r(cr, Z), () => yr(e); } function yr(e) { - (!e || Q === e) && (Q = null); + (!e || Z === e) && (Z = null); } function br(e) { + return Q = mr(e), _r(lr, Q, hr), () => xr(e); +} +function xr(e) { + (!e || Q === e) && (Q = null); +} +function Sr(e) { let t = $(Z); try { t?.appendChild?.(e); @@ -1851,8 +1858,8 @@ function br(e) { } return t; } -function xr(e) { - let t = pr(Q); +function Cr(e) { + let t = hr(Q); try { t?.appendChild?.(e); } catch (e) { @@ -1860,8 +1867,8 @@ function xr(e) { } return t; } -function Sr() { - return mr(or, Z); +function wr() { + return gr(cr, Z); } //#endregion -export { ht as $, me as $t, Vn as A, Qe as At, kt as B, It as Bt, Yn as C, at as Ct, Gn as D, gt as Dt, Xn as E, vt as Et, Mn as F, Mt as Ft, zt as G, on as Gt, Kt as H, rn as Ht, Rn as I, wt as It, Wt as J, dn as Jt, lt as K, nn as Kt, $t as L, Ut as Lt, qn as M, Et as Mt, Zn as N, mt as Nt, Un as O, et as Ot, jn as P, nt as Pt, _t as Q, je as Qt, Dt as R, Pt as Rt, Ln as S, ot as St, zn as T, St as Tt, qt as U, ln as Ut, Zt as V, cn as Vt, Qt as W, an as Wt, st as X, Ue as Xt, it as Y, We as Yt, xt as Z, N as Zt, In as _, Yt as _t, gr as a, p as an, pt as at, $n as b, Vt as bt, rr as c, Ft as ct, tr as d, un as dt, De as en, $e as et, Wn as f, Xt as ft, Pn as g, en as gt, J as h, Ot as ht, vr as i, O as in, Tt as it, Kn as j, ft as jt, Y as k, bt as kt, ar as l, Nt as lt, Hn as m, Gt as mt, br as n, we as nn, dt as nt, nr as o, f as on, Lt as ot, Bn as p, Bt as pt, tn as q, sn as qt, Sr as r, Ee as rn, Rt as rt, ir as s, tt as st, xr as t, Te as tn, yt as tt, er as u, Ct as ut, Nn as v, jt as vt, Jn as w, ct as wt, Fn as x, ut as xt, Qn as y, Ht as yt, At as z, rt as zt }; +export { _t as $, N as $t, Un as A, et as At, jt as B, It as Bt, Zn as C, ot as Ct, qn as D, xt as Dt, Qn as E, wt as Et, Pn as F, mt as Ft, Vt as G, dn as Gt, Jt as H, Rt as Ht, Bn as I, nt as It, Kt as J, an as Jt, lt as K, sn as Kt, tn as L, Pt as Lt, Yn as M, Qe as Mt, $n as N, ft as Nt, Gn as O, vt as Ot, Nn as P, Ot as Pt, bt as Q, Ue as Qt, kt as R, Et as Rt, zn as S, ut as St, Vn as T, ct as Tt, Yt as U, un as Ut, $t as V, rt as Vt, en as W, on as Wt, st as X, pn as Xt, it as Y, ln as Yt, Ct as Z, We as Zt, Rn as _, nn as _t, vr as a, De as an, Dt as at, tr as b, Wt as bt, ar as c, f as cn, tt as ct, rr as d, Tt as dt, je as en, ht as et, Kn as f, fn as ft, In as g, At as gt, J as h, qt as ht, br as i, Te as in, Bt as it, Jn as j, St as jt, Y as k, gt as kt, sr as l, Lt as lt, Wn as m, Ht as mt, Sr as n, Oe as nn, yt as nt, ir as o, E as on, pt as ot, Hn as p, Qt as pt, rn as q, cn as qt, wr as r, Ee as rn, dt as rt, or as s, p as sn, zt as st, Cr as t, ge as tn, $e as tt, nr as u, Ft as ut, Fn as v, Zt as vt, Xn as w, at as wt, Ln as x, Ut as xt, er as y, Nt as yt, Mt as z, Gt as zt }; diff --git a/dist/entry.js b/dist/entry.js index a2aa66cb..e9bcbce0 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -1,13 +1,13 @@ -import { $t as e, A as t, B as n, C as r, D as i, E as a, Ft as o, G as s, Gt as c, H as l, Ht as u, It as d, J as f, Jt as p, Kt as m, L as h, Lt as g, M as _, N as v, O as y, P as b, Qt as x, Rt as S, S as C, Tt as w, U as T, V as E, Vt as D, W as O, Zt as k, _ as A, _t as j, b as M, bt as N, c as P, d as F, dt as ee, en as te, f as I, ft as ne, g as re, gt as ie, h as ae, ht as oe, in as se, j as ce, k as le, kt as ue, l as de, lt as fe, m as pe, mt as me, nn as he, o as ge, ot as _e, pt as ve, q as ye, qt as be, rn as xe, s as Se, tn as Ce, u as we, vt as Te, w as Ee, y as De, yt as Oe, z as ke, zt as Ae } from "./chunks/viewerRuntimeHosts-DyiuTSfr.js"; -import { $ as je, A as Me, Ct as Ne, F as Pe, G as Fe, H as Ie, K as Le, L as Re, Q as ze, St as Be, U as Ve, W as He, X as Ue, Z as We, _ as Ge, at as Ke, bt as qe, ct as Je, dt as Ye, et as Xe, ft as Ze, g as Qe, it as $e, j as et, lt as tt, m as L, n as R, o as z, ot as nt, pt as rt, q as it, r as B, rt as at, st as ot, t as st, tt as ct, ut as lt, xt as ut, yt as dt } from "./chunks/events-DrYpMD-I.js"; -import { a as ft, i as pt, n as mt, t as ht } from "./chunks/graphTraversal-BIYmTTPW.js"; -import { A as gt, B as _t, C as vt, D as yt, E as bt, F as xt, G as St, H as Ct, I as wt, J as Tt, L as Et, M as Dt, N as Ot, O as kt, P as At, R as jt, S as Mt, T as Nt, U as Pt, V as Ft, W as It, Y as Lt, _ as Rt, b as zt, d as Bt, g as Vt, j as Ht, k as Ut, q as Wt, v as Gt, x as Kt, y as qt, z as Jt } from "./chunks/Viewer-DXsFcJRb.js"; -import { $ as Yt, A as Xt, B as Zt, C as Qt, D as $t, E as en, F as tn, G as nn, H as rn, I as an, J as on, K as sn, L as cn, M as ln, N as un, O as dn, P as fn, Q as pn, R as mn, T as hn, U as gn, V as _n, W as vn, X as yn, Y as bn, Z as xn, _ as Sn, a as Cn, c as wn, d as Tn, et as En, f as Dn, g as On, h as kn, i as An, j as jn, k as Mn, l as Nn, m as Pn, n as Fn, o as In, p as Ln, q as Rn, s as zn, t as Bn, u as Vn, w as Hn, z as Un } from "./chunks/SidebarWorkflowSection-BEJKYrrz.js"; -import { _ as Wn, i as Gn, n as Kn, p as qn, t as Jn } from "./chunks/openMajoorSettings-CjYabCh7.js"; -import { a as Yn, c as Xn, l as Zn, o as Qn, s as $n, u as er } from "./chunks/floatingViewerManager-Crq2oCKD.js"; -import { A as tr, B as nr, C as V, D as rr, E as H, G as ir, H as ar, I as or, J as U, K as sr, L as cr, M as lr, N as ur, O as W, P as dr, R as fr, S as pr, T as G, U as mr, V as K, W as hr, Y as gr, at as _r, b as vr, ct as yr, dt as br, ft as q, it as xr, j as J, k as Y, lt as X, nt as Sr, q as Cr, rt as Z, tt as wr, ut as Q, v as Tr, w as Er, x as Dr, y as Or, z as kr } from "./chunks/mjr-primevue-BlSRoWcG.js"; -import { n as Ar, r as jr } from "./chunks/mjr-vue-vendor-Bb2CVJXl.js"; -import { t as Mr } from "./chunks/TagsEditor-BiRWztXF.js"; +import { $t as e, A as t, B as n, Bt as r, C as i, D as a, E as o, Et as s, G as c, H as l, J as u, Jt as d, L as f, Lt as p, M as m, N as h, O as g, P as _, Rt as v, S as y, U as b, Ut as x, V as S, Vt as C, W as w, Wt as T, Xt as E, Yt as D, _ as O, _t as k, an as A, b as j, bt as M, c as N, d as P, en as ee, f as te, ft as F, g as I, gt as ne, h as re, ht as ie, in as ae, j as oe, jt as se, k as L, l as ce, m as le, mt as ue, nn as de, o as fe, on as pe, pt as me, q as he, qt as ge, rn as _e, s as ve, st as ye, tn as be, u as xe, ut as Se, vt as Ce, w as we, xt as Te, y as Ee, yt as De, z as Oe, zt as ke } from "./chunks/viewerRuntimeHosts-BBd8uK6j.js"; +import { $ as Ae, A as je, Ct as Me, F as Ne, G as Pe, H as Fe, K as Ie, L as Le, Q as Re, St as ze, U as Be, W as Ve, X as He, Z as Ue, _ as We, at as Ge, bt as Ke, ct as qe, dt as Je, et as Ye, ft as Xe, g as Ze, it as Qe, j as $e, lt as et, m as R, n as z, o as B, ot as tt, pt as nt, q as rt, r as V, rt as it, st as at, t as ot, tt as st, ut as ct, xt as lt, yt as ut } from "./chunks/events-CoI83paj.js"; +import { a as dt, i as ft, n as pt, t as mt } from "./chunks/graphTraversal-C94Q5bJN.js"; +import { A as ht, B as gt, C as _t, D as vt, E as yt, F as bt, G as xt, H as St, I as Ct, J as wt, L as Tt, M as Et, N as Dt, O as Ot, P as kt, R as At, S as jt, T as Mt, U as Nt, V as Pt, W as Ft, Y as It, _ as Lt, b as Rt, d as zt, g as Bt, j as Vt, k as Ht, q as Ut, v as Wt, x as Gt, y as Kt, z as qt } from "./chunks/Viewer-DWgaGos-.js"; +import { $ as Jt, A as Yt, B as Xt, C as Zt, D as Qt, E as $t, F as en, G as tn, H as nn, I as rn, J as an, K as on, L as sn, M as cn, N as ln, O as un, P as dn, Q as fn, R as pn, T as mn, U as hn, V as gn, W as _n, X as vn, Y as yn, Z as bn, _ as xn, a as Sn, c as Cn, d as wn, et as Tn, f as En, g as Dn, h as On, i as kn, j as An, k as jn, l as Mn, m as Nn, n as Pn, o as Fn, p as In, q as Ln, s as Rn, t as zn, u as Bn, w as Vn, z as Hn } from "./chunks/SidebarWorkflowSection-DpoPGJrq.js"; +import { _ as Un, i as Wn, n as Gn, p as Kn, t as qn } from "./chunks/openMajoorSettings-CxqtW_yN.js"; +import { a as Jn, c as Yn, l as Xn, o as Zn, s as Qn, u as $n } from "./chunks/floatingViewerManager-XH4AFW4G.js"; +import { A as er, B as tr, C as H, D as nr, E as U, G as rr, H as ir, I as ar, J as W, K as or, L as sr, M as cr, N as lr, O as G, P as ur, R as dr, S as fr, T as K, U as pr, V as q, W as mr, Y as hr, at as gr, b as _r, ct as vr, dt as yr, ft as J, it as br, j as Y, k as X, lt as Z, nt as xr, q as Sr, rt as Q, tt as Cr, ut as wr, v as Tr, w as Er, x as Dr, y as Or, z as kr } from "./chunks/mjr-primevue-BOf2ACk_.js"; +import { n as Ar, r as jr } from "./chunks/mjr-vue-vendor-BKZZuiuB.js"; +import { t as Mr } from "./chunks/TagsEditor-BXjsZ3IO.js"; import { app as Nr } from "../../scripts/app.js"; function Pr(e = null) { return null; @@ -16,7 +16,7 @@ function Fr() { return null; } try { - typeof window < "u" && ct && ct.LIST; + typeof window < "u" && st && st.LIST; } catch {} //#endregion //#region ui/integration/comfy_send_to_am.ts @@ -63,9 +63,9 @@ function Br(e) { return t; } async function Vr(e) { - let t = et(), n = Me(t); + let t = $e(), n = je(t); if (!e.length) { - it({ + rt({ severity: "warn", summary: "Majoor Assets Manager", detail: "No output to send (run the node first).", @@ -74,7 +74,7 @@ async function Vr(e) { return; } if (!n || typeof n.fetchApi != "function") { - it({ + rt({ severity: "error", summary: "Majoor Assets Manager", detail: "ComfyUI API unavailable.", @@ -89,14 +89,14 @@ async function Vr(e) { body: JSON.stringify({ items: e }) }); if (!r.ok && r.status !== 404) throw Error(`HTTP ${r.status}`); - Ge(t, "majoor-assets"), it({ + We(t, "majoor-assets"), rt({ severity: "success", summary: "Majoor Assets Manager", detail: `Sent ${e.length} item(s) to the asset grid.`, life: 2500 }); } catch (e) { - it({ + rt({ severity: "error", summary: "Majoor Assets Manager", detail: `Failed to send: ${e?.message || e}`, @@ -105,7 +105,7 @@ async function Vr(e) { } } function Hr() { - let e = et(); + let e = $e(); if (!e || typeof e.registerExtension != "function") { setTimeout(Hr, 100); return; @@ -185,7 +185,7 @@ function Xr(e, t) { } catch {} } function Zr() { - let e = et(); + let e = $e(); if (!e || typeof e.registerExtension != "function") { setTimeout(Zr, 100); return; @@ -214,7 +214,7 @@ function ni() { } } async function ri(e = {}) { - if (!z || typeof z != "object" || !z.AUTO_SCAN_ON_STARTUP || Qr) return; + if (!B || typeof B != "object" || !B.AUTO_SCAN_ON_STARTUP || Qr) return; let t = Math.max(0, Number(e?.delayMs) || 0), n = e?.idleOnly !== !1; if (t > 0) { $r && clearTimeout($r), $r = setTimeout(() => { @@ -236,8 +236,8 @@ async function ri(e = {}) { } Qr = !0; try { - we("[Majoor] Starting startup scan of output directory..."); - let e = await le(ct.SCAN, { + xe("[Majoor] Starting startup scan of output directory..."); + let e = await L(st.SCAN, { recursive: !0, incremental: !0, fast: !0, @@ -245,7 +245,7 @@ async function ri(e = {}) { }); if (e.ok) { let t = e.data; - we(`[Majoor] Startup scan complete - added: ${t.added}, updated: ${t.updated}, skipped: ${t.skipped}`); + xe(`[Majoor] Startup scan complete - added: ${t.added}, updated: ${t.updated}, skipped: ${t.skipped}`); } else console.warn("[Majoor] Majoor [WARN]: Startup scan failed:", e.error); } catch (e) { console.error("[Majoor] ERROR: Startup scan error:", e); @@ -254,9 +254,9 @@ async function ri(e = {}) { async function ii() { try { await Promise.allSettled([ - ae(ct.HEALTH), - ae(`${ct.HEALTH_COUNTERS}?scope=output`), - ae(ct.HEALTH_DB) + re(st.HEALTH), + re(`${st.HEALTH_COUNTERS}?scope=output`), + re(st.HEALTH_DB) ]); } catch (e) { console.debug?.(e); @@ -288,9 +288,9 @@ function oi() { } async function si() { try { - we("[Majoor] Testing API connection..."); - let e = await ae(ct.HEALTH); - e?.ok ? we("[Majoor] API connection successful, health:", e.data.overall) : console.error("[Majoor] ERROR: API health check failed:", e?.error); + xe("[Majoor] Testing API connection..."); + let e = await re(st.HEALTH); + e?.ok ? xe("[Majoor] API connection successful, health:", e.data.overall) : console.error("[Majoor] ERROR: API health check failed:", e?.error); } catch (e) { console.error("[Majoor] ERROR: Failed to connect to API:", e); } @@ -344,7 +344,7 @@ function di(e) { let t = (t, n) => { n ? e.classList.add(t) : e.classList.remove(t); }; - t("mjr-show-filename", z.GRID_SHOW_DETAILS_FILENAME), t("mjr-show-dimensions", z.GRID_SHOW_DETAILS_DIMENSIONS), t("mjr-show-date", z.GRID_SHOW_DETAILS_DATE), t("mjr-show-gentime", z.GRID_SHOW_DETAILS_GENTIME), t("mjr-show-hover-info", z.GRID_SHOW_HOVER_INFO), t("mjr-show-dot", z.GRID_SHOW_WORKFLOW_DOT), t("mjr-show-badges-ext", z.GRID_SHOW_BADGES_EXTENSION), t("mjr-show-badges-rating", z.GRID_SHOW_BADGES_RATING), t("mjr-show-badges-tags", z.GRID_SHOW_BADGES_TAGS), t("mjr-show-details", z.GRID_SHOW_DETAILS), e.style.setProperty("--mjr-grid-min-size", `${z.GRID_MIN_SIZE}px`), e.style.setProperty("--mjr-grid-gap", `${z.GRID_GAP}px`), e.style.setProperty("--mjr-star-active", z.BADGE_STAR_COLOR), e.style.setProperty("--mjr-badge-image", z.BADGE_IMAGE_COLOR), e.style.setProperty("--mjr-badge-video", z.BADGE_VIDEO_COLOR), e.style.setProperty("--mjr-badge-audio", z.BADGE_AUDIO_COLOR), e.style.setProperty("--mjr-badge-model3d", z.BADGE_MODEL3D_COLOR), e.style.setProperty("--mjr-badge-duplicate-alert", z.BADGE_DUPLICATE_ALERT_COLOR), e.style.setProperty("--mjr-card-hover-color", z.UI_CARD_HOVER_COLOR), e.style.setProperty("--mjr-card-selection-color", z.UI_CARD_SELECTION_COLOR), e.style.setProperty("--mjr-rating-color", z.UI_RATING_COLOR), e.style.setProperty("--mjr-tag-color", z.UI_TAG_COLOR); + t("mjr-show-filename", B.GRID_SHOW_DETAILS_FILENAME), t("mjr-show-dimensions", B.GRID_SHOW_DETAILS_DIMENSIONS), t("mjr-show-date", B.GRID_SHOW_DETAILS_DATE), t("mjr-show-gentime", B.GRID_SHOW_DETAILS_GENTIME), t("mjr-show-hover-info", B.GRID_SHOW_HOVER_INFO), t("mjr-show-dot", B.GRID_SHOW_WORKFLOW_DOT), t("mjr-show-badges-ext", B.GRID_SHOW_BADGES_EXTENSION), t("mjr-show-badges-rating", B.GRID_SHOW_BADGES_RATING), t("mjr-show-badges-tags", B.GRID_SHOW_BADGES_TAGS), t("mjr-show-details", B.GRID_SHOW_DETAILS), e.style.setProperty("--mjr-grid-min-size", `${B.GRID_MIN_SIZE}px`), e.style.setProperty("--mjr-grid-gap", `${B.GRID_GAP}px`), e.style.setProperty("--mjr-star-active", B.BADGE_STAR_COLOR), e.style.setProperty("--mjr-badge-image", B.BADGE_IMAGE_COLOR), e.style.setProperty("--mjr-badge-video", B.BADGE_VIDEO_COLOR), e.style.setProperty("--mjr-badge-audio", B.BADGE_AUDIO_COLOR), e.style.setProperty("--mjr-badge-model3d", B.BADGE_MODEL3D_COLOR), e.style.setProperty("--mjr-badge-duplicate-alert", B.BADGE_DUPLICATE_ALERT_COLOR), e.style.setProperty("--mjr-card-hover-color", B.UI_CARD_HOVER_COLOR), e.style.setProperty("--mjr-card-selection-color", B.UI_CARD_SELECTION_COLOR), e.style.setProperty("--mjr-rating-color", B.UI_RATING_COLOR), e.style.setProperty("--mjr-tag-color", B.UI_TAG_COLOR); } function fi(e, { applySettingsClasses: t = !0 } = {}) { if (!e) return null; @@ -522,7 +522,7 @@ function Di(e) { console.debug?.(e); } }, h = (e) => { - if (!(!e || !(e instanceof HTMLElement))) { + if (e && e instanceof HTMLElement) { m(e), e._mjrPortal ||= { parent: e.parentNode, nextSibling: e.nextSibling @@ -545,7 +545,7 @@ function Di(e) { } } }, _ = (t, n) => { - if (!(!t || !n)) try { + if (t && n) try { let r = n.getBoundingClientRect(), i = e.getBoundingClientRect(); h(t), t.style.position = "fixed", t.style.margin = "0"; let a = Math.max(200, Math.min(360, i.width - 16, window.innerWidth - 16)); @@ -658,7 +658,7 @@ function Di(e) { } } }, C = (e, n) => { - if (!(!e || !n)) { + if (e && n) { t.set(e, { popover: e, anchor: n @@ -904,7 +904,7 @@ var Oi = { } }, ki = null; function Ai() { - return ki ||= import("./chunks/viewerOpenRequest-sWnzQpJQ.js").then((e) => e.n), ki; + return ki ||= import("./chunks/viewerOpenRequest-CwB6clm0.js").then((e) => e.n), ki; } function ji(e) { if (!e) return ""; @@ -919,153 +919,153 @@ function Mi(e, t) { return n && r && i && a; } var Ni = /* @__PURE__ */ new Map(); -function Pi(e, t, n) { - let r = e?.id; - if (!r) return; - let i = String(r); +function Pi(t, n, r) { + let i = t?.id; + if (!i) return; + let a = String(i); try { - let e = Ni.get(i); + let e = Ni.get(a); e && clearTimeout(e); } catch (e) { console.debug?.(e); } try { - e.rating = t, n?.(); + t.rating = n, r?.(); } catch (e) { console.debug?.(e); } - let a = setTimeout(async () => { + let o = setTimeout(async () => { try { - Ni.delete(i); - let e = await b(r, t); - if (!e?.ok) { - k(e?.error || L("toast.ratingUpdateFailed"), "error"); + Ni.delete(a); + let t = await _(i, n); + if (!t?.ok) { + e(t?.error || R("toast.ratingUpdateFailed"), "error"); return; } - k(L("toast.ratingSetN", { n: t }), "success", 1500), Lt(st, { - assetId: String(r), - rating: t + e(R("toast.ratingSetN", { n }), "success", 1500), It(ot, { + assetId: String(i), + rating: n }, { warnPrefix: "[GridKeyboard]" }); - } catch (e) { - console.error("[GridKeyboard] Rating update failed:", e), k(L("toast.ratingUpdateError"), "error"); + } catch (t) { + console.error("[GridKeyboard] Rating update failed:", t), e(R("toast.ratingUpdateError"), "error"); } }, 350); - Ni.set(i, a); + Ni.set(a, o); } -function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = () => [], getActiveAsset: r = () => null, onOpenDetails: i = () => {}, onOpenTagsEditor: a = () => {}, onSelectionChanged: o = () => {}, onAssetChanged: s = () => {} } = {}) { - if (!e) return { +function Fi({ gridContainer: t, getState: n = () => ({}), getSelectedAssets: r = () => [], getActiveAsset: i = () => null, onOpenDetails: a = () => {}, onOpenTagsEditor: o = () => {}, onSelectionChanged: s = () => {}, onAssetChanged: c = () => {} } = {}) { + if (!t) return { bind: () => {}, unbind: () => {}, dispose: () => {} }; - let c = null, u = null, d = null, f = null, p = !1, m = !1, h = ({ assets: e = [], index: t = 0, mode: n = "" } = {}) => { + let u = null, d = null, f = null, p = null, m = !1, h = !1, g = ({ assets: e = [], index: t = 0, mode: n = "" } = {}) => { Ai().then((r) => r.requestViewerOpen({ assets: e, index: t, mode: n })).catch((e) => console.debug?.(e)); - }, g = () => { - try { - er(e); - } catch (e) { - console.debug?.(e); - } - try { - window.__MJR_LAST_SELECTION_GRID__ = e; - } catch (e) { - console.debug?.(e); - } }, _ = () => { try { - return n() || []; - } catch { - return []; + $n(t); + } catch (e) { + console.debug?.(e); + } + try { + window.__MJR_LAST_SELECTION_GRID__ = t; + } catch (e) { + console.debug?.(e); } }, v = () => { try { - if (typeof e?._mjrGetRenderedCards == "function") { - let t = e._mjrGetRenderedCards(); - if (Array.isArray(t)) return t; - } - } catch (e) { - console.debug?.(e); - } - try { - return Array.from(e.querySelectorAll(".mjr-asset-card")); + return r() || []; } catch { return []; } }, y = () => { try { - return r() || _()[0] || null; - } catch { - return null; - } - }, b = (e) => { - if (!e?.filepath) return !1; - let t = Je(e.filepath), n = document.createElement("a"); - return n.href = t, n.download = e.filename || "download", document.body.appendChild(n), n.click(), document.body.removeChild(n), k(L("toast.downloadingFile", "Downloading {filename}...", { filename: e.filename }), "info", 3e3), !0; - }, x = () => { - try { - if (Array.isArray(t?.()?.assets) && t().assets.length) return t().assets; - } catch (e) { - console.debug?.(e); - } - try { - if (typeof e?._mjrGetAssets == "function") { - let t = e._mjrGetAssets(); - if (Array.isArray(t) && t.length) return t; + if (typeof t?._mjrGetRenderedCards == "function") { + let e = t._mjrGetRenderedCards(); + if (Array.isArray(e)) return e; } } catch (e) { console.debug?.(e); } try { - return v().map((e) => e?._mjrAsset).filter(Boolean); + return Array.from(t.querySelectorAll(".mjr-asset-card")); } catch { return []; } + }, b = () => { + try { + return i() || v()[0] || null; + } catch { + return null; + } + }, x = (t) => { + if (!t?.filepath) return !1; + let n = qe(t.filepath), r = document.createElement("a"); + return r.href = n, r.download = t.filename || "download", document.body.appendChild(r), r.click(), document.body.removeChild(r), e(R("toast.downloadingFile", "Downloading {filename}...", { filename: t.filename }), "info", 3e3), !0; }, S = () => { try { - let t = v(); - if (t.length >= 2) { - let e = Math.round(t[0].getBoundingClientRect().top), n = t.filter((t) => { + if (Array.isArray(n?.()?.assets) && n().assets.length) return n().assets; + } catch (e) { + console.debug?.(e); + } + try { + if (typeof t?._mjrGetAssets == "function") { + let e = t._mjrGetAssets(); + if (Array.isArray(e) && e.length) return e; + } + } catch (e) { + console.debug?.(e); + } + try { + return y().map((e) => e?._mjrAsset).filter(Boolean); + } catch { + return []; + } + }, C = () => { + try { + let e = y(); + if (e.length >= 2) { + let t = Math.round(e[0].getBoundingClientRect().top), n = e.filter((e) => { try { - return Math.abs(Math.round(t.getBoundingClientRect().top) - e) <= 4; + return Math.abs(Math.round(e.getBoundingClientRect().top) - t) <= 4; } catch { return !1; } }); if (n.length >= 1) return Math.max(1, n.length); } - if (t.length >= 1) { - let n = t[0].getBoundingClientRect(), r = e.getBoundingClientRect(), i = Math.max(1, Math.round(n.width)), a = Math.max(1, Math.round(r.width)); + if (e.length >= 1) { + let n = e[0].getBoundingClientRect(), r = t.getBoundingClientRect(), i = Math.max(1, Math.round(n.width)), a = Math.max(1, Math.round(r.width)); return Math.max(1, Math.floor(a / i)); } } catch (e) { console.debug?.(e); } return 1; - }, C = (t, n) => { - let r = Array.isArray(t) ? t.map(String).filter(Boolean) : [], i = String(n || r[0] || ""); + }, w = (e, n) => { + let r = Array.isArray(e) ? e.map(String).filter(Boolean) : [], i = String(n || r[0] || ""); try { - typeof e?._mjrSetSelection == "function" ? e._mjrSetSelection(r, i) : (e.dataset.mjrSelectedAssetIds = JSON.stringify(r), e.dataset.mjrSelectedAssetId = i); + typeof t?._mjrSetSelection == "function" ? t._mjrSetSelection(r, i) : (t.dataset.mjrSelectedAssetIds = JSON.stringify(r), t.dataset.mjrSelectedAssetId = i); } catch (e) { console.debug?.(e); } - }, w = (t) => { - let n = String(t || "").trim(); + }, T = (e) => { + let n = String(e || "").trim(); if (n) { try { - if (typeof e?._mjrScrollToAssetId == "function") { - e._mjrScrollToAssetId(n); + if (typeof t?._mjrScrollToAssetId == "function") { + t._mjrScrollToAssetId(n); return; } } catch (e) { console.debug?.(e); } try { - let t = typeof CSS < "u" && CSS?.escape ? CSS.escape(n) : n.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1"); - e.querySelector(`.mjr-asset-card[data-mjr-asset-id="${t}"]`)?.scrollIntoView?.({ + let e = typeof CSS < "u" && CSS?.escape ? CSS.escape(n) : n.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1"); + t.querySelector(`.mjr-asset-card[data-mjr-asset-id="${e}"]`)?.scrollIntoView?.({ block: "nearest", inline: "nearest" }); @@ -1073,100 +1073,100 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = console.debug?.(e); } } - }, T = (t) => { - let n = String(t.key || ""); - if (n !== "ArrowLeft" && n !== "ArrowRight" && n !== "ArrowUp" && n !== "ArrowDown" && n !== "Home" && n !== "End" || t.ctrlKey || t.altKey || t.metaKey) return !1; - let r = x(); + }, E = (e) => { + let n = String(e.key || ""); + if (n !== "ArrowLeft" && n !== "ArrowRight" && n !== "ArrowUp" && n !== "ArrowDown" && n !== "Home" && n !== "End" || e.ctrlKey || e.altKey || e.metaKey) return !1; + let r = S(); if (!Array.isArray(r) || r.length === 0) return !1; - let i = y(), a = String(i?.id || e?.dataset?.mjrSelectedAssetId || ""), s = r.findIndex((e) => String(e?.id || "") === a), c = s >= 0; - s < 0 && (s = 0); - let l = Math.max(1, S()), u = s; - if (n === "ArrowLeft" ? --u : n === "ArrowRight" ? u += 1 : n === "ArrowUp" ? u -= l : n === "ArrowDown" ? u += l : n === "Home" ? u = 0 : n === "End" && (u = r.length - 1), u = Math.max(0, Math.min(r.length - 1, u)), c && u === s && n !== "Home" && n !== "End") return !1; + let i = b(), a = String(i?.id || t?.dataset?.mjrSelectedAssetId || ""), o = r.findIndex((e) => String(e?.id || "") === a), c = o >= 0; + o < 0 && (o = 0); + let l = Math.max(1, C()), u = o; + if (n === "ArrowLeft" ? --u : n === "ArrowRight" ? u += 1 : n === "ArrowUp" ? u -= l : n === "ArrowDown" ? u += l : n === "Home" ? u = 0 : n === "End" && (u = r.length - 1), u = Math.max(0, Math.min(r.length - 1, u)), c && u === o && n !== "Home" && n !== "End") return !1; let d = String(r[u]?.id || ""); if (!d) return !1; - if (g(), t.shiftKey) { - let t = String(e?._mjrSelectionAnchorId || ""); - t ||= a || d; - let n = r.findIndex((e) => String(e?.id || "") === t), i = n >= 0 ? n : s, o = Math.min(i, u), c = Math.max(i, u), l = r.slice(o, c + 1).map((e) => String(e?.id || "")).filter(Boolean); - C(l, d); - } else e._mjrSelectionAnchorId = d, C([d], d); - w(d); + if (_(), e.shiftKey) { + let e = String(t?._mjrSelectionAnchorId || ""); + e ||= a || d; + let n = r.findIndex((t) => String(t?.id || "") === e), i = n >= 0 ? n : o, s = Math.min(i, u), c = Math.max(i, u), l = r.slice(s, c + 1).map((e) => String(e?.id || "")).filter(Boolean); + w(l, d); + } else t._mjrSelectionAnchorId = d, w([d], d); + T(d); try { - o?.(); + s?.(); } catch (e) { console.debug?.(e); } return !0; - }, E = async (n) => { - let r = n.target; - if (r && (r.tagName === "INPUT" || r.tagName === "TEXTAREA" || r.isContentEditable) || Se() || ge().scope === "viewer") return; + }, D = async (r) => { + let i = r.target; + if (i && (i.tagName === "INPUT" || i.tagName === "TEXTAREA" || i.isContentEditable) || ve() || fe().scope === "viewer") return; if (document.activeElement !== document.body) { - let t = document.activeElement, n = e.contains(t), r = t && t.contains && t.contains(e), i = t?.closest?.(".mjr-asset-card"); + let e = document.activeElement, n = t.contains(e), r = e && e.contains && e.contains(t), i = e?.closest?.(".mjr-asset-card"); if (!n && !r && !i) return; } else { - let t = Zn(); - if (t && t !== e) return; + let e = Xn(); + if (e && e !== t) return; } - let c = () => { - n.preventDefault(), n.stopPropagation(); + let u = () => { + r.preventDefault(), r.stopPropagation(); }; try { - if (T(n)) { - c(); + if (E(r)) { + u(); return; } } catch (e) { console.debug?.(e); } - let u = _(), d = y(), f = t(); - if (Mi(n, Oi.DOWNLOAD) && d?.filepath) { - c(), m = !0; + let d = v(), f = b(), p = n(); + if (Mi(r, Oi.DOWNLOAD) && f?.filepath) { + u(), h = !0; return; } - let p = !!ge().ratingHotkeysActive; - if (!n.ctrlKey && !n.altKey && !n.metaKey && !n.shiftKey) { - if (!p && Mi(n, Oi.RATING_1) && d?.id) { - c(), Pi(d, 1, s); + let m = !!fe().ratingHotkeysActive; + if (!r.ctrlKey && !r.altKey && !r.metaKey && !r.shiftKey) { + if (!m && Mi(r, Oi.RATING_1) && f?.id) { + u(), Pi(f, 1, c); return; } - if (!p && Mi(n, Oi.RATING_2) && d?.id) { - c(), Pi(d, 2, s); + if (!m && Mi(r, Oi.RATING_2) && f?.id) { + u(), Pi(f, 2, c); return; } - if (!p && Mi(n, Oi.RATING_3) && d?.id) { - c(), Pi(d, 3, s); + if (!m && Mi(r, Oi.RATING_3) && f?.id) { + u(), Pi(f, 3, c); return; } - if (!p && Mi(n, Oi.RATING_4) && d?.id) { - c(), Pi(d, 4, s); + if (!m && Mi(r, Oi.RATING_4) && f?.id) { + u(), Pi(f, 4, c); return; } - if (!p && Mi(n, Oi.RATING_5) && d?.id) { - c(), Pi(d, 5, s); + if (!m && Mi(r, Oi.RATING_5) && f?.id) { + u(), Pi(f, 5, c); return; } - if (!p && Mi(n, Oi.RATING_RESET) && d?.id) { - c(), Pi(d, 0, s); + if (!m && Mi(r, Oi.RATING_RESET) && f?.id) { + u(), Pi(f, 0, c); return; } } - if ((Mi(n, Oi.OPEN_VIEWER) || Mi(n, Oi.OPEN_VIEWER_ALT)) && u.length > 0) { - c(); + if ((Mi(r, Oi.OPEN_VIEWER) || Mi(r, Oi.OPEN_VIEWER_ALT)) && d.length > 0) { + u(); try { - if (u.length >= 2 && u.length <= 4) h({ - assets: u, + if (d.length >= 2 && d.length <= 4) g({ + assets: d, index: 0 }); else { - let t = []; - if (Array.isArray(f?.assets) && f.assets.length) t = f.assets; - else if (typeof e?._mjrGetAssets == "function") { - let n = e._mjrGetAssets(); - Array.isArray(n) && n.length && (t = n); - } else t = v().map((e) => e._mjrAsset).filter(Boolean); - let n = t.findIndex((e) => String(e?.id) === String(d?.id)); - h({ - assets: t, + let e = []; + if (Array.isArray(p?.assets) && p.assets.length) e = p.assets; + else if (typeof t?._mjrGetAssets == "function") { + let n = t._mjrGetAssets(); + Array.isArray(n) && n.length && (e = n); + } else e = y().map((e) => e._mjrAsset).filter(Boolean); + let n = e.findIndex((e) => String(e?.id) === String(f?.id)); + g({ + assets: e, index: Math.max(0, n) }); } @@ -1175,15 +1175,15 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = } return; } - if (Mi(n, Oi.METADATA_PANEL) && d) { - c(), i(d); + if (Mi(r, Oi.METADATA_PANEL) && f) { + u(), a(f); return; } - if (Mi(n, Oi.COMPARE_AB) && u.length === 2) { - c(); + if (Mi(r, Oi.COMPARE_AB) && d.length === 2) { + u(); try { - h({ - assets: u, + g({ + assets: d, index: 0, mode: "ab" }); @@ -1192,11 +1192,11 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = } return; } - if (Mi(n, Oi.SIDE_BY_SIDE) && u.length >= 2 && u.length <= 4) { - c(); + if (Mi(r, Oi.SIDE_BY_SIDE) && d.length >= 2 && d.length <= 4) { + u(); try { - h({ - assets: u, + g({ + assets: d, index: 0, mode: "sidebyside" }); @@ -1205,33 +1205,33 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = } return; } - if (Mi(n, Oi.EDIT_TAGS) && d?.id) { - c(), a(d); + if (Mi(r, Oi.EDIT_TAGS) && f?.id) { + u(), o(f); return; } - if (Mi(n, Oi.ADD_TO_COLLECTION) && (u.length > 0 || d)) { - c(); - let t = u.length > 0 ? u : [d], n = e.getBoundingClientRect(); - await zt({ + if (Mi(r, Oi.ADD_TO_COLLECTION) && (d.length > 0 || f)) { + u(); + let e = d.length > 0 ? d : [f], n = t.getBoundingClientRect(); + await Rt({ x: n.left + n.width / 2, y: n.top + n.height / 2, - assets: t + assets: e }); return; } - if (Mi(n, Oi.REMOVE_FROM_COLLECTION)) { - let e = f?.collectionId; - if (e && (u.length > 0 || d)) { - c(); + if (Mi(r, Oi.REMOVE_FROM_COLLECTION)) { + let t = p?.collectionId; + if (t && (d.length > 0 || f)) { + u(); try { - let t = (u.length > 0 ? u : [d]).map((e) => String(e?.filepath || e?.path || e?.file_info?.filepath || "").trim()).filter(Boolean); - if (!t.length) { - k(L("toast.removeFromCollectionFailed", "No valid files to remove from collection"), "warning"); + let n = (d.length > 0 ? d : [f]).map((e) => String(e?.filepath || e?.path || e?.file_info?.filepath || "").trim()).filter(Boolean); + if (!n.length) { + e(R("toast.removeFromCollectionFailed", "No valid files to remove from collection"), "warning"); return; } - let n = await ie(e, t); - if (!n?.ok) { - k(n?.error || L("toast.removeFromCollectionFailed", "Failed to remove from collection"), "error"); + let r = await k(t, n); + if (!r?.ok) { + e(r?.error || R("toast.removeFromCollectionFailed", "Failed to remove from collection"), "error"); return; } try { @@ -1239,146 +1239,146 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = } catch (e) { console.debug?.(e); } - k(L("toast.removedFromCollection", "Removed from collection"), "success", 1400); - } catch (e) { - k(L("toast.removeFromCollectionError", "Error removing from collection: {error}", { error: e?.message || String(e || "") }), "error"); + e(R("toast.removedFromCollection", "Removed from collection"), "success", 1400); + } catch (t) { + e(R("toast.removeFromCollectionError", "Error removing from collection: {error}", { error: t?.message || String(t || "") }), "error"); } return; } } - if (Mi(n, Oi.COPY_PATH) && d?.filepath) { - c(); + if (Mi(r, Oi.COPY_PATH) && f?.filepath) { + u(); try { - await navigator.clipboard.writeText(d.filepath), k(L("toast.pathCopied"), "success", 2e3); + await navigator.clipboard.writeText(f.filepath), e(R("toast.pathCopied"), "success", 2e3); } catch { - k(L("toast.pathCopyFailed"), "error"); + e(R("toast.pathCopyFailed"), "error"); } return; } - if (Mi(n, Oi.OPEN_IN_FOLDER) && d?.id) { - c(); - let e = await oe(d.id); - e?.ok ? k(L("toast.openedInFolder"), "info", 2e3) : k(e?.error || L("toast.openFolderFailed"), "error"); + if (Mi(r, Oi.OPEN_IN_FOLDER) && f?.id) { + u(); + let t = await ne(f.id); + t?.ok ? e(R("toast.openedInFolder"), "info", 2e3) : e(t?.error || R("toast.openFolderFailed"), "error"); return; } - if (Mi(n, Oi.RENAME) && d?.id) { - c(); - let e = d.filename || "", t = await Tt(L("dialog.rename.title", "Rename file"), e), n = yt(t, e); - if (n && n !== e) { - let e = kt(n); - if (!e.valid) { - k(e.reason, "error"); + if (Mi(r, Oi.RENAME) && f?.id) { + u(); + let t = f.filename || "", n = await wt(R("dialog.rename.title", "Rename file"), t), r = vt(n, t); + if (r && r !== t) { + let t = Ot(r); + if (!t.valid) { + e(t.reason, "error"); return; } try { - let e = await j(d, n); - if (e?.ok) { - let t = e?.data?.asset; - t && typeof t == "object" ? Object.assign(d, t) : (d.filename = n, d.filepath = d.filepath?.replace(/[^\\/]+$/, n), d.path &&= String(d.path).replace(/[^\\/]+$/, n), d.file_info && typeof d.file_info == "object" && (d.file_info.filename = n, d.file_info.filepath && (d.file_info.filepath = String(d.file_info.filepath).replace(/[^\\/]+$/, n)), d.file_info.path && (d.file_info.path = String(d.file_info.path).replace(/[^\\/]+$/, n)))), k(L("toast.fileRenamedSuccess"), "success"); + let t = await Ce(f, r); + if (t?.ok) { + let n = t?.data?.asset; + n && typeof n == "object" ? Object.assign(f, n) : (f.filename = r, f.filepath = f.filepath?.replace(/[^\\/]+$/, r), f.path &&= String(f.path).replace(/[^\\/]+$/, r), f.file_info && typeof f.file_info == "object" && (f.file_info.filename = r, f.file_info.filepath && (f.file_info.filepath = String(f.file_info.filepath).replace(/[^\\/]+$/, r)), f.file_info.path && (f.file_info.path = String(f.file_info.path).replace(/[^\\/]+$/, r)))), e(R("toast.fileRenamedSuccess"), "success"); try { window.dispatchEvent(new CustomEvent("mjr:reload-grid", { detail: { reason: "rename-keyboard" } })); } catch (e) { console.debug?.(e); } - s(); - } else k(e?.error || L("toast.fileRenameFailed"), "error"); - } catch (e) { - k(L("toast.errorRenaming", "Error renaming file: {error}", { error: e?.message || String(e || "") }), "error"); + c(); + } else e(t?.error || R("toast.fileRenameFailed"), "error"); + } catch (t) { + e(R("toast.errorRenaming", "Error renaming file: {error}", { error: t?.message || String(t || "") }), "error"); } } return; } - if ((Mi(n, Oi.DELETE) || Mi(n, Oi.DELETE_ALT)) && (d?.id || u.length > 0)) { - c(); - let t = u.length > 0 ? u : [d], n = 0, r = 0, i = []; - for (let e of t) if (e?.id) try { - (await l(e.id))?.ok ? (n++, i.push(String(e.id))) : r++; + if ((Mi(r, Oi.DELETE) || Mi(r, Oi.DELETE_ALT)) && (f?.id || d.length > 0)) { + u(); + let n = d.length > 0 ? d : [f], r = 0, i = 0, a = []; + for (let e of n) if (e?.id) try { + (await l(e.id))?.ok ? (r++, a.push(String(e.id))) : i++; } catch { - r++; + i++; } - if (i.length) try { - let t = e?._mjrRemoveAssets; - if (typeof t == "function") t(i); - else for (let t of i) e.querySelector(`[data-mjr-asset-id="${t}"]`)?.remove?.(); + if (a.length) try { + let e = t?._mjrRemoveAssets; + if (typeof e == "function") e(a); + else for (let e of a) t.querySelector(`[data-mjr-asset-id="${e}"]`)?.remove?.(); } catch (e) { console.debug?.(e); } - r === 0 ? k(L("toast.filesDeletedShort", "{n} files deleted", { n }), "success") : k(L("toast.filesDeletedShortPartial", "{success} deleted, {failed} failed", { - success: n, - failed: r + i === 0 ? e(R("toast.filesDeletedShort", "{n} files deleted", { n: r }), "success") : e(R("toast.filesDeletedShortPartial", "{success} deleted, {failed} failed", { + success: r, + failed: i }), "warning"); try { - if (typeof e?._mjrSetSelection == "function") { - let t = u.filter((e) => !i.includes(String(e?.id || ""))).map((e) => String(e?.id || "")).filter(Boolean); - e._mjrSetSelection(t, t[0] || ""); + if (typeof t?._mjrSetSelection == "function") { + let e = d.filter((e) => !a.includes(String(e?.id || ""))).map((e) => String(e?.id || "")).filter(Boolean); + t._mjrSetSelection(e, e[0] || ""); } } catch (e) { console.debug?.(e); } - o(); + s(); return; } - if (Mi(n, Oi.SELECT_ALL)) { - c(); - let t = []; + if (Mi(r, Oi.SELECT_ALL)) { + u(); + let e = []; try { - if (Array.isArray(f?.assets) && f.assets.length) t = f.assets.map((e) => String(e?.id || "")).filter(Boolean); - else if (typeof e?._mjrGetAssets == "function") { - let n = e._mjrGetAssets(); - Array.isArray(n) && (t = n.map((e) => String(e?.id || "")).filter(Boolean)); + if (Array.isArray(p?.assets) && p.assets.length) e = p.assets.map((e) => String(e?.id || "")).filter(Boolean); + else if (typeof t?._mjrGetAssets == "function") { + let n = t._mjrGetAssets(); + Array.isArray(n) && (e = n.map((e) => String(e?.id || "")).filter(Boolean)); } } catch (e) { console.debug?.(e); } - if (!t.length) try { - t = v().map((e) => String(e?._mjrAsset?.id || "")).filter(Boolean); + if (!e.length) try { + e = y().map((e) => String(e?._mjrAsset?.id || "")).filter(Boolean); } catch (e) { console.debug?.(e); } try { - typeof e?._mjrSetSelection == "function" ? e._mjrSetSelection(t, t[0] || "") : (v().forEach((e) => { + typeof t?._mjrSetSelection == "function" ? t._mjrSetSelection(e, e[0] || "") : (y().forEach((e) => { e.classList.add("is-selected"), e.setAttribute("aria-selected", "true"); - }), e.dataset.mjrSelectedAssetIds = JSON.stringify(t), e.dataset.mjrSelectedAssetId = String(t[0] || "")); + }), t.dataset.mjrSelectedAssetIds = JSON.stringify(e), t.dataset.mjrSelectedAssetId = String(e[0] || "")); } catch (e) { console.debug?.(e); } - o(); + s(); return; } - if (Mi(n, Oi.DESELECT_ALL)) { - c(); + if (Mi(r, Oi.DESELECT_ALL)) { + u(); try { - typeof e?._mjrSetSelection == "function" ? e._mjrSetSelection([], "") : (v().filter((e) => e?.classList?.contains?.("is-selected")).forEach((e) => { + typeof t?._mjrSetSelection == "function" ? t._mjrSetSelection([], "") : (y().filter((e) => e?.classList?.contains?.("is-selected")).forEach((e) => { e.classList.remove("is-selected"), e.setAttribute("aria-selected", "false"); - }), delete e.dataset.mjrSelectedAssetIds, delete e.dataset.mjrSelectedAssetId); + }), delete t.dataset.mjrSelectedAssetIds, delete t.dataset.mjrSelectedAssetId); } catch (e) { console.debug?.(e); } - o(); + s(); return; } - }, D = (e) => { - if (String(e?.key || "").toLowerCase() !== "s" || !m || (m = !1, Se()) || ge().scope === "viewer") return; - let t = y(); - t?.filepath && (e.preventDefault?.(), e.stopPropagation?.(), e.stopImmediatePropagation?.(), b(t)); - }, O = () => { - m = !1; + }, O = (e) => { + if (String(e?.key || "").toLowerCase() !== "s" || !h || (h = !1, ve()) || fe().scope === "viewer") return; + let t = b(); + t?.filepath && (e.preventDefault?.(), e.stopPropagation?.(), e.stopImmediatePropagation?.(), x(t)); }, A = () => { - p ||= (c = E, u = D, d = O, f = () => g(), document.addEventListener("keydown", c, !0), document.addEventListener("keyup", u, !0), document.addEventListener("dragstart", d, !0), e.addEventListener("pointerdown", f, !0), e.addEventListener("focusin", f, !0), !0); + h = !1; + }, j = () => { + m ||= (u = D, d = O, f = A, p = () => _(), document.addEventListener("keydown", u, !0), document.addEventListener("keyup", d, !0), document.addEventListener("dragstart", f, !0), t.addEventListener("pointerdown", p, !0), t.addEventListener("focusin", p, !0), !0); }, M = () => { - if (!(!p || !c)) { - document.removeEventListener("keydown", c, !0), u && document.removeEventListener("keyup", u, !0), d && document.removeEventListener("dragstart", d, !0), f && (e.removeEventListener("pointerdown", f, !0), e.removeEventListener("focusin", f, !0)), c = null, u = null, d = null, f = null, m = !1; + if (m && u) { + document.removeEventListener("keydown", u, !0), d && document.removeEventListener("keyup", d, !0), f && document.removeEventListener("dragstart", f, !0), p && (t.removeEventListener("pointerdown", p, !0), t.removeEventListener("focusin", p, !0)), u = null, d = null, f = null, p = null, h = !1; try { - Xn(e); + Yn(t); } catch (e) { console.debug?.(e); } try { - window.__MJR_LAST_SELECTION_GRID__ === e && delete window.__MJR_LAST_SELECTION_GRID__; + window.__MJR_LAST_SELECTION_GRID__ === t && delete window.__MJR_LAST_SELECTION_GRID__; } catch (e) { console.debug?.(e); } - p = !1; + m = !1; for (let e of Ni.values()) try { clearTimeout(e); } catch (e) { @@ -1388,7 +1388,7 @@ function Fi({ gridContainer: e, getState: t = () => ({}), getSelectedAssets: n = } }; return { - bind: A, + bind: j, unbind: M, dispose: () => { M(); @@ -1407,7 +1407,7 @@ function Ii(e) { } //#endregion //#region ui/features/workflows/workflowInfoState.ts -var Li = Sr({ +var Li = xr({ open: !1, workflow: null }); @@ -1421,10 +1421,10 @@ function zi() { //#region ui/features/contextmenu/GridContextMenu.ts var Bi = 1, Vi = null, Hi = null; function Ui() { - return Vi ||= import("./chunks/viewerOpenRequest-sWnzQpJQ.js").then((e) => e.n), Vi; + return Vi ||= import("./chunks/viewerOpenRequest-CwB6clm0.js").then((e) => e.n), Vi; } function Wi() { - return Hi ||= import("./chunks/floatingViewerManager-Crq2oCKD.js").then((e) => e.n), Hi; + return Hi ||= import("./chunks/floatingViewerManager-XH4AFW4G.js").then((e) => e.n), Hi; } function Gi(e) { let t = String(e || "").trim().toLowerCase(); @@ -1512,7 +1512,7 @@ async function Yi(e) { let t = String(e?.filepath || e?.path || e?.full_path || "").trim(); if (!t) return e; try { - let n = await C(t, { timeoutMs: 25e3 }), r = n?.data?.workflow || n?.workflow || null, i = n?.data?.prompt || n?.prompt || null; + let n = await y(t, { timeoutMs: 25e3 }), r = n?.data?.workflow || n?.workflow || null, i = n?.data?.prompt || n?.prompt || null; return !r && !i ? e : { ...e, workflow: r || e?.workflow, @@ -1541,7 +1541,7 @@ var Xi = (e) => { filename: t, subfolder: e.subfolder || "", type: String(e.type || e.source || "output").toLowerCase(), - root_id: Ne(e) || void 0, + root_id: Me(e) || void 0, kind: String(e.kind || "").toLowerCase() } : null; }, Qi = (e) => { @@ -1551,7 +1551,7 @@ var Xi = (e) => { filename: t, subfolder: e.subfolder || "", type: String(e.type || e.source || "output").toLowerCase(), - root_id: Ne(e) || void 0 + root_id: Me(e) || void 0 } : null; }; function $i(e, t = "") { @@ -1559,39 +1559,39 @@ function $i(e, t = "") { let n = document.createElement("a"); n.href = e, t && (n.download = t), document.body.appendChild(n), n.click(), document.body.removeChild(n); } -async function ea(e) { - let t = (Array.isArray(e) ? e.filter((e) => !ma(e)) : []).map(Qi).filter(Boolean); - if (t.length < 2) { - k("Select at least two files to download a ZIP.", "warning", 2600); +async function ea(t) { + let n = (Array.isArray(t) ? t.filter((e) => !ma(e)) : []).map(Qi).filter(Boolean); + if (n.length < 2) { + e("Select at least two files to download a ZIP.", "warning", 2600); return; } - let n = ""; + let r = ""; try { - n = qe("mjr_", 24); - } catch (e) { - F(e, "[GridContextMenu] Batch ZIP token", { showToast: z.DEBUG_VERBOSE_ERRORS }), k("Could not create a secure ZIP token.", "error"); + r = Ke("mjr_", 24); + } catch (t) { + P(t, "[GridContextMenu] Batch ZIP token", { showToast: B.DEBUG_VERBOSE_ERRORS }), e("Could not create a secure ZIP token.", "error"); return; } - k(`Preparing ZIP for ${t.length} files...`, "info", 1800); - let r = await le(ct.BATCH_ZIP_CREATE, { - token: n, - items: t, + e(`Preparing ZIP for ${n.length} files...`, "info", 1800); + let i = await L(st.BATCH_ZIP_CREATE, { + token: r, + items: n, strip_metadata: !1 }); - if (!r?.ok) { - k(r?.error || "Failed to create ZIP.", "error"); + if (!i?.ok) { + e(i?.error || "Failed to create ZIP.", "error"); return; } - let i = r?.data?.filename || `Majoor_Batch_${t.length}.zip`; - $i($e(n), i), k(`Downloading ${i}...`, "info", 3e3); + let a = i?.data?.filename || `Majoor_Batch_${n.length}.zip`; + $i(Qe(r), a), e(`Downloading ${a}...`, "info", 3e3); } async function ta(e) { let t = Array.isArray(e) ? e.filter(Boolean) : [], n = await Promise.all(t.map(async (e) => { let t = Zi(e); if (!t) return null; - let n = (await Hn({ - post: le, - endpoint: ct.STAGE_TO_INPUT, + let n = (await Vn({ + post: L, + endpoint: st.STAGE_TO_INPUT, payload: t, index: !1 }))?.relativePath; @@ -1601,8 +1601,8 @@ async function ta(e) { droppedExt: String(t.filename || "").split(".").pop() || "" } : null; })); - return hn({ - app: et(), + return mn({ + app: $e(), items: n.filter(Boolean), event: null }); @@ -1619,7 +1619,7 @@ var na = (e) => { } catch (e) { console.debug?.(e); } - Lt("mjr:selection-changed", { selectedIds: [] }, { + It("mjr:selection-changed", { selectedIds: [] }, { target: e, warnPrefix: "[GridContextMenu]" }); @@ -1680,7 +1680,7 @@ var na = (e) => { function oa(e) { if (e == null) return null; try { - return document.querySelector(`[data-mjr-asset-id="${bt(e)}"]`); + return document.querySelector(`[data-mjr-asset-id="${yt(e)}"]`); } catch (e) { return console.debug?.(e), null; } @@ -1718,7 +1718,7 @@ async function la(e, t) { ok: !1, error: "Missing filename" }; - let r = await le(ct.INDEX_FILES, { + let r = await L(st.INDEX_FILES, { files: [n], incremental: !1 }); @@ -1727,12 +1727,12 @@ async function la(e, t) { error: "Index refresh failed" }; if (e?.id != null) try { - let t = await re(e.id); + let t = await I(e.id); if (t?.ok && t?.data && typeof t.data == "object") { Object.assign(e, t.data); let n = sa(e, t.data), r = n?.querySelector?.(".mjr-workflow-dot"); if (r) { - let e = Dt(n._mjrAsset); + let e = Et(n._mjrAsset); e && r.replaceWith(e); } } @@ -1757,24 +1757,24 @@ function ua(e, t, n) { console.debug?.(e); } if (r) { - qt(String(r), t, { + Kt(String(r), t, { successMessage: t > 0 ? `Rating set to ${t} stars` : "Rating cleared", errorMessage: "Failed to update rating", warnPrefix: "[GridContextMenu]", onSuccess: () => { - Lt(st, { + It(ot, { assetId: String(r), rating: t }, { warnPrefix: "[GridContextMenu]" }); }, onFailure: (e) => { - F(e, "[GridContextMenu] Rating update", { showToast: z.DEBUG_VERBOSE_ERRORS }); + P(e, "[GridContextMenu] Rating update", { showToast: B.DEBUG_VERBOSE_ERRORS }); } }); return; } - b(e, t).catch((e) => { - F(e, "[GridContextMenu] Rating update", { showToast: z.DEBUG_VERBOSE_ERRORS }); + _(e, t).catch((e) => { + P(e, "[GridContextMenu] Rating update", { showToast: B.DEBUG_VERBOSE_ERRORS }); }); } function da(e) { @@ -1783,7 +1783,7 @@ function da(e) { } function fa() { try { - return !!(Yt()?.browser?.showFolders ?? !1); + return !!(Jt()?.browser?.showFolders ?? !1); } catch { return !1; } @@ -1820,62 +1820,62 @@ function ga(e) { } async function _a(e) { if (!e || ma(e)) return null; - let t = qn(e); + let t = Kn(e); if (t) return t; let n = e?.id; if (n == null || n === "") return null; try { - let t = await re(n, { timeoutMs: 3e4 }), r = t?.data; - if (t?.ok && r && typeof r == "object") return Object.assign(e, r), qn(e); + let t = await I(n, { timeoutMs: 3e4 }), r = t?.data; + if (t?.ok && r && typeof r == "object") return Object.assign(e, r), Kn(e); } catch (e) { console.debug?.(e); } return null; } -async function va(e) { - let t = await _a(e); - if (!t || typeof t != "object") { - k(L("toast.assetWorkflowMissing", "No embedded ComfyUI workflow was found for this asset."), "warn", 2600); +async function va(t) { + let n = await _a(t); + if (!n || typeof n != "object") { + e(R("toast.assetWorkflowMissing", "No embedded ComfyUI workflow was found for this asset."), "warn", 2600); return; } - let n = et(), r = Pe(t, n); - if (!r.ok) { - k(L("toast.workflowImportUnavailable", "ComfyUI workflow import is unavailable in this frontend."), "error"); + let r = $e(), i = Ne(n, r); + if (!i.ok) { + e(R("toast.workflowImportUnavailable", "ComfyUI workflow import is unavailable in this frontend."), "error"); return; } - let i = r.mode === "new-tab" ? L("toast.workflowLoadedNewTab", "Workflow loaded in a new ComfyUI tab.") : L("toast.workflowLoaded", "Workflow loaded"); - k(i, "success", 1800); + let a = i.mode === "new-tab" ? R("toast.workflowLoadedNewTab", "Workflow loaded in a new ComfyUI tab.") : R("toast.workflowLoaded", "Workflow loaded"); + e(a, "success", 1800); } -async function ya(e) { - let t = String(e?.filepath || e?.path || e?.full_path || "").trim(); - if (!t) { - k(L("toast.workflowMissingPath", "Workflow file path is missing."), "error"); +async function ya(t) { + let n = String(t?.filepath || t?.path || t?.full_path || "").trim(); + if (!n) { + e(R("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = et(); - if (Re(n) === !0 && !await Wt(L("dialog.workflowLoadReplaceDirty", "Current canvas has unsaved changes. Replace it with this workflow?"), L("tab.workflow", "Workflow"))) return; - let r = await C(t, { timeoutMs: 3e4 }), a = r?.data?.workflow || r?.workflow || null; - if (!r?.ok || !a || typeof a != "object") { - k(r?.error || L("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + let r = $e(); + if (Le(r) === !0 && !await Ut(R("dialog.workflowLoadReplaceDirty", "Current canvas has unsaved changes. Replace it with this workflow?"), R("tab.workflow", "Workflow"))) return; + let i = await y(n, { timeoutMs: 3e4 }), o = i?.data?.workflow || i?.workflow || null; + if (!i?.ok || !o || typeof o != "object") { + e(i?.error || R("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - let o = Pe(a, n); - if (!o.ok) { - let e = Je(t, { inline: !0 }); + let s = Ne(o, r); + if (!s.ok) { + let t = qe(n, { inline: !0 }); try { - e && typeof window < "u" && window.open(e, "_blank", "noopener,noreferrer"); + t && typeof window < "u" && window.open(t, "_blank", "noopener,noreferrer"); } catch (e) { console.debug?.(e); } - k(L("toast.workflowImportFallback", "ComfyUI workflow import is unavailable in this frontend. Opened workflow JSON for manual import."), "warn"), o.mode === "new-tab" && k(L("toast.workflowLoadedNewTab", "Workflow loaded in a new ComfyUI tab."), "success"); + e(R("toast.workflowImportFallback", "ComfyUI workflow import is unavailable in this frontend. Opened workflow JSON for manual import."), "warn"), s.mode === "new-tab" && e(R("toast.workflowLoadedNewTab", "Workflow loaded in a new ComfyUI tab."), "success"); return; } try { - await i({ filepath: t }, { timeoutMs: 1e4 }); + await a({ filepath: n }, { timeoutMs: 1e4 }); } catch (e) { console.debug?.(e); } - k(L("toast.workflowLoaded", "Workflow loaded"), "success", 1800); + e(R("toast.workflowLoaded", "Workflow loaded"), "success", 1800); } function ba(e) { try { @@ -1884,144 +1884,144 @@ function ba(e) { console.debug?.(e); } } -async function xa(e) { - let t = String(e?.filepath || "").trim(), n = await pe({ filepath: t }, { timeoutMs: 3e4 }); - if (!n?.ok) { - k(n?.error || L("toast.workflowSaveFailed", "Failed to save workflow."), "error"); +async function xa(t) { + let n = String(t?.filepath || "").trim(), r = await le({ filepath: n }, { timeoutMs: 3e4 }); + if (!r?.ok) { + e(r?.error || R("toast.workflowSaveFailed", "Failed to save workflow."), "error"); return; } - k(L("toast.workflowSaved", "Workflow saved"), "success", 1800), ba("workflow-duplicate"); + e(R("toast.workflowSaved", "Workflow saved"), "success", 1800), ba("workflow-duplicate"); } -async function Sa(e) { - let t = String(e?.filepath || "").trim(), n = String(e?.display_name || e?.filename || "").replace(/\.json$/i, ""), r = await Tt(L("ctx.renameWorkflow", "Rename workflow"), n, L("tab.workflow", "Workflow")), i = String(r || "").trim(); - if (!i) return; - let a = await y({ - filepath: t, - name: i +async function Sa(t) { + let n = String(t?.filepath || "").trim(), r = String(t?.display_name || t?.filename || "").replace(/\.json$/i, ""), i = await wt(R("ctx.renameWorkflow", "Rename workflow"), r, R("tab.workflow", "Workflow")), a = String(i || "").trim(); + if (!a) return; + let o = await g({ + filepath: n, + name: a + }, { timeoutMs: 3e4 }); + if (!o?.ok) { + e(o?.error || R("toast.workflowSaveFailed", "Failed to save workflow."), "error"); + return; + } + e(R("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-rename"); +} +async function Ca(t) { + let n = String(t?.filepath || "").trim(), r = String(t?.subfolder || "").trim(), i = await wt(R("dialog.workflowCategory", "Workflow category"), r, R("tab.workflow", "Workflow")); + if (i == null) return; + let a = await g({ + filepath: n, + category: String(i || "") }, { timeoutMs: 3e4 }); if (!a?.ok) { - k(a?.error || L("toast.workflowSaveFailed", "Failed to save workflow."), "error"); + e(a?.error || R("toast.workflowSaveFailed", "Failed to save workflow."), "error"); return; } - k(L("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-rename"); + e(R("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-categorize"); } -async function Ca(e) { - let t = String(e?.filepath || "").trim(), n = String(e?.subfolder || "").trim(), r = await Tt(L("dialog.workflowCategory", "Workflow category"), n, L("tab.workflow", "Workflow")); - if (r == null) return; - let i = await y({ - filepath: t, - category: String(r || "") - }, { timeoutMs: 3e4 }); - if (!i?.ok) { - k(i?.error || L("toast.workflowSaveFailed", "Failed to save workflow."), "error"); +async function wa(t) { + let n = String(t?.filepath || "").trim(); + if (!n) { + e(R("toast.noFilePath"), "error"); return; } - k(L("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-categorize"); -} -async function wa(e) { - let t = String(e?.filepath || "").trim(); - if (!t) { - k(L("toast.noFilePath"), "error"); - return; - } - let n = await Ee({ - filepath: t, + let r = await we({ + filepath: n, limit: 12 }, { timeoutMs: 15e3 }); - if (!n?.ok) { - k(n?.error || L("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + if (!r?.ok) { + e(r?.error || R("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - let r = Array.isArray(n.data) ? n.data : []; - if (!r.length) { - k(L("toast.workflowThumbnailNoCandidates", "No linked outputs are available for this workflow yet."), "warning", 2600); + let i = Array.isArray(r.data) ? r.data : []; + if (!i.length) { + e(R("toast.workflowThumbnailNoCandidates", "No linked outputs are available for this workflow yet."), "warning", 2600); return; } - let i = await kn({ - title: L("ctx.setWorkflowThumbnail", "Set workflow thumbnail"), - workflow: e, - items: r + let a = await On({ + title: R("ctx.setWorkflowThumbnail", "Set workflow thumbnail"), + workflow: t, + items: i }); - if (!i?.filepath) return; - let a = await v({ - filepath: t, - source_filepath: i.filepath + if (!a?.filepath) return; + let o = await h({ + filepath: n, + source_filepath: a.filepath }, { timeoutMs: 3e4 }); - if (!a?.ok) { - k(a?.error || L("toast.workflowSaveFailed", "Failed to save workflow."), "error"); + if (!o?.ok) { + e(o?.error || R("toast.workflowSaveFailed", "Failed to save workflow."), "error"); return; } - k(L("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-thumbnail"); + e(R("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-thumbnail"); } -async function Ta(e) { - let t = String(e?.filepath || "").trim(); - if (!t) { - k(L("toast.workflowMissingPath", "Workflow file path is missing."), "error"); +async function Ta(t) { + let n = String(t?.filepath || "").trim(); + if (!n) { + e(R("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = await C(t, { timeoutMs: 3e4 }); - if (!n?.ok) { - k(n?.error || L("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + let r = await y(n, { timeoutMs: 3e4 }); + if (!r?.ok) { + e(r?.error || R("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - let r = n?.data?.workflow || n?.workflow || null; - if (!r || typeof r != "object") { - k(L("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + let i = r?.data?.workflow || r?.workflow || null; + if (!i || typeof i != "object") { + e(R("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - let i = String(e?.filename || e?.display_name || "workflow.json").replace(/[\\/:*?"<>|]+/g, "_").replace(/\.json$/i, "") || "workflow", a = new Blob([`${JSON.stringify(r, null, 2)}\n`], { type: "application/json" }), o = URL.createObjectURL(a); + let a = String(t?.filename || t?.display_name || "workflow.json").replace(/[\\/:*?"<>|]+/g, "_").replace(/\.json$/i, "") || "workflow", o = new Blob([`${JSON.stringify(i, null, 2)}\n`], { type: "application/json" }), s = URL.createObjectURL(o); try { - let e = document.createElement("a"); - e.href = o, e.download = `${i}.json`, e.rel = "noopener", document.body.appendChild(e), e.click(), e.remove(), k(L("toast.workflowExported", "Workflow exported"), "success", 1800); + let t = document.createElement("a"); + t.href = s, t.download = `${a}.json`, t.rel = "noopener", document.body.appendChild(t), t.click(), t.remove(), e(R("toast.workflowExported", "Workflow exported"), "success", 1800); } finally { - setTimeout(() => URL.revokeObjectURL(o), 5e3); + setTimeout(() => URL.revokeObjectURL(s), 5e3); } } -async function Ea(e) { - let t = String(e?.filepath || "").trim(); - if (!t) { - k(L("toast.workflowMissingPath", "Workflow file path is missing."), "error"); +async function Ea(t) { + let n = String(t?.filepath || "").trim(); + if (!n) { + e(R("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = await oe({ filepath: t }); - if (!n?.ok) { - k(n?.error || L("toast.openFolderFailed", "Failed to open folder."), "error"); + let r = await ne({ filepath: n }); + if (!r?.ok) { + e(r?.error || R("toast.openFolderFailed", "Failed to open folder."), "error"); return; } - k(L("toast.openedInFolder", "Opened in folder"), "success", 1600); + e(R("toast.openedInFolder", "Opened in folder"), "success", 1600); } -async function Da(e) { - let t = Xi(e); - if (!t) { - k(L("toast.noFilePath"), "error"); +async function Da(t) { + let n = Xi(t); + if (!n) { + e(R("toast.noFilePath"), "error"); return; } - let n = await On({ - title: L("ctx.assignAsWorkflowThumbnail", "Use as workflow thumbnail"), - sourceAsset: e - }), r = String(n?.filepath || "").trim(); - if (!r) return; - let i = String(e?.kind || "").toLowerCase() === "video" || /\.(mp4|webm|mov|mkv|avi|m4v)$/i.test(t); - k(i ? L("toast.workflowThumbnailConverting", "Preparing a 5 second animated workflow thumbnail...") : L("toast.workflowThumbnailApplying", "Applying workflow thumbnail..."), "info", 2200); - let a = await v({ - filepath: r, - source_filepath: t - }, { timeoutMs: i ? 75e3 : 3e4 }); - if (!a?.ok) { - k(a?.error || L("toast.workflowSaveFailed", "Failed to save workflow."), "error"); + let r = await Dn({ + title: R("ctx.assignAsWorkflowThumbnail", "Use as workflow thumbnail"), + sourceAsset: t + }), i = String(r?.filepath || "").trim(); + if (!i) return; + let a = String(t?.kind || "").toLowerCase() === "video" || /\.(mp4|webm|mov|mkv|avi|m4v)$/i.test(n); + e(a ? R("toast.workflowThumbnailConverting", "Preparing a 5 second animated workflow thumbnail...") : R("toast.workflowThumbnailApplying", "Applying workflow thumbnail..."), "info", 2200); + let o = await h({ + filepath: i, + source_filepath: n + }, { timeoutMs: a ? 75e3 : 3e4 }); + if (!o?.ok) { + e(o?.error || R("toast.workflowSaveFailed", "Failed to save workflow."), "error"); return; } - k(L("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-thumbnail-assign"); + e(R("toast.workflowUpdated", "Workflow updated"), "success", 1800), ba("workflow-thumbnail-assign"); } -async function Oa(e) { - let t = String(e?.filepath || "").trim(); - if (!await Wt(L("dialog.deleteWorkflowConfirm", "Delete this workflow JSON and its adjacent thumbnail files?"), L("ctx.deleteWorkflow", "Delete workflow"))) return; - let n = await I({ filepath: t }, { timeoutMs: 3e4 }); - if (!n?.ok) { - k(n?.error || L("toast.fileDeleteFailed", "Failed to delete file."), "error"); +async function Oa(t) { + let n = String(t?.filepath || "").trim(); + if (!await Ut(R("dialog.deleteWorkflowConfirm", "Delete this workflow JSON and its adjacent thumbnail files?"), R("ctx.deleteWorkflow", "Delete workflow"))) return; + let r = await te({ filepath: n }, { timeoutMs: 3e4 }); + if (!r?.ok) { + e(r?.error || R("toast.fileDeleteFailed", "Failed to delete file."), "error"); return; } - k(L("toast.workflowDeleted", "Workflow deleted"), "success", 1800), ba("workflow-delete"); + e(R("toast.workflowDeleted", "Workflow deleted"), "success", 1800), ba("workflow-delete"); } function ka(e) { let t = qi(e), n = Ji(e), r = n.length || t.size; @@ -2054,7 +2054,7 @@ function Aa(e, t) { ua(e, 1, () => r(1)); }, { disabled: !t }), Ki(), - $(L("ctx.resetRating", "Reset rating"), "pi pi-star", "0", async () => { + $(R("ctx.resetRating", "Reset rating"), "pi pi-star", "0", async () => { ua(e, 0, () => r(0)); }, { disabled: !t }) ]; @@ -2065,160 +2065,160 @@ function ja(e, t) { let r = String(e || "").trim().replaceAll("\\", "/"); return r ? `mjr://${n}/${r}` : `mjr://${n}`; } -function Ma({ currentPath: e, gridContainer: t } = {}) { - return [$(L("ctx.createFolderHere", "Create folder here..."), "pi pi-plus", null, async () => { +function Ma({ currentPath: t, gridContainer: n } = {}) { + return [$(R("ctx.createFolderHere", "Create folder here..."), "pi pi-plus", null, async () => { try { - let n = await Tt(L("dialog.newFolderName", "New folder name"), ""), r = String(n || "").trim(); - if (!r) return; - let i = await ke({ + let r = await wt(R("dialog.newFolderName", "New folder name"), ""), i = String(r || "").trim(); + if (!i) return; + let a = await Oe({ op: "create", - path: ja(e, t), - name: r + path: ja(t, n), + name: i }); - if (!i?.ok) { - k(i?.error || "Failed to create folder", "error"); + if (!a?.ok) { + e(a?.error || "Failed to create folder", "error"); return; } - ca(t), k(L("toast.folderCreated", "Folder created: {name}", { name: r }), "success"); - } catch (e) { - k(L("toast.createFolderFailedDetail", "Create folder failed: {error}", { error: e?.message || String(e || "") }), "error"); + ca(n), e(R("toast.folderCreated", "Folder created: {name}", { name: i }), "success"); + } catch (t) { + e(R("toast.createFolderFailedDetail", "Create folder failed: {error}", { error: t?.message || String(t || "") }), "error"); } })]; } -function Na({ asset: e, gridContainer: t, panelState: n } = {}) { - let r = String(e?.filepath || "").trim(), i = [$(L("ctx.openFolder", "Open folder"), "pi pi-folder-open", null, () => { +function Na({ asset: t, gridContainer: n, panelState: r } = {}) { + let i = String(t?.filepath || "").trim(), a = [$(R("ctx.openFolder", "Open folder"), "pi pi-folder-open", null, () => { try { - t.dispatchEvent(new CustomEvent("mjr:open-folder-asset", { + n.dispatchEvent(new CustomEvent("mjr:open-folder-asset", { bubbles: !0, - detail: { asset: e } + detail: { asset: t } })); } catch (e) { console.debug?.(e); } - }), $(L("ctx.pinAsBrowserRoot"), "pi pi-bookmark", null, async () => { - if (!r) { - k(L("toast.unableResolveFolderPath"), "error"); + }), $(R("ctx.pinAsBrowserRoot"), "pi pi-bookmark", null, async () => { + if (!i) { + e(R("toast.unableResolveFolderPath"), "error"); return; } - let t = await Tt(L("dialog.browserRootLabelOptional"), String(e?.filename || "")), n = await le(ct.CUSTOM_ROOTS, { - path: r, - label: String(t || "").trim() || void 0 + let n = await wt(R("dialog.browserRootLabelOptional"), String(t?.filename || "")), r = await L(st.CUSTOM_ROOTS, { + path: i, + label: String(n || "").trim() || void 0 }); - if (!n?.ok) { - k(n?.error || L("toast.pinFolderFailed"), "error"); + if (!r?.ok) { + e(r?.error || R("toast.pinFolderFailed"), "error"); return; } - k(L("toast.folderPinnedAsBrowserRoot"), "success"); + e(R("toast.folderPinnedAsBrowserRoot"), "success"); try { - window.dispatchEvent(new CustomEvent("mjr:custom-roots-changed", { detail: { preferredId: String(n?.data?.id || "") } })); + window.dispatchEvent(new CustomEvent("mjr:custom-roots-changed", { detail: { preferredId: String(r?.data?.id || "") } })); } catch (e) { console.debug?.(e); } })]; - return da(n) && r && i.push(Ki(), $(L("ctx.createFolderHere"), "pi pi-plus", null, async () => { + return da(r) && i && a.push(Ki(), $(R("ctx.createFolderHere"), "pi pi-plus", null, async () => { try { - let e = await Tt(L("dialog.newFolderName"), ""), n = String(e || "").trim(); - if (!n) return; - let i = await ke({ + let t = await wt(R("dialog.newFolderName"), ""), r = String(t || "").trim(); + if (!r) return; + let a = await Oe({ op: "create", - path: r, - name: n + path: i, + name: r }); - if (!i?.ok) { - k(i?.error || L("toast.createFolderFailed"), "error"); + if (!a?.ok) { + e(a?.error || R("toast.createFolderFailed"), "error"); return; } - ca(t), k(L("toast.folderCreated", { name: n }), "success"); - } catch (e) { - k(L("toast.createFolderFailedDetail", { error: e?.message || String(e || "") }), "error"); + ca(n), e(R("toast.folderCreated", { name: r }), "success"); + } catch (t) { + e(R("toast.createFolderFailedDetail", { error: t?.message || String(t || "") }), "error"); } - }), $(L("ctx.renameFolder"), "pi pi-pencil", null, async () => { + }), $(R("ctx.renameFolder"), "pi pi-pencil", null, async () => { try { - let n = String(e?.filename || "").trim(), i = await Tt(L("dialog.renameFolder"), n), a = String(i || "").trim(); - if (!a || a === n) return; - let o = await ke({ + let r = String(t?.filename || "").trim(), a = await wt(R("dialog.renameFolder"), r), o = String(a || "").trim(); + if (!o || o === r) return; + let s = await Oe({ op: "rename", - path: r, - name: a + path: i, + name: o }); - if (!o?.ok) { - k(o?.error || L("toast.renameFolderFailed"), "error"); + if (!s?.ok) { + e(s?.error || R("toast.renameFolderFailed"), "error"); return; } - ca(t), k(L("toast.folderRenamed"), "success"); - } catch (e) { - k(L("toast.renameFolderFailedDetail", { error: e?.message || String(e || "") }), "error"); + ca(n), e(R("toast.folderRenamed"), "success"); + } catch (t) { + e(R("toast.renameFolderFailedDetail", { error: t?.message || String(t || "") }), "error"); } - }), $(L("ctx.moveFolder"), "pi pi-arrow-right", null, async () => { + }), $(R("ctx.moveFolder"), "pi pi-arrow-right", null, async () => { try { - let e = await Tt(L("dialog.destinationDirectoryPath"), ""), n = String(e || "").trim(); - if (!n) return; - let i = await ke({ + let t = await wt(R("dialog.destinationDirectoryPath"), ""), r = String(t || "").trim(); + if (!r) return; + let a = await Oe({ op: "move", - path: r, - destination: n + path: i, + destination: r }); - if (!i?.ok) { - k(i?.error || L("toast.moveFolderFailed"), "error"); + if (!a?.ok) { + e(a?.error || R("toast.moveFolderFailed"), "error"); return; } - ca(t), k(L("toast.folderMoved"), "success"); - } catch (e) { - k(L("toast.moveFolderFailedDetail", { error: e?.message || String(e || "") }), "error"); + ca(n), e(R("toast.folderMoved"), "success"); + } catch (t) { + e(R("toast.moveFolderFailedDetail", { error: t?.message || String(t || "") }), "error"); } - }), $(L("ctx.deleteFolder"), "pi pi-trash", null, async () => { + }), $(R("ctx.deleteFolder"), "pi pi-trash", null, async () => { try { - let n = String(e?.filename || L("label.thisFolder", "this folder")); - if (!await Wt(L("dialog.deleteFolderRecursive", { name: n }))) return; - let i = await ke({ + let r = String(t?.filename || R("label.thisFolder", "this folder")); + if (!await Ut(R("dialog.deleteFolderRecursive", { name: r }))) return; + let a = await Oe({ op: "delete", - path: r, + path: i, recursive: !0 }); - if (!i?.ok) { - k(i?.error || L("toast.deleteFolderFailed"), "error"); + if (!a?.ok) { + e(a?.error || R("toast.deleteFolderFailed"), "error"); return; } - ca(t), k(L("toast.folderDeleted"), "success"); - } catch (e) { - k(L("toast.deleteFolderFailedDetail", { error: e?.message || String(e || "") }), "error"); + ca(n), e(R("toast.folderDeleted"), "success"); + } catch (t) { + e(R("toast.deleteFolderFailedDetail", { error: t?.message || String(t || "") }), "error"); } - })), i; + })), a; } -function Pa({ asset: e, card: t, gridContainer: r, panelState: i, pointerX: a, pointerY: o, selection: s } = {}) { - let { selectedAssetsNow: c, effectiveSelectionCount: u, isMultiSelected: d, hasSelection: f } = s, p = [], m = pa(i), h = ({ assets: e = [], index: t = 0, mode: n = "" } = {}) => Ui().then((r) => r.requestViewerOpen({ +function Pa({ asset: t, card: r, gridContainer: i, panelState: a, pointerX: o, pointerY: s, selection: c } = {}) { + let { selectedAssetsNow: u, effectiveSelectionCount: d, isMultiSelected: f, hasSelection: p } = c, m = [], h = pa(a), g = ({ assets: e = [], index: t = 0, mode: n = "" } = {}) => Ui().then((r) => r.requestViewerOpen({ assets: e, index: t, mode: n })).catch((e) => console.debug?.(e)); - if (ha(e)) { - if (p.push($(L("ctx.loadWorkflow", "Load workflow"), "pi pi-sitemap", null, () => ya(e)), $(L("ctx.duplicateWorkflow", "Duplicate workflow"), "pi pi-copy", null, () => xa(e)), $(L("ctx.renameWorkflow", "Rename workflow"), "pi pi-pencil", null, () => Sa(e)), $(L("ctx.categorizeWorkflow", "Set workflow category"), "pi pi-folder", null, () => Ca(e)), $(L("ctx.setWorkflowThumbnail", "Set workflow thumbnail"), "pi pi-image", null, () => wa(e)), $(L("ctx.editWorkflowInfo", "Edit infos"), "pi pi-info-circle", null, () => Ri(e)), $(L("ctx.exportWorkflow", "Export workflow"), "pi pi-download", null, () => Ta(e)), $(L("ctx.showInExplorer", "Show in Explorer"), "pi pi-folder-open", null, () => Ea(e)), $(L("ctx.deleteWorkflow", "Delete workflow"), "pi pi-trash", null, () => Oa(e)), Ki()), m) return p.push($("Open Graph Map", "pi pi-sitemap", null, async () => { + if (ha(t)) { + if (m.push($(R("ctx.loadWorkflow", "Load workflow"), "pi pi-sitemap", null, () => ya(t)), $(R("ctx.duplicateWorkflow", "Duplicate workflow"), "pi pi-copy", null, () => xa(t)), $(R("ctx.renameWorkflow", "Rename workflow"), "pi pi-pencil", null, () => Sa(t)), $(R("ctx.categorizeWorkflow", "Set workflow category"), "pi pi-folder", null, () => Ca(t)), $(R("ctx.setWorkflowThumbnail", "Set workflow thumbnail"), "pi pi-image", null, () => wa(t)), $(R("ctx.editWorkflowInfo", "Edit infos"), "pi pi-info-circle", null, () => Ri(t)), $(R("ctx.exportWorkflow", "Export workflow"), "pi pi-download", null, () => Ta(t)), $(R("ctx.showInExplorer", "Show in Explorer"), "pi pi-folder-open", null, () => Ea(t)), $(R("ctx.deleteWorkflow", "Delete workflow"), "pi pi-trash", null, () => Oa(t)), Ki()), h) return m.push($("Open Graph Map", "pi pi-sitemap", null, async () => { try { - let t = await Yi(e), { floatingViewerManager: n } = await Wi(); + let e = await Yi(t), { floatingViewerManager: n } = await Wi(); await n.openAssets({ - assets: [t], + assets: [e], index: 0, mode: "graph" }); } catch (e) { console.debug?.(e); } - })), p; - } else if (m) return p; - p.push($("Open As New Tab", "pi pi-external-link", null, () => va(e)), $("Open Viewer", "pi pi-image", Ii("OPEN_VIEWER"), () => { + })), m; + } else if (h) return m; + m.push($("Open As New Tab", "pi pi-external-link", null, () => va(t)), $("Open Viewer", "pi pi-image", Ii("OPEN_VIEWER"), () => { try { - let t = (f ? Ji(r) : []).filter((e) => !ma(e)), n = t.length; + let e = (p ? Ji(i) : []).filter((e) => !ma(e)), n = e.length; if (n >= 2 && n <= 4) { - h({ - assets: t, + g({ + assets: e, index: 0 }); return; } - let i = ia(r).filter((e) => !ma(e)), a = aa(i, e?.id); - if (!i.length || a < 0) return; - h({ - assets: i, + let r = ia(i).filter((e) => !ma(e)), a = aa(r, t?.id); + if (!r.length || a < 0) return; + g({ + assets: r, index: Math.max(0, a) }); } catch (e) { @@ -2226,201 +2226,201 @@ function Pa({ asset: e, card: t, gridContainer: r, panelState: i, pointerX: a, p } }), $("Open in Floating Viewer", "pi pi-window-maximize", Ii("OPEN_FLOATING_VIEWER"), async () => { try { - let { floatingViewerManager: t } = await Wi(), n = (f ? Ji(r) : []).filter((e) => !ma(e)); + let { floatingViewerManager: e } = await Wi(), n = (p ? Ji(i) : []).filter((e) => !ma(e)); if (n.length) { - await t.openAssets({ + await e.openAssets({ assets: n, - index: Math.max(0, n.findIndex((t) => String(t?.id || "") === String(e?.id || ""))) + index: Math.max(0, n.findIndex((e) => String(e?.id || "") === String(t?.id || ""))) }); return; } - await t.openAssets({ - assets: [e], + await e.openAssets({ + assets: [t], index: 0 }); } catch (e) { console.debug?.(e); } }), $("Load Asset", "pi pi-upload", "L / L+Drop", async () => { - let t = (f ? Ji(r) : []).filter((e) => !ma(e)); - await ta(t.length ? t : [e]) || k("Failed to create a loader node for this asset.", "error"); + let n = (p ? Ji(i) : []).filter((e) => !ma(e)); + await ta(n.length ? n : [t]) || e("Failed to create a loader node for this asset.", "error"); }), $("Open Graph Map", "pi pi-sitemap", null, async () => { try { - let t = await Yi(e), { floatingViewerManager: n } = await Wi(); + let e = await Yi(t), { floatingViewerManager: n } = await Wi(); await n.openAssets({ - assets: [t], + assets: [e], index: 0, mode: "graph" }); } catch (e) { console.debug?.(e); } - }), $(L("ctx.showMetadataPanel", "Show metadata panel"), "pi pi-info-circle", Ii("METADATA_PANEL"), () => { + }), $(R("ctx.showMetadataPanel", "Show metadata panel"), "pi pi-info-circle", Ii("METADATA_PANEL"), () => { try { - ra(r, t, e, i); - let n = r?._mjrOpenDetails; - typeof n == "function" && n(); + ra(i, r, t, a); + let e = i?._mjrOpenDetails; + typeof e == "function" && e(); } catch (e) { console.debug?.(e); } - })), ga(e) && p.push($(L("ctx.assignAsWorkflowThumbnail", "Use as workflow thumbnail"), "pi pi-image", null, () => Da(e))); - let g = (f ? c : []).filter((e) => !ma(e)), _ = g.length; - _ === 2 && p.push($("Compare A/B (2 selected)", "pi pi-clone", Ii("COMPARE_AB"), () => { + })), ga(t) && m.push($(R("ctx.assignAsWorkflowThumbnail", "Use as workflow thumbnail"), "pi pi-image", null, () => Da(t))); + let _ = (p ? u : []).filter((e) => !ma(e)), v = _.length; + v === 2 && m.push($("Compare A/B (2 selected)", "pi pi-clone", Ii("COMPARE_AB"), () => { try { - h({ - assets: g, + g({ + assets: _, index: 0, mode: "ab" }); } catch (e) { console.debug?.(e); } - })), _ >= 2 && _ <= 4 && p.push($(`Side-by-side (2x2) (${_} selected)`, "pi pi-table", Ii("SIDE_BY_SIDE"), () => { + })), v >= 2 && v <= 4 && m.push($(`Side-by-side (2x2) (${v} selected)`, "pi pi-table", Ii("SIDE_BY_SIDE"), () => { try { - h({ - assets: g, + g({ + assets: _, index: 0, mode: "sidebyside" }); } catch (e) { console.debug?.(e); } - })), p.push($(L("ctx.openInFolder", "Open in folder"), "pi pi-folder-open", Ii("OPEN_IN_FOLDER"), async () => { - let t = await oe(e); - t?.ok ? k(L("toast.openedInFolder"), "info", 2e3) : k(t?.error || L("toast.openFolderFailed"), "error"); - }, { disabled: !(e?.id || Xi(e)) }), $(L("ctx.collectFiles", "Collect files"), "pi pi-box", null, async () => { - k(L("toast.collectingFiles", "Collecting files..."), "info", 2500); - let t = await n(e); - if (!t?.ok) { - k(t?.error || L("toast.collectFilesFailed", "Collect files failed"), "error"); + })), m.push($(R("ctx.openInFolder", "Open in folder"), "pi pi-folder-open", Ii("OPEN_IN_FOLDER"), async () => { + let n = await ne(t); + n?.ok ? e(R("toast.openedInFolder"), "info", 2e3) : e(n?.error || R("toast.openFolderFailed"), "error"); + }, { disabled: !(t?.id || Xi(t)) }), $(R("ctx.collectFiles", "Collect files"), "pi pi-box", null, async () => { + e(R("toast.collectingFiles", "Collecting files..."), "info", 2500); + let r = await n(t); + if (!r?.ok) { + e(r?.error || R("toast.collectFilesFailed", "Collect files failed"), "error"); return; } - let r = t?.data || {}, i = Array.isArray(r.missing) ? r.missing.length : 0, a = r.fallback_used ? L("toast.collectFallbackDir", "output folder (source folder not writable)") : L("toast.collectSameDir", "asset folder"), o = L("toast.collectedFiles", "Collected {name} in {where}", { - name: String(r.zip_name || "zip"), - where: a + let i = r?.data || {}, a = Array.isArray(i.missing) ? i.missing.length : 0, o = i.fallback_used ? R("toast.collectFallbackDir", "output folder (source folder not writable)") : R("toast.collectSameDir", "asset folder"), s = R("toast.collectedFiles", "Collected {name} in {where}", { + name: String(i.zip_name || "zip"), + where: o }); - i > 0 && (o += ` — ${i} ${L("toast.collectMissingInputs", "input(s) missing")}`), k(o, i > 0 ? "warning" : "success", 6e3); - }, { disabled: !Xi(e) }), $(L("ctx.copyPath", "Copy path"), "pi pi-copy", Ii("COPY_PATH"), async () => { - let t = e?.filepath ? String(e.filepath) : ""; - if (!t) { - k(L("toast.noFilePath"), "error"); + a > 0 && (s += ` — ${a} ${R("toast.collectMissingInputs", "input(s) missing")}`), e(s, a > 0 ? "warning" : "success", 6e3); + }, { disabled: !Xi(t) }), $(R("ctx.copyPath", "Copy path"), "pi pi-copy", Ii("COPY_PATH"), async () => { + let n = t?.filepath ? String(t.filepath) : ""; + if (!n) { + e(R("toast.noFilePath"), "error"); return; } try { - await navigator.clipboard.writeText(t), k(L("toast.pathCopied"), "success", 2e3); - } catch (e) { - console.warn(L("log.clipboardCopyFailed", "Clipboard copy failed"), e), k(L("toast.pathCopyFailed"), "error"); + await navigator.clipboard.writeText(n), e(R("toast.pathCopied"), "success", 2e3); + } catch (t) { + console.warn(R("log.clipboardCopyFailed", "Clipboard copy failed"), t), e(R("toast.pathCopyFailed"), "error"); } - }), $(L("ctx.download", "Download"), "pi pi-download", Ii("DOWNLOAD"), () => { - if (!e?.filepath) return; - let t = Je(e.filepath), n = e.filename || "download"; - $i(t, n), k(L("toast.downloadingFile", "Downloading {filename}...", { filename: n }), "info", 3e3); - }, { disabled: !e?.filepath }), $(`Download selected as ZIP (${_})`, "pi pi-file-zip", null, async () => { - await ea(g); - }, { disabled: _ < 2 }), $("Add to collection...", "pi pi-bookmark", Ii("ADD_TO_COLLECTION"), async () => { - let t = Ji(r), n = t.length ? t : [e]; - await zt({ - x: a, - y: o, + }), $(R("ctx.download", "Download"), "pi pi-download", Ii("DOWNLOAD"), () => { + if (!t?.filepath) return; + let n = qe(t.filepath), r = t.filename || "download"; + $i(n, r), e(R("toast.downloadingFile", "Downloading {filename}...", { filename: r }), "info", 3e3); + }, { disabled: !t?.filepath }), $(`Download selected as ZIP (${v})`, "pi pi-file-zip", null, async () => { + await ea(_); + }, { disabled: v < 2 }), $("Add to collection...", "pi pi-bookmark", Ii("ADD_TO_COLLECTION"), async () => { + let e = Ji(i), n = e.length ? e : [t]; + await Rt({ + x: o, + y: s, assets: n }); })); - let v = String(i?.collectionId || "").trim(); - if (v) { - let t = Ji(r), n = (t.length ? t : [e]).map(Xi).filter(Boolean), i = n.length > 1 ? `Remove from collection (${n.length})` : "Remove from collection"; - p.push($(i, "pi pi-bookmark", null, async () => { - if (!n.length) { - k(L("toast.noFilePath"), "error"); + let y = String(a?.collectionId || "").trim(); + if (y) { + let n = Ji(i), r = (n.length ? n : [t]).map(Xi).filter(Boolean), a = r.length > 1 ? `Remove from collection (${r.length})` : "Remove from collection"; + m.push($(a, "pi pi-bookmark", null, async () => { + if (!r.length) { + e(R("toast.noFilePath"), "error"); return; } - let e = await ie(v, n); - if (!e?.ok) { - k(e?.error || L("toast.removeFromCollectionFailed"), "error"); + let t = await k(y, r); + if (!t?.ok) { + e(t?.error || R("toast.removeFromCollectionFailed"), "error"); return; } - ca(r); + ca(i); })); } - let y = !!(e?.id || Xi(e)); - return p.push(Ki(), $(L("ctx.editTags", "Edit tags"), "pi pi-tags", Ii("EDIT_TAGS"), () => { - Fa(a + 6, o + 6, e, () => { - sa(e, { tags: Array.isArray(e?.tags) ? [...e.tags] : [] }); + let b = !!(t?.id || Xi(t)); + return m.push(Ki(), $(R("ctx.editTags", "Edit tags"), "pi pi-tags", Ii("EDIT_TAGS"), () => { + Fa(o + 6, s + 6, t, () => { + sa(t, { tags: Array.isArray(t?.tags) ? [...t.tags] : [] }); }); - }, { closeOnSelect: !1 }), Ki(), $(L("ctx.setRating", "Set rating"), "pi pi-star", "1-5 >", null, { - disabled: !y, + }, { closeOnSelect: !1 }), Ki(), $(R("ctx.setRating", "Set rating"), "pi pi-star", "1-5 >", null, { + disabled: !b, closeOnSelect: !1, - submenu: Aa(e, y) - }), Ki(), $(L("ctx.resetIndexFile", "Reset index (this file)"), "pi pi-refresh", null, async () => { - if (e?.filename || e?.id) { - k(L("toast.rescanningFile", "Rescanning file..."), "info", 1600); + submenu: Aa(t, b) + }), Ki(), $(R("ctx.resetIndexFile", "Reset index (this file)"), "pi pi-refresh", null, async () => { + if (t?.filename || t?.id) { + e(R("toast.rescanningFile", "Rescanning file..."), "info", 1600); try { - let t = await la(e, r); - t?.ok ? k(L("toast.metadataRefreshed", "Metadata refreshed{suffix}", { suffix: "" }), "success", 1800) : k(t?.error || L("toast.resetFailed", "Failed to reset index"), "error"); - } catch (e) { - k(`${L("toast.resetFailed", "Failed to reset index")}: ${e?.message || String(e || "")}`, "error"); + let n = await la(t, i); + n?.ok ? e(R("toast.metadataRefreshed", "Metadata refreshed{suffix}", { suffix: "" }), "success", 1800) : e(n?.error || R("toast.resetFailed", "Failed to reset index"), "error"); + } catch (t) { + e(`${R("toast.resetFailed", "Failed to reset index")}: ${t?.message || String(t || "")}`, "error"); } } - }, { disabled: !(e?.filename || e?.id) }), $("Rename...", "pi pi-pencil", Ii("RENAME"), async () => { - if (!(e?.id || Xi(e))) return; - let t = e.filename || "", n = await Tt(L("dialog.rename.title", "Rename file"), t), i = yt(n, t); - if (!i || i === t) return; - let a = kt(i); - if (!a.valid) { - k(a.reason, "error"); + }, { disabled: !(t?.filename || t?.id) }), $("Rename...", "pi pi-pencil", Ii("RENAME"), async () => { + if (!(t?.id || Xi(t))) return; + let n = t.filename || "", r = await wt(R("dialog.rename.title", "Rename file"), n), a = vt(r, n); + if (!a || a === n) return; + let o = Ot(a); + if (!o.valid) { + e(o.reason, "error"); return; } try { - let t = await j(e, i); - if (!t?.ok) { - k(t?.error || L("toast.fileRenameFailed"), "error"); + let n = await Ce(t, a); + if (!n?.ok) { + e(n?.error || R("toast.fileRenameFailed"), "error"); return; } - let n = t?.data?.asset; - n && typeof n == "object" ? (Object.assign(e, n), sa(e, n)) : (e.filename = i, e.filepath &&= String(e.filepath).replace(/[^\\/]+$/, i), e.path &&= String(e.path).replace(/[^\\/]+$/, i), e.file_info && typeof e.file_info == "object" && (e.file_info.filename = i, e.file_info.filepath && (e.file_info.filepath = String(e.file_info.filepath).replace(/[^\\/]+$/, i)), e.file_info.path && (e.file_info.path = String(e.file_info.path).replace(/[^\\/]+$/, i))), sa(e, { - filename: e.filename, - filepath: e.filepath, - path: e.path, - file_info: e.file_info + let r = n?.data?.asset; + r && typeof r == "object" ? (Object.assign(t, r), sa(t, r)) : (t.filename = a, t.filepath &&= String(t.filepath).replace(/[^\\/]+$/, a), t.path &&= String(t.path).replace(/[^\\/]+$/, a), t.file_info && typeof t.file_info == "object" && (t.file_info.filename = a, t.file_info.filepath && (t.file_info.filepath = String(t.file_info.filepath).replace(/[^\\/]+$/, a)), t.file_info.path && (t.file_info.path = String(t.file_info.path).replace(/[^\\/]+$/, a))), sa(t, { + filename: t.filename, + filepath: t.filepath, + path: t.path, + file_info: t.file_info })); - let a = oa(e.id)?.querySelector?.(".mjr-filename"); - a && (a.textContent = e.filename || i), k(L("toast.fileRenamedSuccess"), "success"), ca(r); - } catch (e) { - k(L("toast.errorRenaming", "Error renaming file: {error}", { error: e?.message || String(e || "") }), "error"); + let o = oa(t.id)?.querySelector?.(".mjr-filename"); + o && (o.textContent = t.filename || a), e(R("toast.fileRenamedSuccess"), "success"), ca(i); + } catch (t) { + e(R("toast.errorRenaming", "Error renaming file: {error}", { error: t?.message || String(t || "") }), "error"); } - }, { disabled: !(e?.id || Xi(e)) })), d ? p.push($(`Delete ${u} files...`, "pi pi-trash", Ii("DELETE"), async () => { - if (await vt(Number(u) || 0)) try { - let t = 0, n = 0, a = [], o = 0, s = c.length ? c : [e]; - for (let e of s) (await l(e))?.ok ? (t += 1, e?.id == null ? o += 1 : a.push(String(e.id))) : n += 1; - if (a.length) { - let e = Si(r, a); - i && Array.isArray(e?.selectedIds) && (i.selectedAssetIds = e.selectedIds, i.activeAssetId = e.selectedIds[0] || ""); + }, { disabled: !(t?.id || Xi(t)) })), f ? m.push($(`Delete ${d} files...`, "pi pi-trash", Ii("DELETE"), async () => { + if (await _t(Number(d) || 0)) try { + let n = 0, r = 0, o = [], s = 0, c = u.length ? u : [t]; + for (let e of c) (await l(e))?.ok ? (n += 1, e?.id == null ? s += 1 : o.push(String(e.id))) : r += 1; + if (o.length) { + let e = Si(i, o); + a && Array.isArray(e?.selectedIds) && (a.selectedAssetIds = e.selectedIds, a.activeAssetId = e.selectedIds[0] || ""); } - o > 0 && ca(r), n === 0 ? k(L("toast.filesDeletedSuccessN", "{n} files deleted successfully!", { n: t }), "success") : k(L("toast.filesDeletedPartial", "{success} files deleted, {failed} failed.", { - success: t, - failed: n + s > 0 && ca(i), r === 0 ? e(R("toast.filesDeletedSuccessN", "{n} files deleted successfully!", { n }), "success") : e(R("toast.filesDeletedPartial", "{success} files deleted, {failed} failed.", { + success: n, + failed: r }), "warning"); - } catch (e) { - k(L("toast.errorDeleting", "Error deleting file: {error}", { error: e?.message || String(e || "") }), "error"); + } catch (t) { + e(R("toast.errorDeleting", "Error deleting file: {error}", { error: t?.message || String(t || "") }), "error"); } - })) : p.push($(L("ctx.delete", "Delete"), "pi pi-trash", Ii("DELETE"), async () => { - if (await vt(1, e?.filename)) try { - let t = await l(e); - if (!t?.ok) { - k(t?.error || L("toast.fileDeleteFailed"), "error"); + })) : m.push($(R("ctx.delete", "Delete"), "pi pi-trash", Ii("DELETE"), async () => { + if (await _t(1, t?.filename)) try { + let n = await l(t); + if (!n?.ok) { + e(n?.error || R("toast.fileDeleteFailed"), "error"); return; } - if (e?.id) { - let t = Si(r, [String(e.id)]); - i && Array.isArray(t?.selectedIds) && (i.selectedAssetIds = t.selectedIds, i.activeAssetId = t.selectedIds[0] || ""); - } else ca(r); - k(L("toast.fileDeletedSuccess"), "success"); - } catch (e) { - k(L("toast.errorDeleting", "Error deleting file: {error}", { error: e?.message || String(e || "") }), "error"); + if (t?.id) { + let e = Si(i, [String(t.id)]); + a && Array.isArray(e?.selectedIds) && (a.selectedAssetIds = e.selectedIds, a.activeAssetId = e.selectedIds[0] || ""); + } else ca(i); + e(R("toast.fileDeletedSuccess"), "success"); + } catch (t) { + e(R("toast.errorDeleting", "Error deleting file: {error}", { error: t?.message || String(t || "") }), "error"); } - }, { disabled: !(e?.id || Xi(e)) })), p; + }, { disabled: !(t?.id || Xi(t)) })), m; } function Fa(e, t, n, r) { - n && Rn({ + n && Ln({ x: e, y: t, asset: n, @@ -2437,12 +2437,12 @@ function Ia({ gridContainer: e, getState: t = () => ({}) } = {}) { } catch { return {}; } - })(), i = Nt(n.target, ".mjr-asset-card"); + })(), i = Mt(n.target, ".mjr-asset-card"); if (!i) { if (!da(r)) return; let t = String(e?.dataset?.mjrScope || "").toLowerCase(), i = String(e?.dataset?.mjrSubfolder || "").trim(), a = (t === "input" || t === "output") && fa(); if (!i && !a) return; - n.preventDefault(), n.stopPropagation(), nn({ + n.preventDefault(), n.stopPropagation(), tn({ x: n.clientX, y: n.clientY, items: Ma({ @@ -2468,7 +2468,7 @@ function Ia({ gridContainer: e, getState: t = () => ({}) } = {}) { pointerY: n.clientY, selection: o }); - nn({ + tn({ x: n.clientX, y: n.clientY, items: s @@ -2497,12 +2497,12 @@ function Ia({ gridContainer: e, getState: t = () => ({}) } = {}) { console.debug?.(e); } try { - Gt(); + Wt(); } catch (e) { console.debug?.(e); } try { - _n(); + gn(); } catch (e) { console.debug?.(e); } @@ -2511,7 +2511,7 @@ function Ia({ gridContainer: e, getState: t = () => ({}) } = {}) { } //#endregion //#region ui/features/panel/controllers/ratingHotkeysController.ts -var La = st; +var La = ot; function Ra(e) { let t = String(e ?? ""); try { @@ -2524,7 +2524,7 @@ function Ra(e) { function za(e, t = null) { if (!e) return []; try { - let t = Array.from(Yn(e)); + let t = Array.from(Jn(e)); if (t.length) return t; } catch (e) { console.debug?.(e); @@ -2572,24 +2572,24 @@ async function Ha(e, t, n = 5) { for (let t = 0; t < Math.min(r, e.length); t += 1) a.push(o()); await Promise.all(a); } -function Ua({ gridContainer: e, createRatingBadge: t } = {}) { - let n = !1, r = null, i = null, a = async (e, t) => { - if (e != null) { +function Ua({ gridContainer: t, createRatingBadge: n } = {}) { + let r = !1, i = null, a = null, o = async (t, n) => { + if (t != null) { try { - let n = await b(e, t); - if (!n?.ok) { - k(n?.error || L("toast.ratingUpdateFailed"), "error"); + let r = await _(t, n); + if (!r?.ok) { + e(r?.error || R("toast.ratingUpdateFailed"), "error"); return; } - k(L("toast.ratingSetN", { n: t }), "success", 1500); + e(R("toast.ratingSetN", { n }), "success", 1500); } catch { - k(L("toast.ratingUpdateError"), "error"); + e(R("toast.ratingUpdateError"), "error"); return; } try { window.dispatchEvent(new CustomEvent(La, { detail: { - assetId: String(e), - rating: t + assetId: String(t), + rating: n } })); } catch (e) { console.debug?.(e); @@ -2598,53 +2598,53 @@ function Ua({ gridContainer: e, createRatingBadge: t } = {}) { }; return { bind: () => { - if (!(n || !e)) { - n = !0, de(!0), r = async (t) => { - if (Se() || ge().scope === "viewer" || t.defaultPrevented) return; + if (!r && t) { + r = !0, ce(!0), i = async (e) => { + if (ve() || fe().scope === "viewer" || e.defaultPrevented) return; let n = (e) => !!(e?.isContentEditable || e?.closest?.("input, textarea, select, [contenteditable]:not([contenteditable='false'])")); - if (t.isComposing || n(t.target) || n(document.activeElement)) return; - let r = String(t.key || ""); + if (e.isComposing || n(e.target) || n(document.activeElement)) return; + let r = String(e.key || ""); if (r !== "0" && r !== "1" && r !== "2" && r !== "3" && r !== "4" && r !== "5") return; let i = document.querySelector(".mjr-viewer-overlay"); if (i && i.style.display !== "none") return; - let o = e.contains(t.target) || e === t.target, s = !!t.target?.closest?.(".mjr-mfv"), c = !!document.querySelector(".mjr-mfv.is-visible"); - if (!o && !s && !c) return; + let a = t.contains(e.target) || t === e.target, s = !!e.target?.closest?.(".mjr-mfv"), c = !!document.querySelector(".mjr-mfv.is-visible"); + if (!a && !s && !c) return; let l = r === "0" ? 0 : Number(r); if (!Number.isFinite(l)) return; - let u = za(e, t.target); - u.length && (t.preventDefault(), t.stopPropagation(), t.stopImmediatePropagation?.(), await Ha(u, (e) => a(e, l), 5)); - }, i = (n) => { - let r = n?.detail || {}, i = r.assetId ?? r.id ?? null, a = Number(r.rating); + let u = za(t, e.target); + u.length && (e.preventDefault(), e.stopPropagation(), e.stopImmediatePropagation?.(), await Ha(u, (e) => o(e, l), 5)); + }, a = (e) => { + let r = e?.detail || {}, i = r.assetId ?? r.id ?? null, a = Number(r.rating); if (!i || !Number.isFinite(a)) return; - let o = Ba(e, i); - o && Va(o, t, a); + let o = Ba(t, i); + o && Va(o, n, a); }; try { - window.addEventListener("keydown", r, { capture: !0 }); + window.addEventListener("keydown", i, { capture: !0 }); } catch (e) { console.debug?.(e); } try { - window.addEventListener(La, i); + window.addEventListener(La, a); } catch (e) { console.debug?.(e); } } }, dispose: () => { - if (n) { - n = !1, de(!1); + if (r) { + r = !1, ce(!1); try { - window.removeEventListener("keydown", r, { capture: !0 }); + window.removeEventListener("keydown", i, { capture: !0 }); } catch (e) { console.debug?.(e); } try { - window.removeEventListener(La, i); + window.removeEventListener(La, a); } catch (e) { console.debug?.(e); } - r = null, i = null; + i = null, a = null; } } }; @@ -2711,7 +2711,7 @@ function Xa(e, t, n) { let e = a?._mjrGridContainer, t = a?._mjrAsset; if (!e || !t) return; let n = Array.isArray(t._mjrDupMembers) ? t._mjrDupMembers : [t], r = n.length; - e.dispatchEvent(new CustomEvent(B.OPEN_STACK_GROUP, { + e.dispatchEvent(new CustomEvent(V.OPEN_STACK_GROUP, { bubbles: !0, detail: { asset: t, @@ -2745,7 +2745,7 @@ var Za = () => { Za() && console.debug("[Majoor.DnD]", ...e); }, $a = (e, { buildCustomViewURL: t, buildViewURL: n }) => { let r = String(e?.type || "output").toLowerCase(); - return r === "custom" ? t(e?.filename || "", e?.subfolder || "", Ne(e)) : r === "input" ? n(e?.filename || "", e?.subfolder || "", "input") : r === "temp" ? n(e?.filename || "", e?.subfolder || "", "temp") : n(e?.filename || "", e?.subfolder || "", "output"); + return r === "custom" ? t(e?.filename || "", e?.subfolder || "", Me(e)) : r === "input" ? n(e?.filename || "", e?.subfolder || "", "input") : r === "temp" ? n(e?.filename || "", e?.subfolder || "", "temp") : n(e?.filename || "", e?.subfolder || "", "output"); }, eo = (e) => { if (!e || typeof e != "object") return null; let t = String(e.filename || "").trim(); @@ -2794,7 +2794,7 @@ var fo = (e) => { } catch { return String(e || ""); } -}, po = () => qe("mjr_", 24), mo = (e) => { +}, po = () => Ke("mjr_", 24), mo = (e) => { let t = e && typeof e == "object" ? e : null; if (!t) return null; let n = t.filename || t.name; @@ -2802,7 +2802,7 @@ var fo = (e) => { filename: n, subfolder: t.subfolder || "", type: String(t.type || "output").toLowerCase(), - root_id: Ne(t) || void 0 + root_id: Me(t) || void 0 } : null; }, ho = (e, t) => { let n = []; @@ -2851,7 +2851,7 @@ var fo = (e) => { } for (let e of a) { let t = e?._mjrAsset; - !t || typeof t != "object" || n.push(t); + t && typeof t == "object" && n.push(t); } return n; }, go = (e) => { @@ -2872,7 +2872,7 @@ var fo = (e) => { } if (n) { try { - le(ct.BATCH_ZIP_CREATE, { + L(st.BATCH_ZIP_CREATE, { token: n, items: t, strip_metadata: !!a @@ -2880,7 +2880,7 @@ var fo = (e) => { } catch (e) { console.debug?.(e); } - let r = fo($e(n)), i = a ? `Majoor_Clean_Batch_${t.length}.zip` : `Majoor_Batch_${t.length}.zip`; + let r = fo(Qe(n)), i = a ? `Majoor_Clean_Batch_${t.length}.zip` : `Majoor_Batch_${t.length}.zip`; try { e.setData("text/uri-list", r), e.setData("DownloadURL", `application/zip:${i}:${r}`), e.effectAllowed = "copyMove"; } catch (e) { @@ -2892,14 +2892,14 @@ var fo = (e) => { } let s = t.filename || t.name; if (!s) return; - let c = a ? go(t) : "", l = fo((c ? Ke(c) : "") || i), u = tn(s); + let c = a ? go(t) : "", l = fo((c ? Ge(c) : "") || i), u = en(s); try { e.setData("text/uri-list", l), e.setData("DownloadURL", `${u}:${s}:${l}`), e.effectAllowed = "copyMove"; } catch (e) { console.debug?.(e); } }, vo = (e, { asset: t, containerEl: n, card: r }) => { - if (!(!e || !t)) try { + if (e && t) try { let t = e?.dataTransfer?.dropEffect; !t || t === "none" || lo(); return; @@ -2907,11 +2907,11 @@ var fo = (e) => { console.debug?.(e); } }, yo = () => { - let e = et(); + let e = $e(); return e && typeof e == "object" ? e : null; }, bo = (e) => $a(e, { - buildCustomViewURL: nt, - buildViewURL: rt + buildCustomViewURL: tt, + buildViewURL: nt }), xo = !1, So = !1, Co = (e) => { try { return !!e?.closest?.("input, textarea, select, [contenteditable='true']"); @@ -2922,10 +2922,10 @@ var fo = (e) => { String(e?.type || "output"), String(e?.filename || ""), String(e?.subfolder || ""), - String(Ne(e) || "") + String(Me(e) || "") ].join("\n"), Do = (e, t) => { if (String(e?.type || e?.file_info?.type || "").toLowerCase() === "custom") return null; - let n = dt(String(e?.filepath || e?.path || e?.fullpath || e?.full_path || e?.file_info?.filepath || e?.file_info?.path || "")).trim(); + let n = ut(String(e?.filepath || e?.path || e?.fullpath || e?.full_path || e?.file_info?.filepath || e?.file_info?.path || "")).trim(); if (!n || !t) return null; let r = n.toLowerCase(), i = t.toLowerCase(); for (let e of [ @@ -2962,7 +2962,7 @@ var fo = (e) => { filename: t, subfolder: n?.subfolder ?? e.subfolder ?? "", type: n?.type ?? String(e.type || "output").toLowerCase(), - root_id: Ne(e) || void 0, + root_id: Me(e) || void 0, kind: String(e.kind || "").toLowerCase(), filepath: String(e.filepath || e.path || e?.file_info?.filepath || "").trim() || void 0 }; @@ -2999,14 +2999,14 @@ var fo = (e) => { }, tags: Array.isArray(t.tags) ? t.tags : [] }; - ko(e, cn, JSON.stringify(a)), r && ko(e, "text/uri-list", r); + ko(e, sn, JSON.stringify(a)), r && ko(e, "text/uri-list", r); }, jo = (e) => { let t = e && typeof e == "object" ? e : null; if (!t) return []; try { let e = window?.__MJR_LAST_SELECTION_GRID__, n = typeof e?._mjrGetSelectedAssets == "function" ? e._mjrGetSelectedAssets() : []; if (Array.isArray(n) && n.length > 1) { - let e = n.map(Oo).filter(an), r = Eo(t); + let e = n.map(Oo).filter(rn), r = Eo(t); if (e.some((e) => Eo(e) === r)) return e; } } catch (e) { @@ -3017,7 +3017,7 @@ var fo = (e) => { try { let n = typeof e?._mjrGetSelectedAssets == "function" ? e._mjrGetSelectedAssets() : []; if (!Array.isArray(n) || n.length <= 1) return []; - let r = n.map(Oo).filter(an), i = Eo(t); + let r = n.map(Oo).filter(rn), i = Eo(t); return r.some((e) => Eo(e) === i) ? r : []; } catch (e) { return console.debug?.(e), []; @@ -3026,7 +3026,7 @@ var fo = (e) => { try { let t = e?.dataTransfer?.getData?.("application/x-mjr-assets") || ""; if (t) { - let e = JSON.parse(t), n = (Array.isArray(e?.items) ? e.items : Array.isArray(e) ? e : []).map(to).filter(an); + let e = JSON.parse(t), n = (Array.isArray(e?.items) ? e.items : Array.isArray(e) ? e : []).map(to).filter(rn); if (n.length) return n; } } catch (e) { @@ -3036,9 +3036,9 @@ var fo = (e) => { }, Po = async (e) => { let t = Array.isArray(e) ? e.filter(Boolean) : []; return t.length ? (await Promise.all(t.map(async (e) => { - let t = (await Hn({ - post: le, - endpoint: ct.STAGE_TO_INPUT, + let t = (await Vn({ + post: L, + endpoint: st.STAGE_TO_INPUT, payload: e, index: !1 }))?.relativePath; @@ -3080,7 +3080,7 @@ var fo = (e) => { for (let [t, n] of Fo.entries()) e - (n?.at || 0) > Io && Fo.delete(t); Fo.size > Lo && Array.from(Fo.entries()).sort((e, t) => (e[1]?.at || 0) - (t[1]?.at || 0)).slice(0, Fo.size - Lo).forEach(([e]) => Fo.delete(e)); }, Zo = async (e, t = null) => { - let n = e && typeof e == "object" ? e : null, r = Ne(n), i = yo(), a = n?.filename ? `${n.type || "output"}:${n.filename}:${n.subfolder || ""}:${r}` : t ? `path:${t}` : null; + let n = e && typeof e == "object" ? e : null, r = Me(n), i = yo(), a = n?.filename ? `${n.type || "output"}:${n.filename}:${n.subfolder || ""}:${r}` : t ? `path:${t}` : null; if (a) { let e = Fo.get(a); if (e && Date.now() - (e.at || 0) < Io) { @@ -3105,14 +3105,14 @@ var fo = (e) => { try { let e = null, o = null; if (String(n?.kind || "").toLowerCase() === "workflow" && n?.filepath) { - let e = await C(String(n.filepath), { timeoutMs: 3e4 }); + let e = await y(String(n.filepath), { timeoutMs: 3e4 }); o = e?.ok && (e?.data?.workflow || e?.workflow) || null; } else if (n?.filename) { - let t = `${ct.WORKFLOW_QUICK}?type=${encodeURIComponent(n.type || "output")}&filename=${encodeURIComponent(n.filename)}&subfolder=${encodeURIComponent(n.subfolder || "")}` + (r ? `&root_id=${encodeURIComponent(r)}` : ""), i = await ae(t); - i?.ok && i.workflow && (o = i.workflow), o || (e = `${ct.METADATA}?workflow_only=1&type=${encodeURIComponent(n.type || "output")}&filename=${encodeURIComponent(n.filename)}&subfolder=${encodeURIComponent(n.subfolder || "")}&root_id=${encodeURIComponent(r)}`); - } else t && (e = `${ct.METADATA}?workflow_only=1&path=${encodeURIComponent(String(t))}`); + let t = `${st.WORKFLOW_QUICK}?type=${encodeURIComponent(n.type || "output")}&filename=${encodeURIComponent(n.filename)}&subfolder=${encodeURIComponent(n.subfolder || "")}` + (r ? `&root_id=${encodeURIComponent(r)}` : ""), i = await re(t); + i?.ok && i.workflow && (o = i.workflow), o || (e = `${st.METADATA}?workflow_only=1&type=${encodeURIComponent(n.type || "output")}&filename=${encodeURIComponent(n.filename)}&subfolder=${encodeURIComponent(n.subfolder || "")}&root_id=${encodeURIComponent(r)}`); + } else t && (e = `${st.METADATA}?workflow_only=1&path=${encodeURIComponent(String(t))}`); if (!o && e) { - let t = await ae(e); + let t = await re(e); if (!t?.ok || !t.data) return !1; o = t.data?.workflow; } @@ -3148,15 +3148,15 @@ function Qo(e) { filename: i.filename, subfolder: o?.subfolder ?? i.subfolder ?? "", type: s, - root_id: Ne(i) || void 0, + root_id: Me(i) || void 0, kind: a, filepath: String(i.filepath || i.path || i?.file_info?.filepath || "").trim() || void 0 }; try { let t = wo(); - ko(n, mn, JSON.stringify(c)); + ko(n, pn, JSON.stringify(c)); let o = Mo(e, c); - o.length > 1 && ko(n, Un, JSON.stringify({ items: o })), ko(n, "text/plain", String(i.filename || "")); + o.length > 1 && ko(n, Hn, JSON.stringify({ items: o })), ko(n, "text/plain", String(i.filename || "")); let s = a === "workflow" ? "" : bo(c); Ao({ dt: n, @@ -3208,16 +3208,16 @@ var $o = (e) => { }); }, es = null, ts = 0; function ns() { - let e = (e) => { + let t = (e) => { if (Co(e?.target)) return; let t = String(e?.key || "").toLowerCase(); t === "s" ? xo = !0 : t === "l" && (So = !0); - }, t = (e) => { + }, n = (e) => { let t = String(e?.key || "").toLowerCase(); t === "s" ? xo = !1 : t === "l" && (So = !1); - }, n = () => { + }, r = () => { xo = !1, So = !1; - }, r = /* @__PURE__ */ new Set([ + }, i = /* @__PURE__ */ new Set([ "mp3", "wav", "ogg", @@ -3225,7 +3225,7 @@ function ns() { "m4a", "aac", "opus" - ]), i = /* @__PURE__ */ new Set([ + ]), a = /* @__PURE__ */ new Set([ "mp4", "webm", "mkv", @@ -3234,7 +3234,7 @@ function ns() { "m4v", "flv", "wmv" - ]), a = (e, t) => String(e?.kind || "").toLowerCase() === "video" || i.has(String(t || "").toLowerCase()), o = (e, t, n, r) => { + ]), o = (e, t) => String(e?.kind || "").toLowerCase() === "video" || a.has(String(t || "").toLowerCase()), s = (e, t, n, r) => { let i = () => { let i = Number(n?.duration) || 0; if (!Number.isFinite(i) || i <= 0) return; @@ -3283,138 +3283,138 @@ function ns() { console.debug?.(e); } }, { once: !0 }), n.addEventListener?.("seeked", a, { once: !0 }); - }, s = async (e, t, n) => { - let i = null; - if (e._ghostSegmentId && e._previewSegments) { - let t = e._previewSegments.find((t) => t.id === e._ghostSegmentId); - t && (i = t.resolvedStart === void 0 ? t.start : t.resolvedStart); + }, c = async (t, n, r) => { + let a = null; + if (t._ghostSegmentId && t._previewSegments) { + let e = t._previewSegments.find((e) => e.id === t._ghostSegmentId); + e && (a = e.resolvedStart === void 0 ? e.start : e.resolvedStart); } - e._ghostSegmentId = null, e._ghostTrack = null, e._ghostInitialTimeline = null, e._previewSegments = null, e.render?.(); - let s = String(n || "").toLowerCase(), c = r.has(s), l = await Hn({ - post: le, - endpoint: ct.STAGE_TO_INPUT, - payload: t, + t._ghostSegmentId = null, t._ghostTrack = null, t._ghostInitialTimeline = null, t._previewSegments = null, t.render?.(); + let c = String(r || "").toLowerCase(), l = i.has(c), u = await Vn({ + post: L, + endpoint: st.STAGE_TO_INPUT, + payload: n, index: !1 }); - if (!l?.name) { - k(`Failed to stage: "${t?.filename}"`, "error"); + if (!u?.name) { + e(`Failed to stage: "${n?.filename}"`, "error"); return; } - let { name: u, subfolder: d = "" } = l, f = d ? `${d}/${u}` : u, p = `/view?filename=${encodeURIComponent(u)}&type=input&subfolder=${encodeURIComponent(d)}`; - if (c) { + let { name: d, subfolder: f = "" } = u, p = f ? `${f}/${d}` : d, m = `/view?filename=${encodeURIComponent(d)}&type=input&subfolder=${encodeURIComponent(f)}`; + if (l) { try { - let t = await fetch(p); - if (!t.ok) throw Error(`HTTP ${t.status}`); - let n = await t.arrayBuffer(), r = await new (window.AudioContext || window.webkitAudioContext)().decodeAudioData(n), a = typeof e.getFrameRate == "function" ? e.getFrameRate() : 25, o = Math.max(1, Math.ceil(r.duration * a)), s = r.getChannelData(0), c = Math.max(1, Math.floor(s.length / 200)), l = []; + let n = await fetch(m); + if (!n.ok) throw Error(`HTTP ${n.status}`); + let r = await n.arrayBuffer(), i = await new (window.AudioContext || window.webkitAudioContext)().decodeAudioData(r), o = typeof t.getFrameRate == "function" ? t.getFrameRate() : 25, s = Math.max(1, Math.ceil(i.duration * o)), c = i.getChannelData(0), l = Math.max(1, Math.floor(c.length / 200)), u = []; for (let e = 0; e < 200; e++) { let t = 0; - for (let n = 0; n < c; n++) { - let r = Math.abs(s[e * c + n] || 0); + for (let n = 0; n < l; n++) { + let r = Math.abs(c[e * l + n] || 0); r > t && (t = r); } - l.push(t); + u.push(t); } - let d = i ?? 0; - if (i === null) { - let t = Array.isArray(e.timeline?.audioSegments) ? [...e.timeline.audioSegments] : []; - t.sort((e, t) => e.start - t.start); - for (let e of t) { - if (d + o <= e.start) break; - d = Math.max(d, e.start + e.length); + let f = a ?? 0; + if (a === null) { + let e = Array.isArray(t.timeline?.audioSegments) ? [...t.timeline.audioSegments] : []; + e.sort((e, t) => e.start - t.start); + for (let t of e) { + if (f + s <= t.start) break; + f = Math.max(f, t.start + t.length); } } - let m = Date.now().toString(36) + Math.random().toString(36).slice(2, 7), h = { - id: m, + let h = Date.now().toString(36) + Math.random().toString(36).slice(2, 7), g = { + id: h, type: "audio", - start: d, - length: o, + start: f, + length: s, trimStart: 0, - audioDurationFrames: o, - audioFile: f, - fileName: u, - waveformPeaks: l + audioDurationFrames: s, + audioFile: p, + fileName: d, + waveformPeaks: u }; - if (!e.timeline?.audioSegments) { + if (!t.timeline?.audioSegments) { Qa("ltxdirector inject: no audioSegments", {}); return; } - e.timeline.audioSegments.push(h), e.timeline.audioSegments.sort((e, t) => e.start - t.start), e.selectionType = "audio", e.selectedIndex = e.timeline.audioSegments.findIndex((e) => e.id === m), e.updateUIFromSelection?.(), e.commitChanges?.(!0), e.render?.(), k(`Added audio to LTX Director: ${u}`, "success", 3e3), Qa("drop ltxdirector inject audio", { - file: u, - start: d + t.timeline.audioSegments.push(g), t.timeline.audioSegments.sort((e, t) => e.start - t.start), t.selectionType = "audio", t.selectedIndex = t.timeline.audioSegments.findIndex((e) => e.id === h), t.updateUIFromSelection?.(), t.commitChanges?.(!0), t.render?.(), e(`Added audio to LTX Director: ${d}`, "success", 3e3), Qa("drop ltxdirector inject audio", { + file: d, + start: f }); - } catch (e) { - console.error("[Majoor] LTX Director audio inject failed", e), k(`Audio decode failed for: ${u}`, "error"); + } catch (t) { + console.error("[Majoor] LTX Director audio inject failed", t), e(`Audio decode failed for: ${d}`, "error"); } return; } - let m = typeof e.getFrameRate == "function" ? e.getFrameRate() : 25, h = a(t, s), g = m, _ = i ?? 0; - if (i === null) { - let t = Array.isArray(e.timeline?.segments) ? [...e.timeline.segments] : []; - t.sort((e, t) => e.start - t.start); - for (let e of t) { - if (_ + g <= e.start) break; - _ = Math.max(_, e.start + e.length); + let h = typeof t.getFrameRate == "function" ? t.getFrameRate() : 25, g = o(n, c), _ = h, v = a ?? 0; + if (a === null) { + let e = Array.isArray(t.timeline?.segments) ? [...t.timeline.segments] : []; + e.sort((e, t) => e.start - t.start); + for (let t of e) { + if (v + _ <= t.start) break; + v = Math.max(v, t.start + t.length); } } - let v = Date.now().toString(36) + Math.random().toString(36).slice(2, 7), y; - if (h) { - let t = document.createElement("video"); - t.crossOrigin = "Anonymous", t.preload = "auto", t.muted = !0, t.playsInline = !0, t.src = p, y = { - id: `${v}_v`, - start: _, - length: g, + let y = Date.now().toString(36) + Math.random().toString(36).slice(2, 7), b; + if (g) { + let e = document.createElement("video"); + e.crossOrigin = "Anonymous", e.preload = "auto", e.muted = !0, e.playsInline = !0, e.src = m, b = { + id: `${y}_v`, + start: v, + length: _, trimStart: 0, prompt: "", type: "video", - videoDurationFrames: g, - imageFile: f, - fileName: u, - videoEl: t - }, o(e, y, t, m); - } else y = { - id: v, - start: _, - length: g, + videoDurationFrames: _, + imageFile: p, + fileName: d, + videoEl: e + }, s(t, b, e, h); + } else b = { + id: y, + start: v, + length: _, prompt: "", type: "image", - imageFile: f, - imageB64: p + imageFile: p, + imageB64: m }; - if (!e.timeline?.segments) { + if (!t.timeline?.segments) { Qa("ltxdirector inject: no timeline", {}); return; } - if (e.timeline.segments.push(y), e.timeline.segments.sort((e, t) => e.start - t.start), h) try { - e.retakeMode || e.growTimelineIfNeeded?.(y.start + y.length), e._ensureThumbnails?.(y); + if (t.timeline.segments.push(b), t.timeline.segments.sort((e, t) => e.start - t.start), g) try { + t.retakeMode || t.growTimelineIfNeeded?.(b.start + b.length), t._ensureThumbnails?.(b); } catch (e) { console.debug?.(e); } else { - let t = new Image(); - t.onload = () => { - y.imgObj = t, e.render?.(); - }, t.src = p; + let e = new Image(); + e.onload = () => { + b.imgObj = e, t.render?.(); + }, e.src = m; } - let b = e.timeline.segments.findIndex((e) => e.id === v), x = h ? e.timeline.segments.findIndex((e) => e.id === y.id) : b; - x >= 0 && (e.selectionType = "image", e.selectedIndex = x, e.updateUIFromSelection?.()), e.commitChanges?.(!0), e.render?.(), k(`Added ${h ? "video" : "image"} to LTX Director: ${u}`, "success", 3e3), Qa("drop ltxdirector inject", { - file: u, - start: _, - ext: s, - isVideo: h + let x = t.timeline.segments.findIndex((e) => e.id === y), S = g ? t.timeline.segments.findIndex((e) => e.id === b.id) : x; + S >= 0 && (t.selectionType = "image", t.selectedIndex = S, t.updateUIFromSelection?.()), t.commitChanges?.(!0), t.render?.(), e(`Added ${g ? "video" : "image"} to LTX Director: ${d}`, "success", 3e3), Qa("drop ltxdirector inject", { + file: d, + start: v, + ext: c, + isVideo: g }); }; return { - onKeyDown: e, - onKeyUp: t, - onWindowBlur: n, + onKeyDown: t, + onKeyUp: n, + onWindowBlur: r, onDragOver: (e) => { let t = yo(); if (!Array.from(e?.dataTransfer?.types || []).includes("application/x-mjr-asset")) return; - let n = no(e, mn); - if (!an(n)) return; - let r = un(t, e.clientX, e.clientY), i = r ? ln(t, r, e.clientX, e.clientY) : null, a = String(n?.filename || "").split(".").pop() || "", o = r && !i ? fn(r, n, a) : null, s = r && !i && !o && !!r._timelineEditor; + let n = no(e, pn); + if (!rn(n)) return; + let r = ln(t, e.clientX, e.clientY), i = r ? cn(t, r, e.clientX, e.clientY) : null, a = String(n?.filename || "").split(".").pop() || "", o = r && !i ? dn(r, n, a) : null, s = r && !i && !o && !!r._timelineEditor; if (r && (i || o || s)) { - e.preventDefault(), s || (e.stopImmediatePropagation?.(), e.stopPropagation()), Xt(t, r, Mn), e.dataTransfer.dropEffect = "copy", i ? Qa("dragover slot", { + e.preventDefault(), s || (e.stopImmediatePropagation?.(), e.stopPropagation()), Yt(t, r, jn), e.dataTransfer.dropEffect = "copy", i ? Qa("dragover slot", { node: r?.title, slot: i.input?.name }) : s ? Qa("dragover ltxdirector", { node: r?.title }) : Qa("dragover widget", { @@ -3423,117 +3423,117 @@ function ns() { }); return; } - jn(t, Mn), dn(t, e) && (e.preventDefault(), e.dataTransfer.dropEffect = "copy"); + An(t, jn), un(t, e) && (e.preventDefault(), e.dataTransfer.dropEffect = "copy"); }, - onDrop: async (e) => { - let t = yo(); - if (!Array.from(e?.dataTransfer?.types || []).includes("application/x-mjr-asset")) return; + onDrop: async (t) => { + let n = yo(); + if (!Array.from(t?.dataTransfer?.types || []).includes("application/x-mjr-asset")) return; try { - if ((e?.target)?.closest?.(".mjr-folder-card")) return; + if ((t?.target)?.closest?.(".mjr-folder-card")) return; } catch {} - let n = no(e, mn); - if (!an(n) || !dn(t, e)) return; + let r = no(t, pn); + if (!rn(r) || !un(n, t)) return; co(); - let r = To(), i = r ? No(e, n) : [n], a = un(t, e.clientX, e.clientY), o = a ? ln(t, a, e.clientX, e.clientY) : null, c = String(n?.filename || "").split(".").pop() || "", l = a && !o ? fn(a, n, c) : null; - if (a && o) { - e.preventDefault(), e.stopImmediatePropagation?.(), e.stopPropagation(), jn(t, Mn); - let r = await Qt({ - post: le, - endpoint: ct.STAGE_TO_INPUT, - payload: n, + let i = To(), a = i ? No(t, r) : [r], o = ln(n, t.clientX, t.clientY), s = o ? cn(n, o, t.clientX, t.clientY) : null, l = String(r?.filename || "").split(".").pop() || "", u = o && !s ? dn(o, r, l) : null; + if (o && s) { + t.preventDefault(), t.stopImmediatePropagation?.(), t.stopPropagation(), An(n, jn); + let i = await Zt({ + post: L, + endpoint: st.STAGE_TO_INPUT, + payload: r, index: !1 }); - if (!r) return; - if (en({ - app: t, - payload: n, - relativePath: r, - targetNode: a, - inputSlotIndex: o.index, - event: e + if (!i) return; + if ($t({ + app: n, + payload: r, + relativePath: i, + targetNode: o, + inputSlotIndex: s.index, + event: t })) { Qa("drop slot created and connected loader", { - node: a?.title, - slot: o.input?.name, - value: r + node: o?.title, + slot: s.input?.name, + value: i }); return; } - k(`Staged to input: ${r}`, "success", 4e3); + e(`Staged to input: ${i}`, "success", 4e3); return; } - if (a && !o && !l && a._timelineEditor && !r) { - e.preventDefault(), e.stopImmediatePropagation?.(), e.stopPropagation(), jn(t, Mn), await s(a._timelineEditor, n, c); + if (o && !s && !u && o._timelineEditor && !i) { + t.preventDefault(), t.stopImmediatePropagation?.(), t.stopPropagation(), An(n, jn), await c(o._timelineEditor, r, l); return; } - if (!a || !l) { - if (jn(t, Mn), e.preventDefault(), e.stopImmediatePropagation?.(), e.stopPropagation(), r) { - let r = await Po(i), a = hn({ - app: t, - items: r, - event: e + if (!o || !u) { + if (An(n, jn), t.preventDefault(), t.stopImmediatePropagation?.(), t.stopPropagation(), i) { + let i = await Po(a), o = mn({ + app: n, + items: i, + event: t }); - if (a > 0) { - Qa("drop canvas created loaders", { count: a }); + if (o > 0) { + Qa("drop canvas created loaders", { count: o }); return; } - k(`Failed to load file: "${n?.filename}". Staging failed.`, "error"); + e(`Failed to load file: "${r?.filename}". Staging failed.`, "error"); return; } - if (String(n?.kind || "").toLowerCase() === "workflow") { - if (await Zo(n)) { - Qa("drop canvas loaded workflow", { file: n?.filename }); + if (String(r?.kind || "").toLowerCase() === "workflow") { + if (await Zo(r)) { + Qa("drop canvas loaded workflow", { file: r?.filename }); return; } - k(`Failed to load workflow: "${n?.filename}".`, "error"); + e(`Failed to load workflow: "${r?.filename}".`, "error"); return; } - let o = !a && !r, s = Hn({ - post: le, - endpoint: ct.STAGE_TO_INPUT, - payload: n, + let s = !o && !i, c = Vn({ + post: L, + endpoint: st.STAGE_TO_INPUT, + payload: r, index: !1 - }), l = o ? Zo(n) : Promise.resolve(!1), [u, d] = await Promise.all([l, s]); - if (u) { - Qa("drop canvas loaded workflow", { file: n?.filename }); + }), u = s ? Zo(r) : Promise.resolve(!1), [d, f] = await Promise.all([u, c]); + if (d) { + Qa("drop canvas loaded workflow", { file: r?.filename }); return; } - let f = d?.relativePath; - if (!f) { - Qa("drop canvas stage failed"), k(`Failed to load file: "${n?.filename}". Staging failed.`, "error"); + let p = f?.relativePath; + if (!p) { + Qa("drop canvas stage failed"), e(`Failed to load file: "${r?.filename}". Staging failed.`, "error"); return; } - if (Qa("drop canvas staged", { value: f }), hn({ - app: t, + if (Qa("drop canvas staged", { value: p }), mn({ + app: n, items: [{ - payload: n, - relativePath: f, - droppedExt: c + payload: r, + relativePath: p, + droppedExt: l }], - event: e + event: t })) { - Qa("drop canvas created loader", { value: f }); + Qa("drop canvas created loader", { value: p }); return; } - k(`Staged to input: ${f}`, "success", 4e3); + e(`Staged to input: ${p}`, "success", 4e3); return; } - e.preventDefault(), e.stopImmediatePropagation?.(), e.stopPropagation(), jn(t, Mn); - let u = await Qt({ - post: le, - endpoint: ct.STAGE_TO_INPUT, - payload: n, + t.preventDefault(), t.stopImmediatePropagation?.(), t.stopPropagation(), An(n, jn); + let d = await Zt({ + post: L, + endpoint: st.STAGE_TO_INPUT, + payload: r, index: !1 }); - u && ($t(l, u), Mn(t), Qa("drop inject", { - node: a?.title, - widget: l?.name, - value: u + d && (Qt(u, d), jn(n), Qa("drop inject", { + node: o?.title, + widget: u?.name, + value: d })); }, onDragLeave: () => { let e = yo(); - jn(e, Mn), Qa("dragleave"); + An(e, jn), Qa("dragleave"); } }; } @@ -3548,7 +3548,7 @@ function rs() { } xo = !1, So = !1; try { - jn(yo(), Mn); + An(yo(), jn); } catch (e) { console.debug?.(e); } @@ -3747,7 +3747,7 @@ function hs() { } return e; } -var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ +var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ lr({ __name: "RatingBadge", props: { rating: { type: [Number, String], @@ -3758,27 +3758,27 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ } } }, setup(e) { - let t = e, n = G(() => Math.max(0, Math.min(5, Number(t.rating) || 0))), r = G(() => n.value > 0), i = G(() => L("rating.title", "Rating: {n} star{n, plural, one {} other {s}}", { n: n.value })); - return (e, t) => r.value ? (K(), Y("div", { + let t = e, n = K(() => Math.max(0, Math.min(5, Number(t.rating) || 0))), r = K(() => n.value > 0), i = K(() => R("rating.title", "Rating: {n} star{n, plural, one {} other {s}}", { n: n.value })); + return (e, t) => r.value ? (q(), X("div", { key: 0, class: "mjr-rating-badge", title: i.value - }, [(K(!0), Y(V, null, mr(n.value, (e) => (K(), Y("span", { + }, [(q(!0), X(H, null, pr(n.value, (e) => (q(), X("span", { key: e, - style: br({ + style: yr({ color: "var(--mjr-rating-color, var(--mjr-star-active, #FFD45A))", marginRight: e < n.value ? "2px" : "0" }) - }, " ★ ", 4))), 128))], 8, _s)) : W("", !0); + }, " ★ ", 4))), 128))], 8, _s)) : G("", !0); } -}), ys = ["title"], bs = /* @__PURE__ */ ur({ +}), ys = ["title"], bs = /* @__PURE__ */ lr({ __name: "TagsBadge", props: { tags: { type: [Array, String], default: () => [] } }, setup(e) { - let t = e, n = G(() => { + let t = e, n = K(() => { if (Array.isArray(t.tags)) return t.tags.map((e) => String(e ?? "").trim()).filter(Boolean).slice(0, 10); if (typeof t.tags == "string") { let e = t.tags.trim(); @@ -3791,28 +3791,28 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ } } return []; - }), r = G(() => n.value.length > 0), i = G(() => L("tags.title", "Tags: {tags}", { tags: n.value.join(", ") })), a = G(() => { + }), r = K(() => n.value.length > 0), i = K(() => R("tags.title", "Tags: {tags}", { tags: n.value.join(", ") })), a = K(() => { let e = n.value; return e.length <= 5 ? e.join(", ") : e.slice(0, 5).join(", ") + ` +${e.length - 5}`; }); - return (e, t) => r.value ? (K(), Y("div", { + return (e, t) => r.value ? (q(), X("div", { key: 0, class: "mjr-tags-badge", title: i.value, style: { color: "var(--mjr-tag-color, #90CAF9)" } - }, q(a.value), 9, ys)) : W("", !0); + }, J(a.value), 9, ys)) : G("", !0); } -}), xs = ["title"], Ss = /* @__PURE__ */ ur({ +}), xs = ["title"], Ss = /* @__PURE__ */ lr({ __name: "GenTimeBadge", props: { genTimeMs: { default: 0 } }, setup(e) { - let t = e, n = G(() => xt(t.genTimeMs)), r = G(() => n.value > 0), i = G(() => Ot(n.value)), a = G(() => At(n.value)); - return (e, t) => r.value ? (K(), Y("div", { + let t = e, n = K(() => bt(t.genTimeMs)), r = K(() => n.value > 0), i = K(() => Dt(n.value)), a = K(() => kt(n.value)); + return (e, t) => r.value ? (q(), X("div", { key: 0, class: "mjr-gentime-badge", title: i.value.title, - style: br({ color: a.value }) - }, q(i.value.text), 13, xs)) : W("", !0); + style: yr({ color: a.value }) + }, J(i.value.text), 13, xs)) : G("", !0); } }), Cs = { key: 0, @@ -3873,7 +3873,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ opacity: "0.55", margin: "0 3px" } -}, rc = ["title"], ic = { class: "mjr-stack-group-button-count" }, ac = { class: "mjr-dup-stack-count" }, oc = /* @__PURE__ */ ur({ +}, rc = ["title"], ic = { class: "mjr-stack-group-button-count" }, ac = { class: "mjr-dup-stack-count" }, oc = /* @__PURE__ */ lr({ __name: "AssetCardInner", props: { asset: {} }, emits: ["workflow-action"], @@ -4009,49 +4009,49 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ function f(e) { e && (u(e), s(e)); } - let p = e, m = t, h = G(() => String(p.asset.kind || "image").toLowerCase()), g = G(() => h.value === "workflow"), _ = G(() => h.value === "image"), v = G(() => h.value === "video"), y = G(() => h.value === "audio"), b = G(() => h.value === "model3d"), x = G(() => at(p.asset) || ""), S = G(() => String(p.asset.thumbnail_url || p.asset.graph_map_thumbnail_url || p.asset.thumb_url || p.asset.poster || "").trim()), C = G(() => !!String(p.asset.thumbnail_url || p.asset.thumb_url || p.asset.poster || "").trim()), w = G(() => g.value && !C.value && !!String(p.asset.graph_map_thumbnail_url || "").trim()), T = G(() => String(p.asset.preview_url || p.asset.previewUrl || p.asset.url || "").trim()), E = G(() => x.value), D = G(() => T.value || x.value), O = G(() => !v.value && !g.value ? "" : Ze(p.asset, 384)), k = G(() => S.value || O.value), A = G(() => String(p.asset.filename || "")), j = G(() => String(p.asset.display_name || p.asset.displayName || p.asset.name || A.value || "").trim()), M = G(() => { + let p = e, m = t, h = K(() => String(p.asset.kind || "image").toLowerCase()), g = K(() => h.value === "workflow"), _ = K(() => h.value === "image"), v = K(() => h.value === "video"), y = K(() => h.value === "audio"), b = K(() => h.value === "model3d"), x = K(() => it(p.asset) || ""), S = K(() => String(p.asset.thumbnail_url || p.asset.graph_map_thumbnail_url || p.asset.thumb_url || p.asset.poster || "").trim()), C = K(() => !!String(p.asset.thumbnail_url || p.asset.thumb_url || p.asset.poster || "").trim()), w = K(() => g.value && !C.value && !!String(p.asset.graph_map_thumbnail_url || "").trim()), T = K(() => String(p.asset.preview_url || p.asset.previewUrl || p.asset.url || "").trim()), E = K(() => x.value), D = K(() => T.value || x.value), O = K(() => !v.value && !g.value ? "" : Xe(p.asset, 384)), k = K(() => S.value || O.value), A = K(() => String(p.asset.filename || "")), j = K(() => String(p.asset.display_name || p.asset.displayName || p.asset.name || A.value || "").trim()), M = K(() => { let e = A.value; return e.includes(".") ? e.split(".").pop().toUpperCase() : ""; - }), N = G(() => { + }), N = K(() => { let e = j.value || A.value; return e.includes(".") ? e.slice(0, e.lastIndexOf(".")) : e; - }), P = G(() => String(p.asset.notes || "").trim()), F = G(() => r(`${p.asset.id || ""}:${A.value}:${p.asset.duration || ""}`)), ee = G(() => N.value || A.value || "Audio"), te = G(() => [pe.value, M.value].filter(Boolean).join(" / ") || "Audio"), I = G(() => { + }), P = K(() => String(p.asset.notes || "").trim()), ee = K(() => r(`${p.asset.id || ""}:${A.value}:${p.asset.duration || ""}`)), te = K(() => N.value || A.value || "Audio"), F = K(() => [fe.value, M.value].filter(Boolean).join(" / ") || "Audio"), I = K(() => { let e = [A.value || j.value], t = String(p.asset.subfolder || p.asset.file_info?.subfolder || "").trim(), n = String(p.asset.type || p.asset.source || p.asset.file_info?.type || "").trim(); return t && e.push(`Subfolder: ${t}`), n && e.push(`Type: ${n}`), P.value && e.push(`Notes: ${P.value}`), e.filter(Boolean).join("\n"); - }), ne = G(() => Number(p.asset.rating) || 0), re = G(() => p.asset.tags || []), ie = G(() => { + }), ne = K(() => Number(p.asset.rating) || 0), re = K(() => p.asset.tags || []), ie = K(() => { let e = p.asset.generation_time_ms ?? p.asset.metadata?.generation_time_ms ?? 0; - return xt(e); - }), ae = G(() => ie.value > 0), oe = G(() => Ot(ie.value)), se = G(() => At(ie.value)), ce = G(() => String(p.asset.positive_prompt || "").trim()), le = G(() => p.asset?._mjrLivePlaceholder === !0 || p.asset?.is_live_placeholder === !0 || String(p.asset?.id || "").trim().toLowerCase().startsWith("live:")), ue = G(() => String(p.asset?._mjrLiveLabel || "In progress").trim() || "In progress"), de = G(() => `${ue.value}: waiting for indexed asset data`), fe = G(() => { + return bt(e); + }), ae = K(() => ie.value > 0), oe = K(() => Dt(ie.value)), se = K(() => kt(ie.value)), L = K(() => String(p.asset.positive_prompt || "").trim()), ce = K(() => p.asset?._mjrLivePlaceholder === !0 || p.asset?.is_live_placeholder === !0 || String(p.asset?.id || "").trim().toLowerCase().startsWith("live:")), le = K(() => String(p.asset?._mjrLiveLabel || "In progress").trim() || "In progress"), ue = K(() => `${le.value}: waiting for indexed asset data`), de = K(() => { let { width: e, height: t } = p.asset; return e && t ? `${e}x${t}` : ""; - }), pe = G(() => p.asset.duration ? wn(p.asset.duration) : ""), me = G(() => String(p.asset.task || p.asset.workflow_task || "").trim()), he = G(() => String(p.asset.model_family || p.asset.modelFamily || "").trim()), ge = G(() => String(p.asset.runs_on || p.asset.runsOn || "").trim()), _e = G(() => Number(p.asset.node_count || p.asset.nodeCount || 0) || 0), ve = G(() => !!p.asset.favorite), ye = G(() => Number(p.asset.subgraph_count || p.asset.subgraphCount || 0) || 0), be = G(() => Number(p.asset.missing_nodes_count || p.asset.missingNodesCount || 0) || 0), xe = G(() => Number(p.asset.missing_models_count || p.asset.missingModelsCount || 0) || 0), Se = G(() => be.value > 0 || xe.value > 0), Ce = G(() => { - if (!Se.value) return ""; + }), fe = K(() => p.asset.duration ? Cn(p.asset.duration) : ""), pe = K(() => String(p.asset.task || p.asset.workflow_task || "").trim()), me = K(() => String(p.asset.model_family || p.asset.modelFamily || "").trim()), he = K(() => String(p.asset.runs_on || p.asset.runsOn || "").trim()), ge = K(() => Number(p.asset.node_count || p.asset.nodeCount || 0) || 0), _e = K(() => !!p.asset.favorite), ve = K(() => Number(p.asset.subgraph_count || p.asset.subgraphCount || 0) || 0), ye = K(() => Number(p.asset.missing_nodes_count || p.asset.missingNodesCount || 0) || 0), be = K(() => Number(p.asset.missing_models_count || p.asset.missingModelsCount || 0) || 0), xe = K(() => ye.value > 0 || be.value > 0), Se = K(() => { + if (!xe.value) return ""; let e = []; - return be.value > 0 && e.push(`${be.value} node`), xe.value > 0 && e.push(`${xe.value} model`), `Missing: ${e.join(" / ")}`; - }), we = G(() => p.asset.generation_time || p.asset.file_creation_time || p.asset.mtime || p.asset.created_at), Te = G(() => we.value ? zn(we.value) : ""), Ee = G(() => we.value ? Nn(we.value) : ""), De = G(() => [ - fe.value ? { + return ye.value > 0 && e.push(`${ye.value} node`), be.value > 0 && e.push(`${be.value} model`), `Missing: ${e.join(" / ")}`; + }), Ce = K(() => p.asset.generation_time || p.asset.file_creation_time || p.asset.mtime || p.asset.created_at), we = K(() => Ce.value ? Rn(Ce.value) : ""), Te = K(() => Ce.value ? Mn(Ce.value) : ""), Ee = K(() => [ + de.value ? { key: "resolution", className: "mjr-meta-res", - title: `Resolution: ${fe.value}`, - text: fe.value + title: `Resolution: ${de.value}`, + text: de.value } : null, - pe.value ? { + fe.value ? { key: "duration", className: "mjr-meta-duration", - title: `Duration: ${pe.value}`, - text: pe.value + title: `Duration: ${fe.value}`, + text: fe.value } : null, - Te.value ? { + we.value ? { key: "date", className: "mjr-meta-date", - title: `Date: ${Te.value}`, - text: Te.value + title: `Date: ${we.value}`, + text: we.value } : null, - Ee.value ? { + Te.value ? { key: "time", className: "mjr-meta-date mjr-meta-time-val", - title: `Time: ${Ee.value}`, - text: Ee.value + title: `Time: ${Te.value}`, + text: Te.value } : null, ae.value ? { key: "gentime", @@ -4063,17 +4063,29 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ fontWeight: "500" } } : null - ].filter(Boolean)), Oe = G(() => !!p.asset._mjrNameCollision && !p.asset._mjrDupStack), ke = G(() => Oe.value ? "var(--mjr-badge-duplicate-alert, #ff1744)" : { + ].filter(Boolean)), De = K(() => !!p.asset._mjrNameCollision && !p.asset._mjrDupStack), Oe = K(() => De.value ? "var(--mjr-badge-duplicate-alert, #ff1744)" : { image: "var(--mjr-badge-image, #2196F3)", video: "var(--mjr-badge-video, #F44336)", audio: "var(--mjr-badge-audio, #4CAF50)", model3d: "var(--mjr-badge-model3d, #9C27B0)" - }[h.value] || "var(--mjr-badge-image, #888)"), Ae = or("mjrStackService", null), je = G(() => !Ae || !String(p.asset.stack_id || "").trim() ? !1 : Number(p.asset.stack_asset_count || p.asset._mjrFeedGroupCount || 0) > 1), Me = G(() => Number(p.asset.stack_asset_count || p.asset._mjrFeedGroupCount || 0) || 0), Ne = G(() => !!p.asset._mjrDupStack && Number(p.asset._mjrDupCount || 0) >= 2), Pe = G(() => Number(p.asset._mjrDupCount || 0) || 0), Fe = G(() => Ne.value && !je.value), Ie = Z(!1), Le = Z(!1); - async function Re(e) { + }[h.value] || "var(--mjr-badge-image, #888)"), ke = ar("mjrStackService", null), Ae = K(() => !ke || !String(p.asset.stack_id || "").trim() ? !1 : Number(p.asset.stack_asset_count || p.asset._mjrFeedGroupCount || 0) > 1), je = K(() => Number(p.asset.stack_asset_count || p.asset._mjrFeedGroupCount || 0) || 0), Me = K(() => !!p.asset._mjrDupStack && Number(p.asset._mjrDupCount || 0) >= 2), Ne = K(() => Number(p.asset._mjrDupCount || 0) || 0), Pe = K(() => Me.value && !Ae.value), Fe = Q(!1), Ie = Q(!1); + async function Le(e) { + if (e.preventDefault(), e.stopPropagation(), !Fe.value) { + Fe.value = !0; + try { + await ke?.openStackGroup?.(p.asset); + } catch (e) { + console.debug?.(e); + } finally { + Fe.value = !1; + } + } + } + function Re(e) { if (e.preventDefault(), e.stopPropagation(), !Ie.value) { Ie.value = !0; try { - await Ae?.openStackGroup?.(p.asset); + ke?.openDupGroup?.(p.asset); } catch (e) { console.debug?.(e); } finally { @@ -4081,104 +4093,92 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ } } } - function ze(e) { - if (e.preventDefault(), e.stopPropagation(), !Le.value) { - Le.value = !0; - try { - Ae?.openDupGroup?.(p.asset); - } catch (e) { - console.debug?.(e); - } finally { - Le.value = !1; - } - } - } - let Be = Z(null), Ve = Z(null), He = Z(null), Ue = Z(null), We = Z(!1), Ge = Z(!1), Ke = Z(""), qe = 0, Je = "", Ye = "", Xe = ""; - function Qe() { + let ze = Q(null), Be = Q(null), Ve = Q(null), He = Q(null), Ue = Q(!1), We = Q(!1), Ge = Q(""), Ke = 0, qe = "", Je = "", Ye = ""; + function Ze() { try { - Je && gs.releaseUrl(Je); + qe && gs.releaseUrl(qe); } catch (e) { console.debug?.(e); } - Je = ""; + qe = ""; } - sr(() => g.value ? S.value : _.value ? E.value : "", (e) => { + or(() => g.value ? S.value : _.value ? E.value : "", (e) => { let t = String(e || "").trim(); - !t || t === Ye || (We.value = !1, Ye = ""); - }, { immediate: !0 }), sr(() => b.value ? k.value : "", (e) => { + t && t !== Je && (Ue.value = !1, Je = ""); + }, { immediate: !0 }), or(() => b.value ? k.value : "", (e) => { let t = String(e || "").trim(); - !t || t === Xe || (Ge.value = !1, Xe = ""); - }, { immediate: !0 }), sr(() => [_.value ? He.value : null, _.value ? E.value : ""], async ([e, t], n, r) => { - if (!e || !t || We.value) return; - let o = qe += 1, s = new AbortController(), c = !1; + t && t !== Ye && (We.value = !1, Ye = ""); + }, { immediate: !0 }), or(() => [_.value ? Ve.value : null, _.value ? E.value : ""], async ([e, t], n, r) => { + if (!e || !t || Ue.value) return; + let o = Ke += 1, s = new AbortController(), c = !1; r(() => { c = !0, s.abort(); }); try { - let n = Je || String(e.dataset?.mjrSourceKey || ""); - if (Ke.value && n === t || (e.dataset.mjrSourceKey = t, await a(), c || o !== qe || !e.isConnected)) return; + let n = qe || String(e.dataset?.mjrSourceKey || ""); + if (Ge.value && n === t || (e.dataset.mjrSourceKey = t, await a(), c || o !== Ke || !e.isConnected)) return; let r = await i(t, { signal: s.signal }); - if (c || o !== qe || !e.isConnected) { + if (c || o !== Ke || !e.isConnected) { r && r !== t && gs.releaseUrl(t); return; } - if (r && r !== Ke.value) { - let e = Je; - Ke.value = r, Je = r === t ? "" : t, e && e !== Je && gs.releaseUrl(e); - } else !r && Je && Je !== t && (Qe(), Ke.value = ""); + if (r && r !== Ge.value) { + let e = qe; + Ge.value = r, qe = r === t ? "" : t, e && e !== qe && gs.releaseUrl(e); + } else !r && qe && qe !== t && (Ze(), Ge.value = ""); } catch {} }, { immediate: !0 }); - let $e = Z(z.GRID_VIDEO_AUTOPLAY_MODE || "hover"); - function et() { - $e.value = z.GRID_VIDEO_AUTOPLAY_MODE || "hover"; + let Qe = Q(B.GRID_VIDEO_AUTOPLAY_MODE || "hover"); + function $e() { + Qe.value = B.GRID_VIDEO_AUTOPLAY_MODE || "hover"; } kr(() => { - window.addEventListener("mjr-settings-changed", et); - }), sr(Ve, (e, t) => { + window.addEventListener("mjr-settings-changed", $e); + }), or(Be, (e, t) => { if (t) try { f(t); } catch {} - if (e && Be.value) try { - d(Be.value, e, $e.value); + if (e && ze.value) try { + d(ze.value, e, Qe.value); } catch {} - }), sr($e, (e) => { - let t = Ve.value, n = Be.value; + }), or(Qe, (e) => { + let t = Be.value, n = ze.value; t && n && d(n, t, e); - }), sr(D, (e, t) => { + }), or(D, (e, t) => { if (e === t) return; - let n = Ve.value, r = Be.value; - !n || !r || (f(n), d(r, n, $e.value)); - }, { flush: "post" }), fr(() => { - window.removeEventListener("mjr-settings-changed", et), qe += 1, Qe(); - let e = Ve.value; + let n = Be.value, r = ze.value; + n && r && (f(n), d(r, n, Qe.value)); + }, { flush: "post" }), dr(() => { + window.removeEventListener("mjr-settings-changed", $e), Ke += 1, Ze(); + let e = Be.value; if (e) try { f(e); } catch {} - }), nr(() => { - window.removeEventListener("mjr-settings-changed", et); - }), Cr(() => { - let e = Ue.value; + }), tr(() => { + window.removeEventListener("mjr-settings-changed", $e); + }), Sr(() => { + let e = He.value; if (!e) return; let t = p.asset; t?.has_workflow ?? t?.hasWorkflow, t?.has_generation_data ?? t?.hasGenerationData, t?.has_ai_info ?? t?.hasAiInfo ?? t?.ai_indexed, t?.has_ai_auto_tags ?? t?.hasAiAutoTags ?? t?.auto_tags ?? t?.autoTags, t?.has_ai_enhanced_caption ?? t?.hasAiEnhancedCaption ?? t?.enhanced_caption ?? t?.enhancedCaption, t?.has_ai_vector ?? t?.hasAiVector ?? t?.vector_indexed ?? t?.vectorIndexed; try { e.textContent = ""; - let n = Dt(t); + let n = Et(t); n && e.appendChild(n); } catch {} }); - function tt(e) { - We.value = !0; + function et(e) { + Ue.value = !0; try { let e = g.value ? S.value : E.value; - Ye = String(e || "").trim(), gs.markError(e); + Je = String(e || "").trim(), gs.markError(e); } catch {} } - function L() { - Ge.value = !0, Xe = String(k.value || "").trim(); + function R() { + We.value = !0, Ye = String(k.value || "").trim(); } - function R(e) { - if (!Oe.value) return; + function z(e) { + if (!De.value) return; e.preventDefault(), e.stopPropagation(); let t = e.target?.closest?.(".mjr-asset-card"); t && t.dispatchEvent(new CustomEvent("mjr:badge-duplicates-focus", { @@ -4191,7 +4191,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ } })); } - function nt(e, t) { + function tt(e, t) { try { t?.preventDefault?.(), t?.stopPropagation?.(); } catch (e) { @@ -4204,61 +4204,61 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ }); } return (t, n) => { - let r = ir("MButton"); - return K(), Y(V, null, [ - H("div", { - class: Q(["mjr-thumb", { "mjr-thumb-workflow": g.value }]), + let r = rr("MButton"); + return q(), X(H, null, [ + U("div", { + class: wr(["mjr-thumb", { "mjr-thumb-workflow": g.value }]), ref_key: "thumbRef", - ref: Be + ref: ze }, [ - le.value ? (K(), Y("div", Cs)) : W("", !0), - g.value ? (K(), Y(V, { key: 1 }, [ - H("div", { + ce.value ? (q(), X("div", Cs)) : G("", !0), + g.value ? (q(), X(H, { key: 1 }, [ + U("div", { class: "mjr-workflow-card-actions", - onClick: n[1] ||= pr(() => {}, ["stop"]), - onDblclick: n[2] ||= pr(() => {}, ["stop"]) - }, [H("button", { + onClick: n[1] ||= fr(() => {}, ["stop"]), + onDblclick: n[2] ||= fr(() => {}, ["stop"]) + }, [U("button", { type: "button", - class: Q(["mjr-workflow-action-btn", { "is-active": ve.value }]), - title: ve.value ? "Remove favorite" : "Add favorite", - "aria-label": ve.value ? "Remove favorite" : "Add favorite", - onClick: n[0] ||= (e) => nt("favorite", e) - }, [H("i", { class: Q(ve.value ? "pi pi-star-fill" : "pi pi-star") }, null, 2)], 10, ws)], 32), - k.value && !We.value ? (K(), Y("img", { + class: wr(["mjr-workflow-action-btn", { "is-active": _e.value }]), + title: _e.value ? "Remove favorite" : "Add favorite", + "aria-label": _e.value ? "Remove favorite" : "Add favorite", + onClick: n[0] ||= (e) => tt("favorite", e) + }, [U("i", { class: wr(_e.value ? "pi pi-star-fill" : "pi pi-star") }, null, 2)], 10, ws)], 32), + k.value && !Ue.value ? (q(), X("img", { key: 0, - class: Q(["mjr-thumb-media", { "mjr-workflow-graph-map-preview": w.value }]), + class: wr(["mjr-thumb-media", { "mjr-workflow-graph-map-preview": w.value }]), alt: A.value, decoding: "async", loading: "lazy", src: k.value, - onError: tt - }, null, 42, Ts)) : W("", !0), - H("div", { class: Q(["mjr-workflow-thumb", { - "has-thumbnail": k.value && !We.value, - "has-graph-map": w.value && !We.value + onError: et + }, null, 42, Ts)) : G("", !0), + U("div", { class: wr(["mjr-workflow-thumb", { + "has-thumbnail": k.value && !Ue.value, + "has-graph-map": w.value && !Ue.value }]) }, [ - n[15] ||= H("i", { class: "pi pi-sitemap" }, null, -1), - H("div", Es, q(me.value || "Workflow"), 1), - H("div", Ds, [ - he.value ? (K(), Y("span", Os, q(he.value), 1)) : W("", !0), - ge.value ? (K(), Y("span", ks, q(ge.value), 1)) : W("", !0), - _e.value ? (K(), Y("span", As, q(_e.value) + " nodes", 1)) : W("", !0), - Se.value ? (K(), Y("span", js, q(Ce.value), 1)) : W("", !0) + n[15] ||= U("i", { class: "pi pi-sitemap" }, null, -1), + U("div", Es, J(pe.value || "Workflow"), 1), + U("div", Ds, [ + me.value ? (q(), X("span", Os, J(me.value), 1)) : G("", !0), + he.value ? (q(), X("span", ks, J(he.value), 1)) : G("", !0), + ge.value ? (q(), X("span", As, J(ge.value) + " nodes", 1)) : G("", !0), + xe.value ? (q(), X("span", js, J(Se.value), 1)) : G("", !0) ]) ], 2) - ], 64)) : _.value ? (K(), Y(V, { key: 2 }, [We.value ? W("", !0) : (K(), Y("img", { + ], 64)) : _.value ? (q(), X(H, { key: 2 }, [Ue.value ? G("", !0) : (q(), X("img", { key: 0, ref_key: "imgRef", - ref: He, + ref: Ve, class: "mjr-thumb-media", alt: A.value, decoding: "async", loading: "lazy", - src: Ke.value || E.value || void 0, - onError: tt - }, null, 40, Ms)), We.value ? (K(), Y("div", Ns, [...n[16] ||= [H("i", { class: "pi pi-image" }, null, -1)]])) : W("", !0)], 64)) : v.value ? (K(), Y(V, { key: 3 }, [H("video", { + src: Ge.value || E.value || void 0, + onError: et + }, null, 40, Ms)), Ue.value ? (q(), X("div", Ns, [...n[16] ||= [U("i", { class: "pi pi-image" }, null, -1)]])) : G("", !0)], 64)) : v.value ? (q(), X(H, { key: 3 }, [U("video", { ref_key: "videoRef", - ref: Ve, + ref: Be, class: "mjr-thumb-media", "data-src": D.value, poster: k.value || void 0, @@ -4270,78 +4270,78 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ draggable: !1, tabindex: -1, style: { "pointer-events": "none" } - }, null, 8, Ps), n[17] ||= H("div", { class: "mjr-thumb-play" }, [H("i", { class: "pi pi-play" })], -1)], 64)) : y.value ? (K(), Y(V, { key: 4 }, [k.value ? (K(), Y("img", { + }, null, 8, Ps), n[17] ||= U("div", { class: "mjr-thumb-play" }, [U("i", { class: "pi pi-play" })], -1)], 64)) : y.value ? (q(), X(H, { key: 4 }, [k.value ? (q(), X("img", { key: 0, class: "mjr-thumb-media", src: k.value, draggable: !1, alt: "" - }, null, 8, Fs)) : W("", !0), H("div", { class: Q(["mjr-audio-thumb", { "has-poster": k.value }]) }, [ - H("div", Is, [n[18] ||= H("span", { class: "mjr-audio-thumb-icon" }, [H("i", { class: "pi pi-volume-up" })], -1), H("span", Ls, q(M.value || "AUDIO"), 1)]), - H("div", Rs, [(K(!0), Y(V, null, mr(F.value, (e, t) => (K(), Y("span", { + }, null, 8, Fs)) : G("", !0), U("div", { class: wr(["mjr-audio-thumb", { "has-poster": k.value }]) }, [ + U("div", Is, [n[18] ||= U("span", { class: "mjr-audio-thumb-icon" }, [U("i", { class: "pi pi-volume-up" })], -1), U("span", Ls, J(M.value || "AUDIO"), 1)]), + U("div", Rs, [(q(!0), X(H, null, pr(ee.value, (e, t) => (q(), X("span", { key: t, - style: br({ + style: yr({ height: `${e.height}%`, opacity: e.opacity }) }, null, 4))), 128))]), - H("div", zs, [H("span", Bs, q(ee.value), 1), H("span", Vs, q(te.value), 1)]) - ], 2)], 64)) : b.value ? (K(), Y(V, { key: 5 }, [k.value && !Ge.value ? (K(), Y("img", { + U("div", zs, [U("span", Bs, J(te.value), 1), U("span", Vs, J(F.value), 1)]) + ], 2)], 64)) : b.value ? (q(), X(H, { key: 5 }, [k.value && !We.value ? (q(), X("img", { key: 0, class: "mjr-thumb-media", src: k.value, draggable: !1, alt: A.value, - onError: L - }, null, 40, Hs)) : (K(), Y("div", Us, [...n[19] ||= [H("i", { + onError: R + }, null, 40, Hs)) : (q(), X("div", Us, [...n[19] ||= [U("i", { class: "pi pi-box", style: { "font-size": "2.5rem" } - }, null, -1)]]))], 64)) : W("", !0), - H("div", { + }, null, -1)]]))], 64)) : G("", !0), + U("div", { class: "mjr-file-badge mjr-badge-ext", "data-mjr-ext": M.value, - "data-mjr-badge-bg": ke.value, - style: br({ + "data-mjr-badge-bg": Oe.value, + style: yr({ position: "absolute", top: "6px", left: "6px", zIndex: 10, - background: ke.value, + background: Oe.value, color: "#fff", padding: "2px 5px", borderRadius: "4px", fontSize: "10px", fontWeight: "700", - pointerEvents: Oe.value ? "auto" : "none", - cursor: Oe.value ? "pointer" : "default" + pointerEvents: De.value ? "auto" : "none", + cursor: De.value ? "pointer" : "default" }), - title: Oe.value ? `${M.value} - duplicate filename (${e.asset._mjrNameCollisionCount || 2} files)` : `${M.value} file`, - onClick: R - }, q(M.value) + q(Oe.value ? "+" : ""), 13, Ws), - J(vs, { + title: De.value ? `${M.value} - duplicate filename (${e.asset._mjrNameCollisionCount || 2} files)` : `${M.value} file`, + onClick: z + }, J(M.value) + J(De.value ? "+" : ""), 13, Ws), + Y(vs, { rating: ne.value, class: "mjr-badge-rating" }, null, 8, ["rating"]), - J(bs, { + Y(bs, { tags: re.value, class: "mjr-badge-tags" }, null, 8, ["tags"]), - J(Ss, { "gen-time-ms": ie.value }, null, 8, ["gen-time-ms"]), - le.value ? (K(), Y("div", { + Y(Ss, { "gen-time-ms": ie.value }, null, 8, ["gen-time-ms"]), + ce.value ? (q(), X("div", { key: 6, class: "mjr-live-pill", - title: de.value - }, [n[20] ||= H("span", { + title: ue.value + }, [n[20] ||= U("span", { class: "mjr-live-pill-dot", "aria-hidden": "true" - }, null, -1), H("span", null, q(ue.value), 1)], 8, Gs)) : W("", !0), - ce.value || g.value && P.value || ae.value ? (K(), Y("div", Ks, [ - ce.value ? (K(), Y("div", qs, q(ce.value), 1)) : W("", !0), - g.value && P.value ? (K(), Y("div", Js, q(P.value), 1)) : W("", !0), - ae.value ? (K(), Y("div", Ys, "Time " + q(oe.value.text), 1)) : W("", !0) - ])) : W("", !0) + }, null, -1), U("span", null, J(le.value), 1)], 8, Gs)) : G("", !0), + L.value || g.value && P.value || ae.value ? (q(), X("div", Ks, [ + L.value ? (q(), X("div", qs, J(L.value), 1)) : G("", !0), + g.value && P.value ? (q(), X("div", Js, J(P.value), 1)) : G("", !0), + ae.value ? (q(), X("div", Ys, "Time " + J(oe.value.text), 1)) : G("", !0) + ])) : G("", !0) ], 2), - H("div", { + U("div", { class: "mjr-card-info mjr-card-meta", "data-mjr-kind": g.value ? "workflow" : void 0, style: { @@ -4350,7 +4350,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ "min-width": "0" } }, [ - H("div", { + U("div", { class: "mjr-card-filename", title: I.value, style: { @@ -4360,31 +4360,31 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ "margin-bottom": "4px", "padding-right": "12px" } - }, q(N.value), 9, Zs), - H("div", Qs, [g.value ? (K(), Y(V, { key: 0 }, [ - me.value ? (K(), Y("span", { + }, J(N.value), 9, Zs), + U("div", Qs, [g.value ? (q(), X(H, { key: 0 }, [ + pe.value ? (q(), X("span", { key: 0, class: "mjr-meta-workflow-task", - title: `Task: ${me.value}` - }, q(me.value), 9, $s)) : W("", !0), - ye.value ? (K(), Y("span", { + title: `Task: ${pe.value}` + }, J(pe.value), 9, $s)) : G("", !0), + ve.value ? (q(), X("span", { key: 1, class: "mjr-meta-workflow-subgraphs", - title: `${ye.value} subgraph${ye.value > 1 ? "s" : ""}` - }, q(ye.value) + " sub", 9, ec)) : W("", !0), - Se.value ? (K(), Y("span", { + title: `${ve.value} subgraph${ve.value > 1 ? "s" : ""}` + }, J(ve.value) + " sub", 9, ec)) : G("", !0), + xe.value ? (q(), X("span", { key: 2, class: "mjr-meta-workflow-missing", - title: Ce.value - }, q(Ce.value), 9, tc)) : W("", !0) - ], 64)) : W("", !0), (K(!0), Y(V, null, mr(De.value, (e, t) => (K(), Y(V, { key: e.key }, [t > 0 ? (K(), Y("span", nc, "/")) : W("", !0), H("span", { - class: Q(e.className), - style: br(e.style || null), + title: Se.value + }, J(Se.value), 9, tc)) : G("", !0) + ], 64)) : G("", !0), (q(!0), X(H, null, pr(Ee.value, (e, t) => (q(), X(H, { key: e.key }, [t > 0 ? (q(), X("span", nc, "/")) : G("", !0), U("span", { + class: wr(e.className), + style: yr(e.style || null), title: e.title - }, q(e.text), 15, rc)], 64))), 128))]), - H("div", { + }, J(e.text), 15, rc)], 64))), 128))]), + U("div", { ref_key: "dotWrapperRef", - ref: Ue, + ref: He, class: "mjr-card-dot-wrapper", style: { position: "absolute", @@ -4394,60 +4394,60 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ } }, null, 512) ], 8, Xs), - je.value ? (K(), rr(r, { + Ae.value ? (q(), nr(r, { key: 0, type: "button", class: "mjr-stack-group-button", severity: "secondary", text: "", rounded: "", - disabled: Ie.value, - "aria-busy": Ie.value ? "true" : "false", - "aria-label": `Open generation group in grid (${Me.value} assets)`, - title: `Open generation group in grid (${Me.value} assets)`, - onClick: Re, - onPointerdown: n[3] ||= pr(() => {}, ["stop"]), - onMousedown: n[4] ||= pr(() => {}, ["stop", "prevent"]), - onTouchstartPassive: n[5] ||= pr(() => {}, ["stop"]), - onDblclick: n[6] ||= pr(() => {}, ["stop"]), - onKeydown: n[7] ||= pr(() => {}, ["stop"]), - onDragstart: n[8] ||= pr(() => {}, ["stop", "prevent"]) + disabled: Fe.value, + "aria-busy": Fe.value ? "true" : "false", + "aria-label": `Open generation group in grid (${je.value} assets)`, + title: `Open generation group in grid (${je.value} assets)`, + onClick: Le, + onPointerdown: n[3] ||= fr(() => {}, ["stop"]), + onMousedown: n[4] ||= fr(() => {}, ["stop", "prevent"]), + onTouchstartPassive: n[5] ||= fr(() => {}, ["stop"]), + onDblclick: n[6] ||= fr(() => {}, ["stop"]), + onKeydown: n[7] ||= fr(() => {}, ["stop"]), + onDragstart: n[8] ||= fr(() => {}, ["stop", "prevent"]) }, { - default: U(() => [n[21] ||= H("span", { class: "pi pi-clone" }, null, -1), H("span", ic, q(Me.value), 1)]), + default: W(() => [n[21] ||= U("span", { class: "pi pi-clone" }, null, -1), U("span", ic, J(je.value), 1)]), _: 1 }, 8, [ "disabled", "aria-busy", "aria-label", "title" - ])) : W("", !0), - Fe.value ? (K(), rr(r, { + ])) : G("", !0), + Pe.value ? (q(), nr(r, { key: 1, type: "button", class: "mjr-dup-stack-button", severity: "secondary", text: "", rounded: "", - disabled: Le.value, - "aria-busy": Le.value ? "true" : "false", - "aria-label": `${Pe.value} duplicate${Pe.value > 1 ? "s" : ""} - click to compare all copies`, - title: `${Pe.value} duplicate${Pe.value > 1 ? "s" : ""} - click to compare all copies`, - onClick: ze, - onPointerdown: n[9] ||= pr(() => {}, ["stop"]), - onMousedown: n[10] ||= pr(() => {}, ["stop", "prevent"]), - onTouchstartPassive: n[11] ||= pr(() => {}, ["stop"]), - onDblclick: n[12] ||= pr(() => {}, ["stop"]), - onKeydown: n[13] ||= pr(() => {}, ["stop"]), - onDragstart: n[14] ||= pr(() => {}, ["stop", "prevent"]) + disabled: Ie.value, + "aria-busy": Ie.value ? "true" : "false", + "aria-label": `${Ne.value} duplicate${Ne.value > 1 ? "s" : ""} - click to compare all copies`, + title: `${Ne.value} duplicate${Ne.value > 1 ? "s" : ""} - click to compare all copies`, + onClick: Re, + onPointerdown: n[9] ||= fr(() => {}, ["stop"]), + onMousedown: n[10] ||= fr(() => {}, ["stop", "prevent"]), + onTouchstartPassive: n[11] ||= fr(() => {}, ["stop"]), + onDblclick: n[12] ||= fr(() => {}, ["stop"]), + onKeydown: n[13] ||= fr(() => {}, ["stop"]), + onDragstart: n[14] ||= fr(() => {}, ["stop", "prevent"]) }, { - default: U(() => [n[22] ||= H("span", { class: "pi pi-copy" }, null, -1), H("span", ac, q(Pe.value), 1)]), + default: W(() => [n[22] ||= U("span", { class: "pi pi-copy" }, null, -1), U("span", ac, J(Ne.value), 1)]), _: 1 }, 8, [ "disabled", "aria-busy", "aria-label", "title" - ])) : W("", !0) + ])) : G("", !0) ], 64); }; } @@ -4467,7 +4467,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ let n = e.__vccOpts || e; for (let [e, r] of t) n[e] = r; return n; -})(/* @__PURE__ */ ur({ +})(/* @__PURE__ */ lr({ __name: "FolderCard", props: { asset: {}, @@ -4475,7 +4475,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ }, emits: ["drop-asset"], setup(e, { emit: t }) { - let n = e, r = t, i = Z(!1); + let n = e, r = t, i = Q(!1); function a(e) { e.dataTransfer && (e.dataTransfer.dropEffect = "move"), i.value = !0; } @@ -4496,17 +4496,17 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ folderPath: a }); } - return (t, n) => (K(), Y("div", { - class: Q(["mjr-asset-card mjr-card mjr-folder-card", { + return (t, n) => (q(), X("div", { + class: wr(["mjr-asset-card mjr-card mjr-folder-card", { "is-selected": e.selected, "drop-active": i.value }]), role: "button", tabindex: 0, draggable: "true", - onDragover: pr(a, ["prevent"]), + onDragover: fr(a, ["prevent"]), onDragleave: o, - onDrop: pr(s, ["stop", "prevent"]), + onDrop: fr(s, ["stop", "prevent"]), "data-mjr-asset-id": String(e.asset.id ?? ""), "data-mjr-filename-key": String(e.asset.filename || "").toLowerCase(), "data-mjr-ext": "FOLDER", @@ -4514,25 +4514,25 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ "data-mjr-kind": "folder", "aria-label": `Folder ${e.asset.filename}`, "aria-selected": e.selected ? "true" : "false" - }, [n[1] ||= H("div", { + }, [n[1] ||= U("div", { class: "mjr-thumb", style: { display: "flex", "align-items": "center", "justify-content": "center" } - }, [H("svg", { + }, [U("svg", { width: "64", height: "64", viewBox: "0 0 24 24", "aria-hidden": "true" - }, [H("path", { + }, [U("path", { fill: "#F4C74A", d: "M10 4H4c-1.1 0-2 .9-2 2v1h20V8c0-1.1-.9-2-2-2h-8l-2-2z" - }), H("path", { + }), U("path", { fill: "#D9A730", d: "M20 6H4c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z" - })])], -1), H("div", cc, [H("div", { + })])], -1), U("div", cc, [U("div", { class: "mjr-card-filename", title: e.asset.filename, style: { @@ -4541,7 +4541,7 @@ var gs = hs(), _s = ["title"], vs = /* @__PURE__ */ ur({ "white-space": "nowrap", "margin-bottom": "4px" } - }, q(e.asset.filename), 9, lc), n[0] ||= H("div", { class: "mjr-card-meta-row" }, null, -1)])], 42, sc)); + }, J(e.asset.filename), 9, lc), n[0] ||= U("div", { class: "mjr-card-meta-row" }, null, -1)])], 42, sc)); } }), [["__scopeId", "data-v-252fa951"]]); //#endregion @@ -4550,7 +4550,7 @@ function dc(e) { return Array.from(e || []).map((e) => String(e || "").trim()).filter(Boolean); } function fc() { - let e = xr({ + let e = br({ query: "*", offset: 0, cursor: null, @@ -4579,7 +4579,7 @@ function fc() { e.virtualGrid = { setItems(t) { e.assets = Array.isArray(t) ? t.slice() : []; } }; - let t = G(() => new Set(dc(e.selectedIds))); + let t = K(() => new Set(dc(e.selectedIds))); function n(t = "", { error: n = !1 } = {}) { e.statusMessage = String(t || ""), e.statusError = !!n; } @@ -5175,7 +5175,7 @@ async function _l({ fetchPage: e, applyPage: t, getLimit: n, canContinue: r = nu }; } function vl({ query: e, collection: t, fetchPage: n, pageSize: r = 80, getPageSize: i = null } = {}) { - let a = Sr({ + let a = xr({ offset: 0, cursor: null, total: null, @@ -5183,7 +5183,7 @@ function vl({ query: e, collection: t, fetchPage: n, pageSize: r = 80, getPageSi error: null, done: !1, requestId: 0 - }), o = G(() => t?.items?.value || []), s = G(() => !a.loading && !a.done); + }), o = K(() => t?.items?.value || []), s = K(() => !a.loading && !a.done); function c() { return e && typeof e == "object" && "value" in e ? e.value : e; } @@ -5349,7 +5349,7 @@ async function bl(e, t, n, r, i, { requestId: a = 0, signal: o = null, cursor: s let t = String(u || "").toLowerCase() === "output", c = Tc({ ...l, q: N - }), j = t && Number(r ?? 0) === 0 && N === "*" && !c && String(A || "mtime_desc").toLowerCase() === "mtime_desc", M = !(t && (Number(r ?? 0) > 0 || j)), P = !!l.groupStacks, F = Number(r ?? 0) > 0 ? null : s || null, ee = i.buildListURL({ + }), j = t && Number(r ?? 0) === 0 && N === "*" && !c && String(A || "mtime_desc").toLowerCase() === "mtime_desc", M = !(t && (Number(r ?? 0) > 0 || j)), P = !!l.groupStacks, ee = Number(r ?? 0) > 0 ? null : s || null, te = i.buildListURL({ q: N, limit: n, offset: r, @@ -5373,11 +5373,11 @@ async function bl(e, t, n, r, i, { requestId: a = 0, signal: o = null, cursor: s dateRange: D || null, dateExact: O || null, sort: A, - cursor: F, + cursor: ee, includeTotal: M, groupStacks: P, metadataMode: k || null - }), te = await i.get(ee, { + }), F = await i.get(te, { timeoutMs: 12e4, ...o ? { signal: o } : {} }); @@ -5391,23 +5391,23 @@ async function bl(e, t, n, r, i, { requestId: a = 0, signal: o = null, cursor: s } catch (e) { console.debug?.(e); } - if (te.ok) { - let e = te.data?.assets || [], t = Array.isArray(e) ? e.length : 0, n = te.data?.total; + if (F.ok) { + let e = F.data?.assets || [], t = Array.isArray(e) ? e.length : 0, n = F.data?.total; return { ok: !0, assets: e, total: n == null ? null : Number(n ?? 0) || 0, count: t, - limit: Math.max(0, Number(te.data?.limit) || 0), - offset: Math.max(0, Number(te.data?.offset) || 0), - nextCursor: te.data?.next_cursor || te.data?.nextCursor || null, - hasMore: typeof te.data?.has_more == "boolean" ? te.data.has_more : null, + limit: Math.max(0, Number(F.data?.limit) || 0), + offset: Math.max(0, Number(F.data?.offset) || 0), + nextCursor: F.data?.next_cursor || F.data?.nextCursor || null, + hasMore: typeof F.data?.has_more == "boolean" ? F.data.has_more : null, sortKey: A, safeQuery: N }; } try { - if (String(te?.code || "") === "ABORTED") return { + if (String(F?.code || "") === "ABORTED") return { ok: !1, aborted: !0, error: "Aborted" @@ -5417,7 +5417,7 @@ async function bl(e, t, n, r, i, { requestId: a = 0, signal: o = null, cursor: s } return { ok: !1, - error: te.error + error: F.error }; } catch (e) { try { @@ -5522,7 +5522,7 @@ function jl(e, t) { function Ml(e, t) { let n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map(), a = []; for (let o of Array.isArray(e?.assets) ? e.assets : []) { - let e = o?.id == null ? "" : String(o.id), s = t.assetKey(o), c = jt(o?.filename); + let e = o?.id == null ? "" : String(o.id), s = t.assetKey(o), c = At(o?.filename); if (!(e && n.has(e)) && !(s && r.has(s))) { if (c) { let e = i.get(c); @@ -5549,12 +5549,12 @@ function Nl(e, t) { for (let [a, o] of r.entries()) { let r = Dl(o); i.assetKeyFn = t.assetKey; - let s = Ct(o, i, t.loadMajoorSettings); + let s = St(o, i, t.loadMajoorSettings); if (Array.isArray(s?.removed) && s.removed.length) { let e = new Set(s.removed); i.assets = i.assets.filter((t) => { let n = !e.has(t); - return n || Pt(i, t, i), n; + return n || Nt(i, t, i), n; }); try { i.hiddenPngSiblings = (Number(i.hiddenPngSiblings || 0) || 0) + s.removed.length; @@ -5585,7 +5585,7 @@ function Nl(e, t) { continue; } let [e] = i.assets.splice(d, 1); - Pt(i, e, i), n = !0; + Nt(i, e, i), n = !0; } continue; } @@ -5683,7 +5683,7 @@ function Gl(e) { function Kl(e) { if (!e || typeof e != "object") return ""; if (e.id != null && String(e.id).trim()) return `id:${String(e.id).trim()}`; - let t = String(e?.type || e?.source || "output").trim().toLowerCase(), n = String(Ne(e) || "").trim().toLowerCase(), r = String(e?.subfolder || "").trim().toLowerCase(), i = String(e?.filename || "").trim().toLowerCase(); + let t = String(e?.type || e?.source || "output").trim().toLowerCase(), n = String(Me(e) || "").trim().toLowerCase(), r = String(e?.subfolder || "").trim().toLowerCase(), i = String(e?.filename || "").trim().toLowerCase(); if (i) return `${t}|${n}|${r}|${i}`; let a = String(e?.filepath || e?.path || e?.fullpath || e?.full_path || "").trim().toLowerCase(); return a ? `${t}|${n}|path|${a}` : ""; @@ -5713,7 +5713,7 @@ function Yl(e) { return e ? typeof e == "object" && "value" in e ? e.value || null : e : null; } async function Xl() { - await cr(); + await sr(); } function Zl(e, t) { let n = String(e || "Failed to load"); @@ -5725,10 +5725,10 @@ function Zl(e, t) { } } function Ql(e, t) { - let n = Math.max(1, Math.min(z.MAX_PAGE_SIZE, Number(e) || 1)), r = Math.max(0, Number(t) || 0); + let n = Math.max(1, Math.min(B.MAX_PAGE_SIZE, Number(e) || 1)), r = Math.max(0, Number(t) || 0); if (r <= 0) return n; let i = 2 ** Math.min(r, 5); - return Math.max(1, Math.min(z.MAX_PAGE_SIZE, n * i)); + return Math.max(1, Math.min(B.MAX_PAGE_SIZE, n * i)); } function $l() { try { @@ -5740,18 +5740,18 @@ function $l() { return !1; } function eu() { - return z.PREFETCH_NEXT_PAGE ? !$l() : !1; + return B.PREFETCH_NEXT_PAGE ? !$l() : !1; } function tu(e, t = {}) { let n = Array.isArray(e.assets) ? e.assets : []; if (t.rebuildFromVisible && n.length) { - _t(e, n, { + gt(e, n, { assetKey: t.assetKey || e.assetKeyFn, preserveHiddenCount: !!t.preserveHiddenCount }); return; } - _t(e, [], { + gt(e, [], { assetKey: t.assetKey || e.assetKeyFn, preserveHiddenCount: !1 }); @@ -5887,7 +5887,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM return gc(y(), l()); } function j() { - if (!z.DEFER_GRID_FETCH_DURING_EXECUTION) return !1; + if (!B.DEFER_GRID_FETCH_DURING_EXECUTION) return !1; try { if (!Array.isArray(t.assets) || t.assets.length === 0) return !1; } catch (e) { @@ -5906,7 +5906,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } try { - m?.listener && window.removeEventListener(B.RUNTIME_STATUS, m.listener); + m?.listener && window.removeEventListener(V.RUNTIME_STATUS, m.listener); } catch (e) { console.debug?.(e); } @@ -5920,17 +5920,17 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } h = null; } - function P(e, n = z.PREFETCH_NEXT_PAGE_DELAY_MS) { + function P(e, n = B.PREFETCH_NEXT_PAGE_DELAY_MS) { if (!eu()) return; N(); let r = Math.max(0, Number(n) || 0); h = setTimeout(() => { - h = null, !(t.requestId !== e || t.done || t.loading) && he().catch((e) => { + h = null, !(t.requestId !== e || t.done || t.loading) && me().catch((e) => { console.debug?.("[AssetsManager][GridLoader] Delayed prefetch failed", e); }); }, r); } - function F(e, t = {}) { + function ee(e, t = {}) { M(); let n = (() => { try { @@ -5960,12 +5960,12 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } if (e && e !== n) { - we("[Grid] Deferred execution reload skipped - scope/filter changed during execution"); + xe("[Grid] Deferred execution reload skipped - scope/filter changed during execution"); return; } } let a = Sc(i, e); - Promise.resolve().then(() => ve(a, { + Promise.resolve().then(() => _e(a, { ...t || {}, reset: !0, preserveVisibleUntilReady: !0 @@ -5978,23 +5978,23 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM timer: setTimeout(r, 1250) }; try { - window.addEventListener(B.RUNTIME_STATUS, i); + window.addEventListener(V.RUNTIME_STATUS, i); } catch (e) { console.debug?.(e); } } - function ee(e, t = null) { + function te(e, t = null) { if (!e || typeof e != "object") return ""; - let n = e.id == null ? `${e.type || ""}|${Ne(e)}|${e.filepath || ""}|${e.subfolder || ""}|${e.filename || ""}` : `id:${e.id}`; + let n = e.id == null ? `${e.type || ""}|${Me(e)}|${e.filepath || ""}|${e.subfolder || ""}|${e.filename || ""}` : `id:${e.id}`; try { return Ja(t || y() || globalThis?.__MJR_LAST_ASSETKEY_GRID__, e, n); } catch (e) { return console.debug?.(e), n; } } - function te() { + function F() { try { - let e = Yt?.() || {}, t = e.grid || {}; + let e = Jt?.() || {}, t = e.grid || {}; return t.snapshotCacheEnabled === !0 || t.enableSnapshotCache === !0 || e.snapshotCacheEnabled === !0 || e.enableSnapshotCache === !0; } catch (e) { return console.debug?.(e), !1; @@ -6002,7 +6002,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } function I(e = "") { try { - if (!te()) return; + if (!F()) return; let n = y(), r = Array.isArray(t.assets) ? t.assets : []; if (!n || !r.length) return; let i = r.map(el).filter(Boolean); @@ -6034,20 +6034,20 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } } - function re(e, n) { - let r = _(), i = Array.isArray(n) ? n.length : 0, o = Et(e, n, t, { - loadMajoorSettings: Yt, + function ie(e, n) { + let r = _(), i = Array.isArray(n) ? n.length : 0, o = Tt(e, n, t, { + loadMajoorSettings: Jt, clearGridMessage: () => { a(); }, ensureVirtualGrid: () => t.virtualGrid, - setFileBadgeCollision: wt, - assetKey: (t) => ee(t, e), + setFileBadgeCollision: Ct, + assetKey: (t) => te(t, e), ensureDupStackCard: (e, t, n) => Xa(e, t, n) }); return g.renderTimeMs += Math.max(0, _() - r), g.assetsReceived += i, g.visibleAssetsAdded += Number(o || 0) || 0, g.hiddenOrDedupedAssets += Math.max(0, i - (Number(o || 0) || 0)), o; } - function ie(e, t) { + function ae(e, t) { let n = String(t || "*").trim() || "*"; return wc(xc(e?.dataset || {}, { q: n })); } @@ -6066,14 +6066,14 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM total: null } : e; } - async function ce(e, n, r, { requestId: i = 0, signal: a = null } = {}) { + async function L(e, n, r, { requestId: i = 0, signal: a = null } = {}) { let o = y(); if (!o) return { ok: !1, error: "Grid unavailable" }; if (r === 0) { - let s = ie(o, e), c = Fr(); + let s = ae(o, e), c = Fr(); if (c && c === s) { let o = Pr(s); if (o) try { @@ -6090,7 +6090,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM }; let c = s?.data?.assets; if (s?.ok && Array.isArray(c)) { - we("[Grid] Using early-fetched data:", c.length, "assets"); + xe("[Grid] Using early-fetched data:", c.length, "assets"); let t = s.data?.total ?? s.meta?.total ?? null; return se({ ok: !0, @@ -6107,14 +6107,14 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM }); } } catch (e) { - we("[Grid] Early fetch failed, falling back to normal fetch", e); + xe("[Grid] Early fetch failed, falling back to normal fetch", e); } } } return se(await bl(o, e, n, r, { sanitizeQuery: ql, - buildListURL: tt, - get: ae, + buildListURL: et, + get: re, getGridState: () => t }, { requestId: i, @@ -6126,7 +6126,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM offset: r }); } - let le = vl({ + let ce = vl({ query: { get value() { return t.query || "*"; @@ -6138,23 +6138,23 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM collection: { append(e = []) { let t = y(); - return t && e.length && Number(re(t, e) || 0) || 0; + return t && e.length && Number(ie(t, e) || 0) || 0; }, reset() {} }, fetchPage: async ({ query: e, limit: n, offset: r, requestId: i }) => { let a = _(); g.pagesRequested += 1; - let o = await ce(e, n, r, { + let o = await L(e, n, r, { requestId: i, signal: t.abortController?.signal || null }); return g.apiTimeMs += Math.max(0, _() - a), o; }, - pageSize: z.DEFAULT_PAGE_SIZE + pageSize: B.DEFAULT_PAGE_SIZE }); - function ue() { - le.setPageState({ + function le() { + ce.setPageState({ offset: t.offset, cursor: t.cursor, total: t.total, @@ -6164,22 +6164,22 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM error: null }); } - function de(e = {}, { syncPaged: n = !0 } = {}) { - !e || typeof e != "object" || (Object.prototype.hasOwnProperty.call(e, "offset") && (t.offset = Math.max(0, Number(e.offset || 0) || 0)), Object.prototype.hasOwnProperty.call(e, "cursor") && (t.cursor = e.cursor || null), Object.prototype.hasOwnProperty.call(e, "total") && (t.total = e.total == null ? null : Math.max(0, Number(e.total) || 0)), Object.prototype.hasOwnProperty.call(e, "done") && (t.done = !!e.done), n && ue()); + function ue(e = {}, { syncPaged: n = !0 } = {}) { + e && typeof e == "object" && (Object.prototype.hasOwnProperty.call(e, "offset") && (t.offset = Math.max(0, Number(e.offset || 0) || 0)), Object.prototype.hasOwnProperty.call(e, "cursor") && (t.cursor = e.cursor || null), Object.prototype.hasOwnProperty.call(e, "total") && (t.total = e.total == null ? null : Math.max(0, Number(e.total) || 0)), Object.prototype.hasOwnProperty.call(e, "done") && (t.done = !!e.done), n && le()); + } + function de() { + ue(ce.getPageState(), { syncPaged: !1 }); } function fe() { - de(le.getPageState(), { syncPaged: !1 }); - } - function pe() { let e = Array.isArray(t.assets) ? t.assets.length : 0; - e <= 0 || t.done || Number(t.offset || 0) >= e || de({ offset: e }, { syncPaged: !0 }); + e <= 0 || t.done || Number(t.offset || 0) >= e || ue({ offset: e }, { syncPaged: !0 }); } - function me({ title: e = "", showEmptyMessage: n = !0 } = {}) { + function pe({ title: e = "", showEmptyMessage: n = !0 } = {}) { r(), Array.isArray(t.assets) && t.assets.length ? (a(), I(e || t.query)) : n && (!t.statusMessage || !t.statusError) && i("No assets found"); let o = (Array.isArray(t.assets) ? t.assets : []).map((e) => String(e?.id || "")).filter(Boolean); (t.done || Number.isFinite(Number(t.total)) && Number(t.total || 0) <= o.length) && c(o, { activeId: t.activeId }); } - async function he() { + async function me() { let e = y(); if (!e || t.loading || t.done) return { ok: !0, @@ -6207,7 +6207,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM skipped: !0, busy: !0 }; - let h = Math.max(1, Math.min(z.MAX_PAGE_SIZE, z.DEFAULT_PAGE_SIZE)), _ = Date.now(); + let h = Math.max(1, Math.min(B.MAX_PAGE_SIZE, B.DEFAULT_PAGE_SIZE)), _ = Date.now(); t.loading = !0, a(); try { if (!t.done) { @@ -6216,8 +6216,8 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM skipped: !0, hidden: !0 }; - p || pe(), ue(); - let n = t.requestId, r = await le.loadUntilVisible({ + p || fe(), le(); + let n = t.requestId, r = await ce.loadUntilVisible({ maxEmptyPages: 6, canContinue: () => A(), getLimit: (e) => Ql(h, e), @@ -6233,12 +6233,12 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM query: t.query || "*", total: null, done: !1 - }), de({ + }), ue({ offset: 0, cursor: null, total: null, done: !1 - }), tu(t), g.resetCount += 1, p = !1, null) : Array.isArray(t.assets) && t.assets.length ? (we("[Grid LoadPage] empty response with cached visible assets - preserving cached view", { + }), tu(t), g.resetCount += 1, p = !1, null) : Array.isArray(t.assets) && t.assets.length ? (xe("[Grid LoadPage] empty response with cached visible assets - preserving cached view", { offset: t.offset, query: t.query }), { @@ -6249,10 +6249,10 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM }) : null; }, onEmptyPage: (e) => { - e.emptyPageIndex <= 0 || we(`[Grid LoadPage] fetched adaptive page with no visible additions: offset=${t.offset}, fetched=${e.count}, consumed=${e.advanced}, added=${e.added}, limit=${e.limit}, done=${t.done}, visibleCount=${t.assets.length}, total=${t.total}`); + e.emptyPageIndex <= 0 || xe(`[Grid LoadPage] fetched adaptive page with no visible additions: offset=${t.offset}, fetched=${e.count}, consumed=${e.advanced}, added=${e.added}, limit=${e.limit}, done=${t.done}, visibleCount=${t.assets.length}, total=${t.total}`); } }); - if (fe(), pe(), !r.ok) return r.aborted || r.stale ? r : (de({ done: !0 }), i(Zl("Failed to load assets", r?.error || "Unknown error"), { error: !0 }), r); + if (de(), fe(), !r.ok) return r.aborted || r.stale ? r : (ue({ done: !0 }), i(Zl("Failed to load assets", r?.error || "Unknown error"), { error: !0 }), r); if (r.preservedCached) return r; if (t.done || r.added > 0) return I(t.query || Sc(e, "*")), { ok: !0, @@ -6260,7 +6260,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM total: t.total }; let a = r.lastResult || r.firstResult || r; - return we(`[Grid LoadPage] fetched one page with no visible additions: offset=${t.offset}, fetched=${r.count}, consumed=${a.advanced}, added=${a.added}, limit=${a.limit || h}, done=${t.done}, visibleCount=${t.assets.length}, total=${t.total}`), !t.done && eu() && P(Number(t.requestId ?? 0) || 0, Math.min(z.PREFETCH_NEXT_PAGE_DELAY_MS ?? 700, 250)), { + return xe(`[Grid LoadPage] fetched one page with no visible additions: offset=${t.offset}, fetched=${r.count}, consumed=${a.advanced}, added=${a.added}, limit=${a.limit || h}, done=${t.done}, visibleCount=${t.assets.length}, total=${t.total}`), !t.done && eu() && P(Number(t.requestId ?? 0) || 0, Math.min(B.PREFETCH_NEXT_PAGE_DELAY_MS ?? 700, 250)), { ok: !0, count: r.count, total: t.total, @@ -6311,11 +6311,11 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM t.loading = !1, r(); } } - let ge = null; - function _e(e = 250) { + let he = null; + function ge(e = 250) { v("refreshHead", { appendReason: "snapshotHeadRefresh" }); try { - ge && clearTimeout(ge); + he && clearTimeout(he); } catch (e) { console.debug?.(e); } @@ -6325,8 +6325,8 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } catch (e) { console.debug?.(e); } - ge = setTimeout(async () => { - if (ge = null, Number(t.requestId) !== Number(n) || j() || !y()) return; + he = setTimeout(async () => { + if (he = null, Number(t.requestId) !== Number(n) || j() || !y()) return; if (r) { let e = null; try { @@ -6335,13 +6335,13 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } if (e && e !== r) { - we("[Grid] Snapshot head refresh skipped - context changed"); + xe("[Grid] Snapshot head refresh skipped - context changed"); return; } } - let e = Math.max(1, Math.min(z.MAX_PAGE_SIZE, z.DEFAULT_PAGE_SIZE)); + let e = Math.max(1, Math.min(B.MAX_PAGE_SIZE, B.DEFAULT_PAGE_SIZE)); try { - let i = await ce(t.query || "*", e, 0, { + let i = await L(t.query || "*", e, 0, { requestId: n, signal: t.abortController?.signal || null }); @@ -6354,22 +6354,22 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } if (e && e !== r) { - we("[Grid] Snapshot head refresh discarded - context changed mid-fetch"); + xe("[Grid] Snapshot head refresh discarded - context changed mid-fetch"); return; } } if (!i?.ok) return; let a = Array.isArray(i.assets) ? i.assets : []; - if (i.total != null && de({ total: i.total }), !a.length) return; + if (i.total != null && ue({ total: i.total }), !a.length) return; let o = 0; - for (let e of a) e && e.id != null && Oe(e) && (o += 1); - o > 0 && (I(t.query || "*"), we("[Grid] Snapshot head refresh: inserted", o, "new asset(s)")); + for (let e of a) e && e.id != null && De(e) && (o += 1); + o > 0 && (I(t.query || "*"), xe("[Grid] Snapshot head refresh: inserted", o, "new asset(s)")); } catch (e) { console.debug?.("[Grid] Snapshot head refresh failed", e); } }, Math.max(0, Number(e) || 0)); } - async function ve(e = "*", i = {}) { + async function _e(e = "*", i = {}) { let s = t.requestId, { reset: c = !0, preserveVisibleUntilReady: l = !0 } = i || {}, u = y(); if (!u) return { ok: !1, @@ -6396,14 +6396,14 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM let n = C(); n.query = m; let r = $c(n); - if (te() && ul(r) && (e = await Ee(n, { allowReplaceExisting: !0 }), t.requestId > s + +!!e)) return console.debug?.("[Grid] loadAssets aborted during deferral due to scope switch"), { + if (F() && ul(r) && (e = await Te(n, { allowReplaceExisting: !0 }), t.requestId > s + +!!e)) return console.debug?.("[Grid] loadAssets aborted during deferral due to scope switch"), { ok: !1, aborted: !0 }; } catch (e) { console.debug?.(e); } - return e ? (r(), t.loading = !1) : n("Grid refresh deferred while ComfyUI is generating..."), F(m, i || {}), { + return e ? (r(), t.loading = !1) : n("Grid refresh deferred while ComfyUI is generating..."), ee(m, i || {}), { ok: !0, deferred: !0, cached: e, @@ -6430,7 +6430,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } catch { t.abortController = null; } - t.requestId = (Number(t.requestId) || 0) + 1, N(), ne(), a(), p ? (t.query = m, de({ + t.requestId = (Number(t.requestId) || 0) + 1, N(), ne(), a(), p ? (t.query = m, ue({ offset: 0, cursor: null, total: null, @@ -6438,20 +6438,20 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM }), tu(t, { rebuildFromVisible: !0, preserveHiddenCount: !0, - assetKey: (e) => ee(e, u) + assetKey: (e) => te(e, u) })) : (o({ query: m, total: null, done: !1 - }), de({ + }), ue({ offset: 0, cursor: null, total: null, done: !1 }), tu(t), g.resetCount += 1), n(m === "*" ? "Loading assets..." : `Searching for "${m}"...`); } - let _ = await he(); - return pe(), eu() && _?.ok && !_?.skipped && !t.done && !_?.aborted && P(t.requestId), c && (me({ + let _ = await me(); + return fe(), eu() && _?.ok && !_?.skipped && !t.done && !_?.aborted && P(t.requestId), c && (pe({ title: m, showEmptyMessage: !(_?.skipped || _?.hidden || _?.aborted || _?.stale || _?.preservedCached || _?.busy) }), O(h.nextContext)), { @@ -6462,7 +6462,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM aborted: !!_?.aborted }; } - async function ye(e, s = {}) { + async function ve(e, s = {}) { let { title: c = "Collection", reset: l = !0, showLoading: u = !0, preserveVisibleUntilReady: d = !0 } = s || {}; v("reload", { reloadReason: s?.resetReason || s?.reason || "collection" }); let f = y(); @@ -6486,7 +6486,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } catch { t.abortController = null; } - t.requestId = (Number(t.requestId) || 0) + 1, ne(), a(), h ? (t.query = String(c || "Collection"), de({ + t.requestId = (Number(t.requestId) || 0) + 1, ne(), a(), h ? (t.query = String(c || "Collection"), ue({ offset: 0, cursor: null, total: p.length, @@ -6495,7 +6495,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM query: String(c || "Collection"), total: p.length, done: !0 - }), de({ + }), ue({ offset: 0, cursor: null, total: p.length, @@ -6508,12 +6508,12 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM query: String(c || "Collection"), total: p.length, done: !0 - }), tu(t), g.resetCount += 1), re(f, n), de({ + }), tu(t), g.resetCount += 1), ie(f, n), ue({ offset: n.length, cursor: null, total: n.length, done: !0 - }), me({ title: c }), O(w(String(c || "Collection"))), { + }), pe({ title: c }), O(w(String(c || "Collection"))), { ok: !0, count: n.length, total: n.length @@ -6533,7 +6533,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM t.loading = !1, u && r(); } } - function be() { + function ye() { v("reload", { reloadReason: "scopeSwitch" }); try { Ya(y()); @@ -6545,19 +6545,19 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM } catch (e) { console.debug?.(e); } - t.abortController = null, t.requestId = (Number(t.requestId) || 0) + 1, t.loading = !0, de({ + t.abortController = null, t.requestId = (Number(t.requestId) || 0) + 1, t.loading = !0, ue({ offset: 0, cursor: null, total: null, done: !1 }), N(), ne(), r(), a(), p = !0, s([], ""); } - function xe() { + function be() { t.virtualGrid?.setItems?.(t.assets || []); } function Se(e, { updateSelection: n = !0 } = {}) { - let r = hl(t, e, { assetKey: (e) => ee(e, y()) }); - return r ? (Number.isFinite(Number(t.total)) && de({ total: Math.max(0, Number(t.total || 0) - r) }), n && c(t.assets.map((e) => String(e?.id || "")).filter(Boolean), { activeId: t.activeId }), !t.assets.length && !t.loading && i("No assets found"), { + let r = hl(t, e, { assetKey: (e) => te(e, y()) }); + return r ? (Number.isFinite(Number(t.total)) && ue({ total: Math.max(0, Number(t.total || 0) - r) }), n && c(t.assets.map((e) => String(e?.id || "")).filter(Boolean), { activeId: t.activeId }), !t.assets.length && !t.loading && i("No assets found"), { ok: !0, removed: r, selectedIds: t.selectedIds.slice() @@ -6591,7 +6591,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM return console.debug?.(e), null; } } - async function Te(e) { + async function we(e) { let t = y(), n = l(); if (!t || !n || !e) return; await Xl(); @@ -6613,9 +6613,9 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(t), n.scrollTop = Number(e.scrollTop || 0) || 0, g.scrollRestoreCount += 1; } } - async function Ee(e = {}, n = {}) { + async function Te(e = {}, n = {}) { let i = y(); - if (!i || !te()) return !1; + if (!i || !F()) return !1; let s = $c(e), c = ll(s); if (!c || !Array.isArray(c.assets) || !c.assets.length || !n.allowReplaceExisting && Array.isArray(t.assets) && t.assets.length) return !1; g.lastResetReason = "snapshot"; @@ -6633,7 +6633,7 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM query: c.query || n.title || "Cached", total: Number(c.total ?? c.assets.length) || c.assets.length, done: !!c.done - }), tu(t), g.resetCount += 1, a(), r(), t.loading = !1, re(i, c.assets), de({ + }), tu(t), g.resetCount += 1, a(), r(), t.loading = !1, ie(i, c.assets), ue({ offset: Math.max(Number(c.assets.length || 0) || 0, Number(c.offset || c.assets.length) || c.assets.length), cursor: c.cursor || null, total: Number(c.total ?? c.assets.length) || c.assets.length, @@ -6641,37 +6641,37 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM }), t._mjrLastHydrateKey = s, t._mjrLastHydrateAt = Date.now(), O({ ...e, query: c.query || e.query || "*" - }), p = !1, me({ title: c.title || n.title || "Cached" }), !0; + }), p = !1, pe({ title: c.title || n.title || "Cached" }), !0; } - function De(e) { + function Ee(e) { return { getOrCreateState: () => t, ensureVirtualGrid: () => t.virtualGrid, upsertState: Hl, maxBatchSize: Vl, debounceMs: Bl, - assetKey: (t) => Kl(t) || ee(t, e), - loadMajoorSettings: Yt + assetKey: (t) => Kl(t) || te(t, e), + loadMajoorSettings: Jt }; } - function Oe(e) { + function De(e) { v("upsertRealtime", { appendReason: "realtime" }); let t = y(); - return !t || !e || !e.id ? !1 : Pl(t, e, De(t)); + return !t || !e || !e.id ? !1 : Pl(t, e, Ee(t)); } - let ke = !1; - function Ae(e) { + let Oe = !1; + function ke(e) { v("upsertRealtime", { appendReason: "realtimeImmediate" }); let t = y(); if (!t || !e || !e.id) return !1; - let n = Pl(t, e, De(t)); - return n && !ke && (ke = !0, queueMicrotask(() => { - ke = !1; + let n = Pl(t, e, Ee(t)); + return n && !Oe && (Oe = !0, queueMicrotask(() => { + Oe = !1; let e = y(); - e && Nl(e, De(e)); + e && Nl(e, Ee(e)); })), n; } - function je() { + function Ae() { I(t.query || "Cached"); try { cl(); @@ -6692,70 +6692,73 @@ function nu({ gridContainerRef: e, state: t, setLoadingMessage: n, clearLoadingM console.debug?.(e); } try { - window.removeEventListener("pagehide", je); + window.removeEventListener("pagehide", Ae); } catch (e) { console.debug?.(e); } } try { - window.addEventListener("pagehide", je, { once: !0 }); + window.addEventListener("pagehide", Ae, { once: !0 }); } catch (e) { console.debug?.(e); } return { - reload: ve, - appendNextPage: he, - refreshHead: _e, - upsertRealtime: Ae, - loadAssets: ve, - loadAssetsFromList: ye, - loadNextPage: he, - prepareGridForScopeSwitch: be, - refreshGrid: xe, + reload: _e, + appendNextPage: me, + refreshHead: ge, + upsertRealtime: ke, + loadAssets: _e, + loadAssetsFromList: ve, + loadNextPage: me, + prepareGridForScopeSwitch: ye, + refreshGrid: be, removeAssets: Se, captureAnchor: Ce, - restoreAnchor: Te, - hydrateFromSnapshot: Ee, - upsertAsset: Oe, - upsertAssetNow: Ae, + restoreAnchor: we, + hydrateFromSnapshot: Te, + upsertAsset: De, + upsertAssetNow: ke, getCanonicalState: x, getDebugSnapshot: S, - dispose: je + dispose: Ae }; } //#endregion //#region node_modules/@tanstack/virtual-core/dist/esm/lazy-measurements.js -function ru(e, t, n) { - let r = Array(e); - return new Proxy(r, { get(r, i, a) { - if (typeof i == "string") { - let a = i.charCodeAt(0); - if (a >= 48 && a <= 57) { - let a = +i; - if (Number.isInteger(a) && a >= 0 && a < e) { - let e = r[a]; - if (!e) { - let i = t[a * 2]; - e = r[a] = { - index: a, - key: n(a), - start: i, - size: t[a * 2 + 1], - end: i + t[a * 2 + 1], +function ru(e) { + return typeof e == "object" ? e.key : e; +} +function iu(e, t) { + let n = e.length; + return new Proxy(e, { get(e, r, i) { + if (typeof r == "string") { + let i = r.charCodeAt(0); + if (i >= 48 && i <= 57) { + let i = +r; + if (Number.isInteger(i) && i >= 0 && i < n) { + let n = e[i]; + if (typeof n != "object") { + let r = t[i * 2]; + n = e[i] = { + index: i, + key: n, + start: r, + size: t[i * 2 + 1], + end: r + t[i * 2 + 1], lane: 0 }; } - return e; + return n; } } - if (i === "length") return e; + if (r === "length") return n; } - return Reflect.get(r, i, a); + return Reflect.get(e, r, i); } }); } //#endregion //#region node_modules/@tanstack/virtual-core/dist/esm/utils.js -function iu(e, t, n) { +function au(e, t, n) { let r = n.initialDeps ?? [], i, a = !0; function o() { let o = e(); @@ -6765,34 +6768,34 @@ function iu(e, t, n) { r = e; }, o; } -function au(e, t) { +function ou(e, t) { if (e === void 0) throw Error(`Unexpected undefined${t ? `: ${t}` : ""}`); return e; } -var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { +var su = (e, t) => Math.abs(e - t) < 1.01, cu = (e, t, n) => { let r; return Object.assign(function(...i) { e.clearTimeout(r), r = e.setTimeout(() => t.apply(this, i), n); }, { cancel: () => { e.clearTimeout(r); } }); -}, cu, lu = () => { - if (cu !== void 0) return cu; - if (typeof navigator > "u") return cu = !1; - if (/iP(hone|od|ad)/.test(navigator.userAgent)) return cu = !0; +}, lu, uu = () => { + if (lu !== void 0) return lu; + if (typeof navigator > "u") return lu = !1; + if (/iP(hone|od|ad)/.test(navigator.userAgent)) return lu = !0; let e = navigator.maxTouchPoints; - return cu = navigator.platform === "MacIntel" && e !== void 0 && e > 0; -}, uu = (e) => { + return lu = navigator.platform === "MacIntel" && e !== void 0 && e > 0; +}, du = (e) => { let { offsetWidth: t, offsetHeight: n } = e; return { width: t, height: n }; -}, du = (e) => e, fu = (e) => { +}, fu = (e) => e, pu = (e) => { let t = Math.max(e.startIndex - e.overscan, 0), n = Math.min(e.endIndex + e.overscan, e.count - 1) - t + 1, r = Array(n); for (let e = 0; e < n; e++) r[e] = t + e; return r; -}, pu = (e, t) => { +}, mu = (e, t) => { let n = e.scrollElement; if (!n) return; let r = e.targetWindow; @@ -6804,7 +6807,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { height: Math.round(r) }); }; - if (i(uu(n)), !r.ResizeObserver) return () => {}; + if (i(du(n)), !r.ResizeObserver) return () => {}; let a = new r.ResizeObserver((t) => { let r = () => { let e = t[0]; @@ -6818,28 +6821,28 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { return; } } - i(uu(n)); + i(du(n)); }; e.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(r) : r(); }); return a.observe(n, { box: "border-box" }), () => { a.unobserve(n); }; -}, mu = { passive: !0 }, hu = typeof window > "u" || "onscrollend" in window, gu = (e, t, n) => { +}, hu = { passive: !0 }, gu = typeof window > "u" || "onscrollend" in window, _u = (e, t, n) => { let r = e.scrollElement; if (!r) return; let i = e.targetWindow; if (!i) return; - let a = e.options.useScrollendEvent && hu, o = 0, s = a ? null : su(i, () => t(o, !1), e.options.isScrollingResetDelay), c = (e) => () => { + let a = e.options.useScrollendEvent && gu, o = 0, s = a ? null : cu(i, () => t(n(r), !1), e.options.isScrollingResetDelay), c = (e) => () => { o = n(r), s?.(), t(o, e); }, l = c(!0), u = c(!1); - return r.addEventListener("scroll", l, mu), a && r.addEventListener("scrollend", u, mu), () => { + return r.addEventListener("scroll", l, hu), a && r.addEventListener("scrollend", u, hu), () => { r.removeEventListener("scroll", l), a && r.removeEventListener("scrollend", u), s?.cancel(); }; -}, _u = (e, t) => gu(e, t, (t) => { +}, vu = (e, t) => _u(e, t, (t) => { let { horizontal: n, isRtl: r } = e.options; return n ? t.scrollLeft * (r && -1 || 1) : t.scrollTop; -}), vu = (e, t, n) => { +}), yu = (e, t, n) => { if (n.options.useCachedMeasurements) { let t = n.indexFromElement(e), r = n.options.getItemKey(t); return n.itemSizeCache.get(r) ?? n.options.estimateSize(t); @@ -6853,15 +6856,30 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { if (i !== void 0) return i; } return e[n.options.horizontal ? "offsetWidth" : "offsetHeight"]; -}, yu = (e, { adjustments: t = 0, behavior: n }, r) => { +}, bu = (e, { adjustments: t = 0, behavior: n }, r) => { var i, a; (a = (i = r.scrollElement)?.scrollTo) == null || a.call(i, { [r.options.horizontal ? "left" : "top"]: e + t, behavior: n }); -}, bu = class { +}; +function xu(e, t, n, r) { + if (t === 0) return !1; + let i = r(0), a = /* @__PURE__ */ new Set(), o = 0; + for (; o < e;) { + let e = n(o); + if (e === i) break; + a.add(e), o++; + } + let s = e - o; + if (s === 0 || s >= t) return !1; + for (let e = 0; e < s; e++) if (r(e) !== n(o + e)) return !1; + for (let e = s; e < t; e++) if (a.has(r(e))) return !1; + return !0; +} +var Su = class { constructor(e) { - this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._flatMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => { + this.unsubs = [], this.scrollElement = null, this.targetWindow = null, this.isScrolling = !1, this.scrollState = null, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache = /* @__PURE__ */ new Map(), this.itemSizeCacheVersion = 0, this.laneAssignments = /* @__PURE__ */ new Map(), this.pendingMin = null, this.prevLanes = void 0, this.lanesChangedFlag = !1, this.lanesSettling = !1, this.pendingScrollAnchor = null, this.scrollRect = null, this.scrollOffset = null, this.scrollDirection = null, this.scrollAdjustments = 0, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._intendedScrollOffset = null, this._clampedAdjustment = null, this.elementsCache = /* @__PURE__ */ new Map(), this.now = () => { var e; return ((e = this.targetWindow?.performance)?.now)?.call(e) ?? Date.now(); }, this.observer = /* @__PURE__ */ (() => { @@ -6900,10 +6918,10 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { scrollPaddingStart: 0, scrollPaddingEnd: 0, horizontal: !1, - getItemKey: du, - rangeExtractor: fu, + getItemKey: fu, + rangeExtractor: pu, onChange: () => {}, - measureElement: vu, + measureElement: yu, initialRect: { width: 0, height: 0 @@ -6930,25 +6948,25 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { } let n = this.options, r = null, i = null, a = !1; if (n !== void 0 && n.enabled && t.enabled && t.anchorTo === "end" && this.scrollElement !== null) { - let e = n.count, o = t.count, s = this.getMeasurements(), c = e > 0 ? s[0]?.key ?? n.getItemKey(0) : null, l = e > 0 ? s[e - 1]?.key ?? n.getItemKey(e - 1) : null; - if (o !== e || e > 0 && o > 0 && (t.getItemKey(0) !== c || t.getItemKey(o - 1) !== l)) { + let e = n.count, o = t.count, s = this.getMeasurements(), c = this._singleLaneMeasurements?.items ?? s, l = (e) => ru(c[e]), u = e > 0 ? l(0) : null, d = e > 0 ? l(e - 1) : null; + if (o !== e || e > 0 && o > 0 && (t.getItemKey(0) !== u || t.getItemKey(o - 1) !== d)) { a = !0; let c = e > 0 ? this.getVirtualItemForOffset(this.getScrollOffset()) ?? s[0] : null; c && (r = [c.key, this.getScrollOffset() - c.start]); let u = t.followOnAppend === !0 ? "auto" : t.followOnAppend || null; - u && o > e && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== l) && (i = u); + u && o > 0 && this.isAtEnd(n.scrollEndThreshold) && (e === 0 || t.getItemKey(o - 1) !== d) && (o > e || xu(e, o, l, t.getItemKey)) && (i = u); } } this.options = t, a && (this.pendingMin = 0, this.itemSizeCacheVersion++); let o = !1, s = 0; if (r && this.scrollOffset !== null) { - let [e, t] = r, n = this.getMeasurements(), { count: i, getItemKey: a } = this.options, c = 0; - for (; c < i && a(c) !== e;) c++; - if (c < i) { - let e = n[c]; + let [e, t] = r, n = this.getMeasurements(), { count: a, getItemKey: c } = this.options, l = 0; + for (; l < a && c(l) !== e;) l++; + if (l < a) { + let e = n[l]; if (e) { let n = Math.max(0, e.start + t); - n !== this.scrollOffset && (s = n - this.scrollOffset, this.scrollOffset = n, o = !0); + !i && n !== this.scrollOffset && (s = n - this.scrollOffset, this.scrollOffset = n, o = !0); } } } @@ -6961,7 +6979,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { }, this.notify = (e) => { var t, n; (n = (t = this.options).onChange) == null || n.call(t, this, e); - }, this.maybeNotify = iu(() => (this.calculateRange(), [ + }, this.maybeNotify = au(() => (this.calculateRange(), [ this.isScrolling, this.range ? this.range.startIndex : null, this.range ? this.range.endIndex : null @@ -6976,7 +6994,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { this.range ? this.range.endIndex : null ] }), this.cleanup = () => { - this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.isScrolling = !1, this.scrollDirection = null, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this.scrollElement = null, this.targetWindow = null; + this.unsubs.filter(Boolean).forEach((e) => e()), this.unsubs = [], this.observer.disconnect(), this.rafId != null && this.targetWindow && (this.targetWindow.cancelAnimationFrame(this.rafId), this.rafId = null), this.scrollState = null, this.isScrolling = !1, this.scrollDirection = null, this._iosDeferredAdjustment = 0, this._iosTouching = !1, this._iosJustTouchEnded = !1, this._clampedAdjustment = null, this.scrollElement = null, this.targetWindow = null; }, this._didMount = () => () => { this.cleanup(); }, this._willUpdate = () => { @@ -6992,18 +7010,18 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { this.scrollRect = e, this.maybeNotify(); })), this.unsubs.push(this.options.observeElementOffset(this, (e, t) => { if (t && this._intendedScrollOffset === null && e === this.scrollOffset) return; - this._intendedScrollOffset !== null && Math.abs(e - this._intendedScrollOffset) < 1.5 && (e = this._intendedScrollOffset), this._intendedScrollOffset = null, this.scrollAdjustments = 0; + this._intendedScrollOffset !== null && Math.abs(e - this._intendedScrollOffset) < 1.5 && (e = this._intendedScrollOffset), this._intendedScrollOffset = null, this._clampedAdjustment !== null && Math.abs(e - this._clampedAdjustment.maxAtWrite) >= 1.5 && (this._clampedAdjustment = null), this.scrollAdjustments = 0; let n = this.getScrollOffset(); this.scrollDirection = t ? n === e ? this.scrollDirection : n < e ? "forward" : "backward" : null, this.scrollOffset = e, this.isScrolling = t, this._flushIosDeferredIfReady(), this.scrollState && this.scheduleScrollReconcile(), this.maybeNotify(); })), "addEventListener" in this.scrollElement) { let e = this.scrollElement, t = () => { this._iosTouching = !0, this._iosJustTouchEnded = !1, this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null); }, n = () => { - this._iosTouching = !1, !(!lu() || this.targetWindow == null) && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => { + this._iosTouching = !1, uu() && this.targetWindow != null && (this._iosJustTouchEnded = !0, this._iosTouchEndTimerId = this.targetWindow.setTimeout(() => { this._iosJustTouchEnded = !1, this._iosTouchEndTimerId = null, this._flushIosDeferredIfReady(); }, 150)); }; - e.addEventListener("touchstart", t, mu), e.addEventListener("touchend", n, mu), this.unsubs.push(() => { + e.addEventListener("touchstart", t, hu), e.addEventListener("touchend", n, hu), this.unsubs.push(() => { e.removeEventListener("touchstart", t), e.removeEventListener("touchend", n), this._iosTouchEndTimerId !== null && this.targetWindow != null && (this.targetWindow.clearTimeout(this._iosTouchEndTimerId), this._iosTouchEndTimerId = null); }); } @@ -7015,11 +7033,22 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { let t = this.pendingScrollAnchor; if (this.pendingScrollAnchor = null, t && this.scrollElement && this.options.enabled) { let [e, n, r, i] = t; - e !== null && !r && (lu() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? i !== 0 && (this._iosDeferredAdjustment += i) : this._scrollToOffset(this.getScrollOffset(), { + e !== null && !r && (uu() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? i !== 0 && (this._iosDeferredAdjustment += i) : this.scrollState?.behavior === "smooth" && !su(this.getScrollOffset() - i, this.scrollState.lastTargetOffset) || this._scrollToOffset(this.getScrollOffset(), { adjustments: void 0, behavior: void 0 })), r && this.scrollToEnd({ behavior: r }); } + this._retryClampedAdjustment(); + }, this._retryClampedAdjustment = () => { + if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled) return; + let { target: e, maxAtWrite: t } = this._clampedAdjustment, n = this.getMaxScrollOffset(); + n > t + .5 && (this._clampedAdjustment = e > n + .5 ? { + target: e, + maxAtWrite: n + } : null, this._scrollToOffset(e, { + adjustments: void 0, + behavior: void 0 + })); }, this._flushIosDeferredIfReady = () => { if (this._iosDeferredAdjustment === 0 || this.isScrolling || this._iosTouching || this._iosJustTouchEnded) return; let e = this.getScrollOffset(), t = this.getMaxScrollOffset(); @@ -7033,7 +7062,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { adjustments: this.scrollAdjustments += n, behavior: void 0 }); - }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getMeasurementOptions = iu(() => [ + }, this.rafId = null, this.getSize = () => this.options.enabled ? (this.scrollRect = this.scrollRect ?? this.options.initialRect, this.scrollRect[this.options.horizontal ? "width" : "height"]) : (this.scrollRect = null, 0), this.getScrollOffset = () => this.options.enabled ? (this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset == "function" ? this.options.initialOffset() : this.options.initialOffset), this.scrollOffset) : (this.scrollOffset = null, 0), this.getMeasurementOptions = au(() => [ this.options.count, this.options.paddingStart, this.options.scrollMargin, @@ -7051,32 +7080,38 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { lanes: a, laneAssignmentMode: o, gap: s - }), { key: !1 }), this.isIndexInRange = (e) => e >= 0 && e < this.options.count, this.getMeasurements = iu(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o, gap: s }, c) => { + }), { key: !1 }), this.isIndexInRange = (e) => e >= 0 && e < this.options.count, this.getMeasurements = au(() => [this.getMeasurementOptions(), this.itemSizeCacheVersion], ({ count: e, paddingStart: t, scrollMargin: n, getItemKey: r, enabled: i, lanes: a, laneAssignmentMode: o, gap: s }, c) => { let l = this.itemSizeCache; - if (!i) return this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), []; + if (!i) return this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), []; if (this.laneAssignments.size > e) for (let t of this.laneAssignments.keys()) t >= e && this.laneAssignments.delete(t); - this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => { + this.lanesChangedFlag && (this.lanesChangedFlag = !1, this.lanesSettling = !0, this.measurementsCache = [], this._singleLaneMeasurements = null, this.itemSizeCache.clear(), this.laneAssignments.clear(), this.pendingMin = null), this.measurementsCache.length === 0 && !this.lanesSettling && (this.measurementsCache = this.options.initialMeasurementsCache, this.measurementsCache.forEach((e) => { this.itemSizeCache.set(e.key, e.size); })); let u = this.lanesSettling ? 0 : this.pendingMin ?? 0; if (this.pendingMin = null, this.lanesSettling && this.measurementsCache.length === e && (this.lanesSettling = !1), a === 1) { - let i = e * 2, a = this._flatMeasurements; + let i = e * 2, a = this._singleLaneMeasurements?.flat; if (!a || a.length < i) { let e = new Float64Array(i); - a && u > 0 && e.set(a.subarray(0, u * 2)), a = e, this._flatMeasurements = a; + a && u > 0 && e.set(a.subarray(0, u * 2)), a = e; } - let o; - if (u === 0) o = t + n; + let o = u === 0 ? Array(e) : this._singleLaneMeasurements.items.slice(), c; + if (u === 0) c = t + n; else { let e = u - 1; - o = a[e * 2] + a[e * 2 + 1] + s; + c = a[e * 2] + a[e * 2 + 1] + s; } for (let t = u; t < e; t++) { - let e = r(t), n = l.get(e), i = typeof n == "number" ? n : this.options.estimateSize(t); - a[t * 2] = o, a[t * 2 + 1] = i, o += i + s; + let e = r(t); + o[t] = e; + let n = l.get(e), i = typeof n == "number" ? n : this.options.estimateSize(t); + a[t * 2] = c, a[t * 2 + 1] = i, c += i + s; } - let c = ru(e, a, r); - return this.measurementsCache = c, c; + this._singleLaneMeasurements = { + flat: a, + items: o + }; + let d = iu(o, a); + return this.measurementsCache = d, d; } let d = this.measurementsCache.slice(0, u), f = Array(a).fill(void 0), p = new Float64Array(a), m = 0; for (let e = 0; e < u; e++) { @@ -7111,15 +7146,15 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { }, { key: !1, debug: () => this.options.debug - }), this.calculateRange = iu(() => [ + }), this.calculateRange = au(() => [ this.getMeasurements(), this.getSize(), this.getScrollOffset(), this.options.lanes - ], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = Cu(e, t, n, r, r === 1 && this._flatMeasurements != null ? this._flatMeasurements : null), this.range), { + ], (e, t, n, r) => e.length === 0 || t === 0 ? (this.range = null, null) : (this.range = Tu(e, t, n, r, r === 1 && this._singleLaneMeasurements !== null ? this._singleLaneMeasurements.flat : null), this.range), { key: !1, debug: () => this.options.debug - }), this.getVirtualIndexes = iu(() => { + }), this.getVirtualIndexes = au(() => { let e = null, t = null, n = this.calculateRange(); return n && (e = n.startIndex, t = n.endIndex), this.maybeNotify.updateDeps([ this.isScrolling, @@ -7164,8 +7199,8 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { r !== e && (r && this.observer.unobserve(r), this.observer.observe(e), this.elementsCache.set(n, e)), (!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(t) && this.resizeItem(t, this.options.measureElement(e, void 0, this)); }, this.resizeItem = (e, t) => { if (!this.isIndexInRange(e)) return; - let n, r, i, a = this._flatMeasurements; - if (this.options.lanes === 1 && a !== null) i = this.options.getItemKey(e), r = a[e * 2], n = a[e * 2 + 1]; + let n, r, i, a = this._singleLaneMeasurements?.flat; + if (this.options.lanes === 1 && a != null) i = this.options.getItemKey(e), r = a[e * 2], n = a[e * 2 + 1]; else { let t = this.measurementsCache[e]; if (!t) return; @@ -7183,9 +7218,9 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { }, s, this)); (this.pendingMin === null || e < this.pendingMin) && (this.pendingMin = e), this.itemSizeCache.set(i, t), this.itemSizeCacheVersion++; let f = !1; - a ? f = this.applyScrollAdjustment(this.getTotalSize() - c) : d && (f = this.applyScrollAdjustment(s)), this.notify(f); + a ? f = this.applyScrollAdjustment(this.getTotalSize() - c) : d && (f = this.applyScrollAdjustment(s)), this.notify(f), this._retryClampedAdjustment(); } - }, this.getVirtualItems = iu(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => { + }, this.getVirtualItems = au(() => [this.getVirtualIndexes(), this.getMeasurements()], (e, t) => { let n = []; for (let r = 0, i = e.length; r < i; r++) { let i = t[e[r]]; @@ -7198,8 +7233,8 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { }), this.getVirtualItemForOffset = (e) => { let t = this.getMeasurements(); if (t.length === 0) return; - let n = this._flatMeasurements, r = this.options.lanes === 1 && n != null; - return au(t[xu(0, t.length - 1, r ? (e) => n[e * 2] : (e) => au(t[e]).start, e)]); + let n = this._singleLaneMeasurements?.flat, r = this.options.lanes === 1 && n != null; + return ou(t[Cu(0, t.length - 1, r ? (e) => n[e * 2] : (e) => ou(t[e]).start, e)]); }, this.getMaxScrollOffset = () => { if (!this.scrollElement) return 0; if ("scrollHeight" in this.scrollElement) return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight; @@ -7281,7 +7316,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { let e = this.getMeasurements(), t; if (e.length === 0) t = this.options.paddingStart; else if (this.options.lanes === 1) { - let n = e.length - 1, r = this._flatMeasurements; + let n = e.length - 1, r = this._singleLaneMeasurements?.flat; t = r == null ? e[n]?.end ?? 0 : r[n * 2] + r[n * 2 + 1]; } else { let n = Array(this.options.lanes).fill(null), r = e.length - 1; @@ -7315,10 +7350,18 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { }, this.setOptions(e); } applyScrollAdjustment(e, t) { - return e === 0 ? !1 : lu() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded) ? (this._iosDeferredAdjustment += e, !1) : (this._scrollToOffset(this.getScrollOffset(), { - adjustments: this.scrollAdjustments += e, - behavior: t - }), this.scrollOffset !== null && (this.scrollOffset += this.scrollAdjustments, this.scrollOffset < 0 && (this.scrollOffset = 0), this.scrollAdjustments = 0), !0); + if (e === 0) return !1; + if (uu() && (this.isScrolling || this._iosTouching || this._iosJustTouchEnded)) return this._iosDeferredAdjustment += e, !1; + { + let n = this.getScrollOffset() + this.scrollAdjustments + e, r = this.scrollElement, i = r !== null && ("scrollHeight" in r || "document" in r) ? this.getMaxScrollOffset() : null; + return this._clampedAdjustment = i !== null && n > i + .5 ? { + target: n, + maxAtWrite: i + } : null, this._scrollToOffset(this.getScrollOffset(), { + adjustments: this.scrollAdjustments += e, + behavior: t + }), this.scrollOffset !== null && (this.scrollOffset += this.scrollAdjustments, this.scrollOffset < 0 && (this.scrollOffset = 0), this.scrollAdjustments = 0), !0; + } } scheduleScrollReconcile() { if (!this.targetWindow) { @@ -7336,7 +7379,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { return; } let e = this.scrollState.index == null ? void 0 : this.getOffsetForIndex(this.scrollState.index, this.scrollState.align), t = e ? e[0] : this.scrollState.lastTargetOffset, n = t !== this.scrollState.lastTargetOffset; - if (!n && ou(t, this.getScrollOffset())) { + if (!n && su(t, this.getScrollOffset())) { if (this.scrollState.stableFrames++, this.scrollState.stableFrames >= 1) { this.getScrollOffset() !== t && this._scrollToOffset(t, { adjustments: void 0, @@ -7353,7 +7396,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { } this.scheduleScrollReconcile(); } -}, xu = (e, t, n, r) => { +}, Cu = (e, t, n, r) => { for (; e <= t;) { let i = (e + t) / 2 | 0, a = n(i); if (a < r) e = i + 1; @@ -7362,7 +7405,7 @@ var ou = (e, t) => Math.abs(e - t) < 1.01, su = (e, t, n) => { } return e > 0 ? e - 1 : 0; }; -function Su(e, t, n) { +function wu(e, t, n) { let r = 0; for (; r <= t;) { let i = (r + t) / 2 | 0, a = e[i * 2]; @@ -7372,21 +7415,21 @@ function Su(e, t, n) { } return r > 0 ? r - 1 : 0; } -function Cu(e, t, n, r, i) { +function Tu(e, t, n, r, i) { let a = e.length - 1; if (e.length <= r) return { startIndex: 0, endIndex: a }; if (r === 1 && i !== null) { - let e = Su(i, a, n), r = e, o = n + t; + let e = wu(i, a, n), r = e, o = n + t; for (; r < a && i[r * 2] + i[r * 2 + 1] < o;) r++; return { startIndex: e, endIndex: r }; } - let o = xu(0, a, (t) => e[t].start, n), s = o; + let o = Cu(0, a, (t) => e[t].start, n), s = o; if (r === 1) for (; s < a && e[s].end < n + t;) s++; else if (r > 1) { let i = Array(r).fill(0); @@ -7408,35 +7451,35 @@ function Cu(e, t, n, r, i) { } //#endregion //#region node_modules/@tanstack/vue-virtual/dist/esm/index.js -function wu(e) { - let t = new bu(X(e)), n = _r(t), r = t._didMount(); - return sr(() => X(e).getScrollElement(), (e) => { +function Eu(e) { + let t = new Su(Z(e)), n = gr(t), r = t._didMount(); + return or(() => Z(e).getScrollElement(), (e) => { e && t._willUpdate(); - }, { immediate: !0 }), sr(() => X(e), (e) => { + }, { immediate: !0 }), or(() => Z(e), (e) => { t.setOptions({ ...e, onChange: (t, r) => { var i; - yr(n), (i = e.onChange) == null || i.call(e, t, r); + vr(n), (i = e.onChange) == null || i.call(e, t, r); } - }), t._willUpdate(), yr(n); - }, { immediate: !0 }), wr(r), n; + }), t._willUpdate(), vr(n); + }, { immediate: !0 }), Cr(r), n; } -function Tu(e) { - return wu(G(() => ({ - observeElementRect: pu, - observeElementOffset: _u, - scrollToFn: yu, - ...X(e) +function Du(e) { + return Eu(K(() => ({ + observeElementRect: mu, + observeElementOffset: vu, + scrollToFn: bu, + ...Z(e) }))); } //#endregion //#region ui/vue/grid/useGridVirtualRows.ts -function Eu(e, t = 0) { - let n = Number(X(e)); +function Ou(e, t = 0) { + let n = Number(Z(e)); return Number.isFinite(n) ? n : t; } -function Du(e = [], t = 1) { +function ku(e = [], t = 1) { let n = Array.isArray(e) ? e : [], r = Math.max(1, Number(t) || 1), i = []; for (let e = 0; e < n.length; e += r) i.push({ index: Math.floor(e / r), @@ -7444,29 +7487,29 @@ function Du(e = [], t = 1) { }); return i; } -function Ou(e = [], t = 0, n = 1) { +function Au(e = [], t = 0, n = 1) { let r = Array.isArray(e) ? e : [], i = Math.max(1, Number(n) || 1), a = Math.max(0, Number(t) || 0) * i; return r.slice(a, a + i); } -function ku({ scrollRef: e, items: t, rows: n, columnCount: r, estimateRowHeight: i, overscan: a = 8, enabled: o = !0, measure: s = vu } = {}) { - let c = G(() => { - if (!X(o)) return 0; - let e = X(n); +function ju({ scrollRef: e, items: t, rows: n, columnCount: r, estimateRowHeight: i, overscan: a = 8, enabled: o = !0, measure: s = yu } = {}) { + let c = K(() => { + if (!Z(o)) return 0; + let e = Z(n); if (Array.isArray(e)) return e.length; - let i = X(t) || [], a = Math.max(1, Eu(r, 1)); + let i = Z(t) || [], a = Math.max(1, Ou(r, 1)); return Math.ceil((Array.isArray(i) ? i.length : 0) / a); - }), l = Tu(G(() => ({ + }), l = Du(K(() => ({ count: c.value, - getScrollElement: () => X(e) || null, - estimateSize: () => Math.max(1, Eu(i, 120)), - overscan: Math.max(0, Eu(a, 8)), + getScrollElement: () => Z(e) || null, + estimateSize: () => Math.max(1, Ou(i, 120)), + overscan: Math.max(0, Ou(a, 8)), measureElement: s }))); return { rowCount: c, virtualizer: l, - virtualRows: G(() => { - let e = X(n); + virtualRows: K(() => { + let e = Z(n); if (Array.isArray(e)) return l.value.getVirtualItems().map((t) => { let n = e[t.index] || {}; return { @@ -7479,29 +7522,29 @@ function ku({ scrollRef: e, items: t, rows: n, columnCount: r, estimateRowHeight groupKey: String(n?.groupKey || "") }; }); - let i = X(t) || [], a = Math.max(1, Eu(r, 1)); + let i = Z(t) || [], a = Math.max(1, Ou(r, 1)); return l.value.getVirtualItems().map((e) => ({ key: e.key, index: e.index, virtual: e, - items: Ou(i, e.index, a), + items: Au(i, e.index, a), kind: "assets", title: "", groupKey: "" })); }), - totalSize: G(() => l.value.getTotalSize()), - getRowItems: (e) => Ou(X(t) || [], e, Eu(r, 1)) + totalSize: K(() => l.value.getTotalSize()), + getRowItems: (e) => Au(Z(t) || [], e, Ou(r, 1)) }; } //#endregion //#region ui/vue/grid/useInfiniteTrigger.ts -function Au(e, t = !0) { - let n = X(e); +function Mu(e, t = !0) { + let n = Z(e); return n == null ? t : !!n; } -function ju({ rootRef: e, enabled: t = !0, canLoad: n = !0, loadMore: r, rootMargin: i = "900px", threshold: a = .01 } = {}) { - let o = Z(null), s = null, c = !1; +function Nu({ rootRef: e, enabled: t = !0, canLoad: n = !0, loadMore: r, rootMargin: i = "900px", threshold: a = .01 } = {}) { + let o = Q(null), s = null, c = !1; function l() { try { s?.disconnect?.(); @@ -7511,7 +7554,7 @@ function ju({ rootRef: e, enabled: t = !0, canLoad: n = !0, loadMore: r, rootMar s = null; } async function u() { - if (!c && !(!Au(t, !0) || !Au(n, !0)) && typeof r == "function") { + if (!c && Mu(t, !0) && Mu(n, !0) && typeof r == "function") { c = !0; try { await r(); @@ -7523,15 +7566,15 @@ function ju({ rootRef: e, enabled: t = !0, canLoad: n = !0, loadMore: r, rootMar function d() { l(); let t = o.value; - !t || typeof IntersectionObserver != "function" || (s = new IntersectionObserver((e = []) => { + t && typeof IntersectionObserver == "function" && (s = new IntersectionObserver((e = []) => { e.some((e) => e?.isIntersecting) && u(); }, { - root: X(e) || null, + root: Z(e) || null, rootMargin: i, threshold: a }), s.observe(t)); } - return dr() && (kr(d), fr(l), sr(() => [X(e), o.value], () => d(), { flush: "post" })), { + return ur() && (kr(d), dr(l), or(() => [Z(e), o.value], () => d(), { flush: "post" })), { sentinelRef: o, connect: d, disconnect: l, @@ -7540,18 +7583,18 @@ function ju({ rootRef: e, enabled: t = !0, canLoad: n = !0, loadMore: r, rootMar } //#endregion //#region ui/vue/grid/useGridDisplayAssets.ts -function Mu(e) { - let t = jt(e?.filename); +function Pu(e) { + let t = At(e?.filename); return t ? `${String(e?.source || e?.type || "").trim().toLowerCase()}|${String(e?.root_id || e?.custom_root_id || "").trim().toLowerCase()}|${String(e?.subfolder || "").trim().toLowerCase()}|${t}` : ""; } -function Nu(e) { +function Fu(e) { return !!e; } -function Pu(e) { +function Iu(e) { let t = Array.isArray(e) ? e : [], n = /* @__PURE__ */ new Map(), r = []; for (let e of t) { if (!e) continue; - let t = Mu(e); + let t = Pu(e); if (!t) { e._mjrNameCollision = !1, delete e._mjrNameCollisionCount, delete e._mjrNameCollisionPaths, e._mjrDupStack = !1, e._mjrDupMembers = null, e._mjrDupCount = 0, r.push(e); continue; @@ -7570,7 +7613,7 @@ function Pu(e) { } //#endregion //#region ui/vue/components/grid/VirtualAssetGridHost.vue?vue&type=script&setup=true&lang.ts -var Fu = { +var Lu = { key: 0, class: "mjr-grid-loading-overlay", style: { @@ -7585,19 +7628,19 @@ var Fu = { background: "rgba(20,22,28,0.55)", "backdrop-filter": "blur(2px)" } -}, Iu = { style: { width: "100%" } }, Lu = { style: { +}, Ru = { style: { width: "100%" } }, zu = { style: { "margin-top": "10px", "font-size": "12px", opacity: "0.68", "text-align": "center" -} }, Ru = ["data-index"], zu = [ +} }, Bu = ["data-index"], Vu = [ "aria-expanded", "title", "onClick" -], Bu = { +], Hu = { class: "mjr-grid-group-separator-chevron", "aria-hidden": "true" -}, Vu = { class: "mjr-grid-group-separator-title" }, Hu = [ +}, Uu = { class: "mjr-grid-group-separator-title" }, Wu = [ "data-mjr-asset-id", "data-mjr-filename-key", "data-mjr-ext", @@ -7613,21 +7656,21 @@ var Fu = { "onMousedown", "onClick", "onDblclick" -], Uu = { +], Gu = { key: 3, style: { display: "flex", "flex-direction": "column", width: "100%" } -}, Wu = [ +}, Ku = [ "aria-expanded", "title", "onClick" -], Gu = { +], qu = { class: "mjr-grid-group-separator-chevron", "aria-hidden": "true" -}, Ku = { class: "mjr-grid-group-separator-title" }, qu = [ +}, Ju = { class: "mjr-grid-group-separator-title" }, Yu = [ "data-mjr-asset-id", "data-mjr-filename-key", "data-mjr-ext", @@ -7643,7 +7686,7 @@ var Fu = { "onMousedown", "onClick", "onDblclick" -], Ju = 501, Yu = /* @__PURE__ */ ur({ +], Xu = 501, Zu = /* @__PURE__ */ lr({ __name: "VirtualAssetGridHost", props: { scrollElement: { default: null }, @@ -7668,42 +7711,42 @@ var Fu = { default: !0 } }, - setup(e, { expose: t }) { - let n = e, r = Z(null), a = Z(1024); - Z(!0); - let o = Z(0), s = Z(0), c = /* @__PURE__ */ new WeakMap(), l = 0, u = 0, d = 0, f = 0, p = 0, m = /* @__PURE__ */ new Map(), h = null, g = null; - function _() { - return h ||= import("./chunks/viewerOpenRequest-sWnzQpJQ.js").then((e) => e.n), h; - } + setup(t, { expose: n }) { + let r = t, i = Q(null), o = Q(1024); + Q(!0); + let s = Q(0), c = Q(0), l = /* @__PURE__ */ new WeakMap(), u = 0, d = 0, f = 0, p = 0, m = 0, h = /* @__PURE__ */ new Map(), g = null, _ = null; function v() { - return g ||= import("./chunks/floatingViewerManager-Crq2oCKD.js").then((e) => e.n), g; + return g ||= import("./chunks/viewerOpenRequest-CwB6clm0.js").then((e) => e.n), g; } - function y(e) { + function b() { + return _ ||= import("./chunks/floatingViewerManager-XH4AFW4G.js").then((e) => e.n), _; + } + function x(e) { return (Array.isArray(e) ? e : []).slice().sort((e, t) => { let n = Number(e?.mtime || e?.created_at || 0) || 0; return (Number(t?.mtime || t?.created_at || 0) || 0) - n; }); } - ar("mjrStackService", { + ir("mjrStackService", { openStackGroup: async (e) => { - let t = r.value; + let t = i.value; if (!t || !e) return; let n = String(e.stack_id || "").trim(); if (!n) return; - let i = `stack:${n}`; + let r = `stack:${n}`; t._mjrStackMembersCache ||= /* @__PURE__ */ new Map(); - let a = t._mjrStackMembersCache.get(i); + let a = t._mjrStackMembersCache.get(r); if (!Array.isArray(a)) { - let e = m.get(i); - e || (e = ae(Ye(n, { limit: Ju }), { timeoutMs: 3e4 }).finally(() => { - m.delete(i); - }), m.set(i, e)); - let r = await e; - if (r?.ok && Array.isArray(r?.data)) a = r.data, t._mjrStackMembersCache.set(i, a); + let e = h.get(r); + e || (e = re(Je(n, { limit: Xu }), { timeoutMs: 3e4 }).finally(() => { + h.delete(r); + }), h.set(r, e)); + let i = await e; + if (i?.ok && Array.isArray(i?.data)) a = i.data, t._mjrStackMembersCache.set(r, a); else return; } - let o = y(a); - t.dispatchEvent(new CustomEvent(B.OPEN_STACK_GROUP, { + let o = x(a); + t.dispatchEvent(new CustomEvent(V.OPEN_STACK_GROUP, { bubbles: !0, detail: { asset: e, @@ -7714,10 +7757,10 @@ var Fu = { })); }, openDupGroup: (e) => { - let t = r.value; + let t = i.value; if (!t || !e) return; let n = Array.isArray(e._mjrDupMembers) ? e._mjrDupMembers : [e]; - t.dispatchEvent(new CustomEvent(B.OPEN_STACK_GROUP, { + t.dispatchEvent(new CustomEvent(V.OPEN_STACK_GROUP, { bubbles: !0, detail: { asset: e, @@ -7728,30 +7771,30 @@ var Fu = { })); } }); - let { state: b, selectedIdSet: x, setLoadingMessage: S, clearLoadingMessage: w, setStatusMessage: T, clearStatusMessage: E, resetAssets: D, setSelection: O, reconcileSelection: A, getSelectedAssets: j, getActiveAsset: M } = fc(); + let { state: S, selectedIdSet: C, setLoadingMessage: w, clearLoadingMessage: T, setStatusMessage: E, clearStatusMessage: D, resetAssets: O, setSelection: k, reconcileSelection: A, getSelectedAssets: j, getActiveAsset: M } = fc(); function N(e) { return e ? typeof e == "object" && "value" in e ? e.value || null : e : null; } - let P = G(() => N(n.scrollElement)); - function F() { - return Il(r.value); + let P = K(() => N(r.scrollElement)); + function ee() { + return Il(i.value); } - function ee(e, { align: t = "auto" } = {}) { - let r = String(e || "").trim(); - if (!r) return; - let i = (Array.isArray(xe.value) ? xe.value : []).findIndex((e) => String(e?.id || "") === r); + function te(e, { align: t = "auto" } = {}) { + let n = String(e || "").trim(); + if (!n) return; + let i = (Array.isArray(be.value) ? be.value : []).findIndex((e) => String(e?.id || "") === n); if (!(i < 0)) { - if (n.virtualize) { - let e = Math.floor(i / Math.max(1, Be.value)); + if (r.virtualize) { + let e = Math.floor(i / Math.max(1, ze.value)); try { - Ze.value.scrollToIndex(e, { align: t }); + Xe.value.scrollToIndex(e, { align: t }); } catch (e) { console.debug?.(e); } return; } try { - b.cardElements.get(r)?.scrollIntoView?.({ + S.cardElements.get(n)?.scrollIntoView?.({ block: "nearest", inline: "nearest" }); @@ -7760,51 +7803,51 @@ var Fu = { } } } - function te() { - return gc(r.value, P.value); + function F() { + return gc(i.value, P.value); } let I = nu({ - gridContainerRef: r, - state: b, - setLoadingMessage: S, - clearLoadingMessage: w, - setStatusMessage: T, - clearStatusMessage: E, - resetAssets: D, - setSelection: O, + gridContainerRef: i, + state: S, + setLoadingMessage: w, + clearLoadingMessage: T, + setStatusMessage: E, + clearStatusMessage: D, + resetAssets: O, + setSelection: k, reconcileSelection: A, readScrollElement: () => P.value, - readRenderedCards: F, - scrollToAssetId: ee, - canLoadMore: te - }), { sentinelRef: ne } = ju({ + readRenderedCards: ee, + scrollToAssetId: te, + canLoadMore: F + }), { sentinelRef: ne } = Nu({ rootRef: P, enabled: !0, - canLoad: G(() => !b.loading && !b.done && te()), + canLoad: K(() => !S.loading && !S.done && F()), loadMore: () => I.loadNextPage(), rootMargin: "900px" }); - function re(e) { + function ie(e) { let t = String(e?.filename || ""), n = t.lastIndexOf("."); return n >= 0 ? t.slice(n + 1).toUpperCase() : ""; } - function ie(e) { + function ae(e) { let t = String(e?.filename || ""), n = t.lastIndexOf("."); return n >= 0 ? t.slice(0, n).toLowerCase() : t.toLowerCase(); } - function oe(e) { - return x.value.has(String(e?.id || "")); - } function se(e) { + return C.value.has(String(e?.id || "")); + } + function L(e) { return String(e?.kind || "").toLowerCase() === "folder"; } - function le(e) { + function ce(e) { return String(e?.kind || "").toLowerCase() === "workflow"; } - function ue() { - return String(Ce.value || "").trim().toLowerCase() === "workflow"; + function le() { + return String(Se.value || "").trim().toLowerCase() === "workflow"; } - function de(e) { + function ue(e) { let t = String(e || "none").trim().toLowerCase(); return [ "task", @@ -7812,29 +7855,29 @@ var Fu = { "category" ].includes(t) ? t : "none"; } - function fe(e) { + function de(e) { let t = String(e || ""), n = 0; for (let e = 0; e < t.length; e += 1) n = (n << 5) - n + t.charCodeAt(e), n |= 0; return `hsl(${Math.abs(n) % 360}deg 68% 60%)`; } - function pe(e, t) { + function fe(e, t) { return !e || typeof e != "object" ? "Ungrouped" : t === "task" ? String(e?.task || e?.workflow_task || "").trim() || "Task: Unknown" : t === "model" ? String(e?.model_family || e?.workflow_model_family || e?.workflow_model || e?.model || "").trim() || "Model: Unknown" : t === "category" ? String(e?.category || e?.subfolder || e?.workflow_category || "").trim() || "Category: Uncategorized" : "Ungrouped"; } - function me(e, t) { + function pe(e, t) { return (Array.isArray(e) ? e : []).slice().sort((e, n) => { - let r = pe(e, t).toLowerCase(), i = pe(n, t).toLowerCase(); + let r = fe(e, t).toLowerCase(), i = fe(n, t).toLowerCase(); if (r < i) return -1; if (r > i) return 1; let a = Number(e?.mtime || e?.created_at || 0) || 0; return (Number(n?.mtime || n?.created_at || 0) || 0) - a; }); } - function he(e, t, n) { - let r = me(e, n), i = []; + function me(e, t, n) { + let r = pe(e, n), i = []; if (!r.length) return i; let a = /* @__PURE__ */ new Map(); for (let e of r) { - let t = le(e) ? pe(e, n) : "Other"; + let t = ce(e) ? fe(e, n) : "Other"; a.has(t) || a.set(t, []), a.get(t).push(e); } let o = Array.from(a.keys()); @@ -7845,7 +7888,7 @@ var Fu = { title: e, groupKey: e, groupCount: n.length, - accent: fe(e), + accent: de(e), items: [] }); for (let r = 0; r < n.length; r += t) i.push({ @@ -7853,39 +7896,39 @@ var Fu = { title: "", groupKey: e, groupCount: n.length, - accent: fe(e), + accent: de(e), items: n.slice(r, r + t) }); } return i; } - function ge(e) { - let t = r.value; + function he(e) { + let t = i.value; return !t || String(t.dataset?.mjrGroupStacks || "") !== "1" ? !1 : !!String(e?.stack_id || "").trim() && Number(e?.stack_asset_count || 0) > 1; } - function _e(e) { + function ge(e) { return e?._mjrLivePlaceholder === !0 || e?.is_live_placeholder === !0 || String(e?.id || "").trim().toLowerCase().startsWith("live:"); } - function ve() { - let e = r.value; + function _e() { + let e = i.value; if (!e) return; - let t = new Set((Array.isArray(b.selectedIds) ? b.selectedIds : []).map((e) => String(e || "").trim()).filter(Boolean)); - Qn(e, t, b.activeId || ""); + let t = new Set((Array.isArray(S.selectedIds) ? S.selectedIds : []).map((e) => String(e || "").trim()).filter(Boolean)); + Zn(e, t, S.activeId || ""); try { - t.size ? e.dataset.mjrSelectedAssetId = String(b.activeId || Array.from(t)[0] || "") : delete e.dataset.mjrSelectedAssetId; + t.size ? e.dataset.mjrSelectedAssetId = String(S.activeId || Array.from(t)[0] || "") : delete e.dataset.mjrSelectedAssetId; } catch (e) { console.debug?.(e); } } - function ye() { - let e = r.value; + function ve() { + let e = i.value; if (!e) return; - let t = Array.isArray(b.selectedIds) ? b.selectedIds.slice() : [], i = String(b.activeId || ""), a = `${t.join("|")}::${i}`; - if (a === ye._lastSelectionKey) return; - ye._lastSelectionKey = a; + let t = Array.isArray(S.selectedIds) ? S.selectedIds.slice() : [], n = String(S.activeId || ""), a = `${t.join("|")}::${n}`; + if (a === ve._lastSelectionKey) return; + ve._lastSelectionKey = a; let o = { selectedIds: t, - activeId: i, + activeId: n, selectedAssets: j() }; try { @@ -7893,74 +7936,74 @@ var Fu = { } catch (e) { console.debug?.(e); } - if (n.emitWindowSelectionEvents) try { + if (r.emitWindowSelectionEvents) try { window.dispatchEvent(new CustomEvent("mjr:selection-changed", { detail: o })); } catch (e) { console.debug?.(e); } } - ye._lastSelectionKey = ""; - let be = G(() => Pu(b.assets)), xe = G(() => (Array.isArray(be.value) ? be.value : []).filter((e) => Nu(e))), Se = Z(/* @__PURE__ */ new Set()), Ce = Z(""), we = G(() => { - o.value; - let e = de(z.WORKFLOW_GRID_GROUP_BY); - return e === "none" || Ce.value !== "workflow" ? "none" : e; - }), Te = G(() => { - let e = Array.isArray(xe.value) ? xe.value : []; + ve._lastSelectionKey = ""; + let ye = K(() => Iu(S.assets)), be = K(() => (Array.isArray(ye.value) ? ye.value : []).filter((e) => Fu(e))), xe = Q(/* @__PURE__ */ new Set()), Se = Q(""), Ce = K(() => { + s.value; + let e = ue(B.WORKFLOW_GRID_GROUP_BY); + return e === "none" || Se.value !== "workflow" ? "none" : e; + }), we = K(() => { + let e = Array.isArray(be.value) ? be.value : []; if (!e.length) return []; - let t = we.value; - return t === "none" ? [] : he(e, Be.value, t); + let t = Ce.value; + return t === "none" ? [] : me(e, ze.value, t); }); - sr(() => `${we.value}::${Te.value.map((e) => `${e.kind}:${e.groupKey}`).join("|")}`, () => { - if (we.value === "none") { - Se.value = /* @__PURE__ */ new Set(); + or(() => `${Ce.value}::${we.value.map((e) => `${e.kind}:${e.groupKey}`).join("|")}`, () => { + if (Ce.value === "none") { + xe.value = /* @__PURE__ */ new Set(); return; } - let e = /* @__PURE__ */ new Set(), t = Se.value; - for (let n of Te.value) { + let e = /* @__PURE__ */ new Set(), t = xe.value; + for (let n of we.value) { if (n?.kind !== "header") continue; let r = String(n.groupKey || ""); r && t.has(r) && e.add(r); } - Se.value = e; + xe.value = e; }, { immediate: !0 }); + function Te(e) { + let t = String(e || ""); + return t ? xe.value.has(t) : !1; + } function Ee(e) { let t = String(e || ""); - return t ? Se.value.has(t) : !1; + if (!t) return; + let n = new Set(xe.value); + n.has(t) ? n.delete(t) : n.add(t), xe.value = n; } function De(e) { - let t = String(e || ""); - if (!t) return; - let n = new Set(Se.value); - n.has(t) ? n.delete(t) : n.add(t), Se.value = n; - } - function Oe(e) { let t = String(e?.groupKey || e?.title || ""), n = 0; for (let e = 0; e < t.length; e += 1) n = (n << 5) - n + t.charCodeAt(e) | 0; return `mjr-grid-group-separator--accent-${Math.abs(n) % 8}`; } - let Ae = G(() => { - let e = Array.isArray(xe.value) ? xe.value : []; + let ke = K(() => { + let e = Array.isArray(be.value) ? be.value : []; if (!e.length) return []; - if (we.value === "none") return Du(e, Be.value); - let t = Array.isArray(Te.value) ? Te.value : [], n = []; + if (Ce.value === "none") return ku(e, ze.value); + let t = Array.isArray(we.value) ? we.value : [], n = []; for (let e of t) { if (e?.kind === "header") { n.push(e); continue; } - Ee(String(e?.groupKey || "")) || n.push(e); + Te(String(e?.groupKey || "")) || n.push(e); } return n; }); - function je() { - let e = r.value; + function Ae() { + let e = i.value; if (!e) return; let t = { - count: Array.isArray(xe.value) ? xe.value.length : 0, - total: Number(b.total || 0) || 0 + count: Array.isArray(be.value) ? be.value.length : 0, + total: Number(S.total || 0) || 0 }; try { - e.dataset.mjrShown = String(t.count), e.dataset.mjrTotal = String(t.total), e.dataset.mjrHiddenPngSiblings = String(Number(b.hiddenPngSiblings || 0) || 0); + e.dataset.mjrShown = String(t.count), e.dataset.mjrTotal = String(t.total), e.dataset.mjrHiddenPngSiblings = String(Number(S.hiddenPngSiblings || 0) || 0); } catch (e) { console.debug?.(e); } @@ -7970,24 +8013,24 @@ var Fu = { console.debug?.(e); } } - function Me(e) { + function je(e) { if (!e?.id) return; - let t = (Array.isArray(b.assets) ? b.assets : []).find((t) => String(t?.id || "") === String(e.id)); + let t = (Array.isArray(S.assets) ? S.assets : []).find((t) => String(t?.id || "") === String(e.id)); if (t) try { t.rating = e.rating, t.tags = e.tags; } catch (e) { console.debug?.(e); } } - function Ne() { + function Me() { try { window.dispatchEvent(new CustomEvent("mjr:open-sidebar", { detail: { tab: "details" } })); } catch (e) { console.debug?.(e); } } - function Fe(e, t = 6) { - let n = b.cardElements.get(e); + function Pe(e, t = 6) { + let n = S.cardElements.get(e); if (n) { try { n.focus?.({ preventScroll: !0 }); @@ -7996,13 +8039,13 @@ var Fu = { } return; } - t <= 0 || requestAnimationFrame(() => Fe(e, t - 1)); + t <= 0 || requestAnimationFrame(() => Pe(e, t - 1)); + } + function Fe(e) { + let t = e?.detail || {}, n = String(t.assetId ?? t.id ?? "").trim(); + n && (Array.isArray(be.value) ? be.value : []).some((e) => String(e?.id || "") === n) && (k([n], n), _e(), ve(), te(n, { align: "center" }), setTimeout(() => Pe(n), 0)); } function Ie(e) { - let t = e?.detail || {}, n = String(t.assetId ?? t.id ?? "").trim(); - n && (Array.isArray(xe.value) ? xe.value : []).some((e) => String(e?.id || "") === n) && (O([n], n), ve(), ye(), ee(n, { align: "center" }), setTimeout(() => Fe(n), 0)); - } - function Le(e) { if (!e) return; e._mjrSelectionManagedByVue = !0; try { @@ -8011,29 +8054,29 @@ var Fu = { console.debug?.(e); } try { - mt?.(); + pt?.(); } catch (e) { console.debug?.(e); } - fi(e, { applySettingsClasses: n.applyDefaultSettingsClasses }); + fi(e, { applySettingsClasses: r.applyDefaultSettingsClasses }); try { - mt = $o(e); + pt = $o(e); } catch (e) { - console.debug?.(e), mt = null; + console.debug?.(e), pt = null; } - e._mjrPrimaryPointerSelectionUnbind = () => {}, e._mjrGetAssets = () => Array.isArray(xe.value) ? xe.value : [], e._mjrSetSelection = (e, t = "") => { - let n = O(e, t); - return ve(), ye(), n.selectedIds; + e._mjrPrimaryPointerSelectionUnbind = () => {}, e._mjrGetAssets = () => Array.isArray(be.value) ? be.value : [], e._mjrSetSelection = (e, t = "") => { + let n = k(e, t); + return _e(), ve(), n.selectedIds; }; let t = (e, t = {}) => { let n = I.removeAssets(e, t); - return je(), n; + return Ae(), n; }; - e._mjrRemoveAssets = t, e._mjrGetRenderedCards = () => F(), e._mjrScrollToAssetId = (e, t = {}) => { - ee(e, t); - }, e._mjrHasAssetId = (e) => (Array.isArray(b.assets) ? b.assets : []).some((t) => String(t?.id || "") === String(e || "")), e._mjrGetGridState = () => b, e._mjrGetSelectedAssets = () => j(), e._mjrGetActiveAsset = () => M(), e._mjrOnKeyboardAssetChanged = (e) => Me(e), e._mjrOpenKeyboardDetails = () => Ne(); - let r = () => (n.applyDefaultSettingsClasses && (di(e), o.value += 1), I.refreshGrid()), i = () => { - I.prepareGridForScopeSwitch(), I.dispose(), b.cardElements.clear(), e._mjrGridApi = null; + e._mjrRemoveAssets = t, e._mjrGetRenderedCards = () => ee(), e._mjrScrollToAssetId = (e, t = {}) => { + te(e, t); + }, e._mjrHasAssetId = (e) => (Array.isArray(S.assets) ? S.assets : []).some((t) => String(t?.id || "") === String(e || "")), e._mjrGetGridState = () => S, e._mjrGetSelectedAssets = () => j(), e._mjrGetActiveAsset = () => M(), e._mjrOnKeyboardAssetChanged = (e) => je(e), e._mjrOpenKeyboardDetails = () => Me(); + let n = () => (r.applyDefaultSettingsClasses && (di(e), s.value += 1), I.refreshGrid()), i = () => { + I.prepareGridForScopeSwitch(), I.dispose(), S.cardElements.clear(), e._mjrGridApi = null; }; e._mjrGridApi = { reload: (...e) => I.reload(...e), @@ -8043,7 +8086,7 @@ var Fu = { upsertRealtime: (...e) => I.upsertRealtime(...e), upsertRealtimeNow: (...e) => I.upsertAssetNow(...e), prepareForScopeSwitch: () => I.prepareGridForScopeSwitch(), - refreshGrid: r, + refreshGrid: n, captureAnchor: () => I.captureAnchor(), restoreAnchor: (e) => I.restoreAnchor(e), hydrateFromSnapshot: (...e) => I.hydrateFromSnapshot(...e), @@ -8051,116 +8094,116 @@ var Fu = { dispose: i, getCanonicalState: () => I.getCanonicalState(), getDebugSnapshot: () => I.getDebugSnapshot() - }, e._mjrLoadAssets = (...e) => I.loadAssets(...e), e._mjrLoadAssetsFromList = (...e) => I.loadAssetsFromList(...e), e._mjrPrepareForScopeSwitch = () => I.prepareGridForScopeSwitch(), e._mjrRefreshGrid = r, e._mjrCaptureAnchor = () => I.captureAnchor(), e._mjrRestoreAnchor = (e) => I.restoreAnchor(e), e._mjrHydrateFromSnapshot = (...e) => I.hydrateFromSnapshot(...e), e._mjrUpsertAsset = (e) => I.upsertAsset(e), e._mjrUpsertAssetNow = (e) => I.upsertAssetNow(e), e._mjrGetCanonicalState = () => I.getCanonicalState(), e._mjrGetDebugSnapshot = () => I.getDebugSnapshot(), e._mjrDispose = i; + }, e._mjrLoadAssets = (...e) => I.loadAssets(...e), e._mjrLoadAssetsFromList = (...e) => I.loadAssetsFromList(...e), e._mjrPrepareForScopeSwitch = () => I.prepareGridForScopeSwitch(), e._mjrRefreshGrid = n, e._mjrCaptureAnchor = () => I.captureAnchor(), e._mjrRestoreAnchor = (e) => I.restoreAnchor(e), e._mjrHydrateFromSnapshot = (...e) => I.hydrateFromSnapshot(...e), e._mjrUpsertAsset = (e) => I.upsertAsset(e), e._mjrUpsertAssetNow = (e) => I.upsertAssetNow(e), e._mjrGetCanonicalState = () => I.getCanonicalState(), e._mjrGetDebugSnapshot = () => I.getDebugSnapshot(), e._mjrDispose = i; } - sr(r, (e) => { - e && (Le(e), ve(), je()); - }, { immediate: !0 }), sr(() => `${(b.selectedIds || []).join("|")}::${String(b.activeId || "")}`, () => { - r.value && (ve(), ye()); - }, { flush: "post" }), sr(() => `${Array.isArray(xe.value) ? xe.value.length : 0}::${Number(b.total || 0)}::${Number(b.hiddenPngSiblings || 0)}`, () => { - r.value && je(); + or(i, (e) => { + e && (Ie(e), _e(), Ae()); + }, { immediate: !0 }), or(() => `${(S.selectedIds || []).join("|")}::${String(S.activeId || "")}`, () => { + i.value && (_e(), ve()); + }, { flush: "post" }), or(() => `${Array.isArray(be.value) ? be.value.length : 0}::${Number(S.total || 0)}::${Number(S.hiddenPngSiblings || 0)}`, () => { + i.value && Ae(); }, { flush: "post", immediate: !0 }); - function ze() { - let e = r.value, t = String(e?.dataset?.mjrBottomFeed || "").toLowerCase() === "true", n = Number(z.GRID_MIN_SIZE || 120) || 120; - return t ? Math.max(80, Number(z.FEED_GRID_MIN_SIZE || n) || n) : ue() ? Math.max(180, n) : Math.max(80, n); + function Re() { + let e = i.value, t = String(e?.dataset?.mjrBottomFeed || "").toLowerCase() === "true", n = Number(B.GRID_MIN_SIZE || 120) || 120; + return t ? Math.max(80, Number(B.FEED_GRID_MIN_SIZE || n) || n) : le() ? Math.max(180, n) : Math.max(80, n); } - let Be = G(() => { - o.value; - let e = Math.max(0, Number(z.GRID_GAP || 10) || 10), t = ze(), n = Number(a.value || 0) || Number(P.value?.clientWidth || 0) || 0; + let ze = K(() => { + s.value; + let e = Math.max(0, Number(B.GRID_GAP || 10) || 10), t = Re(), n = Number(o.value || 0) || Number(P.value?.clientWidth || 0) || 0; return n <= 0 ? 1 : Math.max(1, Math.floor((n + e) / (t + e))); - }), Ve = G(() => (Number(a.value || 0) || Number(P.value?.clientWidth || 0) || 0) > 0), He = G(() => (o.value, Math.max(0, Number(z.GRID_GAP || 10) || 10))), Ue = G(() => { - let e = Math.max(1, Be.value), t = Number(a.value || 0) || Number(P.value?.clientWidth || 0) || 0; - return t <= 0 ? ze() : Math.max(80, Math.floor((t - He.value * Math.max(0, e - 1)) / e)); - }), We = G(() => { - o.value; - let e = !!z.GRID_SHOW_DETAILS, t = Ue.value, n = e ? 82 : 0; - return we.value === "none" ? t + n + He.value : Math.max(48, t + n + He.value); - }), Ge = G(() => n.virtualize ? [] : Array.isArray(Ae.value) ? Ae.value : []); - function Ke(e) { - if (!u) try { - u = requestAnimationFrame(() => { - u = 0; + }), Be = K(() => (Number(o.value || 0) || Number(P.value?.clientWidth || 0) || 0) > 0), Ve = K(() => (s.value, Math.max(0, Number(B.GRID_GAP || 10) || 10))), He = K(() => { + let e = Math.max(1, ze.value), t = Number(o.value || 0) || Number(P.value?.clientWidth || 0) || 0; + return t <= 0 ? Re() : Math.max(80, Math.floor((t - Ve.value * Math.max(0, e - 1)) / e)); + }), Ue = K(() => { + s.value; + let e = !!B.GRID_SHOW_DETAILS, t = He.value, n = e ? 82 : 0; + return Ce.value === "none" ? t + n + Ve.value : Math.max(48, t + n + Ve.value); + }), We = K(() => r.virtualize ? [] : Array.isArray(ke.value) ? ke.value : []); + function Ge(e) { + if (!d) try { + d = requestAnimationFrame(() => { + d = 0; try { - let t = typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), n = Number(e?.scrollTop || 0) || 0, r = Math.max(16, t - Number(p || t)), i = Math.abs(n - Number(f || n)) / Math.max(1, We.value) * (16 / r); - s.value = Math.max(0, Math.min(20, i)), f = n, p = t, d && clearTimeout(d), d = setTimeout(() => { - d = 0, s.value = 0; + let t = typeof performance < "u" && typeof performance.now == "function" ? performance.now() : Date.now(), n = Number(e?.scrollTop || 0) || 0, r = Math.max(16, t - Number(m || t)), i = Math.abs(n - Number(p || n)) / Math.max(1, Ue.value) * (16 / r); + c.value = Math.max(0, Math.min(20, i)), p = n, m = t, f && clearTimeout(f), f = setTimeout(() => { + f = 0, c.value = 0; }, 140); } catch (e) { console.debug?.(e); } }); } catch (e) { - console.debug?.(e), u = 0; + console.debug?.(e), d = 0; } } - function qe() { - if (u) { - try { - cancelAnimationFrame(u); - } catch (e) { - console.debug?.(e); - } - u = 0; - } + function Ke() { if (d) { try { - clearTimeout(d); + cancelAnimationFrame(d); } catch (e) { console.debug?.(e); } d = 0; } - s.value = 0; + if (f) { + try { + clearTimeout(f); + } catch (e) { + console.debug?.(e); + } + f = 0; + } + c.value = 0; } - let Je = ku({ + let qe = ju({ scrollRef: P, - items: xe, - rows: Ae, - columnCount: Be, - estimateRowHeight: We, - overscan: G(() => { - let e = Math.max(1, We.value), t = P.value?.clientHeight || 0; + items: be, + rows: ke, + columnCount: ze, + estimateRowHeight: Ue, + overscan: K(() => { + let e = Math.max(1, Ue.value), t = P.value?.clientHeight || 0; if (t <= 0) return 6; - let n = Math.ceil(t / e), r = Math.ceil(s.value * 3); + let n = Math.ceil(t / e), r = Math.ceil(c.value * 3); return Math.max(3, Math.min(30, n + r)); }), - enabled: G(() => n.virtualize) - }), Xe = Je.rowCount, Ze = Je.virtualizer, Qe = Je.virtualRows, $e = Je.totalSize, tt = G(() => { + enabled: K(() => r.virtualize) + }), Ye = qe.rowCount, Xe = qe.virtualizer, Ze = qe.virtualRows, Qe = qe.totalSize, et = K(() => { let e = /* @__PURE__ */ new Map(); - for (let t of Qe.value) e.set(t.index, t.virtual || t); + for (let t of Ze.value) e.set(t.index, t.virtual || t); return e; - }), R = G(() => (o.value, !!z.GRID_SHOW_DETAILS)), nt = G(() => { - let e = Math.max(1, Number(Be.value || 1)); + }), z = K(() => (s.value, !!B.GRID_SHOW_DETAILS)), tt = K(() => { + let e = Math.max(1, Number(ze.value || 1)); return Math.max(12, Math.min(36, e * 4)); - }), rt = G(() => Array.from({ length: Number(nt.value || 12) }, (e, t) => t)), it = G(() => { - let e = Math.max(80, Number(We.value || 0) - Number(He.value || 0)), t = Math.max(80, Number(Ue.value || 0)); + }), nt = K(() => Array.from({ length: Number(tt.value || 12) }, (e, t) => t)), rt = K(() => { + let e = Math.max(80, Number(Ue.value || 0) - Number(Ve.value || 0)), t = Math.max(80, Number(He.value || 0)); return Math.max(0, e - t); - }), at = G(() => ({ + }), it = K(() => ({ display: "grid", - gridTemplateColumns: `repeat(${Math.max(1, Number(Be.value || 1))}, minmax(0, ${Math.max(80, Number(Ue.value || 0))}px))`, - gap: `${He.value}px`, + gridTemplateColumns: `repeat(${Math.max(1, Number(ze.value || 1))}, minmax(0, ${Math.max(80, Number(He.value || 0))}px))`, + gap: `${Ve.value}px`, justifyContent: "start", boxSizing: "border-box" - })), ot = G(() => ({ + })), at = K(() => ({ width: "100%", minWidth: "0", - height: `${Math.max(80, Number(We.value || 0) - Number(He.value || 0))}px`, + height: `${Math.max(80, Number(Ue.value || 0) - Number(Ve.value || 0))}px`, borderRadius: "12px", border: "1px solid rgba(255,255,255,0.22)", background: "rgba(192,198,206,0.20)", overflow: "hidden", boxShadow: "0 6px 18px rgba(0,0,0,0.24)", boxSizing: "border-box" - })), st = G(() => ({ + })), ot = K(() => ({ width: "100%", - height: `${Math.max(80, Number(Ue.value || 0))}px`, + height: `${Math.max(80, Number(He.value || 0))}px`, background: "linear-gradient(90deg, rgba(168,174,182,0.40) 0%, rgba(220,225,232,0.54) 50%, rgba(168,174,182,0.40) 100%)", backgroundSize: "220% 100%", animation: "mjr-skeleton-shimmer 2.2s ease-in-out infinite" - })), ct = G(() => ({ + })), st = K(() => ({ height: "10px", margin: "10px 10px 6px", borderRadius: "8px", @@ -8168,7 +8211,7 @@ var Fu = { background: "linear-gradient(90deg, rgba(162,168,176,0.38) 0%, rgba(214,219,226,0.52) 50%, rgba(162,168,176,0.38) 100%)", backgroundSize: "220% 100%", animation: "mjr-skeleton-shimmer 2.2s ease-in-out infinite" - })), lt = G(() => ({ + })), ct = K(() => ({ height: "10px", margin: "0 10px 10px", borderRadius: "8px", @@ -8176,23 +8219,23 @@ var Fu = { background: "linear-gradient(90deg, rgba(160,166,173,0.34) 0%, rgba(208,214,221,0.48) 50%, rgba(160,166,173,0.34) 100%)", backgroundSize: "220% 100%", animation: "mjr-skeleton-shimmer 2.2s ease-in-out infinite" - })), ut = G(() => ({ - display: R.value ? "block" : "none", - minHeight: `${Math.max(0, Number(it.value || 0))}px` + })), lt = K(() => ({ + display: z.value ? "block" : "none", + minHeight: `${Math.max(0, Number(rt.value || 0))}px` })); - function dt() { - let e = Number(P.value?.clientWidth || 0) || Number(r.value?.clientWidth || 0) || 0; - e > 0 && (a.value = e); + function ut() { + let e = Number(P.value?.clientWidth || 0) || Number(i.value?.clientWidth || 0) || 0; + e > 0 && (o.value = e); + } + let dt = null, ft = null, pt = null, mt = !1; + function ht() { + let e = String(i.value?.dataset?.mjrScope || "").trim().toLowerCase(); + Se.value !== e && (Se.value = e); } - let ft = null, pt = null, mt = null, ht = !1; function gt() { - let e = String(r.value?.dataset?.mjrScope || "").trim().toLowerCase(); - Ce.value !== e && (Ce.value = e); - } - function _t() { - Bt(); + zt(); let e = () => { - Bt(), Kt(); + zt(), Gt(); }; try { requestAnimationFrame(() => { @@ -8208,81 +8251,81 @@ var Fu = { ]) setTimeout(e, t); } kr(() => { - _t(), window.addEventListener(B.VIEWER_ACTIVE_ASSET_CHANGED, Ie); - }), sr(r, (e) => { - try { - pt?.disconnect?.(); - } catch (e) { - console.debug?.(e); - } - if (pt = null, e) { - gt(); - try { - pt = new MutationObserver(() => { - gt(); - }), pt.observe(e, { - attributes: !0, - attributeFilter: ["data-mjr-scope"] - }); - } catch (e) { - console.debug?.(e), pt = null; - } - } - }, { immediate: !0 }), sr(P, (e, t) => { + gt(), window.addEventListener(V.VIEWER_ACTIVE_ASSET_CHANGED, Fe); + }), or(i, (e) => { try { ft?.disconnect?.(); } catch (e) { console.debug?.(e); } - if (e) { - dt(); + if (ft = null, e) { + ht(); try { - ft = new ResizeObserver(() => { - dt(); - }), ft.observe(e); + ft = new MutationObserver(() => { + ht(); + }), ft.observe(e, { + attributes: !0, + attributeFilter: ["data-mjr-scope"] + }); } catch (e) { console.debug?.(e), ft = null; } } - }, { immediate: !0 }), sr(() => Xe.value, async () => { - Ve.value && (await cr(), xt(), Vt()); - }), sr(() => b.assets, async (e) => { + }, { immediate: !0 }), or(P, (e, t) => { + try { + dt?.disconnect?.(); + } catch (e) { + console.debug?.(e); + } + if (e) { + ut(); + try { + dt = new ResizeObserver(() => { + ut(); + }), dt.observe(e); + } catch (e) { + console.debug?.(e), dt = null; + } + } + }, { immediate: !0 }), or(() => Ye.value, async () => { + Be.value && (await sr(), bt(), Bt()); + }), or(() => S.assets, async (e) => { if (!Array.isArray(e) || e.length === 0) { - let e = r.value; + let e = i.value; e?._mjrStackMembersCache && e._mjrStackMembersCache.clear(); } - await cr(), xt(); + await sr(), bt(); }); - function vt(e, t) { - let n = String(t?.filename || "").trim().toLowerCase(), r = c.get(e); + function _t(e, t) { + let n = String(t?.filename || "").trim().toLowerCase(), r = l.get(e); if (r && r !== n) { - let t = b.renderedFilenameMap.get(r); - t && (t.delete(e), t.size || b.renderedFilenameMap.delete(r)); + let t = S.renderedFilenameMap.get(r); + t && (t.delete(e), t.size || S.renderedFilenameMap.delete(r)); } if (!n) { - c.delete(e); + l.delete(e); return; } - let i = b.renderedFilenameMap.get(n); - i || (i = /* @__PURE__ */ new Set(), b.renderedFilenameMap.set(n, i)), i.add(e), c.set(e, n); + let i = S.renderedFilenameMap.get(n); + i || (i = /* @__PURE__ */ new Set(), S.renderedFilenameMap.set(n, i)), i.add(e), l.set(e, n); + } + function vt(e) { + if (!e) return; + let t = l.get(e); + if (!t) return; + let n = S.renderedFilenameMap.get(t); + n && (n.delete(e), n.size || S.renderedFilenameMap.delete(t)), l.delete(e); } function yt(e) { - if (!e) return; - let t = c.get(e); - if (!t) return; - let n = b.renderedFilenameMap.get(t); - n && (n.delete(e), n.size || b.renderedFilenameMap.delete(t)), c.delete(e); - } - function bt(e) { let t = String(e || "").trim().toLowerCase(); if (!t) return; - let n = b.renderedFilenameMap.get(t), r = Array.from(n || []); + let n = S.renderedFilenameMap.get(t), r = Array.from(n || []); if (!r.length) return; - let i = (Array.isArray(b.assets) ? b.assets : []).filter((e) => String(e?.filename || "").trim().toLowerCase() === t), a = Math.max(Number(b.filenameCounts?.get?.(t) || 0) || 0, i.length), o = Ft(i), s = r.find((e) => { + let i = (Array.isArray(S.assets) ? S.assets : []).filter((e) => String(e?.filename || "").trim().toLowerCase() === t), a = Math.max(Number(S.filenameCounts?.get?.(t) || 0) || 0, i.length), o = Pt(i), s = r.find((e) => { let t = String(e._mjrAsset?.id || ""), n = String(o?.id || ""); return t && n && t === n; }) || r[0] || r[0] || null, c = s?._mjrAsset || o || i[0] || null; - Jt(c, i); + qt(c, i); for (let e of r) { delete e.dataset.mjrDupHidden; let t = e._mjrAsset; @@ -8294,31 +8337,31 @@ var Fu = { } c._mjrDupStack = !0, c._mjrDupMembers = i.length ? i : [c], c._mjrDupCount = c._mjrDupMembers.length, c._mjrNameCollision = !1; } - function xt() { - for (let e of b.renderedFilenameMap.keys()) bt(e); + function bt() { + for (let e of S.renderedFilenameMap.keys()) yt(e); } - function St(e, t) { - let i = String(e?.id || "").trim(); - if (!i) return; + function xt(e, t) { + let n = String(e?.id || "").trim(); + if (!n) return; if (!t) { - let e = b.cardElements.get(i), t = e ? c.get(e) : ""; - yt(e), b.cardElements.delete(i), bt(t); + let e = S.cardElements.get(n), t = e ? l.get(e) : ""; + vt(e), S.cardElements.delete(n), yt(t); return; } let a = t?.$el ?? t; if (a instanceof HTMLElement) { - b.cardElements.set(i, a), a._mjrIsVue = !0, a._mjrAsset = e, a._mjrReactiveAsset = e, a.dataset.mjrKind = String(e?.kind || ""), vt(a, e), bt(String(e?.filename || "").trim().toLowerCase()); + S.cardElements.set(n, a), a._mjrIsVue = !0, a._mjrAsset = e, a._mjrReactiveAsset = e, a.dataset.mjrKind = String(e?.kind || ""), _t(a, e), yt(String(e?.filename || "").trim().toLowerCase()); try { - n.onCardRendered?.(a, e, r.value); + r.onCardRendered?.(a, e, i.value); } catch (e) { console.debug?.(e); } } } - function Ct(e) { - return (t) => St(e, t); + function St(e) { + return (t) => xt(e, t); } - function wt(e, t) { + function Ct(e, t) { try { let n = e?.closest?.("a, button, input, textarea, select, label"); return !!(n && t?.contains?.(n)); @@ -8326,66 +8369,66 @@ var Fu = { return !1; } } - let Tt = { + let wt = { assetId: "", at: 0 }; - function Et(e, t) { + function Tt(e, t) { let n = String(t?.id || "").trim(); if (!n) return; if (e?.type === "click" && Number(e?.detail || 0) > 0) { - let e = Date.now() - Number(Tt.at || 0); - if (Tt.assetId === n && e >= 0 && e < 500) { - Tt.assetId = "", Tt.at = 0; + let e = Date.now() - Number(wt.at || 0); + if (wt.assetId === n && e >= 0 && e < 500) { + wt.assetId = "", wt.at = 0; return; } } - if (wt(e?.target, e?.currentTarget)) return; - let r = Array.isArray(b.assets) ? b.assets : [], i = r.findIndex((e) => String(e?.id || "") === n), a = Array.isArray(b.selectedIds) ? b.selectedIds.slice() : []; + if (Ct(e?.target, e?.currentTarget)) return; + let r = Array.isArray(S.assets) ? S.assets : [], i = r.findIndex((e) => String(e?.id || "") === n), a = Array.isArray(S.selectedIds) ? S.selectedIds.slice() : []; if (e?.shiftKey && i >= 0) { - let e = String(b.selectionAnchorId || b.activeId || n).trim(), t = r.findIndex((t) => String(t?.id || "") === e), a = t >= 0 ? t : i, o = Math.min(a, i), s = Math.max(a, i), c = r.slice(o, s + 1).map((e) => String(e?.id || "")).filter(Boolean); - O(c, n); + let e = String(S.selectionAnchorId || S.activeId || n).trim(), t = r.findIndex((t) => String(t?.id || "") === e), a = t >= 0 ? t : i, o = Math.min(a, i), s = Math.max(a, i), c = r.slice(o, s + 1).map((e) => String(e?.id || "")).filter(Boolean); + k(c, n); return; } if (e?.ctrlKey || e?.metaKey) { let e = new Set(a.map(String)); e.has(n) ? e.delete(n) : e.add(n); let t = Array.from(e); - O(t, e.has(n) ? n : t[0] || ""); + k(t, e.has(n) ? n : t[0] || ""); return; } - O([n], n); + k([n], n); try { - b.cardElements.get(n)?.focus?.({ preventScroll: !0 }); + S.cardElements.get(n)?.focus?.({ preventScroll: !0 }); } catch (e) { console.debug?.(e); } - ue() && le(t) && v().then((e) => e?.floatingViewerManager?.isGraphModeVisible?.() ? At(t) : null).catch((e) => console.debug?.(e)); + le() && ce(t) && b().then((e) => e?.floatingViewerManager?.isGraphModeVisible?.() ? kt(t) : null).catch((e) => console.debug?.(e)); } - function Dt(e, t) { + function Et(e, t) { if (Number(e?.button ?? 0) !== 0) return; let n = String(t?.id || "").trim(); if (!n) return; - let r = Array.isArray(b.selectedIds) ? b.selectedIds.map(String).filter(Boolean) : []; + let r = Array.isArray(S.selectedIds) ? S.selectedIds.map(String).filter(Boolean) : []; if (r.includes(n) && r.length > 1 && !e?.ctrlKey && !e?.metaKey && !e?.shiftKey) { - Tt.assetId = n, Tt.at = Date.now(); + wt.assetId = n, wt.at = Date.now(); return; } - Tt.assetId = n, Tt.at = Date.now(), Et(e, t); + wt.assetId = n, wt.at = Date.now(), Tt(e, t); } - async function Ot(e) { - let t = (Array.isArray(b.assets) ? b.assets : []).filter((e) => !se(e)), n = t.findIndex((t) => String(t?.id || "") === String(e?.id || "")); + async function Dt(e) { + let t = (Array.isArray(S.assets) ? S.assets : []).filter((e) => !L(e)), n = t.findIndex((t) => String(t?.id || "") === String(e?.id || "")); if (!t.length || n < 0) return; - let { requestViewerOpen: r } = await _(); + let { requestViewerOpen: r } = await v(); r({ assets: t, index: n }); } - function kt(e, t = null) { + function Ot(e, t = null) { let n = String(e?.id || "").trim(); if (!n) return; - let r = b.cardElements.get(n); + let r = S.cardElements.get(n); if (r instanceof HTMLElement) try { let e = r.getBoundingClientRect(), n = Number(t?.clientX || t?.pageX || e.right - 8) || 0, i = Number(t?.clientY || t?.pageY || e.top + 10) || 0, a = new MouseEvent("contextmenu", { bubbles: !0, @@ -8399,13 +8442,13 @@ var Fu = { console.debug?.(e); } } - async function At(e, { select: t = !1 } = {}) { + async function kt(e, { select: t = !1 } = {}) { try { let n = String(e?.id || "").trim(); - t && n && O([n], n); + t && n && k([n], n); let r = String(e?.filepath || e?.path || e?.full_path || "").trim(), i = e; if (r) try { - let t = await C(r, { timeoutMs: 25e3 }), n = t?.data?.workflow || t?.workflow || null, a = t?.data?.prompt || t?.prompt || null; + let t = await y(r, { timeoutMs: 25e3 }), n = t?.data?.workflow || t?.workflow || null, a = t?.data?.prompt || t?.prompt || null; (n || a) && (i = { ...e, workflow: n || e?.workflow, @@ -8419,93 +8462,93 @@ var Fu = { } catch (e) { console.debug?.(e); } - let { floatingViewerManager: a } = await v(); + let { floatingViewerManager: a } = await b(); await a.openAssets({ assets: [i], index: 0, mode: "graph" }); } catch (e) { - console.debug?.(e), Ne(); + console.debug?.(e), Me(); } } - async function jt(e, t) { - let n = String(e?.type || "").trim().toLowerCase(); - if (!(!n || String(t?.kind || "").toLowerCase() !== "workflow")) { - if (n === "load") { - await Mt(t); + async function At(t, n) { + let r = String(t?.type || "").trim().toLowerCase(); + if (r && String(n?.kind || "").toLowerCase() === "workflow") { + if (r === "load") { + await jt(n); return; } - if (n === "inspect") { - await At(t, { select: !0 }); + if (r === "inspect") { + await kt(n, { select: !0 }); return; } - if (n === "favorite") { - let e = !!t.favorite, n = !e; + if (r === "favorite") { + let t = !!n.favorite, r = !t; try { - t.favorite = n; - let e = String(t?.filepath || t?.path || t?.full_path || "").trim(); + n.favorite = r; + let e = String(n?.filepath || n?.path || n?.full_path || "").trim(); if (!e) throw Error("Missing workflow filepath"); - let i = await ce({ + let t = await oe({ filepath: e, - favorite: n + favorite: r }, { timeoutMs: 12e3 }); - if (!i?.ok) throw Error(String(i?.error || "Failed to save workflow favorite")); - r.value?.dispatchEvent?.(new CustomEvent("mjr:workflow-favorite-changed", { + if (!t?.ok) throw Error(String(t?.error || "Failed to save workflow favorite")); + i.value?.dispatchEvent?.(new CustomEvent("mjr:workflow-favorite-changed", { bubbles: !0, detail: { - asset: t, - favorite: n + asset: n, + favorite: r } })); - } catch (n) { - console.debug?.(n), t.favorite = e, k(L("toast.workflowFavoriteFailed", "Failed to update workflow favorite."), "error"); + } catch (r) { + console.debug?.(r), n.favorite = t, e(R("toast.workflowFavoriteFailed", "Failed to update workflow favorite."), "error"); } return; } - n === "menu" && kt(t, e?.event || null); + r === "menu" && Ot(n, t?.event || null); } } - async function Mt(e) { - let t = String(e?.filepath || e?.path || e?.full_path || "").trim(); - if (!t) { - k(L("toast.workflowMissingPath", "Workflow file path is missing."), "error"); + async function jt(t) { + let n = String(t?.filepath || t?.path || t?.full_path || "").trim(); + if (!n) { + e(R("toast.workflowMissingPath", "Workflow file path is missing."), "error"); return; } - let n = et(); - if (Re(n) === !0 && !await Wt(L("dialog.workflowLoadReplaceDirty", "Current canvas has unsaved changes. Replace it with this workflow?"), L("tab.workflow", "Workflow"))) return; - let r = await C(t, { timeoutMs: 3e4 }), a = r?.data?.workflow || r?.workflow || null; - if (!r?.ok || !a || typeof a != "object") { - k(r?.error || L("toast.workflowLoadFailed", "Failed to load workflow."), "error"); + let r = $e(); + if (Le(r) === !0 && !await Ut(R("dialog.workflowLoadReplaceDirty", "Current canvas has unsaved changes. Replace it with this workflow?"), R("tab.workflow", "Workflow"))) return; + let i = await y(n, { timeoutMs: 3e4 }), o = i?.data?.workflow || i?.workflow || null; + if (!i?.ok || !o || typeof o != "object") { + e(i?.error || R("toast.workflowLoadFailed", "Failed to load workflow."), "error"); return; } - if (!Pe(a, n).ok) { - k(L("toast.workflowImportUnavailable", "ComfyUI workflow import is unavailable in this frontend."), "error"); + if (!Ne(o, r).ok) { + e(R("toast.workflowImportUnavailable", "ComfyUI workflow import is unavailable in this frontend."), "error"); return; } try { - await i({ filepath: t }, { timeoutMs: 1e4 }); + await a({ filepath: n }, { timeoutMs: 1e4 }); } catch (e) { console.debug?.(e); } - k(L("toast.workflowLoaded", "Workflow loaded"), "success", 1800); + e(R("toast.workflowLoaded", "Workflow loaded"), "success", 1800); } - function Nt(e) { + function Mt(e) { try { - if (typeof n.onCardDblclick == "function") { - n.onCardDblclick({ + if (typeof r.onCardDblclick == "function") { + r.onCardDblclick({ asset: e, - assets: Array.isArray(b.assets) ? b.assets : [], - gridContainer: r.value + assets: Array.isArray(S.assets) ? S.assets : [], + gridContainer: i.value }); return; } } catch (e) { console.debug?.(e); } - if (se(e)) { + if (L(e)) { try { - r.value?.dispatchEvent?.(new CustomEvent("mjr:open-folder-asset", { + i.value?.dispatchEvent?.(new CustomEvent("mjr:open-folder-asset", { bubbles: !0, detail: { asset: e } })); @@ -8515,74 +8558,74 @@ var Fu = { return; } if (String(e?.kind || "").toLowerCase() === "workflow") { - Mt(e); + jt(e); return; } - Ot(e); + Dt(e); } - async function Pt({ asset: e, folderPath: t }) { - let n = String(e?.filepath || "").trim(); - if (!(!n || !t)) try { - let e = await ke({ + async function Nt({ asset: t, folderPath: n }) { + let r = String(t?.filepath || "").trim(); + if (r && n) try { + let t = await Oe({ op: "move_file", - path: n, - destination: t + path: r, + destination: n }); - e?.ok ? (k("Moved to folder", "success"), I.reload()) : k(e?.error || "Failed to move file", "error"); - } catch (e) { - k(e?.message || "Failed to move file", "error"); + t?.ok ? (e("Moved to folder", "success"), I.reload()) : e(t?.error || "Failed to move file", "error"); + } catch (t) { + e(t?.message || "Failed to move file", "error"); } } - let It = null, Lt = null, Rt = 0, zt = ""; - function Bt() { - dt(); + let Ft = null, It = null, Lt = 0, Rt = ""; + function zt() { + ut(); try { - Ze.value?.measure?.(); + Xe.value?.measure?.(); } catch (e) { console.debug?.(e); } } - function Vt() { - if (!l) try { - l = requestAnimationFrame(() => { - l = 0; + function Bt() { + if (!u) try { + u = requestAnimationFrame(() => { + u = 0; try { - Ze.value?.measure?.(); + Xe.value?.measure?.(); } catch (e) { console.debug?.(e); } }); } catch (e) { - console.debug?.(e), l = 0; + console.debug?.(e), u = 0; try { - Ze.value?.measure?.(); + Xe.value?.measure?.(); } catch (e) { console.debug?.(e); } } } - function Ht() { - Bt(), requestAnimationFrame(() => { + function Vt() { + zt(), requestAnimationFrame(() => { requestAnimationFrame(() => { - Bt(), Kt(); + zt(), Gt(); }); }), setTimeout(() => { - Bt(), Kt(); + zt(), Gt(); }, 150); } - function Ut(e) { - if (!e || !n.virtualize) return () => {}; + function Ht(e) { + if (!e || !r.virtualize) return () => {}; let t = () => { - Ke(e); + Ge(e); }; e.addEventListener("scroll", t, { passive: !0 }); try { requestAnimationFrame(() => { - t(), Kt(); + t(), Gt(); }); } catch { setTimeout(() => { - t(), Kt(); + t(), Gt(); }, 0); } return () => { @@ -8591,21 +8634,21 @@ var Fu = { } catch (e) { console.debug?.(e); } - qe(); + Ke(); }; } - sr(P, (e) => { + or(P, (e) => { try { - It?.(); + Ft?.(); } catch (e) { console.debug?.(e); } - It = Ut(e); + Ft = Ht(e); }, { immediate: !0 }); - function Gt(e) { + function Wt(e) { let t = Number(e?.clientHeight || 0) || 0; if (t > 0) return t; - let n = Number(r.value?.clientHeight || 0) || 0; + let n = Number(i.value?.clientHeight || 0) || 0; if (n > 0) return n; try { return Math.max(0, Math.floor(Number(window?.innerHeight || 0) * .7)); @@ -8613,43 +8656,43 @@ var Fu = { return 0; } } - async function Kt() { - if (!n.virtualize || !Ve.value || b.loading || b.done) return; + async function Gt() { + if (!r.virtualize || !Be.value || S.loading || S.done) return; let e = P.value; if (!e) return; - let t = Array.isArray(b.assets) ? b.assets.length : 0, r = `${t}::${Be.value}`; - if (!Lt && !(r === zt && Date.now() - Rt < 500) && (await cr(), (Number(e.scrollHeight || 0) || 0) <= Gt(e) + 40)) { + let t = Array.isArray(S.assets) ? S.assets.length : 0, n = `${t}::${ze.value}`; + if (!It && !(n === Rt && Date.now() - Lt < 500) && (await sr(), (Number(e.scrollHeight || 0) || 0) <= Wt(e) + 40)) { let e = t; - Lt = Promise.resolve(I.loadNextPage()).catch((e) => console.debug?.(e)).finally(() => { - let t = Array.isArray(b.assets) ? b.assets.length : 0; - Rt = Date.now(), zt = t === e ? r : "", Lt = null, setTimeout(() => { - Kt(); + It = Promise.resolve(I.loadNextPage()).catch((e) => console.debug?.(e)).finally(() => { + let t = Array.isArray(S.assets) ? S.assets.length : 0; + Lt = Date.now(), Rt = t === e ? n : "", It = null, setTimeout(() => { + Gt(); }, 0); }); } } - sr(() => `${Array.isArray(b.assets) ? b.assets.length : 0}::${Be.value}::${b.loading}::${b.done}`, () => { - Kt(); + or(() => `${Array.isArray(S.assets) ? S.assets.length : 0}::${ze.value}::${S.loading}::${S.done}`, () => { + Gt(); }, { flush: "post" }); - function qt(e) { - if (!(!e || !n.virtualize)) try { - Ze.value.measureElement(e); + function Kt(e) { + if (e && r.virtualize) try { + Xe.value.measureElement(e); } catch (e) { console.debug?.(e); } } - function Yt() { + function Jt() { return { - width: `${Ue.value}px`, - flex: `0 0 ${Ue.value}px`, - minWidth: `${Ue.value}px` + width: `${He.value}px`, + flex: `0 0 ${He.value}px`, + minWidth: `${He.value}px` }; } - function Xt(e) { - return tt.value.get(e) || null; + function Yt(e) { + return et.value.get(e) || null; } - function Zt(e) { - let t = Xt(e); + function Xt(e) { + let t = Yt(e); return { position: "absolute", left: "0", @@ -8657,37 +8700,42 @@ var Fu = { transform: `translateY(${Number(t?.start || 0)}px)`, width: "100%", display: "flex", - gap: `${He.value}px`, - paddingBottom: `${He.value}px`, + gap: `${Ve.value}px`, + paddingBottom: `${Ve.value}px`, + boxSizing: "border-box" + }; + } + function Zt() { + return { + display: "flex", + gap: `${Ve.value}px`, + paddingBottom: `${Ve.value}px`, boxSizing: "border-box" }; } function Qt() { - return { - display: "flex", - gap: `${He.value}px`, - paddingBottom: `${He.value}px`, - boxSizing: "border-box" - }; + s.value += 1, r.applyDefaultSettingsClasses && i.value && di(i.value); } - function $t() { - o.value += 1, n.applyDefaultSettingsClasses && r.value && di(r.value); - } - return sr(() => n.applyDefaultSettingsClasses, () => { - r.value && n.applyDefaultSettingsClasses && di(r.value); - }, { immediate: !0 }), fr(() => { + return or(() => r.applyDefaultSettingsClasses, () => { + i.value && r.applyDefaultSettingsClasses && di(i.value); + }, { immediate: !0 }), dr(() => { try { - window.removeEventListener(B.VIEWER_ACTIVE_ASSET_CHANGED, Ie); + window.removeEventListener(V.VIEWER_ACTIVE_ASSET_CHANGED, Fe); } catch (e) { console.debug?.(e); } try { - r.value?._mjrPrimaryPointerSelectionUnbind?.(); + i.value?._mjrPrimaryPointerSelectionUnbind?.(); } catch (e) { console.debug?.(e); } try { - r.value && (r.value._mjrPrimaryPointerSelectionUnbind = null, r.value._mjrSelectionManagedByVue = !1); + i.value && (i.value._mjrPrimaryPointerSelectionUnbind = null, i.value._mjrSelectionManagedByVue = !1); + } catch (e) { + console.debug?.(e); + } + try { + dt?.disconnect?.(); } catch (e) { console.debug?.(e); } @@ -8697,50 +8745,45 @@ var Fu = { console.debug?.(e); } try { - pt?.disconnect?.(); + Ft?.(); } catch (e) { console.debug?.(e); } try { - It?.(); + u && cancelAnimationFrame(u); } catch (e) { console.debug?.(e); } - try { - l && cancelAnimationFrame(l); - } catch (e) { - console.debug?.(e); - } - l = 0, qe(); + u = 0, Ke(); try { I.dispose(); } catch (e) { console.debug?.(e); } try { - mt?.(); + pt?.(); } catch (e) { console.debug?.(e); } - mt = null; + pt = null; try { - window.removeEventListener("mjr-settings-changed", $t), ht = !1; + window.removeEventListener("mjr-settings-changed", Qt), mt = !1; } catch (e) { console.debug?.(e); } try { - window.removeEventListener("mjr:keepalive-attached", Ht); + window.removeEventListener("mjr:keepalive-attached", Vt); } catch (e) { console.debug?.(e); } - }), sr(r, (e) => { - e && (ht ||= (window.addEventListener("mjr-settings-changed", $t), window.addEventListener("mjr:keepalive-attached", Ht), !0)); - }, { immediate: !0 }), t({ + }), or(i, (e) => { + e && (mt ||= (window.addEventListener("mjr-settings-changed", Qt), window.addEventListener("mjr:keepalive-attached", Vt), !0)); + }, { immediate: !0 }), n({ get gridContainer() { - return r.value; + return i.value; }, get assets() { - return Array.isArray(b.assets) ? b.assets : []; + return Array.isArray(S.assets) ? S.assets : []; }, loadAssets(...e) { return I.loadAssets(...e); @@ -8790,9 +8833,9 @@ var Fu = { dispose() { return I.dispose(); } - }), (t, n) => (K(), Y("div", { + }), (e, n) => (q(), X("div", { ref_key: "gridContainerRef", - ref: r, + ref: i, class: "mjr-grid", tabindex: "0", role: "grid", @@ -8801,27 +8844,27 @@ var Fu = { "min-height": "100%" } }, [ - X(b).loading && !X(b).assets.length ? (K(), Y("div", Fu, [H("div", Iu, [H("div", { + Z(S).loading && !Z(S).assets.length ? (q(), X("div", Lu, [U("div", Ru, [U("div", { class: "mjr-grid-skeleton-layout", - style: br(at.value) - }, [(K(!0), Y(V, null, mr(rt.value, (e) => (K(), Y("div", { + style: yr(it.value) + }, [(q(!0), X(H, null, pr(nt.value, (e) => (q(), X("div", { key: `sk-${e}`, class: "mjr-grid-skeleton-card", - style: br(ot.value) - }, [H("div", { + style: yr(at.value) + }, [U("div", { class: "mjr-grid-skeleton-thumb mjr-grid-skeleton-shimmer", - style: br(st.value) - }, null, 4), H("div", { style: br(ut.value) }, [H("div", { + style: yr(ot.value) + }, null, 4), U("div", { style: yr(lt.value) }, [U("div", { class: "mjr-grid-skeleton-line mjr-grid-skeleton-line--title mjr-grid-skeleton-shimmer", - style: br(ct.value) - }, null, 4), H("div", { + style: yr(st.value) + }, null, 4), U("div", { class: "mjr-grid-skeleton-line mjr-grid-skeleton-line--meta mjr-grid-skeleton-shimmer", - style: br(lt.value) - }, null, 4)], 4)], 4))), 128))], 4), H("div", Lu, q(X(b).loadingMessage || "Loading assets..."), 1)])])) : W("", !0), - X(b).statusMessage && !X(b).assets.length && !X(b).loading ? (K(), Y("div", { + style: yr(ct.value) + }, null, 4)], 4)], 4))), 128))], 4), U("div", zu, J(Z(S).loadingMessage || "Loading assets..."), 1)])])) : G("", !0), + Z(S).statusMessage && !Z(S).assets.length && !Z(S).loading ? (q(), X("div", { key: 1, class: "mjr-grid-message", - style: br({ + style: yr({ position: "absolute", inset: "0", zIndex: 3, @@ -8833,42 +8876,42 @@ var Fu = { pointerEvents: "none", fontSize: "14px", lineHeight: "1.4", - color: X(b).statusError ? "var(--error-text, #f44336)" : "var(--muted-text, #bdbdbd)", + color: Z(S).statusError ? "var(--error-text, #f44336)" : "var(--muted-text, #bdbdbd)", background: "rgba(0, 0, 0, 0.35)" }) - }, q(X(b).statusMessage), 5)) : W("", !0), - e.virtualize ? (K(), Y("div", { + }, J(Z(S).statusMessage), 5)) : G("", !0), + t.virtualize ? (q(), X("div", { key: 2, - style: br({ - height: `${X($e)}px`, + style: yr({ + height: `${Z(Qe)}px`, position: "relative", width: "100%", gridColumn: "1 / -1" }) - }, [(K(!0), Y(V, null, mr(X(Qe), (e) => (K(), Y("div", { + }, [(q(!0), X(H, null, pr(Z(Ze), (e) => (q(), X("div", { key: e.key, ref_for: !0, - ref: qt, + ref: Kt, "data-index": e.index, - style: br(Zt(e.index)) - }, [e.kind === "header" ? (K(), Y("button", { + style: yr(Xt(e.index)) + }, [e.kind === "header" ? (q(), X("button", { key: 0, type: "button", - class: Q(["mjr-grid-group-separator", Oe(e)]), - "aria-expanded": Ee(e.groupKey) ? "false" : "true", - title: `${Ee(e.groupKey) ? "Open" : "Close"} group`, - onClick: (t) => De(e.groupKey) - }, [H("span", Bu, [H("i", { class: Q(["pi", Ee(e.groupKey) ? "pi-chevron-down" : "pi-chevron-up"]) }, null, 2)]), H("span", Vu, q(e.title), 1)], 10, zu)) : e.items.length ? (K(!0), Y(V, { key: 1 }, mr(e.items, (e) => (K(), Y(V, { key: String(e.id) }, [se(e) ? (K(), rr(uc, { + class: wr(["mjr-grid-group-separator", De(e)]), + "aria-expanded": Te(e.groupKey) ? "false" : "true", + title: `${Te(e.groupKey) ? "Open" : "Close"} group`, + onClick: (t) => Ee(e.groupKey) + }, [U("span", Hu, [U("i", { class: wr(["pi", Te(e.groupKey) ? "pi-chevron-down" : "pi-chevron-up"]) }, null, 2)]), U("span", Uu, J(e.title), 1)], 10, Vu)) : e.items.length ? (q(!0), X(H, { key: 1 }, pr(e.items, (e) => (q(), X(H, { key: String(e.id) }, [L(e) ? (q(), nr(uc, { key: 0, ref_for: !0, - ref: Ct(e), + ref: St(e), asset: e, - selected: oe(e), - style: br(Yt()), - onMousedown: pr((t) => Dt(t, e), ["left"]), - onClick: (t) => Et(t, e), - onDblclick: pr((t) => Nt(e), ["stop"]), - onDropAsset: Pt + selected: se(e), + style: yr(Jt()), + onMousedown: fr((t) => Et(t, e), ["left"]), + onClick: (t) => Tt(t, e), + onDblclick: fr((t) => Mt(e), ["stop"]), + onDropAsset: Nt }, null, 8, [ "asset", "selected", @@ -8876,57 +8919,57 @@ var Fu = { "onMousedown", "onClick", "onDblclick" - ])) : (K(), Y("div", { + ])) : (q(), X("div", { key: 1, ref_for: !0, - ref: Ct(e), - class: Q(["mjr-asset-card mjr-card", { - "is-selected": oe(e), - "mjr-live-placeholder": _e(e) + ref: St(e), + class: wr(["mjr-asset-card mjr-card", { + "is-selected": se(e), + "mjr-live-placeholder": ge(e) }]), role: "button", tabindex: "0", draggable: "true", - style: br(Yt()), + style: yr(Jt()), "data-mjr-asset-id": String(e.id ?? ""), "data-mjr-filename-key": String(e.filename || "").toLowerCase(), - "data-mjr-ext": re(e), - "data-mjr-stem": ie(e), + "data-mjr-ext": ie(e), + "data-mjr-stem": ae(e), "data-mjr-kind": String(e.kind || ""), - "data-mjr-live-placeholder": _e(e) ? "true" : void 0, - "data-mjr-stacked": ge(e) ? "true" : void 0, - "data-mjr-stack-count": ge(e) ? String(e.stack_asset_count || 0) : void 0, + "data-mjr-live-placeholder": ge(e) ? "true" : void 0, + "data-mjr-stacked": he(e) ? "true" : void 0, + "data-mjr-stack-count": he(e) ? String(e.stack_asset_count || 0) : void 0, "data-mjr-dup-stacked": e._mjrDupStack ? "true" : void 0, "data-mjr-dup-count": e._mjrDupStack ? String(e._mjrDupCount || 0) : void 0, "aria-label": `Asset ${e.filename || ""}`, - "aria-selected": oe(e) ? "true" : "false", - onMousedown: pr((t) => Dt(t, e), ["left"]), - onClick: (t) => Et(t, e), - onDblclick: pr((t) => Nt(e), ["stop"]) - }, [J(oc, { + "aria-selected": se(e) ? "true" : "false", + onMousedown: fr((t) => Et(t, e), ["left"]), + onClick: (t) => Tt(t, e), + onDblclick: fr((t) => Mt(e), ["stop"]) + }, [Y(oc, { asset: e, - onWorkflowAction: (t) => jt(t, e) - }, null, 8, ["asset", "onWorkflowAction"])], 46, Hu))], 64))), 128)) : W("", !0)], 12, Ru))), 128))], 4)) : (K(), Y("div", Uu, [(K(!0), Y(V, null, mr(Ge.value, (e) => (K(), Y("div", { + onWorkflowAction: (t) => At(t, e) + }, null, 8, ["asset", "onWorkflowAction"])], 46, Wu))], 64))), 128)) : G("", !0)], 12, Bu))), 128))], 4)) : (q(), X("div", Gu, [(q(!0), X(H, null, pr(We.value, (e) => (q(), X("div", { key: `${e.kind || "assets"}-${e.groupKey || ""}-${e.index ?? ""}`, - style: br(Qt()) - }, [e.kind === "header" ? (K(), Y("button", { + style: yr(Zt()) + }, [e.kind === "header" ? (q(), X("button", { key: 0, type: "button", - class: Q(["mjr-grid-group-separator", Oe(e)]), - "aria-expanded": Ee(e.groupKey) ? "false" : "true", - title: `${Ee(e.groupKey) ? "Open" : "Close"} group`, - onClick: (t) => De(e.groupKey) - }, [H("span", Gu, [H("i", { class: Q(["pi", Ee(e.groupKey) ? "pi-chevron-down" : "pi-chevron-up"]) }, null, 2)]), H("span", Ku, q(e.title), 1)], 10, Wu)) : (K(!0), Y(V, { key: 1 }, mr(e.items, (e) => (K(), Y(V, { key: String(e.id) }, [se(e) ? (K(), rr(uc, { + class: wr(["mjr-grid-group-separator", De(e)]), + "aria-expanded": Te(e.groupKey) ? "false" : "true", + title: `${Te(e.groupKey) ? "Open" : "Close"} group`, + onClick: (t) => Ee(e.groupKey) + }, [U("span", qu, [U("i", { class: wr(["pi", Te(e.groupKey) ? "pi-chevron-down" : "pi-chevron-up"]) }, null, 2)]), U("span", Ju, J(e.title), 1)], 10, Ku)) : (q(!0), X(H, { key: 1 }, pr(e.items, (e) => (q(), X(H, { key: String(e.id) }, [L(e) ? (q(), nr(uc, { key: 0, ref_for: !0, - ref: Ct(e), + ref: St(e), asset: e, - selected: oe(e), - style: br(Yt()), - onMousedown: pr((t) => Dt(t, e), ["left"]), - onClick: (t) => Et(t, e), - onDblclick: pr((t) => Nt(e), ["stop"]), - onDropAsset: Pt + selected: se(e), + style: yr(Jt()), + onMousedown: fr((t) => Et(t, e), ["left"]), + onClick: (t) => Tt(t, e), + onDblclick: fr((t) => Mt(e), ["stop"]), + onDropAsset: Nt }, null, 8, [ "asset", "selected", @@ -8934,38 +8977,38 @@ var Fu = { "onMousedown", "onClick", "onDblclick" - ])) : (K(), Y("div", { + ])) : (q(), X("div", { key: 1, ref_for: !0, - ref: Ct(e), - class: Q(["mjr-asset-card mjr-card", { - "is-selected": oe(e), - "mjr-live-placeholder": _e(e) + ref: St(e), + class: wr(["mjr-asset-card mjr-card", { + "is-selected": se(e), + "mjr-live-placeholder": ge(e) }]), role: "button", tabindex: "0", draggable: "true", - style: br(Yt()), + style: yr(Jt()), "data-mjr-asset-id": String(e.id ?? ""), "data-mjr-filename-key": String(e.filename || "").toLowerCase(), - "data-mjr-ext": re(e), - "data-mjr-stem": ie(e), + "data-mjr-ext": ie(e), + "data-mjr-stem": ae(e), "data-mjr-kind": String(e.kind || ""), - "data-mjr-live-placeholder": _e(e) ? "true" : void 0, - "data-mjr-stacked": ge(e) ? "true" : void 0, - "data-mjr-stack-count": ge(e) ? String(e.stack_asset_count || 0) : void 0, + "data-mjr-live-placeholder": ge(e) ? "true" : void 0, + "data-mjr-stacked": he(e) ? "true" : void 0, + "data-mjr-stack-count": he(e) ? String(e.stack_asset_count || 0) : void 0, "data-mjr-dup-stacked": e._mjrDupStack ? "true" : void 0, "data-mjr-dup-count": e._mjrDupStack ? String(e._mjrDupCount || 0) : void 0, "aria-label": `Asset ${e.filename || ""}`, - "aria-selected": oe(e) ? "true" : "false", - onMousedown: pr((t) => Dt(t, e), ["left"]), - onClick: (t) => Et(t, e), - onDblclick: pr((t) => Nt(e), ["stop"]) - }, [J(oc, { + "aria-selected": se(e) ? "true" : "false", + onMousedown: fr((t) => Et(t, e), ["left"]), + onClick: (t) => Tt(t, e), + onDblclick: fr((t) => Mt(e), ["stop"]) + }, [Y(oc, { asset: e, - onWorkflowAction: (t) => jt(t, e) - }, null, 8, ["asset", "onWorkflowAction"])], 46, qu))], 64))), 128))], 4))), 128))])), - H("div", { + onWorkflowAction: (t) => At(t, e) + }, null, 8, ["asset", "onWorkflowAction"])], 46, Yu))], 64))), 128))], 4))), 128))])), + U("div", { ref_key: "infiniteSentinelRef", ref: ne, "aria-hidden": "true", @@ -8978,14 +9021,14 @@ var Fu = { }, null, 512) ], 512)); } -}), Xu = 240, Zu = 120, Qu = 80, $u = null, ed = null; -function td() { - return $u ||= import("./chunks/viewerOpenRequest-sWnzQpJQ.js").then((e) => e.n), $u; +}), Qu = 240, $u = 120, ed = 80, td = null, nd = null; +function rd() { + return td ||= import("./chunks/viewerOpenRequest-CwB6clm0.js").then((e) => e.n), td; } -function nd() { - return ed ||= import("./chunks/floatingViewerManager-Crq2oCKD.js").then((e) => e.n), ed; +function id() { + return nd ||= import("./chunks/floatingViewerManager-XH4AFW4G.js").then((e) => e.n), nd; } -function rd(e) { +function ad(e) { let t = document.createElement("button"); t.type = "button", t.className = "mjr-asset-card mjr-card mjr-feed-group-member-card", t.style.cssText = "display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-end;min-height:110px;padding:8px;border:1px solid var(--mjr-border,#444);border-radius:8px;background:var(--mjr-surface,#202020);color:inherit;text-align:left;overflow:hidden;"; try { @@ -8996,7 +9039,7 @@ function rd(e) { let n = document.createElement("div"); return n.className = "mjr-feed-group-member-name", n.style.cssText = "font-size:11px;font-weight:600;line-height:1.3;word-break:break-word;", n.textContent = String(e?.filename || "Asset"), t.appendChild(n), t; } -function id(e) { +function od(e) { try { if (typeof e?._mjrGetRenderedCards == "function") { let t = e._mjrGetRenderedCards(); @@ -9011,11 +9054,11 @@ function id(e) { return console.debug?.(e), []; } } -function ad(e, t, n = "") { +function sd(e, t, n = "") { let r = Array.isArray(t) ? t.map(String).filter(Boolean) : []; - return $n(e, r, { activeId: n || r[0] || "" }, id); + return Qn(e, r, { activeId: n || r[0] || "" }, od); } -function od(e) { +function cd(e) { let t = e?.grid; if (!t) return; let n = (e) => { @@ -9031,19 +9074,19 @@ function od(e) { } catch (e) { console.debug?.(e); } - let a = id(t), o = a.indexOf(n), s = Yn(t); + let a = od(t), o = a.indexOf(n), s = Jn(t); if (e.shiftKey && o >= 0) { let n = Number.isFinite(Number(t._mjrLastSelectedIndex)) ? Number(t._mjrLastSelectedIndex) : o, r = Math.min(n, o), s = Math.max(n, o), c = a.slice(r, s + 1).map((e) => String(e?.dataset?.mjrAssetId || "").trim()).filter(Boolean); - ad(t, c, i), t._mjrLastSelectedIndex = o, e.preventDefault(), e.stopPropagation(); + sd(t, c, i), t._mjrLastSelectedIndex = o, e.preventDefault(), e.stopPropagation(); return; } if (e.ctrlKey || e.metaKey) { s.has(i) ? s.delete(i) : s.add(i); let n = Array.from(s); - ad(t, n, s.has(i) ? i : n[0] || ""), o >= 0 && (t._mjrLastSelectedIndex = o), e.preventDefault(), e.stopPropagation(); + sd(t, n, s.has(i) ? i : n[0] || ""), o >= 0 && (t._mjrLastSelectedIndex = o), e.preventDefault(), e.stopPropagation(); return; } - ad(t, [i], i), o >= 0 && (t._mjrLastSelectedIndex = o); + sd(t, [i], i), o >= 0 && (t._mjrLastSelectedIndex = o); try { n.focus?.({ preventScroll: !0 }); } catch (e) { @@ -9059,23 +9102,23 @@ function od(e) { } }; } -var sd = { +var ld = { hosts: /* @__PURE__ */ new Set(), pendingAssets: /* @__PURE__ */ new Map() }; -function cd(e) { - if (!z.EXECUTION_GROUPING_ENABLED) return Cd(e); +function ud(e) { + if (!B.EXECUTION_GROUPING_ENABLED) return Td(e); let t = String(e?.stack_id || "").trim(); if (t) return `stack:${t}`; let n = String(e?.job_id || "").trim(); - return n ? `job:${n}` : Cd(e); + return n ? `job:${n}` : Td(e); } -function ld(e) { +function dd(e) { let t = /* @__PURE__ */ new Map(); for (let n of Array.isArray(e) ? e : []) { - let e = Td(n); + let e = Dd(n); if (!e) continue; - let r = cd(e), i = t.get(r); + let r = ud(e), i = t.get(r); i || (i = { key: r, members: [] @@ -9100,16 +9143,16 @@ function ld(e) { return (Number(t?.mtime || t?.created_at || 0) || 0) - n; }), n; } -function ud(e) { +function fd(e) { return Array.from(e?.assetsByKey?.values?.() || []); } -function dd(e) { +function pd(e) { return String(e ?? "").trim().toLowerCase(); } -function fd(e) { +function md(e) { return e?._mjrLivePlaceholder === !0 || e?.is_live_placeholder === !0 || String(e?.id || "").trim().toLowerCase().startsWith("live:"); } -function pd(e) { +function hd(e) { if (!e || typeof e != "object") return e; try { delete e._mjrLivePlaceholder, delete e._mjrLiveStatus, delete e._mjrLiveLabel, delete e.is_live_placeholder; @@ -9118,19 +9161,19 @@ function pd(e) { } return e; } -function md(e) { +function gd(e) { if (!e || typeof e != "object") return ""; - let t = dd(e?.type || e?.source || "output"), n = dd(e?.root_id || e?.custom_root_id || ""), r = dd(e?.subfolder || ""), i = dd(e?.filename || ""); + let t = pd(e?.type || e?.source || "output"), n = pd(e?.root_id || e?.custom_root_id || ""), r = pd(e?.subfolder || ""), i = pd(e?.filename || ""); if (i) return `${t}|${n}|${r}|${i}`; - let a = dd(e?.filepath || e?.path || e?.fullpath || e?.full_path || ""); + let a = pd(e?.filepath || e?.path || e?.fullpath || e?.full_path || ""); return a ? `${t}|${n}|path|${a}` : ""; } -function hd(e, t) { - let n = Td(t); +function _d(e, t) { + let n = Dd(t); if (!e || typeof e.set != "function" || !n) return null; - let r = Cd(n), i = md(n), a = ""; + let r = Td(n), i = gd(n), a = ""; if (i) { - for (let [t, n] of e.entries()) if (md(n) === i) { + for (let [t, n] of e.entries()) if (gd(n) === i) { a = t; break; } @@ -9139,17 +9182,17 @@ function hd(e, t) { ...o, ...n } : n; - return fd(n) || pd(s), a && a !== r && e.delete(a), e.set(r, s), s; + return md(n) || hd(s), a && a !== r && e.delete(a), e.set(r, s), s; } -function gd(e, t) { - return e ? (e.assetsByKey ||= /* @__PURE__ */ new Map(), hd(e.assetsByKey, t)) : null; +function vd(e, t) { + return e ? (e.assetsByKey ||= /* @__PURE__ */ new Map(), _d(e.assetsByKey, t)) : null; } -function _d(e) { - !e?.grid || !e.loaded || (e._renderTimer ||= setTimeout(() => { - e._renderTimer = null, Sd(e); - }, Qu)); +function yd(e) { + e?.grid && e.loaded && (e._renderTimer ||= setTimeout(() => { + e._renderTimer = null, wd(e); + }, ed)); } -function vd(e, t, n = 0) { +function bd(e, t, n = 0) { let r = Array.isArray(t?._mjrFeedGroupAssets) ? t._mjrFeedGroupAssets.filter(Boolean) : [t].filter(Boolean); if (!r.length) return; let i = Math.max(0, Math.min(n, r.length - 1)), a = r[i] || null, o = String(a?.id || "").trim(); @@ -9159,52 +9202,52 @@ function vd(e, t, n = 0) { } catch (e) { console.debug?.(e); } - ad(e.grid, [o], o); + sd(e.grid, [o], o); } - td().then((e) => e.requestViewerOpen({ + rd().then((e) => e.requestViewerOpen({ assets: r, index: i })).catch((e) => console.debug?.(e)); } -function yd(e, t) { +function xd(e, t) { let n = document.createElement("div"); n.className = "mjr-popover mjr-feed-group-popover", n.style.cssText = "display:none; width:min(440px, 92vw); padding:10px;"; let r = document.createElement("div"); - r.className = "mjr-feed-group-popover-title", r.textContent = L("bottomFeed.groupTitle", "Generation group"), r.style.cssText = "font-size:12px; font-weight:700; opacity:0.92; margin-bottom:8px;", n.appendChild(r); + r.className = "mjr-feed-group-popover-title", r.textContent = R("bottomFeed.groupTitle", "Generation group"), r.style.cssText = "font-size:12px; font-weight:700; opacity:0.92; margin-bottom:8px;", n.appendChild(r); let i = document.createElement("div"); i.className = "mjr-feed-group-popover-grid", i.style.cssText = "display:grid; grid-template-columns:repeat(auto-fill, minmax(110px, 1fr)); gap:8px; max-height:360px; overflow-y:auto; overscroll-behavior:contain;"; let a = Array.isArray(t?._mjrFeedGroupAssets) ? t._mjrFeedGroupAssets : []; for (let r = 0; r < a.length; r += 1) { - let o = a[r], s = rd(o); + let o = a[r], s = ad(o); s.classList.add("mjr-feed-group-member-card"), r === 0 && s.classList.add("mjr-feed-group-member-card--cover"), s.addEventListener("click", (i) => { - i.preventDefault(), i.stopPropagation(), e.popoverManager?.close?.(n), vd(e, t, r); + i.preventDefault(), i.stopPropagation(), e.popoverManager?.close?.(n), bd(e, t, r); }), i.appendChild(s); } return n.appendChild(i), e.root.appendChild(n), n; } -function bd(e, t, n) { +function Sd(e, t, n) { if (!t || !n) return; let r = Number(n?._mjrFeedGroupCount || 0) || 0; if (r <= 1 || (t.dataset.mjrFeedGrouped = "true", t.dataset.mjrFeedGroupCount = String(r), t.dataset.mjrStacked = "true", t.dataset.mjrStackCount = String(r), t.querySelector(".mjr-feed-group-button"))) return; let i = document.createElement("button"); - i.type = "button", i.className = "mjr-feed-group-button", i.title = L("bottomFeed.groupOpen", "Show other assets from this generation"), i.setAttribute("aria-label", `${r} assets`); + i.type = "button", i.className = "mjr-feed-group-button", i.title = R("bottomFeed.groupOpen", "Show other assets from this generation"), i.setAttribute("aria-label", `${r} assets`); let a = document.createElement("span"); a.className = "mjr-feed-group-button-icon pi pi-clone", i.appendChild(a); let o = document.createElement("span"); o.className = "mjr-feed-group-button-count", o.textContent = String(r), i.appendChild(o), i.style.cssText = "position:absolute; top:34px; right:6px; z-index:11;", Wa(i); - let s = yd(e, n); + let s = xd(e, n); i.addEventListener("click", (t) => { t.preventDefault(), t.stopPropagation(), e.popoverManager?.toggle?.(s, i); }), t.appendChild(i); } -function xd(e, t) { +function Cd(e, t) { let n = new Map((Array.isArray(t) ? t : []).map((e) => [String(e?.id || "").trim(), e]).filter(([e]) => !!e)); - for (let t of id(e?.grid)) { + for (let t of od(e?.grid)) { let r = String(t?.dataset?.mjrAssetId || "").trim(), i = n.get(r); - i && bd(e, t, i); + i && Sd(e, t, i); } } -async function Sd(e) { +async function wd(e) { if (!e?.grid) return; try { e.popoverManager?.closeAll?.(); @@ -9217,19 +9260,19 @@ async function Sd(e) { } catch (e) { console.debug?.(e); } - let t = ld(ud(e)), n = await gi(e.grid, t, { - title: L("bottomFeed.title", "Generated Feed"), + let t = dd(fd(e)), n = await gi(e.grid, t, { + title: R("bottomFeed.title", "Generated Feed"), reset: !0 }); - xd(e, t), Number(n?.count || 0) <= 0 ? (e.empty.textContent = L("bottomFeed.empty", "No generated assets yet."), e.empty.style.display = "") : e.empty.style.display = "none"; + Cd(e, t), Number(n?.count || 0) <= 0 ? (e.empty.textContent = R("bottomFeed.empty", "No generated assets yet."), e.empty.style.display = "") : e.empty.style.display = "none"; } -function Cd(e) { +function Td(e) { let t = String(e?.id || "").trim(); if (t) return `id:${t}`; let n = String(e?.filename || "").trim(), r = String(e?.subfolder || "").trim(); return `file:${String(e?.source || e?.type || "").trim()}:${r}:${n}`; } -function wd(e) { +function Ed(e) { let t = String(e || "").split(".").pop()?.toUpperCase() ?? "", n = /* @__PURE__ */ new Set([ "MP4", "WEBM", @@ -9256,92 +9299,92 @@ function wd(e) { ]); return n.has(t) ? "video" : r.has(t) ? "audio" : i.has(t) ? "model3d" : "image"; } -function Td(e) { +function Dd(e) { if (!e || typeof e != "object") return null; let t = { ...e }; - return !t.type && t.source && (t.type = t.source), !t.source && t.type && (t.source = t.type), t.kind ||= wd(t.ext || t.filename || ""), t; + return !t.type && t.source && (t.type = t.source), !t.source && t.type && (t.source = t.type), t.kind ||= Ed(t.ext || t.filename || ""), t; } -function Ed(e) { - let t = Td(e); +function Od(e) { + let t = Dd(e); if (!t) return null; - let n = Cd(t); + let n = Td(t); if (!n) return null; - let r = md(t), i = null; - if (r) for (let [e, t] of sd.pendingAssets.entries()) e !== n && md(t) === r && (i = t, sd.pendingAssets.delete(e)); - let a = sd.pendingAssets.get(n) || i || null, o = a ? { + let r = gd(t), i = null; + if (r) for (let [e, t] of ld.pendingAssets.entries()) e !== n && gd(t) === r && (i = t, ld.pendingAssets.delete(e)); + let a = ld.pendingAssets.get(n) || i || null, o = a ? { ...a, ...t } : t; - if (fd(t) || pd(o), sd.pendingAssets.set(n, o), sd.pendingAssets.size > 64) { - let e = sd.pendingAssets.keys().next().value; - e && sd.pendingAssets.delete(e); + if (md(t) || hd(o), ld.pendingAssets.set(n, o), ld.pendingAssets.size > 64) { + let e = ld.pendingAssets.keys().next().value; + e && ld.pendingAssets.delete(e); } return o; } -function Dd() { - return Array.from(sd.pendingAssets.values()); +function kd() { + return Array.from(ld.pendingAssets.values()); } -async function Od(e) { +async function Ad(e) { if (e?.grid) { - e.empty.style.display = "none", e.empty.textContent = L("bottomFeed.loading", "Loading recent assets..."); + e.empty.style.display = "none", e.empty.textContent = R("bottomFeed.loading", "Loading recent assets..."); try { e.assetsByKey = /* @__PURE__ */ new Map(); let t = [], n = 0; - for (; n < Xu;) { - let r = tt({ + for (; n < Qu;) { + let r = et({ q: "*", - limit: Math.min(Zu, Xu - n), + limit: Math.min($u, Qu - n), offset: n, scope: "output", sort: "mtime_desc", includeTotal: n === 0 - }), i = await ae(r, { timeoutMs: 3e4 }); + }), i = await re(r, { timeoutMs: 3e4 }); if (!i?.ok) throw Error(String(i?.error || "Failed to load feed assets")); let a = Array.isArray(i?.data?.assets) ? i.data.assets : []; if (!a.length) break; for (let n of a) { - let r = gd(e, n); + let r = vd(e, n); r && t.push(r); } - if (a.length < Zu) break; + if (a.length < $u) break; n += a.length; } - for (let t of Dd()) gd(e, t); - sd.pendingAssets.clear(); - let r = ld(ud(e)), i = await gi(e.grid, r, { - title: L("bottomFeed.title", "Generated Feed"), + for (let t of kd()) vd(e, t); + ld.pendingAssets.clear(); + let r = dd(fd(e)), i = await gi(e.grid, r, { + title: R("bottomFeed.title", "Generated Feed"), reset: !0 }); - xd(e, r), Number(i?.count || 0) <= 0 ? (e.empty.textContent = L("bottomFeed.empty", "No generated assets yet."), e.empty.style.display = "") : e.empty.style.display = "none"; + Cd(e, r), Number(i?.count || 0) <= 0 ? (e.empty.textContent = R("bottomFeed.empty", "No generated assets yet."), e.empty.style.display = "") : e.empty.style.display = "none"; } catch (t) { - console.debug?.(t), e.empty.textContent = L("bottomFeed.loadFailed", "Failed to load generated assets."), e.empty.style.display = ""; + console.debug?.(t), e.empty.textContent = R("bottomFeed.loadFailed", "Failed to load generated assets."), e.empty.style.display = ""; } finally { e.loaded = !0; } } } -async function kd() { - for (let e of Array.from(sd.hosts)) try { - await Od(e); +async function jd() { + for (let e of Array.from(ld.hosts)) try { + await Ad(e); } catch (e) { console.debug?.(e); } } -function Ad() { - kd(); +function Md() { + jd(); } -function jd(e) { +function Nd(e) { let t = document.createElement("div"); - t.textContent = L("bottomFeed.loading", "Loading recent assets..."), t.style.cssText = "font-size:11px; opacity:0.65; padding:4px 2px 8px 2px;", e.root.appendChild(t), e.empty = t; + t.textContent = R("bottomFeed.loading", "Loading recent assets..."), t.style.cssText = "font-size:11px; opacity:0.65; padding:4px 2px 8px 2px;", e.root.appendChild(t), e.empty = t; } -function Md(e) { +function Pd(e) { if (!e) return; let t = [ e, e.parentElement, e.parentElement?.parentElement ]; - for (let e of t) if (!(!e || !(e instanceof HTMLElement))) try { + for (let e of t) if (e && e instanceof HTMLElement) try { e.style.minHeight = "0"; } catch (e) { console.debug?.(e); @@ -9352,14 +9395,14 @@ function Md(e) { console.debug?.(e); } } -function Nd(e) { +function Fd(e) { if (!e) return; let t = (t, n) => { n ? e.classList.add(t) : e.classList.remove(t); }; - t("mjr-feed-show-info", z.FEED_SHOW_INFO), t("mjr-feed-show-filename", z.FEED_SHOW_FILENAME), t("mjr-feed-show-dimensions", z.FEED_SHOW_DIMENSIONS), t("mjr-feed-show-date", z.FEED_SHOW_DATE), t("mjr-feed-show-gentime", z.FEED_SHOW_GENTIME), t("mjr-show-hover-info", z.GRID_SHOW_HOVER_INFO), t("mjr-feed-show-dot", z.FEED_SHOW_WORKFLOW_DOT), t("mjr-feed-show-badges-ext", z.FEED_SHOW_BADGES_EXTENSION), t("mjr-feed-show-badges-rating", z.FEED_SHOW_BADGES_RATING), t("mjr-feed-show-badges-tags", z.FEED_SHOW_BADGES_TAGS); + t("mjr-feed-show-info", B.FEED_SHOW_INFO), t("mjr-feed-show-filename", B.FEED_SHOW_FILENAME), t("mjr-feed-show-dimensions", B.FEED_SHOW_DIMENSIONS), t("mjr-feed-show-date", B.FEED_SHOW_DATE), t("mjr-feed-show-gentime", B.FEED_SHOW_GENTIME), t("mjr-show-hover-info", B.GRID_SHOW_HOVER_INFO), t("mjr-feed-show-dot", B.FEED_SHOW_WORKFLOW_DOT), t("mjr-feed-show-badges-ext", B.FEED_SHOW_BADGES_EXTENSION), t("mjr-feed-show-badges-rating", B.FEED_SHOW_BADGES_RATING), t("mjr-feed-show-badges-tags", B.FEED_SHOW_BADGES_TAGS); } -function Pd(e, t = null) { +function Id(e, t = null) { let n = t || document.createElement("div"); n.classList.add("mjr-am-grid-scroll"), n.style.position = "relative", n.style.flex = "1 1 auto", n.style.minHeight = "0", n.style.height = "100%", n.style.overflow = "auto", n.style.scrollbarGutter = "stable", n.style.overscrollBehavior = "contain", n.style.webkitOverflowScrolling = "touch"; let r = () => { @@ -9371,20 +9414,20 @@ function Pd(e, t = null) { }, i = () => { r(); try { - window.dispatchEvent(new Event(B.MFV_OPEN)); + window.dispatchEvent(new Event(V.MFV_OPEN)); } catch (e) { console.debug?.(e); } }, a = document.createElement("div"); n.appendChild(a), e.root.appendChild(n); - let { app: o } = Vn(Yu, { + let { app: o } = Bn(Zu, { scrollElement: n, virtualize: !1, applyDefaultSettingsClasses: !1, emitWindowSelectionEvents: !0, onCardRendered: (t, n) => { try { - bd(e, t, n); + Sd(e, t, n); } catch (e) { console.debug?.(e); } @@ -9395,7 +9438,7 @@ function Pd(e, t = null) { }), s = o.mount(a), c = s?.gridContainer || a.querySelector?.(".mjr-grid") || null; if (e.gridApp = o, e.gridVm = s, e.grid = c, !c) return; c.style.minHeight = "100%", c.style.height = "auto", c.dataset.mjrScope = "output", c.dataset.mjrQuery = "*", c.dataset.mjrSort = "mtime_desc", c.dataset.mjrBottomFeed = "true"; - let l = Number(z.FEED_GRID_MIN_SIZE || z.GRID_MIN_SIZE || 120); + let l = Number(B.FEED_GRID_MIN_SIZE || B.GRID_MIN_SIZE || 120); c.dataset.mjrFeedMinItemWidth = String(l), c.style.setProperty("--mjr-grid-min-size", `${l}px`), c.addEventListener("keydown", (e) => { let t = e?.key?.toLowerCase?.() || ""; if (!(e?.ctrlKey || e?.metaKey || e?.altKey)) { @@ -9406,7 +9449,7 @@ function Pd(e, t = null) { if (t === "c") { e.preventDefault?.(), e.stopPropagation?.(), r(); try { - nd().then(async ({ floatingViewerManager: e }) => { + id().then(async ({ floatingViewerManager: e }) => { await e.open(), e.toggleCompareAB(); }).catch((e) => console.debug?.(e)); } catch (e) { @@ -9427,19 +9470,19 @@ function Pd(e, t = null) { } }; } -function Fd(e) { +function Ld(e) { let t = e?.grid; if (!t) return []; - let n = Yn(t); - return n.size ? ud(e).filter((e) => n.has(String(e?.id || ""))) : []; + let n = Jn(t); + return n.size ? fd(e).filter((e) => n.has(String(e?.id || ""))) : []; } -function Id(e) { +function Rd(e) { let t = e?.grid; if (!t) return null; let n = String(t.dataset?.mjrSelectedAssetId || "").trim(); - return n ? ud(e).find((e) => String(e?.id || "") === n) || null : Fd(e)[0] || null; + return n ? fd(e).find((e) => String(e?.id || "") === n) || null : Ld(e)[0] || null; } -function Ld(e) { +function zd(e) { let t = String(e ?? ""); try { if (typeof CSS < "u" && typeof CSS.escape == "function") return CSS.escape(t); @@ -9448,23 +9491,23 @@ function Ld(e) { } return t.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1"); } -function Rd(e) { +function Bd(e) { let t = e?.grid; if (!t) return; let n = () => { try { - _d(e); + yd(e); } catch (e) { console.debug?.(e); } }; e.keyboard = Fi({ gridContainer: t, - getState: () => ({ assets: ld(ud(e)) }), - getSelectedAssets: () => Fd(e), - getActiveAsset: () => Id(e), + getState: () => ({ assets: dd(fd(e)) }), + getSelectedAssets: () => Ld(e), + getActiveAsset: () => Rd(e), onOpenTagsEditor: (e) => { - let r = t.querySelector?.(`.mjr-asset-card[data-mjr-asset-id="${Ld(e?.id || "")}"]`) || null, i = null; + let r = t.querySelector?.(`.mjr-asset-card[data-mjr-asset-id="${zd(e?.id || "")}"]`) || null, i = null; try { i = r?.getBoundingClientRect?.() || t.getBoundingClientRect(); } catch (e) { @@ -9475,21 +9518,21 @@ function Rd(e) { onAssetChanged: n }), e.keyboard.bind(), e.ratingHotkeys = Ua({ gridContainer: t, - createRatingBadge: gt + createRatingBadge: ht }), e.ratingHotkeys.bind(); } -var zd = 60, Bd = 600, Vd = 10; -function Hd(e, t) { - let n = Math.max(zd, Math.min(Bd, Math.round(Number(t) / Vd) * Vd)); +var Vd = 60, Hd = 600, Ud = 10; +function Wd(e, t) { + let n = Math.max(Vd, Math.min(Hd, Math.round(Number(t) / Ud) * Ud)); if (e?.grid) try { e.grid.style.setProperty("--mjr-grid-min-size", `${n}px`); } catch (e) { console.debug?.(e); } - z.FEED_GRID_MIN_SIZE = n; + B.FEED_GRID_MIN_SIZE = n; try { - let e = Yt(); - e.feed.minSize = n, En(e), pn(e); + let e = Jt(); + e.feed.minSize = n, Tn(e), fn(e); } catch (e) { console.debug?.(e); } @@ -9506,27 +9549,27 @@ function Hd(e, t) { } return n; } -function Ud(e) { - let t = Math.max(zd, Number(z.FEED_GRID_MIN_SIZE || 120) || 120), n = document.createElement("div"); +function Gd(e) { + let t = Math.max(Vd, Number(B.FEED_GRID_MIN_SIZE || 120) || 120), n = document.createElement("div"); n.className = "mjr-feed-toolbar", n.style.cssText = "display:flex; align-items:center; gap:5px; padding:0 2px 5px 2px; flex-shrink:0; user-select:none;"; let r = document.createElement("span"); - r.textContent = L("bottomFeed.cardSize", "Cards:"), r.style.cssText = "font-size:11px; opacity:0.65; white-space:nowrap; flex-shrink:0;", n.appendChild(r); + r.textContent = R("bottomFeed.cardSize", "Cards:"), r.style.cssText = "font-size:11px; opacity:0.65; white-space:nowrap; flex-shrink:0;", n.appendChild(r); let i = document.createElement("button"); - i.type = "button", i.className = "mjr-feed-size-btn", i.textContent = "-", i.title = L("bottomFeed.cardSizeDecrease", "Decrease card size"), i.style.cssText = "width:20px; height:20px; padding:0; border:1px solid var(--mjr-border,#555); border-radius:4px; background:var(--mjr-surface,#2a2a2a); color:inherit; cursor:pointer; font-size:14px; line-height:1; flex-shrink:0; display:flex; align-items:center; justify-content:center;", n.appendChild(i); + i.type = "button", i.className = "mjr-feed-size-btn", i.textContent = "-", i.title = R("bottomFeed.cardSizeDecrease", "Decrease card size"), i.style.cssText = "width:20px; height:20px; padding:0; border:1px solid var(--mjr-border,#555); border-radius:4px; background:var(--mjr-surface,#2a2a2a); color:inherit; cursor:pointer; font-size:14px; line-height:1; flex-shrink:0; display:flex; align-items:center; justify-content:center;", n.appendChild(i); let a = document.createElement("input"); - a.type = "range", a.className = "mjr-feed-size-slider", a.min = String(zd), a.max = String(Bd), a.step = String(Vd), a.value = String(t), a.title = L("bottomFeed.cardSizeSlider", "Card size"), a.style.cssText = "flex:1 1 auto; min-width:40px; max-width:180px; height:4px; cursor:pointer; accent-color:var(--mjr-accent,#64b5f6);", n.appendChild(a); + a.type = "range", a.className = "mjr-feed-size-slider", a.min = String(Vd), a.max = String(Hd), a.step = String(Ud), a.value = String(t), a.title = R("bottomFeed.cardSizeSlider", "Card size"), a.style.cssText = "flex:1 1 auto; min-width:40px; max-width:180px; height:4px; cursor:pointer; accent-color:var(--mjr-accent,#64b5f6);", n.appendChild(a); let o = document.createElement("button"); - o.type = "button", o.className = "mjr-feed-size-btn", o.textContent = "+", o.title = L("bottomFeed.cardSizeIncrease", "Increase card size"), o.style.cssText = i.style.cssText, n.appendChild(o); + o.type = "button", o.className = "mjr-feed-size-btn", o.textContent = "+", o.title = R("bottomFeed.cardSizeIncrease", "Increase card size"), o.style.cssText = i.style.cssText, n.appendChild(o); let s = document.createElement("span"); s.className = "mjr-feed-size-display", s.textContent = `${t}px`, s.style.cssText = "font-size:11px; opacity:0.65; white-space:nowrap; min-width:36px; text-align:right; flex-shrink:0; font-variant-numeric:tabular-nums;", n.appendChild(s), i.addEventListener("click", () => { - Hd(e, Number(a.value) - Vd); + Wd(e, Number(a.value) - Ud); }), o.addEventListener("click", () => { - Hd(e, Number(a.value) + Vd); + Wd(e, Number(a.value) + Ud); }), a.addEventListener("input", () => { - Hd(e, Number(a.value)); + Wd(e, Number(a.value)); }), e.root.appendChild(n), e._sizeToolbar = n; } -function Wd(e, t = {}) { +function Kd(e, t = {}) { let n = document.createElement("div"); n.className = "mjr-assets-manager mjr-bottom-feed", n.style.cssText = "padding:6px; height:100%; min-height:0; box-sizing:border-box; display:flex; flex-direction:column; overflow:hidden;", e.replaceChildren(n); let r = { @@ -9538,13 +9581,13 @@ function Wd(e, t = {}) { assetsByKey: /* @__PURE__ */ new Map(), popoverManager: null }; - Ud(r), jd(r), Pd(r, t.gridWrapper ?? null), od(r), r.popoverManager = Di(n), r._disposeContextMenu = Ia({ + Gd(r), Nd(r), Id(r, t.gridWrapper ?? null), cd(r), r.popoverManager = Di(n), r._disposeContextMenu = Ia({ gridContainer: r.grid, getState: () => ({ scope: "output" }) - }), Rd(r), Nd(r.grid); + }), Bd(r), Fd(r.grid); let i = () => { try { - Nd(r.grid); + Fd(r.grid); } catch (e) { console.debug?.(e); } @@ -9557,26 +9600,26 @@ function Wd(e, t = {}) { } }, r; } -function Gd(e) { - let t = Ed(e); - if (t) for (let e of Array.from(sd.hosts)) try { - if (!e?.grid || (gd(e, t), !e.loaded)) continue; - e.empty.style.display = "none", _d(e); +function qd(e) { + let t = Od(e); + if (t) for (let e of Array.from(ld.hosts)) try { + if (!e?.grid || (vd(e, t), !e.loaded)) continue; + e.empty.style.display = "none", yd(e); } catch (e) { console.debug?.(e); } } -function Kd(e, t = {}) { - Md(e); - let n = Wd(e, t); +function Jd(e, t = {}) { + Pd(e); + let n = Kd(e, t); try { e._mjrGeneratedFeedHost = n; } catch (e) { console.debug?.(e); } - return sd.hosts.add(n), Od(n), n; + return ld.hosts.add(n), Ad(n), n; } -function qd(e) { +function Yd(e) { let t = e?._mjrGeneratedFeedHost || e || null; if (!t) return; let n = t.container || null; @@ -9590,7 +9633,7 @@ function qd(e) { } console.debug?.(e); } - sd.hosts.delete(t); + ld.hosts.delete(t); try { t._disposeSelection?.(); } catch (e) { @@ -9649,24 +9692,24 @@ function qd(e) { } //#endregion //#region ui/features/stacks/executionAssetBuffer.ts -function Jd(e) { +function Xd(e) { return String(e || "").trim(); } -function Yd(e) { +function Zd(e) { let t = String(e?.filename || "").trim(), n = String(e?.subfolder || "").trim(); return `${String(e?.type || "output").trim().toLowerCase()}|${String(e?.root_id || e?.custom_root_id || "").trim()}|${n}|${t}`; } -function Xd() { +function Qd() { let e = /* @__PURE__ */ new Map(); function t(t, n) { - let r = Jd(t); + let r = Xd(t); if (!r) return []; let i = Array.isArray(n) ? n : []; if (!i.length) return []; let a = e.get(r); a || (a = /* @__PURE__ */ new Map(), e.set(r, a)); for (let e of i) { - let t = Yd(e); + let t = Zd(e); t && a.set(t, { ...a.get(t) || {}, ...e || {} @@ -9675,13 +9718,13 @@ function Xd() { return Array.from(a.values()); } function n(t) { - let n = Jd(t); + let n = Xd(t); if (!n) return []; let r = e.get(n); return e.delete(n), Array.from(r?.values?.() || []); } function r(t) { - let n = Jd(t); + let n = Xd(t); n && e.delete(n); } return { @@ -9693,7 +9736,7 @@ function Xd() { } //#endregion //#region ui/features/stacks/finalizeQueue.ts -function Zd({ defaultDelayMs: e = 900, postJob: t } = {}) { +function $d({ defaultDelayMs: e = 900, postJob: t } = {}) { let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = !1; async function a() { if (!i) { @@ -9731,27 +9774,27 @@ function Zd({ defaultDelayMs: e = 900, postJob: t } = {}) { } //#endregion //#region ui/features/stacks/liveAssetGate.ts -function Qd(e) { +function ef(e) { return String(e || "").trim(); } -function $d(e) { +function tf(e) { let t = String(e?.filename || "").trim(), n = String(e?.filepath || "").trim(), r = String(e?.subfolder || "").trim(); return `${String(e?.type || e?.source || "output").trim().toLowerCase()}|${String(e?.root_id || e?.custom_root_id || "").trim()}|${r}|${t || n}`; } -function ef(e, t) { +function nf(e, t) { return !t || String(e?.job_id || "").trim() === t ? e : { ...e || {}, job_id: t }; } -function tf() { +function rf() { let e = /* @__PURE__ */ new Map(); function t(t, { files: n = [], expectedCount: r = null } = {}) { - let i = Qd(t); + let i = ef(t); if (!i) return; let a = /* @__PURE__ */ new Set(); for (let e of Array.isArray(n) ? n : []) { - let t = $d(e); + let t = tf(e); t && a.add(t); } e.set(i, { @@ -9761,13 +9804,13 @@ function tf() { }); } function n(t) { - let n = Qd(t); + let n = ef(t); n && e.delete(n); } function r(t) { - let n = Qd(t?.job_id); + let n = ef(t?.job_id); if (n) return n; - let r = $d(t); + let r = tf(t); if (!r) return ""; let i = "", a = Infinity; for (let [t, n] of e.entries()) n?.fileKeys?.has?.(r) && (n.markedAt ?? Infinity) < a && (a = n.markedAt ?? Infinity, i = t); @@ -9780,7 +9823,7 @@ function tf() { jobId: "", defer: !1 }; - let i = ef(t, n), a = e.get(n); + let i = nf(t, n), a = e.get(n); if (!a) return { detail: i, jobId: n, @@ -9803,20 +9846,20 @@ function tf() { } //#endregion //#region ui/features/stacks/executionRuntimeController.ts -var nf = 2e3, rf = 2e3, af = /* @__PURE__ */ new Set([ +var af = 2e3, of = 2e3, sf = /* @__PURE__ */ new Set([ "DB_MAINTENANCE", "TIMEOUT", "NETWORK_ERROR", "SERVICE_UNAVAILABLE" -]), of = 8, sf = 1200, cf = 15e3, lf = 6e5, uf = 500, df = 6, ff = 3e4, pf = 500; -function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensureExecutionRuntime: i, emitRuntimeStatus: a, refreshGeneratedFeedHosts: o, getActiveGridContainer: s }) { - let c = se({ - ttlMs: nf, - maxSize: rf - }), l = se({ - ttlMs: lf, - maxSize: uf - }), u = Math.max(0, Number(z.EXECUTION_IDLE_GRACE_MS) || 6e3), d = /* @__PURE__ */ new Map(), f = Xd(), p = tf(), m = "", h = 0, g = null; +]), cf = 8, lf = 1200, uf = 15e3, df = 6e5, ff = 500, pf = 6, mf = 3e4, hf = 500; +function gf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensureExecutionRuntime: i, emitRuntimeStatus: a, refreshGeneratedFeedHosts: o, getActiveGridContainer: s }) { + let c = pe({ + ttlMs: af, + maxSize: of + }), l = pe({ + ttlMs: df, + maxSize: ff + }), u = Math.max(0, Number(B.EXECUTION_IDLE_GRACE_MS) || 6e3), d = /* @__PURE__ */ new Map(), f = Qd(), p = rf(), m = "", h = 0, g = null; function _() { try { return typeof window > "u" ? !1 : window.__MJR_DEBUG_JOB_TRACKING__ === !0 || String(window.localStorage?.getItem("mjr.debug.jobTracking") || "").trim() === "1"; @@ -9832,7 +9875,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu } } function y() { - return !!z.EXECUTION_GROUPING_ENABLED; + return !!B.EXECUTION_GROUPING_ENABLED; } function b() { let e = y(); @@ -9888,7 +9931,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu console.debug?.(e); } } - let S = Zd({ + let S = $d({ defaultDelayMs: 900, async postJob(r) { v("auto-stack:start", { job_id: r }); @@ -9926,7 +9969,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu } function T(e) { let t = Math.max(1, Number(e) || 1), n = Math.min(6, t - 1); - return Math.min(cf, sf * 2 ** n); + return Math.min(uf, lf * 2 ** n); } function E() { g &&= (clearTimeout(g), null); @@ -9944,7 +9987,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu } function O(e) { let t = String(e?.code || "").trim().toUpperCase(); - return af.has(t); + return sf.has(t); } function k(r, i = 1, a = {}) { let o = Array.isArray(r) ? r : []; @@ -9959,7 +10002,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu files: o.map((e) => String(e?.filename || e?.filepath || "")) }), e(t.INDEX_FILES, s).then((e) => { if (!e?.ok) { - if (O(e) && i < of) { + if (O(e) && i < cf) { let e = T(i); setTimeout(() => k(o, i + 1, a), e); return; @@ -9996,12 +10039,12 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu let a = d.get(i); a?.timer && clearTimeout(a.timer); let o = a?.firstAttemptAt ?? Date.now(); - if (Date.now() - o >= ff) { + if (Date.now() - o >= mf) { k(r, 1, t); return; } let s = Math.max(1, Number(n) || 1), c = Math.min(2e3, 250 * s), l = setTimeout(() => { - d.delete(i), F(r, t, s + 1); + d.delete(i), ee(r, t, s + 1); }, c); d.set(i, { files: r, @@ -10032,7 +10075,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu d.delete(e); } } - function F(e, t = {}, n = 1) { + function ee(e, t = {}, n = 1) { let r = A(t); if (v("buffer:add", { prompt_id: r, @@ -10041,7 +10084,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu file_count: Array.isArray(e) ? e.length : 0, files: Array.isArray(e) ? e.map((e) => String(e?.filename || e?.filepath || "")) : [] }), !r) { - if (n < df) { + if (n < pf) { M(e, t, n); return; } @@ -10050,13 +10093,13 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu } f.add(r, e); } - function ee(e, t = 900) { + function te(e, t = 900) { y() && (v("finalize:schedule", { job_id: String(e || ""), delay_ms: t }), S.schedule(e, t)); } - function te(r) { + function F(r) { let i = b(), a = String(r || "").trim(); if (!a) return; let o = f.take(a); @@ -10068,7 +10111,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu files: o, expectedCount: o.length }), !o.length) { - i.allowLiveStackFinalize && ee(a); + i.allowLiveStackFinalize && te(a); return; } e(t.INDEX_FILES, { @@ -10083,7 +10126,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu v("index:flush:done", { prompt_id: a, file_count: o.length - }), i.allowLiveStackFinalize && ee(a, 1800); + }), i.allowLiveStackFinalize && te(a, 1800); }).catch((e) => { i.allowLiveStackFinalize && p.clearPendingJob(a), n(e, "executionRuntime.executed.index"); }); @@ -10125,7 +10168,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu let i = e?.detail?.prompt_id || e?.detail?.promptId, a = String(e?.detail?.node || e?.detail?.display_node || "").trim(), o = i ? l.get(String(i)) : null, s = o ? Math.max(0, Date.now() - o) : 0, c = ""; try { if (a && t !== void 0) { - let e = mt(ft(t), a); + let e = pt(dt(t), a); e && (c = String(e.type || e.comfyClass || "").trim()); } } catch (e) { @@ -10145,7 +10188,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu files: u.map((e) => String(e?.filename || e?.filepath || "")) }); try { - window.dispatchEvent(new CustomEvent(B.NEW_GENERATION_OUTPUT, { detail: { + window.dispatchEvent(new CustomEvent(V.NEW_GENERATION_OUTPUT, { detail: { files: u, prompt_id: String(i || ""), promptId: String(i || "") @@ -10154,7 +10197,7 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu console.debug?.(e); } let d = u.length > 0 ? [u[0]] : [], f = u.length > 1 ? u.slice(1) : []; - d.length > 0 && k(d, 1, { prompt_id: i }), f.length > 0 && F(f, { prompt_id: i }); + d.length > 0 && k(d, 1, { prompt_id: i }), f.length > 0 && ee(f, { prompt_id: i }); } function ae(e, { setCurrentJobId: t }) { let n = e?.detail?.prompt_id || e?.detail?.promptId, r = e?.detail?.timestamp; @@ -10184,20 +10227,20 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu prompt_id: String(r || ""), reason: String(e?.type || "") }), E(), f.clear(r), n.allowLiveStackFinalize && p.clearPendingJob(r), P()), String(e?.type || "") === "execution_success" && D(() => { - r && N(r), te(r); - }, I(r) ? Math.min(u, pf) : u); + r && N(r), F(r); + }, I(r) ? Math.min(u, hf) : u); } - function ce(e) { + function se(e) { if (!y()) return; let t = []; for (let [, n] of e instanceof Map ? e.entries() : []) { let e = r(n); if (e?.length) for (let n of e) t.push(n); } - !t.length || !y() || (v("node-outputs:updated", { + t.length && y() && (v("node-outputs:updated", { prompt_id: A(), file_count: t.length - }), F(t, { prompt_id: A() })); + }), ee(t, { prompt_id: A() })); } return { notifyStacksUpdated: x, @@ -10206,12 +10249,12 @@ function mf({ post: e, ENDPOINTS: t, reportError: n, extractOutputFiles: r, ensu handleExecutedEvent: ie, handleExecutionStart: ae, handleExecutionEnd: oe, - handleNodeOutputsUpdated: ce + handleNodeOutputsUpdated: se }; } //#endregion //#region ui/utils/extractOutputFiles.ts -function hf(e) { +function _f(e) { let t = [], n = /* @__PURE__ */ new Set(), r = 2e3, i = /\.(png|jpe?g|webp|gif|bmp|tiff?|avif|heic|heif|apng|hdr|svg|mp4|webm|mov|mkv|avi|m4v|mp3|wav|flac|ogg|glb|gltf|obj|fbx|ply|stl)$/i, a = typeof WeakSet < "u" ? /* @__PURE__ */ new WeakSet() : null, o = ({ type: e, subfolder: t, filename: n, path: r }) => r ? `path|${String(r).trim().toLowerCase()}` : `${e || ""}|${t || ""}|${n || ""}`.toLowerCase(), s = (e) => { if (!e) return; let r = e.path || e.filepath || e.fullpath || e.fullPath || e.full_path, i = e.filename; @@ -10297,15 +10340,15 @@ function hf(e) { } //#endregion //#region ui/features/runtime/sidebarAssetBadge.ts -var gf = "mjr-sidebar-asset-badge", _f = "mjr-sidebar-tab-has-badge", vf = "mjr-sidebar-asset-badge-style", yf = 99, bf = 0, xf = "majoor-assets", Sf = !1, Cf = /* @__PURE__ */ new Set(); -function wf() { - if (typeof document > "u" || document.getElementById(vf)) return; +var vf = "mjr-sidebar-asset-badge", yf = "mjr-sidebar-tab-has-badge", bf = "mjr-sidebar-asset-badge-style", xf = 99, Sf = 0, Cf = "majoor-assets", wf = !1, Tf = /* @__PURE__ */ new Set(); +function Ef() { + if (typeof document > "u" || document.getElementById(bf)) return; let e = document.createElement("style"); - e.id = vf, e.textContent = ` - .${_f} { + e.id = bf, e.textContent = ` + .${yf} { position: relative !important; } - .${gf} { + .${vf} { position: absolute; top: 3px; right: 3px; @@ -10329,7 +10372,7 @@ function wf() { } `, document.head?.appendChild(e); } -function Tf(e) { +function Df(e) { let t = String(e || "").trim(); if (!t) return []; let n = (() => { @@ -10348,81 +10391,81 @@ function Tf(e) { `[href="#${n}"]` ]; } -function Ef(e) { +function Of(e) { let t = `${e?.textContent || ""} ${e?.title || ""} ${e?.getAttribute?.("aria-label") || ""}`; return /assets\s*manager|majoor/i.test(t); } -function Df(e) { +function kf(e) { return !e || typeof e != "object" ? !1 : typeof HTMLElement < "u" ? e instanceof HTMLElement : typeof e.querySelector == "function" && typeof e.appendChild == "function"; } -function Of() { +function Af() { if (typeof document > "u") return null; - for (let e of Tf(xf)) { + for (let e of Df(Cf)) { let t = document.querySelector(e); - if (Df(t)) return t; + if (kf(t)) return t; } let e = Array.from(document.querySelectorAll(".pi-folder, .pi-folder-open")); for (let t of e) { let e = t.closest?.("button,[role='tab'],a,.p-button,.comfyui-button,.sidebar-tab"); - if (Df(e) && Ef(e)) return e; + if (kf(e) && Of(e)) return e; } - return Array.from(document.querySelectorAll("button,[role='tab'],a,.p-button,.comfyui-button,.sidebar-tab")).find((e) => Df(e) && Ef(e)) || null; -} -function kf() { - wf(); - let e = Of(); - if (!e) return !1; - let t = e.querySelector(`:scope > .${gf}`); - return !jf() || bf <= 0 ? (t?.remove(), e.classList.remove(_f), !0) : (t || (t = document.createElement("span"), t.className = gf, t.setAttribute("aria-hidden", "true"), e.appendChild(t)), e.classList.add(_f), t.textContent = bf > yf ? `${yf}+` : String(bf), !0); -} -function Af() { - kf(), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => kf()), setTimeout(() => kf(), 250), setTimeout(() => kf(), 1e3); + return Array.from(document.querySelectorAll("button,[role='tab'],a,.p-button,.comfyui-button,.sidebar-tab")).find((e) => kf(e) && Of(e)) || null; } function jf() { - return z.SIDEBAR_ASSET_BADGE_ENABLED !== !1; + Ef(); + let e = Af(); + if (!e) return !1; + let t = e.querySelector(`:scope > .${vf}`); + return !Nf() || Sf <= 0 ? (t?.remove(), e.classList.remove(yf), !0) : (t || (t = document.createElement("span"), t.className = vf, t.setAttribute("aria-hidden", "true"), e.appendChild(t)), e.classList.add(yf), t.textContent = Sf > xf ? `${xf}+` : String(Sf), !0); } -function Mf(e = null) { +function Mf() { + jf(), typeof requestAnimationFrame == "function" && requestAnimationFrame(() => jf()), setTimeout(() => jf(), 250), setTimeout(() => jf(), 1e3); +} +function Nf() { + return B.SIDEBAR_ASSET_BADGE_ENABLED !== !1; +} +function Pf(e = null) { let t = String(e?.id || e?.asset_id || "").trim(); if (t) return `id:${t}`; let n = String(e?.type || e?.source || "output").trim().toLowerCase(), r = String(e?.root_id || e?.custom_root_id || "").trim().toLowerCase(), i = String(e?.subfolder || e?.sub_folder || e?.subFolder || "").trim().toLowerCase(), a = String(e?.filename || "").trim().toLowerCase(), o = String(e?.filepath || e?.path || e?.fullpath || e?.full_path || "").trim().toLowerCase(), s = a || o; return s ? `file:${n}|${r}|${i}|${s}` : ""; } -function Nf(e) { +function Ff(e) { if (!e) return !0; - if (Cf.has(e)) return !1; - if (Cf.add(e), Cf.size > 1e3) { - let e = Array.from(Cf).slice(-500); - Cf.clear(); - for (let t of e) Cf.add(t); + if (Tf.has(e)) return !1; + if (Tf.add(e), Tf.size > 1e3) { + let e = Array.from(Tf).slice(-500); + Tf.clear(); + for (let t of e) Tf.add(t); } return !0; } -function Pf({ sidebarTabId: e } = {}) { +function If({ sidebarTabId: e } = {}) { let t = String(e || "").trim(); - t && (xf = t), !Sf && typeof window < "u" && (Sf = !0, window.addEventListener?.("mjr-settings-changed", (e) => { - e?.detail?.key === "sidebar.assetBadgeEnabled" && (jf() || (bf = 0, Cf.clear()), Af()); - })), Af(); + t && (Cf = t), !wf && typeof window < "u" && (wf = !0, window.addEventListener?.("mjr-settings-changed", (e) => { + e?.detail?.key === "sidebar.assetBadgeEnabled" && (Nf() || (Sf = 0, Tf.clear()), Mf()); + })), Mf(); } -function Ff(e = null) { - jf() && Nf(Mf(e)) && (bf += 1, Af()); +function Lf(e = null) { + Nf() && Ff(Pf(e)) && (Sf += 1, Mf()); } -function If() { - bf = 0, Cf.clear(), Af(); +function Rf() { + Sf = 0, Tf.clear(), Mf(); } //#endregion //#region ui/features/runtime/pendingGeneratedAssets.ts -var Lf = 0; -function Rf(e = 1) { +var zf = 0; +function Bf(e = 1) { let t = Math.max(1, Number(e) || 1); - Lf += t; + zf += t; try { - window.__mjrPendingGeneratedAssetCount = Lf; + window.__mjrPendingGeneratedAssetCount = zf; } catch {} - return Lf; + return zf; } -function zf() { - let e = Lf; - Lf = 0; +function Vf() { + let e = zf; + zf = 0; try { window.__mjrPendingGeneratedAssetCount = 0; } catch {} @@ -10430,11 +10473,11 @@ function zf() { } //#endregion //#region ui/features/runtime/registerRealtimeListeners.ts -var Bf = 3e4, Vf = /* @__PURE__ */ new Map(), Hf = "live"; -function Uf(e) { +var Hf = 3e4, Uf = /* @__PURE__ */ new Map(), Wf = "live"; +function Gf(e) { return e === !0 || e === 1 || e === "1" ? !0 : e === !1 || e === 0 || e === "0" ? !1 : null; } -function Wf(e) { +function Kf(e) { let t = [ e?.has_ai_vector, e?.hasAiVector, @@ -10444,25 +10487,25 @@ function Wf(e) { e?.vectorIndexed ]; for (let e of t) { - let t = Uf(e); + let t = Gf(e); if (t !== null) return t; } return !1; } -function Gf(e) { - let t = Date.now(), n = Number(Vf.get(e) || 0); - if (n > 0 && t - n < Bf) return !0; - if (Vf.set(e, t), Vf.size > 500) { - let e = t - 5 * Bf; - for (let [t, n] of Vf.entries()) Number(n) < e && Vf.delete(t); +function qf(e) { + let t = Date.now(), n = Number(Uf.get(e) || 0); + if (n > 0 && t - n < Hf) return !0; + if (Uf.set(e, t), Uf.size > 500) { + let e = t - 5 * Hf; + for (let [t, n] of Uf.entries()) Number(n) < e && Uf.delete(t); } return !1; } -function Kf(e) { +function Jf(e) { let t = String(e?.id || "").trim(); - t && (Wf(e) || Gf(t) || c(t).catch((e) => console.debug?.("[Majoor] auto vector index failed", e))); + t && (Kf(e) || qf(t) || ge(t).catch((e) => console.debug?.("[Majoor] auto vector index failed", e))); } -function qf(e) { +function Yf(e) { let t = String(e?.kind || "").trim().toLowerCase(); if (t) return t; let n = String(e?.filename || e?.filepath || e?.path || e?.fullpath || "").trim(), r = n.includes(".") && n.split(".").pop()?.toLowerCase?.() || ""; @@ -10510,8 +10553,8 @@ function qf(e) { "spz" ].includes(r) ? "model3d" : "unknown" : ""; } -function Jf(e, { jobId: t = "" } = {}) { - let n = String(e?.filename || "").trim(), r = String(e?.filepath || e?.path || e?.fullpath || e?.full_path || "").trim(), i = String(e?.subfolder || e?.sub_folder || e?.subFolder || "").trim(), a = String(e?.type || e?.source || "output").trim().toLowerCase(), o = String(e?.root_id || e?.custom_root_id || "").trim(), s = qf(e); +function Xf(e, { jobId: t = "" } = {}) { + let n = String(e?.filename || "").trim(), r = String(e?.filepath || e?.path || e?.fullpath || e?.full_path || "").trim(), i = String(e?.subfolder || e?.sub_folder || e?.subFolder || "").trim(), a = String(e?.type || e?.source || "output").trim().toLowerCase(), o = String(e?.root_id || e?.custom_root_id || "").trim(), s = Yf(e); if (!s || !n && !r) return null; let c = n || r.split(/[/\\]/).filter(Boolean).pop() || ""; if (!c) return null; @@ -10522,7 +10565,7 @@ function Jf(e, { jobId: t = "" } = {}) { c ].map((e) => String(e || "").trim().toLowerCase()).join("|"), d = Date.now() / 1e3, f = String(e?.job_id || t || "").trim(); return { - id: `${Hf}:${u || l.toLowerCase()}`, + id: `${Wf}:${u || l.toLowerCase()}`, filename: c, filepath: l, path: l, @@ -10545,7 +10588,7 @@ function Jf(e, { jobId: t = "" } = {}) { _mjrLiveLabel: "In progress" }; } -function Yf(e) { +function Zf(e) { let t = String(e || ""); try { if (typeof CSS < "u" && typeof CSS.escape == "function") return CSS.escape(t); @@ -10554,11 +10597,11 @@ function Yf(e) { } return t.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1"); } -function Xf(e, t) { +function Qf(e, t) { let n = String(e || "").trim().toLowerCase(); return n === "delete_db" ? t("btn.deleteDb", "Delete DB") : n === "reset_index" ? t("btn.resetIndex", "Reset index") : n === "restore_db" ? t("btn.dbRestore", "Restore DB") : t("btn.maintenance", "Maintenance"); } -function Zf(e, t) { +function $f(e, t) { let n = String(e || "").trim().toLowerCase(), r = String(t || "").trim().toLowerCase(), i = { delete_db: [ "started", @@ -10592,7 +10635,7 @@ function Zf(e, t) { label: r.replace(/[_-]+/g, " ") }; } -async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStreamModule: i, ensureExecutionRuntime: a, emitRuntimeStatus: o, getActiveGridContainer: s, pushGeneratedAsset: c, upsertAsset: l, upsertAssetNow: u, removeAssetsFromGrid: d, getEnrichmentState: f, setEnrichmentState: p, comfyToast: m, t: h, reportError: g, registerCleanableListener: _, syncExecutionBackendState: v }) { +async function ep({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStreamModule: i, ensureExecutionRuntime: a, emitRuntimeStatus: o, getActiveGridContainer: s, pushGeneratedAsset: c, upsertAsset: l, upsertAssetNow: u, removeAssetsFromGrid: d, getEnrichmentState: f, setEnrichmentState: p, comfyToast: m, t: h, reportError: g, registerCleanableListener: _, syncExecutionBackendState: v }) { e._mjrExecutedHandler = (e) => { try { n.handleExecutedEvent(e, { appRef: r }); @@ -10645,7 +10688,7 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre } catch (e) { g(e, "entry.execution_cached"); } - }, _(t, e, "execution_start", e._mjrExecutionStartHandler), _(t, e, "execution_success", e._mjrExecutionEndHandler), _(t, e, "execution_error", e._mjrExecutionEndHandler), _(t, e, "execution_interrupted", e._mjrExecutionEndHandler), _(t, e, "mjr.stacks.updated", e._mjrStacksUpdatedHandler), _(t, e, "progress", e._mjrRuntimeStatusHandler), _(t, e, "status", e._mjrRuntimeStatusHandler), _(t, e, B.RUNTIME_STATUS, e._mjrRuntimeStatusHandler), _(t, e, "execution_cached", e._mjrExecutionCachedHandler); + }, _(t, e, "execution_start", e._mjrExecutionStartHandler), _(t, e, "execution_success", e._mjrExecutionEndHandler), _(t, e, "execution_error", e._mjrExecutionEndHandler), _(t, e, "execution_interrupted", e._mjrExecutionEndHandler), _(t, e, "mjr.stacks.updated", e._mjrStacksUpdatedHandler), _(t, e, "progress", e._mjrRuntimeStatusHandler), _(t, e, "status", e._mjrRuntimeStatusHandler), _(t, e, V.RUNTIME_STATUS, e._mjrRuntimeStatusHandler), _(t, e, "execution_cached", e._mjrExecutionCachedHandler); function y() { try { window.__mjrLastAssetUpsert = Date.now(), window.__mjrLastAssetUpsertCount = (Number(window.__mjrLastAssetUpsertCount || 0) || 0) + 1; @@ -10656,7 +10699,7 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre function b(e, t, { immediate: n = !1, force: r = !1 } = {}) { let i = String(t?.id || "").trim(), a = String(t?.kind || "").trim(), o = String(t?.filename || "").trim(), s = String(t?.filepath || "").trim(), c = !!a && (!!o || !!s), d = !1; if (i) try { - d = typeof e?._mjrHasAssetId == "function" ? !!e._mjrHasAssetId(i) : !!e.querySelector(`.mjr-asset-card[data-mjr-asset-id="${Yf(i)}"]`); + d = typeof e?._mjrHasAssetId == "function" ? !!e._mjrHasAssetId(i) : !!e.querySelector(`.mjr-asset-card[data-mjr-asset-id="${Zf(i)}"]`); } catch (e) { console.debug?.(e); } @@ -10685,7 +10728,7 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre if (n !== "output" && n !== "all") return; let r = Array.isArray(e?.detail?.files) ? e.detail.files : [], i = String(e?.detail?.prompt_id || e?.detail?.promptId || "").trim(); for (let e of r) { - let n = Jf(e, { jobId: i }); + let n = Xf(e, { jobId: i }); n && b(t, n, { immediate: !0, force: !0 @@ -10694,25 +10737,25 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre } catch (e) { g(e, "entry.new_generation_output"); } - }, _(t, window, B.NEW_GENERATION_OUTPUT, e._mjrNewGenerationOutputHandler), e._mjrAssetAddedHandler = (e) => { + }, _(t, window, V.NEW_GENERATION_OUTPUT, e._mjrNewGenerationOutputHandler), e._mjrAssetAddedHandler = (e) => { try { if (!e?.detail) return; let t = n.prepareLiveAssetEvent(e.detail), r = t?.detail || e.detail; if (t?.defer) return; let i = n.isRenderableLiveAsset(r); - i && c(r), Kf(r); + i && c(r), Jf(r); let a = s(); if (!a) { - i && Rf(); + i && Bf(); return; } let o = a.dataset?.mjrScope || "output"; if (o !== "output" && o !== "all") { - i && Rf(); + i && Bf(); return; } let l = a.dataset?.mjrQuery || "*"; - String(l).trim() === "*" && i ? b(a, r, { immediate: !0 }) || Rf() : i && Rf(); + String(l).trim() === "*" && i ? b(a, r, { immediate: !0 }) || Bf() : i && Bf(); } catch (e) { g(e, "entry.asset_added"); } @@ -10731,23 +10774,23 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre }, _(t, e, "mjr-asset-updated", e._mjrAssetUpdatedHandler), e._mjrStructuredEventHandler = (e) => { try { let t = e?.detail || {}; - window.dispatchEvent(new CustomEvent(B.STRUCTURED_EVENT, { detail: t })); + window.dispatchEvent(new CustomEvent(V.STRUCTURED_EVENT, { detail: t })); } catch (e) { console.debug?.(e); } - }, _(t, e, B.STRUCTURED_EVENT, e._mjrStructuredEventHandler), e._mjrScanCompleteHandler = (e) => { + }, _(t, e, V.STRUCTURED_EVENT, e._mjrStructuredEventHandler), e._mjrScanCompleteHandler = (e) => { try { let t = e?.detail || {}; - window.dispatchEvent(new CustomEvent(B.SCAN_COMPLETE, { detail: t })); + window.dispatchEvent(new CustomEvent(V.SCAN_COMPLETE, { detail: t })); } catch (e) { console.debug?.(e); } - }, _(t, e, B.SCAN_COMPLETE, e._mjrScanCompleteHandler), e._mjrCoreExecutionAssetsReadyHandler = (e) => { + }, _(t, e, V.SCAN_COMPLETE, e._mjrScanCompleteHandler), e._mjrCoreExecutionAssetsReadyHandler = (e) => { try { let t = e?.detail || {}; - window.dispatchEvent(new CustomEvent(B.CORE_EXECUTION_ASSETS_READY, { detail: t })); + window.dispatchEvent(new CustomEvent(V.CORE_EXECUTION_ASSETS_READY, { detail: t })); let n = Number(t?.indexed || 0); - Number.isFinite(n) && n > 0 && window.dispatchEvent(new CustomEvent(B.RELOAD_GRID, { detail: { + Number.isFinite(n) && n > 0 && window.dispatchEvent(new CustomEvent(V.RELOAD_GRID, { detail: { reason: "core-execution-assets-ready", prompt_id: t?.prompt_id || t?.promptId || "", indexed: n @@ -10755,27 +10798,27 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre } catch (e) { console.debug?.(e); } - }, _(t, e, B.CORE_EXECUTION_ASSETS_READY, e._mjrCoreExecutionAssetsReadyHandler), e._mjrScanProgressHandler = (e) => { + }, _(t, e, V.CORE_EXECUTION_ASSETS_READY, e._mjrCoreExecutionAssetsReadyHandler), e._mjrScanProgressHandler = (e) => { try { let t = e?.detail || {}; - window.dispatchEvent(new CustomEvent(B.SCAN_PROGRESS, { detail: t })); + window.dispatchEvent(new CustomEvent(V.SCAN_PROGRESS, { detail: t })); } catch (e) { console.debug?.(e); } - }, _(t, e, B.SCAN_PROGRESS, e._mjrScanProgressHandler), e._mjrAssetIndexingHandler = (e) => { + }, _(t, e, V.SCAN_PROGRESS, e._mjrScanProgressHandler), e._mjrAssetIndexingHandler = (e) => { try { let t = e?.detail || {}; - window.dispatchEvent(new CustomEvent(B.ASSET_INDEXING, { detail: t })); + window.dispatchEvent(new CustomEvent(V.ASSET_INDEXING, { detail: t })); } catch (e) { console.debug?.(e); } - }, _(t, e, B.ASSET_INDEXING, e._mjrAssetIndexingHandler), e._mjrAssetIndexedHandler = (e) => { + }, _(t, e, V.ASSET_INDEXING, e._mjrAssetIndexingHandler), e._mjrAssetIndexedHandler = (e) => { try { let t = e?.detail || {}; - if (window.dispatchEvent(new CustomEvent(B.ASSET_INDEXED, { detail: t })), !t) return; + if (window.dispatchEvent(new CustomEvent(V.ASSET_INDEXED, { detail: t })), !t) return; let r = n.prepareLiveAssetEvent(t), i = r?.detail || t; if (r?.defer) return; - n.isRenderableLiveAsset(i) && (c(i), Ff(i)), Kf(i); + n.isRenderableLiveAsset(i) && (c(i), Lf(i)), Jf(i); let a = s(); if (!a) return; b(a, i, { @@ -10785,17 +10828,17 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre } catch (e) { console.debug?.(e); } - }, _(t, e, B.ASSET_INDEXED, e._mjrAssetIndexedHandler), e._mjrEnrichmentStatusHandler = (e) => { + }, _(t, e, V.ASSET_INDEXED, e._mjrAssetIndexedHandler), e._mjrEnrichmentStatusHandler = (e) => { try { let t = e?.detail || {}, n = Number(t?.queued), r = Number(t?.queue_left), i = Number.isFinite(n) ? Math.max(0, Math.floor(n)) : Number.isFinite(r) ? Math.max(0, Math.floor(r)) : 0, a = !!t?.active || i > 0, o = f().active; - p(a, i), window.dispatchEvent(new CustomEvent(B.ENRICHMENT_STATUS, { detail: t })), o && !a && m(h("toast.enrichmentComplete", "Metadata enrichment complete"), "success", 2600); + p(a, i), window.dispatchEvent(new CustomEvent(V.ENRICHMENT_STATUS, { detail: t })), o && !a && m(h("toast.enrichmentComplete", "Metadata enrichment complete"), "success", 2600); } catch (e) { console.debug?.(e); } - }, _(t, e, B.ENRICHMENT_STATUS, e._mjrEnrichmentStatusHandler), e._mjrDbRestoreStatusHandler = (e) => { + }, _(t, e, V.ENRICHMENT_STATUS, e._mjrEnrichmentStatusHandler), e._mjrDbRestoreStatusHandler = (e) => { try { let t = e?.detail || {}, n = String(t?.step || ""), r = String(t?.level || "info"), i = String(t?.operation || ""); - window.dispatchEvent(new CustomEvent(B.DB_RESTORE_STATUS, { detail: t })); + window.dispatchEvent(new CustomEvent(V.DB_RESTORE_STATUS, { detail: t })); let a = i === "delete_db", o = i === "reset_index", s = { started: a ? h("toast.dbDeleteTriggered", "Deleting database and rebuilding...") : o ? h("toast.resetTriggered", "Reset triggered: Reindexing all files...") : h("toast.dbRestoreStarted", "DB restore started"), stopping_workers: h("toast.dbRestoreStopping", "Stopping running workers"), @@ -10810,11 +10853,11 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre if (!s) return; let c = r === "error" || n === "failed" ? "error" : n === "done" ? "success" : "info", l = { history: { trackId: `maintenance:${String(i || "db_restore").trim().toLowerCase() || "db_restore"}`, - title: Xf(i, h), + title: Qf(i, h), detail: s, status: n, operation: String(i || "db_restore").trim().toLowerCase(), - progress: Zf(i, n), + progress: $f(i, n), source: String(t?.name || "").trim() || "maintenance", forceStore: !0 } }; @@ -10823,15 +10866,15 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre "done", "failed" ].includes(n)) { - x(s, c, 0, l); + ee(s, c, 0, l); return; } m(s, c, n === "done" || n === "failed" ? 2800 : 1800, l); } catch (e) { console.debug?.(e); } - }, _(t, e, B.DB_RESTORE_STATUS, e._mjrDbRestoreStatusHandler); - let S = (e) => { + }, _(t, e, V.DB_RESTORE_STATUS, e._mjrDbRestoreStatusHandler); + let x = (e) => { try { let t = Array.isArray(e?.detail?.ids) ? e.detail.ids.map((e) => String(e || "")).filter(Boolean) : []; if (!t.length) return; @@ -10841,12 +10884,12 @@ async function Qf({ api: e, runtime: t, executionRuntime: n, appRef: r, liveStre console.debug?.(e); } }; - _(t, window, B.ASSETS_DELETED, S), t && typeof t == "object" && (t.api = e, t.assetsDeletedHandler = S), console.debug("[Majoor] Real-time listener registered"); + _(t, window, V.ASSETS_DELETED, x), t && typeof t == "object" && (t.api = e, t.assetsDeletedHandler = x), console.debug("[Majoor] Real-time listener registered"); } //#endregion //#region ui/features/runtime/entryDebugApi.ts -function $f({ resolveNodeStreamModule: e }) { - typeof window > "u" || (window.MajoorDebug = { +function tp({ resolveNodeStreamModule: e }) { + typeof window < "u" && (window.MajoorDebug = { exportMetrics: () => window.MajoorMetrics?.exportMetrics?.(), getMetrics: () => window.MajoorMetrics?.getMetricsReport?.(), resetMetrics: () => window.MajoorMetrics?.resetMetrics?.() @@ -10861,16 +10904,16 @@ function $f({ resolveNodeStreamModule: e }) { } //#endregion //#region ui/features/runtime/benignConsoleNoise.ts -var ep = ["ResizeObserver loop completed with undelivered notifications.", "ResizeObserver loop limit exceeded"]; -function tp(e) { +var np = ["ResizeObserver loop completed with undelivered notifications.", "ResizeObserver loop limit exceeded"]; +function rp(e) { try { let t = String(e?.message || e || ""); - return ep.some((e) => t.includes(e)); + return np.some((e) => t.includes(e)); } catch { return !1; } } -function np() { +function ip() { if (typeof window > "u") return null; try { window.__MJR_BENIGN_CONSOLE_NOISE_FILTER__?.abort?.(); @@ -10885,7 +10928,7 @@ function np() { } let t = (e) => { try { - if (!tp(e?.message || e?.error)) return; + if (!rp(e?.message || e?.error)) return; e.preventDefault?.(), e.stopImmediatePropagation?.(); } catch (e) { console.debug?.(e); @@ -10911,7 +10954,7 @@ function np() { } //#endregion //#region ui/features/geninfo/genInfoOverridePicker.ts -var rp = "Majoor.GenInfoOverridePicker", ip = "MajoorGenInfoOverride", ap = L("genInfoOverride.autoFillFromWorkflow", "Auto fill from workflow"), op = L("genInfoOverride.pick", "Pick"), sp = { +var ap = "Majoor.GenInfoOverridePicker", op = "MajoorGenInfoOverride", sp = R("genInfoOverride.autoFillFromWorkflow", "Auto fill from workflow"), cp = R("genInfoOverride.pick", "Pick"), lp = { positive_prompt: [ "positive_prompt", "prompt", @@ -10934,7 +10977,7 @@ var rp = "Majoor.GenInfoOverridePicker", ip = "MajoorGenInfoOverride", ap = L("g ], vae: ["vae", "vae_name"], clip: ["clip", "clip_name"] -}, cp = [ +}, up = [ { field: "positive_prompt", label: "prompt" @@ -10979,14 +11022,14 @@ var rp = "Majoor.GenInfoOverridePicker", ip = "MajoorGenInfoOverride", ap = L("g field: "denoise", label: "denoise" } -], lp = 0x10000000000000000, up = !1, dp = !1; -function fp(e, t) { +], dp = 0x10000000000000000, fp = !1, pp = !1; +function mp(e, t) { let n = (e.widgets ?? []).find((e) => e?.name === t); if (n && n.value !== void 0 && n.value !== null && String(n.value).trim() !== "") return n.value; let r = Array.isArray(e.widgets_values) ? e.widgets_values : [], i = (Array.isArray(e.widgets) ? e.widgets : []).findIndex((e) => e?.name === t); return i >= 0 ? r[i] : void 0; } -function pp(e, t, n, r, i) { +function hp(e, t, n, r, i) { if (r == null || String(r).trim() === "") return; let a = `${n}:${String(r).trim()}`; t.has(a) || (t.add(a), e.push({ @@ -10996,42 +11039,42 @@ function pp(e, t, n, r, i) { source: i })); } -function mp(e, t, n) { +function gp(e, t, n) { let r = t.toLowerCase(); - return !!((sp[e] ?? [e]).some((e) => r === e || r.includes(e)) || e === "positive_prompt" && r === "text" && n.toLowerCase().includes("positive") || e === "negative_prompt" && (r.includes("negative") || n.toLowerCase().includes("negative"))); + return !!((lp[e] ?? [e]).some((e) => r === e || r.includes(e)) || e === "positive_prompt" && r === "text" && n.toLowerCase().includes("positive") || e === "negative_prompt" && (r.includes("negative") || n.toLowerCase().includes("negative"))); } -function hp(e, t = null) { +function _p(e, t = null) { let n = [], r = /* @__PURE__ */ new Set(); - for (let { graph: i, label: a } of ht(e)) for (let e of pt(i)) { - if (String(e?.comfyClass || e?.type || "") === ip) continue; + for (let { graph: i, label: a } of mt(e)) for (let e of ft(i)) { + if (String(e?.comfyClass || e?.type || "") === op) continue; let i = String(e?.title || e?.comfyClass || e?.type || `Node ${e?.id ?? ""}`).trim(), o = a === "Workflow" ? i : `${a} / ${i}`; - for (let [t, i] of Object.entries(sp)) for (let a of i) pp(n, r, t, fp(e, a), o); + for (let [t, i] of Object.entries(lp)) for (let a of i) hp(n, r, t, mp(e, a), o); let s = Array.isArray(e.widgets) ? e.widgets : [], c = Array.isArray(e.widgets_values) ? e.widgets_values : []; s.forEach((e, a) => { let s = String(e?.name || "").toLowerCase(), l = e?.value ?? c[a]; - s.includes("positive") || s === "text" && String(i).toLowerCase().includes("positive") ? pp(n, r, "positive_prompt", l, o) : s.includes("negative") && pp(n, r, "negative_prompt", l, o), t && mp(t, s, i) && pp(n, r, t, l, `${o} / ${e?.name || `widget ${a + 1}`}`); + s.includes("positive") || s === "text" && String(i).toLowerCase().includes("positive") ? hp(n, r, "positive_prompt", l, o) : s.includes("negative") && hp(n, r, "negative_prompt", l, o), t && gp(t, s, i) && hp(n, r, t, l, `${o} / ${e?.name || `widget ${a + 1}`}`); }); } return t ? n.filter((e) => e.field === t).slice(0, 120) : n.slice(0, 80); } -function gp(e, t) { +function vp(e, t) { return (e.widgets ?? []).find((e) => e?.name === t); } -function _p(e) { - let t = gp(e, "seed"); +function yp(e) { + let t = vp(e, "seed"); t && (t.options = { ...t.options ?? {}, min: -1, - max: lp, + max: dp, control_after_generate: !1 }); } -function vp(e, t) { +function bp(e, t) { return t === "positive_prompt" ? e?.prompt ?? e?.positive_prompt : t === "negative_prompt" ? e?.negative_prompt ?? e?.negative : t === "loras_json" && Array.isArray(e?.loras) ? JSON.stringify(e.loras) : t === "custom_info_json" && Array.isArray(e?.custom_info) ? JSON.stringify(e.custom_info) : e?.[t]; } -function yp(e, t) { +function xp(e, t) { if (!e || !t || typeof t != "object") return 0; - _p(e); + yp(e); let n = 0; for (let r of [ "positive_prompt", @@ -11049,16 +11092,16 @@ function yp(e, t) { "workflow_notes", "custom_info_json" ]) { - let i = vp(t, r); + let i = bp(t, r); if (i == null) continue; - let a = gp(e, r); - a && (bp(a, i, e, r), xp(a, i), n += 1); + let a = vp(e, r); + a && (Sp(a, i, e, r), Cp(a, i), n += 1); } return n; } -function bp(e, t, n, r) { +function Sp(e, t, n, r) { if (r !== "seed") { - Gn(e, t, n); + Wn(e, t, n); return; } let i = Number(t); @@ -11066,15 +11109,15 @@ function bp(e, t, n, r) { e.options = { ...e.options ?? {}, min: -1, - max: lp, + max: dp, control_after_generate: !1 }, e.value = Math.trunc(i); try { - e.callback?.(e.value, et()?.canvas ?? null, n, null, e); + e.callback?.(e.value, $e()?.canvas ?? null, n, null, e); } catch {} } } -function xp(e, t) { +function Cp(e, t) { let n = String(t ?? ""), r = [ e?.inputEl, e?.element, @@ -11083,30 +11126,30 @@ function xp(e, t) { e?.cachedDeepestByFrame?.widget?.element, e?.cachedDeepestByFrame?.widget?.el ]; - for (let e of r) if (!(!e || typeof e != "object") && "value" in e) try { + for (let e of r) if (e && typeof e == "object" && "value" in e) try { e.value = n; } catch {} } -function Sp(e, t, n) { - let r = Dp({ detail: { output: t } }); - if (r && yp(e, r)) try { +function wp(e, t, n) { + let r = kp({ detail: { output: t } }); + if (r && xp(e, r)) try { e.setSize?.(e.computeSize?.()), e.graph?.setDirtyCanvas?.(!0, !0), e.graph?.change?.(), n?.graph?.setDirtyCanvas?.(!0, !0), n?.graph?.change?.(), n?.canvas?.setDirty?.(!0, !0), n?.canvas?.draw?.(!0, !0); } catch {} } -function Cp(e, t, n = null) { - let r = n || t.field, i = gp(e, r); - i && (bp(i, t.value, e, r), xp(i, t.value)); +function Tp(e, t, n = null) { + let r = n || t.field, i = vp(e, r); + i && (Sp(i, t.value, e, r), Cp(i, t.value)); } -function wp(e) { +function Ep(e) { return !e || e.value === void 0 || e.value === null || String(e.value).trim() === ""; } -function Tp(e, t) { - let n = hp(t), r = 0; - for (let t of Object.keys(sp)) { - let i = gp(e, t); - if (!i || !wp(i)) continue; +function Dp(e, t) { + let n = _p(t), r = 0; + for (let t of Object.keys(lp)) { + let i = vp(e, t); + if (!i || !Ep(i)) continue; let a = n.find((e) => e.field === t); - a && (bp(i, a.value, e, t), xp(i, a.value), r += 1); + a && (Sp(i, a.value, e, t), Cp(i, a.value), r += 1); } return t?.graph?.setDirtyCanvas?.(!0, !0), t?.graph?.change?.(), t?.extensionManager?.toast?.add?.({ severity: r ? "success" : "warn", @@ -11115,34 +11158,34 @@ function Tp(e, t) { life: 3e3 }), r; } -function Ep(e, t) { - if (!(!e || String(e?.comfyClass || e?.type || "") !== ip) && (_p(e), !(e.widgets ?? []).some((e) => e?.name === ap) && typeof e.addWidget == "function")) { - e.addWidget("button", ap, null, () => Tp(e, t)); - for (let n of cp) { - let r = `${op} ${n.label}`; - (e.widgets ?? []).some((e) => e?.name === r) || e.addWidget("button", r, null, () => kp(e, t, n.field)); +function Op(e, t) { + if (e && String(e?.comfyClass || e?.type || "") === op && (yp(e), !(e.widgets ?? []).some((e) => e?.name === sp) && typeof e.addWidget == "function")) { + e.addWidget("button", sp, null, () => Dp(e, t)); + for (let n of up) { + let r = `${cp} ${n.label}`; + (e.widgets ?? []).some((e) => e?.name === r) || e.addWidget("button", r, null, () => jp(e, t, n.field)); } try { e.setSize?.(e.computeSize?.()), t?.graph?.setDirtyCanvas?.(!0, !0); } catch {} } } -function Dp(e) { +function kp(e) { let t = e?.detail?.output, n = t?.majoor_geninfo_override ?? t?.ui?.majoor_geninfo_override, r = Array.isArray(n) ? n[0] : n; return r && typeof r == "object" ? r : null; } -function Op(e) { - if (dp) return; +function Ap(e) { + if (pp) return; let t = e?.api; - !t || typeof t.addEventListener != "function" || (dp = !0, t.addEventListener("executed", (t) => { + t && typeof t.addEventListener == "function" && (pp = !0, t.addEventListener("executed", (t) => { let n = t?.detail?.node ?? t?.detail?.display_node; if (!n) return; - let r = mt(e, n); - !r || String(r?.comfyClass || r?.type || "") !== ip || Sp(r, t?.detail?.output, e); + let r = pt(e, n); + r && String(r?.comfyClass || r?.type || "") === op && wp(r, t?.detail?.output, e); })); } -function kp(e, t, n = null) { - let r = hp(t, n); +function jp(e, t, n = null) { + let r = _p(t, n); if (!r.length) { t?.extensionManager?.toast?.add?.({ severity: "warn", @@ -11156,59 +11199,59 @@ function kp(e, t, n = null) { i.style.cssText = "position:fixed;inset:0;z-index:1000000;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center"; let a = document.createElement("div"); a.style.cssText = "width:min(720px,92vw);max-height:80vh;overflow:auto;background:#202020;color:#eee;border:1px solid #555;border-radius:8px;padding:12px;box-shadow:0 16px 48px rgba(0,0,0,.55);font:12px sans-serif"; - let o = n ? L("genInfoOverride.pickField", "Pick {field}", { field: n.replace(/_/g, " ") }) : L("genInfoOverride.pickFromWorkflow", "Pick Gen Info from workflow"); + let o = n ? R("genInfoOverride.pickField", "Pick {field}", { field: n.replace(/_/g, " ") }) : R("genInfoOverride.pickFromWorkflow", "Pick Gen Info from workflow"); a.innerHTML = "