"use strict";
(() => {
var exports = {};
exports.id = 4565;
exports.ids = [4565,8105,133,4135];
exports.modules = {

/***/ 3907:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
// @ts-check
/**
 * Check for user in local storage
 *
 * @description Preventdefault, declare variables
 */ const defaultFieldsRegexp = /^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (defaultFieldsRegexp);


/***/ }),

/***/ 7535:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "AddTableEntryContext": () => (/* binding */ AddTableEntryContext),
  "default": () => (/* binding */ AddTableEntry),
  "getServerSideProps": () => (/* binding */ getServerSideProps)
});

// EXTERNAL MODULE: external "react/jsx-runtime"
var jsx_runtime_ = __webpack_require__(997);
// EXTERNAL MODULE: external "react"
var external_react_ = __webpack_require__(6689);
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
// EXTERNAL MODULE: ./functions/backend/userAuth.js
var userAuth = __webpack_require__(370);
var userAuth_default = /*#__PURE__*/__webpack_require__.n(userAuth);
// EXTERNAL MODULE: ./layouts/AdminLayout.jsx + 2 modules
var AdminLayout = __webpack_require__(4858);
// EXTERNAL MODULE: ./components/general/BackButton.jsx
var BackButton = __webpack_require__(1781);
// EXTERNAL MODULE: ./components/general/Breadcrumbs.jsx
var Breadcrumbs = __webpack_require__(424);
// EXTERNAL MODULE: ./components/general/CopySlug.jsx
var CopySlug = __webpack_require__(9230);
// EXTERNAL MODULE: ./functions/frontend/defaultFieldsRegexp.js
var defaultFieldsRegexp = __webpack_require__(3907);
// EXTERNAL MODULE: ./components/general/LoadingBlock.jsx
var LoadingBlock = __webpack_require__(5264);
// EXTERNAL MODULE: ./components/admin/databases/TableEntryField.jsx + 11 modules
var TableEntryField = __webpack_require__(4559);
// EXTERNAL MODULE: ./functions/frontend/fetchApi.js
var fetchApi = __webpack_require__(6729);
// EXTERNAL MODULE: ./functions/frontend/updateDiskUsage.js
var updateDiskUsage = __webpack_require__(1069);
;// CONCATENATED MODULE: ./functions/frontend/newEntryHandler.js
// @ts-check
/**
 * ==============================================================================
 * Imports
 * ==============================================================================
 */ 

/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
 * ==============================================================================
 * Auth user on client side
 * ==============================================================================
 * @param {object} params
 * @param {React.FormEvent<HTMLFormElement>} params.e
 * @param {React.Dispatch<React.SetStateAction<boolean>>} params.setLoading
 * @param {import("@/package-shared/types").DSQL_FieldSchemaType[]} params.filteredFields
 * @param {React.MutableRefObject<import("@/package-shared/types").RichTextEditorsRefArray[]>} params.currentRichTextEditorForms
 * @param {React.MutableRefObject<import("@/package-shared/types").JSONTextEditorsRefArray[]>} params.jsonTextEditors
 * @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} params.database
 * @param {import("@/package-shared/types").DSQL_TableSchemaType} params.table
 * @param {any} params.query
 *
 * @requires search-field name attribute
 */ function newEntryHandler({ e , setLoading , filteredFields , currentRichTextEditorForms , jsonTextEditors , database , table , query ,  }) {
    e.preventDefault();
    setLoading(true);
    /** @type {HTMLFormElement} */ // @ts-ignore
    const formEl = e.target;
    /** @type {any} */ let payload = {};
    filteredFields.forEach((field)=>{
        if (!field?.fieldName) return;
        if (!formEl[field.fieldName]?.value) return;
        payload[field.fieldName] = formEl[field.fieldName].value;
    });
    if (currentRichTextEditorForms.current[0]) {
        currentRichTextEditorForms.current.forEach((richTextObject)=>{
            if (!richTextObject?.fieldName || !richTextObject?.ref?.current) return;
            payload[richTextObject.fieldName] = richTextObject.ref.current.getContent();
        });
    }
    if (jsonTextEditors.current[0]) {
        jsonTextEditors.current.forEach((jsonEditor)=>{
            if (!jsonEditor?.fieldName || !jsonEditor?.ref?.current) return;
            payload[jsonEditor.fieldName] = jsonEditor.ref.current.getValue();
        });
    }
    /** @type {import("@/pages/api/addTableEntry").AddTableEntryRequestBody} */ const fetchBody = {
        dbSlug: database.db_slug,
        dbId: database.id,
        tableName: table.tableName,
        payload: payload,
        tableSchema: table,
        delegated: query?.delegated
    };
    (0,fetchApi/* default */.Z)("/api/addTableEntry", {
        method: "post",
        body: fetchBody
    }, true).then((res)=>{
        if (res.success) {
            (0,updateDiskUsage/* default */.Z)().then(()=>{
                window.location.pathname = window.location.pathname.replace(/\/add-entry.*?/, "");
            });
        } else {
            window.alert(res.msg + "\n" + (res.err || ""));
            setTimeout(()=>{
                setLoading(false);
            }, 500);
        }
    });
} ////////////////////////////////////////
 ////////////////////////////////////////
 ////////////////////////////////////////

