'use client';
"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
function _export(target, all) {
    for(var name in all)Object.defineProperty(target, name, {
        enumerable: true,
        get: all[name]
    });
}
_export(exports, {
    ActionsProvider: function() {
        return ActionsProvider;
    },
    useActions: function() {
        return useActions;
    }
});
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
const _Config = require("../Config");
function _getRequireWildcardCache(nodeInterop) {
    if (typeof WeakMap !== "function") return null;
    var cacheBabelInterop = new WeakMap();
    var cacheNodeInterop = new WeakMap();
    return (_getRequireWildcardCache = function(nodeInterop) {
        return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
    })(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
    if (!nodeInterop && obj && obj.__esModule) {
        return obj;
    }
    if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
        return {
            default: obj
        };
    }
    var cache = _getRequireWildcardCache(nodeInterop);
    if (cache && cache.has(obj)) {
        return cache.get(obj);
    }
    var newObj = {
        __proto__: null
    };
    var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
    for(var key in obj){
        if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
            var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
            if (desc && (desc.get || desc.set)) {
                Object.defineProperty(newObj, key, desc);
            } else {
                newObj[key] = obj[key];
            }
        }
    }
    newObj.default = obj;
    if (cache) {
        cache.set(obj, newObj);
    }
    return newObj;
}
const ActionsContext = /*#__PURE__*/ (0, _react.createContext)({
    actions: [],
    setViewActions: ()=>{}
});
const useActions = ()=>(0, _react.useContext)(ActionsContext);
const ActionsProvider = ({ children })=>{
    const [viewActions, setViewActions] = (0, _react.useState)([]);
    const [adminActions, setAdminActions] = (0, _react.useState)([]);
    const { admin: { components: { actions: configAdminActions } } } = (0, _Config.useConfig)();
    (0, _react.useEffect)(()=>{
        setAdminActions(configAdminActions || []);
    }, [
        configAdminActions
    ]);
    const combinedActions = [
        ...viewActions,
        ...adminActions
    ];
    return /*#__PURE__*/ _react.default.createElement(ActionsContext.Provider, {
        value: {
            actions: combinedActions,
            setViewActions
        }
    }, children);
};

//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9wcm92aWRlcnMvQWN0aW9uc1Byb3ZpZGVyL2luZGV4LnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIGNsaWVudCdcbmltcG9ydCBSZWFjdCwgeyBjcmVhdGVDb250ZXh0LCB1c2VDb250ZXh0LCB1c2VFZmZlY3QsIHVzZVN0YXRlIH0gZnJvbSAncmVhY3QnXG5cbmltcG9ydCB7IHVzZUNvbmZpZyB9IGZyb20gJy4uL0NvbmZpZydcblxudHlwZSBBY3Rpb25zQ29udGV4dFR5cGUgPSB7XG4gIGFjdGlvbnM6IFJlYWN0LkNvbXBvbmVudFR5cGU8YW55PltdXG4gIHNldFZpZXdBY3Rpb25zOiAoYWN0aW9uczogUmVhY3QuQ29tcG9uZW50VHlwZTxhbnk+W10pID0+IHZvaWRcbn1cblxuY29uc3QgQWN0aW9uc0NvbnRleHQgPSBjcmVhdGVDb250ZXh0PEFjdGlvbnNDb250ZXh0VHlwZT4oe1xuICBhY3Rpb25zOiBbXSxcbiAgc2V0Vmlld0FjdGlvbnM6ICgpID0+IHt9LFxufSlcblxuZXhwb3J0IGNvbnN0IHVzZUFjdGlvbnMgPSAoKSA9PiB1c2VDb250ZXh0KEFjdGlvbnNDb250ZXh0KVxuXG5leHBvcnQgY29uc3QgQWN0aW9uc1Byb3ZpZGVyID0gKHsgY2hpbGRyZW4gfSkgPT4ge1xuICBjb25zdCBbdmlld0FjdGlvbnMsIHNldFZpZXdBY3Rpb25zXSA9IHVzZVN0YXRlKFtdKVxuICBjb25zdCBbYWRtaW5BY3Rpb25zLCBzZXRBZG1pbkFjdGlvbnNdID0gdXNlU3RhdGUoW10pXG5cbiAgY29uc3Qge1xuIC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