dsql-admin/dsql-app/.local_dist/static/chunks/278-a10f4a06716eadad.js
Benjamin Toby e95f4d1087 Updates
2025-02-16 17:12:40 +01:00

1 line
40 KiB
JavaScript

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[278],{278:(e,l,t)=>{t.d(l,{A:()=>T});var a=t(4848),n=t(6540),i=t(6517),s=t(2543),r=t.n(s);function d(e){let{tableFields:l,setTableFields:t,setRefresh:a,setPageRefresh:n,refreshFieldsListRef:i}=e;if(l.find(e=>e.newTempField))return;let s=r().cloneDeep(l),d=s.findIndex(e=>"date_created"===e.fieldName);s.splice(d,0,{newTempField:!0}),t(s),(null==i?void 0:i.current)&&i.current(e=>e+1)}var o=t(1342),c=t(1710),u=t(2675),m=t(2086),p=t(9020),x=t(3430);function v(e){var l,t,i,s,r,d,o,c,v,f,h;let{field:g,database:b,currentTable:y,isDelegated:N,setLoading:j}=e,w=n.useContext(x.AppContext),[T,C]=n.useState(g),[A,F]=n.useState(!1);return(0,a.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(A?" shadow-2xl shadow-slate-700/40 relative z-50":""),children:[(0,a.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(A?" rounded-t":" rounded")+((null===(l=T.fieldName)||void 0===l?void 0:l.match(u.A))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,a.jsx)("span",{className:"font-bold"+((null===(t=T.fieldName)||void 0===t?void 0:t.match(u.A))?" dark:text-slate-500":" dark:text-white"),children:T.fieldName}),(0,a.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:T.dataType}),(null==T?void 0:T.foreignKey)&&(0,a.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,a.jsx)("span",{children:"Foreign Key: "}),(0,a.jsxs)("span",{children:[T.foreignKey.destinationTableName," ("," ",(0,a.jsx)("b",{children:T.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(i=T.fieldName)||void 0===i?void 0:i.match(u.A))&&(0,a.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),!(!N&&!(null===(s=T.fieldName)||void 0===s?void 0:s.match(u.A))&&(null===(r=T.dataType)||void 0===r?void 0:r.match(/INT/)))||T.foreignKey||(null==b?void 0:null===(o=b.active_clone)||void 0===o?void 0:null===(d=o.toString())||void 0===d?void 0:d.match(/1/))?!(!N&&!(null===(c=T.fieldName)||void 0===c?void 0:c.match(u.A))&&(null===(v=T.dataType)||void 0===v?void 0:v.match(/INT/)))||(null==b?void 0:null===(h=b.active_clone)||void 0===h?void 0:null===(f=h.toString())||void 0===f?void 0:f.match(/1/))?(0,a.jsx)(n.Fragment,{}):(0,a.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,a.jsx)("div",{className:"button py-1 text-xs light-gray",onClick:e=>{if(window.confirm("Delete this foreign Key?")){var l,t;delete g.foreignKey,j(!0),(0,p.A)("/api/updateClonedTableForeignKeys",{method:"post",body:{tableData:y,database:b.db_full_name,dbSlug:b.db_slug,delegated:null!==(t=window.location)&&void 0!==t&&null!==(l=t.search)&&void 0!==l&&!!l.match(/delegated=true/i)}},!0).then(e=>{e.success?window.location.reload():window.alert("Update Failed, Please Try again.")})}},style:{color:"var(--slate-500)"},children:"Delete Foreign Key"})}):(0,a.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(0,a.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{A?F(!1):F(!0)},style:{color:"var(--slate-500)"},children:"Add Foreign Key"})})]}),A&&!N&&(0,a.jsx)("div",{className:"card col w-full -mt-5 pt-0 no-hover",children:(0,a.jsx)(m.A,{fieldObject:g,setFieldObject:C,setActiveEdit:F,activeClonedTable:!0,appContextObject:w})})]})}var f=t(1464);function h(e){let{fieldIndex:l,tableFields:t,setTableFields:i,refreshFieldsListRef:s,database:r,currentTable:d,user:o}=e,[c,u]=n.useState("VARCHAR"),[m,p]=n.useState("200"),[x,v]=n.useState("10"),[h,g]=n.useState("2"),[b,y]=n.useState("Varchar is simply letters and numbers within the range 0 - 255"),[N,j]=n.useState({}),w=n.useRef(),[T,C]=n.useState("");return n.useEffect(()=>{var e;w.current&&(w.current.scrollIntoView({block:"center",behavior:"smooth"}),null===(e=w.current.querySelector("input"))||void 0===e||e.focus())},[]),c.match(/uuid/i),(0,a.jsx)(f.A,{setFields:i,fieldIndex:l,fields:t})}function g(e){let{tableFields:l,setTableFields:t,refreshFieldsListRef:a,order:n,field:i,e:s}=e,d=r().cloneDeep(l),o=d.findIndex(e=>e.fieldName===i.fieldName);if(o<0)return;let c=d[o];if("up"===n&&o&&o<=1){console.log("Min Reached =>",o);return}if("down"===n&&o&&o>=d.length-7){console.log("Max Reached =>",o);return}try{var u,m;let e;let l=s.target.closest(".table-field-wrapper"),t=l.previousElementSibling,a=l.nextElementSibling,i=window.DSQL.Flip,r=i.getState(l);"up"===n?(e=i.getState(t),null===(u=l.parentNode)||void 0===u||u.insertBefore(l,t)):(null==a?void 0:a.nextElementSibling)&&(e=i.getState(a),null===(m=l.parentNode)||void 0===m||m.insertBefore(l,a.nextElementSibling)),i.from(r,{duration:.3,ease:"power1.inOut"}),i.from(e,{duration:.3,ease:"power1.inOut"})}catch(e){console.log("Error =>",e.message)}if(!o){console.log("No target Field Index =>",o);return}d.splice(o,1),"up"===n?d.splice(o-1,0,c):d.splice(o+1,0,c),setTimeout(()=>{t([...d]),a.current&&a.current(e=>e+1)},500)}var b=t(900),y=t(2027);function N(e){var l,t,i,s,r,d,o;let{field:c,fieldIndex:m,tableFields:p,setTableFields:x,refreshFieldsListRef:v,database:h,confirmedDelegetedUser:N}=e,j=null==N?void 0:N.delegated,w=null==N?void 0:null===(l=N.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i);null==N||null===(t=N.priviledges)||void 0===t||t.match(/Delete Tables/i),null==N||null===(i=N.priviledges)||void 0===i||i.match(/Create Tables/i);let{active_clone:T,active_clone_parent_db:C,remote_connected:A}=h,[F,S]=n.useState(c),[k,D]=n.useState(!1);return(0,a.jsxs)("div",{className:"flex-col w-full table-field-wrapper"+(k?" shadow-2xl shadow-slate-300/40 dark:shadow-black/30 relative z-50":""),children:[(0,a.jsxs)("div",{className:"card no-hover items-center w-full py-4"+(k?" rounded-t":" rounded")+((null===(s=F.fieldName)||void 0===s?void 0:s.match(u.A))?" text-slate-400 pointer-events-none border-slate-200 border":" light-gray"),children:[(0,a.jsx)("span",{className:"font-bold"+((null===(r=F.fieldName)||void 0===r?void 0:r.match(u.A))?" dark:text-slate-500":" dark:text-white"),children:F.fieldName}),(0,a.jsx)("span",{className:"text-xs py-1 px-2 bg-slate-100 dark:bg-slate-700 dark:text-slate-200 rounded ",children:F.dataType}),(null==F?void 0:F.foreignKey)&&(0,a.jsxs)("div",{className:"text-xs bg-primary text-white px-2 py-0.5 rounded-full",children:[(0,a.jsx)("span",{children:"Foreign Key: "}),(0,a.jsxs)("span",{children:[F.foreignKey.destinationTableName," ("," ",(0,a.jsx)("b",{children:F.foreignKey.destinationTableColumnName})," ",")"]})]}),(null===(d=F.fieldName)||void 0===d?void 0:d.match(u.A))&&(0,a.jsx)("span",{className:"text-slate-300 text-sm font-semibold ml-0 md:ml-auto",children:"Default Field"}),!(null===(o=F.fieldName)||void 0===o?void 0:o.match(u.A))&&!C&&!A&&(0,a.jsx)("div",{className:"ml-0 md:ml-auto flex-wrap",children:(!j||j&&w)&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)(b.A,{children:[(0,a.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{k?D(!1):D(!0)},style:{color:"var(--slate-500)"},children:"Edit"}),!C&&!A&&(0,a.jsx)("div",{className:"button outlined py-1 text-xs gray",onClick:e=>{window.confirm('Delete "'.concat(c.fieldName,'"?'))&&x(e=>e.filter((e,l)=>l!=m))},style:{color:"var(--slate-500)"},children:"Delete"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full rotate-180",onClick:e=>{g({tableFields:p,setTableFields:x,refreshFieldsListRef:v,order:"up",field:c,e})},children:(0,a.jsx)(y.A,{size:20})}),(0,a.jsx)("div",{className:"button outlined gray p-2 w-8 h-8 rounded-full",onClick:e=>{g({tableFields:p,setTableFields:x,refreshFieldsListRef:v,order:"down",field:c,e})},children:(0,a.jsx)(y.A,{size:20})})]})]})})]}),k&&(0,a.jsx)(f.A,{existingField:c,setFields:x,setActiveEdit:D,fieldIndex:m,fields:p})]})}var j=t(8845);let w=1;function T(e){var l;let{user:s,tableFields:r,setTableFields:u,refreshFieldsListRef:m,updateTable:p,updateTableAfterFieldsUpdateFunction:x,collapsed:f,database:g,table:b,confirmedDelegetedUser:y,query:T}=e,C=null==y?void 0:y.delegated,A=null==y?void 0:null===(l=y.priviledges)||void 0===l?void 0:l.match(/Edit Tables/i),{active_clone_parent_db:F,remote_connected:S}=g,[k,D]=n.useState(0);m.current=D;let[E,_]=n.useState(!1),[I,V]=n.useState(f||!1);return(n.useEffect(()=>{let{Flip:e}=t(8383);i.Ay.registerPlugin(e);let l=window.DSQL;l&&(l.Flip=e)},[]),C&&!A)?null:(0,a.jsxs)("section",{className:"paper green",children:[E&&(0,a.jsx)(c.A,{}),(null==b?void 0:b.childTable)?(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,a.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"button outlined light-gray",onClick:e=>{let l=(0,j.A)({paradigm:"JavaScript",table:b,query:T});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("JavaScript Type Definition Copied")})},children:(0,a.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,a.jsx)("div",{className:"button outlined light-gray",onClick:e=>{let l=(0,j.A)({paradigm:"TypeScript",table:b,query:T});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("TypeScript Type Definition Copied")})},children:(0,a.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,a.jsx)("div",{className:"flex-col w-full",style:I?{maxHeight:"200px"}:{},children:r&&r[0]&&r.map((e,l)=>(w++,(0,a.jsx)(v,{field:e,database:g,setLoading:_,currentTable:b,isDelegated:C},w)))}),f&&(0,a.jsx)(o.A,{collapse:I||!1,setCollapse:V})]}):(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,a.jsx)("h2",{className:"text-xl m-0 text-left title",children:"Fields"}),(0,a.jsxs)("div",{children:[(!C||C&&A)&&!F&&!S&&(0,a.jsxs)("div",{className:"button secondary outlined",onClick:e=>{I&&V(!1),d({setTableFields:u,tableFields:r,setRefresh:D,refreshFieldsListRef:m})},children:[(0,a.jsx)("span",{className:"symbol",children:"+"}),(0,a.jsx)("span",{children:"Add New Field"})]}),(0,a.jsx)("div",{className:"button outlined light-gray",onClick:e=>{if(!b)return;let l=(0,j.A)({paradigm:"JavaScript",table:b,query:T});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("JavaScript Type Definition Copied")})},children:(0,a.jsx)("span",{children:"Copy TypeDef (JS)"})}),(0,a.jsx)("div",{className:"button outlined light-gray",onClick:e=>{if(!b)return;let l=(0,j.A)({paradigm:"TypeScript",table:b,query:T});l&&navigator.clipboard.writeText(l).then(()=>{window.alert("TypeScript Type Definition Copied")})},children:(0,a.jsx)("span",{children:"Copy TypeDef (TS)"})})]})]}),(0,a.jsxs)("div",{className:"flex-col w-full",style:I?{maxHeight:"200px"}:{},children:[r&&r[0]&&r.map((e,l)=>(w++,e.newTempField)?(0,a.jsx)(h,{fieldIndex:l,tableFields:r,setTableFields:u,refreshFieldsListRef:m,database:g,currentTable:b,user:s},w):(0,a.jsx)(N,{field:e,fieldIndex:l,setTableFields:u,refreshFieldsListRef:m,tableFields:r,database:g,confirmedDelegetedUser:y},w)),(!C||C&&A)&&!F&&!S&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("div",{className:"button outlined gray w-full more-padding",style:{borderStyle:"dashed"},onClick:e=>{I&&V(!1),d({setTableFields:u,tableFields:r,setRefresh:D,refreshFieldsListRef:m})},children:[(0,a.jsx)("span",{className:"symbol",children:"+"}),(0,a.jsx)("span",{children:"Add New Field"})]}),p&&(0,a.jsx)("button",{className:"secondary w-full py-3",onClick:e=>{window.confirm("Update Table Fields?")&&(_(!0),x&&x(_))},children:"Update Table Fields"})]})]}),f&&(0,a.jsx)(o.A,{collapse:I,setCollapse:V})]})]})}},2086:(e,l,t)=>{t.d(l,{A:()=>d});var a=t(4848),n=t(6540),i=t(9020),s=t(1710),r=t(2408);function d(e){var l,t,d,o;let{appContextObject:c,fieldObject:u,setFieldObject:m,activeClonedTable:p,setActiveEdit:x}=e,v=c.pageProps.database,f=c.pageProps.table,h=c.pageProps.user,[g,b]=n.useState(null!=u&&!!u.foreignKey),[y,N]=n.useState(null),[j,w]=n.useState(null),[T,C]=n.useState(null),[A,F]=n.useState(null),[S,k]=n.useState(!1),[D,E]=n.useState("boolean"!=typeof(null===(l=u.foreignKey)||void 0===l?void 0:l.cascadeDelete)||u.foreignKey.cascadeDelete),[_,I]=n.useState("boolean"==typeof(null===(t=u.foreignKey)||void 0===t?void 0:t.cascadeUpdate)&&u.foreignKey.cascadeUpdate);return n.useEffect(()=>{m(e=>({...e,foreignKey:{...e.foreignKey,cascadeDelete:D,cascadeUpdate:_}}))},[D,_]),n.useEffect(()=>{if(!g&&!(null==u?void 0:u.foreignKey)){N(null),w(null),C(null),F(null);return}(0,i.A)("/api/getUserSchemaData").then(e=>{if(e.success)try{let t=e.schemaData.filter(e=>e.dbFullName===v.db_full_name),a=f?t[0].tables.filter(e=>e.tableName!==f.tableName):t[0].tables;if(N(a),null==u?void 0:u.foreignKey){var l;let e=a.filter(e=>{var l;return e.tableName===(null==u?void 0:null===(l=u.foreignKey)||void 0===l?void 0:l.destinationTableName)});w(e[0]),(null===(l=e[0])||void 0===l?void 0:l.fields)&&C(e[0].fields)}}catch(e){(0,i.A)("/api/admin/clientError",{method:"post",body:{component:"ForeignKey/fetch-error-getUserSchemaData/lines-65-77",message:e.message,user:h}})}})},[g]),(0,a.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full mt-2 relative",style:{minWidth:"70px"},children:[S&&(0,a.jsx)(s.A,{}),(0,a.jsxs)("label",{htmlFor:"foreign_key_field",className:"flex flex-wrap items-center gap-2 mt-2",children:[(0,a.jsx)("span",{children:"Foreign Key?"}),(0,a.jsxs)("div",{className:"dropdown-wrapper reversed text-sm items-start",children:[(0,a.jsx)("span",{className:"px-2 bg-slate-200 rounded-full hover:bg-slate-100 hidden xl:flex text-slate-600",children:"Info"}),(0,a.jsx)("div",{className:"dropdown mt-0 xl:-mt-2",children:(0,a.jsx)("span",{children:"Foriegn key links the current table to another table"})})]})]}),(0,a.jsxs)("select",{name:"foreign_key_field",id:"foreign_key_field",className:"px-2",defaultValue:(null==u?void 0:u.foreignKey)?"Yes":"No",onChange:e=>{e.target.value.match(/yes/i)?(b(!0),m&&m(e=>(e.foreignKey={foreignKeyName:void 0,destinationTableName:void 0,destinationTableColumnName:void 0,cascadeDelete:!0},e))):(b(!1),m&&m(e=>(delete e.foreignKey,e)))},children:[(0,a.jsx)("option",{value:"No",children:"No"}),(0,a.jsx)("option",{value:"Yes",children:"Yes"})]}),g&&y&&(0,a.jsx)(n.Fragment,{children:(0,a.jsxs)("select",{name:"foreign_key_destination_table_name",id:"foreign_key_destination_table_name",className:"px-2",defaultValue:(null==u?void 0:null===(d=u.foreignKey)||void 0===d?void 0:d.destinationTableName)?u.foreignKey.destinationTableName:void 0,onChange:e=>{var l;let t=e.target;if(null===(l=e.target.value)||void 0===l?void 0:l.match(/--/)){m?m(e=>{let l=e.foreignKey;return l&&(l.destinationTableName=void 0),e}):t.dataset.destinationTableName=void 0;return}let a=y.filter(l=>l.tableName===e.target.value)[0];w(a),(null==a?void 0:a.fields)&&C(a.fields),m?m(l=>{let t=l.foreignKey;return t&&(t.destinationTableName=e.target.value),l}):e.target.dataset.destinationTableName=e.target.value},children:[(0,a.jsx)("option",{value:"--",children:"--Select Table--"}),y.map((e,l)=>(0,a.jsx)("option",{value:e.tableName,children:e.tableFullName},l+1))]})}),j&&T&&(0,a.jsxs)(n.Fragment,{children:[(0,a.jsxs)("select",{name:"foreign_key_destination_table_column_name",id:"foreign_key_destination_table_column_name",className:"px-2",defaultValue:(null==u?void 0:null===(o=u.foreignKey)||void 0===o?void 0:o.destinationTableColumnName)?u.foreignKey.destinationTableColumnName:void 0,onChange:e=>{try{var l;let t=T.filter(l=>l.fieldName===e.target.value)[0];if(F(t),null===(l=e.target.value)||void 0===l?void 0:l.match(/--/)){m&&m(e=>{let l=e.foreignKey;return l&&(l.destinationTableColumnName=void 0),e});return}let a="dsql_".concat(v.user_id,"_").concat(v.db_slug,"_").concat(Date.now());m?m(e=>{e.dataType=t.dataType;let l=e.foreignKey;return l&&(l.destinationTableColumnName=t.fieldName,l.destinationTableColumnType=t.dataType,l.foreignKeyName=a),e}):(e.target.dataset.dataType=t.dataType,e.target.dataset.destinationTableColumnName=t.fieldName,e.target.dataset.foreignKeyName=a)}catch(e){(0,i.A)("/api/admin/clientError",{method:"post",body:{component:"ForeignKey/lines-232-264",message:e.message,user:h}})}},children:[(0,a.jsx)("option",{value:"--",children:"--Select Column--"}),T.map((e,l)=>(0,a.jsx)("option",{value:e.fieldName,children:e.fieldName},l+1))]}),p&&A&&(0,a.jsx)("button",{className:"secondary w-full",onClick:e=>{var l,t;k(!0),(0,i.A)("/api/updateClonedTableForeignKeys",{method:"post",body:{tableData:f,database:v.db_full_name,dbSlug:v.db_slug,delegated:null!==(t=window.location)&&void 0!==t&&null!==(l=t.search)&&void 0!==l&&!!l.match(/delegated=true/i)}},!0).then(e=>{e.success?window.alert("Foreign Key Added Successfully!"):window.alert("Update Failed, Please Try again.")})},children:"Add Foreign Key"}),(0,a.jsx)(r.A,{checkBoxValues:[{title:"Cascade Delete",default:D,name:"cascade-delete",onChangeHandler:e=>{E(e.target.checked)}},{title:"Cascade Update",name:"cascade-update",default:_,onChangeHandler:e=>{I(e.target.checked)}}],smallText:!0})]}),p&&(0,a.jsx)("button",{className:"light-gray w-full",onClick:e=>{delete u.foreignKey,null==x||x(!1)},children:"Cancel"})]})}},1464:(e,l,t)=>{let a;t.d(l,{U:()=>B,A:()=>Q});var n=t(4848),i=t(7319),s=t(6540),r=t(4327);function d(e,l){let t=e.replace(/\d|\(|\)/g,""),a=l?Number(l):e.match(/\d/)?Number(e.replace(/[^\d]/g,"")):200;return{full:"".concat(t,"(").concat(a,")"),name:t,number:a}}var o=t(3226);function c(e){var l,t;let{dataType:a,integerLength:n,decimals:i}=e,s=a.replace(/\d|\(|\)|\,/g,""),r=null===(l=a.match(/\d+\,/))||void 0===l?void 0:l[0].replace(/[^\d]/g,""),d=null===(t=a.match(/\,\d+\)/))||void 0===t?void 0:t[0].replace(/[^\d]/g,""),c=n?(0,o._n)(n):r?(0,o._n)(r):10,u=i?(0,o._n)(i):d?(0,o._n)(d):2;return{full:"".concat(s,"(").concat(c,",").concat(u,")"),name:s,integer:c,decimal:u}}function u(e){let{dataType:l,decimals:t,integerLength:a,varcharValue:n}=e;return l.match(/varchar/i)&&n?d(l,n).full:l.match(/decimal|double|float/i)&&t&&a?c({dataType:l,decimals:t,integerLength:a}).full:l}var m=t(2027),p=t(856);function x(e){var l;let{label:t,options:a,componentRef:i,labelProps:s,wrapperProps:r,showLabel:d,iconProps:o,changeHandler:c,...u}=e;return(0,n.jsxs)("div",{...r,className:(0,p.QP)("relative w-full flex items-center",null==r?void 0:r.className),children:[d&&(0,n.jsx)("label",{htmlFor:u.name,...s,className:(0,p.QP)("text-xs absolute -top-2.5 left-2 text-slate-500 bg-white px-1.5 rounded-t","dark:text-white/60 dark:bg-black","twui-input-label",null==s?void 0:s.className),children:t||u.name}),(0,n.jsx)("select",{...u,className:(0,p.QP)("w-full pl-3 py-2 border rounded-md appearance-none pr-8","border-slate-300 dark:border-white/20","focus:border-slate-700 dark:focus:border-white/50","outline-slate-300 dark:outline-white/20","focus:outline-slate-700 dark:focus:outline-white/50","bg-white dark:bg-black","twui-select",u.className),ref:i,defaultValue:(null===(l=a.flat().find(e=>e.default))||void 0===l?void 0:l.value)||void 0,onChange:e=>{var l;null==c||c(e.target.value),null===(l=u.onChange)||void 0===l||l.call(u,e)},children:a.flat().map((e,l)=>(0,n.jsx)("option",{value:e.value,children:e.title},l))}),(0,n.jsx)(m.A,{size:20,...o,className:(0,p.QP)("absolute right-2 pointer-events-none",null==o?void 0:o.className)})]})}var v=t(6603);function f(e){let{label:l,variant:t,prefix:i,suffix:r,componentRef:d,labelProps:o,wrapperProps:c,showLabel:u,istextarea:m,debounce:x,invalidMessage:f,autoComplete:h,validationFunction:g,validationRegex:b,valueUpdate:y,...N}=e,[j,w]=s.useState(!1),[T,C]=s.useState(N.value?String(N.value):N.defaultValue?String(N.defaultValue):"");delete N.defaultValue;let[A,F]=s.useState(!0),S=x||500;s.useEffect(()=>{if(!T.match(/./))return F(!0);window.clearTimeout(a),b&&(a=setTimeout(()=>{F(b.test(T))},S)),g&&(a=setTimeout(()=>{g(T).then(e=>{F(e)})},S))},[T]),s.useEffect(()=>{N.value&&C(String(N.value))},[N.value]);let k=m?(0,n.jsx)("textarea",{...N,className:(0,p.QP)("w-full outline-none bg-transparent","twui-textarea",N.className),ref:d,onFocus:e=>{var l;w(!0),null==N||null===(l=N.onFocus)||void 0===l||l.call(N,e)},onBlur:e=>{var l;w(!1),null==N||null===(l=N.onBlur)||void 0===l||l.call(N,e)},value:T,onChange:e=>C(e.target.value),autoComplete:h,rows:N.height?Number(N.height):4}):(0,n.jsx)("input",{...N,className:(0,p.QP)("w-full outline-none bg-transparent border-none","hover:border-none hover:outline-none focus:border-none focus:outline-none","dark:bg-transparent dark:outline-none dark:border-none","p-0","twui-input",N.className),ref:d,onFocus:e=>{var l;w(!0),null==N||null===(l=N.onFocus)||void 0===l||l.call(N,e)},onBlur:e=>{var l;w(!1),null==N||null===(l=N.onBlur)||void 0===l||l.call(N,e)},value:T,onChange:e=>{var l;C(e.target.value),null==N||null===(l=N.onChange)||void 0===l||l.call(N,e)}});return(0,n.jsxs)("div",{...c,className:(0,p.QP)("relative flex items-center gap-2 border rounded-md px-3 py-2 outline outline-1",j&&A?"border-slate-700 dark:border-white/50":"border-slate-300 dark:border-white/20",j&&A?"outline-slate-700 dark:outline-white/50":"outline-slate-300 dark:outline-white/20","warning"==t&&A&&"border-yellow-500 dark:border-yellow-300 outline-yellow-500 dark:outline-yellow-300","error"==t&&A&&"border-red-500 dark:border-red-300 outline-red-500 dark:outline-red-300","inactive"==t&&A&&"opacity-40 pointer-events-none","bg-white dark:bg-black",A?"":"border-orange-500 outline-orange-500 twui-input-invalid",N.readOnly&&"opacity-50 pointer-events-none","twui-input-wrapper",null==c?void 0:c.className),children:[u&&(0,n.jsx)("label",{htmlFor:N.name,...o,className:(0,p.QP)("text-xs absolute -top-2.5 left-2 text-slate-500 bg-white px-1.5 rounded-t","dark:text-white/60 dark:bg-black","twui-input-label",null==o?void 0:o.className),children:l||N.placeholder||N.name}),i&&(0,n.jsx)("div",{className:"opacity-60 pointer-events-none whitespace-nowrap",children:i}),k,r&&(0,n.jsx)("div",{className:"opacity-60 pointer-events-none whitespace-nowrap",children:r}),!A&&(0,n.jsx)(v.A,{className:"opacity-30 pointer-events-none whitespace-nowrap",children:f||"Invalid"})]})}function h(){let{fieldObject:e,setFieldObject:l}=s.useContext(B),t=String(d(e.dataType||"VARCHAR").number);return(0,n.jsx)(f,{type:"number",defaultValue:t,className:"",max:255,min:5,onChange:t=>{l(l=>({...l,dataType:d(e.dataType||"VARCHAR",t.target.value).full}))}})}function g(){let{fieldObject:e,setFieldObject:l}=s.useContext(B),t=String(c({dataType:e.dataType||"DECIMAL"}).decimal),a=String(c({dataType:e.dataType||"DECIMAL"}).integer);return(0,n.jsxs)(i.A,{className:"flex-nowrap",children:[(0,n.jsx)(f,{type:"number",defaultValue:a,className:"min-w-[100px]",max:100,min:1,onChange:a=>{l(l=>({...l,dataType:c({dataType:e.dataType||"DECIMAL",decimals:t,integerLength:a.target.value}).full}))},label:"Integer Length",showLabel:!0}),(0,n.jsx)(f,{type:"number",defaultValue:t,className:"min-w-[60px]",max:4,min:1,onChange:t=>{l(l=>({...l,dataType:c({dataType:e.dataType||"DECIMAL",decimals:t.target.value,integerLength:a}).full}))},label:"Decimals",showLabel:!0})]})}function b(){var e,l,t;let a,o;let{fieldObject:m,setFieldObject:p}=s.useContext(B),v=String(d(m.fieldName||"VARCHAR").number),f=String(c({dataType:m.dataType||"DECIMAL"}).decimal),b=String(c({dataType:m.dataType||"DECIMAL"}).integer),y=(t=m.dataType,a=r.find(e=>e.name===t),(null==t?void 0:t.match(/VARCHAR/i))&&(a=r.find(e=>"VARCHAR"===e.name)),(null==t?void 0:t.match(/DECIMAL/i))&&(a=r.find(e=>"DECIMAL"===e.name)),(null==t?void 0:t.match(/DOUBLE/i))&&(a=r.find(e=>"DOUBLE"===e.name)),(null==t?void 0:t.match(/FLOAT/i))&&(a=r.find(e=>"FLOAT"===e.name)),o=r.find(e=>"VARCHAR"===e.name),a||o||r[0]);return s.useEffect(()=>{m.dataType||p(e=>({...e,dataType:u({dataType:"VARCHAR",varcharValue:v,decimals:f,integerLength:b})}))},[]),(0,n.jsxs)(i.A,{className:"flex-nowrap",children:[(0,n.jsx)(x,{options:r.map(e=>({title:e.title,value:e.name,default:y.name==e.name})),onChange:e=>{p(l=>({...l,dataType:u({dataType:e.target.value,varcharValue:v,decimals:f,integerLength:b})}))},label:"Data Type",showLabel:!0}),(null===(e=y.title)||void 0===e?void 0:e.match(/VARCHAR/))&&(0,n.jsx)(h,{}),(null===(l=y.title)||void 0===l?void 0:l.match(/decimal|float|double/i))&&(0,n.jsx)(g,{})]})}let y=[{title:"Plain Text",value:"plain"},{title:"Rich Text",value:"richText"},{title:"JSON",value:"json"},{title:"YAML",value:"yaml"},{title:"HTML",value:"html"},{title:"CSS",value:"css"},{title:"Javascript",value:"javascript"},{title:"Shell",value:"shell"}];var N=t(2543),j=t.n(N);function w(e){let{fieldObject:l,setFieldObject:t}=e,a=y.find(e=>l[e.value]);return(0,n.jsx)(i.A,{children:(0,n.jsx)(x,{options:y.map(e=>({title:e.title,value:e.value,default:e.value==(null==a?void 0:a.value)})),onChange:e=>{t(l=>{let t=j().cloneDeep(l);return y.forEach(e=>delete t[e.value]),t[e.target.value]=!0,t})},label:"Text Type",showLabel:!0})})}let T=["No","Yes"];function C(){let{fieldObject:e,setFieldObject:l}=s.useContext(B);return(0,n.jsx)(x,{options:T.map(l=>({title:l,value:l,default:!!e.notNullValue&&"Yes"==l||!!e.nullValue&&"No"==l})),changeHandler:e=>{"Yes"==e?l(e=>{let l=j().cloneDeep(e);return delete l.nullValue,l.notNullValue=!0,l}):l(e=>{let l=j().cloneDeep(e);return delete l.notNullValue,l.nullValue=!0,l})},label:"Required?",showLabel:!0,className:"min-w-[100px] w-auto",wrapperProps:{className:"w-auto"}})}var A=t(1510),F=t(9268),S=t(6897);function k(e){let{singelFieldFormContextObject:l}=e,{fieldObject:t,setFieldObject:a}=l,[i,r]=s.useState(t.cssFiles||[]),d=s.useRef(null);return s.useEffect(()=>{a(e=>({...e,cssFiles:i}))},[i]),(0,n.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full my-4",style:{minWidth:"70px"},children:[(0,n.jsx)("span",{className:"label text-xs text-slate-500",children:"Add CSS"}),i.map((e,l)=>(0,n.jsxs)("div",{className:"relative border border-solid border-slate-300 text-xs px-2 py-1 rounded-full",children:[(0,n.jsx)("span",{children:e}),(0,n.jsx)(S.A,{size:20,onClick:()=>{r(l=>l.filter(l=>l!==e))},className:"cursor-pointer hover:opacity-60 "})]},l+1)),(0,n.jsxs)("div",{className:"row w-full",children:[(0,n.jsx)(F.A,{name:"css-file",placeholder:"CSS file URL",elementRef:d}),(0,n.jsx)("button",{className:"secondary outlined",onClick:()=>{var e;let l=null===(e=d.current)||void 0===e?void 0:e.value;(null==l?void 0:l.match(/./))&&r(e=>[...new Set([...e,l])])},children:"Add"})]}),(0,n.jsx)("span",{className:"text-sm text-slate-600",children:"Add CSS files to your Rich Text field"})]})}function D(e){let{singelFieldFormContextObject:l}=e,{fieldObject:t,setFieldObject:a}=l;return(0,n.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",style:{minWidth:"70px"},children:[(0,n.jsx)("label",{htmlFor:"encryption_field",children:"Encrypt?"}),(0,n.jsxs)("select",{name:"encryption_field",id:"encryption_field",className:"px-2",defaultValue:(null==t?void 0:t.encrypted)?"Yes":"No",onChange:e=>{a(l=>{let t=j().cloneDeep(l);return e.target.value.match(/yes/i)?t.encrypted=!0:(t.encrypted=!1,delete t.encrypted),t})},children:[(0,n.jsx)("option",{value:"No",children:"No"}),(0,n.jsx)("option",{value:"Yes",children:"Yes"})]})]})}var E=t(2086);function _(e){let{singelFieldFormContextObject:l}=e,{fieldObject:t,setFieldObject:a}=l;return(0,n.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",style:{minWidth:"70px"},children:[(0,n.jsx)("label",{htmlFor:"encryption_field",children:"Auto Increment?"}),(0,n.jsxs)("select",{name:"encryption_field",id:"encryption_field",className:"px-2",defaultValue:(null==t?void 0:t.autoIncrement)?"Yes":"No",onChange:e=>{a(l=>{var t;let a=j().cloneDeep(l);return(null===(t=e.target.value)||void 0===t?void 0:t.match(/yes/i))?a.autoIncrement=!0:delete a.autoIncrement,a})},children:[(0,n.jsx)("option",{value:"No",children:"No"}),(0,n.jsx)("option",{value:"Yes",children:"Yes"})]})]})}function I(e){let{singelFieldFormContextObject:l}=e,{fieldObject:t,setFieldObject:a}=l;return(0,n.jsxs)("div",{className:"flex flex-col items-start gap-2 w-full",style:{minWidth:"70px"},children:[(0,n.jsx)("label",{htmlFor:"encryption_field",children:"Pattern"}),(0,n.jsx)("span",{className:"text-sm text-slate-500",children:'This describes a pattern that must be matched for this field to be valid. If you add a pattern and make a db entry that doesn\'t match, the entry will be "NULL" or an empty string or the default value.'}),(0,n.jsx)("input",{type:"text",placeholder:"Regex Pattern. Eg: '\\\\.[a-z]+'",onInput:e=>{let l=e.target;a(e=>{var t;let a=j().cloneDeep(e);return(null==l?void 0:null===(t=l.value)||void 0===t?void 0:t.length)>0?a.pattern=l.value:delete a.pattern,a})},defaultValue:null==t?void 0:t.pattern}),(0,n.jsx)("input",{type:"text",placeholder:"Regex Pattern Flags. Eg: igm",onInput:e=>{let l=e.target;a(e=>{var t;let a=j().cloneDeep(e);return(null==l?void 0:null===(t=l.value)||void 0===t?void 0:t.length)>0?a.patternFlags=l.value:delete a.patternFlags,a})},defaultValue:null==t?void 0:t.patternFlags})]})}var V=t(9878);function L(e){let{singelFieldFormContextObject:l}=e,{fieldObject:t,setFieldObject:a}=l;return(0,n.jsxs)("div",{className:"flex flex-col items-start gap-0.5 w-full",style:{minWidth:"70px"},children:[(0,n.jsx)("label",{htmlFor:"unique_field",children:"Unique Field?"}),(0,n.jsxs)("select",{name:"unique_field",id:"unique_field",className:"px-2",defaultValue:(null==t?void 0:t.unique)?"Yes":"No",onChange:e=>{a(l=>{let t=j().cloneDeep(l);return e.target.value.match(/yes/i)?t.unique=!0:(t.unique=!1,delete t.unique),t})},children:[(0,n.jsx)("option",{value:"No",children:"No"}),(0,n.jsx)("option",{value:"Yes",children:"Yes"})]})]})}var K=t(3430);function R(){let e=s.useContext(K.AppContext),l=s.useContext(B),{fieldObject:t,setFieldObject:a,setActiveEdit:i}=l,r=e.pageProps.table,[d,o]=s.useState(!1),c=s.useRef(j().cloneDeep(t));return(0,n.jsxs)(s.Fragment,{children:[(0,n.jsx)("span",{className:"button outlined gray w-full xl:w-auto",onClick:()=>{o(!0)},children:"More"}),(0,n.jsx)(V.A,{open:d,onClose:()=>{c.current&&a(j().cloneDeep(c.current)),o(!1)},maxWidth:"600px",children:(0,n.jsxs)("div",{className:"m-auto flex flex-col max-w-xl w-full max-h-[90vh] overflow-y-auto",children:[(0,n.jsx)("div",{className:"w-full justify-between",children:(0,n.jsx)("span",{className:"text-xl",children:"More Options"})}),(0,n.jsx)(k,{singelFieldFormContextObject:l}),(0,n.jsx)(L,{singelFieldFormContextObject:l}),(0,n.jsx)(D,{singelFieldFormContextObject:l}),r&&(0,n.jsx)(E.A,{fieldObject:t,setFieldObject:a,appContextObject:e,setActiveEdit:i}),(0,n.jsx)(_,{singelFieldFormContextObject:l}),(0,n.jsx)(I,{singelFieldFormContextObject:l}),(0,n.jsx)("button",{className:"w-full outlined more-padding",onClick:()=>{o(!1)},children:"Done"})]})})]})}function U(){var e,l;let{fieldObject:t,setFieldObject:a}=s.useContext(B);return(0,n.jsx)(f,{label:(null===(e=t.dataType)||void 0===e?void 0:e.match(/text$/i))?"Can't Set Default for text values":"Default Value (optional)",showLabel:!0,className:(null===(l=t.dataType)||void 0===l?void 0:l.match(/text$/i))?"pointer-events-none opacity-50":"",defaultValue:t.defaultValue?t.defaultValue:(t.nullValue,""),onInput:e=>{var l;let n=e.target;null!==(l=t.dataType)&&void 0!==l&&l.match(/text$/i)||a(e=>{let l=j().cloneDeep(e);return n.value.match(/./)||(delete l.defaultValue,delete l.nullValue),n.value.match(/^null$/i)?(delete l.defaultValue,l.nullValue=!0):n.value.match(/./)&&(delete l.nullValue,l.defaultValue=n.value),l})},placeholder:"Empty for Null."})}function M(){let{fieldObject:e,setFields:l,setActiveEdit:t,fieldIndex:a,existingField:r,fields:d}=s.useContext(B);return l?(0,n.jsxs)(i.A,{className:"ml-auto",children:[(0,n.jsx)("button",{type:"submit",className:"secondary mt-auto py-3 w-full md:w-auto grow",onClick:n=>{r?l(l=>{let t=j().cloneDeep(l);return a&&(t[a]=j().cloneDeep(e)),t}):function(e){let{setFields:l,newFieldObject:t,fieldIndex:a,fields:n}=e;try{var i;if(!(null===(i=t.fieldName)||void 0===i?void 0:i.match(/./)))throw Error("Please Provide a field name!");let e=null==n?void 0:n.find(e=>e.fieldName==t.fieldName);if(null==e?void 0:e.fieldName)throw Error("Field Name Already exists. Please chose a different name.");l(e=>{let l=j().cloneDeep(e),n=l.findIndex(e=>"date_created"==e.fieldName),i=a||(n<0?e.length-6:n);return l.splice(i,0,t),l.filter(e=>!e.newTempField)})}catch(l){let e="New Field Error: ".concat(l.message);console.log(e),window.alert(e)}}({newFieldObject:e,setFields:l,fieldIndex:a,fields:d}),null==t||t(!1)},children:r?"Save Updates":"Add New Field"}),(0,n.jsx)("div",{className:"button outlined gray mt-auto py-2.5 w-full md:w-auto justify-center grow",onClick:n=>{r?l(l=>{let t=j().cloneDeep(l);return a&&r&&o.On.stringify(e)!==o.On.stringify(r)?(t[a]=j().cloneDeep(r),t):l}):l(e=>j().cloneDeep(e).filter((e,l)=>!e.newTempField)),null==t||t(!1)},children:"Cancel"})]}):null}function O(){let{fieldObject:e,setFieldObject:l,fields:t}=s.useContext(B),[a,i]=s.useState();return(0,n.jsx)(f,{name:"field_name",showLabel:!0,placeholder:"Eg. post_title",label:a||"Field Name",onChange:e=>{let a=(0,o.Yv)(e.target.value).replace(/-/g,"_"),n=null==t?void 0:t.find(e=>e.fieldName==a);(null==n?void 0:n.fieldName)?i("This Field Name Exists"):i(void 0),l(e=>({...e,fieldName:a}))},defaultValue:e.fieldName,value:e.fieldName,variant:a?"error":void 0,autoFocus:!0})}var P=t(2323),Y=t(3851);function H(){let{existingField:e}=s.useContext(B);return e?null:(0,n.jsx)(Y.A,{className:"dark:bg-white/5 bg-slate-200 rounded",children:(0,n.jsx)(v.A,{size:"smaller",className:"font-bold",children:"New Field"})})}let B=s.createContext({});function Q(e){var l,t;let{existingField:a,setFields:r,setActiveEdit:d,fieldIndex:o,fields:c}=e,u=s.useContext(K.AppContext);u.pageProps.database,u.pageProps.table;let[m,x]=s.useState(a||{}),v=s.useRef();return s.useEffect(()=>{if(!a){var e;null===(e=v.current)||void 0===e||e.scrollIntoView({block:"center",behavior:"smooth"})}},[]),(0,n.jsx)(B.Provider,{value:{fieldObject:m,setFieldObject:x,setFields:r,setActiveEdit:d,fieldIndex:o,existingField:a,fields:c},children:(0,n.jsx)("div",{ref:v,className:"w-full",children:(0,n.jsx)(A.A,{className:(0,p.QP)("w-full",a?"rounded-t-none -mt-3":""),children:(0,n.jsxs)(P.A,{className:"w-full",children:[(0,n.jsx)(H,{}),(0,n.jsxs)(i.A,{className:"pt-8 pb-4 px-4 gap-4 w-full",children:[(0,n.jsx)(O,{}),(0,n.jsx)(b,{}),(null===(l=m.dataType)||void 0===l?void 0:l.match(/text/i))&&(0,n.jsx)(w,{fieldObject:m,setFieldObject:x}),!(null===(t=m.dataType)||void 0===t?void 0:t.match(/text/i))&&!m.defaultValueLiteral&&(0,n.jsx)(C,{}),!m.defaultValueLiteral&&(0,n.jsx)(U,{}),!m.defaultValueLiteral&&(0,n.jsx)(R,{}),(0,n.jsx)(M,{})]})]})})})})}},8845:(e,l,t)=>{t.d(l,{A:()=>n});var a=t(2675);function n(e){let{paradigm:l,table:t,query:n,typeDefName:i,allValuesOptional:s,addExport:r}=e,d="";try{let e=i||"DSQL_".concat(n.single,"_").concat(n.single_table).toUpperCase(),c=t.fields;function o(e){return(null==e?void 0:e.match(/int/i))?"number":(null==e||e.match(/text|varchar|timestamp/i),"string")}let u=[],m=[];u.push("".concat(r?"export ":"","type ").concat(e," = {")),m.push("/**\n * @typedef {object} ".concat(e)),c.forEach(e=>{var l;let t=s?"?":e.nullValue?"?":(null===(l=e.fieldName)||void 0===l?void 0:l.match(a.A))?"?":"";u.push(" ".concat(e.fieldName).concat(t,": ").concat(o(e.dataType||""),";")),m.push(" * @property {".concat(o(e.dataType||"")).concat(t,"} ").concat(e.fieldName))}),u.push("}"),m.push(" */"),(null==l?void 0:l.match(/javascript/i))&&(d=m.join("\n")),(null==l?void 0:l.match(/typescript/i))&&(d=u.join("\n"))}catch(e){console.log(e.message),d=null}return d}},2408:(e,l,t)=>{t.d(l,{A:()=>n});var a=t(4848);function n(e){let{name:l,checkBoxValues:t,setAlert:n,labelColor:i,flexRow:s,baseText:r,smallText:d,className:o}=e;return(0,a.jsx)("div",{className:"flex items-start gap-x-4"+(s?" flex-row flex-wrap gap-y-2 ":" flex-col gap-y-4 ")+(o||""),children:t.map((e,t)=>{let{payload:s,title:o,onChangeHandler:c,fixed:u,jsx:m}=e,p=e.name?"".concat(l,"-").concat(e.name):s?l+"-"+s:l;return(0,a.jsxs)("div",{className:"flex items-center"+(e.default&&u?" pointer-events-none":"")+(d?" gap-1 ":" gap-2 ")+((null==e?void 0:e.className)?e.className:""),children:[(0,a.jsx)("input",{className:"m-0"+(d?" w-4 h-4":" w-5 h-5"),type:"checkbox",defaultChecked:!!e.default,name:p,id:p,onChange:l=>{n&&n(null),c&&c(l,e)},value:s,style:{minWidth:"20px"},...e.props}),m||(0,a.jsx)("label",{htmlFor:p,className:"m-0 "+(i||"text-slate-800 dark:text-white/80")+(r||d?" text-base":" text-lg"),children:o})]},t+1)})})}t(6540)},1342:(e,l,t)=>{t.d(l,{A:()=>n});var a=t(4848);function n(e){let{collapse:l,setCollapse:t}=e;return(0,a.jsxs)("div",{className:"collapse-block"+(l?" -mt-16 -mb-6 pt-10":" mt-0 mb-0 p-0"),onClick:e=>{l?t(!1):t(!0)},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")})]})}t(6540)},9878:(e,l,t)=>{t.d(l,{A:()=>r});var a=t(4848),n=t(6540),i=t(5338),s=t(6897);function r(e){let{children:l,open:t,setOpen:s,onClose:r,maxWidth:o}=e;return n.useEffect(()=>{if(t){let e=document.createElement("div");e.className="modal-wrapper",(0,i.createRoot)(e).render((0,a.jsx)(d,{onClose:r,maxWidth:o,children:l})),document.body.appendChild(e)}else document.querySelectorAll(".modal-wrapper").forEach(e=>{var l;null===(l=e.parentElement)||void 0===l||l.removeChild(e)})},[t]),(0,a.jsx)(a.Fragment,{})}function d(e){let{children:l,onClose:t,maxWidth:i,open:r}=e,d=n.useRef();return(0,a.jsxs)(n.Fragment,{children:[(0,a.jsx)("div",{className:"modal-cancel",onClick:e=>{o({modalEl:e.target.closest(".modal-wrapper"),closeFn:t})}}),(0,a.jsxs)("div",{className:"modal-content",style:{maxWidth:i||void 0},ref:d,children:[l," ",(0,a.jsx)("button",{className:"ghost modal-cancel-button",onClick:e=>{o({modalEl:e.target.closest(".modal-wrapper"),closeFn:t})},children:(0,a.jsx)(s.A,{})})]})]})}function o(e){var l;let{modalEl:t,closeFn:a}=e;a&&a(),null===(l=t.parentElement)||void 0===l||l.removeChild(t)}},1510:(e,l,t)=>{t.d(l,{A:()=>i});var a=t(4848),n=t(856);function i(e){let{spacing:l,...t}=e;return(0,a.jsx)("div",{...t,className:(0,n.QP)("relative flex items-center gap-2 border border-solid rounded","border-slate-300 dark:border-white/10",l?"normal"==l?"px-3 py-2":"tight"==l?"px-2 py-1":"":"px-3 py-2","twui-border",t.className),children:t.children})}},3851:(e,l,t)=>{t.d(l,{A:()=>i});var a=t(4848),n=t(856);function i(e){let{...l}=e;return(0,a.jsx)("div",{...l,className:(0,n.QP)("flex flex-col items-center justify-center gap-4 p-2 w-full","twui-center",l.className),children:l.children})}},2675:(e,l,t)=>{t.d(l,{A:()=>a});let a=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},4327:e=>{e.exports=JSON.parse('[{"title":"VARCHAR","name":"VARCHAR","value":"0-255","argument":true,"description":"Varchar is simply letters and numbers within the range 0 - 255","maxValue":255},{"title":"TINYINT","name":"TINYINT","value":"0-100","description":"TINYINT means Integers: 0 to 100","maxValue":127},{"title":"SMALLINT","name":"SMALLINT","value":"0-255","description":"SMALLINT means Integers: 0 to 240933","maxValue":32767},{"title":"MEDIUMINT","name":"MEDIUMINT","value":"0-255","description":"MEDIUMINT means Integers: 0 to 1245568545560","maxValue":8388607},{"title":"INT","name":"INT","value":"0-255","description":"INT means Integers: 0 to 12560","maxValue":2147483647},{"title":"BIGINT","name":"BIGINT","value":"0-255","description":"BIGINT means Integers: 0 to 1245569056767568545560","maxValue":2e+63},{"title":"TINYTEXT","name":"TINYTEXT","value":"0-255","description":"Text with 255 max characters","maxValue":127},{"title":"TEXT","name":"TEXT","value":"0-100","description":"MEDIUMTEXT is just text with max length 16,777,215"},{"title":"MEDIUMTEXT","name":"MEDIUMTEXT","value":"0-255","description":"MEDIUMTEXT is just text with max length 16,777,215"},{"title":"LONGTEXT","name":"LONGTEXT","value":"0-255","description":"LONGTEXT is just text with max length 4,294,967,295"},{"title":"DECIMAL","name":"DECIMAL","description":"Numbers with decimals","integer":"1-100","decimals":"1-4"},{"title":"FLOAT","name":"FLOAT","description":"Numbers with decimals","integer":"1-100","decimals":"1-4"},{"title":"DOUBLE","name":"DOUBLE","description":"Numbers with decimals","integer":"1-100","decimals":"1-4"},{"title":"UUID","name":"UUID","valueLiteral":"UUID()","description":"A Unique ID"}]')}}]);