;// CONCATENATED MODULE: ./components/admin/databases/TableEntryForm.jsx
// @ts-check
/**
 * ==============================================================================
 * Imports
 * ==============================================================================
 */ 








/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
 * ==============================================================================
 * Main Component { Functional }
 * ==============================================================================
 * @param {Object} props - Server props
 */ function TableEntryForm({}) {
    /**
     * Get Contexts
     *
     * @abstract { React.useContext }
     */ const { user , database , table , dbSchemaData , richTextEditors , query , confirmedDelegetedUser , jsonTextEditors , duplicateEntry ,  } = external_react_default().useContext(AddTableEntryContext);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Javascript Variables
     *
     * @abstract Non hook variables and functions
     */ const filteredFields = table.fields.filter((field)=>!field.fieldName?.match(defaultFieldsRegexp/* default */.Z));
    const dataTypes = __webpack_require__(9594);
    const isDelegated = confirmedDelegetedUser?.delegated;
    const isTableEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Tables/i);
    const isTableDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Tables/i);
    const isTableCreatable = confirmedDelegetedUser?.priviledges?.match(/Create Tables/i);
    const areEntriesEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Entries/i);
    const areEntriesDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Entries/i);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * React Hooks
     *
     * @abstract { useState, useEffect, useRef, etc ... }
     */ const [loading, setLoading] = external_react_default().useState(false);
    /** @type {React.MutableRefObject<import("@/package-shared/types").RichTextEditorsRefArray[]>} */ const currentRichTextEditorForms = external_react_default().useRef([]);
    /** @type {[ state: any, dispatch: React.Dispatch<React.SetStateAction<any>> ]} */ const [existingEntry, setExistingEntry] = external_react_default().useState(duplicateEntry || null);
    external_react_default().useEffect(()=>{
        if (query.duplicate) {
            try {
                const localExistingEntry = localStorage.getItem("duplicate_entry");
                const existingEntry = JSON.parse(localExistingEntry || "{}");
                setExistingEntry(existingEntry);
            } catch (error) {}
        }
    }, []);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Function Return
     *
     * @abstract Main Function Return
     */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)("section", {
        className: "paper",
        children: [
            /*#__PURE__*/ jsx_runtime_.jsx("h2", {
                className: "text-xl m-0 mb-4",
                children: "Form Fields"
            }),
            query?.duplicate && duplicateEntry && /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
                className: "info gray",
                children: [
                    "This post is a duplicate of",
                    " ",
                    /*#__PURE__*/ jsx_runtime_.jsx("a", {
                        href: `/admin/${user?.id}/databases/${database.db_slug}/tables/${table.tableName}/entries/${duplicateEntry.id}`,
                        target: "_blank",
                        children: duplicateEntry.title || `Entry #${duplicateEntry.id}`
                    })
                ]
            }),
            /*#__PURE__*/ (0,jsx_runtime_.jsxs)("form", {
                className: "w-full flex flex-col items-stretch gap-8",
                onSubmit: (e)=>{
                    newEntryHandler({
                        e,
                        currentRichTextEditorForms,
                        database,
                        filteredFields,
                        jsonTextEditors,
                        query,
                        setLoading,
                        table
                    });
                },
                onKeyUp: (e)=>{
                    if (e.ctrlKey && e.key == "Enter") {
                        const confirm = window.confirm("Add this Entry?");
                        if (!confirm) return;
                        document.getElementById("add-entry-button")?.click();
                    }
                },
                children: [
                    loading && /*#__PURE__*/ jsx_runtime_.jsx(LoadingBlock/* default */.Z, {}),
                    filteredFields.map((field, index)=>{
                        let dataTypeSchema = dataTypes.filter((type)=>type.name === field.dataType?.replace(/\d|\(|\)/g, ""));
                        if (existingEntry && field.fieldName) {
                            field.defaultValue = existingEntry[field.fieldName];
                            field.defaultValueLiteral = existingEntry[field.fieldName];
                        }
                        if (field.defaultValueLiteral && !existingEntry) {
                            return /*#__PURE__*/ jsx_runtime_.jsx((external_react_default()).Fragment, {}, index + 1);
                        }
                        return /*#__PURE__*/ jsx_runtime_.jsx(TableEntryField/* default */.Z, {
                            fieldObject: field,
                            dataTypeSchema: dataTypeSchema[0],
                            richTextEditors: richTextEditors,
                            currentRichTextEditorForms: currentRichTextEditorForms,
                            query: query,
                            confirmedDelegetedUser: confirmedDelegetedUser,
                            jsonTextEditors: jsonTextEditors
                        }, index + 1);
                    }),
                    /*#__PURE__*/ jsx_runtime_.jsx("button", {
                        type: "submit",
                        className: "" + (loading ? " pointer-events-none opacity-40" : ""),
                        id: "add-entry-button",
                        children: "Add Entry"
                    })
                ]
            })
        ]
    });
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */ 

