@instantdb/components 1.0.52 → 1.0.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
 
2
- > @instantdb/components@1.0.52 build /home/runner/work/instant/instant/client/packages/components
2
+ > @instantdb/components@1.0.53 build /home/runner/work/instant/instant/client/packages/components
3
3
  > vite build
4
4
 
5
5
  vite v5.4.14 building for production...
@@ -12,9 +12,9 @@ rendering chunks...
12
12
  [unplugin:dts] Start generate declaration files...
13
13
  computing gzip size...
14
14
  dist/style.css  61.80 kB │ gzip: 10.75 kB
15
- dist/index.js 390.09 kB │ gzip: 95.64 kB
16
- [unplugin:dts] Declaration files built in 9441ms.
15
+ dist/index.js 390.10 kB │ gzip: 95.63 kB
16
+ [unplugin:dts] Declaration files built in 6856ms.
17
17
  
18
18
  dist/style.css  61.80 kB │ gzip: 10.75 kB
19
- dist/index.cjs 268.84 kB │ gzip: 75.84 kB
20
- ✓ built in 10.62s
19
+ dist/index.cjs 268.84 kB │ gzip: 75.83 kB
20
+ ✓ built in 7.72s
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),Me=require("sonner"),ha=require("@radix-ui/react-visually-hidden"),yr=require("@monaco-editor/react"),Pe=require("clsx"),ot=require("copy-to-clipboard"),b=require("react"),fa=require("tailwind-merge"),ma=require("@radix-ui/react-select"),J=require("@heroicons/react/24/outline"),ba=require("react-dom"),_t=require("swr"),Ne=require("@instantdb/core"),at=require("date-fns"),U=require("@heroicons/react/24/solid"),Oe=require("@instantdb/react"),ve=require("@dnd-kit/core"),xa=require("markdown-table"),Ct=require("export-to-csv"),wa=require("@dnd-kit/modifiers"),Te=require("@dnd-kit/sortable"),_e=require("@tanstack/react-table"),ye=require("lucide-react"),re=require("@headlessui/react"),be=require("lodash"),kr=require("@dnd-kit/utilities");require("swr/subscription");const va=require("@radix-ui/react-tooltip"),ya=require("uuid"),ka=require("@radix-ui/react-dialog"),ja=require("json5"),Sa=require("@radix-ui/react-dropdown-menu"),Na=require("@radix-ui/react-toggle-group"),jr=require("react-copy-to-clipboard"),Ea=require("@radix-ui/react-switch");function Ge(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return r.default=e,Object.freeze(r)}const oe=Ge(ma),ue=Ge(va),qe=Ge(ka),Ue=Ge(Sa),or=Ge(Na),sr=Ge(Ea),Ca=`/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-mono:"Berk Mono";--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-500:oklch(76.9% .188 70.08);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-slate-100:oklch(96.8% .007 247.896);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-50:oklch(98.5% 0 0);--color-neutral-100:oklch(97% 0 0);--color-neutral-200:oklch(92.2% 0 0);--color-neutral-300:oklch(87% 0 0);--color-neutral-400:oklch(70.8% 0 0);--color-neutral-500:oklch(55.6% 0 0);--color-neutral-600:oklch(43.9% 0 0);--color-neutral-700:oklch(37.1% 0 0);--color-neutral-800:oklch(26.9% 0 0);--color-neutral-900:oklch(20.5% 0 0);--color-neutral-950:oklch(14.5% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-xs:4px;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:"Switzer",var(--font-switzer),"Georgia";--default-mono-font-family:"Berk Mono",var(--font-berk-mono),"monospace"}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}@font-face{font-family:Berk Mono;font-weight:400;font-style:normal;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Regular.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:400;font-style:italic;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Italic.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:700;font-style:normal;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Bold.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:400;font-style:italic;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-BoldItalic.woff2)format("woff2");font-display:swap}@font-face{font-family:Switzer;font-weight:400;font-style:normal;font-stretch:100%;src:url(/fonts/Switzer-Variable.woff2)format("woff2");font-display:swap}*,:after,:before,::backdrop{border-color:#e5e7eb}::file-selector-button{border-color:#e5e7eb}[type=text],input:where(:not([type])),[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{appearance:none;--tw-shadow:0 0 #0000;background-color:#fff;border-width:1px;border-color:#6a7282;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem}:is([type=text],input:where(:not([type])),[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#155dfc;outline:2px solid #0000}input::placeholder,textarea::placeholder{color:#6a7282;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-date-and-time-value{text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-year-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-month-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-day-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-hour-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-minute-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-second-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-millisecond-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{print-color-adjust:exact;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='oklch(55.1%25 0.027 264.364)' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem}[multiple],[size]:where(select:not([size="1"])){background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;print-color-adjust:unset;padding-right:.75rem}[type=checkbox],[type=radio]{appearance:none;print-color-adjust:exact;vertical-align:middle;-webkit-user-select:none;user-select:none;color:#155dfc;--tw-shadow:0 0 #0000;background-color:#fff;background-origin:border-box;border-width:1px;border-color:#6a7282;flex-shrink:0;width:1rem;height:1rem;padding:0;display:inline-block}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}[type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}@media (forced-colors:active){[type=checkbox]:checked{appearance:auto}}[type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}@media (forced-colors:active){[type=radio]:checked{appearance:auto}}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{background-color:currentColor;border-color:#0000}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}@media (forced-colors:active){[type=checkbox]:indeterminate{appearance:auto}}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{background-color:currentColor;border-color:#0000}[type=file]{background:unset;border-color:inherit;font-size:unset;line-height:inherit;border-width:0;border-radius:0;padding:0}[type=file]:focus{outline:1px solid buttontext;outline:1px auto -webkit-focus-ring-color}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-1\\/2{top:50%}.top-4{top:calc(var(--spacing)*4)}.top-\\[18px\\]{top:18px}.top-\\[50\\%\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.left-\\[50\\%\\]{left:50%}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-100{z-index:100}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mr-0\\.5{margin-right:calc(var(--spacing)*.5)}.mr-4{margin-right:calc(var(--spacing)*4)}.mr-8{margin-right:calc(var(--spacing)*8)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.-ml-0\\.5{margin-left:calc(var(--spacing)*-.5)}.ml-4{margin-left:calc(var(--spacing)*4)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.h-\\(--radix-select-trigger-height\\){height:var(--radix-select-trigger-height)}.h-1{height:calc(var(--spacing)*1)}.h-3\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-12{height:calc(var(--spacing)*12)}.h-32{height:calc(var(--spacing)*32)}.h-64{height:calc(var(--spacing)*64)}.h-\\[1\\.15rem\\]{height:1.15rem}.h-full{height:100%}.h-px{height:1px}.max-h-\\(--radix-select-content-available-height\\){max-height:var(--radix-select-content-available-height)}.max-h-\\[25vh\\]{max-height:25vh}.max-h-\\[calc\\(100\\%-2rem\\)\\]{max-height:calc(100% - 2rem)}.max-h-\\[calc\\(100dvh-4rem\\)\\]{max-height:calc(100dvh - 4rem)}.max-h-\\[min\\(50vh\\,var\\(--radix-popper-available-height\\)\\)\\]{max-height:min(50vh,var(--radix-popper-available-height))}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\\[30vh\\]{min-height:30vh}.min-h-\\[34px\\]{min-height:34px}.min-h-full{min-height:100%}.w-\\(--input-width\\){width:var(--input-width)}.w-0\\.5{width:calc(var(--spacing)*.5)}.w-3\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-12{width:calc(var(--spacing)*12)}.w-24{width:calc(var(--spacing)*24)}.w-48{width:calc(var(--spacing)*48)}.w-\\[30px\\]{width:30px}.w-\\[62px\\]{width:62px}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.max-w-\\[67vw\\]{max-width:67vw}.max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.max-w-\\[min\\(75rem\\,80vw\\)\\]{max-width:min(75rem,80vw)}.max-w-fit{max-width:fit-content}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-\\(--radix-select-trigger-width\\){min-width:var(--radix-select-trigger-width)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-32{min-width:calc(var(--spacing)*32)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\\[200px\\]{min-width:200px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-\\(--radix-select-content-transform-origin\\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\\(--radix-tooltip-content-transform-origin\\){transform-origin:var(--radix-tooltip-content-transform-origin)}.translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0\\.5{--tw-translate-y:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\[-50\\%\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-rotate-45{rotate:-45deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.filter-shadow-r{opacity:1}@supports (animation-timeline:scroll()){@media (prefers-reduced-motion:no-preference){.filter-shadow-r{opacity:0;animation:linear backwards filter-shadow-r-fade;animation-timeline:--filter-scroll;animation-range:calc(100% - 16px) 100%}}}.filter-shadow-l{opacity:0}@supports (animation-timeline:scroll()){@media (prefers-reduced-motion:no-preference){.filter-shadow-l{animation:linear forwards filter-shadow-l-fade;animation-timeline:--filter-scroll;animation-range:0% 16px}}}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.scroll-my-1{scroll-margin-block:calc(var(--spacing)*1)}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-1{column-gap:calc(var(--spacing)*1)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xs{border-radius:var(--radius-xs)}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[\\#606AF4\\]{border-color:#606af4}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-300\\/80{border-color:#d1d5dccc}@supports (color:color-mix(in lab,red,red)){.border-gray-300\\/80{border-color:color-mix(in oklab,var(--color-gray-300)80%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-neutral-200{border-color:var(--color-neutral-200)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.border-transparent{border-color:#0000}.border-r-gray-200{border-right-color:var(--color-gray-200)}.border-b-gray-200{border-bottom-color:var(--color-gray-200)}.border-l-red-500{border-left-color:var(--color-red-500)}.bg-\\[\\#606AF4\\]{background-color:#606af4}.bg-\\[\\#616AF4\\]{background-color:#616af4}.bg-\\[\\#4543e9\\]{background-color:#4543e9}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-200{background-color:var(--color-neutral-200)}.bg-neutral-300{background-color:var(--color-neutral-300)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-200{background-color:var(--color-red-200)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-linear-to-l{--tw-gradient-position:to left}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-l{--tw-gradient-position:to left in oklab}}.bg-linear-to-l{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-none{background-image:none}.from-black\\/10{--tw-gradient-from:#0000001a}@supports (color:color-mix(in lab,red,red)){.from-black\\/10{--tw-gradient-from:color-mix(in oklab,var(--color-black)10%,transparent)}}.from-black\\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\\/20{--tw-gradient-from:#0003}@supports (color:color-mix(in lab,red,red)){.from-black\\/20{--tw-gradient-from:color-mix(in oklab,var(--color-black)20%,transparent)}}.from-black\\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-black\\/0{--tw-gradient-via:#0000}@supports (color:color-mix(in lab,red,red)){.via-black\\/0{--tw-gradient-via:color-mix(in oklab,var(--color-black)0%,transparent)}}.via-black\\/0{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\\/5{--tw-gradient-via:#0000000d}@supports (color:color-mix(in lab,red,red)){.via-black\\/5{--tw-gradient-via:color-mix(in oklab,var(--color-black)5%,transparent)}}.via-black\\/5{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-1\\.5{padding-top:calc(var(--spacing)*1.5)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-6{padding-right:calc(var(--spacing)*6)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-24{padding-left:calc(var(--spacing)*24)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-balance{text-wrap:balance}.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[\\#606AF4\\]{color:#606af4}.text-\\[\\#2563EB\\]{color:#2563eb}.text-blue-800{color:var(--color-blue-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-neutral-500{color:var(--color-neutral-500)}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-neutral-950{color:var(--color-neutral-950)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[\\#606AF4\\]{--tw-ring-color:#606af4}.ring-gray-300{--tw-ring-color:var(--color-gray-300)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-sm{--tw-blur:blur(var(--blur-sm));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[color\\,box-shadow\\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.content-\\[hi\\]{--tw-content:hi;content:var(--tw-content)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}.\\[scroll-timeline\\:--filter-scroll_inline\\]{scroll-timeline:--filter-scroll inline}.\\[timeline-scope\\:--filter-scroll\\]{timeline-scope:--filter-scroll}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.group-hover\\:text-amber-500:is(:where(.group):hover *){color:var(--color-amber-500)}.group-hover\\:opacity-70:is(:where(.group):hover *){opacity:.7}.group-hover\\:opacity-100:is(:where(.group):hover *),.group-hover\\/cell\\:opacity-100:is(:where(.group\\/cell):hover *){opacity:1}}.file\\:rounded-xs::file-selector-button{border-radius:var(--radius-xs)}.file\\:border-none::file-selector-button{--tw-border-style:none;border-style:none}.file\\:border-neutral-200::file-selector-button{border-color:var(--color-neutral-200)}.file\\:bg-transparent::file-selector-button{background-color:#0000}.file\\:p-2::file-selector-button{padding:calc(var(--spacing)*2)}.file\\:pt-1::file-selector-button{padding-top:calc(var(--spacing)*1)}.file\\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\\:shadow-none::file-selector-button{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.placeholder\\:text-gray-400::placeholder{color:var(--color-gray-400)}.placeholder\\:text-neutral-500::placeholder{color:var(--color-neutral-500)}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.empty\\:invisible:empty{visibility:hidden}.focus-within\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\:ring-blue-700:focus-within{--tw-ring-color:var(--color-blue-700)}@media (hover:hover){.hover\\:cursor-col-resize:hover{cursor:col-resize}.hover\\:cursor-grab:hover{cursor:grab}.hover\\:border-red-300:hover{border-color:var(--color-red-300)}.hover\\:bg-\\[\\#4543E9\\]:hover,.hover\\:bg-\\[\\#4543e9\\]:hover{background-color:#4543e9}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-50\\/30:hover{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-50\\/30:hover{background-color:color-mix(in oklab,var(--color-gray-50)30%,transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-gray-200\\/30:hover{background-color:#e5e7eb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-200\\/30:hover{background-color:color-mix(in oklab,var(--color-gray-200)30%,transparent)}}.hover\\:bg-gray-200\\/50:hover{background-color:#e5e7eb80}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-200\\/50:hover{background-color:color-mix(in oklab,var(--color-gray-200)50%,transparent)}}.hover\\:bg-neutral-100:hover{background-color:var(--color-neutral-100)}.hover\\:bg-neutral-300:hover{background-color:var(--color-neutral-300)}.hover\\:bg-orange-500:hover{background-color:var(--color-orange-500)}.hover\\:text-black:hover{color:var(--color-black)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:text-slate-100:hover{color:var(--color-slate-100)}.hover\\:opacity-100:hover{opacity:1}}.focus\\:bg-neutral-100:focus{background-color:var(--color-neutral-100)}.focus\\:text-neutral-900:focus{color:var(--color-neutral-900)}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-\\[\\#606AF4\\]:focus{--tw-ring-color:#606af4}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:bg-neutral-100:focus-visible{background-color:var(--color-neutral-100)}.focus-visible\\:opacity-100:focus-visible{opacity:1}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-neutral-400:focus-visible{--tw-ring-color:var(--color-neutral-400)}.focus-visible\\:ring-neutral-950:focus-visible{--tw-ring-color:var(--color-neutral-950)}.focus-visible\\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus-visible\\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}.active\\:cursor-grabbing:active{cursor:grabbing}@media (hover:hover){.hover\\:enabled\\:border-red-300:hover:enabled{border-color:var(--color-red-300)}.hover\\:enabled\\:bg-\\[\\#4543e9\\]:hover:enabled{background-color:#4543e9}.hover\\:enabled\\:bg-gray-50\\/30:hover:enabled{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:enabled\\:bg-gray-50\\/30:hover:enabled{background-color:color-mix(in oklab,var(--color-gray-50)30%,transparent)}}.hover\\:enabled\\:bg-gray-200\\/30:hover:enabled{background-color:#e5e7eb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:enabled\\:bg-gray-200\\/30:hover:enabled{background-color:color-mix(in oklab,var(--color-gray-200)30%,transparent)}}.hover\\:enabled\\:bg-orange-500:hover:enabled{background-color:var(--color-orange-500)}.hover\\:enabled\\:text-gray-600:hover:enabled{color:var(--color-gray-600)}.hover\\:enabled\\:text-red-600:hover:enabled{color:var(--color-red-600)}.hover\\:enabled\\:text-slate-100:hover:enabled{color:var(--color-slate-100)}}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:border-gray-300:disabled{border-color:var(--color-gray-300)}.disabled\\:border-red-50:disabled{border-color:var(--color-red-50)}.disabled\\:bg-\\[\\#9197f3\\]:disabled{background-color:#9197f3}.disabled\\:bg-gray-200:disabled{background-color:var(--color-gray-200)}.disabled\\:text-gray-400:disabled{color:var(--color-gray-400)}.disabled\\:text-red-300:disabled{color:var(--color-red-300)}.disabled\\:opacity-20:disabled{opacity:.2}.disabled\\:opacity-50:disabled{opacity:.5}.data-disabled\\:pointer-events-none[data-disabled]{pointer-events:none}.data-disabled\\:opacity-50[data-disabled]{opacity:.5}.data-focus\\:bg-blue-100[data-focus]{background-color:var(--color-blue-100)}.data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=left\\]\\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=right\\]\\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=top\\]\\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[size\\=default\\]\\:h-9[data-size=default]{height:calc(var(--spacing)*9)}.data-\\[size\\=sm\\]\\:h-8[data-size=sm]{height:calc(var(--spacing)*8)}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:flex>*)[data-slot=select-value]{display:flex}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing)*2)}.data-\\[state\\=checked\\]\\:translate-x-\\[calc\\(100\\%-2px\\)\\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[state\\=checked\\]\\:bg-neutral-800[data-state=checked]{background-color:var(--color-neutral-800)}.data-\\[state\\=checked\\]\\:bg-white[data-state=checked]{background-color:var(--color-white)}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[state\\=unchecked\\]\\:bg-neutral-300[data-state=unchecked]{background-color:var(--color-neutral-300)}@media (min-width:40rem){.sm\\:max-w-lg{max-width:var(--container-lg)}}@media (min-width:48rem){.md\\:static{position:static}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:flex-row{flex-direction:row}.md\\:items-center{align-items:center}.md\\:justify-start{justify-content:flex-start}.md\\:gap-2{gap:calc(var(--spacing)*2)}.md\\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:where(.dark\\:divide-neutral-700:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-neutral-700)}.dark\\:border:where(.dark,.dark *){border-style:var(--tw-border-style);border-width:1px}.dark\\:border-neutral-500:where(.dark,.dark *){border-color:var(--color-neutral-500)}.dark\\:border-neutral-600:where(.dark,.dark *){border-color:var(--color-neutral-600)}.dark\\:border-neutral-700:where(.dark,.dark *){border-color:var(--color-neutral-700)}.dark\\:border-neutral-800:where(.dark,.dark *){border-color:var(--color-neutral-800)}.dark\\:border-red-900\\/60:where(.dark,.dark *){border-color:#82181a99}@supports (color:color-mix(in lab,red,red)){.dark\\:border-red-900\\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-900)60%,transparent)}}.dark\\:border-y-neutral-700:where(.dark,.dark *){border-block-color:var(--color-neutral-700)}.dark\\:border-y-neutral-800:where(.dark,.dark *){border-block-color:var(--color-neutral-800)}.dark\\:border-t-neutral-700:where(.dark,.dark *){border-top-color:var(--color-neutral-700)}.dark\\:border-r-neutral-700:where(.dark,.dark *){border-right-color:var(--color-neutral-700)}.dark\\:border-b-neutral-600:where(.dark,.dark *){border-bottom-color:var(--color-neutral-600)}.dark\\:border-b-neutral-700:where(.dark,.dark *){border-bottom-color:var(--color-neutral-700)}.dark\\:border-l-neutral-700:where(.dark,.dark *){border-left-color:var(--color-neutral-700)}.dark\\:bg-\\[\\#606AF4\\]:where(.dark,.dark *){background-color:#606af4}.dark\\:bg-\\[\\#252525\\]:where(.dark,.dark *){background-color:#252525}.dark\\:bg-\\[\\#303030\\]:where(.dark,.dark *){background-color:#303030}.dark\\:bg-blue-700\\/30:where(.dark,.dark *){background-color:#1447e64d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-blue-700\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-700)30%,transparent)}}.dark\\:bg-neutral-200:where(.dark,.dark *){background-color:var(--color-neutral-200)}.dark\\:bg-neutral-600\\/20:where(.dark,.dark *){background-color:#52525233}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)20%,transparent)}}.dark\\:bg-neutral-600\\/40:where(.dark,.dark *){background-color:#52525266}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)40%,transparent)}}.dark\\:bg-neutral-600\\/50:where(.dark,.dark *){background-color:#52525280}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)50%,transparent)}}.dark\\:bg-neutral-700:where(.dark,.dark *){background-color:var(--color-neutral-700)}.dark\\:bg-neutral-700\\/50:where(.dark,.dark *){background-color:#40404080}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-700\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-700)50%,transparent)}}.dark\\:bg-neutral-800:where(.dark,.dark *){background-color:var(--color-neutral-800)}.dark\\:bg-neutral-900:where(.dark,.dark *){background-color:var(--color-neutral-900)}.dark\\:bg-neutral-900\\/50:where(.dark,.dark *){background-color:#17171780}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-900\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-900)50%,transparent)}}.dark\\:bg-orange-600:where(.dark,.dark *){background-color:var(--color-orange-600)}.dark\\:bg-red-500\\/10:where(.dark,.dark *){background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-500\\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\\:bg-red-900\\/30:where(.dark,.dark *){background-color:#82181a4d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-900\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-900)30%,transparent)}}.dark\\:bg-transparent:where(.dark,.dark *){background-color:#0000}.dark\\:text-blue-100:where(.dark,.dark *){color:var(--color-blue-100)}.dark\\:text-neutral-50:where(.dark,.dark *){color:var(--color-neutral-50)}.dark\\:text-neutral-100:where(.dark,.dark *){color:var(--color-neutral-100)}.dark\\:text-neutral-200:where(.dark,.dark *){color:var(--color-neutral-200)}.dark\\:text-neutral-300:where(.dark,.dark *){color:var(--color-neutral-300)}.dark\\:text-neutral-400:where(.dark,.dark *){color:var(--color-neutral-400)}.dark\\:text-neutral-500:where(.dark,.dark *){color:var(--color-neutral-500)}.dark\\:text-neutral-600:where(.dark,.dark *){color:var(--color-neutral-600)}.dark\\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\\:ring-neutral-500:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-500)}.dark\\:ring-neutral-600:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-600)}.dark\\:ring-neutral-700:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-700)}.dark\\:file\\:border-neutral-700:where(.dark,.dark *)::file-selector-button{border-color:var(--color-neutral-700)}.dark\\:file\\:text-white:where(.dark,.dark *)::file-selector-button{color:var(--color-white)}.dark\\:placeholder\\:text-neutral-400:where(.dark,.dark *)::placeholder{color:var(--color-neutral-400)}.dark\\:placeholder\\:text-neutral-500:where(.dark,.dark *)::placeholder{color:var(--color-neutral-500)}.dark\\:checked\\:border-\\[\\#2563EB\\]:where(.dark,.dark *):checked{border-color:#2563eb}.dark\\:checked\\:bg-\\[\\#2563EB\\]:where(.dark,.dark *):checked{background-color:#2563eb}.dark\\:focus-within\\:ring-blue-500:where(.dark,.dark *):focus-within{--tw-ring-color:var(--color-blue-500)}@media (hover:hover){.dark\\:hover\\:border-red-800:where(.dark,.dark *):hover{border-color:var(--color-red-800)}.dark\\:hover\\:bg-\\[\\#4543e9\\]:where(.dark,.dark *):hover{background-color:#4543e9}.dark\\:hover\\:bg-neutral-600:where(.dark,.dark *):hover{background-color:var(--color-neutral-600)}.dark\\:hover\\:bg-neutral-700:where(.dark,.dark *):hover{background-color:var(--color-neutral-700)}.dark\\:hover\\:bg-neutral-700\\/30:where(.dark,.dark *):hover{background-color:#4040404d}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)30%,transparent)}}.dark\\:hover\\:bg-neutral-700\\/50:where(.dark,.dark *):hover{background-color:#40404080}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)50%,transparent)}}.dark\\:hover\\:bg-neutral-700\\/80:where(.dark,.dark *):hover{background-color:#404040cc}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/80:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)80%,transparent)}}.dark\\:hover\\:bg-neutral-800:where(.dark,.dark *):hover{background-color:var(--color-neutral-800)}.dark\\:hover\\:bg-orange-500:where(.dark,.dark *):hover{background-color:var(--color-orange-500)}.dark\\:hover\\:text-neutral-100:where(.dark,.dark *):hover{color:var(--color-neutral-100)}.dark\\:hover\\:text-neutral-300:where(.dark,.dark *):hover{color:var(--color-neutral-300)}.dark\\:hover\\:text-white:where(.dark,.dark *):hover{color:var(--color-white)}}.dark\\:focus\\:bg-neutral-700:where(.dark,.dark *):focus{background-color:var(--color-neutral-700)}.dark\\:focus\\:text-neutral-50:where(.dark,.dark *):focus{color:var(--color-neutral-50)}.dark\\:focus-visible\\:bg-neutral-700:where(.dark,.dark *):focus-visible{background-color:var(--color-neutral-700)}.dark\\:focus-visible\\:ring-neutral-400:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-400)}.dark\\:focus-visible\\:ring-neutral-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-500)}@media (hover:hover){.dark\\:hover\\:enabled\\:border-red-800:where(.dark,.dark *):hover:enabled{border-color:var(--color-red-800)}.dark\\:hover\\:enabled\\:bg-\\[\\#4543e9\\]:where(.dark,.dark *):hover:enabled{background-color:#4543e9}.dark\\:hover\\:enabled\\:bg-neutral-700\\/30:where(.dark,.dark *):hover:enabled{background-color:#4040404d}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:enabled\\:bg-neutral-700\\/30:where(.dark,.dark *):hover:enabled{background-color:color-mix(in oklab,var(--color-neutral-700)30%,transparent)}}.dark\\:hover\\:enabled\\:bg-orange-500:where(.dark,.dark *):hover:enabled{background-color:var(--color-orange-500)}.dark\\:hover\\:enabled\\:text-neutral-100:where(.dark,.dark *):hover:enabled{color:var(--color-neutral-100)}.dark\\:hover\\:enabled\\:text-neutral-300:where(.dark,.dark *):hover:enabled{color:var(--color-neutral-300)}.dark\\:hover\\:enabled\\:text-red-500:where(.dark,.dark *):hover:enabled{color:var(--color-red-500)}}.dark\\:disabled\\:border-neutral-400:where(.dark,.dark *):disabled{border-color:var(--color-neutral-400)}.dark\\:disabled\\:border-red-950:where(.dark,.dark *):disabled{border-color:var(--color-red-950)}.dark\\:disabled\\:bg-\\[\\#9197f3\\]:where(.dark,.dark *):disabled{background-color:#9197f3}.dark\\:disabled\\:text-neutral-600:where(.dark,.dark *):disabled{color:var(--color-neutral-600)}.dark\\:disabled\\:text-neutral-700:where(.dark,.dark *):disabled{color:var(--color-neutral-700)}.dark\\:disabled\\:text-red-800:where(.dark,.dark *):disabled{color:var(--color-red-800)}.dark\\:disabled\\:opacity-40:where(.dark,.dark *):disabled{opacity:.4}.dark\\:disabled\\:opacity-50:where(.dark,.dark *):disabled{opacity:.5}.dark\\:data-focus\\:bg-neutral-700:where(.dark,.dark *)[data-focus]{background-color:var(--color-neutral-700)}.dark\\:data-\\[state\\=checked\\]\\:border-transparent:where(.dark,.dark *)[data-state=checked]{border-color:#0000}.dark\\:data-\\[state\\=checked\\]\\:bg-neutral-600:where(.dark,.dark *)[data-state=checked]{background-color:var(--color-neutral-600)}.dark\\:data-\\[state\\=checked\\]\\:bg-white:where(.dark,.dark *)[data-state=checked]{background-color:var(--color-white)}.dark\\:data-\\[state\\=unchecked\\]\\:bg-neutral-200:where(.dark,.dark *)[data-state=unchecked]{background-color:var(--color-neutral-200)}.dark\\:data-\\[state\\=unchecked\\]\\:bg-neutral-700:where(.dark,.dark *)[data-state=unchecked]{background-color:var(--color-neutral-700)}.\\[\\&_code\\]\\:wrap-break-word code,.\\[\\&_pre\\]\\:wrap-break-word pre{overflow-wrap:break-word}.\\[\\&_pre\\]\\:whitespace-pre-wrap pre{white-space:pre-wrap}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}:is(.\\*\\:\\[span\\]\\:last\\:flex>*):is(span):last-child{display:flex}:is(.\\*\\:\\[span\\]\\:last\\:items-center>*):is(span):last-child{align-items:center}:is(.\\*\\:\\[span\\]\\:last\\:gap-2>*):is(span):last-child{gap:calc(var(--spacing)*2)}}html{--default-mono-font-family:"Berk Mono",var(--font-berk-mono),"monospace"}@keyframes filter-shadow-r-fade{0%{opacity:1}to{opacity:0}}@keyframes filter-shadow-l-fade{0%{opacity:0}to{opacity:1}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`,Sr=typeof window<"u",Ra=Tt("devBackend");let At="8888";if(Ra&&Sr){const e=new URL(location.href).searchParams.get("port");e&&(At=e)}const ir={apiURI:Tt("devBackend")?`http://localhost:${At}`:"https://api.instantdb.com",websocketURI:Tt("devBackend")?`ws://localhost:${At}/runtime/session`:"wss://api.instantdb.com/runtime/session"};function Tt(e){if(!Sr)return null;try{const r=localStorage.getItem(e);return r?JSON.parse(r):null}catch{return null}}function pe(e){Me.toast.success(e,{richColors:!0})}function ge(e,r){Me.toast.error(e,{duration:r?.autoClose,richColors:!0})}const Dt={"many-many":{cardinality:"many","unique?":!1},"one-one":{cardinality:"one","unique?":!0},"many-one":{cardinality:"many","unique?":!0},"one-many":{cardinality:"one","unique?":!1}},Nr=Object.fromEntries(Object.entries(Dt).map(([e,r])=>[`${r.cardinality}-${r["unique?"]}`,e])),Ia=({attr:e,gracePeriodDays:r,isExpanded:a,setIsExpanded:n,onRestore:o})=>{const s=at.add(new Date(e["deletion-marked-at"]),{days:r}),i=()=>e["forward-identity"][2],p=()=>e["reverse-identity"]?.[2],d=()=>{const l=e["forward-identity"][1],g=e["reverse-identity"]?.[1];return{forwardEtype:l,reverseEtype:g}},h=()=>{const l=`${e.cardinality}-${e["unique?"]}`;return Nr[l]},m=()=>{n(!a)},c=(()=>{if(e["value-type"]==="blob")return[];const l=h(),{forwardEtype:g,reverseEtype:f}=d(),x=i(),w=p(),v=(N,T)=>N==="one-one"?"has one":N==="many-many"?"has many":N==="one-many"?T?"has one":"has many":N==="many-one"?T?"has many":"has one":"has";return[{label:"forward",value:t.jsxs("span",{children:[t.jsx("strong",{children:g})," ",v(l,!0)," ",t.jsx("strong",{children:x})]})},{label:"reverse",value:t.jsxs("span",{children:[t.jsx("strong",{children:f})," ",v(l,!1)," ",t.jsx("strong",{children:w})]})}]})(),u=[{label:"type",value:e["value-type"]},...c];return t.jsxs("div",{children:[t.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:m,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[a?t.jsx(J.ChevronDownIcon,{width:14,className:"text-gray-400"}):t.jsx(J.ChevronRightIcon,{width:14,className:"text-gray-400"}),t.jsx("span",{className:"font-mono text-sm font-medium",children:e["forward-identity"][2]}),t.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["expires ",at.formatDistanceToNow(s,{includeSeconds:!1})]})]}),t.jsxs(H,{className:"px-1",size:"mini",variant:"subtle",onClick:l=>{l.stopPropagation(),o(e.id)},children:[t.jsx(J.ArrowUturnLeftIcon,{width:14}),"Restore"]})]}),a&&t.jsx("div",{className:"pb-3 pl-6",children:t.jsx("table",{className:"mt-2 w-full text-left font-mono text-xs text-gray-500",children:t.jsx("tbody",{children:u.map((l,g)=>t.jsxs("tr",{className:g===u.length-1?"pl-2":"border-b border-gray-200",children:[t.jsx("td",{className:"py-1 pr-4 pl-2 font-medium text-gray-700",children:l.label}),t.jsx("td",{className:"py-1 text-gray-600",children:l.value})]},l.label))})})})]})},Ft=e=>{const r=he(),a=r.adminToken;return _t(["recently-deleted",e],async()=>{const o=await fetch(`${r.apiURI}/dash/apps/${e}/soft_deleted_attrs`,{method:"GET",headers:{Authorization:`Bearer ${a}`}}),s=await o.json();if(!o.ok)throw console.error("Failed to fetch recently deleted attrs",s),new Error("Failed to fetch recently deleted attrs"+JSON.stringify(s));return{...s,attrs:s.attrs.map(Oa)}})},Er=e=>{const{data:r}=Ft(e);return b.useMemo(()=>{const n=r?.attrs||[];return n.filter(i=>i["forward-identity"][2]==="id").map(i=>{const p=n.filter(d=>d.metadata.soft_delete_snapshot?.id_attr_id===i.id);return{idAttr:i,remainingCols:p.filter(d=>i.id!==d.id)}})},[r?.attrs])};function Aa({appId:e,db:r}){const{data:a,mutate:n}=Ft(e),o=Er(e),s=a?.["grace-period-days"]||2,i=async({idAttr:p,remainingCols:d})=>{if(!r||!a)return;const h=[p,...d].map(c=>c.id);await r.core._reactor.pushOps(h.map(c=>["restore-attr",c]));const m=new Set(h);n({...a,attrs:a.attrs.filter(c=>!m.has(c.id))})};return t.jsxs(xe,{className:"flex w-full min-w-0 flex-col gap-4 overflow-hidden",children:[t.jsx("h5",{className:"flex items-center gap-2 text-lg font-bold",children:"Recently Deleted Namespaces"}),o.length?t.jsx("div",{className:"flex flex-col gap-2 overflow-hidden",children:o.toSorted((p,d)=>+new Date(d.idAttr["deletion-marked-at"])-+new Date(p.idAttr["deletion-marked-at"])).map(p=>{const d=new Date(p.idAttr["deletion-marked-at"]),h=at.add(d,{days:s});return t.jsxs("div",{className:"flex items-start justify-between gap-4 overflow-hidden border-b py-3 last:border-b-0 dark:border-neutral-700",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate font-semibold dark:text-white",children:p.idAttr["forward-identity"][1]}),t.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:["Deleted ",at.format(d,"MMM d, h:mm a")," ·"," ","expires"," ",at.formatDistanceToNow(h,{includeSeconds:!1})]}),p.remainingCols.length>0?t.jsxs("div",{className:"mt-1 truncate text-xs text-neutral-500 dark:text-neutral-400",title:p.remainingCols.map(m=>m["forward-identity"][2]).join(", "),children:["Columns:"," ",p.remainingCols.map(m=>m["forward-identity"][2]).join(", ")]}):t.jsx("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"No columns"})]}),t.jsx("div",{className:"flex shrink-0 items-center",children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>i(p),children:[t.jsx(J.ArrowPathIcon,{className:"h-3.5 w-3.5"}),"Restore"]})})]},p.idAttr.id)})}):t.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No recently deleted namespaces."})]})}const Ta=({namespace:e,appId:r,db:a,notes:n})=>{const{data:o,mutate:s,error:i}=Ft(r),[p,d]=b.useState(null),h=Wt(),m=async l=>{if(a&&o)try{await a.core._reactor.pushOps([["restore-attr",l]]),s({attrs:o.attrs.filter(f=>f.id!==l)??[],"grace-period-days":o["grace-period-days"]});const g=o.attrs.find(f=>f.id===l);if(g){const f=_a(g);f&&n.setNote(l,f)}}catch(g){console.error(g),g instanceof Ne.InstantAPIError?g.body?.type==="record-not-unique"?ge("Attribute already exists. Rename existing attribute first and then try again to restore."):ge(g.message):ge("Failed to restore attr")}},c=e.attrs.find(l=>l.name==="id")?.id||"unk",u=o?.attrs?.filter(l=>l.metadata?.soft_delete_snapshot?.id_attr_id===c);return b.useEffect(()=>{u?.length===0&&h.onClose()},[u]),i||!u||u.length===0?null:t.jsxs("div",{className:"pb-2",children:[t.jsx(ct,{className:"pb-2",children:t.jsxs("div",{className:"flex w-full grow items-center justify-center gap-2 text-center opacity-60",children:[t.jsx(J.ClockIcon,{width:16}),"Recently Deleted"]})}),t.jsx("div",{className:"flex flex-col gap-2",children:u?.map(l=>t.jsx(Ia,{isExpanded:p===l.id,setIsExpanded:g=>{d(g?l.id:null)},attr:l,gracePeriodDays:o?.["grace-period-days"]||2,onRestore:m},l.id))})]})},lr="_deleted$",Oa=e=>{const r={...e},[a,n,o]=e["forward-identity"];if(r["forward-identity"]=[a,ft(n),ft(o)],e["reverse-identity"]){const[s,i,p]=e["reverse-identity"];r["reverse-identity"]=[s,ft(i),ft(p)]}return r},ft=e=>{const r=e.indexOf(lr);return r===-1?e:e.slice(r+lr.length)},_a=e=>e&&e?.metadata?.soft_delete_snapshot?e.metadata.soft_delete_snapshot.is_indexed&&e.metadata.soft_delete_snapshot.is_required?"Index and required constraints were dropped after restoring":e.metadata.soft_delete_snapshot.is_indexed?"Indexed constraint was dropped after restoring":e.metadata.soft_delete_snapshot.is_required?"Required constraint was dropped after restoring":null:null;function Da({db:e,onClose:r}){const[a,n]=b.useState("");async function o(){const s={id:Oe.id(),"forward-identity":[Oe.id(),a,"id"],"value-type":"blob",cardinality:"one","unique?":!0,"index?":!1},i=[["add-attr",s]];await e.core._reactor.pushOps(i),r({id:s.id,name:a})}return t.jsxs(xe,{className:"flex flex-col gap-4",children:[t.jsx("h5",{className:"flex items-center text-lg font-bold",children:"Create a new namespace"}),t.jsx(Ie,{value:a,placeholder:"Name your namespace",onChange:s=>n(s),autoFocus:!0,ignorePasswordManager:!0}),t.jsx(Se,{type:"submit",label:"Create",submitLabel:"Creating...",errorMessage:"Failed to create namespace",disabled:!a,onClick:o})]})}const Fa=[["$files","url"]],dr=[":",">","<"];function La(e){let r=0,a,n;const o=[];let s=-1;for(const i of e){if(s++,i===" "&&!dr.includes(e[s+1])){r=s+1;continue}if(dr.includes(i)){a&&n!=null&&(a.value=e.substring(n,r).trim(),o.push(a)),a={field:e.substring(r,s).trim(),operator:i,value:""},n=s+1;continue}}return a&&n!=null&&(a.value=e.substring(n).trim(),o.push(a)),o}function tt(e){switch(e){case":":return"=";case"<":return"$lt";case">":return"$gt";default:throw new Error("what kind of op is this? "+e)}}function $a({query:e,attrsByName:r,stringIndexed:a}){if(!e.trim())return[];const n=La(e),o=n.flatMap(s=>{const i=r[s.field];if(!i||!s.value)return[];if(s.value.toLowerCase()==="null"&&s.operator===":"&&!i.isRequired)return[[s.field,"$isNull",null]];const p=[];if(i.checkedDataType&&i.isIndex){if(i.checkedDataType==="string"){const d=s.value;return[[s.field,d===d.toLowerCase()?"$ilike":"$like",`%${s.value}%`]]}if(i.checkedDataType==="number")try{return[[s.field,tt(s.operator),JSON.parse(s.value)]]}catch{}if(i.checkedDataType==="date")try{return[[s.field,tt(s.operator),JSON.parse(s.value)]]}catch{return[[s.field,tt(s.operator),s.value]]}}for(const d of i.inferredTypes||["json"])switch(d){case"boolean":case"number":{try{p.push([s.field,tt(s.operator),JSON.parse(s.value)])}catch{}break}default:{p.push([s.field,tt(s.operator),s.value]);break}}return p});if(!n.length&&e.trim()&&a.length)for(const s of a)o.push([s.name,e.toLowerCase()===e?"$ilike":"$like",`%${e.trim()}%`]);return o}function za(e,r){if(r.length===e.length){for(let a=0;a<r.length;a++)for(let n=0;n<3;n++)if(r[a][n]!==e[a][n])return!1;return!0}return!1}function Ba({onSearchChange:e,attrs:r,initialFilters:a=[]}){const[n,o]=b.useState(""),s=b.useRef(a),{attrsByName:i,stringIndexed:p}=b.useMemo(()=>{const l={},g=[];for(const f of r||[])l[f.name]=f,f.isIndex&&f.checkedDataType==="string"&&g.push(f);return{attrsByName:l,stringIndexed:g}},[r]),d=b.useCallback(be.debounce(l=>{const g=$a({query:l,attrsByName:i,stringIndexed:p});za(s.current,g)||(s.current=g,e(g))},80),[i,p,s]),h=n.indexOf(":")!==-1?be.last(n.split(" ")):n,m=(r||[]).flatMap(l=>{const g=Fa.some(([w,v])=>w===l.namespace&&v===l.name);if(l.type==="ref"||g)return[];const f=[],x=[];if(x.push({field:l.name,operator:":",display:`${l.name}:`}),l.isIndex&&(l.checkedDataType==="number"||l.checkedDataType==="date")){const w={field:l.name,query:null};x.push({...w,operator:"<",display:`${l.name}<`}),x.push({...w,operator:">",display:`${l.name}>`})}for(const w of x)(!h||w.display.startsWith(h)&&w.display!==h)&&f.push(w);return f}),c=b.useRef(null);function u(l){let g;h&&l.startsWith(h)?g=`${n}${l.substring(h.length)}`:g=`${n.trim()} ${l}`,o(g),d(g)}return b.useEffect(()=>{a.length>0&&!n&&o(a.map(l=>`${l[0]}:${l[2]}`).join(" "))},[a]),t.jsxs(re.Combobox,{value:n,onChange:l=>{l&&u(l)},immediate:!0,children:[t.jsx(re.ComboboxInput,{size:32,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-500",value:n,onChange:l=>{o(l.target.value),d(l.target.value)},onKeyDown:l=>{if(l.key==="Tab"&&m.length){l.preventDefault();const g=c.current||m[0];g&&u(g.display)}},placeholder:"Filter..."}),t.jsx(re.ComboboxOptions,{anchor:"bottom start",modal:!1,className:"z-10 mt-1 w-(--input-width) divide-y overflow-auto rounded-md border border-neutral-300 bg-white shadow-lg dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800",children:m.map((l,g)=>t.jsx(re.ComboboxOption,{value:l.display,className:A("px-3 py-1 data-focus:bg-blue-100 dark:text-white dark:data-focus:bg-neutral-700",{}),children:({focus:f})=>(f&&(c.current=l),t.jsx("span",{children:l.display}))},g))})]})}function Ma(e){const[,r,a]=e["forward-identity"];return e.catalog!=="system"||r==="$users"||r==="$files"||r==="$streams"}function qa(e){const r={},a={};for(const[o,s]of Object.entries(e))Ma(s)&&(a[o]=s);for(const o of Object.values(a)){const[,s]=o["forward-identity"];r[s]||(r[s]={id:s,name:s,attrs:{}})}for(const o of Object.values(a)){const s={forward:{id:o["forward-identity"][0],namespace:o["forward-identity"][1],attr:o["forward-identity"][2],nsMap:r[o["forward-identity"][1]]},reverse:o["reverse-identity"]?{id:o["reverse-identity"][0],namespace:o["reverse-identity"][1],attr:o["reverse-identity"][2],nsMap:r[o["reverse-identity"][1]]}:void 0};if(o["forward-identity"]){const[m,c,u,l]=o["forward-identity"],g=o.id+"-forward";l!==!1&&(r[c].attrs[g]={id:o.id,isForward:!0,namespace:c,name:u,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],isPrimary:o["primary?"],cardinality:o.cardinality,linkConfig:s,inferredTypes:o["inferred-types"],catalog:o.catalog,checkedDataType:o["checked-data-type"],sortable:o["index?"]&&!!o["checked-data-type"],onDelete:o["on-delete"],onDeleteReverse:o["on-delete-reverse"]})}if(!o["reverse-identity"])continue;const[i,p,d,h]=o["reverse-identity"];if(r[p]&&h!==!1){const m=o.id+"-reverse";r[p].attrs[m]={id:o.id,isForward:!1,namespace:p,name:d,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],cardinality:o.cardinality,linkConfig:s,sortable:o["index?"]&&!!o["checked-data-type"],onDelete:o["on-delete"],onDeleteReverse:o["on-delete-reverse"],catalog:o.catalog,checkedDataType:o["checked-data-type"]}}}return Object.values(r).map(o=>({...o,attrs:Object.values(o.attrs).sort(cr)})).sort(cr)}function cr(e,r){return e.name==="id"?-1:r.name==="id"?1:e.name<r.name?-1:e.name>r.name?1:0}function Ua(e,r,a){return r||(e?[]:a)}function Pa(e,r){const a={};return e&&(a[e[0]]=e[1]),r?.length&&(a.or=r.map(([n,o,s])=>{switch(o){case"=":return{[n]:s};case"$isNull":return{[n]:{[o]:!0}};default:return{[n]:{[o]:s}}}})),a}function Ga(e,r,a,n,o,s,i,p){const d=p?"asc":"desc",h=Pa(a,n),m=r?{[r.name]:{...Object.fromEntries(r.attrs.filter(g=>g.type==="ref").map(g=>[g.name,{$:{fields:["id"]}}])),$:{...h?{where:h}:{},...o?{limit:o}:{},...s?{offset:s}:{},order:{[i]:d}}}}:{},c=e.useQuery(m),l=e.useQuery(r?{[r.name]:{$:{aggregate:"count",...h?{where:h}:{}}}}:{}).aggregate?.[r?.name??""]?.count??null;return{itemsRes:c,allCount:l}}function Ha(e){const[r,a]=b.useState({namespaces:null,attrs:null});return e.useQuery({____explorer___:{}}),b.useEffect(()=>{function n(o){a({attrs:o,namespaces:qa(o)})}return e._core._reactor.subscribeAttrs(n)},[e]),r}const ur=e=>{const r=localStorage.getItem(`columnVisibility_${e}`);if(!r)return{};try{return JSON.parse(r)}catch(a){return console.error("Failed to parse column visibility",a),{}}},Wa=e=>{const[r,a]=b.useState(ur(e.appId));return b.useEffect(()=>{localStorage.setItem(`columnVisibility_${e.appId}`,JSON.stringify(r))},[e.appId,r]),b.useEffect(()=>{a(ur(e.appId))},[e.appId]),{visibility:r,setVisibility:a,attrs:e.attrs}};function pr(e){if(typeof window>"u")return;let r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{}}function Va(e,r){if(typeof window>"u")throw new Error("useLocalStorage/setState needs to run on the client");const a=JSON.stringify(r);try{window.localStorage.setItem(e,a)}catch{console.log("[localStorage] can't set k");return}window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:a}))}function Lt(e,r){const a=b.useRef(pr(e)||r),n=b.useCallback(s=>{const i=()=>{a.current=pr(e)||r,s()};return window.addEventListener("storage",i),()=>{window.removeEventListener("storage",i)}},[]);return[b.useSyncExternalStore(n,()=>a.current,()=>r),s=>Va(e,s)]}function Ka(e){const r=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"];let a=0;if(!e)return"0 bytes";for(;e>=1024&&a<r.length-1;)e/=1024,a++;return e.toFixed(2)+" "+r[a]}const Ya=(e,r)=>{const a=document.querySelector(`.th-${e}`);if(!a)throw new Error(`Element with class th-${e} not found`);const n=document.querySelectorAll(`span.td-${e}`),o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.top="-9999px",o.style.left="-9999px",o.style.width="auto",o.style.whiteSpace="nowrap",document.body.appendChild(o);try{const s=a.cloneNode(!0);s.style.display="inline-block",s.style.overflow="visible",s.style.width="auto",s.style.maxWidth="none",s.style.whiteSpace="nowrap",o.appendChild(s);const i=s.scrollWidth,p=Array.from(n).map(c=>{const u=c.cloneNode(!0);u.style.display="inline-block",u.style.overflow="visible",u.style.width="auto",u.style.maxWidth="none",u.style.whiteSpace="nowrap",o.appendChild(u);const l=u.scrollWidth;return o.removeChild(u),l}),d=p.length>0?Math.max(...p):0,m=Math.max(i,d)+12;return Math.min(m,r)}finally{document.body.removeChild(o)}};function Xa(){const e=b.useRef(null),[r,a]=b.useState(!1);return b.useLayoutEffect(()=>{const{current:n}=e;n&&(()=>{const s=n.scrollWidth>n.clientWidth||n.scrollHeight>n.clientHeight;a(s)})()},[e]),{ref:e,isOverflow:r,setIsOverflow:a}}const Za=({header:e,table:r,headerGroup:a,index:n,setMinViableColWidth:o,onSort:s,currentSortAttr:i,currentSortAsc:p})=>{const{attributes:d,setActivatorNodeRef:h,isDragging:m,listeners:c,setNodeRef:u,transform:l}=Te.useSortable({id:e.column.id,disabled:e.id==="select-col"}),g={opacity:m?.8:1,position:"relative",transform:e.id==="select-col"?void 0:kr.CSS.Translate.toString(l),transition:"width transform 0.2s ease-in-out",whiteSpace:"nowrap",width:e.column.getSize(),zIndex:m?1:0},x=!!e.column.columnDef?.meta?.sortable,w=typeof e.column.columnDef.header=="string"?e.column.columnDef.header:"",v=i===w||i==="serverCreatedAt"&&w==="id";return t.jsxs("div",{ref:u,className:Pe("group relative z-10 h-8 w-full whitespace-nowrap select-none"),style:{...g,width:e.getSize()!==0?e.getSize():void 0},children:[e.id!=="select-col"&&t.jsx("button",{className:"absolute inset-0 z-0 hover:cursor-grab active:cursor-grabbing",...d,...c,ref:h,style:{pointerEvents:"auto"}}),e.id==="select-col"?t.jsx("div",{className:`flex h-full w-full items-center px-2 py-1 th-${e.column.id}`,children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())}):t.jsxs("div",{className:"flex h-full items-stretch justify-between overflow-hidden",children:[t.jsx("div",{className:`flex shrink items-center gap-1 truncate px-2 py-1 font-semibold th-${e.column.id}`,children:x?t.jsxs("button",{className:"relative z-50 flex items-center gap-1 py-2 pr-5",onClick:()=>{s&&s(w==="id"?"serverCreatedAt":w,i,p)},children:[t.jsx("span",{className:A(v&&"underline"),children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())}),t.jsx("span",{className:"opacity-50 transition-opacity group-hover:opacity-70",style:{opacity:v?1:void 0,fontWeight:v?"bold":"normal"},children:v?p?t.jsx(J.ArrowUpIcon,{strokeWidth:3,width:10}):t.jsx(J.ArrowDownIcon,{strokeWidth:3,width:10}):t.jsx(J.ArrowsUpDownIcon,{strokeWidth:3,width:10})})]}):t.jsx(t.Fragment,{children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())})}),t.jsx("div",{className:"flex h-full items-center justify-between",children:t.jsx("div",{onDoubleClick:()=>o(e.column.id),onMouseDown:N=>(N.stopPropagation(),e.getResizeHandler()(N)),onTouchStart:e.getResizeHandler(),className:A(`resizer h-full flex justify-center z-50 ${r.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,a.headers.length-1==n&&"justify-end",e.id!=="select-col"&&"hover:cursor-col-resize"),style:{width:8,pointerEvents:"auto"},children:a.headers.length-1!==n&&t.jsx("div",{className:"h-full w-0.5 bg-neutral-200 dark:bg-neutral-700"})})})]})]},e.id)},Ja=({cell:e})=>{const r=e.column.getIsResizing(),{history:a}=xt(),{setDialog:n}=$t(),o=e.column.columnDef.meta,s=o?.editable&&o.attr&&!o?.isLink,{isDragging:i,setNodeRef:p,transform:d}=Te.useSortable({id:e.column.id,disabled:e.column.id==="select-col"}),[h,m]=b.useState(!1),{ref:c,isOverflow:u,setIsOverflow:l}=Xa(),g=e.getValue(),f=(u||be.isObject(g))&&!o?.isLink;b.useEffect(()=>{const C=c.current;if(!C)return;const O=()=>{l(C.scrollWidth>C.clientWidth||C.scrollHeight>C.clientHeight)};O();const M=new ResizeObserver(O);return M.observe(C),()=>{M.disconnect()}},[g,e.column.getSize(),l]);const x={opacity:i?.8:1,position:"relative",transform:e.column.id==="select-col"?void 0:kr.CSS.Translate.toString(d),transition:"width transform 0.2s ease-in-out",width:e.column.getSize(),zIndex:i?1:0},w=o?.disablePadding??!1,v=e.column.id==="select-col",N=o?.isLink&&o.attr&&Array.isArray(g)&&g.length>0,T=o?.copyable&&Qa(g,o),F=t.jsxs("div",{ref:p,style:{...x,...v||w?{}:{padding:"0.5rem"}},className:A("group/cell relative flex min-w-0 cursor-default items-center whitespace-nowrap",v&&"px-2 py-1"),children:[t.jsx("span",{ref:v?void 0:c,className:A(`h-full min-h-full min-w-0 td-${e.column.id}`,v?"flex w-full items-center gap-2 overflow-visible":A("min-w-0 flex-1 truncate",(N||T)&&"cursor-pointer"),!v&&(w?"":"pr-2"),s&&"pr-6"),onClick:v?void 0:()=>{if(N&&o?.attr){const C=o.attr,O=C.linkConfig[C.isForward?"reverse":"forward"];if(O){a.push({namespace:O.namespace,where:[`${O.attr}.id`,e.row.original.id]});return}}T&&ot(Cr(g))&&(m(!0),setTimeout(()=>m(!1),1e3))},children:h?t.jsx("div",{className:"h-1",children:"Copied!"}):_e.flexRender(e.column.columnDef.cell,e.getContext())}),s?t.jsx("button",{type:"button",title:`Edit ${o.attr.name}`,className:"absolute top-1/2 right-1 z-20 -translate-y-1/2 rounded-xs p-0.5 opacity-0 transition-opacity group-hover/cell:opacity-100 hover:bg-neutral-100 focus-visible:bg-neutral-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-neutral-400 focus-visible:outline-hidden dark:hover:bg-neutral-700 dark:focus-visible:bg-neutral-700 dark:focus-visible:ring-neutral-500",onClick:C=>{C.stopPropagation(),n({type:"edit-row",rowId:e.row.original.id,focusAttr:o.attr.name})},children:t.jsx(J.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})}):null]},e.id);return v?F:t.jsxs(He,{delayDuration:400,children:[" ",t.jsx(We,{className:"text-left",asChild:!0,children:F}),f&&!r&&t.jsx(Ve,{collisionPadding:10,className:A("max-h-[min(50vh,var(--radix-popper-available-height))] max-w-[min(75rem,80vw)] min-w-0 overflow-x-hidden overflow-y-auto wrap-break-word whitespace-pre-wrap [&_code]:wrap-break-word [&_pre]:wrap-break-word [&_pre]:whitespace-pre-wrap",be.isObject(g)&&"p-0"),side:"bottom",children:typeof g=="string"?_e.flexRender(e.column.columnDef.cell,e.getContext()):t.jsx(en,{pretty:!0,data:g})})]})};function Qa(e,r){return e==null?!1:r?.isLink?Array.isArray(e)&&e.length>0:Array.isArray(e)?e.length>0:be.isObject(e)?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!0}function Cr(e,r){return be.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function en({data:e,pretty:r}){const a=Cr(e,r),n=he();return r&&be.isObject(e)?t.jsx(St,{darkMode:n.darkMode,code:a,language:"json"}):t.jsx(t.Fragment,{children:a})}const tn=({visiblity:e,localDates:r,setLocalDates:a})=>{const[n,o]=b.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(dt,{icon:t.jsx(J.Cog6ToothIcon,{width:16}),label:"View Settings",onClick:()=>o(!0)}),t.jsxs(ke,{title:"Explorer View Settings",hideCloseButton:!0,onClose:()=>o(!1),open:n,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-lg",children:"Explorer View Settings"}),t.jsx("button",{onClick:()=>o(!1),children:t.jsx(J.XMarkIcon,{className:"h-4 w-4 cursor-pointer"})})]}),t.jsxs("div",{className:"py-2",children:[t.jsx("div",{children:"Visible Columns"}),t.jsx("div",{className:"py-1",children:e.attrs?.map(s=>t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{label:s.name,checked:e.visibility[s.id+s.name]!==!1,onChange:i=>e.setVisibility(p=>({...p,[s.id+s.name]:i}))})},s.id+s.name))})]}),t.jsx(ct,{className:"py-2"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{children:"Show Dates in Local Time"}),t.jsx(rr,{onClick:s=>{a(!r)},checked:r})]}),t.jsx("div",{className:"text-xs opacity-40",children:"Copy to clipboard will still use the original value."})]})]})};async function rn({appId:e,attrId:r,jobType:a,checkedDataType:n,apiURI:o},s){return(await(await fetch(`${o}/dash/apps/${e}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json"},body:JSON.stringify({"app-id":e,"attr-id":r,"job-type":a,"checked-data-type":n})})).json()).job}function Rr(e,r,a,n){let o=!1,s=!1,i=20,p=null;const d=m=>{if(m!==p)return i=20,p=m,i;const c=i;return i=Math.min(1e4,i*2),c},h=async m=>{for(;!o&&!s;)try{const u=await(await fetch(`${n}/dash/apps/${e}/indexing-jobs/${r}`,{headers:{authorization:`Bearer ${a}`}})).text(),g=JSON.parse(u).job;if(m(g),g.job_status!=="processing"&&g.job_status!=="waiting")return g;await new Promise(f=>setTimeout(f,d(u)))}catch(c){console.error("Job polling error:",c),s=!0,m(null,c)}};return{start:async m=>h(m),stop:()=>{o=!0}}}function Ce(e){return e.job_status==="errored"}function Re(e){return e.job_status==="completed"||e.job_status==="errored"}const an=({attr:e,appId:r,isRequired:a,isIndexed:n,isUnique:o,checkedDataType:s,token:i})=>{const[p,d]=b.useState({}),[h,m]=b.useState({}),[c,u]=b.useState({}),l=he();b.useEffect(()=>{Object.values(h).some(N=>N.job_status!=="completed"&&N.job_status!=="errored")||(a===e.isRequired?d(N=>({...N,require:void 0})):a?d(N=>({...N,require:{jobType:"required"}})):a||d(N=>({...N,require:{jobType:"remove-required"}})),n===e.isIndex?d(N=>({...N,index:void 0})):n?d(N=>({...N,index:{jobType:"index"}})):n||d(N=>({...N,index:{jobType:"remove-index"}})),o===e.isUniq?d(N=>({...N,unique:void 0})):o?d(N=>({...N,unique:{jobType:"unique"}})):o||d(N=>({...N,unique:{jobType:"remove-unique"}})),s===(e.checkedDataType||"any")?d(N=>({...N,type:void 0})):d(s==="any"?N=>({...N,type:{jobType:"remove-data-type"}}):N=>({...N,type:{jobType:"check-data-type",checkedDataType:s}})))},[a,n,o,s,e,h]);const[g,f]=b.useState(!1),x=async()=>{g||(m({}),f(!0),Object.entries(p).forEach(async([v,N])=>{if(!N)return;const F=await(await fetch(`${l.apiURI}/dash/apps/${r}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({"app-id":r,"attr-id":e.id,"job-type":N.jobType,"checked-data-type":N.checkedDataType})})).json();m(O=>({...O,[v]:F.job})),d(O=>({...O,[v]:void 0})),f(!1);const C=Rr(r,F.job.id,i,l.apiURI);await C.start((O,M)=>{if(!M&&O){const P=O.work_estimate??5e4,Q=O.work_completed??0,z=Math.floor(Q/P*100);u(B=>({...B,[v]:z})),m(B=>({...B,[v]:O}))}}),C.stop()}))},w=b.useMemo(()=>Object.values(c).filter(v=>v>0&&v<100).reduce((v,N)=>v+N,0)/Object.values(c).filter(v=>v>0&&v<100).length,[c]);return{isPending:Object.values(p).filter(Boolean).length>0,progress:w,isRunning:Object.values(h).some(v=>v.job_status!=="completed"&&v.job_status!=="errored"),pending:p,running:h,apply:x}},nn=()=>{const[e,r]=b.useState({});return{notes:e,setNote:(o,s)=>{r(i=>({...i,[o]:{message:s}}))},removeNote:o=>{r(s=>{const i={...s};return delete i[o],i})}}},on=(e,r,a)=>{const n=r.name,o=[];return r.attrs.forEach(s=>{o.push(["update-attr",{id:s.id,"forward-identity":[s.linkConfig.forward.id,e,s.linkConfig.forward.attr]}])}),a.forEach(s=>{s.attrs.forEach(i=>{i.linkConfig.reverse?.namespace===n&&o.push(["update-attr",{id:i.id,"reverse-identity":[i.linkConfig.reverse.id,e,i.linkConfig.reverse.attr]}])})}),o};function sn({db:e,namespace:r,namespaces:a,onClose:n,isSystemCatalogNs:o,screen:s,onScreenChange:i}){const d=he().appId,{history:h}=xt(),{mutate:m}=_t.useSWRConfig(),[c,u]=b.useState(!1),l=C=>{u(!1),i(C)},[g,f]=b.useState(r.name),[x,w]=b.useState(null);async function v(){const C=r.attrs.map(O=>["delete-attr",O.id]);await e.core._reactor.pushOps(C),setTimeout(()=>{m(["recently-deleted",d])},500),n({ok:!0})}async function N(C){if(C.startsWith("$")){w("Namespace name cannot start with $");return}const O=on(C,r,a);await e.core._reactor.pushOps(O),h.push({namespace:C},!0),pe("Renamed namespace to "+C),f(""),l({kind:"main"})}const T=nn(),F=b.useMemo(()=>{if(s.kind==="edit-attr")return r.attrs.find(C=>C.id===s.attrId&&C.isForward===s.isForward)},[s.kind==="edit-attr"?s.attrId:null,s.kind==="edit-attr"?s.isForward:null,r.attrs]);return c?t.jsx(Ir,{name:r.name,type:"namespace",onClose:n,onConfirm:v}):s.kind==="rename"?t.jsxs("div",{className:"px-2",children:[t.jsx("button",{onClick:()=>{l({kind:"main"})},className:"mb-3",children:t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer"})}),t.jsxs("h6",{className:"text-md pb-2 font-bold",children:["Rename ",r.name]}),t.jsxs("form",{onSubmit:C=>{C.preventDefault(),N(g)},children:[t.jsxs(lt,{className:"pb-2 text-sm",children:["This will immediately rename the namespace. You'll need to"," ",t.jsx("strong",{className:"dark:text-white",children:"update your code"})," to the new name."]}),t.jsx(Ie,{disabled:o,value:g,onChange:C=>f(C)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsxs(H,{type:"submit",disabled:g.startsWith("$")||g.length===0,children:["Rename ",r.name," → ",g]})})]})]}):s.kind==="main"?t.jsxs("div",{className:"flex flex-col gap-4 px-2",children:[t.jsxs("div",{className:"mr-8 flex gap-1",children:[t.jsx("h5",{className:"flex items-center text-lg font-bold",children:r.name}),t.jsx(dt,{variant:"subtle",onClick:()=>{l({kind:"rename"})},icon:t.jsx(U.PencilSquareIcon,{className:"h-4 w-4 opacity-50"}),label:"Rename"}),t.jsxs(H,{className:"ml-4",disabled:o,title:o?`The ${r.name} namespace can't be deleted.`:void 0,size:"mini",variant:"secondary",onClick:()=>u(!0),children:[t.jsx(U.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:r.attrs.map(C=>t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"py-0.5 font-bold",children:C.name}),T.notes[C.id]?.message&&t.jsx(yt,{children:t.jsx("div",{className:"px-2 text-xs text-gray-500 dark:text-neutral-400",children:T.notes[C.id].message})})]}),C.name!=="id"?t.jsx(H,{className:"px-2",size:"mini",variant:"subtle",onClick:()=>{T.removeNote(C.id),l({kind:"edit-attr",attrId:C.id,isForward:C.isForward})},children:"Edit"}):null]},C.id+"-"+C.name))}),t.jsx("div",{children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>l({kind:"add-attr",attrKind:"data"}),children:[t.jsx(U.PlusIcon,{className:"inline",height:"12px"}),"New attribute"]})}),t.jsx(Ta,{notes:T,db:e,appId:d,namespace:r})]}):s.kind==="add-attr"?t.jsx(ln,{db:e,namespace:r,namespaces:a,onClose:()=>l({kind:"main"}),constraints:gr({namespaceName:r.name,isSystemCatalogNs:o}),attrType:s.attrKind==="link"?"ref":"blob",onAttrTypeChange:C=>i({kind:"add-attr",attrKind:C==="ref"?"link":"data"})}):s.kind==="edit-attr"&&F?t.jsx(bn,{db:e,attr:F,onClose:()=>l({kind:"main"}),constraints:gr({namespaceName:r.name,isSystemCatalogNs:o,attr:F})}):null}function Ir({name:e,type:r,onClose:a,onConfirm:n}){return t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(U.ArrowLeftIcon,{height:"1rem",className:"cursor-pointer",onClick:()=>a()}),"Delete ",e]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("p",{className:"pb-2",children:["Are you sure you want to delete the ",t.jsx("strong",{children:e})," ",r,"?"]}),t.jsx(Se,{variant:"destructive",label:`Delete ${e}`,submitLabel:"Deleting...",errorMessage:"Failed to delete",onClick:n})]})]})}function ln({db:e,namespace:r,namespaces:a,onClose:n,constraints:o,attrType:s,onAttrTypeChange:i}){const[p,d]=b.useState(!1),[h,m]=b.useState(!1),[c,u]=b.useState(!1),[l,g]=b.useState(!1),[f,x]=b.useState(!1),[w,v]=b.useState(null),[N,T]=b.useState("many-many"),[F,C]=b.useState(()=>a.find(_=>_.name!==r.name)??a[0]),[O,M]=b.useState(""),[P,Q]=b.useState(r.name),z=N==="one-one"||N==="one-many",B=N==="one-one"||N==="many-one",X=Tr({attrName:O,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:F?.name}),ae=s==="blob"?O:X.isValidLink;b.useEffect(()=>{if(s!=="ref"||!F)return;const _=F.name===r.name;M(_?"parent":F.name),Q(_?"children":r.name),_&&T("one-many")},[s,F]);async function Z(){if(s==="blob"){const G=[["add-attr",{id:Ne.id(),"forward-identity":[Ne.id(),r.name,O],"value-type":"blob",cardinality:"one","unique?":c,"index?":h,"required?":p,"checked-data-type":w??void 0}]];await e._core._reactor.pushOps(G),n()}else{if(!F)throw new Error("No reverse namespace");const G=[["add-attr",{id:Ne.id(),...Dt[N],"forward-identity":[Ne.id(),r.name,O],"reverse-identity":[Ne.id(),F.name,P],"value-type":"ref","index?":!1,"required?":p,"on-delete":z&&l?"cascade":void 0,"on-delete-reverse":B&&f?"cascade":void 0}]];await e._core._reactor.pushOps(G),n()}}return t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer",onClick:n}),"Add an attribute"]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Type"}),t.jsx(Ht,{ariaLabel:"Text alignment",selectedId:s,items:[{id:"blob",label:"Data"},{id:"ref",label:"Link"}],onChange:_=>i(_.id)})]}),s==="blob"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Name"}),t.jsx(Ie,{value:O,onChange:_=>M(_)})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{disabled:o.require.disabled,checked:p,onChange:_=>d(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]}),title:o.require.message})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:h,onChange:_=>m(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Index this attribute"})," to improve lookup performance of values"]})})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:c,onChange:_=>u(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Enforce uniqueness"})," so no two entities can have the same value for this attribute"]})})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Enforce type"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(je,{value:w||"none",onChange:_=>{if(!_)return;const{value:G}=_;G==="none"&&v(null),v(G)},options:[{label:"Any (not enforced)",value:"none"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]})})]})]}):s==="ref"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Link to namespace"}),t.jsx(je,{value:F?.id??void 0,options:a.map(_=>({label:_.name+(_.name===r.name?" (self-link)":""),value:_.id})),onChange:_=>{if(!_)return;const G=a.find(W=>W.id===_.value);C(G)}})]}),t.jsx(Ar,{relationship:N,attrName:O,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:F?.name,setAttrName:M,setReverseAttrName:Q,setRelationship:T,isCascadeAllowed:z,isCascade:l,setIsCascade:g,isCascadeReverseAllowed:B,isCascadeReverse:f,setIsCascadeReverse:x,isRequired:p,setIsRequired:d,constraints:o})]}):null,t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{type:"submit",label:"Create attribute",submitLabel:"Creating attribute...",errorMessage:"Failed to create attribute",disabled:!ae,className:"border-gray-500 disabled:opacity-20",onClick:Z}),X.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})}function mt({indexingJob:e,attr:r,onClickSample:a}){if(e?.invalid_triples_sample?.length)return t.jsxs("div",{children:["Here are the first few invalid entities we found:",t.jsxs("table",{className:"dark:text-netural-500 mx-2 my-2 flex-1 text-left font-mono text-xs text-gray-500",children:[t.jsx("thead",{className:"bg-white text-gray-700 dark:bg-neutral-800 dark:text-white",children:t.jsxs("tr",{children:[t.jsx("th",{className:"pr-2",children:"id"}),t.jsx("th",{className:"max-w-fit pr-2",children:r.name}),t.jsx("th",{className:"pr-2",children:"type"})]})}),t.jsx("tbody",{children:e.invalid_triples_sample.slice(0,3).map((n,o)=>t.jsxs("tr",{className:"cursor-pointer rounded-md px-2 whitespace-nowrap hover:bg-gray-200",onClick:()=>a(n),children:[t.jsx("td",{className:"pr-2",children:t.jsx("pre",{children:n.entity_id})}),t.jsx("td",{className:"truncate pr-2",style:{maxWidth:"12rem"},children:JSON.stringify(n.value)}),t.jsx("td",{className:"pr-2",children:n.json_type})]},o))})]})]})}function st({indexingJob:e,attr:r,onClose:a}){const{history:n}=xt();if(e){if(e.error==="missing-required-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsxs("div",{children:[e.error_data?.count," ",t.jsx("code",{children:r.namespace})," ",e.error_data?.count===1?"entity does":"entities do"," ","not have ",t.jsx("code",{children:r.name})," set."]}),t.jsx(mt,{indexingJob:{...e,invalid_triples_sample:e.error_data&&e.error_data["entity-ids"]?.map(o=>({entity_id:String(o),value:null,json_type:r.checkedDataType||"null"}))},attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="triple-too-large-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"Some of the existing data is too large to index. "}),t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="invalid-triple-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsxs("div",{children:["The type can't be set to ",e?.checked_data_type," because some data is the wrong type."]}),t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="triple-not-unique-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"Some of the existing data is not unique. "}),e.invalid_unique_value!=null?t.jsxs("div",{children:["Found"," ",t.jsxs("span",{className:typeof e.invalid_unique_value=="object"?"":"cursor-pointer underline",onClick:typeof e.invalid_unique_value=="object"?void 0:()=>{n.push({namespace:r.namespace,where:[r.name,e.invalid_unique_value]}),a()},children:["multiple entities with value"," ",t.jsx("code",{children:JSON.stringify(e.invalid_unique_value)})]}),"."]}):null,t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error)return t.jsxs("div",{className:"mt-2 mb-2 space-y-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"An unexpected error occured while changing constraints. Please share these details with the Instant team:"}),t.jsxs("pre",{children:['id: "',e.id,'"']})]})}}function Ar({attrName:e,reverseAttrName:r,namespaceName:a,reverseNamespaceName:n,relationship:o,setAttrName:s,setReverseAttrName:i,setRelationship:p,isCascade:d,setIsCascade:h,isCascadeAllowed:m,isCascadeReverse:c,setIsCascadeReverse:u,isCascadeReverseAllowed:l,isRequired:g,setIsRequired:f,constraints:x}){const w=e&&n&&r;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:gap-2",children:[t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Forward attribute name"}),t.jsx(Ie,{disabled:x.attr.disabled,title:x.attr.message,value:e,onChange:v=>s(v)}),t.jsx("div",{className:"rounded-xs py-0.5 text-xs text-gray-500 dark:text-neutral-400",children:w?t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[a,".",e]})," ","will link to ",t.jsx("strong",{children:n})]}):t.jsx(t.Fragment,{children:" "})})]}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Reverse attribute name"}),t.jsx(Ie,{disabled:x.attr.disabled,title:x.attr.message,value:r,onChange:v=>i(v)}),t.jsx("div",{className:"rounded-xs py-0.5 text-xs text-gray-500 dark:text-neutral-400",children:w?t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[n,".",r]})," ","will link to ",t.jsx("strong",{children:a})]}):t.jsx(t.Fragment,{children:" "})})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Relationship"}),t.jsx(dn,{disabled:!w||x.attr.disabled,value:o,onChange:v=>{p(v.value)},namespace:a,reverseNamespace:n??"",attr:e,reverseAttr:r,title:x.attr.disabled?x.attr.message:void 0}),t.jsx("div",{className:"text-xs wrap-break-word text-gray-500 dark:text-neutral-400",children:w?cn[o](a,n,e,r):t.jsx(t.Fragment,{children:" "})})]}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:m&&d,disabled:!m||x.attr.disabled,onChange:h,title:x.attr.message,label:t.jsxs("span",{className:"dark:text-neutral-200",children:[t.jsx("div",{children:t.jsxs("strong",{children:["Cascade Delete ",n," → ",a]})}),"When a ",t.jsx("strong",{children:n})," entity is deleted, all linked ",t.jsx("strong",{children:a})," will be deleted automatically"]})})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:l&&c,disabled:!l||x.attr.disabled,onChange:u,title:x.attr.message,label:t.jsxs("span",{className:"dark:text-neutral-200",children:[t.jsx("div",{children:t.jsxs("strong",{children:["Cascade Delete ",a," → ",n]})}),"When a ",t.jsx("strong",{children:a})," entity is deleted, all linked ",t.jsx("strong",{children:n})," will be deleted automatically"]})})}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{disabled:x.require.disabled,title:x.require.message,checked:g,onChange:v=>f(v),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})})})]})]})}function dn({value:e,disabled:r,onChange:a,namespace:n,attr:o,reverseNamespace:s,reverseAttr:i,title:p}){return t.jsx(je,{disabled:r,value:e,onChange:d=>{d&&a(d)},options:[{label:"Many-to-many",value:"many-many"},{label:"One-to-one",value:"one-one"},{label:`${n} has-many ${o||"---"} / ${s} has-one ${i||"---"}`,value:"many-one"},{label:`${n} has-one ${o||"---"} / ${s} has-many ${i||"---"}`,value:"one-many"}],title:p})}const cn={"many-many":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have many ",t.jsx("strong",{children:a}),", and"," ",t.jsx("strong",{children:r})," can be associated with more than one"," ",t.jsx("strong",{children:n})]}),"one-one":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have only one ",t.jsx("strong",{children:a}),", and a"," ",t.jsx("strong",{children:r})," can only have one ",t.jsx("strong",{children:n})]}),"many-one":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have many ",t.jsx("strong",{children:a}),", but"," ",t.jsx("strong",{children:r})," can only have one ",t.jsx("strong",{children:n})]}),"one-many":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have only one ",t.jsx("strong",{children:a}),", but"," ",t.jsx("strong",{children:r})," can be associated with more than one"," ",t.jsx("strong",{children:n})]})};async function un({appId:e,attr:r,isRequired:a,authToken:n,setIndexingJob:o,stopFetchLoop:s,apiURI:i}){if(!n||a===r.isRequired)return;s.current?.();const p=`${r.namespace}.${r.name}`;try{const d=await rn({appId:e,attrId:r.id,jobType:a?"required":"remove-required",apiURI:i},n);o(d);const h=Rr(e,d.id,n,i);s.current=h.stop;const m=await h.start((c,u)=>{u&&ge(`Error while marking ${p} as required.`),c&&o(c)});if(m){if(m.job_status==="completed")return pe(a?`Marked ${p} as required.`:`Marked ${p} as optional.`),"completed";if(m.job_status==="canceled")return ge("Marking required was canceled."),"canceled";if(m.job_status==="errored")return m.error==="invalid-triple-error"?ge(`Found invalid data while updating ${p}.`):ge(`Encountered an error while updating ${p}.`),"errored"}}catch(d){return console.error(d),ge(`Unexpected error while updating ${p}`),"errored"}}const pn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=!r||Re(r),d=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.checkedDataType||"any")},[r]),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs("h6",{className:"text-md font-bold",children:["Enforce type"," ",t.jsx(yt,{children:t.jsx("div",{className:"w-48 text-sm",children:"Checks the type on all existing entities and enforces the type when entities are created or updated."})})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(je,{className:A(e&&"border-[#606AF4] ring-1 ring-[#606AF4] ring-inset focus:ring-[#606AF4]"),disabled:o||r&&!Re(r),title:o?s:void 0,value:a,onChange:h=>{h&&n(h.value)},options:[{label:"Any (not enforced)",value:"any"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]}),e&&p&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(i.checkedDataType||"any")},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:d})]})},gn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isRequired||!1)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},hn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isIndex)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Index this attribute"})," to improve lookup performance of values"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},fn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isUniq)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Enforce uniqueness"})," so no two entities can have the same value for this attribute"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},mn=({appId:e,attr:r,constraints:a})=>{const[n,o]=b.useState(r.isRequired||!1),[s,i]=b.useState(r.isIndex),[p,d]=b.useState(r.isUniq),[h,m]=b.useState(r.checkedDataType||"any"),c=he(),{isPending:u,pending:l,apply:g,isRunning:f,running:x,progress:w}=an({attr:r,appId:e,token:c.adminToken,isRequired:n,isIndexed:s,isUnique:p,checkedDataType:h});return t.jsx("div",{children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx(gn,{pendingJob:l.require,runningJob:x.require,value:n,setValue:o,disabled:a.require.disabled,disabledReason:a.require.message,attr:r}),t.jsx(hn,{pendingJob:l.index,runningJob:x.index,value:s,setValue:i,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(fn,{pendingJob:l.unique,runningJob:x.unique,value:p,setValue:d,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(pn,{pendingJob:l.type,runningJob:x.type,value:h,setValue:m,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Xt,{loading:f,percentage:f&&w||0,variant:u||f?"primary":"secondary",className:"border",onClick:()=>g(),disabled:!u||f,children:f?"Updating Constraints...":"Update Constraints"})]})})};function bn({db:e,attr:r,onClose:a,constraints:n}){const s=he().appId,{mutate:i}=_t.useSWRConfig(),[p,d]=b.useState({type:"main"}),[h,m]=b.useState(r.linkConfig.forward.attr),[c,u]=b.useState(r.linkConfig.reverse?.attr),[l,g]=b.useState(()=>{const W=`${r.cardinality}-${r.isUniq}`;return Nr[W]}),f=he(),[x,w]=b.useState(()=>r.onDelete==="cascade"),[v,N]=b.useState(()=>r.onDeleteReverse==="cascade"),[T,F]=b.useState(r.isRequired||!1),[C,O]=b.useState(T),[M,P]=b.useState(null),Q=b.useRef(null),z=re.useClose();b.useEffect(()=>()=>Q.current?.(),[Q]);const B=l==="one-one"||l==="one-many",X=l==="one-one"||l==="many-one",ae=Tr({attrName:h,reverseAttrName:c,namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse?.namespace});async function Z(){if(!r.linkConfig.reverse)throw new Error("No reverse link config");if(T!==C&&await un({appId:s,attr:r,isRequired:T,authToken:f.adminToken,setIndexingJob:P,stopFetchLoop:Q,apiURI:f.apiURI})!="completed")return;const W=[["update-attr",{id:r.id,...Dt[l],"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,h],"reverse-identity":[r.linkConfig.reverse.id,r.linkConfig.reverse.namespace,c],"on-delete":B&&x?"cascade":null,"on-delete-reverse":X&&v?"cascade":null}]];await e.core._reactor.pushOps(W),T==C&&pe("Updated attribute")}async function _(){const W=[["update-attr",{id:r.id,"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,h]}]];await e.core._reactor.pushOps(W),pe("Renamed attribute")}async function G(){await e.core._reactor.pushOps([["delete-attr",r.id]]),setTimeout(()=>{i(["recently-deleted",s])},500),a()}return p.type==="delete"?t.jsx(Ir,{onConfirm:G,onClose:a,name:r.name,type:"attribute"}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"mr-8 flex gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer",onClick:a}),t.jsxs("h5",{className:"flex items-center text-lg font-bold",children:["Edit ",r.namespace,".",r.name]})]}),t.jsxs(H,{disabled:n.attr.disabled,title:n.attr.message,variant:"secondary",size:"mini",onClick:()=>d({type:"delete"}),children:[t.jsx(U.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),r.type==="blob"?t.jsxs(t.Fragment,{children:[t.jsx(mn,{appId:s,attr:r,constraints:n}),t.jsx(ct,{}),t.jsxs(xe,{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Rename"}),t.jsxs(lt,{className:"text-sm",children:["This will immediately rename the attribute. You'll need to"," ",t.jsx("strong",{className:"dark:text-white",children:"update your code"})," to the new name."]}),t.jsx(Ie,{disabled:n.attr.disabled,title:n.attr.message,value:h,onChange:W=>m(W)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsx(Se,{type:"submit",label:`Rename ${r.name} → ${h}`,submitLabel:"Renaming attribute...",errorMessage:"Failed to rename attribute",disabled:n.attr.disabled||!h||h===r.name,title:n.attr.message,onClick:_})})]})]}):t.jsxs(xe,{className:"flex flex-col gap-6",children:[t.jsx(Ar,{relationship:l,attrName:h,reverseAttrName:c??"",namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse.namespace,setAttrName:m,setReverseAttrName:u,setRelationship:g,isCascadeAllowed:B,isCascade:x,setIsCascade:w,isCascadeReverseAllowed:X,isCascadeReverse:v,setIsCascadeReverse:N,isRequired:T,setIsRequired:F,constraints:n}),t.jsx(st,{indexingJob:M,attr:r,onClose:()=>{z(),a()}}),t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Se,{disabled:n.attr.disabled||!ae.isValidLink,type:"submit",label:"Update relationship",submitLabel:"Updating relationship...",errorMessage:"Failed to update relationship",onClick:Z,title:n.attr.message}),ae.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})]})}function Tr({reverseNamespaceName:e,namespaceName:r,attrName:a,reverseAttrName:n}){const o=e&&e===r,s=a&&r&&e&&n,i=a!==n;return{isSelfLink:o,isNonEmptyLink:s,isValidLink:s&&(o?i:!0),shouldShowSelfLinkNameError:s&&o&&!i}}function gr({namespaceName:e,isSystemCatalogNs:r,attr:a}){const n=a?.catalog==="system",o=a?`${a.namespace}.${a.name} is managed by the system and can't be edited`:void 0,s=n?o:r?`The ${e} namespace is managed by the system and can't modify required constraints yet.`:void 0;return{attr:{disabled:n||!1,message:o},require:{disabled:n||r,message:s}}}const nt=[{value:"string",label:"string"},{value:"number",label:"number"},{value:"boolean",label:"boolean"},{value:"json",label:"json"}];function xn({onSave:e,onChange:r,onKeyDown:a,...n}){const o=b.useRef(null),s=i=>{const p=i.closest(".overflow-y-auto"),d=p?.scrollTop||0;i.style.height="auto",i.style.height=i.scrollHeight+"px",p&&(p.scrollTop=d)};return b.useEffect(()=>{o.current&&(s(o.current),o.current&&s(o.current))},[n.value]),t.jsx("textarea",{ref:o,className:"flex min-h-[34px] w-full flex-1 resize-none overflow-hidden rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800 dark:placeholder:text-neutral-500",rows:1,placeholder:"hello world (Shift+Enter for new line)",...n,onChange:i=>{r?.(i),s(i.target)},onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&e&&(i.preventDefault(),e()),a?.(i)}})}const Rt={string:"",number:0,boolean:!1,json:{}};function wn(e){return e?e==="date"?nt.filter(r=>r.value==="string"||r.value==="number"):nt.filter(r=>r.value===e):nt}const Or=e=>!!e&&typeof e=="object";function vn(e){try{return JSON.parse(e),!0}catch{return!1}}function yn(e){try{return JSON.parse(e)}catch{return e}}function kn(e,r){if(e.checkedDataType)return e.checkedDataType==="date"?"string":e.checkedDataType;if(r!=null){const a=Or(r)?"json":typeof r,n=nt.find(o=>o.value===a);if(n)return n.value}return e.inferredTypes?.length?e.inferredTypes[0]:nt[0].value}function hr(e,r){if(e===null)return null;if(r==="number"){const a=String(e).replace(/[^\d.-]/g,"");if(a===""||a==="-"||a==="."||a==="-.")return a;const n=a.match(/^(-?\d*\.?\d*)\.?$/);return n?Number(n[0]):""}else{if(r==="boolean")return e==="true";if(r==="string")return Or(e)?JSON.stringify(e):String(e);if(r==="json")return yn(e)}return e}function jn(e){return ya.validate(e)?null:"Invalid UUID."}const It="This field is required.";function Sn(e,r){if(r==null)return!0;switch(e){case"string":return String(r).trim()==="";case"number":return r===""?!0:typeof r=="string"?r==="-"||r==="."||r==="-.":!1;case"boolean":case"json":return!1;default:return!1}}function Nn(e,r,a){const n=(e[r]||[]).filter(s=>a?.[s.id]?.action!=="unlink").length,o=Object.values(a||{}).filter(s=>s.action==="link").length;return n+o}function fr({db:e,namespace:r,item:a}){const[n,o]=b.useState(!1),[s,i]=b.useState(!1),{data:p,isLoading:d}=e.useQuery(n||s?{[r.name]:{$:{where:{id:a.id}}}}:null);return t.jsx(ue.Provider,{children:t.jsxs(ue.Root,{delayDuration:0,open:n,children:[t.jsx(ue.Trigger,{asChild:!0,onMouseEnter:()=>i(!0),onTouchStart:()=>i(!0),children:t.jsx("span",{children:t.jsx(H,{size:"mini",variant:"subtle",onClick:()=>o(h=>!h),children:t.jsx(U.InformationCircleIcon,{height:14})})})}),t.jsx(ue.Content,{collisionPadding:10,side:"bottom",children:t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"bg-opacity-90 max-w-md overflow-auto border bg-white p-2 font-mono text-xs whitespace-pre shadow-md backdrop-blur-xs dark:border-neutral-700 dark:bg-neutral-800",style:{maxHeight:"var(--radix-popper-available-height)"},children:JSON.stringify(p?.[r.name]?.[0]||a,null,2)}),d?t.jsx("div",{className:"absolute top-0 right-0 animate-spin p-2 opacity-50",children:t.jsx(U.Cog8ToothIcon,{width:12})}):null]})})]})})}function En({q:e,option:r,uniqueAttrs:a,filterableAttrs:n}){const[o,s]=b.useState(!1);return t.jsx(re.ComboboxOption,{value:r,className:Pe("cursor-pointer px-3 py-1 data-focus:bg-blue-100 dark:border-neutral-700 dark:bg-neutral-800",{}),children:t.jsx(ue.Provider,{children:t.jsxs(ue.Root,{delayDuration:0,open:o,children:[t.jsx(ue.Trigger,{asChild:!0,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:t.jsxs("div",{children:[t.jsx("div",{children:t.jsx("code",{children:r.id})}),t.jsxs("div",{className:"truncate",children:[n.filter(i=>r.hasOwnProperty(i.name)&&!i.isUniq&&e&&JSON.stringify(r[i.name]).toLowerCase().indexOf(e.toLowerCase())!==-1).slice(0,3).map(i=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:i.name}),":"," ",JSON.stringify(r[i.name])]},i.id)),a.filter(i=>r.hasOwnProperty(i.name)).slice(0,3).map(i=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:i.name}),":"," ",JSON.stringify(r[i.name])]},i.id))]})]})}),t.jsx(ue.Content,{collisionPadding:10,children:t.jsx("div",{className:"bg-opacity-90 max-w-md overflow-auto border bg-white p-2 font-mono text-xs whitespace-pre shadow-md backdrop-blur-xs dark:border-neutral-700 dark:bg-neutral-800",style:{maxHeight:"var(--radix-popper-available-height)"},children:JSON.stringify(r,null,2)})})]})})},r.id)}function Cn({db:e,namespace:r,onLinkRef:a,ignoreIds:n,onClose:o}){const[s,i]=b.useState(""),p=b.useRef(null),{uniqueAttrs:d,filterableAttrs:h}=b.useMemo(()=>{const g=[],f=[];for(const[x,w]of Object.entries(r.attrs))w.isUniq&&w.name!=="id"&&w.type==="blob"&&g.push(w),w.isIndex&&(w.checkedDataType==="string"||w.checkedDataType==="number")&&f.push(w);return{uniqueAttrs:g,filterableAttrs:f}},[r.attrs]),m=b.useMemo(()=>{const g=[{$entityIdStartsWith:s}];let f;try{const x=JSON.parse(s);typeof x=="number"&&(f=x)}catch{}for(const x of h)x.checkedDataType==="string"&&s.trim()&&g.push({[x.name]:{$ilike:`%${s.trim()}%`}}),x.checkedDataType==="number"&&f!=null&&g.push({[x.name]:f});for(const x of d)x.checkedDataType||(g.push({[x.name]:s}),f!=null&&g.push({[x.name]:f}));return{[r.name]:{$:{where:{or:g},limit:20}}}},[r.name,h,s]),{data:c,isLoading:u}=e.useQuery(m),l=c?.[r.name]?.filter(g=>!n.has(g.id));return t.jsx("div",{className:"relative mt-1 w-full",children:t.jsxs(re.Combobox,{onChange:g=>{g&&(a(g),i(""),o())},onClose:o,immediate:!0,children:[t.jsx(re.ComboboxInput,{ref:p,autoFocus:!0,size:32,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-800 dark:placeholder:text-neutral-500",value:s,onChange:g=>{i(g.target.value)},placeholder:`Search ${r.name}...`}),t.jsx(re.ComboboxOptions,{portal:!1,unmount:!1,static:!0,className:"absolute left-0 z-10 mt-1 max-h-[25vh] w-full divide-y overflow-scroll rounded-md border border-gray-300 bg-white shadow-lg empty:invisible dark:border-neutral-700 dark:bg-neutral-800",children:(l||[]).map(g=>t.jsx(En,{q:s,option:g,uniqueAttrs:d,filterableAttrs:h},g.id))}),l?.length||u?null:t.jsxs("div",{className:"absolute left-0 z-10 mt-1 w-full divide-y overflow-scroll rounded-md border border-gray-300 bg-white p-2 shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:["No matching rows in ",t.jsx("code",{children:r.name})]})]},u?"query-loading":"query-loaded")})}function Rn({db:e,item:r,attr:a,namespace:n,refUpdates:o,handleLinkRef:s,handleUnlinkRef:i}){const[p,d]=b.useState(!1),h=b.useMemo(()=>{const u=new Set;for(const[l]of Object.entries(o||{}))u.add(l);for(const l of r[a.name]||[])u.add(l.id);return u},[r[a.name],o]),m=a.cardinality,c=r[a.name]?.length>0;return t.jsxs(t.Fragment,{children:[r[a.name]?.map(u=>{const l=o?.[u.id]?.action==="unlink";return t.jsxs("div",{children:[t.jsx("code",{className:l?"line-through":"",children:u.id}),t.jsx(fr,{db:e,namespace:n,item:u}),t.jsx(H,{title:l?"Undo":"Unlink",type:"link",size:"mini",variant:l?"subtle":"destructive",className:"border-none",onClick:()=>l?s(a,u):i(a,u.id),children:l?t.jsx(U.ArrowUturnLeftIcon,{height:14}):t.jsx(U.TrashIcon,{height:14})})]},u.id)}),Object.entries(o||{}).map(([u,{action:l,item:g}])=>{if(l==="link")return t.jsxs("div",{children:[t.jsx("code",{children:u}),t.jsx(fr,{db:e,namespace:n,item:g}),t.jsx(H,{title:"Remove",type:"link",size:"mini",variant:"destructive",className:"border-none",onClick:()=>i(a,u),children:t.jsx(U.TrashIcon,{height:14})})]},u)}),p?t.jsx(Cn,{namespace:n,onLinkRef:u=>s(a,u),db:e,ignoreIds:h,onClose:()=>d(!1)}):t.jsx(H,{variant:"secondary",onClick:()=>d(!0),children:m==="many"||!c?"Add link":"Replace link"})]})}const _r=(e,r)=>{switch(e.name){case"$files":return r.type==="blob"&&r.name==="path";case"$streams":return!1;default:return r.type==="blob"}},Dr=e=>{switch(e.namespace){case"$streams":return!1;default:return e.type==="ref"}};function In(e,r){return r.name==="id"?!1:_r(e,r)||r.type==="ref"&&Dr(r)}function mr(e,r){if(r){const a=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollTop+=n.top-a.top-(a.height-n.height)/2;return}e.scrollIntoView({block:"center",inline:"nearest"})}function br({db:e,namespace:r,item:a,onClose:n,focusAttr:o}){const s=a.id?"edit":"add",i=he(),p=b.useRef(null),d=b.useRef({}),h=k=>I=>{d.current[k]=I},[m,c]=b.useState(null),u=[],l=[];for(const k of r.attrs)k.name!=="id"&&(_r(r,k)&&u.push(k),k.type==="ref"&&Dr(k)&&l.push(k));const g=u.reduce((k,I)=>{const E=a[I.name],D=kn(I,E),V=s==="add"?I.isRequired?Rt[D]:null:E;return{...k,[I.name]:{type:D,value:V,error:null}}},{}),[f,x]=b.useState({...g,...s==="add"?{id:{type:"string",value:Oe.id()}}:{}}),[w,v]=b.useState({}),[N,T]=b.useState({}),[F,C]=b.useState({}),[O,M]=b.useState(u.reduce((k,I)=>({...k,[I.name]:s==="edit"?a[I.name]===null||a[I.name]===void 0:f[I.name].value===null}),{})),P=Object.values(F).some(Boolean),Q=Object.values(f).some(k=>!!k.error)||P,[z,B]=b.useState(!1),X=k=>o===k;b.useLayoutEffect(()=>{if(!o)return;const k=d.current[o];k&&mr(k,p.current),f[o]?.type==="boolean"&&!O[o]&&k?.querySelector('[role="combobox"]')?.focus()},[o,f,O]),b.useLayoutEffect(()=>{if(!m)return;const k=d.current[m];k&&(mr(k,p.current),k.querySelector("input, textarea")?.focus()),c(null)},[m,O]);const ae=()=>{v({}),C({}),x({...g}),M(u.reduce((I,E)=>({...I,[E.name]:s==="edit"?a[E.name]===null||a[E.name]===void 0:!1}),{}));const k={};u.forEach(I=>{g[I.name]?.type==="json"&&a[I.name]!==void 0&&(k[I.name]=a[I.name]===null?"null":JSON.stringify(a[I.name],null,2))}),T(k),B(!1)},Z=(k,I)=>{x(E=>{const D=E[k]?.value;return{...E,[k]:{type:I,value:hr(D,I)}}})},_=(k,I,E)=>{let D=E?E(I):null;x(V=>{const ie=V[k]?.type||"string";return!D&&V[k]?.error===It&&(D=null),{...V,[k]:{type:ie,value:hr(I,ie),error:D}}})},G=(k,I)=>{T(E=>({...E,[k]:I})),x(E=>{const D=E[k]||{};return I===""?{...E,[k]:{type:"json",value:void 0,error:"Invalid JSON"}}:vn(I)?{...E,[k]:{type:"json",value:JSON.parse(I),error:null}}:{...E,[k]:{...D,type:"json",error:"Invalid JSON"}}})},W=(k,I)=>{M(D=>({...D,[k]:I}));const E=f[k]?.type||"string";I?(x(D=>({...D,[k]:{type:E,value:null,error:null}})),E==="json"&&T(D=>({...D,[k]:"null"}))):(x(D=>({...D,[k]:{type:E,value:Rt[E],error:null}})),E==="json"&&T(D=>({...D,[k]:"{}"})),c(k))},me=(k,I)=>{v(E=>{if(a[k.name]?.find($=>$.id===I))return{...E,[k.name]:{...E[k.name]||{},[I]:{action:"unlink",item:null}}};const{[I]:V,...ie}=E[k.name]||{};return{...E,[k.name]:ie}})},de=(k,I)=>{C(E=>E[k.name]?{...E,[k.name]:null}:E),v(E=>{const D=I.id,V=E[k.name]?.[D];if(V&&V.action==="unlink"){if(k.cardinality==="one"){const{[k.name]:Y,...ne}=E;return ne}const{[D]:ie,...$}=E[k.name];return{...E,[k.name]:$}}if(k.cardinality==="one"&&a[k.name]?.length){const ie=a[k.name][0];return{...E,[k.name]:{[D]:{action:"link",item:I},[ie.id]:{action:"unlink",item:null}}}}return{...E,[k.name]:{...E[k.name]||{},[D]:{action:"link",item:I}}}})},te=async()=>{const k={},I={};for(const $ of u){if(!$.isRequired)continue;const Y=f[$.name];(O[$.name]||Sn(Y?.type??"string",Y?.value))&&(k[$.name]=It)}for(const $ of l)$.isRequired&&Nn(a,$.name,w[$.name])===0&&(I[$.name]=It);const E=Object.keys(k).length>0||Object.keys(I).length>0,D=Object.values(f).some($=>!!$.error)||Object.values(F).some(Boolean);if(E||D){E&&(x($=>{const Y={...$};for(const[ne,K]of Object.entries(k))Y[ne]={...Y[ne],error:K};return Y}),C($=>({...$,...I}))),B(!0);return}const V=Object.fromEntries(Object.entries(f).map(([$,{value:Y}])=>[$,Y])),ie=a.id||V.id||Oe.id();delete V.id;try{let $=Oe.tx[r.name][ie];const Y=[],ne=[];for(const[K,ut]of Object.entries(w))for(const[Ke,{action:Ye}]of Object.entries(ut))Ye==="link"&&ne.push({[K]:Ke}),Ye==="unlink"&&Y.push({[K]:Ke});for(const K of Y)$=$.unlink(K);$=$.update(V);for(const K of ne)$=$.link(K);await e.transact($),n(),pe("Successfully updated row!")}catch($){const Y=$.message;if(Y)ge(`Failed to save row: ${Y}`);else throw $}};return t.jsxs(xe,{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 px-1",children:[t.jsx("h5",{className:"flex text-lg font-bold",children:s=="edit"?"Edit row":"Add row"}),t.jsx("code",{className:"font-mono text-sm font-medium text-gray-500 dark:text-neutral-500",children:s=="edit"?t.jsxs(t.Fragment,{children:[r.name,"['",a.id,"']"]}):t.jsx(t.Fragment,{children:r.name})})]}),t.jsx("div",{ref:p,className:"scrollbar-gutter-stable mt-4 min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[s==="add"?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx(De,{className:"font-mono",children:t.jsxs("div",{className:"flex gap-1",children:["id"," ",t.jsx(H,{type:"link",size:"mini",variant:"subtle",onClick:()=>_("id",Oe.id()),children:t.jsx(U.ArrowPathIcon,{height:14})})]})})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("input",{className:"flex w-full flex-1 rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800",value:f.id?.value??"",onChange:k=>_("id",k.target.value,jn)})})," ",f.id?.error&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:f.id.error})]},"id"):null,u.map((k,I)=>{const E=I+1,{type:D,value:V,error:ie}=f[k.name]||{type:"string",value:Rt.string},$=N[k.name]||(V!==null?JSON.stringify(V,null,2):"null"),Y=O[k.name],ne=X(k.name);return t.jsxs("div",{ref:h(k.name),className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(De,{className:"font-mono",children:k.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center",children:!k.isRequired&&t.jsx(se,{checked:Y,onChange:K=>W(k.name,K),label:t.jsx("span",{className:"text-[10px] text-gray-600 uppercase dark:text-neutral-600",children:"null"})})}),t.jsx(je,{className:"w-24 rounded-sm px-2 py-0.5 text-sm",value:D,options:wn(k.checkedDataType),onChange:K=>Z(k.name,K.value)})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[Y?t.jsx("button",{type:"button",autoFocus:ne,onClick:()=>W(k.name,!1),className:"flex-1 rounded-xs border border-gray-200 bg-gray-50 px-3 py-1 text-left text-gray-500 italic dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400",children:"null"}):t.jsxs("div",{className:"flex space-x-1",children:[t.jsx("div",{className:"flex-1",children:D==="json"?t.jsx("div",{className:"h-32 w-full rounded-sm border",children:t.jsx(jt,{darkMode:i.darkMode,tabIndex:E,language:"json",value:$,onChange:K=>G(k.name,K),onMount:K=>{ne&&K.focus()}})}):D==="boolean"?t.jsx(je,{tabIndex:E,value:V,options:[{value:"false",label:"false"},{value:"true",label:"true"}],onChange:K=>_(k.name,K.value)}):D==="number"?t.jsx("input",{tabIndex:E,type:"number",autoFocus:ne,className:"flex w-full flex-1 rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800",value:V??"",onChange:K=>_(k.name,K.target.value)}):t.jsx(xn,{tabIndex:E,autoFocus:ne,value:V??"",onChange:K=>_(k.name,K.target.value),onSave:te})}),k.checkedDataType==="date"&&t.jsxs(H,{variant:"subtle",size:"mini",onClick:()=>{_(k.name,D==="number"?Date.now():new Date().toISOString())},children:[t.jsx(J.ClockIcon,{height:14}),"now"]})]}),ie&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:ie})]})]},k.name)}),l.map((k,I)=>{const E=k.isForward?k.linkConfig.reverse.nsMap:k.linkConfig.forward.nsMap;return E?t.jsxs("div",{ref:h(k.name),className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(De,{className:"font-mono",children:k.name}),t.jsxs("span",{className:"rounded-sm px-2 py-0.5 text-sm",children:["Link to ",t.jsx("code",{children:E.name})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(Rn,{db:e,item:a,namespace:E,attr:k,refUpdates:w[k.name],handleLinkRef:de,handleUnlinkRef:me}),F[k.name]&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:F[k.name]})]})]},k.name):null})]})}),t.jsx("div",{className:"mt-2 shrink-0 border-t border-gray-200 bg-white px-1 pt-4 dark:border-neutral-700 dark:bg-neutral-800",children:t.jsxs("div",{className:"flex flex-row items-center justify-between gap-1",children:[z&&Q?t.jsx("span",{className:"text-sm font-medium text-red-500",children:"Failed to save. Please check above for errors."}):t.jsx("span",{}),t.jsxs("div",{className:"flex flex-row items-center gap-1",children:[t.jsx(H,{type:"button",variant:"secondary",onClick:ae,children:"Reset"}),t.jsx(Se,{tabIndex:u.length+1,type:"submit",variant:"primary",label:"Save",submitLabel:"Saving...",errorMessage:"Failed to save row.",onClick:te})]})]})})]})}const An=[];function Tn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(d=>d.id!=="select-col"&&d.header!==void 0&&!d.meta?.isLink),s=e.map(d=>{const h={};return o.forEach(m=>{const c=d[m.header];c==null?h[m.header]="":typeof c=="object"?h[m.header]=JSON.stringify(c):h[m.header]=c}),h}),i=Ct.mkConfig({fieldSeparator:",",filename:`${a}_export`,decimalSeparator:".",useKeysAsHeaders:!0}),p=Ct.generateCsv(i)(s);n?(Ct.download(i)(p),pe("CSV file downloaded")):(ot(p.toString()),pe("CSV copied to clipboard"))}function On(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(d=>d.id!=="select-col"&&d.header!==void 0&&!d.meta?.isLink),s=o.map(d=>d.header),i=e.map(d=>o.map(h=>{const m=d[h.header];return m==null?" ":typeof m=="object"?JSON.stringify(m):String(m)})),p=xa.markdownTable([s,...i]);if(n){const d=new Blob([p],{type:"text/markdown"}),h=URL.createObjectURL(d),m=document.createElement("a");m.href=h,m.download=`${a}_export.md`,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(h),pe("Markdown file downloaded")}else ot(p),pe("Markdown copied to clipboard")}function _n(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(p=>p.id!=="select-col"&&p.header!==void 0&&!p.meta?.isLink),s=e.map(p=>{const d={};return o.forEach(h=>{const m=p[h.header];d[h.header]=m}),d}),i=JSON.stringify(s,null,2);if(n){const p=new Blob([i],{type:"application/json"}),d=URL.createObjectURL(p),h=document.createElement("a");h.href=d,h.download=`${a}_export.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(d),pe("JSON file downloaded")}else ot(i),pe("JSON copied to clipboard")}const Dn=({db:e,namespaces:r})=>{const{explorerState:a,history:n}=xt(),o=he(),s=a,i=r.find(S=>S.id===s.namespace),[p,d]=b.useState(50),[h,m]=b.useState([]),[c,u]=b.useState(!1),[l,g]=b.useState(""),[f,x]=b.useState(!1),{dialog:w,setDialog:v}=$t(),N=w?.type==="edit-schema"?i??null:null,T=w?.type==="edit-row"?w.rowId:null,F=w?.type==="add-row",C=b.useRef(null),[O,M]=b.useState({}),P=b.useRef(null),Q=i?.name?.startsWith("$")??!1,z=i?.name??"",B=Q&&!["$users","$files","$streams"].includes(z),X=O[z]||0,ae=s?.sortAttr||"serverCreatedAt",Z=s?.sortAsc??!0,_=(S,j)=>{const R=ce.options.data.map(we=>we.id),L=R.indexOf(S),q=R.indexOf(C.current),[ee,le]=[Math.min(L,q),Math.max(L,q)];Le(we=>{const et={...we};for(let ze=ee;ze<=le;ze++){const ht=R[ze];j?et[ht]=!0:delete et[ht]}return et})},[G,W]=b.useState([]),{itemsRes:me,allCount:de}=Ga(e,i,s?.where,Ua(s?.where,s?.filters,G),p,X,ae,Z),te=me.data?.[i?.name??""]??An;function k(S,j){return S.filter(R=>j[R.id])}const I=de?Math.ceil(de/p):1,E=X/p+1,[D,V]=Lt("localDates",!1),ie=async()=>{try{if(u(!0),h.length===0)return;const[S]=h;await zn(o.adminToken,o.appId,S,l,o.apiURI)&&(m([]),g(""),P.current&&(P.current.value="")),pe("Successfully uploaded!")}catch(S){console.error("Failed to upload:",S),ge(`Failed to upload: ${S.body.message}`)}finally{u(!1)}},$=b.useMemo(()=>te,[te]),Y=b.useRef(null),[ne,K]=b.useState(0),[ut,Ke]=b.useState(1),[Ye,ar]=b.useState(!1),ta=S=>{if(ce?.getColumn(S)?.columnDef.header==="id"){nr(S,285);return}const j=Ya(S,800);nr(S,j)},nr=(S,j=200)=>{if(!i)return;const R={};i?.attrs.forEach(L=>{R[L.id+L.name]=ce.getColumn(L.id+L.name)?.getSize()||0}),ce.setColumnSizing({...R,[S]:j})},Xe=b.useMemo(()=>{const S=[];return S.push({id:"select-col",enableSorting:!1,accessorFn:()=>null,enableHiding:!1,enableResizing:!1,size:52,header:({table:j})=>t.jsx(se,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",style:{pointerEvents:"auto"},checked:j.getIsAllRowsSelected(),onChange:R=>{R?(j.toggleAllRowsSelected(),te.length>0&&(C.current=te[0].id)):(Le({}),C.current=null)}}),cell:({row:j,column:R})=>t.jsxs("div",{className:"flex h-full w-full items-center gap-2",children:[t.jsx(se,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",checked:j.getIsSelected(),onChange:(L,q)=>{(q.nativeEvent?q.nativeEvent.shiftKey:!1)&&C.current?_(j.id,q.target.checked):Le(le=>{const we={...le};return q.target.checked?we[j.id]=!0:delete we[j.id],we}),C.current=j.id}}),B?null:t.jsx("button",{type:"button",title:"Edit row",className:"rounded-xs p-0.5 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-neutral-100 dark:hover:bg-neutral-700",onClick:()=>v({type:"edit-row",rowId:j.id}),children:t.jsx(J.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})})]})}),i?.attrs?.forEach(j=>{S.push({id:j.id+j.name,header:j.name,enableSorting:!0,enableResizing:!0,accessorFn:R=>R[j.name],meta:{sortable:j.sortable||j.name==="id",copyable:!0,isLink:j.type==="ref",attr:j,disablePadding:j.namespace==="$files"&&j.name==="url",editable:!B&&i!=null&&In(i,j)},cell:R=>{if(R.row.original[j.name]===null||R.row.original[j.name]===void 0)return t.jsx("div",{className:"h-1",children:"-"});if(j.type==="ref"){const L=R.row.original[j.name].length;return t.jsxs("div",{className:A("h-1 translate-y-0.5",L<1&&"opacity-50"),children:[L," link",L===1?"":"s"]})}if(j.namespace==="$files"){if(j.name==="url")return t.jsx("a",{className:"h-full w-full pl-2 align-middle text-xs font-bold underline hover:text-black dark:hover:text-white",href:R.row.original.url,target:"_blank",children:"View File"});if(j.name==="size")return Ka(R.row.original[j.name])}if(j.checkedDataType==="boolean")return R.row.original[j.name]?"true":"false";if(j.checkedDataType==="date"){const L=Ne.coerceToDate(R.row.original[j.name]);return D&&L?.toLocaleString()||R.row.original[j.name]}return be.isObject(R.row.original[j.name])?t.jsx(Ln,{data:R.row.original[j.name]}):R.row.original[j.name]}})}),S},[i,B,D]),[ra,aa]=b.useState({}),na=()=>{const S=Object.entries(ce.getState().columnSizing).reduce((q,[ee,le])=>pt.visibility[ee]!==!1?{...q,[ee]:le}:q,{}),j=Y.current?.clientWidth||-1,R=Object.values(S).reduce((q,ee)=>q+ee,0),L=j-52-R;if(L>0){const q=Object.keys(S).length,ee=L/q;Object.keys(S).forEach(le=>{S[le]+=ee})}ar(!1),ce.setColumnSizing(()=>({...S}))},oa="onChange",sa="ltr",pt=Wa({appId:o.appId,attrs:i?.attrs,namespaceId:i?.id}),[Ze,gt]=b.useState(()=>Xe.map(S=>S.id));b.useLayoutEffect(()=>{if(i?.attrs){const S=localStorage.getItem(`order-${i.id}-${o.appId}`);if(S)gt(JSON.parse(S));else{const j=i.attrs.map(R=>R.id+R.name);gt(["select-col",...j])}}},[i?.attrs]),b.useEffect(()=>{i?.id&&localStorage.setItem(`order-${i.id}-${o.appId}`,JSON.stringify(Ze))},[Ze,i?.id]);const[Fe,Le]=b.useState({});b.useEffect(()=>{Le({}),W([]),C.current=null},[i?.id]);const Je=Object.keys(Fe).length,$e=z==="$files"?Je===1?"file":"files":Je===1?"row":"rows",ce=_e.useReactTable({columnResizeDirection:sa,columnResizeMode:oa,onColumnVisibilityChange:pt.setVisibility,columns:Xe,data:$,enableColumnResizing:!0,enableRowSelection:!0,getCoreRowModel:_e.getCoreRowModel(),getRowId:S=>S.id,onColumnOrderChange:gt,onRowSelectionChange:Le,onColumnSizingChange:aa,state:{columnSizing:ra,columnOrder:Ze,columnVisibility:pt.visibility,rowSelection:Fe}}),[Ae,Nt]=b.useState(!1);b.useEffect(()=>{const S=L=>{L.key==="Shift"&&Nt(!0)},j=L=>{L.key==="Shift"&&Nt(!1)},R=()=>{Nt(!1)};return window.addEventListener("keydown",S),window.addEventListener("keyup",j),window.addEventListener("blur",R),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",j),window.removeEventListener("blur-sm",R)}},[]);const[ia,Qe]=b.useState(!1);function la(S){const{active:j,over:R}=S;j&&R&&j.id!==R.id&&j.id!=="select-col"&&R.id!=="select-col"&&gt(L=>{const q=L.indexOf(j.id),ee=L.indexOf(R.id);return Te.arrayMove(L,q,ee)})}const Et=b.useMemo(()=>te.find(S=>S.id===T),[te.length,T]);b.useEffect(()=>{const S=Y.current;if(!S)return;const j=()=>{const q=ce.getCenterTotalSize(),ee=S.clientWidth;ar(q<ee-5);const{scrollLeft:le,scrollWidth:we,clientWidth:et}=S,ze=we-et;if(ze<=0){K(0),Ke(0);return}const ht=Math.min(le/30,1);K(ht);const ga=Math.min((ze-le)/30,1);Ke(ga)};j(),S.addEventListener("scroll",j);const R=new ResizeObserver(j);R.observe(S);const L=S.firstElementChild;return L&&R.observe(L),window.addEventListener("resize",j),()=>{S.removeEventListener("scroll",j),R.disconnect(),window.removeEventListener("resize",j)}},[i,$]);const da=ve.useSensors(ve.useSensor(ve.MouseSensor,{}),ve.useSensor(ve.TouchSensor,{}),ve.useSensor(ve.KeyboardSensor,{})),ca=n.items.length>=1,ua=S=>S==="id"?140:S==="url"?120:S.length*7.2+50;if(b.useLayoutEffect(()=>{if(i?.id){if(localStorage.getItem(`$sizing-${i.id}-${o.appId}`)){const q=JSON.parse(localStorage.getItem(`sizing-${i.id}-${o.appId}`)||"{}");ce.setColumnSizing(()=>({...q}));return}const S=Y.current?.clientWidth||-1,j={};i?.attrs.forEach(q=>{j[q.id+q.name]=ua(q.name)});const R=Object.values(j).reduce((q,ee)=>q+ee,0),L=S-52-R;if(L>0){const q=Object.keys(j).length,ee=L/q;Object.keys(j).forEach(le=>{j[le]+=ee})}ce.setColumnSizing(j)}},[Y.current,i]),!i)return null;const pa=i.id;return t.jsxs(t.Fragment,{children:[t.jsx(ke,{title:"Delete Rows",open:f,onClose:()=>x(!1),children:i?t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex text-lg font-bold",children:["Delete ",$e]}),t.jsxs(lt,{children:["Deleting is an"," ",t.jsx("strong",{className:"dark:text-white",children:"irreversible operation"})," ","and will"," ",t.jsxs("strong",{className:"dark:text-white",children:["delete ",Je," ",$e," "]}),"associated with"," ",t.jsx("strong",{className:"dark:text-white",children:i.name}),"."]}),t.jsx(Se,{type:"submit",disabled:B,label:`Delete ${$e}`,submitLabel:`Deleting ${$e}...`,errorMessage:`Failed to delete ${$e}`,className:"border-red-500 text-red-500",title:B?`The ${i?.name} namespace is read-only.`:void 0,onClick:async()=>{try{await e.transact(Object.keys(Fe).map(S=>Ne.tx[i.name][S].delete()))}catch(S){const j=S.message;ge(`Failed to delete ${$e}${j?`: ${j}`:""}`);return}Le({}),x(!1)}})]}):null}),t.jsx(ke,{title:"Add Row",open:F,onClose:()=>v(null),className:"flex max-h-[calc(100dvh-4rem)] flex-col overflow-hidden",children:i?t.jsx(br,{db:e,item:{},namespace:i,onClose:()=>v(null)}):null}),t.jsx(ke,{title:"Edit Row",open:!!Et,onClose:()=>v(null),className:"flex max-h-[calc(100dvh-4rem)] flex-col overflow-hidden",children:i&&Et?t.jsx(br,{db:e,namespace:i,item:Et,focusAttr:w?.type==="edit-row"?w.focusAttr:void 0,onClose:()=>v(null)}):null}),t.jsx(ke,{title:"Edit Namespace",stopFocusPropagation:!0,open:!!N,onClose:()=>v(null),children:i?t.jsx(sn,{readOnly:B,isSystemCatalogNs:Q,db:e,namespace:i,namespaces:r??[],screen:w?.type==="edit-schema"?w.screen:{kind:"main"},onScreenChange:S=>v({type:"edit-schema",screen:S},{history:"replace"}),onClose:S=>{v(null),S?.ok&&n.push({namespace:r?.[0].id})}}):null}),t.jsxs("div",{className:"flex flex-1 grow flex-col overflow-hidden bg-white dark:bg-neutral-800",children:[t.jsx("div",{className:"flex items-center overflow-hidden border-b border-b-gray-200 dark:border-neutral-700",children:t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-between py-2 md:flex-row md:items-center",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center self-stretch overflow-hidden border-b px-2 py-1 pl-4 md:border-b-0 dark:border-neutral-700",children:[ca?t.jsx(ye.ArrowLeftIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>n.pop()}):null,s.where?t.jsx(J.XMarkIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>{n.push({namespace:i.id},!0)}}):null,t.jsxs("div",{className:"relative min-w-0 flex-1 self-stretch [timeline-scope:--filter-scroll]",children:[t.jsxs("div",{className:"flex h-full items-center overflow-x-auto font-mono text-xs whitespace-nowrap [scroll-timeline:--filter-scroll_inline] dark:text-white",children:[t.jsx("strong",{children:i.name})," ",s.where?t.jsxs(t.Fragment,{children:[" where ",t.jsx("strong",{children:s.where[0]})," ="," ",t.jsx("em",{className:"rounded-xs border bg-white px-1 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",children:JSON.stringify(s.where[1])})]}):null,s?.filters?.length?t.jsx("span",{title:s.filters.map(([S,j,R])=>`${S} ${j} ${R}`).join(" || "),children:s.filters.map(([S,j,R],L)=>t.jsxs("span",{children:[t.jsxs("em",{className:"rounded-xs border bg-white px-1 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",children:[S," ",j," ",R]}),s?.filters?.length&&L<s.filters.length-1?" || ":null]},S))}):null]}),t.jsx("div",{"aria-hidden":"true",className:"filter-shadow-l pointer-events-none absolute top-0 bottom-0 left-0 w-[30px] bg-linear-to-r from-black/10 via-black/0 to-transparent"}),t.jsx("div",{"aria-hidden":"true",className:"filter-shadow-r pointer-events-none absolute top-0 right-0 bottom-0 w-[30px] bg-linear-to-l from-black/20 via-black/5 to-transparent"})]})]}),t.jsxs("div",{className:"flex justify-between gap-2 px-2 py-1 md:justify-start",children:[t.jsx(H,{className:"rounded-sm dark:bg-neutral-700/50",variant:"secondary",size:"mini",onClick:()=>{v({type:"edit-schema",screen:{kind:"main"}})},children:"Edit Schema"}),t.jsx(Ba,{onSearchChange:S=>{W(S),n.push(j=>({...j,filters:S.length?S:void 0}),!0)},attrs:i?.attrs,initialFilters:s?.filters||[]},pa)]})]})}),i.name==="$files"?t.jsx("div",{className:"flex gap-2 px-2 py-2",children:t.jsxs("div",{className:"flex w-full gap-2",children:[t.jsxs("div",{className:"flex shrink-0 gap-2",children:[t.jsx("input",{ref:P,type:"file",className:"flex cursor-pointer rounded-sm border border-neutral-200 bg-transparent px-1 pt-1.5 text-sm shadow-xs transition-colors file:rounded-xs file:border-none file:border-neutral-200 file:bg-transparent file:p-2 file:pt-1 file:text-sm file:font-medium file:shadow-none placeholder:text-neutral-500 focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:file:border-neutral-700 dark:file:text-white dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-400",onChange:S=>{const j=S.target.files;m(j),j?.[0]&&g(j[0].name)}}),t.jsx(H,{variant:"primary",disabled:h.length===0,size:"mini",loading:c,onClick:ie,className:"rounded-sm",children:c?"Uploading...":"Upload file"})]}),t.jsxs("div",{className:"relative flex max-w-[67vw] min-w-0 flex-1 rounded-sm border border-neutral-200 focus-within:ring-2 focus-within:ring-blue-700 dark:border-neutral-700 dark:focus-within:ring-blue-500",children:[t.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center rounded-l bg-neutral-100 px-3 text-sm text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400",children:"File Path:"}),t.jsx("input",{type:"text",placeholder:"Enter a custom path (optional)",value:l,onChange:S=>g(S.target.value),className:"h-9 w-full rounded-sm border-0 bg-transparent py-1 pr-3 pl-24 text-sm ring-0 placeholder:text-neutral-500 focus:outline-none dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-400"})]})]})}):null,t.jsxs("div",{className:"flex items-center justify-start space-x-2 border-b border-b-gray-200 p-1 text-xs dark:border-neutral-700 dark:text-white",children:[i.name!=="$files"?t.jsxs(H,{disabled:B,title:B?`The ${i?.name} namespace is read-only.`:void 0,size:"mini",variant:"secondary",onClick:()=>{v({type:"add-row"})},children:[t.jsx(ye.PlusIcon,{width:12}),"Add row"]}):null,t.jsx("div",{className:A("px-1",i.name==="$files"&&"pb-1"),children:t.jsx(je,{className:"rounded-sm text-xs",onChange:S=>{if(!S)return;const j=parseInt(S.value,10);d(j),n.push(R=>({...R,limit:j}))},value:`${p}`,options:[{label:"25/page",value:"25"},{label:"50/page",value:"50"},{label:"100/page",value:"100"}]})}),t.jsx("div",{className:"w-[62px]",children:de!==void 0&&(de===0?t.jsx(t.Fragment,{children:"No Results"}):t.jsxs(t.Fragment,{children:[(E-1)*p+1," -"," ",Math.min(de,E*p)," of ",de]}))}),t.jsx("button",{className:"flex items-center justify-center",disabled:E<=1,onClick:()=>{M({...O,[i.name]:Math.max(0,X-p)}),n.push(S=>({...S,page:Math.max(1,E-1)}))},children:t.jsx(ye.ArrowLeftIcon,{className:A("inline",{"opacity-40":E<=1}),height:"1rem"})}),t.jsx("div",{className:"flex items-center space-x-1 overflow-hidden",children:[...new Array(I)].map((S,j)=>{const R=j+1;return I>6&&R!==1&&R!==I&&R!==E&&R!==E-1&&R!==E+1?R===E-2||R===E+2?t.jsx("div",{children:"..."},R):null:t.jsx("button",{className:A("rounded-md px-3 py-1 text-neutral-600 dark:text-neutral-300",R===E?"bg-neutral-200 dark:bg-neutral-700":"hover:bg-neutral-100 dark:hover:bg-neutral-800"),onClick:()=>{M({...O,[i.name]:j*p}),n.push(L=>({...L,page:R}))},disabled:R===E,children:R},R)})}),t.jsx("button",{className:"flex items-center justify-center",disabled:E>=I,onClick:()=>{M({...O,[i.name]:X+p}),n.push(S=>({...S,page:Math.min(I,E+1)}))},children:t.jsx(ye.ArrowRightIcon,{className:A("inline",{"opacity-40":E>=I}),height:"1rem"})}),Je>0&&t.jsxs("div",{className:"flex items-center gap-2 pl-4",children:[t.jsxs(Jt,{open:ia,onOpenChange:Qe,children:[t.jsx(Qt,{children:t.jsxs(H,{onClick:()=>{Qe(!0)},variant:"secondary",children:[t.jsx(J.ArrowUpOnSquareIcon,{width:14}),"Export (",Je,")"]})}),t.jsxs(er,{className:"z-100",align:"end",side:"bottom",sideOffset:5,children:[t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);Tn(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.Table,{width:12}),Ae?"Download as CSV":"Copy as CSV"]}),t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);On(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.FileDown,{width:12}),Ae?"Download as Markdown":"Copy as Markdown"]}),t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);_n(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.CurlyBraces,{width:12}),Ae?"Download as JSON":"Copy as JSON"]}),!Ae&&t.jsxs(t.Fragment,{children:[t.jsx(tr,{}),t.jsx(Be,{className:"text-xs text-neutral-500 dark:text-neutral-400",disabled:!0,children:"Hold shift to download as file"})]})]})]}),t.jsxs(H,{onClick:()=>{x(!0)},className:"px-2",variant:"destructive",children:[t.jsx(J.TrashIcon,{width:14}),"Delete Selected Rows"]})]}),t.jsx("div",{className:"grow"}),t.jsx("div",{className:"px-2",children:t.jsx(tn,{localDates:D,setLocalDates:V,visiblity:pt})})]}),t.jsx(ve.DndContext,{collisionDetection:ve.closestCenter,modifiers:[wa.restrictToHorizontalAxis],onDragEnd:la,sensors:da,children:t.jsxs("div",{className:"relative flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-900/50",children:[!Ye&&t.jsx("div",{className:"absolute top-0 right-0 bottom-0 z-50 w-[30px] bg-linear-to-l from-black/20 via-black/5 to-transparent transition-opacity duration-150",style:{pointerEvents:"none",opacity:ut,display:ut==0?"none":void 0}}),t.jsx("div",{className:"absolute top-0 bottom-0 left-0 z-50 w-[30px] bg-linear-to-r from-black/10 via-black/0 to-transparent transition-opacity duration-150",style:{pointerEvents:"none",opacity:ne,display:ne==0?"none":void 0}}),t.jsx("div",{ref:Y,className:"h-full w-full overflow-auto",children:t.jsxs("div",{className:"flex w-max items-start",children:[t.jsxs("div",{style:{width:ce.getCenterTotalSize()},className:"z-0 text-left font-mono text-xs text-neutral-500 dark:text-neutral-400",children:[t.jsx("div",{className:"sticky top-0 z-10 border-r border-b border-gray-200 border-r-gray-200 bg-white text-neutral-700 shadow-sm dark:border-r-neutral-700 dark:border-b-neutral-600 dark:bg-[#303030] dark:text-neutral-300",children:ce.getHeaderGroups().map(S=>t.jsx("div",{className:"flex w-full",children:t.jsx(Te.SortableContext,{items:Ze,strategy:Te.horizontalListSortingStrategy,children:S.headers.map((j,R)=>t.jsx(Za,{header:j,table:ce,headerGroup:S,index:R,setMinViableColWidth:ta,onSort:(L,q,ee)=>{n.push(le=>({...le,sortAttr:L,sortAsc:q!==L?!0:!ee}))},currentSortAttr:s?.sortAttr,currentSortAsc:s?.sortAsc},j.id))})},S.id))}),t.jsx("div",{children:ce.getRowModel().rows.map(S=>t.jsx("div",{className:"group flex border-r border-b border-r-gray-200 border-b-gray-200 bg-white dark:border-neutral-700 dark:border-r-neutral-700 dark:bg-neutral-800",children:S.getVisibleCells().map(j=>t.jsx(Te.SortableContext,{items:Ze,strategy:Te.horizontalListSortingStrategy,children:t.jsx(Ja,{cell:j},j.id)},j.id))},S.id))})]}),Ye&&t.jsx("div",{className:"sticky top-0",children:t.jsx(dt,{className:"opacity-60",labelDirection:"bottom",label:"Fill Width",icon:t.jsx(ye.ArrowRightFromLine,{}),onClick:na})})]})})]})})]})]})};function Fn(e,r){return be.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function Ln({data:e,pretty:r}){const a=he(),n=Fn(e,r);return r&&be.isObject(e)?t.jsx(St,{darkMode:a.darkMode,code:n,language:"json"}):t.jsx(t.Fragment,{children:n})}async function $n(e,r){const a=await fetch(e,r),n=await a.json();return a.status===200?Promise.resolve(n):Promise.reject({status:a.status,body:n})}async function zn(e,r,a,n,o){const s={app_id:r,path:n||a.name,authorization:`Bearer ${e}`,"content-type":a.type};return await $n(`${o}/dash/apps/${r}/storage/upload`,{method:"PUT",headers:s,body:a})}function Bn(e,r){const a=n=>{e.current&&n.target instanceof HTMLElement&&!e.current.contains(n.target)&&r()};b.useEffect(()=>(document.addEventListener("click",a),()=>{document.removeEventListener("click",a)}))}const Mn=({namespaces:e,db:r,appId:a})=>{const n=he(),{dialog:o,setDialog:s}=$t(),i={open:o?.type==="recently-deleted-ns",onOpen:()=>s({type:"recently-deleted-ns"}),onClose:()=>s(null)},p={open:o?.type==="new-namespace",onOpen:()=>s({type:"new-namespace"}),onClose:()=>s(null)},d=e.find(x=>x.id===n.explorerState?.namespace),[h,m]=b.useState(!1),c=b.useRef(null),[u,l]=Lt(`${a}:recentExplorerNamespace`,d?.id||"");Bn(c,()=>{m(!1)}),b.useEffect(function(){d&&l(d.id)},[d,a,e]);const{setExplorerState:g}=n;b.useEffect(()=>{if(!d&&e.length>0){const w=(u?e.find(v=>v.id===u):void 0)?.id??e[0].id;g(v=>({...v??{},namespace:w}))}},[d,e,u,g]);const f=Er(n.appId);return t.jsxs("div",{className:A("relative flex w-full flex-1 overflow-hidden border-solid dark:bg-neutral-800",n.className),children:[t.jsx(ke,{title:"Recently Deleted Namespaces",...i,children:t.jsx(Aa,{appId:n.appId,db:r})}),t.jsx(ke,{title:"New Namespace",...p,children:t.jsx(Da,{db:r,onClose:x=>{p.onClose(),x?.name&&n.setExplorerState({namespace:x.name})}})}),t.jsxs("div",{ref:c,className:A("absolute top-0 bottom-0 left-0 z-40 flex min-w-[200px] flex-col gap-1 border-r border-solid border-r-gray-200 bg-white p-2 shadow-md md:static md:flex md:shadow-none dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",{hidden:!h}),children:[t.jsxs("div",{className:"flex items-center gap-1 text-sm font-semibold dark:text-white",children:[t.jsx(U.ChevronLeftIcon,{height:"1rem",className:"cursor-pointer md:hidden dark:text-white",onClick:()=>m(!1)}),"Namespaces"]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-hidden overflow-y-auto",children:e.length?t.jsx(Gt,{className:"text-sm",selectedId:n.explorerState?.namespace,items:e.map(x=>({id:x.id,label:x.name})),onChange:x=>{n.setExplorerState({namespace:x.id})}}):null}),t.jsxs(H,{variant:"secondary",size:"mini",className:"justify-center",onClick:p.onOpen,children:[t.jsx(U.PlusIcon,{height:"1rem"})," Create"]}),f.length?t.jsxs(H,{className:"justify-start gap-2 rounded-sm p-2",variant:"subtle",size:"nano",onClick:i.onOpen,children:[t.jsx("span",{className:"rounded-sm bg-gray-200 px-1 text-gray-700 dark:bg-neutral-700 dark:text-neutral-100",children:f.length}),t.jsx("span",{children:"Recently Deleted"})]}):null]}):t.jsx("div",{className:"animate-slow-pulse flex w-full flex-col gap-2",children:Array.from({length:3}).map((x,w)=>t.jsx("div",{className:"h-4 w-full rounded-md bg-neutral-300 dark:bg-neutral-700"},w))})]}),t.jsx("div",{className:"flex flex-col gap-2 border-r border-gray-300 bg-neutral-100 p-1 md:hidden dark:border-neutral-700 dark:bg-neutral-800",children:t.jsx("button",{className:"flex cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 select-none hover:bg-neutral-300 dark:hover:bg-neutral-700",onClick:x=>{x.stopPropagation(),m(!0)},children:t.jsx(U.Bars3Icon,{height:"1rem",className:"dark:text-white"})})}),n.explorerState&&t.jsx(Dn,{namespaces:e,db:r})]})},qn=({appId:e,apiURI:r,websocketURI:a,adminToken:n})=>b.useMemo(()=>Oe.init({appId:e,apiURI:r,websocketURI:a,__adminToken:n,disableValidation:!0,devtool:!1}),[e,r,a,n]);class Un extends b.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,a){console.error("Uncaught error:",r,a)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?t.jsxs("div",{className:"flex h-full w-full flex-1 flex-col items-center justify-center gap-4 bg-white p-6 dark:bg-neutral-800",children:[t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:t.jsx(J.ExclamationTriangleIcon,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Something went wrong"}),t.jsx("p",{className:"max-w-md text-sm text-gray-500 dark:text-neutral-400",children:"An unexpected error occurred. Please try again or contact support if the problem persists."})]}),this.state.error&&t.jsxs("details",{className:"mt-2 w-full max-w-md",children:[t.jsx("summary",{className:"cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-neutral-400 dark:hover:text-neutral-300",children:"Error details"}),t.jsx("pre",{className:"mt-2 overflow-auto rounded border border-gray-200 bg-gray-50 p-2 text-left font-mono text-xs text-gray-700 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300",children:this.state.error.message})]})]}),t.jsx("button",{onClick:this.handleRetry,className:"inline-flex cursor-pointer items-center justify-center gap-1 rounded-sm bg-[#606AF4] px-8 py-1 font-bold whitespace-nowrap text-white transition-all hover:bg-[#4543e9]",children:"Try again"})]}):this.props.children}}const bt=b.createContext({props:null,history:{push:()=>{},pop:()=>{},items:[]}}),he=()=>{const e=b.useContext(bt);if(!e.props)throw new Error("useExplorerProps must be used within an Explorer component");return e.props},xt=()=>{const e=b.useContext(bt);if(!e.props||!e.props.explorerState)throw new Error("useExplorerProps must be used within an Explorer component");return{explorerState:e.props.explorerState,history:e.history}},$t=()=>{const e=b.useContext(bt);if(!e.props)throw new Error("useExplorerDialog must be used within an Explorer component");const r=e.props,a=r.explorerState?.dialog??null,n=b.useCallback((o,s)=>{r.setExplorerState(i=>i&&{...i,dialog:o},s)},[r]);return{dialog:a,setDialog:n}},Fr=e=>e.explorerState!==void 0||e.setExplorerState!==void 0,Pn=(e,r,a)=>{const n=Fr(e);return{...e,apiURI:e.apiURI||ir.apiURI,websocketURI:e.websocketURI||ir.websocketURI,darkMode:e.darkMode===void 0?!1:e.darkMode,explorerState:n?e.explorerState??null:r,setExplorerState:e.setExplorerState||a,useShadowDOM:e.useShadowDOM===void 0?!0:e.useShadowDOM}},Gn=e=>{const[r,a]=b.useState(null),n=Pn(e,r,a);if(!n.adminToken)throw new Error("adminToken is required for explorer");if(!n.appId)throw new Error("appId is required for explorer");const{explorerState:o,setExplorerState:s}=n,[i,p]=b.useState([]),d=b.useCallback((x,w=!1)=>{p(v=>!w&&o?[...v,o]:v),s(x)},[o,s]),h=b.useCallback(()=>{p(x=>{if(x.length>0){const[w,...v]=x;return s(w),v}return x})},[s]),m=qn({appId:n.appId,apiURI:n.apiURI,websocketURI:n.websocketURI,adminToken:n.adminToken}),c=b.useRef(!0),u=b.useRef(n.appId);b.useEffect(()=>{if(c.current){c.current=!1;return}u.current!==n.appId&&(u.current=n.appId,p([]),Fr(e)||a(null))},[n.appId,e]);const l=Ha(m),g=b.useMemo(()=>({props:n,history:{push:d,pop:h,items:i}}),[n,d,h,i]),f=n.useShadowDOM?Lr:b.Fragment;return t.jsx(bt.Provider,{value:g,children:t.jsx(f,{children:t.jsx(Un,{children:t.jsx(Mn,{appId:n.appId,db:m,namespaces:l.namespaces||[]})})})})},zt=b.createContext({shadowRoot:null,container:null,darkMode:!1});function it(){return b.useContext(zt).container}function wt(){return b.useContext(zt).darkMode}const Lr=({children:e})=>{const r=b.useRef(null),a=b.useRef(null),[n,o]=b.useState(null),i=he().darkMode;b.useEffect(()=>{if(r.current&&!n)try{const d=r.current.attachShadow({mode:"open"});a.current=d;const h=document.createElement("style");h.textContent=Ca;const m=document.createElement("div");m.setAttribute("class",i?"h-full dark":"h-full"),d.appendChild(h),d.appendChild(m),o(m)}catch{}},[n]),b.useEffect(()=>{n&&n.setAttribute("class",i?"h-full dark":"h-full")},[i,n]);const p=b.useMemo(()=>({shadowRoot:a.current,container:n,darkMode:i}),[n,i]);return t.jsx("div",{ref:r,style:{height:"100%"},className:A("h-full"),children:t.jsx(zt.Provider,{value:p,children:n?ba.createPortal(e,n):null})})};function Bt({...e}){return t.jsx(oe.Root,{"data-slot":"select",...e})}function $r({...e}){return t.jsx(oe.Group,{"data-slot":"select-group",...e})}function Mt({...e}){return t.jsx(oe.Value,{className:"content-[hi]","data-slot":"select-value",...e})}function qt({className:e,size:r="default",children:a,...n}){return t.jsxs(oe.Trigger,{"data-slot":"select-trigger","data-size":r,className:A("data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex w-fit items-center justify-between gap-2 rounded-sm border border-gray-300/80 bg-white px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-neutral-700/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[a,t.jsx(oe.Icon,{asChild:!0,children:t.jsx(J.ChevronDownIcon,{width:14})})]})}function Ut({className:e,children:r,position:a="popper",...n}){const o=it(),s=wt();return t.jsx(oe.Portal,{container:o,children:t.jsxs(oe.Content,{"data-slot":"select-content",className:A("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border bg-gray-100 text-gray-900 shadow-md dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s?"dark":"",e),position:a,...n,children:[t.jsx(Hn,{}),t.jsx(oe.Viewport,{className:A("p-1",a==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:r}),t.jsx(Wn,{})]})})}function zr({className:e,...r}){return t.jsx(oe.Label,{"data-slot":"select-label",className:A("text-muted-foreground px-2 py-1.5 text-xs",e),...r})}function Pt({className:e,children:r,...a}){return t.jsxs(oe.Item,{"data-slot":"select-item",className:A("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-gray-200/50 data-disabled:pointer-events-none data-disabled:opacity-50 dark:text-white dark:hover:bg-neutral-700 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[t.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:t.jsx(oe.ItemIndicator,{children:t.jsx(J.CheckIcon,{width:12,className:"size-4"})})}),t.jsx(oe.ItemText,{children:r})]})}function Br({className:e,...r}){return t.jsx(oe.Separator,{"data-slot":"select-separator",className:A("bg-border pointer-events-none -mx-1 my-1 h-px",e),...r})}function Hn({className:e,...r}){return t.jsx(oe.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:A("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(J.ChevronUpIcon,{className:"size-4"})})}function Wn({className:e,...r}){return t.jsx(oe.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:A("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(J.ChevronDownIcon,{className:"size-4"})})}/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),Me=require("sonner"),ha=require("@radix-ui/react-visually-hidden"),yr=require("@monaco-editor/react"),Pe=require("clsx"),ot=require("copy-to-clipboard"),b=require("react"),fa=require("tailwind-merge"),ma=require("@radix-ui/react-select"),J=require("@heroicons/react/24/outline"),ba=require("react-dom"),_t=require("swr"),Ne=require("@instantdb/core"),at=require("date-fns"),U=require("@heroicons/react/24/solid"),Oe=require("@instantdb/react"),ve=require("@dnd-kit/core"),xa=require("markdown-table"),Ct=require("export-to-csv"),wa=require("@dnd-kit/modifiers"),Te=require("@dnd-kit/sortable"),_e=require("@tanstack/react-table"),ye=require("lucide-react"),re=require("@headlessui/react"),be=require("lodash"),kr=require("@dnd-kit/utilities");require("swr/subscription");const va=require("@radix-ui/react-tooltip"),ya=require("uuid"),ka=require("@radix-ui/react-dialog"),ja=require("json5"),Sa=require("@radix-ui/react-dropdown-menu"),Na=require("@radix-ui/react-toggle-group"),jr=require("react-copy-to-clipboard"),Ea=require("@radix-ui/react-switch");function Ge(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const n=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,n.get?n:{enumerable:!0,get:()=>e[a]})}}return r.default=e,Object.freeze(r)}const oe=Ge(ma),ue=Ge(va),qe=Ge(ka),Ue=Ge(Sa),or=Ge(Na),sr=Ge(Ea),Ca=`/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-mono:"Berk Mono";--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-red-950:oklch(25.8% .092 26.042);--color-orange-500:oklch(70.5% .213 47.604);--color-orange-600:oklch(64.6% .222 41.116);--color-amber-500:oklch(76.9% .188 70.08);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-slate-100:oklch(96.8% .007 247.896);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-neutral-50:oklch(98.5% 0 0);--color-neutral-100:oklch(97% 0 0);--color-neutral-200:oklch(92.2% 0 0);--color-neutral-300:oklch(87% 0 0);--color-neutral-400:oklch(70.8% 0 0);--color-neutral-500:oklch(55.6% 0 0);--color-neutral-600:oklch(43.9% 0 0);--color-neutral-700:oklch(37.1% 0 0);--color-neutral-800:oklch(26.9% 0 0);--color-neutral-900:oklch(20.5% 0 0);--color-neutral-950:oklch(14.5% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-xs:.125rem;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-xs:4px;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:"Switzer",var(--font-switzer),"Georgia";--default-mono-font-family:"Berk Mono",var(--font-berk-mono),"monospace"}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}@font-face{font-family:Berk Mono;font-weight:400;font-style:normal;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Regular.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:400;font-style:italic;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Italic.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:700;font-style:normal;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-Bold.woff2)format("woff2");font-display:swap}@font-face{font-family:Berk Mono;font-weight:400;font-style:italic;font-stretch:100%;src:url(https://stopaio.s3.amazonaws.com/public/BerkeleyMono-BoldItalic.woff2)format("woff2");font-display:swap}@font-face{font-family:Switzer;font-weight:400;font-style:normal;font-stretch:100%;src:url(/fonts/Switzer-Variable.woff2)format("woff2");font-display:swap}*,:after,:before,::backdrop{border-color:#e5e7eb}::file-selector-button{border-color:#e5e7eb}[type=text],input:where(:not([type])),[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{appearance:none;--tw-shadow:0 0 #0000;background-color:#fff;border-width:1px;border-color:#6a7282;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem}:is([type=text],input:where(:not([type])),[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select):focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#155dfc;outline:2px solid #0000}input::placeholder,textarea::placeholder{color:#6a7282;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-date-and-time-value{text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-year-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-month-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-day-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-hour-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-minute-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-second-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-millisecond-field{padding-top:0;padding-bottom:0}::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{print-color-adjust:exact;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='oklch(55.1%25 0.027 264.364)' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem}[multiple],[size]:where(select:not([size="1"])){background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;print-color-adjust:unset;padding-right:.75rem}[type=checkbox],[type=radio]{appearance:none;print-color-adjust:exact;vertical-align:middle;-webkit-user-select:none;user-select:none;color:#155dfc;--tw-shadow:0 0 #0000;background-color:#fff;background-origin:border-box;border-width:1px;border-color:#6a7282;flex-shrink:0;width:1rem;height:1rem;padding:0;display:inline-block}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline-offset:2px;--tw-ring-inset:var(--tw-empty, );--tw-ring-offset-width:2px;--tw-ring-offset-color:#fff;--tw-ring-color:oklch(54.6% .245 262.881);--tw-ring-offset-shadow:var(--tw-ring-inset)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);outline:2px solid #0000}[type=checkbox]:checked,[type=radio]:checked{background-color:currentColor;background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}[type=checkbox]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e")}@media (forced-colors:active){[type=checkbox]:checked{appearance:auto}}[type=radio]:checked{background-image:url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e")}@media (forced-colors:active){[type=radio]:checked{appearance:auto}}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{background-color:currentColor;border-color:#0000}[type=checkbox]:indeterminate{background-color:currentColor;background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");background-position:50%;background-repeat:no-repeat;background-size:100% 100%;border-color:#0000}@media (forced-colors:active){[type=checkbox]:indeterminate{appearance:auto}}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{background-color:currentColor;border-color:#0000}[type=file]{background:unset;border-color:inherit;font-size:unset;line-height:inherit;border-width:0;border-radius:0;padding:0}[type=file]:focus{outline:1px solid buttontext;outline:1px auto -webkit-focus-ring-color}}@layer components;@layer utilities{.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.inset-y-0{inset-block:calc(var(--spacing)*0)}.top-0{top:calc(var(--spacing)*0)}.top-1{top:calc(var(--spacing)*1)}.top-1\\/2{top:50%}.top-4{top:calc(var(--spacing)*4)}.top-\\[18px\\]{top:18px}.top-\\[50\\%\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1{right:calc(var(--spacing)*1)}.right-2{right:calc(var(--spacing)*2)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.bottom-0{bottom:calc(var(--spacing)*0)}.left-0{left:calc(var(--spacing)*0)}.left-\\[50\\%\\]{left:50%}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-100{z-index:100}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.-mx-1{margin-inline:calc(var(--spacing)*-1)}.mx-2{margin-inline:calc(var(--spacing)*2)}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.mt-0\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-4{margin-top:calc(var(--spacing)*4)}.mr-0\\.5{margin-right:calc(var(--spacing)*.5)}.mr-4{margin-right:calc(var(--spacing)*4)}.mr-8{margin-right:calc(var(--spacing)*8)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.-ml-0\\.5{margin-left:calc(var(--spacing)*-.5)}.ml-4{margin-left:calc(var(--spacing)*4)}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.h-\\(--radix-select-trigger-height\\){height:var(--radix-select-trigger-height)}.h-1{height:calc(var(--spacing)*1)}.h-3\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-12{height:calc(var(--spacing)*12)}.h-32{height:calc(var(--spacing)*32)}.h-64{height:calc(var(--spacing)*64)}.h-\\[1\\.15rem\\]{height:1.15rem}.h-full{height:100%}.h-px{height:1px}.max-h-\\(--radix-select-content-available-height\\){max-height:var(--radix-select-content-available-height)}.max-h-\\[25vh\\]{max-height:25vh}.max-h-\\[calc\\(100\\%-2rem\\)\\]{max-height:calc(100% - 2rem)}.max-h-\\[calc\\(100dvh-4rem\\)\\]{max-height:calc(100dvh - 4rem)}.max-h-\\[min\\(50vh\\,var\\(--radix-popper-available-height\\)\\)\\]{max-height:min(50vh,var(--radix-popper-available-height))}.max-h-full{max-height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\\[30vh\\]{min-height:30vh}.min-h-\\[34px\\]{min-height:34px}.min-h-full{min-height:100%}.w-\\(--input-width\\){width:var(--input-width)}.w-0\\.5{width:calc(var(--spacing)*.5)}.w-3\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-9{width:calc(var(--spacing)*9)}.w-12{width:calc(var(--spacing)*12)}.w-24{width:calc(var(--spacing)*24)}.w-48{width:calc(var(--spacing)*48)}.w-\\[30px\\]{width:30px}.w-\\[62px\\]{width:62px}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.max-w-\\[67vw\\]{max-width:67vw}.max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.max-w-\\[min\\(75rem\\,80vw\\)\\]{max-width:min(75rem,80vw)}.max-w-fit{max-width:fit-content}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-xl{max-width:var(--container-xl)}.min-w-\\(--radix-select-trigger-width\\){min-width:var(--radix-select-trigger-width)}.min-w-0{min-width:calc(var(--spacing)*0)}.min-w-32{min-width:calc(var(--spacing)*32)}.min-w-48{min-width:calc(var(--spacing)*48)}.min-w-\\[200px\\]{min-width:200px}.flex-1{flex:1}.shrink{flex-shrink:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-\\(--radix-select-content-transform-origin\\){transform-origin:var(--radix-select-content-transform-origin)}.origin-\\(--radix-tooltip-content-transform-origin\\){transform-origin:var(--radix-tooltip-content-transform-origin)}.translate-x-\\[-50\\%\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-0\\.5{--tw-translate-y:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\[-50\\%\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-rotate-45{rotate:-45deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.filter-shadow-r{opacity:1}@supports (animation-timeline:scroll()){@media (prefers-reduced-motion:no-preference){.filter-shadow-r{opacity:0;animation:linear backwards filter-shadow-r-fade;animation-timeline:--filter-scroll;animation-range:calc(100% - 16px) 100%}}}.filter-shadow-l{opacity:0}@supports (animation-timeline:scroll()){@media (prefers-reduced-motion:no-preference){.filter-shadow-l{animation:linear forwards filter-shadow-l-fade;animation-timeline:--filter-scroll;animation-range:0% 16px}}}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.cursor-wait{cursor:wait}.resize{resize:both}.resize-none{resize:none}.scroll-my-1{scroll-margin-block:calc(var(--spacing)*1)}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.items-start{align-items:flex-start}.items-stretch{align-items:stretch}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}.gap-6{gap:calc(var(--spacing)*6)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.gap-x-1{column-gap:calc(var(--spacing)*1)}:where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}:where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px*var(--tw-divide-y-reverse));border-bottom-width:calc(1px*calc(1 - var(--tw-divide-y-reverse)))}.self-stretch{align-self:stretch}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-scroll{overflow:scroll}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-x-hidden{overflow-x:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xs{border-radius:var(--radius-xs)}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-y{border-block-style:var(--tw-border-style);border-block-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-none{--tw-border-style:none;border-style:none}.border-solid{--tw-border-style:solid;border-style:solid}.border-\\[\\#606AF4\\]{border-color:#606af4}.border-gray-100{border-color:var(--color-gray-100)}.border-gray-200{border-color:var(--color-gray-200)}.border-gray-300{border-color:var(--color-gray-300)}.border-gray-300\\/80{border-color:#d1d5dccc}@supports (color:color-mix(in lab,red,red)){.border-gray-300\\/80{border-color:color-mix(in oklab,var(--color-gray-300)80%,transparent)}}.border-gray-500{border-color:var(--color-gray-500)}.border-neutral-200{border-color:var(--color-neutral-200)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.border-transparent{border-color:#0000}.border-r-gray-200{border-right-color:var(--color-gray-200)}.border-b-gray-200{border-bottom-color:var(--color-gray-200)}.border-l-red-500{border-left-color:var(--color-red-500)}.bg-\\[\\#606AF4\\]{background-color:#606af4}.bg-\\[\\#616AF4\\]{background-color:#616af4}.bg-\\[\\#4543e9\\]{background-color:#4543e9}.bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-gray-50{background-color:var(--color-gray-50)}.bg-gray-100{background-color:var(--color-gray-100)}.bg-gray-200{background-color:var(--color-gray-200)}.bg-gray-300{background-color:var(--color-gray-300)}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-200{background-color:var(--color-neutral-200)}.bg-neutral-300{background-color:var(--color-neutral-300)}.bg-orange-500{background-color:var(--color-orange-500)}.bg-orange-600{background-color:var(--color-orange-600)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-200{background-color:var(--color-red-200)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-linear-to-l{--tw-gradient-position:to left}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-l{--tw-gradient-position:to left in oklab}}.bg-linear-to-l{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-linear-to-r{--tw-gradient-position:to right}@supports (background-image:linear-gradient(in lab,red,red)){.bg-linear-to-r{--tw-gradient-position:to right in oklab}}.bg-linear-to-r{background-image:linear-gradient(var(--tw-gradient-stops))}.bg-none{background-image:none}.from-black\\/10{--tw-gradient-from:#0000001a}@supports (color:color-mix(in lab,red,red)){.from-black\\/10{--tw-gradient-from:color-mix(in oklab,var(--color-black)10%,transparent)}}.from-black\\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.from-black\\/20{--tw-gradient-from:#0003}@supports (color:color-mix(in lab,red,red)){.from-black\\/20{--tw-gradient-from:color-mix(in oklab,var(--color-black)20%,transparent)}}.from-black\\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.via-black\\/0{--tw-gradient-via:#0000}@supports (color:color-mix(in lab,red,red)){.via-black\\/0{--tw-gradient-via:color-mix(in oklab,var(--color-black)0%,transparent)}}.via-black\\/0{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-black\\/5{--tw-gradient-via:#0000000d}@supports (color:color-mix(in lab,red,red)){.via-black\\/5{--tw-gradient-via:color-mix(in oklab,var(--color-black)5%,transparent)}}.via-black\\/5{--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.p-0{padding:calc(var(--spacing)*0)}.p-0\\.5{padding:calc(var(--spacing)*.5)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0{padding-block:calc(var(--spacing)*0)}.py-0\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-1\\.5{padding-top:calc(var(--spacing)*1.5)}.pt-4{padding-top:calc(var(--spacing)*4)}.pr-2{padding-right:calc(var(--spacing)*2)}.pr-3{padding-right:calc(var(--spacing)*3)}.pr-4{padding-right:calc(var(--spacing)*4)}.pr-5{padding-right:calc(var(--spacing)*5)}.pr-6{padding-right:calc(var(--spacing)*6)}.pr-8{padding-right:calc(var(--spacing)*8)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-2{padding-bottom:calc(var(--spacing)*2)}.pb-3{padding-bottom:calc(var(--spacing)*3)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-1{padding-left:calc(var(--spacing)*1)}.pl-2{padding-left:calc(var(--spacing)*2)}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.pl-24{padding-left:calc(var(--spacing)*24)}.text-center{text-align:center}.text-left{text-align:left}.align-middle{vertical-align:middle}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\[10px\\]{font-size:10px}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-balance{text-wrap:balance}.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.whitespace-pre-wrap{white-space:pre-wrap}.text-\\[\\#606AF4\\]{color:#606af4}.text-\\[\\#2563EB\\]{color:#2563eb}.text-blue-800{color:var(--color-blue-800)}.text-gray-400{color:var(--color-gray-400)}.text-gray-500{color:var(--color-gray-500)}.text-gray-600{color:var(--color-gray-600)}.text-gray-700{color:var(--color-gray-700)}.text-gray-800{color:var(--color-gray-800)}.text-gray-900{color:var(--color-gray-900)}.text-neutral-500{color:var(--color-neutral-500)}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-neutral-950{color:var(--color-neutral-950)}.text-red-500{color:var(--color-red-500)}.text-red-600{color:var(--color-red-600)}.text-white{color:var(--color-white)}.uppercase{text-transform:uppercase}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xs{--tw-shadow:0 1px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-\\[\\#606AF4\\]{--tw-ring-color:#606af4}.ring-gray-300{--tw-ring-color:var(--color-gray-300)}.outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.outline-hidden{outline-offset:2px;outline:2px solid #0000}}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.blur-sm{--tw-blur:blur(var(--blur-sm));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\[color\\,box-shadow\\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-100{--tw-duration:.1s;transition-duration:.1s}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.content-\\[hi\\]{--tw-content:hi;content:var(--tw-content)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.select-text{-webkit-user-select:text;user-select:text}.\\[scroll-timeline\\:--filter-scroll_inline\\]{scroll-timeline:--filter-scroll inline}.\\[timeline-scope\\:--filter-scroll\\]{timeline-scope:--filter-scroll}.ring-inset{--tw-ring-inset:inset}@media (hover:hover){.group-hover\\:text-amber-500:is(:where(.group):hover *){color:var(--color-amber-500)}.group-hover\\:opacity-70:is(:where(.group):hover *){opacity:.7}.group-hover\\:opacity-100:is(:where(.group):hover *),.group-hover\\/cell\\:opacity-100:is(:where(.group\\/cell):hover *){opacity:1}}.file\\:rounded-xs::file-selector-button{border-radius:var(--radius-xs)}.file\\:border-none::file-selector-button{--tw-border-style:none;border-style:none}.file\\:border-neutral-200::file-selector-button{border-color:var(--color-neutral-200)}.file\\:bg-transparent::file-selector-button{background-color:#0000}.file\\:p-2::file-selector-button{padding:calc(var(--spacing)*2)}.file\\:pt-1::file-selector-button{padding-top:calc(var(--spacing)*1)}.file\\:text-sm::file-selector-button{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.file\\:font-medium::file-selector-button{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.file\\:shadow-none::file-selector-button{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.placeholder\\:text-gray-400::placeholder{color:var(--color-gray-400)}.placeholder\\:text-neutral-500::placeholder{color:var(--color-neutral-500)}.last\\:border-b-0:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.empty\\:invisible:empty{visibility:hidden}.focus-within\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\:ring-blue-700:focus-within{--tw-ring-color:var(--color-blue-700)}@media (hover:hover){.hover\\:cursor-col-resize:hover{cursor:col-resize}.hover\\:cursor-grab:hover{cursor:grab}.hover\\:border-red-300:hover{border-color:var(--color-red-300)}.hover\\:bg-\\[\\#4543E9\\]:hover,.hover\\:bg-\\[\\#4543e9\\]:hover{background-color:#4543e9}.hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.hover\\:bg-gray-50\\/30:hover{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-50\\/30:hover{background-color:color-mix(in oklab,var(--color-gray-50)30%,transparent)}}.hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.hover\\:bg-gray-200\\/30:hover{background-color:#e5e7eb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-200\\/30:hover{background-color:color-mix(in oklab,var(--color-gray-200)30%,transparent)}}.hover\\:bg-gray-200\\/50:hover{background-color:#e5e7eb80}@supports (color:color-mix(in lab,red,red)){.hover\\:bg-gray-200\\/50:hover{background-color:color-mix(in oklab,var(--color-gray-200)50%,transparent)}}.hover\\:bg-neutral-100:hover{background-color:var(--color-neutral-100)}.hover\\:bg-neutral-300:hover{background-color:var(--color-neutral-300)}.hover\\:bg-orange-500:hover{background-color:var(--color-orange-500)}.hover\\:text-black:hover{color:var(--color-black)}.hover\\:text-gray-600:hover{color:var(--color-gray-600)}.hover\\:text-gray-700:hover{color:var(--color-gray-700)}.hover\\:text-red-600:hover{color:var(--color-red-600)}.hover\\:text-slate-100:hover{color:var(--color-slate-100)}.hover\\:opacity-100:hover{opacity:1}}.focus\\:bg-neutral-100:focus{background-color:var(--color-neutral-100)}.focus\\:text-neutral-900:focus{color:var(--color-neutral-900)}.focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\:ring-\\[\\#606AF4\\]:focus{--tw-ring-color:#606af4}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\:bg-neutral-100:focus-visible{background-color:var(--color-neutral-100)}.focus-visible\\:opacity-100:focus-visible{opacity:1}.focus-visible\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\:ring-neutral-400:focus-visible{--tw-ring-color:var(--color-neutral-400)}.focus-visible\\:ring-neutral-950:focus-visible{--tw-ring-color:var(--color-neutral-950)}.focus-visible\\:outline-hidden:focus-visible{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus-visible\\:outline-hidden:focus-visible{outline-offset:2px;outline:2px solid #0000}}.active\\:cursor-grabbing:active{cursor:grabbing}@media (hover:hover){.hover\\:enabled\\:border-red-300:hover:enabled{border-color:var(--color-red-300)}.hover\\:enabled\\:bg-\\[\\#4543e9\\]:hover:enabled{background-color:#4543e9}.hover\\:enabled\\:bg-gray-50\\/30:hover:enabled{background-color:#f9fafb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:enabled\\:bg-gray-50\\/30:hover:enabled{background-color:color-mix(in oklab,var(--color-gray-50)30%,transparent)}}.hover\\:enabled\\:bg-gray-200\\/30:hover:enabled{background-color:#e5e7eb4d}@supports (color:color-mix(in lab,red,red)){.hover\\:enabled\\:bg-gray-200\\/30:hover:enabled{background-color:color-mix(in oklab,var(--color-gray-200)30%,transparent)}}.hover\\:enabled\\:bg-orange-500:hover:enabled{background-color:var(--color-orange-500)}.hover\\:enabled\\:text-gray-600:hover:enabled{color:var(--color-gray-600)}.hover\\:enabled\\:text-red-600:hover:enabled{color:var(--color-red-600)}.hover\\:enabled\\:text-slate-100:hover:enabled{color:var(--color-slate-100)}}.disabled\\:pointer-events-none:disabled{pointer-events:none}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:border-gray-300:disabled{border-color:var(--color-gray-300)}.disabled\\:border-red-50:disabled{border-color:var(--color-red-50)}.disabled\\:bg-\\[\\#9197f3\\]:disabled{background-color:#9197f3}.disabled\\:bg-gray-200:disabled{background-color:var(--color-gray-200)}.disabled\\:text-gray-400:disabled{color:var(--color-gray-400)}.disabled\\:text-red-300:disabled{color:var(--color-red-300)}.disabled\\:opacity-20:disabled{opacity:.2}.disabled\\:opacity-50:disabled{opacity:.5}.data-disabled\\:pointer-events-none[data-disabled]{pointer-events:none}.data-disabled\\:opacity-50[data-disabled]{opacity:.5}.data-focus\\:bg-blue-100[data-focus]{background-color:var(--color-blue-100)}.data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=left\\]\\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=right\\]\\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[side\\=top\\]\\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[size\\=default\\]\\:h-9[data-size=default]{height:calc(var(--spacing)*9)}.data-\\[size\\=sm\\]\\:h-8[data-size=sm]{height:calc(var(--spacing)*8)}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:flex>*)[data-slot=select-value]{display:flex}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:items-center>*)[data-slot=select-value]{align-items:center}:is(.\\*\\:data-\\[slot\\=select-value\\]\\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing)*2)}.data-\\[state\\=checked\\]\\:translate-x-\\[calc\\(100\\%-2px\\)\\][data-state=checked]{--tw-translate-x: calc(100% - 2px) ;translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[state\\=checked\\]\\:bg-neutral-800[data-state=checked]{background-color:var(--color-neutral-800)}.data-\\[state\\=checked\\]\\:bg-white[data-state=checked]{background-color:var(--color-white)}.data-\\[state\\=unchecked\\]\\:translate-x-0[data-state=unchecked]{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.data-\\[state\\=unchecked\\]\\:bg-neutral-300[data-state=unchecked]{background-color:var(--color-neutral-300)}@media (min-width:40rem){.sm\\:max-w-lg{max-width:var(--container-lg)}}@media (min-width:48rem){.md\\:static{position:static}.md\\:flex{display:flex}.md\\:hidden{display:none}.md\\:flex-row{flex-direction:row}.md\\:items-center{align-items:center}.md\\:justify-start{justify-content:flex-start}.md\\:gap-2{gap:calc(var(--spacing)*2)}.md\\:border-b-0{border-bottom-style:var(--tw-border-style);border-bottom-width:0}.md\\:shadow-none{--tw-shadow:0 0 #0000;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}:where(.dark\\:divide-neutral-700:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-neutral-700)}.dark\\:border:where(.dark,.dark *){border-style:var(--tw-border-style);border-width:1px}.dark\\:border-neutral-500:where(.dark,.dark *){border-color:var(--color-neutral-500)}.dark\\:border-neutral-600:where(.dark,.dark *){border-color:var(--color-neutral-600)}.dark\\:border-neutral-700:where(.dark,.dark *){border-color:var(--color-neutral-700)}.dark\\:border-neutral-800:where(.dark,.dark *){border-color:var(--color-neutral-800)}.dark\\:border-red-900\\/60:where(.dark,.dark *){border-color:#82181a99}@supports (color:color-mix(in lab,red,red)){.dark\\:border-red-900\\/60:where(.dark,.dark *){border-color:color-mix(in oklab,var(--color-red-900)60%,transparent)}}.dark\\:border-y-neutral-700:where(.dark,.dark *){border-block-color:var(--color-neutral-700)}.dark\\:border-y-neutral-800:where(.dark,.dark *){border-block-color:var(--color-neutral-800)}.dark\\:border-t-neutral-700:where(.dark,.dark *){border-top-color:var(--color-neutral-700)}.dark\\:border-r-neutral-700:where(.dark,.dark *){border-right-color:var(--color-neutral-700)}.dark\\:border-b-neutral-600:where(.dark,.dark *){border-bottom-color:var(--color-neutral-600)}.dark\\:border-b-neutral-700:where(.dark,.dark *){border-bottom-color:var(--color-neutral-700)}.dark\\:border-l-neutral-700:where(.dark,.dark *){border-left-color:var(--color-neutral-700)}.dark\\:bg-\\[\\#606AF4\\]:where(.dark,.dark *){background-color:#606af4}.dark\\:bg-\\[\\#252525\\]:where(.dark,.dark *){background-color:#252525}.dark\\:bg-\\[\\#303030\\]:where(.dark,.dark *){background-color:#303030}.dark\\:bg-blue-700\\/30:where(.dark,.dark *){background-color:#1447e64d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-blue-700\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-700)30%,transparent)}}.dark\\:bg-neutral-200:where(.dark,.dark *){background-color:var(--color-neutral-200)}.dark\\:bg-neutral-600\\/20:where(.dark,.dark *){background-color:#52525233}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)20%,transparent)}}.dark\\:bg-neutral-600\\/40:where(.dark,.dark *){background-color:#52525266}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/40:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)40%,transparent)}}.dark\\:bg-neutral-600\\/50:where(.dark,.dark *){background-color:#52525280}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-600\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-600)50%,transparent)}}.dark\\:bg-neutral-700:where(.dark,.dark *){background-color:var(--color-neutral-700)}.dark\\:bg-neutral-700\\/50:where(.dark,.dark *){background-color:#40404080}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-700\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-700)50%,transparent)}}.dark\\:bg-neutral-800:where(.dark,.dark *){background-color:var(--color-neutral-800)}.dark\\:bg-neutral-900:where(.dark,.dark *){background-color:var(--color-neutral-900)}.dark\\:bg-neutral-900\\/50:where(.dark,.dark *){background-color:#17171780}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-neutral-900\\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-900)50%,transparent)}}.dark\\:bg-orange-600:where(.dark,.dark *){background-color:var(--color-orange-600)}.dark\\:bg-red-500\\/10:where(.dark,.dark *){background-color:#fb2c361a}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-500\\/10:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.dark\\:bg-red-900\\/30:where(.dark,.dark *){background-color:#82181a4d}@supports (color:color-mix(in lab,red,red)){.dark\\:bg-red-900\\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-900)30%,transparent)}}.dark\\:bg-transparent:where(.dark,.dark *){background-color:#0000}.dark\\:text-blue-100:where(.dark,.dark *){color:var(--color-blue-100)}.dark\\:text-neutral-50:where(.dark,.dark *){color:var(--color-neutral-50)}.dark\\:text-neutral-100:where(.dark,.dark *){color:var(--color-neutral-100)}.dark\\:text-neutral-200:where(.dark,.dark *){color:var(--color-neutral-200)}.dark\\:text-neutral-300:where(.dark,.dark *){color:var(--color-neutral-300)}.dark\\:text-neutral-400:where(.dark,.dark *){color:var(--color-neutral-400)}.dark\\:text-neutral-500:where(.dark,.dark *){color:var(--color-neutral-500)}.dark\\:text-neutral-600:where(.dark,.dark *){color:var(--color-neutral-600)}.dark\\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\\:ring-neutral-500:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-500)}.dark\\:ring-neutral-600:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-600)}.dark\\:ring-neutral-700:where(.dark,.dark *){--tw-ring-color:var(--color-neutral-700)}.dark\\:file\\:border-neutral-700:where(.dark,.dark *)::file-selector-button{border-color:var(--color-neutral-700)}.dark\\:file\\:text-white:where(.dark,.dark *)::file-selector-button{color:var(--color-white)}.dark\\:placeholder\\:text-neutral-400:where(.dark,.dark *)::placeholder{color:var(--color-neutral-400)}.dark\\:placeholder\\:text-neutral-500:where(.dark,.dark *)::placeholder{color:var(--color-neutral-500)}.dark\\:checked\\:border-\\[\\#2563EB\\]:where(.dark,.dark *):checked{border-color:#2563eb}.dark\\:checked\\:bg-\\[\\#2563EB\\]:where(.dark,.dark *):checked{background-color:#2563eb}.dark\\:focus-within\\:ring-blue-500:where(.dark,.dark *):focus-within{--tw-ring-color:var(--color-blue-500)}@media (hover:hover){.dark\\:hover\\:border-red-800:where(.dark,.dark *):hover{border-color:var(--color-red-800)}.dark\\:hover\\:bg-\\[\\#4543e9\\]:where(.dark,.dark *):hover{background-color:#4543e9}.dark\\:hover\\:bg-neutral-600:where(.dark,.dark *):hover{background-color:var(--color-neutral-600)}.dark\\:hover\\:bg-neutral-700:where(.dark,.dark *):hover{background-color:var(--color-neutral-700)}.dark\\:hover\\:bg-neutral-700\\/30:where(.dark,.dark *):hover{background-color:#4040404d}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/30:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)30%,transparent)}}.dark\\:hover\\:bg-neutral-700\\/50:where(.dark,.dark *):hover{background-color:#40404080}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)50%,transparent)}}.dark\\:hover\\:bg-neutral-700\\/80:where(.dark,.dark *):hover{background-color:#404040cc}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:bg-neutral-700\\/80:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700)80%,transparent)}}.dark\\:hover\\:bg-neutral-800:where(.dark,.dark *):hover{background-color:var(--color-neutral-800)}.dark\\:hover\\:bg-orange-500:where(.dark,.dark *):hover{background-color:var(--color-orange-500)}.dark\\:hover\\:text-neutral-100:where(.dark,.dark *):hover{color:var(--color-neutral-100)}.dark\\:hover\\:text-neutral-300:where(.dark,.dark *):hover{color:var(--color-neutral-300)}.dark\\:hover\\:text-white:where(.dark,.dark *):hover{color:var(--color-white)}}.dark\\:focus\\:bg-neutral-700:where(.dark,.dark *):focus{background-color:var(--color-neutral-700)}.dark\\:focus\\:text-neutral-50:where(.dark,.dark *):focus{color:var(--color-neutral-50)}.dark\\:focus-visible\\:bg-neutral-700:where(.dark,.dark *):focus-visible{background-color:var(--color-neutral-700)}.dark\\:focus-visible\\:ring-neutral-400:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-400)}.dark\\:focus-visible\\:ring-neutral-500:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-500)}@media (hover:hover){.dark\\:hover\\:enabled\\:border-red-800:where(.dark,.dark *):hover:enabled{border-color:var(--color-red-800)}.dark\\:hover\\:enabled\\:bg-\\[\\#4543e9\\]:where(.dark,.dark *):hover:enabled{background-color:#4543e9}.dark\\:hover\\:enabled\\:bg-neutral-700\\/30:where(.dark,.dark *):hover:enabled{background-color:#4040404d}@supports (color:color-mix(in lab,red,red)){.dark\\:hover\\:enabled\\:bg-neutral-700\\/30:where(.dark,.dark *):hover:enabled{background-color:color-mix(in oklab,var(--color-neutral-700)30%,transparent)}}.dark\\:hover\\:enabled\\:bg-orange-500:where(.dark,.dark *):hover:enabled{background-color:var(--color-orange-500)}.dark\\:hover\\:enabled\\:text-neutral-100:where(.dark,.dark *):hover:enabled{color:var(--color-neutral-100)}.dark\\:hover\\:enabled\\:text-neutral-300:where(.dark,.dark *):hover:enabled{color:var(--color-neutral-300)}.dark\\:hover\\:enabled\\:text-red-500:where(.dark,.dark *):hover:enabled{color:var(--color-red-500)}}.dark\\:disabled\\:border-neutral-400:where(.dark,.dark *):disabled{border-color:var(--color-neutral-400)}.dark\\:disabled\\:border-red-950:where(.dark,.dark *):disabled{border-color:var(--color-red-950)}.dark\\:disabled\\:bg-\\[\\#9197f3\\]:where(.dark,.dark *):disabled{background-color:#9197f3}.dark\\:disabled\\:text-neutral-600:where(.dark,.dark *):disabled{color:var(--color-neutral-600)}.dark\\:disabled\\:text-neutral-700:where(.dark,.dark *):disabled{color:var(--color-neutral-700)}.dark\\:disabled\\:text-red-800:where(.dark,.dark *):disabled{color:var(--color-red-800)}.dark\\:disabled\\:opacity-40:where(.dark,.dark *):disabled{opacity:.4}.dark\\:disabled\\:opacity-50:where(.dark,.dark *):disabled{opacity:.5}.dark\\:data-focus\\:bg-neutral-700:where(.dark,.dark *)[data-focus]{background-color:var(--color-neutral-700)}.dark\\:data-\\[state\\=checked\\]\\:border-transparent:where(.dark,.dark *)[data-state=checked]{border-color:#0000}.dark\\:data-\\[state\\=checked\\]\\:bg-neutral-600:where(.dark,.dark *)[data-state=checked]{background-color:var(--color-neutral-600)}.dark\\:data-\\[state\\=checked\\]\\:bg-white:where(.dark,.dark *)[data-state=checked]{background-color:var(--color-white)}.dark\\:data-\\[state\\=unchecked\\]\\:bg-neutral-200:where(.dark,.dark *)[data-state=unchecked]{background-color:var(--color-neutral-200)}.dark\\:data-\\[state\\=unchecked\\]\\:bg-neutral-700:where(.dark,.dark *)[data-state=unchecked]{background-color:var(--color-neutral-700)}.\\[\\&_code\\]\\:wrap-break-word code,.\\[\\&_pre\\]\\:wrap-break-word pre{overflow-wrap:break-word}.\\[\\&_pre\\]\\:whitespace-pre-wrap pre{white-space:pre-wrap}.\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}:is(.\\*\\:\\[span\\]\\:last\\:flex>*):is(span):last-child{display:flex}:is(.\\*\\:\\[span\\]\\:last\\:items-center>*):is(span):last-child{align-items:center}:is(.\\*\\:\\[span\\]\\:last\\:gap-2>*):is(span):last-child{gap:calc(var(--spacing)*2)}}html{--default-mono-font-family:"Berk Mono",var(--font-berk-mono),"monospace"}@keyframes filter-shadow-r-fade{0%{opacity:1}to{opacity:0}}@keyframes filter-shadow-l-fade{0%{opacity:0}to{opacity:1}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}`,Sr=typeof window<"u",Ra=Tt("devBackend");let At="8888";if(Ra&&Sr){const e=new URL(location.href).searchParams.get("port");e&&(At=e)}const ir={apiURI:Tt("devBackend")?`http://localhost:${At}`:"https://api.instantdb.com",websocketURI:Tt("devBackend")?`ws://localhost:${At}/runtime/session`:"wss://api.instantdb.com/runtime/session"};function Tt(e){if(!Sr)return null;try{const r=localStorage.getItem(e);return r?JSON.parse(r):null}catch{return null}}function pe(e){Me.toast.success(e,{richColors:!0})}function ge(e,r){Me.toast.error(e,{duration:r?.autoClose,richColors:!0})}const Dt={"many-many":{cardinality:"many","unique?":!1},"one-one":{cardinality:"one","unique?":!0},"many-one":{cardinality:"many","unique?":!0},"one-many":{cardinality:"one","unique?":!1}},Nr=Object.fromEntries(Object.entries(Dt).map(([e,r])=>[`${r.cardinality}-${r["unique?"]}`,e])),Ia=({attr:e,gracePeriodDays:r,isExpanded:a,setIsExpanded:n,onRestore:o})=>{const s=at.add(new Date(e["deletion-marked-at"]),{days:r}),i=()=>e["forward-identity"][2],p=()=>e["reverse-identity"]?.[2],d=()=>{const l=e["forward-identity"][1],g=e["reverse-identity"]?.[1];return{forwardEtype:l,reverseEtype:g}},h=()=>{const l=`${e.cardinality}-${e["unique?"]}`;return Nr[l]},m=()=>{n(!a)},c=(()=>{if(e["value-type"]==="blob")return[];const l=h(),{forwardEtype:g,reverseEtype:f}=d(),x=i(),w=p(),v=(N,T)=>N==="one-one"?"has one":N==="many-many"?"has many":N==="one-many"?T?"has one":"has many":N==="many-one"?T?"has many":"has one":"has";return[{label:"forward",value:t.jsxs("span",{children:[t.jsx("strong",{children:g})," ",v(l,!0)," ",t.jsx("strong",{children:x})]})},{label:"reverse",value:t.jsxs("span",{children:[t.jsx("strong",{children:f})," ",v(l,!1)," ",t.jsx("strong",{children:w})]})}]})(),u=[{label:"type",value:e["value-type"]},...c];return t.jsxs("div",{children:[t.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:m,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[a?t.jsx(J.ChevronDownIcon,{width:14,className:"text-gray-400"}):t.jsx(J.ChevronRightIcon,{width:14,className:"text-gray-400"}),t.jsx("span",{className:"font-mono text-sm font-medium",children:e["forward-identity"][2]}),t.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["expires ",at.formatDistanceToNow(s,{includeSeconds:!1})]})]}),t.jsxs(H,{className:"px-1",size:"mini",variant:"subtle",onClick:l=>{l.stopPropagation(),o(e.id)},children:[t.jsx(J.ArrowUturnLeftIcon,{width:14}),"Restore"]})]}),a&&t.jsx("div",{className:"pb-3 pl-6",children:t.jsx("table",{className:"mt-2 w-full text-left font-mono text-xs text-gray-500",children:t.jsx("tbody",{children:u.map((l,g)=>t.jsxs("tr",{className:g===u.length-1?"pl-2":"border-b border-gray-200",children:[t.jsx("td",{className:"py-1 pr-4 pl-2 font-medium text-gray-700",children:l.label}),t.jsx("td",{className:"py-1 text-gray-600",children:l.value})]},l.label))})})})]})},Ft=e=>{const r=he(),a=r.adminToken;return _t(["recently-deleted",e],async()=>{const o=await fetch(`${r.apiURI}/dash/apps/${e}/soft_deleted_attrs`,{method:"GET",headers:{Authorization:`Bearer ${a}`}}),s=await o.json();if(!o.ok)throw console.error("Failed to fetch recently deleted attrs",s),new Error("Failed to fetch recently deleted attrs"+JSON.stringify(s));return{...s,attrs:s.attrs.map(Oa)}})},Er=e=>{const{data:r}=Ft(e);return b.useMemo(()=>{const n=r?.attrs||[];return n.filter(i=>i["forward-identity"][2]==="id").map(i=>{const p=n.filter(d=>d.metadata.soft_delete_snapshot?.id_attr_id===i.id);return{idAttr:i,remainingCols:p.filter(d=>i.id!==d.id)}})},[r?.attrs])};function Aa({appId:e,db:r}){const{data:a,mutate:n}=Ft(e),o=Er(e),s=a?.["grace-period-days"]||2,i=async({idAttr:p,remainingCols:d})=>{if(!r||!a)return;const h=[p,...d].map(c=>c.id);await r.core._reactor.pushOps(h.map(c=>["restore-attr",c]));const m=new Set(h);n({...a,attrs:a.attrs.filter(c=>!m.has(c.id))})};return t.jsxs(xe,{className:"flex w-full min-w-0 flex-col gap-4 overflow-hidden",children:[t.jsx("h5",{className:"flex items-center gap-2 text-lg font-bold",children:"Recently Deleted Namespaces"}),o.length?t.jsx("div",{className:"flex flex-col gap-2 overflow-hidden",children:o.toSorted((p,d)=>+new Date(d.idAttr["deletion-marked-at"])-+new Date(p.idAttr["deletion-marked-at"])).map(p=>{const d=new Date(p.idAttr["deletion-marked-at"]),h=at.add(d,{days:s});return t.jsxs("div",{className:"flex items-start justify-between gap-4 overflow-hidden border-b py-3 last:border-b-0 dark:border-neutral-700",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"truncate font-semibold dark:text-white",children:p.idAttr["forward-identity"][1]}),t.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:["Deleted ",at.format(d,"MMM d, h:mm a")," ·"," ","expires"," ",at.formatDistanceToNow(h,{includeSeconds:!1})]}),p.remainingCols.length>0?t.jsxs("div",{className:"mt-1 truncate text-xs text-neutral-500 dark:text-neutral-400",title:p.remainingCols.map(m=>m["forward-identity"][2]).join(", "),children:["Columns:"," ",p.remainingCols.map(m=>m["forward-identity"][2]).join(", ")]}):t.jsx("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:"No columns"})]}),t.jsx("div",{className:"flex shrink-0 items-center",children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>i(p),children:[t.jsx(J.ArrowPathIcon,{className:"h-3.5 w-3.5"}),"Restore"]})})]},p.idAttr.id)})}):t.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No recently deleted namespaces."})]})}const Ta=({namespace:e,appId:r,db:a,notes:n})=>{const{data:o,mutate:s,error:i}=Ft(r),[p,d]=b.useState(null),h=Wt(),m=async l=>{if(a&&o)try{await a.core._reactor.pushOps([["restore-attr",l]]),s({attrs:o.attrs.filter(f=>f.id!==l)??[],"grace-period-days":o["grace-period-days"]});const g=o.attrs.find(f=>f.id===l);if(g){const f=_a(g);f&&n.setNote(l,f)}}catch(g){console.error(g),g instanceof Ne.InstantAPIError?g.body?.type==="record-not-unique"?ge("Attribute already exists. Rename existing attribute first and then try again to restore."):ge(g.message):ge("Failed to restore attr")}},c=e.attrs.find(l=>l.name==="id")?.id||"unk",u=o?.attrs?.filter(l=>l.metadata?.soft_delete_snapshot?.id_attr_id===c);return b.useEffect(()=>{u?.length===0&&h.onClose()},[u]),i||!u||u.length===0?null:t.jsxs("div",{className:"pb-2",children:[t.jsx(ct,{className:"pb-2",children:t.jsxs("div",{className:"flex w-full grow items-center justify-center gap-2 text-center opacity-60",children:[t.jsx(J.ClockIcon,{width:16}),"Recently Deleted"]})}),t.jsx("div",{className:"flex flex-col gap-2",children:u?.map(l=>t.jsx(Ia,{isExpanded:p===l.id,setIsExpanded:g=>{d(g?l.id:null)},attr:l,gracePeriodDays:o?.["grace-period-days"]||2,onRestore:m},l.id))})]})},lr="_deleted$",Oa=e=>{const r={...e},[a,n,o]=e["forward-identity"];if(r["forward-identity"]=[a,ft(n),ft(o)],e["reverse-identity"]){const[s,i,p]=e["reverse-identity"];r["reverse-identity"]=[s,ft(i),ft(p)]}return r},ft=e=>{const r=e.indexOf(lr);return r===-1?e:e.slice(r+lr.length)},_a=e=>e&&e?.metadata?.soft_delete_snapshot?e.metadata.soft_delete_snapshot.is_indexed&&e.metadata.soft_delete_snapshot.is_required?"Index and required constraints were dropped after restoring":e.metadata.soft_delete_snapshot.is_indexed?"Indexed constraint was dropped after restoring":e.metadata.soft_delete_snapshot.is_required?"Required constraint was dropped after restoring":null:null;function Da({db:e,onClose:r}){const[a,n]=b.useState("");async function o(){const s={id:Oe.id(),"forward-identity":[Oe.id(),a,"id"],"value-type":"blob",cardinality:"one","unique?":!0,"index?":!1},i=[["add-attr",s]];await e.core._reactor.pushOps(i),r({id:s.id,name:a})}return t.jsxs(xe,{className:"flex flex-col gap-4",children:[t.jsx("h5",{className:"flex items-center text-lg font-bold",children:"Create a new namespace"}),t.jsx(Ie,{value:a,placeholder:"Name your namespace",onChange:s=>n(s),autoFocus:!0,ignorePasswordManager:!0}),t.jsx(Se,{type:"submit",label:"Create",submitLabel:"Creating...",errorMessage:"Failed to create namespace",disabled:!a,onClick:o})]})}const Fa=[["$files","url"]],dr=[":",">","<"];function La(e){let r=0,a,n;const o=[];let s=-1;for(const i of e){if(s++,i===" "&&!dr.includes(e[s+1])){r=s+1;continue}if(dr.includes(i)){a&&n!=null&&(a.value=e.substring(n,r).trim(),o.push(a)),a={field:e.substring(r,s).trim(),operator:i,value:""},n=s+1;continue}}return a&&n!=null&&(a.value=e.substring(n).trim(),o.push(a)),o}function tt(e){switch(e){case":":return"=";case"<":return"$lt";case">":return"$gt";default:throw new Error("what kind of op is this? "+e)}}function $a({query:e,attrsByName:r,stringIndexed:a}){if(!e.trim())return[];const n=La(e),o=n.flatMap(s=>{const i=r[s.field];if(!i||!s.value)return[];if(s.value.toLowerCase()==="null"&&s.operator===":"&&!i.isRequired)return[[s.field,"$isNull",null]];const p=[];if(i.checkedDataType&&i.isIndex){if(i.checkedDataType==="string"){const d=s.value;return[[s.field,d===d.toLowerCase()?"$ilike":"$like",`%${s.value}%`]]}if(i.checkedDataType==="number")try{return[[s.field,tt(s.operator),JSON.parse(s.value)]]}catch{}if(i.checkedDataType==="date")try{return[[s.field,tt(s.operator),JSON.parse(s.value)]]}catch{return[[s.field,tt(s.operator),s.value]]}}for(const d of i.inferredTypes||["json"])switch(d){case"boolean":case"number":{try{p.push([s.field,tt(s.operator),JSON.parse(s.value)])}catch{}break}default:{p.push([s.field,tt(s.operator),s.value]);break}}return p});if(!n.length&&e.trim()&&a.length)for(const s of a)o.push([s.name,e.toLowerCase()===e?"$ilike":"$like",`%${e.trim()}%`]);return o}function za(e,r){if(r.length===e.length){for(let a=0;a<r.length;a++)for(let n=0;n<3;n++)if(r[a][n]!==e[a][n])return!1;return!0}return!1}function Ba({onSearchChange:e,attrs:r,initialFilters:a=[]}){const[n,o]=b.useState(""),s=b.useRef(a),{attrsByName:i,stringIndexed:p}=b.useMemo(()=>{const l={},g=[];for(const f of r||[])l[f.name]=f,f.isIndex&&f.checkedDataType==="string"&&g.push(f);return{attrsByName:l,stringIndexed:g}},[r]),d=b.useCallback(be.debounce(l=>{const g=$a({query:l,attrsByName:i,stringIndexed:p});za(s.current,g)||(s.current=g,e(g))},80),[i,p,s]),h=n.indexOf(":")!==-1?be.last(n.split(" ")):n,m=(r||[]).flatMap(l=>{const g=Fa.some(([w,v])=>w===l.namespace&&v===l.name);if(l.type==="ref"||g)return[];const f=[],x=[];if(x.push({field:l.name,operator:":",display:`${l.name}:`}),l.isIndex&&(l.checkedDataType==="number"||l.checkedDataType==="date")){const w={field:l.name,query:null};x.push({...w,operator:"<",display:`${l.name}<`}),x.push({...w,operator:">",display:`${l.name}>`})}for(const w of x)(!h||w.display.startsWith(h)&&w.display!==h)&&f.push(w);return f}),c=b.useRef(null);function u(l){let g;h&&l.startsWith(h)?g=`${n}${l.substring(h.length)}`:g=`${n.trim()} ${l}`,o(g),d(g)}return b.useEffect(()=>{a.length>0&&!n&&o(a.map(l=>`${l[0]}:${l[2]}`).join(" "))},[a]),t.jsxs(re.Combobox,{value:n,onChange:l=>{l&&u(l)},immediate:!0,children:[t.jsx(re.ComboboxInput,{size:32,className:"rounded-md border border-neutral-300 px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-500",value:n,onChange:l=>{o(l.target.value),d(l.target.value)},onKeyDown:l=>{if(l.key==="Tab"&&m.length){l.preventDefault();const g=c.current||m[0];g&&u(g.display)}},placeholder:"Filter..."}),t.jsx(re.ComboboxOptions,{anchor:"bottom start",modal:!1,className:"z-10 mt-1 w-(--input-width) divide-y overflow-auto rounded-md border border-neutral-300 bg-white shadow-lg dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800",children:m.map((l,g)=>t.jsx(re.ComboboxOption,{value:l.display,className:A("px-3 py-1 data-focus:bg-blue-100 dark:text-white dark:data-focus:bg-neutral-700",{}),children:({focus:f})=>(f&&(c.current=l),t.jsx("span",{children:l.display}))},g))})]})}function Ma(e){const[,r,a]=e["forward-identity"];return e.catalog!=="system"||r==="$users"||r==="$files"||r==="$streams"}function qa(e){const r={},a={};for(const[o,s]of Object.entries(e))Ma(s)&&(a[o]=s);for(const o of Object.values(a)){const[,s]=o["forward-identity"];r[s]||(r[s]={id:s,name:s,attrs:{}})}for(const o of Object.values(a)){const s={forward:{id:o["forward-identity"][0],namespace:o["forward-identity"][1],attr:o["forward-identity"][2],nsMap:r[o["forward-identity"][1]]},reverse:o["reverse-identity"]?{id:o["reverse-identity"][0],namespace:o["reverse-identity"][1],attr:o["reverse-identity"][2],nsMap:r[o["reverse-identity"][1]]}:void 0};if(o["forward-identity"]){const[m,c,u,l]=o["forward-identity"],g=o.id+"-forward";l!==!1&&(r[c].attrs[g]={id:o.id,isForward:!0,namespace:c,name:u,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],isPrimary:o["primary?"],cardinality:o.cardinality,linkConfig:s,inferredTypes:o["inferred-types"],catalog:o.catalog,checkedDataType:o["checked-data-type"],sortable:o["index?"]&&!!o["checked-data-type"],onDelete:o["on-delete"],onDeleteReverse:o["on-delete-reverse"]})}if(!o["reverse-identity"])continue;const[i,p,d,h]=o["reverse-identity"];if(r[p]&&h!==!1){const m=o.id+"-reverse";r[p].attrs[m]={id:o.id,isForward:!1,namespace:p,name:d,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],cardinality:o.cardinality,linkConfig:s,sortable:o["index?"]&&!!o["checked-data-type"],onDelete:o["on-delete"],onDeleteReverse:o["on-delete-reverse"],catalog:o.catalog,checkedDataType:o["checked-data-type"]}}}return Object.values(r).map(o=>({...o,attrs:Object.values(o.attrs).sort(cr)})).sort(cr)}function cr(e,r){return e.name==="id"?-1:r.name==="id"?1:e.name<r.name?-1:e.name>r.name?1:0}function Ua(e,r,a){return r||(e?[]:a)}function Pa(e,r){const a={};return e&&(a[e[0]]=e[1]),r?.length&&(a.or=r.map(([n,o,s])=>{switch(o){case"=":return{[n]:s};case"$isNull":return{[n]:{[o]:!0}};default:return{[n]:{[o]:s}}}})),a}function Ga(e,r,a,n,o,s,i,p){const d=p?"asc":"desc",h=Pa(a,n),m=r?{[r.name]:{...Object.fromEntries(r.attrs.filter(g=>g.type==="ref").map(g=>[g.name,{$:{fields:["id"]}}])),$:{...h?{where:h}:{},...o?{limit:o}:{},...s?{offset:s}:{},order:{[i]:d}}}}:{},c=e.useQuery(m),l=e.useQuery(r?{[r.name]:{$:{aggregate:"count",...h?{where:h}:{}}}}:{}).aggregate?.[r?.name??""]?.count??null;return{itemsRes:c,allCount:l}}function Ha(e){const[r,a]=b.useState({namespaces:null,attrs:null});return e.useQuery({____explorer___:{}}),b.useEffect(()=>{function n(o){a({attrs:o,namespaces:qa(o)})}return e._core._reactor.subscribeAttrs(n)},[e]),r}const ur=e=>{const r=localStorage.getItem(`columnVisibility_${e}`);if(!r)return{};try{return JSON.parse(r)}catch(a){return console.error("Failed to parse column visibility",a),{}}},Wa=e=>{const[r,a]=b.useState(ur(e.appId));return b.useEffect(()=>{localStorage.setItem(`columnVisibility_${e.appId}`,JSON.stringify(r))},[e.appId,r]),b.useEffect(()=>{a(ur(e.appId))},[e.appId]),{visibility:r,setVisibility:a,attrs:e.attrs}};function pr(e){if(typeof window>"u")return;let r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{}}function Va(e,r){if(typeof window>"u")throw new Error("useLocalStorage/setState needs to run on the client");const a=JSON.stringify(r);try{window.localStorage.setItem(e,a)}catch{console.log("[localStorage] can't set k");return}window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:a}))}function Lt(e,r){const a=b.useRef(pr(e)||r),n=b.useCallback(s=>{const i=()=>{a.current=pr(e)||r,s()};return window.addEventListener("storage",i),()=>{window.removeEventListener("storage",i)}},[]);return[b.useSyncExternalStore(n,()=>a.current,()=>r),s=>Va(e,s)]}function Ka(e){const r=["bytes","kb","mb","gb","tb","pb","eb","zb","yb"];let a=0;if(!e)return"0 bytes";for(;e>=1024&&a<r.length-1;)e/=1024,a++;return e.toFixed(2)+" "+r[a]}const Ya=(e,r)=>{const a=document.querySelector(`.th-${e}`);if(!a)throw new Error(`Element with class th-${e} not found`);const n=document.querySelectorAll(`span.td-${e}`),o=document.createElement("div");o.style.position="absolute",o.style.visibility="hidden",o.style.top="-9999px",o.style.left="-9999px",o.style.width="auto",o.style.whiteSpace="nowrap",document.body.appendChild(o);try{const s=a.cloneNode(!0);s.style.display="inline-block",s.style.overflow="visible",s.style.width="auto",s.style.maxWidth="none",s.style.whiteSpace="nowrap",o.appendChild(s);const i=s.scrollWidth,p=Array.from(n).map(c=>{const u=c.cloneNode(!0);u.style.display="inline-block",u.style.overflow="visible",u.style.width="auto",u.style.maxWidth="none",u.style.whiteSpace="nowrap",o.appendChild(u);const l=u.scrollWidth;return o.removeChild(u),l}),d=p.length>0?Math.max(...p):0,m=Math.max(i,d)+12;return Math.min(m,r)}finally{document.body.removeChild(o)}};function Xa(){const e=b.useRef(null),[r,a]=b.useState(!1);return b.useLayoutEffect(()=>{const{current:n}=e;n&&(()=>{const s=n.scrollWidth>n.clientWidth||n.scrollHeight>n.clientHeight;a(s)})()},[e]),{ref:e,isOverflow:r,setIsOverflow:a}}const Za=({header:e,table:r,headerGroup:a,index:n,setMinViableColWidth:o,onSort:s,currentSortAttr:i,currentSortAsc:p})=>{const{attributes:d,setActivatorNodeRef:h,isDragging:m,listeners:c,setNodeRef:u,transform:l}=Te.useSortable({id:e.column.id,disabled:e.id==="select-col"}),g={opacity:m?.8:1,position:"relative",transform:e.id==="select-col"?void 0:kr.CSS.Translate.toString(l),transition:"width transform 0.2s ease-in-out",whiteSpace:"nowrap",width:e.column.getSize(),zIndex:m?1:0},x=!!e.column.columnDef?.meta?.sortable,w=typeof e.column.columnDef.header=="string"?e.column.columnDef.header:"",v=i===w||i==="serverCreatedAt"&&w==="id";return t.jsxs("div",{ref:u,className:Pe("group relative z-10 h-8 w-full whitespace-nowrap select-none"),style:{...g,width:e.getSize()!==0?e.getSize():void 0},children:[e.id!=="select-col"&&t.jsx("button",{className:"absolute inset-0 z-0 hover:cursor-grab active:cursor-grabbing",...d,...c,ref:h,style:{pointerEvents:"auto"}}),e.id==="select-col"?t.jsx("div",{className:`flex h-full w-full items-center px-2 py-1 th-${e.column.id}`,children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())}):t.jsxs("div",{className:"flex h-full items-stretch justify-between overflow-hidden",children:[t.jsx("div",{className:`flex shrink items-center gap-1 truncate px-2 py-1 font-semibold th-${e.column.id}`,children:x?t.jsxs("button",{className:"relative z-50 flex items-center gap-1 py-2 pr-5",onClick:()=>{s&&s(w==="id"?"serverCreatedAt":w,i,p)},children:[t.jsx("span",{className:A(v&&"underline"),children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())}),t.jsx("span",{className:"opacity-50 transition-opacity group-hover:opacity-70",style:{opacity:v?1:void 0,fontWeight:v?"bold":"normal"},children:v?p?t.jsx(J.ArrowUpIcon,{strokeWidth:3,width:10}):t.jsx(J.ArrowDownIcon,{strokeWidth:3,width:10}):t.jsx(J.ArrowsUpDownIcon,{strokeWidth:3,width:10})})]}):t.jsx(t.Fragment,{children:e.isPlaceholder?null:_e.flexRender(e.column.columnDef.header,e.getContext())})}),t.jsx("div",{className:"flex h-full items-center justify-between",children:t.jsx("div",{onDoubleClick:()=>o(e.column.id),onMouseDown:N=>(N.stopPropagation(),e.getResizeHandler()(N)),onTouchStart:e.getResizeHandler(),className:A(`resizer h-full flex justify-center z-50 ${r.options.columnResizeDirection} ${e.column.getIsResizing()?"isResizing":""}`,a.headers.length-1==n&&"justify-end",e.id!=="select-col"&&"hover:cursor-col-resize"),style:{width:8,pointerEvents:"auto"},children:a.headers.length-1!==n&&t.jsx("div",{className:"h-full w-0.5 bg-neutral-200 dark:bg-neutral-700"})})})]})]},e.id)},Ja=({cell:e})=>{const r=e.column.getIsResizing(),{history:a}=xt(),{setDialog:n}=$t(),o=e.column.columnDef.meta,s=o?.editable&&o.attr&&!o?.isLink,{isDragging:i,setNodeRef:p,transform:d}=Te.useSortable({id:e.column.id,disabled:e.column.id==="select-col"}),[h,m]=b.useState(!1),{ref:c,isOverflow:u,setIsOverflow:l}=Xa(),g=e.getValue(),f=(u||be.isObject(g))&&!o?.isLink;b.useEffect(()=>{const C=c.current;if(!C)return;const O=()=>{l(C.scrollWidth>C.clientWidth||C.scrollHeight>C.clientHeight)};O();const M=new ResizeObserver(O);return M.observe(C),()=>{M.disconnect()}},[g,e.column.getSize(),l]);const x={opacity:i?.8:1,position:"relative",transform:e.column.id==="select-col"?void 0:kr.CSS.Translate.toString(d),transition:"width transform 0.2s ease-in-out",width:e.column.getSize(),zIndex:i?1:0},w=o?.disablePadding??!1,v=e.column.id==="select-col",N=o?.isLink&&o.attr&&Array.isArray(g)&&g.length>0,T=o?.copyable&&Qa(g,o),F=t.jsxs("div",{ref:p,style:{...x,...v||w?{}:{padding:"0.5rem"}},className:A("group/cell relative flex min-w-0 cursor-default items-center whitespace-nowrap",v&&"px-2 py-1"),children:[t.jsx("span",{ref:v?void 0:c,className:A(`h-full min-h-full min-w-0 td-${e.column.id}`,v?"flex w-full items-center gap-2 overflow-visible":A("min-w-0 flex-1 truncate",(N||T)&&"cursor-pointer"),!v&&(w?"":"pr-2"),s&&"pr-6"),onClick:v?void 0:()=>{if(N&&o?.attr){const C=o.attr,O=C.linkConfig[C.isForward?"reverse":"forward"];if(O){a.push({namespace:O.namespace,where:[`${O.attr}.id`,e.row.original.id]});return}}T&&ot(Cr(g))&&(m(!0),setTimeout(()=>m(!1),1e3))},children:h?t.jsx("div",{className:"h-1",children:"Copied!"}):_e.flexRender(e.column.columnDef.cell,e.getContext())}),s?t.jsx("button",{type:"button",title:`Edit ${o.attr.name}`,className:"absolute top-1/2 right-1 z-20 -translate-y-1/2 rounded-xs p-0.5 opacity-0 transition-opacity group-hover/cell:opacity-100 hover:bg-neutral-100 focus-visible:bg-neutral-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-neutral-400 focus-visible:outline-hidden dark:hover:bg-neutral-700 dark:focus-visible:bg-neutral-700 dark:focus-visible:ring-neutral-500",onClick:C=>{C.stopPropagation(),n({type:"edit-row",rowId:e.row.original.id,focusAttr:o.attr.name})},children:t.jsx(J.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})}):null]},e.id);return v?F:t.jsxs(He,{delayDuration:400,children:[" ",t.jsx(We,{className:"text-left",asChild:!0,children:F}),f&&!r&&t.jsx(Ve,{collisionPadding:10,className:A("max-h-[min(50vh,var(--radix-popper-available-height))] max-w-[min(75rem,80vw)] min-w-0 overflow-x-hidden overflow-y-auto wrap-break-word whitespace-pre-wrap [&_code]:wrap-break-word [&_pre]:wrap-break-word [&_pre]:whitespace-pre-wrap",be.isObject(g)&&"p-0"),side:"bottom",children:typeof g=="string"?_e.flexRender(e.column.columnDef.cell,e.getContext()):t.jsx(en,{pretty:!0,data:g})})]})};function Qa(e,r){return e==null?!1:r?.isLink?Array.isArray(e)&&e.length>0:Array.isArray(e)?e.length>0:be.isObject(e)?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!0}function Cr(e,r){return be.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function en({data:e,pretty:r}){const a=Cr(e,r),n=he();return r&&be.isObject(e)?t.jsx(St,{darkMode:n.darkMode,code:a,language:"json"}):t.jsx(t.Fragment,{children:a})}const tn=({visiblity:e,localDates:r,setLocalDates:a})=>{const[n,o]=b.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(dt,{icon:t.jsx(J.Cog6ToothIcon,{width:16}),label:"View Settings",onClick:()=>o(!0)}),t.jsxs(ke,{title:"Explorer View Settings",hideCloseButton:!0,onClose:()=>o(!1),open:n,children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("div",{className:"text-lg",children:"Explorer View Settings"}),t.jsx("button",{onClick:()=>o(!1),children:t.jsx(J.XMarkIcon,{className:"h-4 w-4 cursor-pointer"})})]}),t.jsxs("div",{className:"py-2",children:[t.jsx("div",{children:"Visible Columns"}),t.jsx("div",{className:"py-1",children:e.attrs?.map(s=>t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{label:s.name,checked:e.visibility[s.id+s.name]!==!1,onChange:i=>e.setVisibility(p=>({...p,[s.id+s.name]:i}))})},s.id+s.name))})]}),t.jsx(ct,{className:"py-2"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{children:"Show Dates in Local Time"}),t.jsx(rr,{onClick:s=>{a(!r)},checked:r})]}),t.jsx("div",{className:"text-xs opacity-40",children:"Copy to clipboard will still use the original value."})]})]})};async function rn({appId:e,attrId:r,jobType:a,checkedDataType:n,apiURI:o},s){return(await(await fetch(`${o}/dash/apps/${e}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json"},body:JSON.stringify({"app-id":e,"attr-id":r,"job-type":a,"checked-data-type":n})})).json()).job}function Rr(e,r,a,n){let o=!1,s=!1,i=20,p=null;const d=m=>{if(m!==p)return i=20,p=m,i;const c=i;return i=Math.min(1e4,i*2),c},h=async m=>{for(;!o&&!s;)try{const u=await(await fetch(`${n}/dash/apps/${e}/indexing-jobs/${r}`,{headers:{authorization:`Bearer ${a}`}})).text(),g=JSON.parse(u).job;if(m(g),g.job_status!=="processing"&&g.job_status!=="waiting")return g;await new Promise(f=>setTimeout(f,d(u)))}catch(c){console.error("Job polling error:",c),s=!0,m(null,c)}};return{start:async m=>h(m),stop:()=>{o=!0}}}function Ce(e){return e.job_status==="errored"}function Re(e){return e.job_status==="completed"||e.job_status==="errored"}const an=({attr:e,appId:r,isRequired:a,isIndexed:n,isUnique:o,checkedDataType:s,token:i})=>{const[p,d]=b.useState({}),[h,m]=b.useState({}),[c,u]=b.useState({}),l=he();b.useEffect(()=>{Object.values(h).some(N=>N.job_status!=="completed"&&N.job_status!=="errored")||(a===e.isRequired?d(N=>({...N,require:void 0})):a?d(N=>({...N,require:{jobType:"required"}})):a||d(N=>({...N,require:{jobType:"remove-required"}})),n===e.isIndex?d(N=>({...N,index:void 0})):n?d(N=>({...N,index:{jobType:"index"}})):n||d(N=>({...N,index:{jobType:"remove-index"}})),o===e.isUniq?d(N=>({...N,unique:void 0})):o?d(N=>({...N,unique:{jobType:"unique"}})):o||d(N=>({...N,unique:{jobType:"remove-unique"}})),s===(e.checkedDataType||"any")?d(N=>({...N,type:void 0})):d(s==="any"?N=>({...N,type:{jobType:"remove-data-type"}}):N=>({...N,type:{jobType:"check-data-type",checkedDataType:s}})))},[a,n,o,s,e,h]);const[g,f]=b.useState(!1),x=async()=>{g||(m({}),f(!0),Object.entries(p).forEach(async([v,N])=>{if(!N)return;const F=await(await fetch(`${l.apiURI}/dash/apps/${r}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({"app-id":r,"attr-id":e.id,"job-type":N.jobType,"checked-data-type":N.checkedDataType})})).json();m(O=>({...O,[v]:F.job})),d(O=>({...O,[v]:void 0})),f(!1);const C=Rr(r,F.job.id,i,l.apiURI);await C.start((O,M)=>{if(!M&&O){const P=O.work_estimate??5e4,Q=O.work_completed??0,z=Math.floor(Q/P*100);u(B=>({...B,[v]:z})),m(B=>({...B,[v]:O}))}}),C.stop()}))},w=b.useMemo(()=>Object.values(c).filter(v=>v>0&&v<100).reduce((v,N)=>v+N,0)/Object.values(c).filter(v=>v>0&&v<100).length,[c]);return{isPending:Object.values(p).filter(Boolean).length>0,progress:w,isRunning:Object.values(h).some(v=>v.job_status!=="completed"&&v.job_status!=="errored"),pending:p,running:h,apply:x}},nn=()=>{const[e,r]=b.useState({});return{notes:e,setNote:(o,s)=>{r(i=>({...i,[o]:{message:s}}))},removeNote:o=>{r(s=>{const i={...s};return delete i[o],i})}}},on=(e,r,a)=>{const n=r.name,o=[];return r.attrs.forEach(s=>{o.push(["update-attr",{id:s.id,"forward-identity":[s.linkConfig.forward.id,e,s.linkConfig.forward.attr]}])}),a.forEach(s=>{s.attrs.forEach(i=>{i.linkConfig.reverse?.namespace===n&&o.push(["update-attr",{id:i.id,"reverse-identity":[i.linkConfig.reverse.id,e,i.linkConfig.reverse.attr]}])})}),o};function sn({db:e,namespace:r,namespaces:a,onClose:n,isSystemCatalogNs:o,screen:s,onScreenChange:i}){const d=he().appId,{history:h}=xt(),{mutate:m}=_t.useSWRConfig(),[c,u]=b.useState(!1),l=C=>{u(!1),i(C)},[g,f]=b.useState(r.name),[x,w]=b.useState(null);async function v(){const C=r.attrs.map(O=>["delete-attr",O.id]);await e.core._reactor.pushOps(C),setTimeout(()=>{m(["recently-deleted",d])},500),n({ok:!0})}async function N(C){if(C.startsWith("$")){w("Namespace name cannot start with $");return}const O=on(C,r,a);await e.core._reactor.pushOps(O),h.push({namespace:C},!0),pe("Renamed namespace to "+C),f(""),l({kind:"main"})}const T=nn(),F=b.useMemo(()=>{if(s.kind==="edit-attr")return r.attrs.find(C=>C.id===s.attrId&&C.isForward===s.isForward)},[s.kind==="edit-attr"?s.attrId:null,s.kind==="edit-attr"?s.isForward:null,r.attrs]);return c?t.jsx(Ir,{name:r.name,type:"namespace",onClose:n,onConfirm:v}):s.kind==="rename"?t.jsxs("div",{className:"px-2",children:[t.jsx("button",{onClick:()=>{l({kind:"main"})},className:"mb-3",children:t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer"})}),t.jsxs("h6",{className:"text-md pb-2 font-bold",children:["Rename ",r.name]}),t.jsxs("form",{onSubmit:C=>{C.preventDefault(),N(g)},children:[t.jsxs(lt,{className:"pb-2 text-sm",children:["This will immediately rename the namespace. You'll need to"," ",t.jsx("strong",{className:"dark:text-white",children:"update your code"})," to the new name."]}),t.jsx(Ie,{disabled:o,value:g,onChange:C=>f(C)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsxs(H,{type:"submit",disabled:g.startsWith("$")||g.length===0,children:["Rename ",r.name," → ",g]})})]})]}):s.kind==="main"?t.jsxs("div",{className:"flex flex-col gap-4 px-2",children:[t.jsxs("div",{className:"mr-8 flex gap-1",children:[t.jsx("h5",{className:"flex items-center text-lg font-bold",children:r.name}),t.jsx(dt,{variant:"subtle",onClick:()=>{l({kind:"rename"})},icon:t.jsx(U.PencilSquareIcon,{className:"h-4 w-4 opacity-50"}),label:"Rename"}),t.jsxs(H,{className:"ml-4",disabled:o,title:o?`The ${r.name} namespace can't be deleted.`:void 0,size:"mini",variant:"secondary",onClick:()=>u(!0),children:[t.jsx(U.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:r.attrs.map(C=>t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("span",{className:"py-0.5 font-bold",children:C.name}),T.notes[C.id]?.message&&t.jsx(yt,{children:t.jsx("div",{className:"px-2 text-xs text-gray-500 dark:text-neutral-400",children:T.notes[C.id].message})})]}),C.name!=="id"?t.jsx(H,{className:"px-2",size:"mini",variant:"subtle",onClick:()=>{T.removeNote(C.id),l({kind:"edit-attr",attrId:C.id,isForward:C.isForward})},children:"Edit"}):null]},C.id+"-"+C.name))}),t.jsx("div",{children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>l({kind:"add-attr",attrKind:"data"}),children:[t.jsx(U.PlusIcon,{className:"inline",height:"12px"}),"New attribute"]})}),t.jsx(Ta,{notes:T,db:e,appId:d,namespace:r})]}):s.kind==="add-attr"?t.jsx(ln,{db:e,namespace:r,namespaces:a,onClose:()=>l({kind:"main"}),constraints:gr({namespaceName:r.name,isSystemCatalogNs:o}),attrType:s.attrKind==="link"?"ref":"blob",onAttrTypeChange:C=>i({kind:"add-attr",attrKind:C==="ref"?"link":"data"})}):s.kind==="edit-attr"&&F?t.jsx(bn,{db:e,attr:F,onClose:()=>l({kind:"main"}),constraints:gr({namespaceName:r.name,isSystemCatalogNs:o,attr:F})}):null}function Ir({name:e,type:r,onClose:a,onConfirm:n}){return t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(U.ArrowLeftIcon,{height:"1rem",className:"cursor-pointer",onClick:()=>a()}),"Delete ",e]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsxs("p",{className:"pb-2",children:["Are you sure you want to delete the ",t.jsx("strong",{children:e})," ",r,"?"]}),t.jsx(Se,{variant:"destructive",label:`Delete ${e}`,submitLabel:"Deleting...",errorMessage:"Failed to delete",onClick:n})]})]})}function ln({db:e,namespace:r,namespaces:a,onClose:n,constraints:o,attrType:s,onAttrTypeChange:i}){const[p,d]=b.useState(!1),[h,m]=b.useState(!1),[c,u]=b.useState(!1),[l,g]=b.useState(!1),[f,x]=b.useState(!1),[w,v]=b.useState(null),[N,T]=b.useState("many-many"),[F,C]=b.useState(()=>a.find(_=>_.name!==r.name)??a[0]),[O,M]=b.useState(""),[P,Q]=b.useState(r.name),z=N==="one-one"||N==="one-many",B=N==="one-one"||N==="many-one",X=Tr({attrName:O,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:F?.name}),ae=s==="blob"?O:X.isValidLink;b.useEffect(()=>{if(s!=="ref"||!F)return;const _=F.name===r.name;M(_?"parent":F.name),Q(_?"children":r.name),_&&T("one-many")},[s,F]);async function Z(){if(s==="blob"){const G=[["add-attr",{id:Ne.id(),"forward-identity":[Ne.id(),r.name,O],"value-type":"blob",cardinality:"one","unique?":c,"index?":h,"required?":p,"checked-data-type":w??void 0}]];await e._core._reactor.pushOps(G),n()}else{if(!F)throw new Error("No reverse namespace");const G=[["add-attr",{id:Ne.id(),...Dt[N],"forward-identity":[Ne.id(),r.name,O],"reverse-identity":[Ne.id(),F.name,P],"value-type":"ref","index?":!1,"required?":p,"on-delete":z&&l?"cascade":void 0,"on-delete-reverse":B&&f?"cascade":void 0}]];await e._core._reactor.pushOps(G),n()}}return t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer",onClick:n}),"Add an attribute"]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Type"}),t.jsx(Ht,{ariaLabel:"Text alignment",selectedId:s,items:[{id:"blob",label:"Data"},{id:"ref",label:"Link"}],onChange:_=>i(_.id)})]}),s==="blob"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Name"}),t.jsx(Ie,{value:O,onChange:_=>M(_)})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{disabled:o.require.disabled,checked:p,onChange:_=>d(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]}),title:o.require.message})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:h,onChange:_=>m(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Index this attribute"})," to improve lookup performance of values"]})})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:c,onChange:_=>u(_),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Enforce uniqueness"})," so no two entities can have the same value for this attribute"]})})})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Enforce type"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(je,{value:w||"none",onChange:_=>{if(!_)return;const{value:G}=_;G==="none"&&v(null),v(G)},options:[{label:"Any (not enforced)",value:"none"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]})})]})]}):s==="ref"?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Link to namespace"}),t.jsx(je,{value:F?.id??void 0,options:a.map(_=>({label:_.name+(_.name===r.name?" (self-link)":""),value:_.id})),onChange:_=>{if(!_)return;const G=a.find(W=>W.id===_.value);C(G)}})]}),t.jsx(Ar,{relationship:N,attrName:O,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:F?.name,setAttrName:M,setReverseAttrName:Q,setRelationship:T,isCascadeAllowed:z,isCascade:l,setIsCascade:g,isCascadeReverseAllowed:B,isCascadeReverse:f,setIsCascadeReverse:x,isRequired:p,setIsRequired:d,constraints:o})]}):null,t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(Se,{type:"submit",label:"Create attribute",submitLabel:"Creating attribute...",errorMessage:"Failed to create attribute",disabled:!ae,className:"border-gray-500 disabled:opacity-20",onClick:Z}),X.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})}function mt({indexingJob:e,attr:r,onClickSample:a}){if(e?.invalid_triples_sample?.length)return t.jsxs("div",{children:["Here are the first few invalid entities we found:",t.jsxs("table",{className:"dark:text-netural-500 mx-2 my-2 flex-1 text-left font-mono text-xs text-gray-500",children:[t.jsx("thead",{className:"bg-white text-gray-700 dark:bg-neutral-800 dark:text-white",children:t.jsxs("tr",{children:[t.jsx("th",{className:"pr-2",children:"id"}),t.jsx("th",{className:"max-w-fit pr-2",children:r.name}),t.jsx("th",{className:"pr-2",children:"type"})]})}),t.jsx("tbody",{children:e.invalid_triples_sample.slice(0,3).map((n,o)=>t.jsxs("tr",{className:"cursor-pointer rounded-md px-2 whitespace-nowrap hover:bg-gray-200",onClick:()=>a(n),children:[t.jsx("td",{className:"pr-2",children:t.jsx("pre",{children:n.entity_id})}),t.jsx("td",{className:"truncate pr-2",style:{maxWidth:"12rem"},children:JSON.stringify(n.value)}),t.jsx("td",{className:"pr-2",children:n.json_type})]},o))})]})]})}function st({indexingJob:e,attr:r,onClose:a}){const{history:n}=xt();if(e){if(e.error==="missing-required-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsxs("div",{children:[e.error_data?.count," ",t.jsx("code",{children:r.namespace})," ",e.error_data?.count===1?"entity does":"entities do"," ","not have ",t.jsx("code",{children:r.name})," set."]}),t.jsx(mt,{indexingJob:{...e,invalid_triples_sample:e.error_data&&e.error_data["entity-ids"]?.map(o=>({entity_id:String(o),value:null,json_type:r.checkedDataType||"null"}))},attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="triple-too-large-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"Some of the existing data is too large to index. "}),t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="invalid-triple-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsxs("div",{children:["The type can't be set to ",e?.checked_data_type," because some data is the wrong type."]}),t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error==="triple-not-unique-error")return t.jsxs("div",{className:"mt-2 mb-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"Some of the existing data is not unique. "}),e.invalid_unique_value!=null?t.jsxs("div",{children:["Found"," ",t.jsxs("span",{className:typeof e.invalid_unique_value=="object"?"":"cursor-pointer underline",onClick:typeof e.invalid_unique_value=="object"?void 0:()=>{n.push({namespace:r.namespace,where:[r.name,e.invalid_unique_value]}),a()},children:["multiple entities with value"," ",t.jsx("code",{children:JSON.stringify(e.invalid_unique_value)})]}),"."]}):null,t.jsx(mt,{indexingJob:e,attr:r,onClickSample:o=>{n.push({namespace:r.namespace,where:["id",o.entity_id]}),a()}})]});if(e.error)return t.jsxs("div",{className:"mt-2 mb-2 space-y-2 border-l-2 border-l-red-500 pl-2",children:[t.jsx("div",{children:"An unexpected error occured while changing constraints. Please share these details with the Instant team:"}),t.jsxs("pre",{children:['id: "',e.id,'"']})]})}}function Ar({attrName:e,reverseAttrName:r,namespaceName:a,reverseNamespaceName:n,relationship:o,setAttrName:s,setReverseAttrName:i,setRelationship:p,isCascade:d,setIsCascade:h,isCascadeAllowed:m,isCascadeReverse:c,setIsCascadeReverse:u,isCascadeReverseAllowed:l,isRequired:g,setIsRequired:f,constraints:x}){const w=e&&n&&r;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:gap-2",children:[t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Forward attribute name"}),t.jsx(Ie,{disabled:x.attr.disabled,title:x.attr.message,value:e,onChange:v=>s(v)}),t.jsx("div",{className:"rounded-xs py-0.5 text-xs text-gray-500 dark:text-neutral-400",children:w?t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[a,".",e]})," ","will link to ",t.jsx("strong",{children:n})]}):t.jsx(t.Fragment,{children:" "})})]}),t.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Reverse attribute name"}),t.jsx(Ie,{disabled:x.attr.disabled,title:x.attr.message,value:r,onChange:v=>i(v)}),t.jsx("div",{className:"rounded-xs py-0.5 text-xs text-gray-500 dark:text-neutral-400",children:w?t.jsxs(t.Fragment,{children:[t.jsxs("strong",{children:[n,".",r]})," ","will link to ",t.jsx("strong",{children:a})]}):t.jsx(t.Fragment,{children:" "})})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Relationship"}),t.jsx(dn,{disabled:!w||x.attr.disabled,value:o,onChange:v=>{p(v.value)},namespace:a,reverseNamespace:n??"",attr:e,reverseAttr:r,title:x.attr.disabled?x.attr.message:void 0}),t.jsx("div",{className:"text-xs wrap-break-word text-gray-500 dark:text-neutral-400",children:w?cn[o](a,n,e,r):t.jsx(t.Fragment,{children:" "})})]}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:m&&d,disabled:!m||x.attr.disabled,onChange:h,title:x.attr.message,label:t.jsxs("span",{className:"dark:text-neutral-200",children:[t.jsx("div",{children:t.jsxs("strong",{children:["Cascade Delete ",n," → ",a]})}),"When a ",t.jsx("strong",{children:n})," entity is deleted, all linked ",t.jsx("strong",{children:a})," will be deleted automatically"]})})}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{checked:l&&c,disabled:!l||x.attr.disabled,onChange:u,title:x.attr.message,label:t.jsxs("span",{className:"dark:text-neutral-200",children:[t.jsx("div",{children:t.jsxs("strong",{children:["Cascade Delete ",a," → ",n]})}),"When a ",t.jsx("strong",{children:a})," entity is deleted, all linked ",t.jsx("strong",{children:n})," will be deleted automatically"]})})}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx("div",{className:"flex gap-2",children:t.jsx(se,{disabled:x.require.disabled,title:x.require.message,checked:g,onChange:v=>f(v),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})})})]})]})}function dn({value:e,disabled:r,onChange:a,namespace:n,attr:o,reverseNamespace:s,reverseAttr:i,title:p}){return t.jsx(je,{disabled:r,value:e,onChange:d=>{d&&a(d)},options:[{label:"Many-to-many",value:"many-many"},{label:"One-to-one",value:"one-one"},{label:`${n} has-many ${o||"---"} / ${s} has-one ${i||"---"}`,value:"many-one"},{label:`${n} has-one ${o||"---"} / ${s} has-many ${i||"---"}`,value:"one-many"}],title:p})}const cn={"many-many":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have many ",t.jsx("strong",{children:a}),", and"," ",t.jsx("strong",{children:r})," can be associated with more than one"," ",t.jsx("strong",{children:n})]}),"one-one":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have only one ",t.jsx("strong",{children:a}),", and a"," ",t.jsx("strong",{children:r})," can only have one ",t.jsx("strong",{children:n})]}),"many-one":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have many ",t.jsx("strong",{children:a}),", but"," ",t.jsx("strong",{children:r})," can only have one ",t.jsx("strong",{children:n})]}),"one-many":(e,r,a,n)=>t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:e})," can have only one ",t.jsx("strong",{children:a}),", but"," ",t.jsx("strong",{children:r})," can be associated with more than one"," ",t.jsx("strong",{children:n})]})};async function un({appId:e,attr:r,isRequired:a,authToken:n,setIndexingJob:o,stopFetchLoop:s,apiURI:i}){if(!n||a===r.isRequired)return;s.current?.();const p=`${r.namespace}.${r.name}`;try{const d=await rn({appId:e,attrId:r.id,jobType:a?"required":"remove-required",apiURI:i},n);o(d);const h=Rr(e,d.id,n,i);s.current=h.stop;const m=await h.start((c,u)=>{u&&ge(`Error while marking ${p} as required.`),c&&o(c)});if(m){if(m.job_status==="completed")return pe(a?`Marked ${p} as required.`:`Marked ${p} as optional.`),"completed";if(m.job_status==="canceled")return ge("Marking required was canceled."),"canceled";if(m.job_status==="errored")return m.error==="invalid-triple-error"?ge(`Found invalid data while updating ${p}.`):ge(`Encountered an error while updating ${p}.`),"errored"}}catch(d){return console.error(d),ge(`Unexpected error while updating ${p}`),"errored"}}const pn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=!r||Re(r),d=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.checkedDataType||"any")},[r]),t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-col gap-2",children:t.jsxs("h6",{className:"text-md font-bold",children:["Enforce type"," ",t.jsx(yt,{children:t.jsx("div",{className:"w-48 text-sm",children:"Checks the type on all existing entities and enforces the type when entities are created or updated."})})]})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(je,{className:A(e&&"border-[#606AF4] ring-1 ring-[#606AF4] ring-inset focus:ring-[#606AF4]"),disabled:o||r&&!Re(r),title:o?s:void 0,value:a,onChange:h=>{h&&n(h.value)},options:[{label:"Any (not enforced)",value:"any"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]}),e&&p&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(i.checkedDataType||"any")},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:d})]})},gn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isRequired||!1)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},hn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isIndex)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Index this attribute"})," to improve lookup performance of values"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},fn=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:s,attr:i})=>{const p=re.useClose();return b.useEffect(()=>{r&&Ce(r)&&n(i.isUniq)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(se,{disabled:o||r&&!Re(r),title:o?s:void 0,checked:a,onChange:d=>n(d),label:t.jsxs("span",{className:A(o||r&&!Re(r)?"cursor-default":"cursor-pointer",e&&"text-[#606AF4]"),children:[t.jsx("strong",{children:"Enforce uniqueness"})," so no two entities can have the same value for this attribute"]})}),e&&t.jsx(U.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&Ce(r)&&t.jsx(st,{indexingJob:r,attr:i,onClose:p})]})},mn=({appId:e,attr:r,constraints:a})=>{const[n,o]=b.useState(r.isRequired||!1),[s,i]=b.useState(r.isIndex),[p,d]=b.useState(r.isUniq),[h,m]=b.useState(r.checkedDataType||"any"),c=he(),{isPending:u,pending:l,apply:g,isRunning:f,running:x,progress:w}=an({attr:r,appId:e,token:c.adminToken,isRequired:n,isIndexed:s,isUnique:p,checkedDataType:h});return t.jsx("div",{children:t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx("h6",{className:"text-md font-bold",children:"Constraints"}),t.jsx(gn,{pendingJob:l.require,runningJob:x.require,value:n,setValue:o,disabled:a.require.disabled,disabledReason:a.require.message,attr:r}),t.jsx(hn,{pendingJob:l.index,runningJob:x.index,value:s,setValue:i,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(fn,{pendingJob:l.unique,runningJob:x.unique,value:p,setValue:d,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(pn,{pendingJob:l.type,runningJob:x.type,value:h,setValue:m,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Xt,{loading:f,percentage:f&&w||0,variant:u||f?"primary":"secondary",className:"border",onClick:()=>g(),disabled:!u||f,children:f?"Updating Constraints...":"Update Constraints"})]})})};function bn({db:e,attr:r,onClose:a,constraints:n}){const s=he().appId,{mutate:i}=_t.useSWRConfig(),[p,d]=b.useState({type:"main"}),[h,m]=b.useState(r.linkConfig.forward.attr),[c,u]=b.useState(r.linkConfig.reverse?.attr),[l,g]=b.useState(()=>{const W=`${r.cardinality}-${r.isUniq}`;return Nr[W]}),f=he(),[x,w]=b.useState(()=>r.onDelete==="cascade"),[v,N]=b.useState(()=>r.onDeleteReverse==="cascade"),[T,F]=b.useState(r.isRequired||!1),[C,O]=b.useState(T),[M,P]=b.useState(null),Q=b.useRef(null),z=re.useClose();b.useEffect(()=>()=>Q.current?.(),[Q]);const B=l==="one-one"||l==="one-many",X=l==="one-one"||l==="many-one",ae=Tr({attrName:h,reverseAttrName:c,namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse?.namespace});async function Z(){if(!r.linkConfig.reverse)throw new Error("No reverse link config");if(T!==C&&await un({appId:s,attr:r,isRequired:T,authToken:f.adminToken,setIndexingJob:P,stopFetchLoop:Q,apiURI:f.apiURI})!="completed")return;const W=[["update-attr",{id:r.id,...Dt[l],"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,h],"reverse-identity":[r.linkConfig.reverse.id,r.linkConfig.reverse.namespace,c],"on-delete":B&&x?"cascade":null,"on-delete-reverse":X&&v?"cascade":null}]];await e.core._reactor.pushOps(W),T==C&&pe("Updated attribute")}async function _(){const W=[["update-attr",{id:r.id,"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,h]}]];await e.core._reactor.pushOps(W),pe("Renamed attribute")}async function G(){await e.core._reactor.pushOps([["delete-attr",r.id]]),setTimeout(()=>{i(["recently-deleted",s])},500),a()}return p.type==="delete"?t.jsx(Ir,{onConfirm:G,onClose:a,name:r.name,type:"attribute"}):t.jsxs("div",{className:"flex flex-col gap-4",children:[t.jsxs("div",{className:"mr-8 flex gap-4",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(U.ArrowLeftIcon,{className:"h-4 w-4 cursor-pointer",onClick:a}),t.jsxs("h5",{className:"flex items-center text-lg font-bold",children:["Edit ",r.namespace,".",r.name]})]}),t.jsxs(H,{disabled:n.attr.disabled,title:n.attr.message,variant:"secondary",size:"mini",onClick:()=>d({type:"delete"}),children:[t.jsx(U.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),r.type==="blob"?t.jsxs(t.Fragment,{children:[t.jsx(mn,{appId:s,attr:r,constraints:n}),t.jsx(ct,{}),t.jsxs(xe,{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Rename"}),t.jsxs(lt,{className:"text-sm",children:["This will immediately rename the attribute. You'll need to"," ",t.jsx("strong",{className:"dark:text-white",children:"update your code"})," to the new name."]}),t.jsx(Ie,{disabled:n.attr.disabled,title:n.attr.message,value:h,onChange:W=>m(W)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsx(Se,{type:"submit",label:`Rename ${r.name} → ${h}`,submitLabel:"Renaming attribute...",errorMessage:"Failed to rename attribute",disabled:n.attr.disabled||!h||h===r.name,title:n.attr.message,onClick:_})})]})]}):t.jsxs(xe,{className:"flex flex-col gap-6",children:[t.jsx(Ar,{relationship:l,attrName:h,reverseAttrName:c??"",namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse.namespace,setAttrName:m,setReverseAttrName:u,setRelationship:g,isCascadeAllowed:B,isCascade:x,setIsCascade:w,isCascadeReverseAllowed:X,isCascadeReverse:v,setIsCascadeReverse:N,isRequired:T,setIsRequired:F,constraints:n}),t.jsx(st,{indexingJob:M,attr:r,onClose:()=>{z(),a()}}),t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(Se,{disabled:n.attr.disabled||!ae.isValidLink,type:"submit",label:"Update relationship",submitLabel:"Updating relationship...",errorMessage:"Failed to update relationship",onClick:Z,title:n.attr.message}),ae.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})]})}function Tr({reverseNamespaceName:e,namespaceName:r,attrName:a,reverseAttrName:n}){const o=e&&e===r,s=a&&r&&e&&n,i=a!==n;return{isSelfLink:o,isNonEmptyLink:s,isValidLink:s&&(o?i:!0),shouldShowSelfLinkNameError:s&&o&&!i}}function gr({namespaceName:e,isSystemCatalogNs:r,attr:a}){const n=a?.catalog==="system",o=a?`${a.namespace}.${a.name} is managed by the system and can't be edited`:void 0,s=n?o:r?`The ${e} namespace is managed by the system and can't modify required constraints yet.`:void 0;return{attr:{disabled:n||!1,message:o},require:{disabled:n||r,message:s}}}const nt=[{value:"string",label:"string"},{value:"number",label:"number"},{value:"boolean",label:"boolean"},{value:"json",label:"json"}];function xn({onSave:e,onChange:r,onKeyDown:a,...n}){const o=b.useRef(null),s=i=>{const p=i.closest(".overflow-y-auto"),d=p?.scrollTop||0;i.style.height="auto",i.style.height=i.scrollHeight+"px",p&&(p.scrollTop=d)};return b.useEffect(()=>{o.current&&(s(o.current),o.current&&s(o.current))},[n.value]),t.jsx("textarea",{ref:o,className:"flex min-h-[34px] w-full flex-1 resize-none overflow-hidden rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800 dark:placeholder:text-neutral-500",rows:1,placeholder:"hello world (Shift+Enter for new line)",...n,onChange:i=>{r?.(i),s(i.target)},onKeyDown:i=>{i.key==="Enter"&&!i.shiftKey&&e&&(i.preventDefault(),e()),a?.(i)}})}const Rt={string:"",number:0,boolean:!1,json:{}};function wn(e){return e?e==="date"?nt.filter(r=>r.value==="string"||r.value==="number"):nt.filter(r=>r.value===e):nt}const Or=e=>!!e&&typeof e=="object";function vn(e){try{return JSON.parse(e),!0}catch{return!1}}function yn(e){try{return JSON.parse(e)}catch{return e}}function kn(e,r){if(e.checkedDataType)return e.checkedDataType==="date"?"string":e.checkedDataType;if(r!=null){const a=Or(r)?"json":typeof r,n=nt.find(o=>o.value===a);if(n)return n.value}return e.inferredTypes?.length?e.inferredTypes[0]:nt[0].value}function hr(e,r){if(e===null)return null;if(r==="number"){const a=String(e).replace(/[^\d.-]/g,"");if(a===""||a==="-"||a==="."||a==="-.")return a;const n=a.match(/^(-?\d*\.?\d*)\.?$/);return n?Number(n[0]):""}else{if(r==="boolean")return e==="true";if(r==="string")return Or(e)?JSON.stringify(e):String(e);if(r==="json")return yn(e)}return e}function jn(e){return ya.validate(e)?null:"Invalid UUID."}const It="This field is required.";function Sn(e,r){if(r==null)return!0;switch(e){case"string":return String(r).trim()==="";case"number":return r===""?!0:typeof r=="string"?r==="-"||r==="."||r==="-.":!1;case"boolean":case"json":return!1;default:return!1}}function Nn(e,r,a){const n=(e[r]||[]).filter(s=>a?.[s.id]?.action!=="unlink").length,o=Object.values(a||{}).filter(s=>s.action==="link").length;return n+o}function fr({db:e,namespace:r,item:a}){const[n,o]=b.useState(!1),[s,i]=b.useState(!1),{data:p,isLoading:d}=e.useQuery(n||s?{[r.name]:{$:{where:{id:a.id}}}}:null);return t.jsx(ue.Provider,{children:t.jsxs(ue.Root,{delayDuration:0,open:n,children:[t.jsx(ue.Trigger,{asChild:!0,onMouseEnter:()=>i(!0),onTouchStart:()=>i(!0),children:t.jsx("span",{children:t.jsx(H,{size:"mini",variant:"subtle",onClick:()=>o(h=>!h),children:t.jsx(U.InformationCircleIcon,{height:14})})})}),t.jsx(ue.Content,{collisionPadding:10,side:"bottom",children:t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"bg-opacity-90 max-w-md overflow-auto border bg-white p-2 font-mono text-xs whitespace-pre shadow-md backdrop-blur-xs dark:border-neutral-700 dark:bg-neutral-800",style:{maxHeight:"var(--radix-popper-available-height)"},children:JSON.stringify(p?.[r.name]?.[0]||a,null,2)}),d?t.jsx("div",{className:"absolute top-0 right-0 animate-spin p-2 opacity-50",children:t.jsx(U.Cog8ToothIcon,{width:12})}):null]})})]})})}function En({q:e,option:r,uniqueAttrs:a,filterableAttrs:n}){const[o,s]=b.useState(!1);return t.jsx(re.ComboboxOption,{value:r,className:Pe("cursor-pointer px-3 py-1 data-focus:bg-blue-100 dark:border-neutral-700 dark:bg-neutral-800",{}),children:t.jsx(ue.Provider,{children:t.jsxs(ue.Root,{delayDuration:0,open:o,children:[t.jsx(ue.Trigger,{asChild:!0,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:t.jsxs("div",{children:[t.jsx("div",{children:t.jsx("code",{children:r.id})}),t.jsxs("div",{className:"truncate",children:[n.filter(i=>r.hasOwnProperty(i.name)&&!i.isUniq&&e&&JSON.stringify(r[i.name]).toLowerCase().indexOf(e.toLowerCase())!==-1).slice(0,3).map(i=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:i.name}),":"," ",JSON.stringify(r[i.name])]},i.id)),a.filter(i=>r.hasOwnProperty(i.name)).slice(0,3).map(i=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:i.name}),":"," ",JSON.stringify(r[i.name])]},i.id))]})]})}),t.jsx(ue.Content,{collisionPadding:10,children:t.jsx("div",{className:"bg-opacity-90 max-w-md overflow-auto border bg-white p-2 font-mono text-xs whitespace-pre shadow-md backdrop-blur-xs dark:border-neutral-700 dark:bg-neutral-800",style:{maxHeight:"var(--radix-popper-available-height)"},children:JSON.stringify(r,null,2)})})]})})},r.id)}function Cn({db:e,namespace:r,onLinkRef:a,ignoreIds:n,onClose:o}){const[s,i]=b.useState(""),p=b.useRef(null),{uniqueAttrs:d,filterableAttrs:h}=b.useMemo(()=>{const g=[],f=[];for(const[x,w]of Object.entries(r.attrs))w.isUniq&&w.name!=="id"&&w.type==="blob"&&g.push(w),w.isIndex&&(w.checkedDataType==="string"||w.checkedDataType==="number")&&f.push(w);return{uniqueAttrs:g,filterableAttrs:f}},[r.attrs]),m=b.useMemo(()=>{const g=[{$entityIdStartsWith:s}];let f;try{const x=JSON.parse(s);typeof x=="number"&&(f=x)}catch{}for(const x of h)x.checkedDataType==="string"&&s.trim()&&g.push({[x.name]:{$ilike:`%${s.trim()}%`}}),x.checkedDataType==="number"&&f!=null&&g.push({[x.name]:f});for(const x of d)x.checkedDataType||(g.push({[x.name]:s}),f!=null&&g.push({[x.name]:f}));return{[r.name]:{$:{where:{or:g},limit:20}}}},[r.name,h,s]),{data:c,isLoading:u}=e.useQuery(m),l=c?.[r.name]?.filter(g=>!n.has(g.id));return t.jsx("div",{className:"relative mt-1 w-full",children:t.jsxs(re.Combobox,{onChange:g=>{g&&(a(g),i(""),o())},onClose:o,immediate:!0,children:[t.jsx(re.ComboboxInput,{ref:p,autoFocus:!0,size:32,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-800 dark:placeholder:text-neutral-500",value:s,onChange:g=>{i(g.target.value)},placeholder:`Search ${r.name}...`}),t.jsx(re.ComboboxOptions,{portal:!1,unmount:!1,static:!0,className:"absolute left-0 z-10 mt-1 max-h-[25vh] w-full divide-y overflow-scroll rounded-md border border-gray-300 bg-white shadow-lg empty:invisible dark:border-neutral-700 dark:bg-neutral-800",children:(l||[]).map(g=>t.jsx(En,{q:s,option:g,uniqueAttrs:d,filterableAttrs:h},g.id))}),l?.length||u?null:t.jsxs("div",{className:"absolute left-0 z-10 mt-1 w-full divide-y overflow-scroll rounded-md border border-gray-300 bg-white p-2 shadow-lg dark:border-neutral-700 dark:bg-neutral-800",children:["No matching rows in ",t.jsx("code",{children:r.name})]})]},u?"query-loading":"query-loaded")})}function Rn({db:e,item:r,attr:a,namespace:n,refUpdates:o,handleLinkRef:s,handleUnlinkRef:i}){const[p,d]=b.useState(!1),h=b.useMemo(()=>{const u=new Set;for(const[l]of Object.entries(o||{}))u.add(l);for(const l of r[a.name]||[])u.add(l.id);return u},[r[a.name],o]),m=a.cardinality,c=r[a.name]?.length>0;return t.jsxs(t.Fragment,{children:[r[a.name]?.map(u=>{const l=o?.[u.id]?.action==="unlink";return t.jsxs("div",{children:[t.jsx("code",{className:l?"line-through":"",children:u.id}),t.jsx(fr,{db:e,namespace:n,item:u}),t.jsx(H,{title:l?"Undo":"Unlink",type:"link",size:"mini",variant:l?"subtle":"destructive",className:"border-none",onClick:()=>l?s(a,u):i(a,u.id),children:l?t.jsx(U.ArrowUturnLeftIcon,{height:14}):t.jsx(U.TrashIcon,{height:14})})]},u.id)}),Object.entries(o||{}).map(([u,{action:l,item:g}])=>{if(l==="link")return t.jsxs("div",{children:[t.jsx("code",{children:u}),t.jsx(fr,{db:e,namespace:n,item:g}),t.jsx(H,{title:"Remove",type:"link",size:"mini",variant:"destructive",className:"border-none",onClick:()=>i(a,u),children:t.jsx(U.TrashIcon,{height:14})})]},u)}),p?t.jsx(Cn,{namespace:n,onLinkRef:u=>s(a,u),db:e,ignoreIds:h,onClose:()=>d(!1)}):t.jsx(H,{variant:"secondary",onClick:()=>d(!0),children:m==="many"||!c?"Add link":"Replace link"})]})}const _r=(e,r)=>{switch(e.name){case"$files":return r.type==="blob"&&r.name==="path";case"$streams":return!1;default:return r.type==="blob"}},Dr=e=>{switch(e.namespace){case"$streams":return!1;default:return e.type==="ref"}};function In(e,r){return r.name==="id"?!1:_r(e,r)||r.type==="ref"&&Dr(r)}function mr(e,r){if(r){const a=r.getBoundingClientRect(),n=e.getBoundingClientRect();r.scrollTop+=n.top-a.top-(a.height-n.height)/2;return}e.scrollIntoView({block:"center",inline:"nearest"})}function br({db:e,namespace:r,item:a,onClose:n,focusAttr:o}){const s=a.id?"edit":"add",i=he(),p=b.useRef(null),d=b.useRef({}),h=k=>I=>{d.current[k]=I},[m,c]=b.useState(null),u=[],l=[];for(const k of r.attrs)k.name!=="id"&&(_r(r,k)&&u.push(k),k.type==="ref"&&Dr(k)&&l.push(k));const g=u.reduce((k,I)=>{const E=a[I.name],D=kn(I,E),V=s==="add"?I.isRequired?Rt[D]:null:E;return{...k,[I.name]:{type:D,value:V,error:null}}},{}),[f,x]=b.useState({...g,...s==="add"?{id:{type:"string",value:Oe.id()}}:{}}),[w,v]=b.useState({}),[N,T]=b.useState({}),[F,C]=b.useState({}),[O,M]=b.useState(u.reduce((k,I)=>({...k,[I.name]:s==="edit"?a[I.name]===null||a[I.name]===void 0:f[I.name].value===null}),{})),P=Object.values(F).some(Boolean),Q=Object.values(f).some(k=>!!k.error)||P,[z,B]=b.useState(!1),X=k=>o===k;b.useLayoutEffect(()=>{if(!o)return;const k=d.current[o];k&&mr(k,p.current),f[o]?.type==="boolean"&&!O[o]&&k?.querySelector('[role="combobox"]')?.focus()},[o,f,O]),b.useLayoutEffect(()=>{if(!m)return;const k=d.current[m];k&&(mr(k,p.current),k.querySelector("input, textarea")?.focus()),c(null)},[m,O]);const ae=()=>{v({}),C({}),x({...g}),M(u.reduce((I,E)=>({...I,[E.name]:s==="edit"?a[E.name]===null||a[E.name]===void 0:!1}),{}));const k={};u.forEach(I=>{g[I.name]?.type==="json"&&a[I.name]!==void 0&&(k[I.name]=a[I.name]===null?"null":JSON.stringify(a[I.name],null,2))}),T(k),B(!1)},Z=(k,I)=>{x(E=>{const D=E[k]?.value;return{...E,[k]:{type:I,value:hr(D,I)}}})},_=(k,I,E)=>{let D=E?E(I):null;x(V=>{const ie=V[k]?.type||"string";return!D&&V[k]?.error===It&&(D=null),{...V,[k]:{type:ie,value:hr(I,ie),error:D}}})},G=(k,I)=>{T(E=>({...E,[k]:I})),x(E=>{const D=E[k]||{};return I===""?{...E,[k]:{type:"json",value:void 0,error:"Invalid JSON"}}:vn(I)?{...E,[k]:{type:"json",value:JSON.parse(I),error:null}}:{...E,[k]:{...D,type:"json",error:"Invalid JSON"}}})},W=(k,I)=>{M(D=>({...D,[k]:I}));const E=f[k]?.type||"string";I?(x(D=>({...D,[k]:{type:E,value:null,error:null}})),E==="json"&&T(D=>({...D,[k]:"null"}))):(x(D=>({...D,[k]:{type:E,value:Rt[E],error:null}})),E==="json"&&T(D=>({...D,[k]:"{}"})),c(k))},me=(k,I)=>{v(E=>{if(a[k.name]?.find($=>$.id===I))return{...E,[k.name]:{...E[k.name]||{},[I]:{action:"unlink",item:null}}};const{[I]:V,...ie}=E[k.name]||{};return{...E,[k.name]:ie}})},de=(k,I)=>{C(E=>E[k.name]?{...E,[k.name]:null}:E),v(E=>{const D=I.id,V=E[k.name]?.[D];if(V&&V.action==="unlink"){if(k.cardinality==="one"){const{[k.name]:Y,...ne}=E;return ne}const{[D]:ie,...$}=E[k.name];return{...E,[k.name]:$}}if(k.cardinality==="one"&&a[k.name]?.length){const ie=a[k.name][0];return{...E,[k.name]:{[D]:{action:"link",item:I},[ie.id]:{action:"unlink",item:null}}}}return{...E,[k.name]:{...E[k.name]||{},[D]:{action:"link",item:I}}}})},te=async()=>{const k={},I={};for(const $ of u){if(!$.isRequired)continue;const Y=f[$.name];(O[$.name]||Sn(Y?.type??"string",Y?.value))&&(k[$.name]=It)}for(const $ of l)$.isRequired&&Nn(a,$.name,w[$.name])===0&&(I[$.name]=It);const E=Object.keys(k).length>0||Object.keys(I).length>0,D=Object.values(f).some($=>!!$.error)||Object.values(F).some(Boolean);if(E||D){E&&(x($=>{const Y={...$};for(const[ne,K]of Object.entries(k))Y[ne]={...Y[ne],error:K};return Y}),C($=>({...$,...I}))),B(!0);return}const V=Object.fromEntries(Object.entries(f).map(([$,{value:Y}])=>[$,Y])),ie=a.id||V.id||Oe.id();delete V.id;try{let $=Oe.tx[r.name][ie];const Y=[],ne=[];for(const[K,ut]of Object.entries(w))for(const[Ke,{action:Ye}]of Object.entries(ut))Ye==="link"&&ne.push({[K]:Ke}),Ye==="unlink"&&Y.push({[K]:Ke});for(const K of Y)$=$.unlink(K);$=$.update(V);for(const K of ne)$=$.link(K);await e.transact($),n(),pe("Successfully updated row!")}catch($){const Y=$.message;if(Y)ge(`Failed to save row: ${Y}`);else throw $}};return t.jsxs(xe,{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[t.jsxs("div",{className:"shrink-0 px-1",children:[t.jsx("h5",{className:"flex text-lg font-bold",children:s=="edit"?"Edit row":"Add row"}),t.jsx("code",{className:"font-mono text-sm font-medium text-gray-500 dark:text-neutral-500",children:s=="edit"?t.jsxs(t.Fragment,{children:[r.name,"['",a.id,"']"]}):t.jsx(t.Fragment,{children:r.name})})]}),t.jsx("div",{ref:p,className:"scrollbar-gutter-stable mt-4 min-h-0 flex-1 overflow-y-auto px-4 pb-4",children:t.jsxs("div",{className:"flex flex-col gap-4",children:[s==="add"?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx(De,{className:"font-mono",children:t.jsxs("div",{className:"flex gap-1",children:["id"," ",t.jsx(H,{type:"link",size:"mini",variant:"subtle",onClick:()=>_("id",Oe.id()),children:t.jsx(U.ArrowPathIcon,{height:14})})]})})}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx("input",{className:"flex w-full flex-1 rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800",value:f.id?.value??"",onChange:k=>_("id",k.target.value,jn)})})," ",f.id?.error&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:f.id.error})]},"id"):null,u.map((k,I)=>{const E=I+1,{type:D,value:V,error:ie}=f[k.name]||{type:"string",value:Rt.string},$=N[k.name]||(V!==null?JSON.stringify(V,null,2):"null"),Y=O[k.name],ne=X(k.name);return t.jsxs("div",{ref:h(k.name),className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(De,{className:"font-mono",children:k.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center",children:!k.isRequired&&t.jsx(se,{checked:Y,onChange:K=>W(k.name,K),label:t.jsx("span",{className:"text-[10px] text-gray-600 uppercase dark:text-neutral-600",children:"null"})})}),t.jsx(je,{className:"w-24 rounded-sm px-2 py-0.5 text-sm",value:D,options:wn(k.checkedDataType),onChange:K=>Z(k.name,K.value)})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[Y?t.jsx("button",{type:"button",autoFocus:ne,onClick:()=>W(k.name,!1),className:"flex-1 rounded-xs border border-gray-200 bg-gray-50 px-3 py-1 text-left text-gray-500 italic dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-400",children:"null"}):t.jsxs("div",{className:"flex space-x-1",children:[t.jsx("div",{className:"flex-1",children:D==="json"?t.jsx("div",{className:"h-32 w-full rounded-sm border",children:t.jsx(jt,{darkMode:i.darkMode,tabIndex:E,language:"json",value:$,onChange:K=>G(k.name,K),onMount:K=>{ne&&K.focus()}})}):D==="boolean"?t.jsx(je,{tabIndex:E,value:V,options:[{value:"false",label:"false"},{value:"true",label:"true"}],onChange:K=>_(k.name,K.value)}):D==="number"?t.jsx("input",{tabIndex:E,type:"number",autoFocus:ne,className:"flex w-full flex-1 rounded-xs border-gray-200 bg-white px-3 py-1 placeholder:text-gray-400 dark:border-neutral-700 dark:bg-neutral-800",value:V??"",onChange:K=>_(k.name,K.target.value)}):t.jsx(xn,{tabIndex:E,autoFocus:ne,value:V??"",onChange:K=>_(k.name,K.target.value),onSave:te})}),k.checkedDataType==="date"&&t.jsxs(H,{variant:"subtle",size:"mini",onClick:()=>{_(k.name,D==="number"?Date.now():new Date().toISOString())},children:[t.jsx(J.ClockIcon,{height:14}),"now"]})]}),ie&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:ie})]})]},k.name)}),l.map((k,I)=>{const E=k.isForward?k.linkConfig.reverse.nsMap:k.linkConfig.forward.nsMap;return E?t.jsxs("div",{ref:h(k.name),className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(De,{className:"font-mono",children:k.name}),t.jsxs("span",{className:"rounded-sm px-2 py-0.5 text-sm",children:["Link to ",t.jsx("code",{children:E.name})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx(Rn,{db:e,item:a,namespace:E,attr:k,refUpdates:w[k.name],handleLinkRef:de,handleUnlinkRef:me}),F[k.name]&&z&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:F[k.name]})]})]},k.name):null})]})}),t.jsx("div",{className:"mt-2 shrink-0 border-t border-gray-200 bg-white px-1 pt-4 dark:border-neutral-700 dark:bg-neutral-800",children:t.jsxs("div",{className:"flex flex-row items-center justify-between gap-1",children:[z&&Q?t.jsx("span",{className:"text-sm font-medium text-red-500",children:"Failed to save. Please check above for errors."}):t.jsx("span",{}),t.jsxs("div",{className:"flex flex-row items-center gap-1",children:[t.jsx(H,{type:"button",variant:"secondary",onClick:ae,children:"Reset"}),t.jsx(Se,{tabIndex:u.length+1,type:"submit",variant:"primary",label:"Save",submitLabel:"Saving...",errorMessage:"Failed to save row.",onClick:te})]})]})})]})}const An=[];function Tn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(d=>d.id!=="select-col"&&d.header!==void 0&&!d.meta?.isLink),s=e.map(d=>{const h={};return o.forEach(m=>{const c=d[m.header];c==null?h[m.header]="":typeof c=="object"?h[m.header]=JSON.stringify(c):h[m.header]=c}),h}),i=Ct.mkConfig({fieldSeparator:",",filename:`${a}_export`,decimalSeparator:".",useKeysAsHeaders:!0}),p=Ct.generateCsv(i)(s);n?(Ct.download(i)(p),pe("CSV file downloaded")):(ot(p.toString()),pe("CSV copied to clipboard"))}function On(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(d=>d.id!=="select-col"&&d.header!==void 0&&!d.meta?.isLink),s=o.map(d=>d.header),i=e.map(d=>o.map(h=>{const m=d[h.header];return m==null?" ":typeof m=="object"?JSON.stringify(m):String(m)})),p=xa.markdownTable([s,...i]);if(n){const d=new Blob([p],{type:"text/markdown"}),h=URL.createObjectURL(d),m=document.createElement("a");m.href=h,m.download=`${a}_export.md`,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(h),pe("Markdown file downloaded")}else ot(p),pe("Markdown copied to clipboard")}function _n(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(p=>p.id!=="select-col"&&p.header!==void 0&&!p.meta?.isLink),s=e.map(p=>{const d={};return o.forEach(h=>{const m=p[h.header];d[h.header]=m}),d}),i=JSON.stringify(s,null,2);if(n){const p=new Blob([i],{type:"application/json"}),d=URL.createObjectURL(p),h=document.createElement("a");h.href=d,h.download=`${a}_export.json`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(d),pe("JSON file downloaded")}else ot(i),pe("JSON copied to clipboard")}const Dn=({db:e,namespaces:r})=>{const{explorerState:a,history:n}=xt(),o=he(),s=a,i=r.find(S=>S.id===s.namespace),[p,d]=b.useState(50),[h,m]=b.useState([]),[c,u]=b.useState(!1),[l,g]=b.useState(""),[f,x]=b.useState(!1),{dialog:w,setDialog:v}=$t(),N=w?.type==="edit-schema"?i??null:null,T=w?.type==="edit-row"?w.rowId:null,F=w?.type==="add-row",C=b.useRef(null),[O,M]=b.useState({}),P=b.useRef(null),Q=i?.name?.startsWith("$")??!1,z=i?.name??"",B=Q&&!["$users","$files","$streams"].includes(z),X=O[z]||0,ae=s?.sortAttr||"serverCreatedAt",Z=s?.sortAsc??!0,_=(S,j)=>{const R=ce.options.data.map(we=>we.id),L=R.indexOf(S),q=R.indexOf(C.current),[ee,le]=[Math.min(L,q),Math.max(L,q)];Le(we=>{const et={...we};for(let ze=ee;ze<=le;ze++){const ht=R[ze];j?et[ht]=!0:delete et[ht]}return et})},[G,W]=b.useState([]),{itemsRes:me,allCount:de}=Ga(e,i,s?.where,Ua(s?.where,s?.filters,G),p,X,ae,Z),te=me.data?.[i?.name??""]??An;function k(S,j){return S.filter(R=>j[R.id])}const I=de?Math.ceil(de/p):1,E=X/p+1,[D,V]=Lt("localDates",!1),ie=async()=>{try{if(u(!0),h.length===0)return;const[S]=h;await zn(o.adminToken,o.appId,S,l,o.apiURI)&&(m([]),g(""),P.current&&(P.current.value="")),pe("Successfully uploaded!")}catch(S){console.error("Failed to upload:",S),ge(`Failed to upload: ${S.body.message}`)}finally{u(!1)}},$=b.useMemo(()=>te,[te]),Y=b.useRef(null),[ne,K]=b.useState(0),[ut,Ke]=b.useState(1),[Ye,ar]=b.useState(!1),ta=S=>{if(ce?.getColumn(S)?.columnDef.header==="id"){nr(S,285);return}const j=Ya(S,800);nr(S,j)},nr=(S,j=200)=>{if(!i)return;const R={};i?.attrs.forEach(L=>{R[L.id+L.name]=ce.getColumn(L.id+L.name)?.getSize()||0}),ce.setColumnSizing({...R,[S]:j})},Xe=b.useMemo(()=>{const S=[];return S.push({id:"select-col",enableSorting:!1,accessorFn:()=>null,enableHiding:!1,enableResizing:!1,size:52,header:({table:j})=>t.jsx(se,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",style:{pointerEvents:"auto"},checked:j.getIsAllRowsSelected(),onChange:R=>{R?(j.toggleAllRowsSelected(),te.length>0&&(C.current=te[0].id)):(Le({}),C.current=null)}}),cell:({row:j,column:R})=>t.jsxs("div",{className:"flex h-full w-full items-center gap-2",children:[t.jsx(se,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",checked:j.getIsSelected(),onChange:(L,q)=>{(q.nativeEvent?q.nativeEvent.shiftKey:!1)&&C.current?_(j.id,q.target.checked):Le(le=>{const we={...le};return q.target.checked?we[j.id]=!0:delete we[j.id],we}),C.current=j.id}}),B?null:t.jsx("button",{type:"button",title:"Edit row",className:"rounded-xs p-0.5 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-neutral-100 dark:hover:bg-neutral-700",onClick:()=>v({type:"edit-row",rowId:j.id}),children:t.jsx(J.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})})]})}),i?.attrs?.forEach(j=>{S.push({id:j.id+j.name,header:j.name,enableSorting:!0,enableResizing:!0,accessorFn:R=>R[j.name],meta:{sortable:j.sortable||j.name==="id",copyable:!0,isLink:j.type==="ref",attr:j,disablePadding:j.namespace==="$files"&&j.name==="url",editable:!B&&i!=null&&In(i,j)},cell:R=>{if(R.row.original[j.name]===null||R.row.original[j.name]===void 0)return t.jsx("div",{className:"h-1",children:"-"});if(j.type==="ref"){const L=R.row.original[j.name].length;return t.jsxs("div",{className:A("h-1 translate-y-0.5",L<1&&"opacity-50"),children:[L," link",L===1?"":"s"]})}if(j.namespace==="$files"){if(j.name==="url")return t.jsx("a",{className:"flex h-full w-full items-center pl-2 text-xs font-bold underline hover:text-black dark:hover:text-white",href:R.row.original.url,target:"_blank",children:"View File"});if(j.name==="size")return Ka(R.row.original[j.name])}if(j.checkedDataType==="boolean")return R.row.original[j.name]?"true":"false";if(j.checkedDataType==="date"){const L=Ne.coerceToDate(R.row.original[j.name]);return D&&L?.toLocaleString()||R.row.original[j.name]}return be.isObject(R.row.original[j.name])?t.jsx(Ln,{data:R.row.original[j.name]}):R.row.original[j.name]}})}),S},[i,B,D]),[ra,aa]=b.useState({}),na=()=>{const S=Object.entries(ce.getState().columnSizing).reduce((q,[ee,le])=>pt.visibility[ee]!==!1?{...q,[ee]:le}:q,{}),j=Y.current?.clientWidth||-1,R=Object.values(S).reduce((q,ee)=>q+ee,0),L=j-52-R;if(L>0){const q=Object.keys(S).length,ee=L/q;Object.keys(S).forEach(le=>{S[le]+=ee})}ar(!1),ce.setColumnSizing(()=>({...S}))},oa="onChange",sa="ltr",pt=Wa({appId:o.appId,attrs:i?.attrs,namespaceId:i?.id}),[Ze,gt]=b.useState(()=>Xe.map(S=>S.id));b.useLayoutEffect(()=>{if(i?.attrs){const S=localStorage.getItem(`order-${i.id}-${o.appId}`);if(S)gt(JSON.parse(S));else{const j=i.attrs.map(R=>R.id+R.name);gt(["select-col",...j])}}},[i?.attrs]),b.useEffect(()=>{i?.id&&localStorage.setItem(`order-${i.id}-${o.appId}`,JSON.stringify(Ze))},[Ze,i?.id]);const[Fe,Le]=b.useState({});b.useEffect(()=>{Le({}),W([]),C.current=null},[i?.id]);const Je=Object.keys(Fe).length,$e=z==="$files"?Je===1?"file":"files":Je===1?"row":"rows",ce=_e.useReactTable({columnResizeDirection:sa,columnResizeMode:oa,onColumnVisibilityChange:pt.setVisibility,columns:Xe,data:$,enableColumnResizing:!0,enableRowSelection:!0,getCoreRowModel:_e.getCoreRowModel(),getRowId:S=>S.id,onColumnOrderChange:gt,onRowSelectionChange:Le,onColumnSizingChange:aa,state:{columnSizing:ra,columnOrder:Ze,columnVisibility:pt.visibility,rowSelection:Fe}}),[Ae,Nt]=b.useState(!1);b.useEffect(()=>{const S=L=>{L.key==="Shift"&&Nt(!0)},j=L=>{L.key==="Shift"&&Nt(!1)},R=()=>{Nt(!1)};return window.addEventListener("keydown",S),window.addEventListener("keyup",j),window.addEventListener("blur",R),()=>{window.removeEventListener("keydown",S),window.removeEventListener("keyup",j),window.removeEventListener("blur-sm",R)}},[]);const[ia,Qe]=b.useState(!1);function la(S){const{active:j,over:R}=S;j&&R&&j.id!==R.id&&j.id!=="select-col"&&R.id!=="select-col"&&gt(L=>{const q=L.indexOf(j.id),ee=L.indexOf(R.id);return Te.arrayMove(L,q,ee)})}const Et=b.useMemo(()=>te.find(S=>S.id===T),[te.length,T]);b.useEffect(()=>{const S=Y.current;if(!S)return;const j=()=>{const q=ce.getCenterTotalSize(),ee=S.clientWidth;ar(q<ee-5);const{scrollLeft:le,scrollWidth:we,clientWidth:et}=S,ze=we-et;if(ze<=0){K(0),Ke(0);return}const ht=Math.min(le/30,1);K(ht);const ga=Math.min((ze-le)/30,1);Ke(ga)};j(),S.addEventListener("scroll",j);const R=new ResizeObserver(j);R.observe(S);const L=S.firstElementChild;return L&&R.observe(L),window.addEventListener("resize",j),()=>{S.removeEventListener("scroll",j),R.disconnect(),window.removeEventListener("resize",j)}},[i,$]);const da=ve.useSensors(ve.useSensor(ve.MouseSensor,{}),ve.useSensor(ve.TouchSensor,{}),ve.useSensor(ve.KeyboardSensor,{})),ca=n.items.length>=1,ua=S=>S==="id"?140:S==="url"?120:S.length*7.2+50;if(b.useLayoutEffect(()=>{if(i?.id){if(localStorage.getItem(`$sizing-${i.id}-${o.appId}`)){const q=JSON.parse(localStorage.getItem(`sizing-${i.id}-${o.appId}`)||"{}");ce.setColumnSizing(()=>({...q}));return}const S=Y.current?.clientWidth||-1,j={};i?.attrs.forEach(q=>{j[q.id+q.name]=ua(q.name)});const R=Object.values(j).reduce((q,ee)=>q+ee,0),L=S-52-R;if(L>0){const q=Object.keys(j).length,ee=L/q;Object.keys(j).forEach(le=>{j[le]+=ee})}ce.setColumnSizing(j)}},[Y.current,i]),!i)return null;const pa=i.id;return t.jsxs(t.Fragment,{children:[t.jsx(ke,{title:"Delete Rows",open:f,onClose:()=>x(!1),children:i?t.jsxs(xe,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex text-lg font-bold",children:["Delete ",$e]}),t.jsxs(lt,{children:["Deleting is an"," ",t.jsx("strong",{className:"dark:text-white",children:"irreversible operation"})," ","and will"," ",t.jsxs("strong",{className:"dark:text-white",children:["delete ",Je," ",$e," "]}),"associated with"," ",t.jsx("strong",{className:"dark:text-white",children:i.name}),"."]}),t.jsx(Se,{type:"submit",disabled:B,label:`Delete ${$e}`,submitLabel:`Deleting ${$e}...`,errorMessage:`Failed to delete ${$e}`,className:"border-red-500 text-red-500",title:B?`The ${i?.name} namespace is read-only.`:void 0,onClick:async()=>{try{await e.transact(Object.keys(Fe).map(S=>Ne.tx[i.name][S].delete()))}catch(S){const j=S.message;ge(`Failed to delete ${$e}${j?`: ${j}`:""}`);return}Le({}),x(!1)}})]}):null}),t.jsx(ke,{title:"Add Row",open:F,onClose:()=>v(null),className:"flex max-h-[calc(100dvh-4rem)] flex-col overflow-hidden",children:i?t.jsx(br,{db:e,item:{},namespace:i,onClose:()=>v(null)}):null}),t.jsx(ke,{title:"Edit Row",open:!!Et,onClose:()=>v(null),className:"flex max-h-[calc(100dvh-4rem)] flex-col overflow-hidden",children:i&&Et?t.jsx(br,{db:e,namespace:i,item:Et,focusAttr:w?.type==="edit-row"?w.focusAttr:void 0,onClose:()=>v(null)}):null}),t.jsx(ke,{title:"Edit Namespace",stopFocusPropagation:!0,open:!!N,onClose:()=>v(null),children:i?t.jsx(sn,{readOnly:B,isSystemCatalogNs:Q,db:e,namespace:i,namespaces:r??[],screen:w?.type==="edit-schema"?w.screen:{kind:"main"},onScreenChange:S=>v({type:"edit-schema",screen:S},{history:"replace"}),onClose:S=>{v(null),S?.ok&&n.push({namespace:r?.[0].id})}}):null}),t.jsxs("div",{className:"flex flex-1 grow flex-col overflow-hidden bg-white dark:bg-neutral-800",children:[t.jsx("div",{className:"flex items-center overflow-hidden border-b border-b-gray-200 dark:border-neutral-700",children:t.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-between py-2 md:flex-row md:items-center",children:[t.jsxs("div",{className:"flex min-w-0 flex-1 items-center self-stretch overflow-hidden border-b px-2 py-1 pl-4 md:border-b-0 dark:border-neutral-700",children:[ca?t.jsx(ye.ArrowLeftIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>n.pop()}):null,s.where?t.jsx(J.XMarkIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>{n.push({namespace:i.id},!0)}}):null,t.jsxs("div",{className:"relative min-w-0 flex-1 self-stretch [timeline-scope:--filter-scroll]",children:[t.jsxs("div",{className:"flex h-full items-center overflow-x-auto font-mono text-xs whitespace-nowrap [scroll-timeline:--filter-scroll_inline] dark:text-white",children:[t.jsx("strong",{children:i.name})," ",s.where?t.jsxs(t.Fragment,{children:[" where ",t.jsx("strong",{children:s.where[0]})," ="," ",t.jsx("em",{className:"rounded-xs border bg-white px-1 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",children:JSON.stringify(s.where[1])})]}):null,s?.filters?.length?t.jsx("span",{title:s.filters.map(([S,j,R])=>`${S} ${j} ${R}`).join(" || "),children:s.filters.map(([S,j,R],L)=>t.jsxs("span",{children:[t.jsxs("em",{className:"rounded-xs border bg-white px-1 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",children:[S," ",j," ",R]}),s?.filters?.length&&L<s.filters.length-1?" || ":null]},S))}):null]}),t.jsx("div",{"aria-hidden":"true",className:"filter-shadow-l pointer-events-none absolute top-0 bottom-0 left-0 w-[30px] bg-linear-to-r from-black/10 via-black/0 to-transparent"}),t.jsx("div",{"aria-hidden":"true",className:"filter-shadow-r pointer-events-none absolute top-0 right-0 bottom-0 w-[30px] bg-linear-to-l from-black/20 via-black/5 to-transparent"})]})]}),t.jsxs("div",{className:"flex justify-between gap-2 px-2 py-1 md:justify-start",children:[t.jsx(H,{className:"rounded-sm dark:bg-neutral-700/50",variant:"secondary",size:"mini",onClick:()=>{v({type:"edit-schema",screen:{kind:"main"}})},children:"Edit Schema"}),t.jsx(Ba,{onSearchChange:S=>{W(S),n.push(j=>({...j,filters:S.length?S:void 0}),!0)},attrs:i?.attrs,initialFilters:s?.filters||[]},pa)]})]})}),i.name==="$files"?t.jsx("div",{className:"flex gap-2 px-2 py-2",children:t.jsxs("div",{className:"flex w-full gap-2",children:[t.jsxs("div",{className:"flex shrink-0 gap-2",children:[t.jsx("input",{ref:P,type:"file",className:"flex cursor-pointer rounded-sm border border-neutral-200 bg-transparent px-1 pt-1.5 text-sm shadow-xs transition-colors file:rounded-xs file:border-none file:border-neutral-200 file:bg-transparent file:p-2 file:pt-1 file:text-sm file:font-medium file:shadow-none placeholder:text-neutral-500 focus-visible:ring-1 focus-visible:ring-neutral-950 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50 dark:border-neutral-700 dark:bg-neutral-800 dark:text-white dark:file:border-neutral-700 dark:file:text-white dark:placeholder:text-neutral-400 dark:focus-visible:ring-neutral-400",onChange:S=>{const j=S.target.files;m(j),j?.[0]&&g(j[0].name)}}),t.jsx(H,{variant:"primary",disabled:h.length===0,size:"mini",loading:c,onClick:ie,className:"rounded-sm",children:c?"Uploading...":"Upload file"})]}),t.jsxs("div",{className:"relative flex max-w-[67vw] min-w-0 flex-1 rounded-sm border border-neutral-200 focus-within:ring-2 focus-within:ring-blue-700 dark:border-neutral-700 dark:focus-within:ring-blue-500",children:[t.jsx("span",{className:"absolute inset-y-0 left-0 flex items-center rounded-l bg-neutral-100 px-3 text-sm text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400",children:"File Path:"}),t.jsx("input",{type:"text",placeholder:"Enter a custom path (optional)",value:l,onChange:S=>g(S.target.value),className:"h-9 w-full rounded-sm border-0 bg-transparent py-1 pr-3 pl-24 text-sm ring-0 placeholder:text-neutral-500 focus:outline-none dark:bg-neutral-800 dark:text-white dark:placeholder:text-neutral-400"})]})]})}):null,t.jsxs("div",{className:"flex items-center justify-start space-x-2 border-b border-b-gray-200 p-1 text-xs dark:border-neutral-700 dark:text-white",children:[i.name!=="$files"?t.jsxs(H,{disabled:B,title:B?`The ${i?.name} namespace is read-only.`:void 0,size:"mini",variant:"secondary",onClick:()=>{v({type:"add-row"})},children:[t.jsx(ye.PlusIcon,{width:12}),"Add row"]}):null,t.jsx("div",{className:A("px-1",i.name==="$files"&&"pb-1"),children:t.jsx(je,{className:"rounded-sm text-xs",onChange:S=>{if(!S)return;const j=parseInt(S.value,10);d(j),n.push(R=>({...R,limit:j}))},value:`${p}`,options:[{label:"25/page",value:"25"},{label:"50/page",value:"50"},{label:"100/page",value:"100"}]})}),t.jsx("div",{className:"w-[62px]",children:de!==void 0&&(de===0?t.jsx(t.Fragment,{children:"No Results"}):t.jsxs(t.Fragment,{children:[(E-1)*p+1," -"," ",Math.min(de,E*p)," of ",de]}))}),t.jsx("button",{className:"flex items-center justify-center",disabled:E<=1,onClick:()=>{M({...O,[i.name]:Math.max(0,X-p)}),n.push(S=>({...S,page:Math.max(1,E-1)}))},children:t.jsx(ye.ArrowLeftIcon,{className:A("inline",{"opacity-40":E<=1}),height:"1rem"})}),t.jsx("div",{className:"flex items-center space-x-1 overflow-hidden",children:[...new Array(I)].map((S,j)=>{const R=j+1;return I>6&&R!==1&&R!==I&&R!==E&&R!==E-1&&R!==E+1?R===E-2||R===E+2?t.jsx("div",{children:"..."},R):null:t.jsx("button",{className:A("rounded-md px-3 py-1 text-neutral-600 dark:text-neutral-300",R===E?"bg-neutral-200 dark:bg-neutral-700":"hover:bg-neutral-100 dark:hover:bg-neutral-800"),onClick:()=>{M({...O,[i.name]:j*p}),n.push(L=>({...L,page:R}))},disabled:R===E,children:R},R)})}),t.jsx("button",{className:"flex items-center justify-center",disabled:E>=I,onClick:()=>{M({...O,[i.name]:X+p}),n.push(S=>({...S,page:Math.min(I,E+1)}))},children:t.jsx(ye.ArrowRightIcon,{className:A("inline",{"opacity-40":E>=I}),height:"1rem"})}),Je>0&&t.jsxs("div",{className:"flex items-center gap-2 pl-4",children:[t.jsxs(Jt,{open:ia,onOpenChange:Qe,children:[t.jsx(Qt,{children:t.jsxs(H,{onClick:()=>{Qe(!0)},variant:"secondary",children:[t.jsx(J.ArrowUpOnSquareIcon,{width:14}),"Export (",Je,")"]})}),t.jsxs(er,{className:"z-100",align:"end",side:"bottom",sideOffset:5,children:[t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);Tn(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.Table,{width:12}),Ae?"Download as CSV":"Copy as CSV"]}),t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);On(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.FileDown,{width:12}),Ae?"Download as Markdown":"Copy as Markdown"]}),t.jsxs(Be,{onSelect:S=>{S.preventDefault();const j=k(te,Fe);_n(j,Xe,i.name,Ae),Qe(!1)},className:"flex items-center gap-2",children:[t.jsx(ye.CurlyBraces,{width:12}),Ae?"Download as JSON":"Copy as JSON"]}),!Ae&&t.jsxs(t.Fragment,{children:[t.jsx(tr,{}),t.jsx(Be,{className:"text-xs text-neutral-500 dark:text-neutral-400",disabled:!0,children:"Hold shift to download as file"})]})]})]}),t.jsxs(H,{onClick:()=>{x(!0)},className:"px-2",variant:"destructive",children:[t.jsx(J.TrashIcon,{width:14}),"Delete Selected Rows"]})]}),t.jsx("div",{className:"grow"}),t.jsx("div",{className:"px-2",children:t.jsx(tn,{localDates:D,setLocalDates:V,visiblity:pt})})]}),t.jsx(ve.DndContext,{collisionDetection:ve.closestCenter,modifiers:[wa.restrictToHorizontalAxis],onDragEnd:la,sensors:da,children:t.jsxs("div",{className:"relative flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-900/50",children:[!Ye&&t.jsx("div",{className:"absolute top-0 right-0 bottom-0 z-50 w-[30px] bg-linear-to-l from-black/20 via-black/5 to-transparent transition-opacity duration-150",style:{pointerEvents:"none",opacity:ut,display:ut==0?"none":void 0}}),t.jsx("div",{className:"absolute top-0 bottom-0 left-0 z-50 w-[30px] bg-linear-to-r from-black/10 via-black/0 to-transparent transition-opacity duration-150",style:{pointerEvents:"none",opacity:ne,display:ne==0?"none":void 0}}),t.jsx("div",{ref:Y,className:"h-full w-full overflow-auto",children:t.jsxs("div",{className:"flex w-max items-start",children:[t.jsxs("div",{style:{width:ce.getCenterTotalSize()},className:"z-0 text-left font-mono text-xs text-neutral-500 dark:text-neutral-400",children:[t.jsx("div",{className:"sticky top-0 z-10 border-r border-b border-gray-200 border-r-gray-200 bg-white text-neutral-700 shadow-sm dark:border-r-neutral-700 dark:border-b-neutral-600 dark:bg-[#303030] dark:text-neutral-300",children:ce.getHeaderGroups().map(S=>t.jsx("div",{className:"flex w-full",children:t.jsx(Te.SortableContext,{items:Ze,strategy:Te.horizontalListSortingStrategy,children:S.headers.map((j,R)=>t.jsx(Za,{header:j,table:ce,headerGroup:S,index:R,setMinViableColWidth:ta,onSort:(L,q,ee)=>{n.push(le=>({...le,sortAttr:L,sortAsc:q!==L?!0:!ee}))},currentSortAttr:s?.sortAttr,currentSortAsc:s?.sortAsc},j.id))})},S.id))}),t.jsx("div",{children:ce.getRowModel().rows.map(S=>t.jsx("div",{className:"group flex border-r border-b border-r-gray-200 border-b-gray-200 bg-white dark:border-neutral-700 dark:border-r-neutral-700 dark:bg-neutral-800",children:S.getVisibleCells().map(j=>t.jsx(Te.SortableContext,{items:Ze,strategy:Te.horizontalListSortingStrategy,children:t.jsx(Ja,{cell:j},j.id)},j.id))},S.id))})]}),Ye&&t.jsx("div",{className:"sticky top-0",children:t.jsx(dt,{className:"opacity-60",labelDirection:"bottom",label:"Fill Width",icon:t.jsx(ye.ArrowRightFromLine,{}),onClick:na})})]})})]})})]})]})};function Fn(e,r){return be.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function Ln({data:e,pretty:r}){const a=he(),n=Fn(e,r);return r&&be.isObject(e)?t.jsx(St,{darkMode:a.darkMode,code:n,language:"json"}):t.jsx(t.Fragment,{children:n})}async function $n(e,r){const a=await fetch(e,r),n=await a.json();return a.status===200?Promise.resolve(n):Promise.reject({status:a.status,body:n})}async function zn(e,r,a,n,o){const s={app_id:r,path:n||a.name,authorization:`Bearer ${e}`,"content-type":a.type};return await $n(`${o}/dash/apps/${r}/storage/upload`,{method:"PUT",headers:s,body:a})}function Bn(e,r){const a=n=>{e.current&&n.target instanceof HTMLElement&&!e.current.contains(n.target)&&r()};b.useEffect(()=>(document.addEventListener("click",a),()=>{document.removeEventListener("click",a)}))}const Mn=({namespaces:e,db:r,appId:a})=>{const n=he(),{dialog:o,setDialog:s}=$t(),i={open:o?.type==="recently-deleted-ns",onOpen:()=>s({type:"recently-deleted-ns"}),onClose:()=>s(null)},p={open:o?.type==="new-namespace",onOpen:()=>s({type:"new-namespace"}),onClose:()=>s(null)},d=e.find(x=>x.id===n.explorerState?.namespace),[h,m]=b.useState(!1),c=b.useRef(null),[u,l]=Lt(`${a}:recentExplorerNamespace`,d?.id||"");Bn(c,()=>{m(!1)}),b.useEffect(function(){d&&l(d.id)},[d,a,e]);const{setExplorerState:g}=n;b.useEffect(()=>{if(!d&&e.length>0){const w=(u?e.find(v=>v.id===u):void 0)?.id??e[0].id;g(v=>({...v??{},namespace:w}))}},[d,e,u,g]);const f=Er(n.appId);return t.jsxs("div",{className:A("relative flex w-full flex-1 overflow-hidden border-solid dark:bg-neutral-800",n.className),children:[t.jsx(ke,{title:"Recently Deleted Namespaces",...i,children:t.jsx(Aa,{appId:n.appId,db:r})}),t.jsx(ke,{title:"New Namespace",...p,children:t.jsx(Da,{db:r,onClose:x=>{p.onClose(),x?.name&&n.setExplorerState({namespace:x.name})}})}),t.jsxs("div",{ref:c,className:A("absolute top-0 bottom-0 left-0 z-40 flex min-w-[200px] flex-col gap-1 border-r border-solid border-r-gray-200 bg-white p-2 shadow-md md:static md:flex md:shadow-none dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",{hidden:!h}),children:[t.jsxs("div",{className:"flex items-center gap-1 text-sm font-semibold dark:text-white",children:[t.jsx(U.ChevronLeftIcon,{height:"1rem",className:"cursor-pointer md:hidden dark:text-white",onClick:()=>m(!1)}),"Namespaces"]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-hidden overflow-y-auto",children:e.length?t.jsx(Gt,{className:"text-sm",selectedId:n.explorerState?.namespace,items:e.map(x=>({id:x.id,label:x.name})),onChange:x=>{n.setExplorerState({namespace:x.id})}}):null}),t.jsxs(H,{variant:"secondary",size:"mini",className:"justify-center",onClick:p.onOpen,children:[t.jsx(U.PlusIcon,{height:"1rem"})," Create"]}),f.length?t.jsxs(H,{className:"justify-start gap-2 rounded-sm p-2",variant:"subtle",size:"nano",onClick:i.onOpen,children:[t.jsx("span",{className:"rounded-sm bg-gray-200 px-1 text-gray-700 dark:bg-neutral-700 dark:text-neutral-100",children:f.length}),t.jsx("span",{children:"Recently Deleted"})]}):null]}):t.jsx("div",{className:"animate-slow-pulse flex w-full flex-col gap-2",children:Array.from({length:3}).map((x,w)=>t.jsx("div",{className:"h-4 w-full rounded-md bg-neutral-300 dark:bg-neutral-700"},w))})]}),t.jsx("div",{className:"flex flex-col gap-2 border-r border-gray-300 bg-neutral-100 p-1 md:hidden dark:border-neutral-700 dark:bg-neutral-800",children:t.jsx("button",{className:"flex cursor-pointer items-center gap-1 rounded-sm px-1 py-0.5 select-none hover:bg-neutral-300 dark:hover:bg-neutral-700",onClick:x=>{x.stopPropagation(),m(!0)},children:t.jsx(U.Bars3Icon,{height:"1rem",className:"dark:text-white"})})}),n.explorerState&&t.jsx(Dn,{namespaces:e,db:r})]})},qn=({appId:e,apiURI:r,websocketURI:a,adminToken:n})=>b.useMemo(()=>Oe.init({appId:e,apiURI:r,websocketURI:a,__adminToken:n,disableValidation:!0,devtool:!1}),[e,r,a,n]);class Un extends b.Component{state={hasError:!1,error:null};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,a){console.error("Uncaught error:",r,a)}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){return this.state.hasError?t.jsxs("div",{className:"flex h-full w-full flex-1 flex-col items-center justify-center gap-4 bg-white p-6 dark:bg-neutral-800",children:[t.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[t.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:t.jsx(J.ExclamationTriangleIcon,{className:"h-6 w-6 text-red-600 dark:text-red-400"})}),t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("h2",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:"Something went wrong"}),t.jsx("p",{className:"max-w-md text-sm text-gray-500 dark:text-neutral-400",children:"An unexpected error occurred. Please try again or contact support if the problem persists."})]}),this.state.error&&t.jsxs("details",{className:"mt-2 w-full max-w-md",children:[t.jsx("summary",{className:"cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-neutral-400 dark:hover:text-neutral-300",children:"Error details"}),t.jsx("pre",{className:"mt-2 overflow-auto rounded border border-gray-200 bg-gray-50 p-2 text-left font-mono text-xs text-gray-700 dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-300",children:this.state.error.message})]})]}),t.jsx("button",{onClick:this.handleRetry,className:"inline-flex cursor-pointer items-center justify-center gap-1 rounded-sm bg-[#606AF4] px-8 py-1 font-bold whitespace-nowrap text-white transition-all hover:bg-[#4543e9]",children:"Try again"})]}):this.props.children}}const bt=b.createContext({props:null,history:{push:()=>{},pop:()=>{},items:[]}}),he=()=>{const e=b.useContext(bt);if(!e.props)throw new Error("useExplorerProps must be used within an Explorer component");return e.props},xt=()=>{const e=b.useContext(bt);if(!e.props||!e.props.explorerState)throw new Error("useExplorerProps must be used within an Explorer component");return{explorerState:e.props.explorerState,history:e.history}},$t=()=>{const e=b.useContext(bt);if(!e.props)throw new Error("useExplorerDialog must be used within an Explorer component");const r=e.props,a=r.explorerState?.dialog??null,n=b.useCallback((o,s)=>{r.setExplorerState(i=>i&&{...i,dialog:o},s)},[r]);return{dialog:a,setDialog:n}},Fr=e=>e.explorerState!==void 0||e.setExplorerState!==void 0,Pn=(e,r,a)=>{const n=Fr(e);return{...e,apiURI:e.apiURI||ir.apiURI,websocketURI:e.websocketURI||ir.websocketURI,darkMode:e.darkMode===void 0?!1:e.darkMode,explorerState:n?e.explorerState??null:r,setExplorerState:e.setExplorerState||a,useShadowDOM:e.useShadowDOM===void 0?!0:e.useShadowDOM}},Gn=e=>{const[r,a]=b.useState(null),n=Pn(e,r,a);if(!n.adminToken)throw new Error("adminToken is required for explorer");if(!n.appId)throw new Error("appId is required for explorer");const{explorerState:o,setExplorerState:s}=n,[i,p]=b.useState([]),d=b.useCallback((x,w=!1)=>{p(v=>!w&&o?[...v,o]:v),s(x)},[o,s]),h=b.useCallback(()=>{p(x=>{if(x.length>0){const[w,...v]=x;return s(w),v}return x})},[s]),m=qn({appId:n.appId,apiURI:n.apiURI,websocketURI:n.websocketURI,adminToken:n.adminToken}),c=b.useRef(!0),u=b.useRef(n.appId);b.useEffect(()=>{if(c.current){c.current=!1;return}u.current!==n.appId&&(u.current=n.appId,p([]),Fr(e)||a(null))},[n.appId,e]);const l=Ha(m),g=b.useMemo(()=>({props:n,history:{push:d,pop:h,items:i}}),[n,d,h,i]),f=n.useShadowDOM?Lr:b.Fragment;return t.jsx(bt.Provider,{value:g,children:t.jsx(f,{children:t.jsx(Un,{children:t.jsx(Mn,{appId:n.appId,db:m,namespaces:l.namespaces||[]})})})})},zt=b.createContext({shadowRoot:null,container:null,darkMode:!1});function it(){return b.useContext(zt).container}function wt(){return b.useContext(zt).darkMode}const Lr=({children:e})=>{const r=b.useRef(null),a=b.useRef(null),[n,o]=b.useState(null),i=he().darkMode;b.useEffect(()=>{if(r.current&&!n)try{const d=r.current.attachShadow({mode:"open"});a.current=d;const h=document.createElement("style");h.textContent=Ca;const m=document.createElement("div");m.setAttribute("class",i?"h-full dark":"h-full"),d.appendChild(h),d.appendChild(m),o(m)}catch{}},[n]),b.useEffect(()=>{n&&n.setAttribute("class",i?"h-full dark":"h-full")},[i,n]);const p=b.useMemo(()=>({shadowRoot:a.current,container:n,darkMode:i}),[n,i]);return t.jsx("div",{ref:r,style:{height:"100%"},className:A("h-full"),children:t.jsx(zt.Provider,{value:p,children:n?ba.createPortal(e,n):null})})};function Bt({...e}){return t.jsx(oe.Root,{"data-slot":"select",...e})}function $r({...e}){return t.jsx(oe.Group,{"data-slot":"select-group",...e})}function Mt({...e}){return t.jsx(oe.Value,{className:"content-[hi]","data-slot":"select-value",...e})}function qt({className:e,size:r="default",children:a,...n}){return t.jsxs(oe.Trigger,{"data-slot":"select-trigger","data-size":r,className:A("data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex w-fit items-center justify-between gap-2 rounded-sm border border-gray-300/80 bg-white px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:border-neutral-700 dark:bg-neutral-800 dark:hover:bg-neutral-700/50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n,children:[a,t.jsx(oe.Icon,{asChild:!0,children:t.jsx(J.ChevronDownIcon,{width:14})})]})}function Ut({className:e,children:r,position:a="popper",...n}){const o=it(),s=wt();return t.jsx(oe.Portal,{container:o,children:t.jsxs(oe.Content,{"data-slot":"select-content",className:A("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border bg-gray-100 text-gray-900 shadow-md dark:border-neutral-700 dark:bg-neutral-800 dark:text-white",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s?"dark":"",e),position:a,...n,children:[t.jsx(Hn,{}),t.jsx(oe.Viewport,{className:A("p-1",a==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:r}),t.jsx(Wn,{})]})})}function zr({className:e,...r}){return t.jsx(oe.Label,{"data-slot":"select-label",className:A("text-muted-foreground px-2 py-1.5 text-xs",e),...r})}function Pt({className:e,children:r,...a}){return t.jsxs(oe.Item,{"data-slot":"select-item",className:A("relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none hover:bg-gray-200/50 data-disabled:pointer-events-none data-disabled:opacity-50 dark:text-white dark:hover:bg-neutral-700 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...a,children:[t.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:t.jsx(oe.ItemIndicator,{children:t.jsx(J.CheckIcon,{width:12,className:"size-4"})})}),t.jsx(oe.ItemText,{children:r})]})}function Br({className:e,...r}){return t.jsx(oe.Separator,{"data-slot":"select-separator",className:A("bg-border pointer-events-none -mx-1 my-1 h-px",e),...r})}function Hn({className:e,...r}){return t.jsx(oe.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:A("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(J.ChevronUpIcon,{className:"size-4"})})}function Wn({className:e,...r}){return t.jsx(oe.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:A("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(J.ChevronDownIcon,{className:"size-4"})})}/**
2
2
  * Prism: Lightweight, robust, elegant syntax highlighting
3
3
  *
4
4
  * @license MIT <https://opensource.org/licenses/MIT>
package/dist/index.js CHANGED
@@ -3827,7 +3827,7 @@ const jo = ({ db: e, namespaces: t }) => {
3827
3827
  return /* @__PURE__ */ r(
3828
3828
  "a",
3829
3829
  {
3830
- className: "h-full w-full pl-2 align-middle text-xs font-bold underline hover:text-black dark:hover:text-white",
3830
+ className: "flex h-full w-full items-center pl-2 text-xs font-bold underline hover:text-black dark:hover:text-white",
3831
3831
  href: A.row.original.url,
3832
3832
  target: "_blank",
3833
3833
  children: "View File"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@instantdb/components",
3
3
  "private": false,
4
- "version": "1.0.52",
4
+ "version": "1.0.53",
5
5
  "type": "module",
6
6
  "description": "Instant's UI components",
7
7
  "license": "Apache-2.0",
@@ -94,11 +94,11 @@
94
94
  "swr": "^2.2.4",
95
95
  "tailwind-merge": "^2.2.1",
96
96
  "uuid": "^11.1.0",
97
- "@instantdb/admin": "1.0.52",
98
- "@instantdb/core": "1.0.52",
99
- "@instantdb/version": "1.0.52",
100
- "@instantdb/platform": "1.0.52",
101
- "@instantdb/react": "1.0.52"
97
+ "@instantdb/platform": "1.0.53",
98
+ "@instantdb/admin": "1.0.53",
99
+ "@instantdb/core": "1.0.53",
100
+ "@instantdb/version": "1.0.53",
101
+ "@instantdb/react": "1.0.53"
102
102
  },
103
103
  "scripts": {
104
104
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -515,7 +515,7 @@ export const InnerExplorer: React.FC<{
515
515
  if (attr.name === 'url') {
516
516
  return (
517
517
  <a
518
- className="h-full w-full pl-2 align-middle text-xs font-bold underline hover:text-black dark:hover:text-white"
518
+ className="flex h-full w-full items-center pl-2 text-xs font-bold underline hover:text-black dark:hover:text-white"
519
519
  href={info.row.original['url'] as string}
520
520
  target="_blank"
521
521
  >