import { _defineProperty } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js";
import { _objectSpread2 } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
import { _asyncToGenerator } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
import { locales } from "@pisell/utils";
import { PisellToast } from "@pisell/materials";
//#region src/utils/index.ts
var Request = class {
	constructor() {
		_defineProperty(this, "request", {});
	}
	setRequest(val) {
		this.request = val;
	}
	withCustomToast(config) {
		return _objectSpread2(_objectSpread2({}, config || {}), {}, { customToast: (msg) => PisellToast({ content: msg }) });
	}
	getRequest() {
		return _objectSpread2(_objectSpread2({}, this.request), {}, {
			get: (url, params, config) => this.request.get(url, params, this.withCustomToast(config)),
			post: (url, params, config) => this.request.post(url, params, this.withCustomToast(config))
		});
	}
};
const request = new Request();
let modal;
(function() {
	var _ref = _asyncToGenerator(function* () {
		return modal.confirm({
			title: locales.getText("pisell2.text.products.unsaved-title"),
			content: locales.getText("pisell2.text.products.unsaved-content"),
			cancelText: locales.getText("pisell2.text.products.unsaved-back"),
			okText: locales.getText("pisell2.text.products.unsaved-yes")
		});
	});
	return function saveConfirm() {
		return _ref.apply(this, arguments);
	};
})();
//#endregion
export { request };
