File: //lib/node_modules/openclaw/dist/dm-policy-shared-CHwAl-JC.js
import { l as normalizeStringEntries } from "./dock-DE75y38s.js";
import { i as readChannelAllowFromStore } from "./pairing-store-BICHFkVx.js";
//#region src/security/dm-policy-shared.ts
async function resolveDmAllowState(params) {
const configAllowFrom = normalizeStringEntries(Array.isArray(params.allowFrom) ? params.allowFrom : void 0);
const hasWildcard = configAllowFrom.includes("*");
const storeAllowFrom = await (params.readStore ?? readChannelAllowFromStore)(params.provider).catch(() => []);
const normalizeEntry = params.normalizeEntry ?? ((value) => value);
const normalizedCfg = configAllowFrom.filter((value) => value !== "*").map((value) => normalizeEntry(value)).map((value) => value.trim()).filter(Boolean);
const normalizedStore = storeAllowFrom.map((value) => normalizeEntry(value)).map((value) => value.trim()).filter(Boolean);
const allowCount = Array.from(new Set([...normalizedCfg, ...normalizedStore])).length;
return {
configAllowFrom,
hasWildcard,
allowCount,
isMultiUserDm: hasWildcard || allowCount > 1
};
}
//#endregion
export { resolveDmAllowState as t };