// EXTERNAL MODULE: ./components/general/ActiveCloneDbBanner.jsx
var ActiveCloneDbBanner = __webpack_require__(4986);
// EXTERNAL MODULE: ./components/general/ActiveCloneTableBanner.jsx
var ActiveCloneTableBanner = __webpack_require__(8515);
// EXTERNAL MODULE: ./components/admin/databases/DatabasesTablesList.jsx
var DatabasesTablesList = __webpack_require__(8264);
;// CONCATENATED MODULE: ./components/admin/databases/AddTableEntryContent.jsx
// @ts-check
/**
 * ==============================================================================
 * Imports
 * ==============================================================================
 */ 









/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
 * ==============================================================================
 * Main Component { Functional }
 * ==============================================================================
 * @param {Object} props - Server props
 */ function AddTableEntryContent(props) {
    /**
     * Get Contexts
     *
     * @abstract { React.useContext }
     */ const { user , database , table , dbSchemaData , query , confirmedDelegetedUser ,  } = external_react_default().useContext(AddTableEntryContext);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Javascript Variables
     *
     * @abstract Non hook variables and functions
     */ const isDelegated = confirmedDelegetedUser?.delegated;
    const isTableEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Tables/i);
    const isTableDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Tables/i);
    const isTableCreatable = confirmedDelegetedUser?.priviledges?.match(/Create Tables/i);
    const areEntriesEditable = confirmedDelegetedUser?.priviledges?.match(/Edit Entries/i);
    const areEntriesDeletable = confirmedDelegetedUser?.priviledges?.match(/Delete Entries/i);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * React Hooks
     *
     * @abstract { useState, useEffect, useRef, etc ... }
     */ ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Function Return
     *
     * @abstract Main Function Return
     */ return /*#__PURE__*/ (0,jsx_runtime_.jsxs)((external_react_default()).Fragment, {
        children: [
            /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                className: "flex-col items-start gap-0 w-full relative z-50",
                children: [
                    /*#__PURE__*/ jsx_runtime_.jsx("div", {
                        className: "w-full justify-between flex-wrap",
                        children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("div", {
                            className: "flex-wrap",
                            children: [
                                /*#__PURE__*/ jsx_runtime_.jsx(BackButton/* default */.Z, {}),
                                /*#__PURE__*/ jsx_runtime_.jsx("h1", {
                                    className: "text-3xl m-0",
                                    children: /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
                                        className: "flex gap-y-2 flex-wrap gap-x-2 items-center",
                                        children: [
                                            "Add New Entry To",
                                            " ",
                                            /*#__PURE__*/ (0,jsx_runtime_.jsxs)("span", {
                                                className: "bg-slate-100 dark:bg-slate-800 px-2 py-1 border border-solid border-slate-400 dark:border-slate-600 rounded relative",
                                                children: [
                                                    table.tableFullName,
                                                    /*#__PURE__*/ jsx_runtime_.jsx("div", {
                                                        className: "absolute -top-5 -right-4",
                                                        children: /*#__PURE__*/ jsx_runtime_.jsx(CopySlug/* default */.Z, {
                                                            slugText: table.tableName,
                                                            justIcon: true
                                                        })
                                                    })
                                                ]
                                            }),
                                            " ",
                                            "Table"
                                        ]
                                    })
                                })
                            ]
                        })
                    }),
                    /*#__PURE__*/ jsx_runtime_.jsx(Breadcrumbs/* default */.Z, {
                        confirmedDelegetedUser: query?.delegated,
                        user: user
                    })
                ]
            }),
            database.active_clone ? /*#__PURE__*/ jsx_runtime_.jsx(ActiveCloneDbBanner/* default */.Z, {
                database: database,
                user: user
            }) : /*#__PURE__*/ jsx_runtime_.jsx(jsx_runtime_.Fragment, {}),
            database.remote_connected ? /*#__PURE__*/ jsx_runtime_.jsx(DatabasesTablesList/* ConnectedDatabaseBanner */.w, {
                database: database
            }) : /*#__PURE__*/ jsx_runtime_.jsx(jsx_runtime_.Fragment, {}),
            /*#__PURE__*/ jsx_runtime_.jsx(ActiveCloneTableBanner/* default */.Z, {
                table: table,
                database: database,
                user: user
            }),
            /*#__PURE__*/ jsx_runtime_.jsx(TableEntryForm, {})
        ]
    });
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
} /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */  /** ****************************************************************************** */ 

