import { Chain, Guard, NamedChain } from '@ephox/agar';
import { Arr, Obj } from '@ephox/katamari';
// INVESTIGATE: Does cLogging have a place in vanilla agar?
const cLogging = (label, chains) => {
    const logChains = Arr.map(chains, (c) => Chain.control(c, Guard.addLogging(label)));
    return Chain.fromChains(logChains);
};
const cFindUid = (uid) => Chain.binder((context) => context.getByUid(uid));
const cFindUids = (gui, lookups) => {
    const keys = Obj.keys(lookups);
    const others = Arr.map(keys, (k) => NamedChain.direct('context', cFindUid(lookups[k]), k));
    return NamedChain.asChain([
        NamedChain.writeValue('context', gui)
    ].concat(others));
};
const cToElement = Chain.mapper((comp) => comp.element);
const eToComponent = (other) => Chain.binder((elem) => other.getSystem().getByDom(elem));
export { cLogging, cFindUids, cToElement, eToComponent };
//# sourceMappingURL=ChainUtils.js.map