var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __read = (this && this.__read) || function (o, n) {
    var m = typeof Symbol === "function" && o[Symbol.iterator];
    if (!m) return o;
    var i = m.call(o), r, ar = [], e;
    try {
        while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
    }
    catch (error) { e = { error: error }; }
    finally {
        try {
            if (r && !r.done && (m = i["return"])) m.call(i);
        }
        finally { if (e) throw e.error; }
    }
    return ar;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { createContext, useState } from 'react';
var globalCtx = {
    setChangeView: function (func) { },
    changeView: function (path, params) { },
    setSendAppointment: function (func) { },
    sendAppointment: function (form) { return new Promise(function () { return ({}); }); },
    initGoogleAutoComplete: function (element_id, locale_id, callback) { },
    setInitGoogleAutoComplete: function (func) { },
};
export var GlobalCtx = createContext(globalCtx);
export default function GlobalProvider(_a) {
    var children = _a.children;
    var _b = __read(useState({
        changeView: undefined,
        sendAppointment: undefined,
        setChangeView: setChangeView,
        setSendAppointment: setSendAppointment,
        setInitGoogleAutoComplete: setInitGoogleAutoComplete,
    }), 2), state = _b[0], setState = _b[1];
    function setChangeView(changeView) {
        setState(function (state) { return (__assign(__assign({}, state), { changeView: changeView })); });
    }
    function setSendAppointment(sendAppointment) {
        setState(function (state) { return (__assign(__assign({}, state), { sendAppointment: sendAppointment })); });
    }
    function setInitGoogleAutoComplete(initGoogleAutoComplete) {
        setState(function (state) { return (__assign(__assign({}, state), { initGoogleAutoComplete: initGoogleAutoComplete })); });
    }
    return _jsx(GlobalCtx.Provider, { value: state, children: children });
}