// EXTERNAL MODULE: ./components/general/ExtraContentDatabase.jsx
var ExtraContentDatabase = __webpack_require__(4941);
// EXTERNAL MODULE: ./functions/backend/grabDelegatedUserFromCookie.js
var grabDelegatedUserFromCookie = __webpack_require__(5116);
var grabDelegatedUserFromCookie_default = /*#__PURE__*/__webpack_require__.n(grabDelegatedUserFromCookie);
// EXTERNAL MODULE: ./functions/backend/serverError.js
var serverError = __webpack_require__(2317);
var serverError_default = /*#__PURE__*/__webpack_require__.n(serverError);
// EXTERNAL MODULE: ./package-shared/utils/backend/global-db/DB_HANDLER.js
var DB_HANDLER = __webpack_require__(9395);
var DB_HANDLER_default = /*#__PURE__*/__webpack_require__.n(DB_HANDLER);
// EXTERNAL MODULE: ./package-shared/functions/backend/varDatabaseDbHandler.js
var varDatabaseDbHandler = __webpack_require__(1206);
var varDatabaseDbHandler_default = /*#__PURE__*/__webpack_require__.n(varDatabaseDbHandler);
;// CONCATENATED MODULE: ./pages/admin/[user_id]/databases/[single]/tables/[single_table]/entries/add-entry.jsx
// @ts-check
/**
 * ==============================================================================
 * Imports
 * ==============================================================================
 */ 

