var g = Object.defineProperty;
var l = (o, t, e) => t in o ? g(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
var n = (o, t, e) => l(o, typeof t != "symbol" ? t + "" : t, e);
import { createAsyncThunk as m } from "@reduxjs/toolkit";
import { EndPoint as h } from "./api-config.js";
import { HttpStore as w } from "./index-http.store.js";
import { AbortControllersManager as A } from "./index-abort-controllers-manager.js";
import { firstValueFrom as b } from "./index-firstValueFrom.js";
const r = class r extends w {
  /**
   * Save logs in elastic
   *
   */
  putLog(t, e, a) {
    return this.put(new h("/rest_api/v1/log"), t, e, a);
  }
};
/**
 * Manager of list of AbortControllers for the Request
 */
n(r, "putLogAbortManager", new A()), n(r, "putLogThunk", m(
  /**
   * Save logs in elastic
   *
   */
  "putLog",
  async ({
    requestBody: t,
    queryParams: e
  }, {
    rejectWithValue: a
  } = {}) => {
    const p = (/* @__PURE__ */ new Date()).getTime().toString();
    try {
      const s = new AbortController(), u = s.signal;
      r.putLogAbortManager._push(p, s);
      const c = await b(f.putLog(t, e, u));
      return r.putLogAbortManager._remove(p), c;
    } catch (s) {
      return r.putLogAbortManager._remove(p), a(s.response.data);
    }
  }
)), n(r, "putLogUrlRegEx", new RegExp("/rest_api/v1/log")), n(r, "putLogUrlMockRequest", "/rest_api/v1/log(.*)");
let i = r;
const f = new i();
export {
  i as LogStore,
  f as logStore
};
