import{j as r}from"./tanstack-1.0.74-aU0azVkW.js";import{r as p}from"./redux-1.0.74-D8bIc6ki.js";import{B as f,J as g}from"./index-1.0.74-DxwH6OqZ.js";import{d as x}from"./ActionsSettings-1.0.74-C1yaah3Y.js";import{S}from"./ScopeEnum-1.0.74-B4DDvIDj.js";import{T as c}from"./TargetEnum-1.0.74-BJN_W527.js";import{B as l,C as h}from"./ConfirmDialog-1.0.74-CXu4CqK2.js";import{e as o}from"./utils-1.0.74-7xWhx9mc.js";import{l as j,b as s}from"./lib-1.0.74-B5IEqfHg.js";import{A as T,a as b}from"./AccordionSummary-1.0.74-BIcO1H0G.js";import{A as v}from"./AccordionDetails-1.0.74-UIik1H9G.js";import{F as A,b as B}from"./TextField-1.0.74-BW9Byijb.js";import"./vendor-1.0.74-CN03Eozo.js";import"./CircularProgress-1.0.74-QfwfRJ7i.js";import"./ButtonBase-1.0.74-W6tAH7AI.js";import"./Typography-1.0.74-B4mhsevh.js";import"./useEnhancedEffect-1.0.74-B56M26dS.js";import"./ThemeProvider-1.0.74-4uzbYYLM.js";import"./Portal-1.0.74-BrUPeMX9.js";import"./iconBase-1.0.74-Cs0vntJu.js";import"./RestApi-1.0.74-5XKxNzpR.js";import"./AdminTheme-1.0.74-BtTaJUu_.js";import"./Modal-1.0.74-BfLid1bk.js";import"./Collapse-1.0.74-DA2Rx31o.js";import"./Select-1.0.74-DHOnlEEH.js";import"./Menu-1.0.74-CdjCBJ4R.js";import"./isHostComponent-1.0.74-DVu5iVWx.js";import"./createSvgIcon-1.0.74-Cw_ZFbxi.js";const $=({dbs:n,tbl:m})=>{j.debug(n,m);const[u,t]=p.useState(!1),[i,a]=p.useState(void 0),d=()=>{switch(i){case"form":return"Reset Form Builder?";case"theme":return"Reset Theme?";default:return"Reset Table Builder?"}};return r.jsxs(r.Fragment,{children:[r.jsxs(T,{disableGutters:!0,children:[r.jsx(b,{expandIcon:r.jsx(f,{}),children:"Reset"}),r.jsx(v,{children:r.jsxs(A,{sx:{display:"grid",gridGap:"20px"},children:[r.jsx(l,{variant:"contained",color:"primary",onClick:()=>{a(c.TABLE),t(!0)},children:"Reset Table Builder"}),r.jsx(l,{variant:"contained",color:"primary",onClick:()=>{a(c.FORM),t(!0)},children:"Reset Form Builder"}),r.jsxs(B,{sx:{display:"inline-grid",gridTemplateColumns:"20px auto",gridGap:"5px",alignItems:"center","& svg":{fontSize:"20px"}},error:!0,children:[r.jsx(g,{}),"A reset cannot be undone!"]})]})})]}),r.jsx(h,{title:d(),message:"Are you sure? This action cannot be undone!",open:u,setOpen:t,onConfirm:()=>{i!==void 0&&x(S.GLOBAL,i,n,m,null,e=>{if(e!=null&&e.code&&(e==null?void 0:e.message)!==void 0)switch(e.code){case"ok":o(e.message,{variant:"success"});break;case"info":o(e.message,{variant:"info"});break;default:o(e.message??s.contactSupport,{variant:"error"})}else console.error(e),o(s.contactSupport,{variant:"error"})},e=>{console.error("error",e),o(e??s.contactSupport,{variant:"error"})})}})]})};export{$ as default};