const fs = __webpack_require__(7147);
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////

////////////////////////////////////////







/** ****************************************************************************** */ /** @type {import("@/package-shared/types").AddEntryContextType} */ // @ts-ignore
const init = {};
const AddTableEntryContext = /*#__PURE__*/ external_react_default().createContext(init);
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
 * ==============================================================================
 * Main Component { Functional }
 * ==============================================================================
 * @param {Object} props - Server props
 * @param {import("@/package-shared/types").UserType} props.user
 * @param {import("@/package-shared/types").DSQL_MYSQL_user_databases_Type} props.database
 * @param {import("@/package-shared/types").DSQL_TableSchemaType} props.table
 * @param {import("@/package-shared/types").DSQL_DatabaseSchemaType[]} props.dbSchemaData
 * @param {any} props.query
 * @param {any} props.duplicateEntry
 * @param {any} props.confirmedDelegetedUser
 */ function AddTableEntry({ user , database , table , dbSchemaData , query , confirmedDelegetedUser , duplicateEntry ,  }) {
    /**
     * Get Contexts
     *
     * @abstract { React.useContext }
     */ ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Javascript Variables
     *
     * @abstract Non hook variables and functions
     */ const pageTitle = `${table.tableFullName} Table New Entry | Datasquirel`;
    const pageDescription = "Single Table";
    let head = /*#__PURE__*/ (0,jsx_runtime_.jsxs)(jsx_runtime_.Fragment, {
        children: [
            /*#__PURE__*/ jsx_runtime_.jsx("title", {
                children: pageTitle
            }),
            /*#__PURE__*/ jsx_runtime_.jsx("meta", {
                name: "description",
                content: pageDescription
            })
        ]
    });
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * React Hooks
     *
     * @abstract { useState, useEffect, useRef, etc ... }
     */ const richTextEditors = external_react_default().useRef([]);
    const jsonTextEditors = external_react_default().useRef([]);
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    /**
     * Function Return
     *
     * @abstract Main Function Return
     */ return /*#__PURE__*/ jsx_runtime_.jsx(AdminLayout/* default */.Z, {
        head: head,
        user: user,
        extraHeaderContent: /*#__PURE__*/ jsx_runtime_.jsx(ExtraContentDatabase/* default */.Z, {
            database: database,
            query: query,
            confirmedDelegetedUser: confirmedDelegetedUser,
            user: user
        }),
        children: /*#__PURE__*/ jsx_runtime_.jsx(AddTableEntryContext.Provider, {
            value: {
                user,
                database,
                table,
                dbSchemaData,
                richTextEditors,
                jsonTextEditors,
                query,
                confirmedDelegetedUser,
                duplicateEntry
            },
            children: /*#__PURE__*/ jsx_runtime_.jsx(AddTableEntryContent, {})
        })
    });
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
}
/** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /** ****************************************************************************** */ /**
 * ==============================================================================
 * Server Side Props or Static Props
 * ==============================================================================
 * @type {import("next").GetServerSideProps}
 */ async function getServerSideProps({ req , res , query  }) {
    /**
     * User Auth
     *
     * @description User Auth
     */ const user = await userAuth_default()(req, res);
    if (!user?.logged_in_status) {
        return {
            redirect: {
                destination: "/login",
                permanent: false
            }
        };
    }
    try {
        /**
         * Check delegated user token
         *
         * @description Check delegated user token
         */ /** @type {string} */ // @ts-ignore
        const slug = query.single;
        const dbUserData = await grabDelegatedUserFromCookie_default()({
            request: req,
            user: user,
            databaseSlug: slug,
            query
        });
        const dbUserDataObj = dbUserData;
        if (!dbUserDataObj) {
            throw new Error("No Db Object Found!");
        }
        const { dbUserId  } = dbUserDataObj;
        /**
         * Page/Site Data Data Fetching
         *
         * @description Fetch data on the server before returning
         */ const database = await DB_HANDLER_default()(`SELECT * FROM user_databases WHERE user_id='${dbUserId}' AND db_slug='${query.single}'`);
        if (!database || !database[0]) {
            return {
                redirect: {
                    destination: `/admin/${user?.id}/databases`,
                    permanent: false
                }
            };
        }
        ////////////////////////////////////////
        ////////////////////////////////////////
        ////////////////////////////////////////
        /**
         * Confirm delegated User
         *
         * @description Confirm delegated User
         */ let confirmedDelegetedUser = dbUserData;
        ////////////////////////////////////////
        ////////////////////////////////////////
        ////////////////////////////////////////
        /**
         * Page/Site Data Data Fetching
         *
         * @description Fetch data on the server before returning
         */ /** @type {import("@/package-shared/types").DSQL_DatabaseSchemaType[]} */ const dbSchemaData = JSON.parse(fs.readFileSync(`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${dbUserId}/main.json`, "utf-8"));
        const tables = dbSchemaData.filter((db)=>db.dbFullName === database[0].db_full_name)[0]?.tables;
        const targetTable = tables.filter((table)=>table.tableName === query.single_table)[0];
        ////////////////////////////////////////
        ////////////////////////////////////////
        ////////////////////////////////////////
        let duplicateEntry;
        if (query.duplicate && query.id) {
            const dbName = database[0].db_full_name;
            const tableName = targetTable.tableName;
            const targetDuplicateEntry = await varDatabaseDbHandler_default()({
                database: dbName,
                queryString: `SELECT * FROM ${tableName} WHERE id='${query.id}'`,
                tableSchema: targetTable
            });
            duplicateEntry = targetDuplicateEntry?.[0];
        }
        ////////////////////////////////////////
        ////////////////////////////////////////
        ////////////////////////////////////////
        /**
         * Server props return
         *
         * @description Return data fetched on the server side
         */ return {
            props: {
                user: user,
                database: database[0],
                table: targetTable,
                dbSchemaData: dbSchemaData,
                query,
                confirmedDelegetedUser,
                duplicateEntry: duplicateEntry || null
            }
        };
    ////////////////////////////////////////
    ////////////////////////////////////////
    ////////////////////////////////////////
    } catch (/** @type {any} */ error) {
        serverError_default()({
            component: "add-entry-page-component/getServerSideProps/catch-error",
            message: error.message,
            user: user
        });
        return {
            props: {
                user: user,
                database: null,
                table: null
            }
        };
    }
}


