"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4893],{34893:function(e,l,t){t.d(l,{Z:function(){return R}});var a=t(828),i=t(85893),d=t(67294),n=t(10990);function s(e){var l=e.tableFields,t=e.setTableFields,a=(e.setRefresh,e.setPageRefresh,e.refreshFieldsListRef),i=l,d=i.findIndex((function(e){return"date_created"===e.fieldName}));i.splice(d,0,{newTempField:!0}),t(i),(null===a||void 0===a?void 0:a.current)&&a.current((function(e){return e+1}))}var r=t(36169),o=t(95264),c=t(33907),u=t(29815),f=t(96486),v=t.n(f);function p(e){var l=e.tableFields,t=e.setTableFields,a=e.refreshFieldsListRef,i=e.order,d=e.field,n=e.e,s=v().cloneDeep(l),r=s.findIndex((function(e){return e.fieldName===d.fieldName}));if(!(r<0)){var o=s[r];if("up"===i&&r&&r<=1)console.log("Min Reached =>",r);else if("down"===i&&r&&r>=s.length-7)console.log("Max Reached =>",r);else{try{var c,f,p=n.target.closest(".table-field-wrapper"),m=p.previousElementSibling,x=p.nextElementSibling,h=window.DSQL.Flip,b=h.getState(p);if("up"===i)c=h.getState(m),null===(f=p.parentNode)||void 0===f||f.insertBefore(p,m);else if(null===x||void 0===x?void 0:x.nextElementSibling){var g;c=h.getState(x),null===(g=p.parentNode)||void 0===g||g.insertBefore(p,x.nextElementSibling)}h.from(b,{duration:.3,ease:"power1.inOut"}),h.from(c,{duration:.3,ease:"power1.inOut"})}catch(y){console.log("Error =>",y.message)}r?(s.splice(r,1),"up"===i?s.splice(r-1,0,o):s.splice(r+1,0,o),setTimeout((function(){t((0,u.Z)(s)),a.current&&a.current((function(e){return e+1}))}),500)):console.log("No target Field Index =>",r)}}}var m=t(99967),x=t(3699),h=t(86729);function b(e){var l,t,n,s,r,o,u,f,v,p,m,b=e.field,g=(e.setTargetField,e.fieldIndex,e.tableFields),y=e.setTableFields,w=(e.refreshFieldsListRef,e.database),j=e.currentTable,N=e.user,T=e.isDelegated,F=e.setLoading,_=(0,a.Z)(d.useState(b),2),D=_[0],C=_[1],Z=(0,a.Z)(d.useState(!1),2),k=Z[0],S=Z[1];return(0,i.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(k?" shadow-2xl shadow-slate-700/40 relative z-50":""),children:[(0,i.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(k?" rounded-t":" rounded")+((null===(l=D.fieldName)||void 0===l?void 0:l.match(c.Z))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,i.jsx)("span",{className:"font-bold"+((null===(t=D.fieldName)||void 0===t?void 0:t.match(c.Z))?" dark:text-slate-500":" dark:text-white"),children:D.fieldName}),(0,i.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:D.dataType}),(null===D||void 0===D?void 0:D.foreignKey)&&(0,i.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,i.jsx)("span",{children:"Foreign Key: "}),(0,i.jsxs)("span",{children:[D.foreignKey.destinationTableName," ("," ",(0,i.jsx)("b",{children:D.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(n=D.fieldName)||void 0===n?void 0:n.match(c.Z))&&(0,i.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),T||(null===(s=D.fieldName)||void 0===s?void 0:s.match(c.Z))||!(null===(r=D.dataType)||void 0===r?void 0:r.match(/INT/))||D.foreignKey||(null===(u=null===w||void 0===w||null===(o=w.active_clone)||void 0===o?void 0:o.toString())||void 0===u?void 0:u.match(/1/))?T||(null===(f=D.fieldName)||void 0===f?void 0:f.match(c.Z))||!(null===(v=D.dataType)||void 0===v?void 0:v.match(/INT/))||(null===(m=null===w||void 0===w||null===(p=w.active_clone)||void 0===p?void 0:p.toString())||void 0===m?void 0:m.match(/1/))?(0,i.jsx)(d.Fragment,{}):(0,i.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,i.jsx)("div",{className:"button py-1 text-xs light-gray",onClick:function(e){var l,t;window.confirm("Delete this foreign Key?")&&(delete b.foreignKey,F(!0),(0,h.Z)("/api/updateClonedTableForeignKeys",{method:"post",body:{tableData:j,database:w.db_full_name,dbSlug:w.db_slug,delegated:!!(null===(l=window.location)||void 0===l||null===(t=l.search)||void 0===t?void 0:t.match(/delegated=true/i))}},!0).then((function(e){e.success?window.location.reload():window.alert("Update Failed, Please Try again.")})))},style:{color:"var(--slate-500)"},children:"Delete Foreign Key"})}):(0,i.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,i.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:function(e){S(!k)},style:{color:"var(--slate-500)"},children:"Add Foreign Key"})})]}),k&&!T&&(0,i.jsx)("div",{className:"card col w-full -mt-5 pt-0 no-hover",children:(0,i.jsx)(x.Z,{targetField:b,setFieldData:C,tableFields:g,setTableFields:y,database:w,currentTable:j,user:N,setActiveEdit:S,activeClonedTable:!0})})]})}var g=t(26042),y=t(69396);var w=t(47568),j=t(97582),N=t(24209),T=t(64838);function F(e){var l=e.fieldIndex,a=e.setTableFields,n=e.database,s=e.user,r=e.isNewField,o=e.setLiteralValue,c=e.tempFieldData,u=e.setTempFieldData,f=e.dataTypeValue,v=e.setDataTypeValue,p=e.dataType,m=e.setDataType,x=e.dataTypeDesc,h=e.setDataTypeDesc,b=t(89594),g=d.useRef();d.useEffect((function(){var e;g.current&&(g.current.scrollIntoView({block:"center",behavior:"smooth"}),null===(e=g.current.querySelector("input"))||void 0===e||e.focus())}),[]);var y=Boolean(p.match(/uuid/i));return(0,i.jsxs)(d.Fragment,{children:[r&&(0,i.jsx)("span",{className:"absolute -top-4 text-sm bg-fuchsia-600 dark:bg-white text-white dark:text-fuchsia-800 px-3 py-1 rounded-full",children:"New Field"}),(0,i.jsxs)("div",{className:"gap-4 flex-wrap xl:flex-nowrap flex-col xl:flex-row items-stretch w-full xl:w-auto",children:[(0,i.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,i.jsx)("label",{htmlFor:"new_field_name",children:"Field Name"}),(0,i.jsx)("input",{type:"text",name:"new_field_name",id:"new_field_name",placeholder:"Eg. post_title",onInput:function(){var e=(0,w.Z)((function(e){var l,t;return(0,j.__generator)(this,(function(a){return l=e.target,t=l.value.toLowerCase().replace(/ /g,"_"),l.value=t,[2]}))}));return function(l){return e.apply(this,arguments)}}(),required:!0})]}),(0,i.jsxs)("div",{className:"flex flex-col items-start gap-4 xl:gap-0.5",children:[(0,i.jsxs)("div",{className:"items-start flex-wrap xl:flex-nowrap",children:[(0,i.jsx)("label",{htmlFor:"new_field_data_type",children:"Data Type"}),(0,i.jsxs)("div",{className:"dropdown-wrapper reversed text-sm w-full items-start gap-2",children:[(0,i.jsx)("span",{className:"px-2 bg-slate-200 dark:bg-slate-700 rounded-full hover:bg-slate-100 dark:hover:bg-slate-600 hidden xl:flex",children:"Info"}),(0,i.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,i.jsx)("span",{children:x})})]})]}),(0,i.jsxs)("div",{className:"w-full xl:w-auto",children:[(0,i.jsx)("select",{name:"new_field_data_type",id:"new_field_data_type",className:"w-full xl:w-auto",onChange:function(e){var l=e.target;m(l.value),l.childNodes.forEach((function(e){e.value===l.value&&h(e.dataset.desc),e.value===l.value&&e.dataset.literal&&o(e.dataset.literal)}))},children:b.map((function(e,l){return e.name.match(/VARCHAR/)?(0,i.jsx)("option",{value:e.name,"data-desc":e.description,children:e.title+"("+(f||200)+")"},l+1):(0,i.jsx)("option",{value:e.name,"data-desc":e.description,"data-literal":e.valueLiteral||void 0,children:e.title},l+1)}))}),p.match(/VARCHAR/)&&(0,i.jsx)("input",{type:"number",defaultValue:f,className:"px-2",style:{maxWidth:"60px"},max:255,min:5,onChange:function(e){v(e.target.value)}})]})]}),(null===p||void 0===p?void 0:p.match(/text/i))&&(0,i.jsx)(d.Fragment,{children:(0,i.jsx)(T.Z,{targetField:c})}),!y&&(0,i.jsxs)("div",{className:"flex flex-col items-start gap-0.5",style:{minWidth:"70px"},children:[(0,i.jsx)("label",{htmlFor:"new_field_required",children:"Required?"}),(0,i.jsxs)("select",{name:"new_field_required",id:"new_field_required",className:"px-2",children:[(0,i.jsx)("option",{value:"No",children:"No"}),(0,i.jsx)("option",{value:"Yes",children:"Yes"})]})]}),!y&&(0,i.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,i.jsx)("label",{htmlFor:"new_field_default_value",children:"Default Value (optional)"}),(0,i.jsx)("input",{type:"text",name:"new_field_default_value",id:"new_field_default_value",placeholder:"Default Value"})]}),!y&&(0,i.jsx)(N.Z,{database:n,setFieldData:u,targetField:c,user:s,fieldIndex:l})]}),(0,i.jsxs)("div",{className:"secondary mt-auto flex-wrap xl:flex-nowrap w-full xl:w-auto",children:[(0,i.jsx)("button",{type:"submit",className:"secondary mt-auto py-3 w-full sm:w-auto justify-center grow",children:"Add Field"}),(0,i.jsx)("div",{className:"button outlined-gray mt-auto py-2.5 w-full sm:w-auto justify-center grow",onClick:function(e){a((function(e){return e.filter((function(e,t){return t!=l}))}))},children:"Cancel"})]})]})}function _(e){var l=e.fieldIndex,n=e.tableFields,s=e.setTableFields,r=e.refreshFieldsListRef,o=e.database,c=e.currentTable,u=e.user,f=(t(89594),(0,a.Z)(d.useState("VARCHAR"),2)),v=f[0],p=f[1],m=(0,a.Z)(d.useState("200"),2),x=m[0],h=m[1],b=(0,a.Z)(d.useState("Varchar is simply letters and numbers within the range 0 - 255"),2),w=b[0],j=b[1],N=d.useState({}),T=(0,a.Z)(N,2),_=T[0],D=T[1],C=d.useRef(),Z=(0,a.Z)(d.useState(""),2),k=Z[0],S=Z[1];d.useEffect((function(){var e;C.current&&(C.current.scrollIntoView({block:"center",behavior:"smooth"}),null===(e=C.current.querySelector("input"))||void 0===e||e.focus())}),[]);var R=Boolean(v.match(/uuid/i));return(0,i.jsx)("div",{className:"w-full mt-1 flex-wrap relative z-0 hover:z-20",ref:C,children:(0,i.jsx)("form",{className:"flex flex-row items-start gap-4 w-full justify-between border border-solid p-4 pt-6 border-slate-400 rounded focus:shadow-lg shadow-slate-400/40 dark:shadow-black/30 relative flex-wrap xl:flex-nowrap shadow-xl",onSubmit:function(e){var t,a,i,d,n,o;e.preventDefault();var c=_.foreignKey;c&&!c.destinationTableName&&delete _.foreignKey;var u=e.target,f=u.new_field_name.value,v=u.new_field_data_type.value,p=null===(t=u.new_field_required)||void 0===t?void 0:t.value,m=null===(a=u.new_field_default_value)||void 0===a?void 0:a.value,h=null===(i=u.encryption_field)||void 0===i?void 0:i.value,b=null===(d=u.rich_text_option)||void 0===d?void 0:d.value,w=u.foreign_key_field,j=u.foreign_key_destination_table_name,N=u.foreign_key_destination_table_column_name,T=(null===w||void 0===w||w.value,(0,y.Z)((0,g.Z)({},_),{fieldName:f,dataType:(null===_||void 0===_?void 0:_.dataType)&&(null===_||void 0===_?void 0:_.foreignKey)?_.dataType:(null===v||void 0===v?void 0:v.match(/VARCHAR/))?"".concat(v,"(").concat(x,")"):v}));(null===p||void 0===p?void 0:p.match(/yes/i))?T.notNullValue=!0:(null===m||void 0===m?void 0:m.match(/./))||(T.nullValue=!0),(null===m||void 0===m?void 0:m.match(/./))&&(T.defaultValue=m),(null===h||void 0===h?void 0:h.match(/yes/i))&&(T.encrypted=!0),(null===N||void 0===N||null===(n=N.value)||void 0===n?void 0:n.match(/./i))&&!(null===N||void 0===N||null===(o=N.value)||void 0===o?void 0:o.match(/^--$/i))&&(T.dataType=N.dataset.dataType,T.foreignKey={foreignKeyName:N.dataset.foreignKeyName,destinationTableName:j.dataset.destinationTableName,destinationTableColumnName:N.dataset.destinationTableColumnName,cascadeDelete:!0}),(null===b||void 0===b?void 0:b.match(/yes/i))&&(T.richText=!0),R?(T.defaultValueLiteral=k,T.nullValue=!1):delete T.defaultValueLiteral,console.log("newFieldObject",T),function(e){var l=e.fieldIndex,t=e.setTableFields,a=e.refreshFieldsListRef,i=e.payload;t((function(e){var t=e;return t.splice(l,1,i),t})),(null===a||void 0===a?void 0:a.current)&&a.current((function(e){return e+1}))}({fieldIndex:l,setTableFields:s,refreshFieldsListRef:r,payload:T})},children:(0,i.jsx)(F,{database:o,fieldIndex:l,isNewField:!0,literalValue:k,refreshFieldsListRef:r,setLiteralValue:S,setTableFields:s,user:u,currentTable:c,tableFields:n,tempFieldData:_,setTempFieldData:D,dataTypeValue:x,setDataTypeValue:h,dataType:v,setDataType:p,dataTypeDesc:w,setDataTypeDesc:j})})})}var D=t(45449),C=t(8971);function Z(e){var l,t,n,s,r,o,u,f=e.field,v=(e.setTargetField,e.fieldIndex),x=e.tableFields,h=e.setTableFields,b=e.refreshFieldsListRef,g=e.database,y=e.currentTable,w=e.confirmedDelegetedUser,j=e.user,N=null===w||void 0===w?void 0:w.delegated,T=null===w||void 0===w||null===(l=w.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i),F=(null===w||void 0===w||null===(t=w.priviledges)||void 0===t||t.match(/Delete Tables/i),null===w||void 0===w||null===(n=w.priviledges)||void 0===n||n.match(/Create Tables/i),g.active_clone,g.active_clone_parent_db),_=g.remote_connected,Z=(0,a.Z)(d.useState(f),2),k=Z[0],S=(Z[1],(0,a.Z)(d.useState(!1),2)),R=S[0],L=S[1];return(0,i.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(R?" shadow-2xl shadow-slate-300/40 dark:shadow-black/30 relative z-50":""),children:[(0,i.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(R?" rounded-t":" rounded")+((null===(s=k.fieldName)||void 0===s?void 0:s.match(c.Z))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,i.jsx)("span",{className:"font-bold"+((null===(r=k.fieldName)||void 0===r?void 0:r.match(c.Z))?" dark:text-slate-500":" dark:text-white"),children:k.fieldName}),(0,i.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:k.dataType}),(null===k||void 0===k?void 0:k.foreignKey)&&(0,i.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,i.jsx)("span",{children:"Foreign Key: "}),(0,i.jsxs)("span",{children:[k.foreignKey.destinationTableName," ("," ",(0,i.jsx)("b",{children:k.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(o=k.fieldName)||void 0===o?void 0:o.match(c.Z))&&(0,i.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),!(null===(u=k.fieldName)||void 0===u?void 0:u.match(c.Z))&&!F&&!_&&(0,i.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(!N||N&&T)&&(0,i.jsxs)(d.Fragment,{children:[(0,i.jsxs)(D.Z,{children:[(0,i.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:function(e){L(!R)},style:{color:"var(--slate-500)"},children:"Edit"}),!F&&!_&&(0,i.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:function(e){window.confirm('Delete "'.concat(f.fieldName,'"?'))&&h((function(e){return e.filter((function(e,l){return l!=v}))}))},style:{color:"var(--slate-500)"},children:"Delete"})]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full rotate-180",onClick:function(e){p({tableFields:x,setTableFields:h,refreshFieldsListRef:b,order:"up",field:f,e:e})},children:(0,i.jsx)(C.Z,{size:20})}),(0,i.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full",onClick:function(e){p({tableFields:x,setTableFields:h,refreshFieldsListRef:b,order:"down",field:f,e:e})},children:(0,i.jsx)(C.Z,{size:20})})]})]})})]}),R&&(0,i.jsx)("div",{className:"w-full",children:(0,i.jsx)(m.Z,{fieldIndex:v,tableFields:x,setTableFields:h,refreshFieldsListRef:b,targetField:f,setActiveEdit:L,database:g,currentTable:y,user:j})})]})}var k=t(95753),S=1;function R(e){var l,c,u,f,v=e.user,p=e.tableFields,m=e.setTableFields,x=e.setTargetField,h=e.refreshFieldsListRef,g=e.updateTable,y=e.updateTableAfterFieldsUpdateFunction,w=e.collapsed,j=e.database,N=e.table,T=e.confirmedDelegetedUser,F=e.query,D=((null===N||void 0===N?void 0:N.childTable)&&(null===(l=N.childTableDbFullName)||void 0===l||l.replace(new RegExp(/datasquirel_user_\d+_/),"")),null===T||void 0===T?void 0:T.delegated),C=null===T||void 0===T||null===(c=T.priviledges)||void 0===c?void 0:c.match(/Edit Tables/i),R=(null===T||void 0===T||null===(u=T.priviledges)||void 0===u||u.match(/Delete Tables/i),null===T||void 0===T||null===(f=T.priviledges)||void 0===f||f.match(/Create Tables/i),j.active_clone,j.active_clone_parent_db),L=j.remote_connected,V=(0,a.Z)(d.useState(0),2),I=(V[0],V[1]);h.current=I;var E=(0,a.Z)(d.useState(!1),2),K=E[0],A=E[1],q=(0,a.Z)(d.useState(w||!1),2),$=q[0],U=q[1];return d.useEffect((function(){var e=t(23226).B;n.ZP.registerPlugin(e);var l=window.DSQL;l&&(l.Flip=e)}),[]),D&&!C?(0,i.jsx)(i.Fragment,{}):(0,i.jsxs)("section",{className:"paper green",children:[K&&(0,i.jsx)(o.Z,{}),(null===N||void 0===N?void 0:N.childTable)?(0,i.jsxs)(d.Fragment,{children:[(0,i.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,i.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:"button outlined light-gray",onClick:function(e){var l=(0,k.Z)({paradigm:"JavaScript",table:N,query:F,user:v});l&&navigator.clipboard.writeText(l).then((function(){window.alert("JavaScript Type Definition Copied")}))},children:(0,i.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,i.jsx)("div",{className:"button outlined light-gray",onClick:function(e){var l=(0,k.Z)({paradigm:"TypeScript",table:N,query:F,user:v});l&&navigator.clipboard.writeText(l).then((function(){window.alert("TypeScript Type Definition Copied")}))},children:(0,i.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,i.jsx)("div",{className:"flex-col w-full",style:$?{maxHeight:"200px"}:{},children:p&&p[0]&&p.map((function(e,l){return S++,(0,i.jsx)(b,{field:e,fieldIndex:l,setTargetField:x,setTableFields:m,refreshFieldsListRef:h,tableFields:p,database:j,setLoading:A,currentTable:N,user:v,isDelegated:D},S)}))}),w&&(0,i.jsx)(r.Z,{collapse:$||!1,setCollapse:U})]}):(0,i.jsxs)(d.Fragment,{children:[(0,i.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,i.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,i.jsxs)("div",{children:[(!D||D&&C)&&!R&&!L&&(0,i.jsxs)("div",{className:"button secondary outlined",onClick:function(e){$&&U(!1),s({setTableFields:m,tableFields:p,setRefresh:I,refreshFieldsListRef:h})},children:[(0,i.jsx)("span",{className:"symbol",children:"+"}),(0,i.jsx)("span",{children:"Add New Field"})]}),(0,i.jsx)("div",{className:"button outlined light-gray",onClick:function(e){if(N){var l=(0,k.Z)({paradigm:"JavaScript",table:N,query:F,user:v});l&&navigator.clipboard.writeText(l).then((function(){window.alert("JavaScript Type Definition Copied")}))}},children:(0,i.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,i.jsx)("div",{className:"button outlined light-gray",onClick:function(e){if(N){var l=(0,k.Z)({paradigm:"TypeScript",table:N,query:F,user:v});l&&navigator.clipboard.writeText(l).then((function(){window.alert("TypeScript Type Definition Copied")}))}},children:(0,i.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,i.jsxs)("div",{className:"flex-col w-full",style:$?{maxHeight:"200px"}:{},children:[p&&p[0]&&p.map((function(e,l){return S++,e.newTempField?(0,i.jsx)(_,{fieldIndex:l,tableFields:p,setTableFields:m,refreshFieldsListRef:h,database:j,currentTable:N,user:v},S):(0,i.jsx)(Z,{field:e,fieldIndex:l,setTargetField:x,setTableFields:m,refreshFieldsListRef:h,tableFields:p,database:j,currentTable:N,confirmedDelegetedUser:T,user:v},S)})),(!D||D&&C)&&!R&&!L&&(0,i.jsxs)(d.Fragment,{children:[(0,i.jsxs)("div",{className:"button outlined gray w-full more-padding",style:{borderStyle:"dashed"},onClick:function(e){$&&U(!1),s({setTableFields:m,tableFields:p,setRefresh:I,refreshFieldsListRef:h})},children:[(0,i.jsx)("span",{className:"symbol",children:"+"}),(0,i.jsx)("span",{children:"Add New Field"})]}),g&&(0,i.jsx)("button",{className:"secondary w-full py-3",onClick:function(e){A(!0),y&&y(A)},children:"Update Table Fields"})]})]}),w&&(0,i.jsx)(r.Z,{collapse:$,setCollapse:U})]})]})}},95753:function(e,l,t){t.d(l,{Z:function(){return i}});var a=t(33907);function i(e){var l=e.paradigm,t=e.table,i=e.query,d=(e.user,"");try{var n=function(e){return(null===e||void 0===e?void 0:e.match(/int/i))?"number":(null===e||void 0===e||e.match(/text|varchar|timestamp/i),"string")},s="DSQL_".concat(i.single,"_").concat(i.single_table).toUpperCase(),r=t.fields,o=[],c=[];o.push("type ".concat(s," = {")),c.push("/**\n * @typedef {object} ".concat(s)),r.forEach((function(e){var l,t=e.nullValue||(null===(l=e.fieldName)||void 0===l?void 0:l.match(a.Z))?"?":"";o.push(" ".concat(e.fieldName).concat(t,": ").concat(n(e.dataType||""),";")),c.push(" * @property {".concat(n(e.dataType||"")).concat(t,"} ").concat(e.fieldName))})),o.push("}"),c.push(" */"),(null===l||void 0===l?void 0:l.match(/javascript/i))&&(d=c.join("\n")),(null===l||void 0===l?void 0:l.match(/typescript/i))&&(d=o.join("\n"))}catch(u){console.log(u.message),d=null}return d}},36169:function(e,l,t){t.d(l,{Z:function(){return i}});var a=t(85893);t(67294);function i(e){var l=e.collapse,t=e.setCollapse;return(0,a.jsxs)("div",{className:"collapse-block"+(l?" -mt-16 -mb-6 pt-10":" mt-0 mb-0 p-0"),onClick:function(e){t(!l)},children:[(0,a.jsx)("span",{children:l?"Expand":"Collapse"}),(0,a.jsx)("img",{src:"/images/down-arrow-dark.svg",alt:"Down Arrow",width:16,className:"dark:hidden opacity-30 "+(l?"":"rotate-180")}),(0,a.jsx)("img",{src:"/images/down-arrow-white.svg",alt:"Down Arrow",width:16,className:"opacity-30 hidden dark:flex "+(l?"":"rotate-180")})]})}},33907:function(e,l){l.Z=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/}}]);