var Oi = Object.defineProperty; var Lt = (e) => { throw TypeError(e); }; var ji = (e, t, i) => t in e ? Oi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i; var v = (e, t, i) => ji(e, typeof t != "symbol" ? t + "" : t, i), At = (e, t, i) => t.has(e) || Lt("Cannot " + i); var y = (e, t, i) => (At(e, t, "read from private field"), i ? i.call(e) : t.get(e)), O = (e, t, i) => t.has(e) ? Lt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), H = (e, t, i, n) => (At(e, t, "write to private field"), n ? n.call(e, i) : t.set(e, i), i); var Vt = (e, t, i, n) => ({ set _(r) { H(e, t, r, i); }, get _() { return y(e, t, n); } }); import { jsx as p, jsxs as j } from "react/jsx-runtime"; import x, { useEffect as A, useState as E, useCallback as X, useMemo as U, useRef as W, useContext as ce, useId as Qe, isValidElement as Li, useLayoutEffect as Ai } from "react"; import w from "prop-types"; import M from "classnames"; import * as It from "react-is"; import { useNotification as Vi } from "rc-notification"; import d from "lodash"; import te, { FieldContext as Yt, Field as Xt } from "rc-field-form"; import { M as dt, N as je, a as Le, P as mt, S as Ii } from "./vender-CtjyT19B.js"; import Qt from "immutability-helper"; import { Form as Ye, Input as Mi, Button as Ze, Pagination as zi, Tree as Bi, Breadcrumb as Di, Table as qi, Empty as Wi, Popconfirm as Ui, Tooltip as Hi, Popover as Ji } from "antd"; import { useMergedState as Ki } from "rc-util"; import { generatePath as _i, useInRouterContext as Zt, useParams as Gi, useLocation as Yi, createBrowserRouter as Xi, Navigate as Qi } from "react-router-dom"; import "rc-util/lib/hooks/useMergedState"; import Zi from "rc-drawer"; import en from "rc-dialog"; var Ne, Ie, Re, ue, Se, ve; class ei { constructor(t, i) { O(this, Ne, /* @__PURE__ */ new Map()); O(this, Ie, !0); O(this, Re, []); O(this, ue); O(this, Se, () => y(this, ue)); O(this, ve, () => Promise.resolve()); v(this, "get", (...t) => new Promise((i, n) => { const r = JSON.stringify(t); if (y(this, Ne).has(r)) return i(y(this, ve).call(this, y(this, ue), ...t)); if (y(this, ue) === void 0) y(this, Re).push([t, i, n]), y(this, Ie) && (H(this, Ie, !1), Promise.resolve(typeof y(this, Se) == "function" ? y(this, Se).call(this) : y(this, Se)).then((a) => H(this, ue, a || null)).finally(() => { y(this, Re).forEach(([a, o, s]) => { try { const l = y(this, ve).call(this, y(this, ue), ...a); y(this, Ne).set(JSON.stringify(a), l), o(l); } catch (l) { s(l); } }), y(this, Re).length = 0; })); else { const a = y(this, ve).call(this, y(this, ue), ...t); y(this, Ne).set(r, a), i(a); } })); H(this, ve, i), H(this, Se, t); } } Ne = new WeakMap(), Ie = new WeakMap(), Re = new WeakMap(), ue = new WeakMap(), Se = new WeakMap(), ve = new WeakMap(); const gr = () => p("div", { children: "Empty" }), We = x.createContext({ ele: {}, mount: () => { }, unmount: () => { } }), Y = ({ rootClassName: e, className: t, children: i, actions: n, title: r, subTitle: a, extras: o, style: s = {} }) => { const { mount: l, unmount: u } = x.useContext(We); return Y.Action({ children: n }), Y.Title({ children: r }), Y.SubTitle({ children: a }), Y.Extra({ children: o }), A(() => (l("rootClassName", e), () => u(e)), [e]), p("div", { className: M("ff-container", t), style: s, children: i }); }, Ge = (e) => ({ children: t, className: i }) => { const { mount: n, unmount: r } = x.useContext(We); return A(() => (t && n(e, x.createElement("div", { key: `ff-${e}`, className: M(`ff-popup-${e}`, i) }, t)), () => r(e)), [i, t]), null; }; Y.Action = Ge("actions"), Y.Title = Ge("title"), Y.SubTitle = Ge("sub-title"), Y.Extra = Ge("extras"), Y.propTypes = { className: w.string, style: w.object, title: w.any, subTitle: w.any, actions: w.any, extras: w.any }; const pr = () => p(Y, { className: "ff-loading", children: j("div", { className: "loader", children: [j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] }), j("div", { className: "square", children: [p("span", {}), p("span", {}), p("span", {})] })] }) }), mr = () => p("div", { children: "NotFound" }), ti = ({ children: e }) => { const [t, i] = E({}), n = X((a, o) => i((s) => ({ ...s, [a]: o })), []), r = X((a) => i((o) => ({ ...o, [a]: void 0 })), []); return typeof (e == null ? void 0 : e.type) == "string" ? e : p(We.Provider, { value: { ele: t, mount: n, unmount: r }, children: x.cloneElement(e, { className: t.rootClassName, title: t.title, subTitle: t["sub-title"], actions: t.actions, extras: t.extras }) }); }; ti.propTypes = { children: w.element.isRequired }; const Mt = { close: ["M563.8 512l262.5-312.9c4.4-5.2 0.7-13.1-6.1-13.1h-79.8c-4.7 0-9.2 2.1-12.3 5.7L511.6 449.8 295.1 191.7c-3-3.6-7.5-5.7-12.3-5.7H203c-6.8 0-10.5 7.9-6.1 13.1L459.4 512 196.9 824.9c-4.4 5.2-0.7 13.1 6.1 13.1h79.8c4.7 0 9.2-2.1 12.3-5.7l216.5-258.1 216.5 258.1c3 3.6 7.5 5.7 12.3 5.7h79.8c6.8 0 10.5-7.9 6.1-13.1L563.8 512z"], check: ["M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474c-6.1-7.7-15.3-12.2-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1 0.4-12.8-6.3-12.8z"], info: ["M512 224m-64 0a64 64 0 1 0 128 0 64 64 0 1 0-128 0Z", "M544 392h-64c-4.4 0-8 3.6-8 8v464c0 4.4 3.6 8 8 8h64c4.4 0 8-3.6 8-8V400c0-4.4-3.6-8-8-8z"] }, $t = ({ type: e, props: t }) => p("i", { ...t, children: p("svg", { viewBox: "0 0 1024 1024", width: "1em", height: "1em", fill: "currentColor", children: (Mt[e] || Mt.info).map((i, n) => p("path", { d: i }, n)) }) }), ii = ({ className: e, content: t, icon: i, $close: n }) => j(x.Fragment, { children: [i && p("div", { className: M("ff-notification-icon", e), children: p($t, { type: i }) }), t] }), tn = ({}) => p(Y, { children: "Confirm" }); var pe, Fe; const ne = class ne { constructor() { O(this, Fe, /* @__PURE__ */ new Map()); v(this, "init", (t) => H(this, Fe, new Map(t))); v(this, "check", (t) => !y(this, Fe).has(t) || y(this, Fe).get(t)); if (y(ne, pe)) return y(ne, pe); } }; pe = new WeakMap(), Fe = new WeakMap(), O(ne, pe, null), v(ne, "getInstance", () => (y(ne, pe) || H(ne, pe, new ne()), y(ne, pe))); let ht = ne; const nn = ht.getInstance(), rn = (e, t, i = "children") => { if (d.isEmpty(e)) return {}; const n = d.find(e, ["value", t]); if (!d.isEmpty(n)) return n; const r = e.length; for (let a = 0; a < r; a++) { const { [i]: o } = e[a], s = rn(o, t, i); if (!d.isEmpty(s)) return s; } return {}; }, ni = (e = "Input", t = "@pkg/ff/grid-layout-forms") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`; var me, Me; const re = class re { constructor() { O(this, Me, null); v(this, "init", (t) => H(this, Me, t)); v(this, "get", (t, i) => d.get(y(this, Me), t, i)); if (y(re, me)) return y(re, me); } }; me = new WeakMap(), Me = new WeakMap(), O(re, me, null), v(re, "getInstance", () => (y(re, me) || H(re, me, new re()), y(re, me))); let ft = re; const Ae = ft.getInstance(), zt = { null2json: (e) => Object.create(), null2array: (e) => [], null2number: (e) => 0, null2bool: (e) => !1, null2string: (e) => "", null2integer: (e) => 0, null2float: (e) => 0, string2json: (e) => e ? JSON.parse(e) : "{}", string2array: (e) => e.substr(0, 1) === "[" && e.substr(-1) === "]" ? JSON.parse(e) : e.split(","), string2number: (e) => e == "" ? 0 : +e, string2integer: (e) => e == "" ? 0 : +e, string2float: (e) => e == "" ? 0 : +e, string2bool: (e) => { switch (`${e}`.toLowerCase()) { case "0": case "false": case "[]": case "{}": return !1; } return !!e; }, string2string: (e) => e, json2json: (e) => e, json2array: (e) => e ? Object.values(e) : [], json2number: (e) => Object.keys(e).length, json2integer: (e) => Object.keys(e).length, json2float: (e) => Object.keys(e).length, json2bool: (e) => Object.keys(e).length > 0, json2string: (e) => e ? JSON.stringify(e) : "", array2json: (e) => ({ ...e }), array2array: (e) => e, array2number: (e) => e.length, array2integer: (e) => e.length, array2float: (e) => e.length, array2bool: (e) => e.length > 0, array2string: (e) => JSON.stringify(e), number2json: (e) => ({}), number2array: (e) => [e], number2number: (e) => e, number2integer: (e) => e, number2float: (e) => e, number2bool: (e) => !!e, number2string: (e) => e.toString(), boolean2json: (e) => ({}), boolean2array: (e) => [], boolean2number: (e) => +e, boolean2integer: (e) => +e, boolean2float: (e) => +e, boolean2bool: (e) => e, boolean2string: (e) => e ? "true" : "false" }, ee = (e, t) => { let i = "string"; i = Array.isArray(e) ? "array" : typeof e, d.isObject(e) && (i = "json"); const n = `${i}2${t}`; return Reflect.has(zt, n) ? zt[n](e) : e; }, Ue = (e = {}, t = {}, i = {}, n = "") => ri(e, (r, a) => a === "type" && r === "code") ? ai(e, t, i, n) : si(e, t, n), ri = (e, t = () => !1) => d.some(e, (i) => !!d.some(i, t) || (d.isEmpty(i) || !d.isPlainObject(i) && !d.isArray(i) ? void 0 : ri(i, t))), ai = async (e = {}, t = {}, i = {}, n = "") => { let r = /* @__PURE__ */ Object.create(null); for (let a in e) { let o; if (Reflect.has(e[a], "type") && ["code", "field", "router", "query", "string"].includes(e[a].type)) { const { type: s, value: l = "", default: u = n } = e[a]; switch (s) { case "code": o = await xe.exec(l, t, i); break; case "field": o = d.get(t, l) ?? d.get(t, l.substring(l.indexOf(".") + 1)); break; case "router": case "query": o = ke.getPageParams(l); break; case "string": o = l; } o ?? (o = u); } else o = await ai(e[a], t, i, n); d.set(r, a, o); } return r; }, si = (e = {}, t = {}, i = "") => Object.keys(e || {}).reduce((n, r) => { if (d.isPlainObject(e[r])) { let a; if (Reflect.has(e[r], "type") && ["field", "router", "query", "string"].includes(e[r].type)) { const { type: o, value: s = "", default: l = i } = e[r]; switch (o) { case "field": a = d.get(t, s) ?? d.get(t, s.substring(s.indexOf(".") + 1)); break; case "router": case "query": a = ke.getPageParams(s); break; case "string": a = s; } a ?? (a = l); } else a = si(e[r], t, i); d.set(n, r, a); } return n; }, {}), ut = (e, t) => e && typeof e == "object" ? Array.isArray(e) ? e.map((i) => ut(i, t)) : Object.keys(e).reduce((i, n) => (t[n] ? i[t[n]] = ut(e[n], t) : i[n] = ut(e[n], t), i), {}) : e, hr = () => "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (e) => { const t = 16 * Math.random() | 0; return (e === "x" ? t : 3 & t | 8).toString(16); }), fr = (e) => { var t, i; return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){3}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.name : ""; }, yr = (e) => { var t, i; return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){2}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.category : ""; }, wr = (e) => { var t, i; return e ? (i = (t = e.match(/^@pkg(?:[^\/]*\/){1}(?[^\/]+)/)) == null ? void 0 : t.groups) == null ? void 0 : i.owner : ""; }, oi = () => _.$index++, an = (e, t = 32, i = "auto") => { const n = yt(e), r = i === "auto" ? "x64" : i; if (t === 32) return dt.x86.hash32(n).toString(); if (t === 128) return r === "x64" ? dt.x64.hash128(n) : dt.x86.hash128(n); throw new Error("bits 只能是 32 或 128"); }, yt = (e) => e == null ? "null" : typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : typeof e == "function" ? e.toString() : Array.isArray(e) ? "[" + e.map(yt).join(",") + "]" : typeof e == "object" ? "{" + Object.keys(e).sort().map((t) => `${t}:${yt(e[t])}`).join(",") + "}" : String(e); var tt, ze, Be, it; const nt = class nt { constructor(...t) { O(this, ze, []); O(this, Be, (t) => { var i; for (let n of t) Array.isArray(n[0]) ? y(this, Be).call(this, n) : y(this, ze).push(y(i = nt, tt).call(i, n[0], n[1])); }); v(this, "toValue", async (t, i = null) => { const n = { getValue: () => t, getRecord: () => i }; return await y(this, ze).reduce(async (r, a) => { try { const o = await r; return (await a).call(n, o); } catch (o) { return console.error(o), r; } }, t); }); v(this, "toRender", (t, i, n = null) => x.createElement(y(this, it), { value: t, record: i }, n)); O(this, it, ({ value: t, record: i, children: n }) => { const [r, a] = E(n); return ot(() => { let o = !1; return a(n), this.toValue(t, i).then((s) => ee(s, "string")).then((s) => !o && a(s)).catch((s) => !o && a(`${s}`)), () => o = !0; }, [t, i]), r; }); y(this, Be).call(this, t); } }; tt = new WeakMap(), ze = new WeakMap(), Be = new WeakMap(), it = new WeakMap(), O(nt, tt, d.memoize((t, i) => le.getWidgetComponent(t).then((n) => { var r; return ((r = n.default) == null ? void 0 : r.call(n, i)) || ((a) => a); }), (t, i) => `${t}::${ee(i, "string")}`)); let et = nt; const sn = (e, t = {}) => U(() => e == null ? void 0 : e.map(({ widgetByJs: i, widgetByJsSetting: n, ...r }, a) => i ? { ...r, render: (o, s) => new et([i, n]).toRender(o, s, "-") } : r), [e, t]), br = (e) => { const [t, i] = E({}); return A(() => { let n = !1; return e && L.get(`/api/_/${e}`).then((r) => d.pick(r, ["uuid", "name", "code", "resource", "marginX", "marginY", "cols", "rowHeight", "primaryKey", "columns", "itemOperations", "batchOperations", "isConditionFormLayout", "layout", "tabs", "pageSize", "layoutConfig"])).then((r) => !n && i(r)), () => n = !0; }, [e]), t; }, Cr = (e, t = {}) => { const [i, n] = E({ dataSource: [] }); return He(() => { let r = !1; return e && L.get(`/api/${e}/${L.encode({ page: 1, ...t })}`).then((a) => !r && n(a)), () => r = !0; }, [e, t]), i; }, li = (e = [], t = /* @__PURE__ */ new Map(), i = "id", n) => { const r = X(n ? (a) => d.get(a, i, d.get(a, [n, i])) : (a) => d.get(a, i), [i, n]); return X((a) => e == null ? void 0 : e.filter((o) => !o.uuid || !t.has(o.uuid) || t.get(o.uuid).some((s) => s == r(a))), [e, t, r]); }, wt = (e = [], t = /* @__PURE__ */ new Map(), i = [], n = "id", r) => { const a = X(r ? (o) => d.get(o, n, d.get(o, [r, n])) : (o) => d.get(o, n), [n, r]); return U(() => { if (d.isEmpty(e) || !e.some(({ uuid: s }) => nn.check(s))) return !1; if (d.isEmpty(t) || d.isEmpty(i)) return !0; const o = i.map((s) => a(s)); return e.some(({ uuid: s }) => !s || !t.has(s) || t.get(s).some((l) => o.some((u) => u == l))); }, [e, i, t, a]); }, on = (e, t, i = "id", n = null) => { const r = st(), a = W(!1), o = W(e.dataSource), s = W(e.itemOperationsAccess); return A(() => (o.current = e.dataSource, s.current = e.itemOperationsAccess, () => a.current = !1), [e.dataSource, e.itemOperationsAccess]), a.current && (e.dataSource = o.current, e.itemOperationsAccess = s.current), [e, (l = 0, u = null) => { var c, g; if (a.current = !1, l === 1) return (c = e.onReload) == null ? void 0 : c.call(e); if (l === 2) { const h = d.get(u, "__PARENT_ID__", ""), m = d.get(u, i, d.get(u, [n, i], "")), f = d.findIndex(o.current, ["__PARENT_ID__", h]), C = d.findIndex(f > -1 ? d.get(o.current, [f, "children"]) : o.current, [i, m]); if (C === -1) return (g = e.onReload) == null ? void 0 : g.call(e); Promise.all([L.get(`/api/${t}/detail/${m}`), L.post(`/api/${t}/list-operations-access`, { ids: m })]).then(([b, k]) => { const S = d.get(o.current, f > -1 ? [f, "children", C, "children"] : [C, "children"]); o.current = Qt(o.current, f > -1 ? { [f]: { children: { $splice: [[C, 1, { ...b, children: S }]] } } } : { $splice: [[C, 1, { ...b, children: S }]] }); const $ = new Map(k); s.current.forEach((T, I) => { var q; (q = $.get(I)) != null && q.some((z) => z == m) || s.current.set(I, T.filter((z) => z !== m)); }), $.forEach((T, I) => { s.current.has(I) ? s.current.set(I, d.uniq([...s.current.get(I) || [], ...T])) : s.current.set(I, T); }); }).then(() => { a.current = !0, r(); }); } }]; }, ln = (e, t) => { const i = st(), n = W(t), r = W(/* @__PURE__ */ new Map()), a = W([]), o = d.throttle((l) => { a.current = [], L.list(e, d.pick({ ...n.current, ...l }, ["tab", "page", "pageSize", "condition", "sider", "keyword"])).then(({ keyword: u, condition: c, total: g, tab: h, sider: m, page: f, pageSize: C, operationsAccess: b, dataSource: k }) => { n.current = { tab: h, condition: c, sider: m, keyword: u, total: g, pageSize: C, page: k != null && k.length ? f : 1 }, a.current = k, r.current = new Map(b), i(); }); }, 380, { leading: !1, trailing: !0 }); ot(() => { a.current = [], e && o(t); }, [e, t]); const s = U(() => d.pick(n.current, ["total", "tab", "page", "pageSize", "condition", "sider", "keyword"]), [n.current]); return Object.assign(s, { onTabChange: (l) => o({ tab: l, page: 1 }), onPageChange: (l, u) => o({ page: l, pageSize: u }), onPageSizeChange: (l) => o({ pageSize: l, page: 1 }), onConditionChange: (l, u) => o({ keyword: u, condition: Qt(n.current.condition || {}, { $merge: l || {} }), page: 1 }), onSiderChange: (l) => o({ sider: l, page: 1 }), onKeywordChange: (l) => o({ keyword: l, page: 1 }), itemOperationsAccess: r.current, dataSource: a.current, onReload: o, payload: t == null ? void 0 : t.payload }); }, cn = ({ listCode: e, className: t, layouts: i, dataSource: n, isPaginate: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: h, itemGridLayout: m, $setting: f, tabs: C, isConditionFormLayout: b, isTreeSider: k, treeSiderConfig: S }) => { const { classNames: $, onClickCallback: T } = ce(ie), I = d.pick(f, ["column", "colWidth", "beforeRender", "afterRender", "style"]), q = li(l, u, g, c), z = X((V, R, B) => p(dn, { className: M("ff-data-list-framework-item", $.item), operations: a ? q(R) : [], data: c ? { [c]: R } : R, children: V, onClickCallback: T }), [c, g, a, T, l, u]); return j("div", { className: M("ff-data-list-framework", t), children: [p(i.sider, { isTreeSider: k, ...S }), j("div", { className: M("ff-data-list-container", $ == null ? void 0 : $.container), children: [p(i.filter, { isConditionFormLayout: b }), p(i.toolbar, { title: h, tabs: C }), p(xn, { ...I, ...m, primaryKey: g, itemRender: z, dataSource: n }), p(i.footer, { isPaginate: r, isOperations: o, operations: s })] })] }); }, dn = ({ className: e, operations: t, children: i, data: n, onClickCallback: r }) => j("div", { className: M("data-list-grid-layout-item-container", e), children: [i, !!(t != null && t.length) && p("div", { className: "data-list-grid-layout-item-actions", children: t.map((a) => p("span", { className: "data-list-grid-layout-item-action", children: p(P.Link, { uuid: a.uuid, type: a.type, name: a.name, widget: a.widget, widgetType: a.widgetType, widgetProps: a.widgetProps, widgetSetting: a.widgetSetting, widgetContainerProps: a.widgetContainerSetting, data: n, confirm: a.confirm, onAfterClick: (o) => o !== !1 && (r == null ? void 0 : r(a.isRefresh, n)) }, a.uuid || Qe()) }, (a == null ? void 0 : a.uuid) || Qe())) })] }), un = ({ listCode: e, className: t, layouts: i, dataSource: n, columns: r, isItemOperations: a, isBatchOperations: o, batchOperations: s, itemOperations: l, itemOperationsAccess: u, resource: c, primaryKey: g, title: h, tabs: m, isPaginate: f, isTreeSider: C, treeSiderConfig: b, isConditionFormLayout: k, ...S }) => { const { classNames: $, onClickCallback: T } = ce(ie), I = li(l, u, g, c), q = wt(l, u, n, g, c); return j("div", { className: M("ff-data-table-framework", t), children: [p(i.sider, { isTreeSider: C, ...b }), j("div", { className: M("ff-data-table-container", $ == null ? void 0 : $.container), children: [p(i.filter, { isConditionFormLayout: k }), p(i.toolbar, { title: h, tabs: m }), p(yn, { ...S, primaryKey: g, className: "ff-data-table-content", columns: r, dataSource: n, operationRender: q ? (z) => { var V; return p("div", { className: "ff-data-table-actions", children: (V = I(z)) == null ? void 0 : V.map((R, B) => p(P.Link, { size: "small", uuid: R.uuid, type: R.type, name: R.name, widget: R.widget, widgetType: R.widgetType, widgetProps: R.widgetProps, widgetData: R.widgetData, widgetSetting: R.widgetSetting, widgetContainerProps: R.widgetContainerSetting, data: z, confirm: R.confirm, onAfterClick: (N) => N !== !1 && (T == null ? void 0 : T(R.isRefresh, z)) }, R.uuid || B)) }); } : null }), p(i.footer, { isPaginate: f, isOperations: o, operations: s })] })] }); }, ie = x.createContext({ listCode: "", classNames: {}, getBase62params: (e, t) => { }, onReload: () => { }, onClickCallback: () => { }, onConditionChange: () => { }, onTabChange: () => { }, onSiderChange: () => { }, onKeywordChange: () => { }, onPageChange: () => { }, onPageSizeChange: () => { } }), ci = (e, t, i, n, r = {}, a = 0) => { const o = { "--grid-layout-h": `${n}`, "--grid-layout-w": `${i}`, "--grid-layout-x": `${e}`, "--grid-layout-y": `${t}`, "--grid-layout-row-height-offset": "0px" }; return r != null && r.autoHeight ? o.height = "fit-content" : o["--grid-layout-row"] = `${n}`, r != null && r.alignItems && (o["--grid-layout-box-align-items"] = r.alignItems), r != null && r.justifyContent && (o["--grid-layout-box-justify-content"] = r.justifyContent), o["--grid-layout-box-margin"] = Bt(r == null ? void 0 : r.marginTop, r == null ? void 0 : r.marginRight, r == null ? void 0 : r.marginBottom, r == null ? void 0 : r.marginLeft), o["--grid-layout-box-padding"] = Bt(r == null ? void 0 : r.paddingTop, r == null ? void 0 : r.paddingRight, r == null ? void 0 : r.paddingBottom, r == null ? void 0 : r.paddingLeft), a && (o.height = `${a}px`), o; }, Bt = (e, t, i, n) => `${e || 0}px ${t || 0}px ${i || 0}px ${n || 0}px`, kr = (e = "Text", t = "@pkg/ff/grid-layouts") => e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, di = ({ className: e, isConditionFormLayout: t }) => { var h, m; const [i, n] = E({}), { listCode: r, onKeywordChange: a, onConditionChange: o, getBase62params: s, classNames: l } = x.useContext(ie), { keyword: u, condition: c } = (s == null ? void 0 : s()) || {}, [g] = Ye.useForm(); return A(() => { r && t && L.get(`/api/_/${r}/list-condition-form-layout`).then(({ resource: f, marginX: C, marginY: b, rowHeight: k, cols: S, fields: $ }) => { n({ resource: f, itemMargin: [C, b], rowHeight: k, cols: S, fields: $ }); }).catch(() => n({})); }, [r, t]), A(() => { g.setFieldsValue({ keyword: u, ...c }); }, [JSON.stringify([u, c])]), p("div", { className: M("ff-data-list-filter", l.filter, e), children: p(Ye, { form: g, layout: "vertical", autoComplete: "off", onFinish: ((h = i.fields) == null ? void 0 : h.length) > 1 ? (f) => o({ [i.resource]: f[i.resource] }, f.keyword) : () => { }, onValuesChange: (f) => { d.isEmpty(d.omit(f, ["keyword"])) || g.submit(); }, children: ((m = i.fields) == null ? void 0 : m.length) > 1 ? p(Nt, { ...i, children: p(gn, { onReset: () => { const { keyword: f, condition: C } = s("init") || {}; g.setFieldsValue({ keyword: f, ...C }); } }) }) : p("div", { className: "ff-data-list-filter-default-form ff-grid-layout-form", children: p("div", { className: "grid-layout-item", style: ci(20, 0, 5, 2), children: p(Ye.Item, { name: ["keyword"], children: p(Mi.Search, { allowClear: !0, enterButton: "搜索", placeholder: "多关键字 | 分割", onSearch: (f) => a(f) }) }) }) }) }) }); }, gn = ({ cols: e, fields: t, onReset: i }) => { const [n, r] = E(!1), a = U(() => t == null ? void 0 : t.toReversed().some((o) => o.y > 1 || o.x + o.w >= e - 5), [e, t]); return j(Ye.Item, { label: " ", style: { "--item-span": 5 }, className: M("ff-data-list-filter-actions", { expanded: n }), children: [p(Ze, { onClick: i, children: "重置" }), p(Ze, { type: "primary", htmlType: "submit", children: "查询" }), a && p(P.Link, { className: "ff-data-list-filter-expanded-button", widget: () => r((o) => !o), type: "primary", name: n ? "关闭" : "展开", icon: n ? "icon-up" : "icon-down", iconPosition: "end" })] }); }; di.reservedFields = [{ x: 0, y: 0, h: 3, w: 5, field: { isVirtual: !0, widgetPrefix: "@pkg/ff/grid-layout-forms", widget: "Input", code: "keyword", label: "关键字", placeholder: "多关键字 | 分割", extras: { prefix: "icon-search" } } }]; const pn = ({ className: e, operations: t, isOperations: i, isPaginate: n }) => { const { onPageChange: r, onPageSizeChange: a, onClickCallback: o, getBase62params: s } = x.useContext(ie), { total: l, page: u, pageSize: c } = (s == null ? void 0 : s()) || {}; return i && !d.isEmpty(t) || n ? j("div", { className: M("ff-data-list-footer", e), children: [p("div", { className: "ff-data-list-actions", children: t == null ? void 0 : t.map((g, h) => p(P, { uuid: g.uuid, type: g.type, name: g.name, widget: g.widget, widgetType: g.widgetType, widgetProps: g.widgetProps, widgetData: g.widgetData, widgetSetting: g.widgetSetting, widgetContainerProps: g.widgetContainerSetting, onAfterClick: (m) => m !== !1 && (o == null ? void 0 : o(g.isRefresh, null)) }, g.uuid || h)) }), n && p(zi, { size: "small", total: l, pageSize: c, showSizeChanger: !1, showTotal: (g) => `第 ${u} 页 / 总共 ${g} 条`, onChange: r, onShowSizeChange: a })] }) : null; }, mn = [{ title: "parent 1", key: "0-0", children: [{ title: "parent 1-0", key: "0-0-0", disabled: !0, children: [{ title: "leaf", key: "0-0-0-0", disableCheckbox: !0 }, { title: "leaf", key: "0-0-0-1" }] }, { title: "parent 1-1", key: "0-0-1", children: [{ title: p("span", { style: { color: "#1677ff" }, children: "sss" }), key: "0-0-1-0" }] }] }], hn = ({ className: e, width: t = 280, isTreeSider: i }) => { const { classNames: n } = ce(ie); return i ? p(Bi.DirectoryTree, { className: M("ff-data-list-sider", n.sider, e), style: { "--sider-width": t }, showLine: !0, showIcon: !1, treeData: mn }) : null; }, fn = ({ className: e, title: t, tabs: i }) => { const { getBase62params: n, onTabChange: r, onReload: a, classNames: o } = ce(ie), { tab: s } = (n == null ? void 0 : n()) || {}, [l, u] = Ki((i == null ? void 0 : i[0].value) ?? (i == null ? void 0 : i[0].code), { value: s, onChange: r }); return j("div", { className: M("ff-data-list-toolbar", o.toolbar, e), children: [p("div", { className: "ff-data-list-title", children: t }), p(Di, { className: "ff-data-list-tabs", itemRender: ({ label: c, code: g, value: h }) => p("span", { onClick: () => u(h ?? g), className: M("ff-data-list-tab", { active: (h ?? g) == l }), children: c }), items: i }), j("div", { className: "ff-data-list-actions", children: [p(P.Link, { icon: "icon-reload", widget: () => a() }), p(P.Link, { icon: "icon-setting" })] })] }); }, ui = ({ isItemGridLayout: e, theme: t, themeProps: i, onClickCallback: n, onReload: r, listCode: a, total: o = 0, page: s = 0, onPageChange: l, pageSize: u = 30, onPageSizeChange: c, tab: g, onTabChange: h, keyword: m, onKeywordChange: f, condition: C, onConditionChange: b, sider: k, onSiderChange: S, layouts: $, classNames: T = {}, payload: I = {}, ...q }) => { const [z, V] = E(), R = X((N, F) => { const J = { tab: g, page: s, pageSize: u, keyword: m, sider: k, condition: C, total: o, payload: I }; return N && N != "init" ? d.get(J, N, F) : J; }, [JSON.stringify(C), JSON.stringify(I), g, s, u, m, k, o]), B = U(() => { let N = { sider: hn, filter: di, footer: pn, toolbar: fn }; $ === !1 ? N = { sider: null, filter: null, footer: null, toolbar: null } : d.isPlainObject($) && (N = Object.assign({}, N, $)); for (const F in N) if (N[F]) { if (Li(N[F])) { const J = N[F]; N[F] = (de) => x.cloneElement(J, de); } } else N[F] = () => p(x.Fragment, {}); return N; }, [$]); return A(() => { t ? le.getWidgetComponent(t).then((N) => { if (!N) throw `${t} not found`; return N; }).catch((N) => ({ default: () => `${N}` })).then((N) => V(x.createElement(N.default, { ...q, layouts: B, $setting: i }))) : V(p(e ? cn : un, { ...q, layouts: B, $setting: i })); }, [t, i]), p(ie.Provider, { value: { classNames: T, listCode: a, onClickCallback: n, onReload: r, getBase62params: R, onPageChange: l, onPageSizeChange: c, onTabChange: h, onSiderChange: S, onKeywordChange: f, onConditionChange: b }, children: z && x.cloneElement(z, q) }); }; ui.propTypes = { classNames: w.exact({ sider: w.string, filter: w.string, footer: w.string, toolbar: w.string, container: w.string, content: w.string, item: w.string }), layouts: w.oneOfType([w.exact({ sider: w.oneOfType([w.elementType, w.element]), filter: w.oneOfType([w.elementType, w.element]), footer: w.oneOfType([w.elementType, w.element]), toolbar: w.oneOfType([w.elementType, w.element]) }), w.bool]) }; var he, ge, Pe, rt; const ae = class ae { constructor() { O(this, ge, null); O(this, Pe, /* @__PURE__ */ new Map()); O(this, rt, () => { if (y(this, ge)) return y(this, ge).port.postMessage({ command: "status", data: [] }); H(this, ge, new SharedWorker(new URL("/ff-worker/res-ws.js", self.location))), y(this, ge).port.onmessage = (t) => { var i, n; (i = t.data) != null && i.uuid ? y(this, Pe).forEach((r, a) => { var o; (r == "*" || (o = r == null ? void 0 : r.includes) != null && o.call(r, t.data.uuid)) && a(t.data); }) : ((n = t.data) == null ? void 0 : n.readyState) == WebSocket.CLOSED && L.get("/api/user-api-token").then(({ token: r, expire_at: a }) => { y(this, ge).port.postMessage({ command: "initWs", data: [`ws${d.trimStart(L.appUrl, "http")}api/user-resource-status-ws?token=${r}`] }); }); }, y(this, ge).port.postMessage({ command: "status", data: [] }); }); v(this, "subscribe", (t, i = []) => (i ? Array.isArray(i) && i.length == 0 ? i = "*" : Array.isArray(i) || (i = [i].flat()) : i = "*", y(this, Pe).set(t, i), y(this, Pe).size == 1 && y(this, rt).call(this), () => this.unsubscribe(t))); v(this, "unsubscribe", (t) => y(this, Pe).delete(t)); if (y(ae, he)) return y(ae, he); } }; he = new WeakMap(), ge = new WeakMap(), Pe = new WeakMap(), rt = new WeakMap(), O(ae, he, null), v(ae, "getInstance", () => (y(ae, he) || H(ae, he, new ae()), y(ae, he))); let bt = ae; const gi = bt.getInstance(), Tt = x.forwardRef(({ listCode: e, base62params: t, className: i, theme: n, themeProps: r, layouts: a, classNames: o }, s) => { const [{ resource: l, primaryKey: u, batchOperations: c = [], itemOperations: g = [], columns: h = [], themeConfig: m, theme: f, isConditionFormLayout: C = !1, isTreeSider: b, treeSiderConfig: k, isItemGridLayout: S, itemGridLayout: $, title: T, isPaginate: I, tabs: q }, z] = E({ isItemGridLayout: !1, itemGridLayout: {} }), V = ln(e, t), [{ dataSource: R, itemOperationsAccess: B, condition: N, tab: F, keyword: J, page: de, total: $e, pageSize: K, sider: Ke, onConditionChange: lt, onTabChange: Ot, onKeywordChange: Si, onPageChange: vi, onPageSizeChange: Pi, onSiderChange: $i, onReload: ct, payload: Ti }, jt] = on(V, e, u, l), Ni = wt(g, B, R, u), Ri = wt(c); A(() => { let Q = null; return e && L.get(`/api/_/${e}`).resp(({ data: _e, res: Ei }) => { _e != null && _e.isDynamicRefresh && (Q = gi.subscribe(() => ct(), Ei)), z(_e); }).catch(() => z({})), () => Q == null ? void 0 : Q(); }, [e]), x.useImperativeHandle(s, () => ({ onReload: ct, onClickCallback: jt })); const Fi = { listCode: e, title: T, classNames: o, layouts: a, resource: l, primaryKey: u, theme: n || f, themeProps: r || m, isTreeSider: b, treeSiderConfig: k, isPaginate: I, tabs: q, isItemOperations: Ni, itemOperations: g == null ? void 0 : g.map((Q) => d.isEmpty(Q == null ? void 0 : Q.confirm) ? Q : { ...Q, confirm: Object.assign({}, Q.confirm, { getPopupContainer: () => document.body }) }), isBatchOperations: Ri, batchOperations: c, isItemGridLayout: S, columns: h, itemGridLayout: $, isConditionFormLayout: C, itemOperationsAccess: B, dataSource: R, onConditionChange: lt, onTabChange: Ot, onKeywordChange: Si, onPageChange: vi, onPageSizeChange: Pi, onSiderChange: $i, condition: N, tab: F, keyword: J, page: de, total: $e, pageSize: K, sider: Ke, payload: Ti }; return p(ui, { ...Fi, className: M("ff-data-list-helper", i), onReload: ct, onClickCallback: jt }); }), pi = (e, t, i = !0) => i !== !0 && i-- <= 0 ? [] : d.isArray(e) && !d.isEmpty(e) ? e.reduce((n, r) => (Reflect.has(r, t) && Reflect.has(r, "children") && n.push(r[t]), Reflect.has(r, "children") && !d.isEmpty(r.children) ? n.concat(pi(r.children, t, i)) : n), []) : [], yn = ({ className: e, primaryKey: t, columns: i = [], dataSource: n = [], operationRender: r, operationWidth: a = 180, ...o }) => { const { classNames: s } = ce(ie); Qe(); const l = W(null), u = W(null), [c, g] = E([]), [h, m] = E({ width: 0, height: 0 }); A(() => { g(pi(n, t)); }, [n, t]), Ai(() => { const C = new ResizeObserver(() => { var b; m({ width: ((b = l.current) == null ? void 0 : b.nativeElement.querySelector(".ant-table-body").scrollWidth) || u.current.offsetWidth, height: u.current.offsetHeight }); }); return u.current && C.observe(u.current), () => { u.current && C.unobserve(u.current); }; }, []); const f = sn(i); return p("div", { ref: u, className: M("ff-data-list-table", s.content, e), children: h.height ? p(qi, { ...o, ref: l, rowKey: (C) => (C == null ? void 0 : C[t]) ?? Math.random(), columns: f == null ? void 0 : f.concat(r ? [{ title: "操作", align: "center", fixed: "right", width: `${Math.ceil(a / h.width * 100).toFixed(2)}%`, render: (C, b, k) => r(b, k) }] : []), dataSource: n, size: "middle", scroll: { x: "max-content", y: h.height - 50 }, pagination: !1, expandable: { defaultExpandAllRows: !0, expandRowByClick: !0, onExpandedRowsChange: g, expandedRowKeys: c } }) : null }); }, wn = "RC_FORM_INTERNAL_HOOKS", bn = (e, { initialValue: t, initialValueLanguage: i, convertJs: n, convertJsSetting: r, type: a = "string" }, o = null) => { const s = W(!1), l = ce(Yt), [u, c] = E(), [g, h] = E(i != "javascript" && e ? l.getFieldValue(e) : void 0), { registerWatch: m } = l.getInternalHooks(wn) || {}; return A(() => m == null ? void 0 : m((f, C, b) => { if (!s.current) return; const k = d.get(C, e); d.isEqual(k, g) || h(ee(k, a)); }), [g]), A(() => { i == "javascript" && t ? xe.exec(t, {}, { getFieldValueForBasicForm: (f) => o ? o.getFieldValue(f) : l.getFieldValue(f), getFieldValue: (f) => l.getFieldValue(f) }).then((f) => h(ee(f, a))).catch((f) => notification.error({ message: `布局数据错误: ${JSON.stringify(f)}` })).finally(() => s.current = !0) : (t && h(ee(t ?? l.getFieldValue(e), a)), s.current = !0); }, [t, i]), He(() => { s.current && n && new et([n, r]).toValue(g, l.getFieldsValue(!0)).then(c).catch((f) => { c(f), console.error("布局数据转换错误: ", f, n); }); }, [g, n, r]), [u ?? g, g]; }, mi = (e, t, i = null) => U(() => { var n; return (n = d.sortBy(e, ["y", "x"])) == null ? void 0 : n.map(({ i: r, x: a, y: o, w: s, h: l, field: { boxStyle: u, ...c } }, g) => p("div", { className: "grid-layout-item", style: ci(a, o, s, l, u), children: p(t, { ...c, basicForm: i }) }, r ?? g)); }, [e]), Cn = ({ widget: e, widgetPrefix: t = "@pkg/ff/grid-layouts", basicForm: i, ...n }) => { const r = e != null && e.startsWith("@") || e != null && e.startsWith("blob:") ? e : `${t}/${e}`, [a, o] = E(); return A(() => { r && le.getWidgetComponent(r).then(({ defaultProps: s = {}, default: l }) => ({ default: kn(l, s, i) })).catch((s) => ({ default: () => `${s}` })).then((s) => o(x.createElement(s.default, n))); }, [r]), a; }, kn = (e, t = {}, i = null) => (n) => { const { code: r, label: a, extras: o, isVirtual: s, initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, value: h, ...m } = d.merge({}, t, n), [f, C] = bn(s ? null : r, { initialValue: l, initialValueLanguage: u, convertJs: c, convertJsSetting: g, type: (m == null ? void 0 : m.type) || "string" }, i), b = U(() => { const $ = Object.keys((t == null ? void 0 : t.extras) || {}); return d.over([d.partialRight(d.pick, $), d.partialRight(d.omit, $)]); }, [t == null ? void 0 : t.extras]), [k, S] = b(m); return p(e, { ...S, value: f, rawValue: C, $setting: Object.assign({}, o, k) }); }, hi = ({ className: e, cols: t = 12, rowHeight: i = 21, containerPadding: n = [0, 0], itemMargin: r = [4, 0], formProps: a = {}, fields: o = [], data: s, basicForm: l = null, ...u }) => { const [c] = te.useForm(), g = mi(o, Cn, l), h = U(() => [{ name: "__PROPS__", value: a }], [a]); return He(() => (c.setFieldsValue(s), () => c.resetFields()), [s]), p(te, { fields: h, form: c, component: !1, children: p("div", { ...u, className: M("ff-grid-layout", e), style: { "--grid-layout-item-margin-y": `${(r == null ? void 0 : r[0]) || 0}px`, "--grid-layout-item-margin-x": `${(r == null ? void 0 : r[1]) || 0}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": t, "--grid-layout-row-height": `${i}px` }, children: g }) }); }, xr = (Dt = hi, function({ code: e, data: t, ...i }) { const [n, r] = E({ resource: null, cols: 12, rowHeight: 21, fields: [] }); return A(() => { e && L.get(`/api/_/${e}`).then((a) => r(d.pick(a, ["resource", "cols", "rowHeight", "fields"]))); }, [e]), (n == null ? void 0 : n.resource) && p(Dt, { ...i, rowHeight: n.rowHeight, cols: n.cols, fields: n.fields, data: n != null && n.resource ? { [n == null ? void 0 : n.resource]: t } : {} }); }); var Dt; const xn = ({ column: e = 0, colWidth: t = 0, cols: i, rowHeight: n, itemMargin: r, fields: a, primaryKey: o, dataSource: s, itemClassName: l, beforeRender: u = null, afterRender: c = null, itemRender: g = (C, b, k) => C, empty: h = p(Wi, { description: null }), className: m, style: f = {} }) => { const { classNames: C } = ce(ie), b = U(() => p(hi, { cols: i, rowHeight: n, itemMargin: r, fields: a, className: l }), [a, i, n, r]), k = d.isEmpty(s); return j("div", { className: M("ff-data-list-content", C.content, m), style: Object.assign({}, f, e && { "--col-num": e }, t && { "--col-width": t }), children: [u == null ? void 0 : u(s), k ? h : s.map((S, $) => { const T = g(x.cloneElement(b, { data: S }), S, $); return x.cloneElement(T, { key: `${(S == null ? void 0 : S[o]) ?? $}-${an(S)}` }); }), c == null ? void 0 : c(s)] }); }, Sn = ({ component: e, $props: t }) => { const { base62params: i } = Ue(t, {}); return p(Y, { children: p(Tt, { listCode: e, base62params: L.decode(i) }) }); }, Sr = () => p(fi, {}), fi = () => "Empty", vn = ({ component: e, $setting: t, $props: i }) => { const [n, r] = E(); A(() => { if (!e) return r(p(fi, { description: null })); le.getWidgetComponent(e).catch((o) => ({ default: () => `${o}` })).then((o) => x.createElement(o.default, { $setting: t })).then(r); }, [e]); const a = Ue(i, {}); return n ? x.cloneElement(n, a) : null; }, vr = () => "NotFoundPage"; var fe, Z, ye, we, De, qe; const se = class se { constructor() { O(this, Z, /* @__PURE__ */ new Map()); O(this, ye, {}); O(this, we, null); v(this, "init", (t, i) => { H(this, Z, t), H(this, ye, i); }); v(this, "get", (t) => (y(this, Z).has(t) || (t = Array.from(y(this, Z).keys()).find((i) => y(this, Z).get(i).uri === t)), y(this, Z).get(t) || {})); v(this, "redirect", (t, i, n = {}) => { const { uri: r, type: a, widgetProps: o } = this.get(t) || {}, { router: s, query: l, ...u } = i || {}, c = Object.assign({}, u, s), g = Object.assign({}, u, l); a == "list" && (c.base62params = L.encode(c != null && c.base62params ? c.base62params : c)); let h = _i(r || t, c); const m = new URLSearchParams(); for (const f in o || {}) (o == null ? void 0 : o.type) == "query" && Object.has(g, f) && m.append(f, JSON.stringify(g[f])); return m.size > 0 && (h = `${h}?${m.toString()}`), n != null && n.isOpenWindow ? window.open(h) : y(this, we).navigate(h, { replace: !!(n != null && n.isReplaceRouteHistory) }); }); v(this, "getMenus", (t) => { var i; return ((i = y(this, ye)) == null ? void 0 : i[t]) || []; }); v(this, "findMenuPathByUuid", (t) => { let i = []; for (const n in y(this, ye)) if (i = y(this, De).call(this, y(this, ye)[n], t, [n]), i.length > 1) return i; return i; }); v(this, "getMenusByRouteUuid", (t) => y(this, qe).call(this, t, Object.values(y(this, ye)).flat())); O(this, De, (t, i, n = []) => { if (d.isEmpty(t)) return n; for (const { uuid: r, children: a } of t) { if (r == i) return n.concat(r); if (!d.isEmpty(a)) return n.concat(r, y(this, De).call(this, a, i)); } return n; }); O(this, qe, (t, i) => { var r; let n = []; for (const a of i) a.widgetType == "redirect" && (a.uuid == t || a.widget == t ? n.push(a) : (r = a.children) != null && r.length && (n = n.concat(y(this, qe).call(this, t, a.children)))); return n; }); v(this, "getCurrentMenu", () => { const { uuid: t } = this.getCurrentRoute() || {}; if (!t) return; const i = this.getMenusByRouteUuid(t); return d.isEmpty(i) ? void 0 : i[0]; }); v(this, "getCurrentRoute", (t = 0) => { var n; const i = (n = y(this, we).state.matches[y(this, we).state.matches.length - 1 - t]) == null ? void 0 : n.route; if (!i) return null; for (let [r, a] of y(this, Z)) if (a.uri === i.path) return a; return null; }); v(this, "getPageParams", (t) => { var r, a, o; let i = "", n = {}; if (Zt()) n = Gi(), i = (r = Yi()) == null ? void 0 : r.search; else { const { location: s = {}, matches: l = [] } = ((a = y(this, we)) == null ? void 0 : a.state) || {}; n = ((o = l[l.length - 1]) == null ? void 0 : o.params) || {}, i = s.search; } return i && new URLSearchParams(i).forEach((s, l) => { n[l] = s; }), t ? d.get(n, t) : n; }); v(this, "createBrowserRouter", (t = {}) => { if (y(this, Z).size == 0) return null; const i = Ae.get("Common.WEBSITE_DEFAULT_THEME", "@pkg/ff/frameworks/DefaultTheme"), n = Ae.get(le.checkUserToken() ? "Common.WEBSITE_LOGIN_REDIRECT" : "Common.WEBSITE_DEFAULT", "/index"), r = { [i]: 0 }, a = (s, l) => () => Promise.all([le.getWidgetComponent(s), Ue(l)]).then(([u, c]) => [u.default || function() { return `${s}`; }, c]).then(([u, c]) => ({ Component: () => x.createElement(ti, {}, x.createElement(u, { $setting: c })) })), o = Array.from(y(this, Z).values()).reduce((s, { uuid: l, uri: u, name: c, type: g, component: h, widgetSetting: m, widgetProps: f, isLogin: C, isLayout: b, extra: k }) => { let S = {}, $ = 0; switch (g) { case "list": S.element = x.createElement(Sn, { component: h, $props: f }); break; case "fsdpf-component": S.element = x.createElement(vn, { key: h, component: h, $setting: m, $props: f }); } const T = (k == null ? void 0 : k.theme) ?? (k == null ? void 0 : k.layout); if (T) { const I = (k == null ? void 0 : k.themeProps) ?? (k == null ? void 0 : k.layoutProps); if (!r[T]) return r[T] = s.length, [...s, { path: "/", lazy: a(T, I), children: [{ path: u, ...S }] }]; $ = r[T]; } return b && $ > -1 ? (s[$].children.push({ path: u, ...S }), s) : [...s, { path: u, ...S }]; }, [{ path: "/", lazy: a(i, {}), children: [] }]); return o.push({ index: !0, element: x.createElement(Pn, { to: n, replace: !0 }) }), H(this, we, Xi(o, t)); }); if (y(se, fe)) return y(se, fe); } }; fe = new WeakMap(), Z = new WeakMap(), ye = new WeakMap(), we = new WeakMap(), De = new WeakMap(), qe = new WeakMap(), O(se, fe, null), v(se, "getInstance", () => (y(se, fe) || H(se, fe, new se()), y(se, fe))); let Ct = se; const Pn = ({ to: e, replace: t }) => Zt() ? x.createElement(Qi, { to: e, replace: t }) : (window.document.location = e, "redirect"), ke = Ct.getInstance(), Te = new Worker(new URL("/ff-worker/index.js", self.location)), qt = { getConfigure: (e) => Ae.get(e), route: { redirect: (...e) => ke.redirect(...e), getPageParams: (...e) => ke.getPageParams(...e), getCurrentRoute: () => ke.getCurrentRoute() }, popup: { notification: (...e) => G.notification(...e), success: (...e) => G.success(...e), error: (...e) => G.error(...e), form: (...e) => G.form(...e), modal: (...e) => G.modal(...e), confirm: (...e) => G.confirm(...e) } }; var at, Ee, be; const D = class D { constructor() { v(this, "exec", (t, i = {}, n = {}, r = "") => new Promise((a, o) => { if (!/^(?!\s*(\/\/|\/\*|\*)).*?\S+/m.test(t)) return a(); const s = Vt(D, at)._++; y(D, Ee).set(s, n), D.mQueue.set(s, [a, o]), Te.postMessage({ id: s, session: r, category: "eval", method: t, args: i }); })); v(this, "clear", (t) => Te.postMessage({ session: t, category: "clear" })); if (y(D, be)) return y(D, be); Promise.resolve().then(() => Gn).then((t) => { qt.http = t.http; }), Te.addEventListener("message", ({ data: { id: t, task_id: i, method: n, args: r, category: a, data: o, error: s, session: l } }) => { if (a === "eval" && D.mQueue.has(t)) s !== null ? D.mQueue.get(t)[1](s) : D.mQueue.get(t)[0](o), y(D, Ee).delete(t), D.mQueue.delete(t); else if (a === "util") try { const u = d.get(qt, n.split("/")) || d.get(y(D, Ee).get(i), n.split("/")); if (!d.isFunction(u)) throw `${n} not found`; Promise.resolve(Reflect.apply(u, void 0, r)).then((c) => { Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: c, error: null }); }).catch((c) => { Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: c }); }); } catch (u) { Te.postMessage({ id: t, task_id: i, category: a, method: n, args: r, session: l, data: null, error: u }); } }, !1); } }; at = new WeakMap(), Ee = new WeakMap(), be = new WeakMap(), v(D, "mQueue", /* @__PURE__ */ new Map()), O(D, at, 0), O(D, Ee, /* @__PURE__ */ new Map()), O(D, be, null), v(D, "getInstance", () => (y(D, be) || H(D, be, new D()), y(D, be))); let kt = D; const xe = kt.getInstance(), st = () => { const e = W(!0), [, t] = x.useReducer((i) => i + 1, 0); return A(() => () => e.current = !1, []), () => e.current && t(); }, Pr = (e) => { const t = W(); return A(() => { t.current = e; }, [e]), t.current; }, $r = (e) => { const [t, i] = E(e), n = W(null), r = X((a, o) => { n.current = o, i(a); }, []); return A(() => { n.current && (n.current(t), n.current = null); }, [t]), [t, r]; }, He = (e = (n) => { }, t, i = d.isEqual) => { const n = x.useRef(); i(t, n.current) || (n.current = d.cloneDeep(t)), x.useEffect(e, [n.current]); }, ot = He, yi = (e, t = "string") => { var i; if (!Array.isArray(e)) return e; for (let n = 0; n < e.length; n++) e[n].value = ee((i = e[n]) == null ? void 0 : i.value, t), e[n] && Reflect.has(e[n], "children") && (e[n].children = yi(e[n].children, t)); return e; }, Tr = (e, t = "json", i = "string", n, r = null) => { const [a] = te.useForm(n), [o, s] = E([{ label: "无", value: "", disabled: !0 }]), l = W([]), u = te.useWatch((c) => l.current.length === 0 ? null : d.pick(c, l.current), a) || null; return A(() => { Array.isArray(e) ? s(e) : t === "javascript" && e ? xe.exec(e, {}, { getFieldValue: (c) => (l.current.includes(c) || l.current.push(c), a.getFieldValue(c)), getFieldValueForBasicForm: (c) => (l.current.includes(c) || l.current.push(c), r ? r.getFieldValue(c) : a.getFieldValue(c)) }).then((c) => { s(ee(c, "array")); }) : e && s(ee(e, "array")); }, [e, t, u]), yi(o, i); }, Nr = (e) => { const [t, i] = E(), n = { type: "GET" }; if (typeof e == "string" ? n.url = e : d.isPlainObject(e) && Object.assign(n, e), !(n != null && n.url)) throw "url is required"; const r = (a) => L.request(n, !1).resp((o) => (console.log("useSubscribeRequest", a), i(o), o)); return He(() => { let a = null; return r().then((o) => { a = gi.subscribe(d.throttle(r, 180, { leading: !1, trailing: !0 }), o.res); }), () => a == null ? void 0 : a(); }, n), t; }, $n = (e) => { const [t, i] = x.useState({ gridItems: [], hideItems: [] }); return x.useEffect(() => { e && L.get(`/api/_/${e}`).then(({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: h, listenChangeFieldsFunc: m, fields: f }) => ({ pk: n, uuid: r, code: a, resource: o, align: s, cols: l, rowHeight: u, marginX: c, marginY: g, listenChangeFields: h, listenChangeFieldsFunc: m, ...f.reduce((C, b) => { var k; return (k = b == null ? void 0 : b.field) != null && k.hidden ? C.hides.push(b == null ? void 0 : b.field) : C.items.push(b), C; }, { items: [], hides: [] }) })).then(i); }, [e]), t; }, Tn = ({ max: e = 0, min: t = 0, type: i = "", message: n, pattern: r, required: a = !1, validator: o } = {}, s, l) => { const [u, c] = E([]); return A(() => { const g = []; if (a) { let h = l; switch (l) { case "number": case "string": case "array": break; case "bool": h = "boolean"; break; case "json": h = "object"; } g.push({ type: h, required: !0, whitespace: !0, message: "该项必填" }); } switch (i) { case "string": g.push({ type: i, max: e, min: t, message: n || (t && e ? `字符必须在 ${t} ~ ${e} 之间` : `${e ? "最多能有" : "最少要有"} ${t || e} 个字符`) }); break; case "pattern": g.push({ type: "string", pattern: r, message: n }); break; case "validator": o && g.push(({ getFieldValue: h }) => ({ validator: async (m, f) => { const C = await xe.exec(o, { value: f, fieldName: s }, { getFieldValue: h }); return d.isString(C) && C ? Promise.reject(C) : d.isBoolean(C) && !C ? Promise.reject(n) : Promise.resolve(); } })); } c(g); }, [e, t, i, n, r, a, o]), u; }, Nn = (e, t, i) => { const [n, r] = E(null); return A(() => { const { initDataUri: a = `/api/${e}`, initDataMethod: o = "GET" } = i || {}; t && L.request({ method: o, url: d.trimEnd(`${a}/${t}`, "/") }).then((s) => { r(s); }); }, [e, t, i]), n; }, wi = (e, t, i = {}, n = {}, r = {}) => { const a = ce(Yt), o = st(), s = W(!0), l = W([]), [u, c] = E(t), g = te.useWatch((h) => JSON.stringify(d.pick(h, l.current)), a) || "{}"; return ot(() => { e && xe.exec(e, i, { ...n, getFieldValueForBasicForm: (h) => r ? r.getFieldValue(h) : null, getFieldValue: d.wrap(a.getFieldValue, (h, m) => (l.current.some((f) => d.isEqual(f, m)) || (l.current.push(m), o()), h == null ? void 0 : h(m))), isFieldTouched: a.isFieldTouched, isFieldsTouched: a.isFieldsTouched }).then((h) => s.current && c(h)); }, [e, g, a, i, n]), A(() => () => s.current = !1, []), u; }, Rn = (e, t, i = [], n = {}) => { const r = W({}); if (!t) return [e, r.current]; const a = W(), o = d.debounce(st(), 180), s = ["disabled", "required"], l = (g, h) => { s.includes(g) && (r.current[g] = h), o(); }, u = U(() => ({ setDisabled: (g) => l("disabled", g), setRequired: (g) => l("required", g), getDisabled: () => r.current.disabled, getRequired: () => r.current.required }), [t]), c = wi(t, -1, {}, u, n) ?? -1; if (a.current != c && (c >= 0 || !d.isEmpty(i == null ? void 0 : i[c]))) { a.current = c; const { widget: g, widgetPrefix: h, props: m } = i == null ? void 0 : i[c]; e = ni(g, h), r.current = d.merge(m, d.pick(r.current, s)); } return [e, r.current]; }, Wt = (e) => e === void 0 || e === !1 ? "" : (Array.isArray(e) ? e : [e]).join("_"), Rr = ({ value: e, onChange: t }, i = null) => { const n = W(), [r] = te.useForm(i), a = W({}); return ot(() => { d.isEqual(n.current, e) || r.setFieldsValue(e); }, [e]), A(() => () => r.resetFields(), []), [U(() => r.__INTERNAL__ ? r : { ...r, __INTERNAL__: { itemRef: (o) => (s) => { const l = Wt(o); s ? a.current[l] = s : delete a.current[l]; } }, scrollToField: (o, s = {}) => { console.warn("useMergedFormValuesChange scrollToField not work, unreferenced antd form"); }, focusField: (o) => { console.warn("useMergedFormValuesChange focusField not work, unreferenced antd form"); }, getFieldInstance: (o) => { const s = Wt(o); return a.current[s]; } }, [r]), (o, s) => { n.current = s, t == null || t(s); }]; }, Fn = ({ type: e, initialValue: t, initialValueLanguage: i, onChange: n, basicForm: r }) => { const a = wi(i == "javascript" && t, i == "javascript" ? void 0 : t, {}, {}, r); return A(() => { i == "javascript" ? n(ee(a, e)) : t && n(ee(t, e)); }, [e, t, a]), null; }, bi = ({ widget: e = "Input", widgetPrefix: t = "@pkg/ff/grid-layout-forms", widgetDecorator: i, subWidgets: n = [], basicForm: r, ...a }) => { const o = ni(e, t), [s, l] = Rn(o, i, n, r), [u, c] = E(); return A(() => { s && le.getWidgetComponent(s).then(({ defaultProps: g = {}, default: h }) => ({ default: En(h, g, r) })).catch((g) => ({ default: () => `${g}` })).then((g) => c(x.createElement(g.default, a))); }, [s]), u && x.cloneElement(u, { ...a, ...l }); }, En = (e, t = {}, i = null) => (n) => { const { type: r, code: a, label: o, noStyle: s, placeholder: l, required: u = !1, extras: c, validators: g, help: h, isVirtual: m, $isReserved: f, initialValue: C, initialValueLanguage: b, ...k } = d.omit(d.merge({}, t, n), ["convertJs", "convertJsSetting", "widget", "widgetPerfix", "widgetDecorator", "subWidgets", "boxStyle"]), S = Tn(Object.assign({}, g, u ? { required: !0 } : {}), a, r), $ = U(() => { const V = Object.keys((t == null ? void 0 : t.extras) || {}); return d.over([d.partialRight(d.pick, V), d.partialRight(d.omit, V)]); }, [t == null ? void 0 : t.extras]), [T, I] = $(k), q = { label: o, noStyle: s, colon: !1, layout: "vertical" }, z = X((V) => V == null ? void 0 : ee(V, r), [r]); return p(Xt, { name: a, rules: S, initialValue: z(C), normalize: z, children: (V, R, B) => { var N; return p(e, { type: r, rcform: B, basicForm: i, itemProps: { validateStatus: R.errors.length > 0 ? "error" : "success", tooltip: h || null, help: R.errors.length > 0 ? R.errors.join("、") : null, required: ((N = S == null ? void 0 : S[0]) == null ? void 0 : N.required) || !1, ...q }, fieldProps: { placeholder: l, ...I, ...V }, $setting: Object.assign({}, c, T) }); } }); }, Nt = ({ cols: e = 24, rowHeight: t = 16, itemMargin: i = [8, 16], containerPadding: n = [0, 0], fields: r = [], children: a, basicForm: o = null }) => { const s = mi(r, bi, o); return j("div", { className: "ff-grid-layout-form", style: { "--grid-layout-item-margin-x": `${(i == null ? void 0 : i[0]) ?? 8}px`, "--grid-layout-item-margin-y": `${(i == null ? void 0 : i[1]) ?? 16}px`, "--grid-layout-container-padding-y": `${(n == null ? void 0 : n[0]) || 0}px`, "--grid-layout-container-padding-x": `${(n == null ? void 0 : n[1]) || 0}px`, "--grid-layout-cols": e, "--grid-layout-row-height": `${t}px` }, children: [s, a && x.cloneElement(a, { cols: e, rowHeight: t, itemMargin: i, containerPadding: n, fields: r })] }); }; Nt.propTypes = { fields: w.array }; const On = (Ut = Nt, ({ code: e, layout: t, name: i, primaryKey: n = 0, style: r = {}, formProps: a = {}, form: o, basicForm: s, isPreview: l = !1, className: u, onFinish: c, onValuesChange: g = () => { }, ...h }) => { const { align: m, autoComplete: f, resource: C, items: b, hides: k, rowHeight: S, marginX: $, marginY: T, cols: I, listenChangeFields: q, listenChangeFieldsFunc: z, pk: V, uuid: R } = $n(e), [B] = te.useForm(o), N = U(() => [{ name: "__PK__", value: V }, { name: "__PROPS__", value: a }, { name: "__RESOURCE__", value: C }, { name: "__LAYOUT_KEY__", value: e }, { name: "__LAYOUT_UUID__", value: R }, { name: "__PRIMARY_KEY__", value: n }], [V, e, R, C, n, a]); return j(te, { className: u, name: i || e, layout: t || m, fields: N, form: B, autoComplete: f, style: { ...r, position: "relative" }, onFinish: c, onValuesChange: (F, J) => (({ changedValues: de, allValues: $e, listenChangeFields: K, listenChangeFieldsFunc: Ke, onValuesChange: lt, code: Ot }) => { lt(de, $e), Ke && Array.isArray(K) && xe.exec(Ke, { changedValues: de, allValues: $e }, { getFieldValue: B.getFieldValue, setFieldValue: B.setFieldValue, setFieldsValue: B.setFieldsValue, isFieldTouched: B.isFieldTouched, isFieldsTouched: B.isFieldsTouched }); })({ changedValues: F, allValues: J, listenChangeFields: q, listenChangeFieldsFunc: z, onValuesChange: g, code: e }), children: [p(Ut, { ...h, form: B, basicForm: s, code: e, fields: b, cols: I, rowHeight: S, itemMargin: [$, T] }), k == null ? void 0 : k.map((F) => { var J; return p(Xt, { name: F.code, children: p(Fn, { form: B, basicForm: s, name: F.code, type: F.type, initialValue: F.initialValue, initialValueLanguage: (J = F.extras) == null ? void 0 : J.initialValueLanguage }) }, JSON.stringify(F.code)); })] }, e); }); var Ut; const Ci = ({ $setting: e, $close: t, extras: i, code: n, primaryKey: r, ...a }) => { const [o] = te.useForm(), s = Nn(n, r, e); return A(() => { s && o.setFieldsValue(s); }, [s]), p(Y, { actions: j(x.Fragment, { children: [p(P, { name: "保存", type: "primary", widget: () => { const l = o.getFieldValue("__RESOURCE__"), { initDataUri: u = `/api/${n}` } = e || {}; o.validateFields(!0).then((c) => l ? d.pick(c, [l]) : c).then((c) => L.post(r ? `${u}/${r}` : `${u}`, c).msg(t)).catch(() => G.error("请先完善表单信息", { duration: 2e3 })); } }), p(P, { name: "取消", widget: () => t(!1) })] }), extras: i, children: p(On, { form: o, code: n, primaryKey: r, ...a }) }); }, Ht = /* @__PURE__ */ new Set(), xt = (e = [], t = 0) => { const i = e[t]; if (i.length && !Ht.has(i)) { const n = document.createElement("script"); n.setAttribute("src", i), n.setAttribute("data-namespace", i), e.length > t + 1 && (n.onload = () => { xt(e, t + 1); }, n.onerror = () => { xt(e, t + 1); }), Ht.add(i), document.body.appendChild(n); } }, St = ({ className: e, type: t, style: i = {}, ...n }) => p("span", { role: "img", className: M("ff-iconfont", e), style: i, ...n, children: p("svg", { style: { width: "1em", height: "1em", fill: "currentColor", overflow: "hidden" }, viewBox: "0 0 1024 1024", children: p("use", { xlinkHref: `#${t}` }) }) }); St.propTypes = { className: w.string, type: w.string.isRequired, style: w.object }, St.init = xt; const jn = (e, t, i, n) => ke.redirect(i, t, n), Ln = (e, t = {}, i, n = {}) => { var a; const r = (a = n.router) == null ? void 0 : a.reduce((o, [s, l, u]) => { const c = d.get(t, ["router", s]); if (!c && c !== 0 && l) throw `请传入 ${u}`; return `${o}/${c}`; }, `/api/${i}`); return L.del(r, t.param).msg(); }, Jt = (e, t, i, { status: { loading: n, disabled: r }, setStatus: a }) => { const o = { loading: (s) => s === void 0 ? n : a((l) => ({ ...l, loading: s })), disabled: (s) => s === void 0 ? r : a((l) => ({ ...l, disabled: s })) }; return d.isFunction(i) ? i.call(null, { ...t, ...o }) : d.isString(i) && i ? xe.exec(i, t, o) : null; }, Kt = (e, t, i, n, r) => d.isString(i) && i ? le.getWidgetComponent(i).then(({ default: a }) => G.modal(a, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r)).catch((a) => { G.error(i, { content: a.toString() }); }) : G.modal(i, { ...t, $setting: n }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), An = (e, t, i, n, r) => G.modal(Ci, { ...t, $setting: n, code: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), Vn = (e, t, i, n, r) => G.modal(Tt, { base62params: t, $setting: n, listCode: i }, r != null && r.title ? { ...r, title: d.template(r.title)(e) } : r), In = ({ widget: e, widgetType: t, widgetData: i, widgetProps: n, widgetSetting: r, widgetContainerProps: a }, { onAfterClick: o, onBeforeClick: s }) => { const l = ce(ie), [u, c] = E({ leading: !0, trailing: !1 }), g = U(() => { switch (t) { case "redirect": return d.partialRight(jn, e, r); case "func": return d.partialRight(Jt, (r == null ? void 0 : r.code) ?? e, { status: u, setStatus: c }); case "fsdpf-component": return d.partialRight(Kt, e, r, a); case "grid-layout-form": return d.partialRight(An, e, r, a); case "data-list": return d.partialRight(Vn, e, r, a); case "destroy": return d.partialRight(Ln, e, r, a); default: if (Et(e) || x.isValidElement(e)) return d.partialRight(Kt, e, r, a); if (d.isFunction(e)) return d.partialRight(Jt, (r == null ? void 0 : r.code) || e, { status: u, setStatus: c }); } return (...h) => console.error("useButton unknown widgetType", t, ...h); }, [e, t]); return [d.debounce((h) => (s == null || s(h), Promise.resolve(Ue(n, h, { list: l })).then((m) => g(h, { ...i, ...m })).then((m) => o == null ? void 0 : o(m)).catch(console.error)), 300, { leading: !0, trailing: !1 }), u]; }, ki = ({ type: e, name: t, className: i, icon: n, iconPosition: r, size: a }, o = "default") => U(() => { const s = { type: "primary", className: M("ff-button", i), iconPosition: r, size: a }; return e === "danger" ? s.danger = !0 : e === "default" && (s.type = e), o === "link" || o === "dashed" ? (s.type = o, e === "default" && (s.className = M(s.className, "ff-default"))) : o !== "circle" && o !== "round" || (s.shape = o), n && (s.icon = p(St, { type: n })), t && (s.children = t), s; }, [o, e, i, n, r]), Je = (e) => function({ className: t, variant: i, children: n, name: r, icon: a, type: o = "default", iconPosition: s = "start", noAuthType: l, onAfterClick: u, onBeforeClick: c, data: g, loading: h, disabled: m, tooltip: f, confirm: C, widget: b = () => { }, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: I, ...q }) { const z = U(() => oi(), []), V = d.isEmpty(f) || !f.enabled ? {} : f, R = d.isEmpty(C) ? { enabled: !1 } : Object.assign({ enabled: !0 }, C), B = ki({ className: t, name: r, type: o, icon: a, iconPosition: s }, i ?? e), [N, F] = E(!1), [J, { disabled: de, loading: $e }] = In({ widget: b, widgetType: k, widgetData: S, widgetProps: $, widgetSetting: T, widgetContainerProps: I }, { onAfterClick: u, onBeforeClick: c }); return p(Ui, { zIndex: z, okText: "确定", cancelText: "取消", getPopupContainer: (K) => K, ...R, disabled: de || m, open: N, onOpenChange: (K) => { if (!K) return F(K); R.enabled ? F(K) : J(g); }, onConfirm: (K) => { J(g, K); }, onClick: (K) => { K.stopPropagation(); }, children: p(Hi, { zIndex: z, getPopupContainer: (K) => K, ...V, title: N ? null : V == null ? void 0 : V.title, trigger: ["hover", "click"], children: p(Ze, { loading: $e || h, disabled: de || m, ...B, ...q, children: n || r }) }) }); }, P = Je("default"); P.propTypes = { type: w.oneOf(["primary", "default", "danger", ""]), size: w.oneOf(["large", "middle", "small"]), name: w.string, icon: w.string, iconPosition: w.oneOf(["start", "end"]), data: w.any, widget: w.any, widgetType: w.oneOf(["destroy", "redirect", "func", "fsdpf-component", "grid-layout-form", "grid-layout", "data-list"]), widgetData: w.object, widgetProps: w.object, widgetSetting: w.object, widgetContainerProps: w.object, tooltip: w.exact({ title: w.string.isRequired, placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func }), confirm: w.exact({ title: w.string.isRequired, cancelText: w.string, okText: w.string, okType: w.oneOf(["primary", "default", "danger", ""]), placement: w.oneOf(["top", "left", "right", "bottom", "topLeft", "topRight", "bottomLeft", "bottomRight", "leftTop", "leftBottom", "rightTop", "rightBottom"]), enabled: w.oneOfType([w.bool, w.number]), getPopupContainer: w.func, arrow: w.oneOfType([w.bool, w.exact({ pointAtCenter: w.bool })]) }) }; const Mn = Je("link"), zn = Je("circle"), Bn = Je("round"), Dn = Je("dashed"), Rt = ({ data: e, widget: t, widgetType: i = "fsdpf-component", widgetData: n, widgetProps: r, widgetSetting: a, widgetContainerProps: o, onAfterClick: s, onBeforeClick: l, children: u, extras: c }) => { const g = U(() => oi(), []), h = ce(ie), [m, f] = E(!1), [C, b] = E("hover"), [k, S] = E({}), [$, T] = E(), { placement: I, align: q, arrow: z = { pointAtCenter: !0 }, getPopupContainer: V, ...R } = o || {}; A(() => { i == "grid-layout-form" ? T(x.createElement(Ci, { ...n, $setting: a, code: t })) : i == "data-list" ? T(x.createElement(Tt, { base62params: e, $setting: a, listCode: t })) : d.isString(t) ? le.getWidgetComponent(t).then(({ default: F }) => { T(x.createElement(F, { ...n, $setting: a })); }).catch((F) => T(F.toString())) : Et(t) ? T(x.createElement(t, { ...n, $setting: a })) : x.isValidElement(t) && T(x.cloneElement(t, { ...n, $setting: a })); }, [t, i, n]), A(() => { Promise.resolve(Ue(r, e, { list: h })).then(S); }, [r, e, h.getBase62params]); const B = (F, J = !1) => (f(F), !F && b("hover"), F ? l == null ? void 0 : l(k) : s == null ? void 0 : s(J)), N = (F) => { f(!0), b("click"); }; return p(Ji, { zIndex: g, placement: I, onPopupClick: N, onClick: N, open: m, align: q, arrow: z, trigger: C, getPopupContainer: V, content: p(qn, { ...R, extras: c, children: $ && x.cloneElement($, { ...k, $close: (F) => B(!1, F) }) }), children: u, onOpenChange: B }); }, qn = ({ title: e, className: t, children: i, extras: n, width: r, height: a, ...o }) => { const [s, l] = E({}), u = X((m, f) => l((C) => ({ ...C, [m]: f })), []), c = X((m) => l((f) => ({ ...f, [m]: void 0 })), []), g = e ? x.createElement("div", { className: "ff-popup-title" }, e) : s == null ? void 0 : s.title, h = n ?? x.createElement("div", { className: "ff-popup-reserved-extras" }, n); return p(We.Provider, { value: { ele: s, mount: u, unmount: c }, children: j("div", { className: M("ff-popup ff-popover", t, s.rootClassName), style: { width: r, height: a }, ...o, children: [j("div", { className: "ff-popup-header", children: [g, s == null ? void 0 : s["sub-title"]] }), i, j("div", { className: "ff-popup-footer", children: [h, s == null ? void 0 : s.extras, s == null ? void 0 : s.actions] })] }) }); }; Rt.propTypes = { widgetType: w.oneOf(["fsdpf-component", "grid-layout-form", "data-list"]) }; const _t = ({ options: e = [], triggerWeights: t = ["grid-layout-form", "grid-layout", "fsdpf-component", "print"], onAfterClick: i = (m, f, C) => { }, onBeforeClick: n = (m, f, C) => { }, labelVariant: r = "link", labelSize: a, labelRender: o, btnVariant: s, btnSize: l, btnRender: u = (m, f) => p(P, { ...m, data: f }, m.uuid || Qe()), widgetContainerProps: c = {}, children: g, data: h }) => { if (d.isEmpty(e)) return g; const [m, f] = U(() => (e || []).reduce((b, k) => { const S = t.indexOf(k.widgetType); return S === -1 ? b[1].push(k) : b[0] ? S < t.indexOf(b[0].widgetType) ? (b[1].push(b[0]), b[0] = k) : b[1].push(k) : b[0] = k, b; }, [null, []]), [e, t]); o ? g = o(m, h) || g : g || (g = p(Ze, { ...ki(Object.assign(m != null && m.name || m != null && m.icon ? {} : { icon: "icon-location" }, m, { size: a }), r) })); const C = f.map((b) => u(Object.assign({ uuid: b.uuid, type: b.type, name: b.name, widget: b.widget, widgetType: b.widgetType, widgetProps: b.widgetProps, widgetData: b.widgetData, widgetSetting: b.widgetSetting, widgetContainerProps: b.widgetContainerSetting, confirm: b.confirm, onAfterClick: d.partialRight(i, b, h), onBeforeClick: d.partialRight(n, b, h) }, { size: l, variant: s }), h)); return p(Rt, { widget: m == null ? void 0 : m.widget, widgetType: m == null ? void 0 : m.widgetType, widgetProps: m == null ? void 0 : m.widgetProps, widgetSetting: m == null ? void 0 : m.widgetSetting, widgetContainerProps: Object.assign({}, c, m == null ? void 0 : m.widgetContainerProps), data: h, widgetData: m == null ? void 0 : m.widgetData, extras: C, onAfterClick: d.partialRight(i, m, h), onBeforeClick: d.partialRight(n, m, h), children: g }); }; _t.propTypes = { triggerWeights: w.array, options: w.arrayOf(w.shape({ ...P.propTypes, widgetType: P.propTypes.widgetType.isRequired })), btnSize: P.propTypes.size, btnRender: w.func, btnVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelVariant: w.oneOf(["", "default", "link", "circle", "round", "dashed"]), labelRender: w.func, labelSize: P.propTypes.size, onAfterClick: w.func, onBeforeClick: w.func, widgetContainerProps: P.propTypes.widgetContainerProps, data: P.propTypes.data }, P.Link = Mn, P.Link.defaultProps = P.defaultProps, P.Link.propTypes = P.propTypes, P.Circle = zn, P.Circle.defaultProps = P.defaultProps, P.Circle.propTypes = P.propTypes, P.Round = Bn, P.Round.defaultProps = P.defaultProps, P.Round.propTypes = P.propTypes, P.Dashed = Dn, P.Dashed.defaultProps = P.defaultProps, P.Dashed.propTypes = P.propTypes, P.Popover = Rt, P.GroupPopover = _t; const Wn = ({ fields: e, formProps: t, $close: i }) => { const [n] = te.useForm(), r = U(() => [{ name: "__PROPS__", value: t }], [t]); return p(Y, { actions: j(x.Fragment, { children: [p(P, { name: "取消", widget: () => i(!1) }), p(P, { name: "确定", type: "primary", widget: () => n.validateFields(!0).then(i) })] }), children: p(te, { fields: r, form: n, className: "ff-modal-form", children: e == null ? void 0 : e.map(({ code: a, ...o }) => p(bi, { code: a, ...o }, a)) }) }); }, Un = ({ className: e, $close: t, children: i, title: n, subTitle: r, actions: a, extras: o, ...s }) => j(Zi, { ...s, prefixCls: "ff-drawer", className: M("ff-popup", e), maskMotion: { motionAppear: !0, motionName: "mask-motion" }, motion: (l) => ({ motionAppear: !0, motionName: `panel-motion-${l}` }), children: [j("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: s.onClose, children: p($t, { type: "close" }) }), n, r] }), p("div", { className: "ff-popup-body", children: i }), j("div", { className: "ff-popup-footer", children: [o, a] })] }), Hn = ({ className: e, $close: t, $event: i, children: n, title: r, subTitle: a, actions: o, extras: s, placement: l, ...u }) => { const c = (i == null ? void 0 : i.pageX) === void 0 ? { animation: null, maskAnimation: null, mousePosition: { x: null, y: null } } : { animation: "zoom", maskAnimation: "fade", mousePosition: { x: i == null ? void 0 : i.pageX, y: i == null ? void 0 : i.pageY } }; return p(en, { ...u, ...c, prefixCls: "ff-modal", modalRender: () => j("div", { className: M("ff-modal-content ff-popup", e), children: [j("div", { className: "ff-popup-header", children: [p("button", { "aria-label": "Close", className: "ff-popup-close", onClick: u.onClose, children: p($t, { type: "close" }) }), r, a] }), p("div", { className: "ff-popup-body", children: n }), j("div", { className: "ff-popup-footer", children: [s, o] })] }) }); }, xi = ({ placement: e, $close: t, $event: i, children: n, title: r, ...a }) => { const [o, s] = E({}), [l, u] = E(!0), c = X((f, C) => s((b) => ({ ...b, [f]: C })), []), g = X((f) => s((C) => ({ ...C, [f]: void 0 })), []); let h = { ...a, className: o.rootClassName, title: o.title || r && x.createElement("div", { className: M("ff-popup-title") }, r), subTitle: o["sub-title"], actions: o.actions, extras: o.extras, children: n, $close: t, $event: i, onClose: () => u(!1) }; const m = () => { t(!1); }; return p(We.Provider, { value: { ele: o, mount: c, unmount: g }, children: e && e !== "center" ? p(Un, { ...h, placement: e, open: l, afterOpenChange: (f) => !f && m() }) : p(Hn, { ...h, visible: l, afterClose: m }) }); }; xi.propTypes = { placement: w.oneOf(["center", "left", "top", "right", "bottom"]) }; const _ = () => { const [e, t] = Vi({ maxCount: 6, motion: { motionName: "ff-notification-fade", motionAppear: !0, motionEnter: !0, motionLeave: !0, onLeaveStart: (a) => { const { offsetHeight: o } = a; return { height: o }; }, onLeaveActive: () => ({ height: 0, opacity: 0, margin: 0 }) }, prefixCls: "ff-notification" }), [, i] = x.useReducer((a) => a + 1, 0); A(() => { _.$onClick = n, _.$queue.forEach(([a, o, s], l, u) => { r([o, s], ...a), delete u[l]; }); }, []); const n = (a, o = {}, s = {}) => new Promise((l, u) => r([l, u], a, o, s)), r = ([a, o], s, l = {}, u = {}) => { const c = _.$index++, g = (h) => ((m, f) => (_.$popups.delete(m), i(), f == null ? void 0 : f()))(c, () => a(h)); if (s === ii) return e.open({ ...u, key: c, content: x.createElement(s, { ...l, $close: () => e.close(c) }) }); _.$popups.set(c, x.createElement(xi, { zIndex: c, maskClosable: !1, $event: l == null ? void 0 : l.$event, ...u, key: c, $close: g }, x.isValidElement(s) ? x.cloneElement(s, { ...l, $close: g }) : s != null && s.name || It.isForwardRef(s) || (s == null ? void 0 : s.$$typeof) === It.ForwardRef ? x.createElement(s, { ...l, $close: g }) : s)), i(); }; return j(x.Fragment, { children: [Array.from(_.$popups).map(([a, o]) => o), t] }); }; _.$popups = /* @__PURE__ */ new Map(), _.$index = 9999, _.$queue = [], _.$onClick = (...e) => new Promise((t, i) => { _.$queue.push([e, t, i]); }); const Gt = (e, t, i = {}) => _.$onClick(e, t, i), gt = (e, { showProgress: t, duration: i, ...n } = { duration: 1.5 }) => _.$onClick(ii, { content: e, ...n }, { showProgress: t, duration: i }), G = { modal: Gt, confirm: (e, t = {}) => _.$onClick(tn, { content: e, ...t }, { placement: "center" }), form: (e, t = {}, i = {}) => Gt(Wn, { formProps: i, fields: e }, { placement: "center", ...t }).then((n) => { if (n === !1) throw !1; return n; }), notification: gt, success: (e, t = { duration: 1.5 }) => gt(e, { ...t, className: "ff-notification-success", icon: "check" }), error: (e, t = { duration: 1.5 }) => gt(e, { ...t, className: "ff-notification-error", icon: "close" }) }; je.configure({ showSpinner: !1 }), Le.interceptors.request.use((e) => { e.headers.Platform = "web", e.headers.SaaS = window.localStorage.getItem("SaaS"); const t = window.localStorage.getItem(Xe); return e.headers.Authorization = t ? `Bearer ${t} ` : void 0, je.inc(), e; }, (e) => (je.done(), Promise.reject({ code: -1, msg: e }))), Le.interceptors.response.use(({ data: e, headers: t }) => (je.done(), { ...e, res: t == null ? void 0 : t.res }), function(e) { return je.done(), Promise.reject(e.message); }), window.addEventListener("unhandledrejection", mt.onUnhandledRejection), mt.onMsg = (e, t) => G[[0, 1].includes(e) ? "success" : "error"](t).then(() => e === 20300 && ke.redirect(Ae.get("Common.WEBSITE_LOGIN_PAGE"))); const vt = { appUrl: "", init: (e, t, i) => { vt.appUrl = i, Le.defaults.baseURL = i, Le.defaults.timeout = 15e3, Object.assign(vt, new mt(e, t, Le)); } }, L = vt; class Ft extends Error { constructor(t, i) { super(i), Error.captureStackTrace && Error.captureStackTrace(this, Ft), !i instanceof Ve && (this.name = `${t} Error Runtime`); } } class Ve extends Error { constructor(t, ...i) { super(...i), Error.captureStackTrace && Error.captureStackTrace(this, Ve), this.name = `${t} Not Found`; } } const pt = "mine", Xe = "token"; var Ce, Oe; const oe = class oe { constructor() { O(this, Oe, /* @__PURE__ */ new Map()); v(this, "setVendor", (t, i) => y(this, Oe).set(t, new ei(i, async (n, r) => { var o, s; if (!(n != null && n.default)) throw "@pkg not found"; let a = () => r; switch ("function") { case typeof (a = (o = n.default) == null ? void 0 : o[`./${r}/index.jsx`]): case typeof (a = (s = n.default) == null ? void 0 : s[`./${r}/index.js`]): return a(); } throw new Ve(r); }))); v(this, "getWidgetComponent", async (t) => { if (!t) throw "getWidgetComponent widget is required"; if (t != null && t.startsWith("blob:") || t != null && t.startsWith("http:") || t != null && t.startsWith("https:")) return await import(t); const [, i] = t == null ? void 0 : t.split("@pkg/"); if (!i) throw new Ve(t); try { return y(this, Oe).has("pkg") ? await y(this, Oe).get("pkg").get(i) : await import(`${L.appUrl}/api/pkg-import/web?name=${t}`); } catch (n) { throw new Ft(t, n); } }); v(this, "getRoutes", () => L.get("/api/my-router").then((t) => [...t, { uuid: "data-list-setting", isLayout: !0, uri: "/data-list-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/DataListSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-setting", isLayout: !0, uri: "/grid-layout-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "grid-layout-form-setting", isLayout: !0, uri: "/grid-layout-form-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/GridLayoutFormSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "resource-api-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ResourceApiSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "charts-setting", isLayout: !0, uri: "/resource-api-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ChartsSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "fsm-setting", isLayout: !0, uri: "/fsm-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/FsmSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "component-setting", isLayout: !0, uri: "/component-setting/:category/:categoryUuid", type: "fsdpf-component", component: "@pkg/ff-design/components/ComponentSetting", extra: { layout: "@pkg/ff-design/frameworks/DesignTheme" } }, { uuid: "login", uri: "/login", name: "登录", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/Login" }, { uuid: "not-found", uri: "*", name: "Not Found", type: "fsdpf-component", isLogin: !1, component: "@pkg/ff/components/NotFound" }].map(({ uuid: i, ...n }) => [i, { uuid: i, ...n }])).then((t) => new Map(t))); v(this, "getMenus", () => L.get("/api/my-menu")); v(this, "getConfigure", () => L.get("api/init-configure")); v(this, "getWidgetOperationAuth", () => L.get("/api/init-widget-operation-auth").then((t) => t.reduce((i, { uuid: n, auth: r }) => [...i, [n, r]], []))); v(this, "getPhoneNumber", (t) => L.get(`/api/user-wx-phone-number/${t}`)); v(this, "getUserToken", () => { const t = window.localStorage.getItem(Xe); if (!t) return ""; const i = t.split("."); if (!Array.isArray(i) || i.length !== 3) throw "登录令牌无效!"; const { iat: n } = JSON.parse(window.atob(i[1])); if (Math.floor((/* @__PURE__ */ new Date()).getTime() / 1e3) - n > 2592e3) throw "登录令牌已过期, 请重新登录!"; return t; }); v(this, "checkUserToken", () => { try { return !!this.getUserToken(); } catch { return !1; } }); v(this, "getUserInfo", (t = !0) => { var i; try { const n = this.getUserToken(); if (!n) return Promise.resolve(null); const { iat: r } = JSON.parse(window.atob((i = n == null ? void 0 : n.split(".")) == null ? void 0 : i[1])), { iat: a, ...o } = L.decode(window.localStorage.getItem(pt) || "", {}); return a === r ? Promise.resolve(o) : L.get("/api/mine-info").then(({ User: s = null }) => (window.localStorage.setItem(pt, L.encode({ ...s, iat: r })), s)); } catch (n) { console.error(n), t && G.error("请登录").then(this.logout); } return Promise.resolve(null); }); v(this, "login", (t, i, n = {}) => L.post("/api/user-token", { username: t, passwd: Ii.hash(i), platform: "web", ...n }).then(({ token: r }) => (window.localStorage.setItem(Xe, r), r))); v(this, "logout", (t) => (window.localStorage.removeItem(pt), window.localStorage.removeItem(Xe), t == null ? void 0 : t())); if (y(oe, Ce)) return y(oe, Ce); } }; Ce = new WeakMap(), Oe = new WeakMap(), O(oe, Ce, null), v(oe, "getInstance", () => (y(oe, Ce) || H(oe, Ce, new oe()), y(oe, Ce))); let Pt = oe; const le = Pt.getInstance(), Jn = x.createContext({ user: {}, initUser: () => { }, initUserComplete: !1 }), Kn = x.createContext({ set: () => { }, get: () => { }, assign: () => { }, currentRoute: () => { } }), Et = (e) => !!(e != null && e.name) && (e.prototype instanceof x.Component || /^[A-Z]/.test(e.name)), _n = (e, t) => { if (!e || typeof window > "u") return; let i = document.querySelector(`style[ff-style-token="${t}"]`); return i ? (i.innerHTML = e, e) : (i = document.createElement("style"), i.setAttribute("ff-style-token", t), i.setAttribute("type", "text/css"), i.innerHTML = e, document.head.appendChild(i), e); }, Gn = Object.freeze(Object.defineProperty({ __proto__: null, AppContext: Jn, AppGlobalParamsContext: Kn, cache: ei, configure: Ae, default: le, func: xe, http: L, insertStyle: _n, isReactComponent: Et, route: ke }, Symbol.toStringTag, { value: "Module" })); export { Nt as $, yn as A, xn as B, cn as C, et as D, un as E, sn as F, xr as G, wn as H, br as I, Cr as J, li as K, wt as L, on as M, ln as N, Sn as O, vn as P, Sr as Q, gi as R, vr as S, st as T, Pr as U, $r as V, He as W, ot as X, Tr as Y, Nr as Z, On as _, ni as a, bi as a0, Ci as a1, $n as a2, Tn as a3, Nn as a4, wi as a5, Rn as a6, Rr as a7, St as a8, P as a9, nn as aa, In as ab, Y as ac, We as ad, ti as ae, _ as af, G as ag, gr as ah, pr as ai, mr as aj, le as ak, Et as al, _n as am, L as an, ei as ao, Ae as ap, xe as aq, ke as ar, Jn as as, Kn as at, Ue as b, fr as c, ri as d, yr as e, wr as f, rn as g, oi as h, an as i, ci as j, kr as k, pi as l, hi as m, Cn as n, bn as o, mi as p, ui as q, ut as r, di as s, ee as t, hr as u, fn as v, hn as w, pn as x, Tt as y, ie as z };