/***/ }),

/***/ 2587:
/***/ ((module) => {

module.exports = require("@monaco-editor/react");

/***/ }),

/***/ 4003:
/***/ ((module) => {

module.exports = require("@mui/icons-material/AdminPanelSettingsTwoTone");

/***/ }),

/***/ 3257:
/***/ ((module) => {

module.exports = require("@mui/icons-material/ArrowBackIosRounded");

/***/ }),

/***/ 1522:
/***/ ((module) => {

module.exports = require("@mui/icons-material/BackupTableTwoTone");

/***/ }),

/***/ 69:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CloudOffTwoTone");

/***/ }),

/***/ 4008:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CloudQueueRounded");

/***/ }),

/***/ 3849:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CodeRounded");

/***/ }),

/***/ 7306:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CollectionsTwoTone");

/***/ }),

/***/ 5050:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CopyAllTwoTone");

/***/ }),

/***/ 386:
/***/ ((module) => {

module.exports = require("@mui/icons-material/CottageTwoTone");

/***/ }),

/***/ 7039:
/***/ ((module) => {

module.exports = require("@mui/icons-material/DeleteForeverTwoTone");

/***/ }),

/***/ 930:
/***/ ((module) => {

module.exports = require("@mui/icons-material/DifferenceTwoTone");

/***/ }),

/***/ 8193:
/***/ ((module) => {

module.exports = require("@mui/icons-material/DriveFileRenameOutlineTwoTone");

/***/ }),

/***/ 8979:
/***/ ((module) => {

module.exports = require("@mui/icons-material/DynamicFormTwoTone");

/***/ }),

/***/ 300:
/***/ ((module) => {

module.exports = require("@mui/icons-material/LanguageOutlined");

/***/ }),

/***/ 399:
/***/ ((module) => {

module.exports = require("@mui/icons-material/LockOutlined");

/***/ }),

/***/ 2814:
/***/ ((module) => {

module.exports = require("@mui/icons-material/LockTwoTone");

/***/ }),

/***/ 5557:
/***/ ((module) => {

module.exports = require("@mui/icons-material/MenuBookTwoTone");

/***/ }),

/***/ 9806:
/***/ ((module) => {

module.exports = require("@mui/icons-material/PeopleOutlineTwoTone");

/***/ }),

/***/ 36:
/***/ ((module) => {

module.exports = require("@mui/icons-material/RefreshRounded");

/***/ }),

/***/ 1799:
/***/ ((module) => {

module.exports = require("@mui/icons-material/SchemaTwoTone");

/***/ }),

/***/ 6500:
/***/ ((module) => {

module.exports = require("@mui/icons-material/SendToMobileTwoTone");

/***/ }),

/***/ 4063:
/***/ ((module) => {

module.exports = require("@mui/icons-material/StorageTwoTone");

/***/ }),

/***/ 7428:
/***/ ((module) => {

module.exports = require("@mui/icons-material/SummarizeTwoTone");

/***/ }),

/***/ 3851:
/***/ ((module) => {

module.exports = require("@mui/icons-material/TableViewTwoTone");

/***/ }),

/***/ 507:
/***/ ((module) => {

module.exports = require("@mui/icons-material/TipsAndUpdatesTwoTone");

/***/ }),

/***/ 6451:
/***/ ((module) => {

module.exports = require("@tinymce/tinymce-react");

/***/ }),

/***/ 2329:
/***/ ((module) => {

module.exports = require("html-prettify");

/***/ }),

/***/ 2423:
/***/ ((module) => {

module.exports = require("lucide-react");

/***/ }),

/***/ 968:
/***/ ((module) => {

module.exports = require("next/head");

/***/ }),

/***/ 6689:
/***/ ((module) => {

module.exports = require("react");

/***/ }),

/***/ 7849:
/***/ ((module) => {

module.exports = require("react-dom/client");

/***/ }),

/***/ 997:
/***/ ((module) => {

module.exports = require("react/jsx-runtime");

/***/ }),

/***/ 2261:
/***/ ((module) => {

module.exports = require("serverless-mysql");

/***/ }),

/***/ 4300:
/***/ ((module) => {

module.exports = require("buffer");

/***/ }),

/***/ 6113:
/***/ ((module) => {

module.exports = require("crypto");

/***/ }),

/***/ 7147:
/***/ ((module) => {

module.exports = require("fs");

/***/ }),

/***/ 3685:
/***/ ((module) => {

module.exports = require("http");

/***/ }),

/***/ 1017:
/***/ ((module) => {

module.exports = require("path");

/***/ })

};
;

// load runtime
var __webpack_require__ = require("../../../../../../../../webpack-runtime.js");
__webpack_require__.C(exports);
var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
var __webpack_exports__ = __webpack_require__.X(0, [4017,8313,5264,6729,5449,913,4480,370,424,4858,5472,1781,4941,7023,8682,2317,1206,5116,8345,4986,9594,8264,8515,4559], () => (__webpack_exec__(7535)));
module.exports = __webpack_exports__;

})();