@instantdb/components 0.22.96 → 0.22.97
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.
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"),De=require("sonner"),ea=require("@radix-ui/react-visually-hidden"),ta=require("@monaco-editor/react"),Me=require("clsx"),et=require("copy-to-clipboard"),b=require("react"),ra=require("tailwind-merge"),aa=require("@radix-ui/react-select"),V=require("@heroicons/react/24/outline"),na=require("react-dom"),St=require("swr"),xe=require("@instantdb/core"),Ze=require("date-fns"),B=require("@heroicons/react/24/solid"),Ie=require("@instantdb/react"),pe=require("@dnd-kit/core"),oa=require("markdown-table"),wt=require("export-to-csv"),sa=require("@dnd-kit/modifiers"),Ce=require("@dnd-kit/sortable"),Fe=require("@tanstack/react-table"),ge=require("lucide-react"),Z=require("@headlessui/react"),fe=require("lodash"),ur=require("@dnd-kit/utilities");require("swr/subscription");const ia=require("@radix-ui/react-tooltip"),la=require("uuid"),da=require("@radix-ui/react-dialog"),ca=require("json5"),ua=require("@radix-ui/react-dropdown-menu"),pa=require("@radix-ui/react-toggle-group"),pr=require("react-copy-to-clipboard"),ga=require("@radix-ui/react-switch");function ze(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 se=ze(aa),ae=ze(ia),Le=ze(da),$e=ze(ua),Xt=ze(pa),Zt=ze(ga),ha=`/*! 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-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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;--container-2xl:42rem;--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:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@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}[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-4{top:calc(var(--spacing)*4)}.top-\\[18px\\]{top:18px}.top-\\[50\\%\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.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-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)}.mt-8{margin-top:calc(var(--spacing)*8)}.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-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%}.max-w-2xl{max-width:var(--container-2xl)}.max-w-\\[67vw\\]{max-width:67vw}.max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.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-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,)}.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-around{justify-content:space-around}.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)))}.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-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-gray-500{background-color:var(--color-gray-500)}.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-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.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)}.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-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)}.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}.align-top{vertical-align:top}.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}.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 *){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\\: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-\\[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-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-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-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\\:ring-neutral-400:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-400)}@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)}.\\[\\&_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)}}@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}}`,gr=typeof window<"u",fa=kt("devBackend");let yt="8888";if(fa&&gr){const e=new URL(location.href).searchParams.get("port");e&&(yt=e)}const Jt={apiURI:kt("devBackend")?`http://localhost:${yt}`:"https://api.instantdb.com",websocketURI:kt("devBackend")?`ws://localhost:${yt}/runtime/session`:"wss://api.instantdb.com/runtime/session"};function kt(e){if(!gr)return null;try{const r=localStorage.getItem(e);return r?JSON.parse(r):null}catch{return null}}function ne(e){De.toast.success(e,{richColors:!0})}function oe(e,r){De.toast.error(e,{duration:r?.autoClose,richColors:!0})}const Nt={"many-many":{cardinality:"many","unique?":!1},"one-one":{cardinality:"one","unique?":!0},"many-one":{cardinality:"many","unique?":!0},"one-many":{cardinality:"one","unique?":!1}},hr=Object.fromEntries(Object.entries(Nt).map(([e,r])=>[`${r.cardinality}-${r["unique?"]}`,e])),ma=({attr:e,gracePeriodDays:r,isExpanded:a,setIsExpanded:n,onRestore:o})=>{const i=Ze.add(new Date(e["deletion-marked-at"]),{days:r}),s=()=>e["forward-identity"][2],g=()=>e["reverse-identity"]?.[2],c=()=>{const l=e["forward-identity"][1],f=e["reverse-identity"]?.[1];return{forwardEtype:l,reverseEtype:f}},p=()=>{const l=`${e.cardinality}-${e["unique?"]}`;return hr[l]},h=()=>{n(!a)},d=(()=>{if(e["value-type"]==="blob")return[];const l=p(),{forwardEtype:f,reverseEtype:m}=c(),x=s(),w=g(),y=(k,T)=>k==="one-one"?"has one":k==="many-many"?"has many":k==="one-many"?T?"has one":"has many":k==="many-one"?T?"has many":"has one":"has";return[{label:"forward",value:t.jsxs("span",{children:[t.jsx("strong",{children:f})," ",y(l,!0)," ",t.jsx("strong",{children:x})]})},{label:"reverse",value:t.jsxs("span",{children:[t.jsx("strong",{children:m})," ",y(l,!1)," ",t.jsx("strong",{children:w})]})}]})(),u=[{label:"type",value:e["value-type"]},...d];return t.jsxs("div",{children:[t.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:h,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[a?t.jsx(V.ChevronDownIcon,{width:14,className:"text-gray-400"}):t.jsx(V.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 ",Ze.formatDistanceToNow(i,{includeSeconds:!1})]})]}),t.jsxs(H,{className:"px-1",size:"mini",variant:"subtle",onClick:l=>{l.stopPropagation(),o(e.id)},children:[t.jsx(V.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,f)=>t.jsxs("tr",{className:f===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))})})})]})},Et=e=>{const r=ie(),a=r.adminToken;return St(["recently-deleted",e],async()=>{const o=await fetch(`${r.apiURI}/dash/apps/${e}/soft_deleted_attrs`,{method:"GET",headers:{Authorization:`Bearer ${a}`}}),i=await o.json();if(!o.ok)throw console.error("Failed to fetch recently deleted attrs",i),new Error("Failed to fetch recently deleted attrs"+JSON.stringify(i));return{...i,attrs:i.attrs.map(wa)}})},fr=e=>{const{data:r}=Et(e);return b.useMemo(()=>{const n=r?.attrs||[];return n.filter(s=>s["forward-identity"][2]==="id").map(s=>{const g=n.filter(c=>c.metadata.soft_delete_snapshot?.id_attr_id===s.id);return{idAttr:s,remainingCols:g.filter(c=>s.id!==c.id)}})},[r?.attrs])};function ba({appId:e,db:r}){const{data:a,mutate:n}=Et(e),o=fr(e),i=a?.["grace-period-days"]||2,s=async({idAttr:g,remainingCols:c})=>{if(!r||!a)return;const p=[g,...c].map(d=>d.id);await r.core._reactor.pushOps(p.map(d=>["restore-attr",d]));const h=new Set(p);n({...a,attrs:a.attrs.filter(d=>!h.has(d.id))})};return t.jsxs(ce,{className:"flex max-w-2xl flex-col gap-4",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",children:o.toSorted((g,c)=>+new Date(c.idAttr["deletion-marked-at"])-+new Date(g.idAttr["deletion-marked-at"])).map(g=>{const c=new Date(g.idAttr["deletion-marked-at"]),p=Ze.add(c,{days:i});return t.jsxs("div",{className:"flex items-start justify-between gap-4 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:"font-semibold dark:text-white",children:g.idAttr["forward-identity"][1]}),t.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:["Deleted ",Ze.format(c,"MMM d, h:mm a")," ·"," ","expires"," ",Ze.formatDistanceToNow(p,{includeSeconds:!1})]}),g.remainingCols.length>0?t.jsxs("div",{className:"mt-1 truncate text-xs text-neutral-500 dark:text-neutral-400",children:["Columns:"," ",g.remainingCols.map(h=>h["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:()=>s(g),children:[t.jsx(V.ArrowPathIcon,{className:"h-3.5 w-3.5"}),"Restore"]})})]},g.idAttr.id)})}):t.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No recently deleted namespaces."})]})}const xa=({namespace:e,appId:r,db:a,notes:n})=>{const{data:o,mutate:i,error:s}=Et(r),[g,c]=b.useState(null),p=Qe(),h=async l=>{if(a&&o)try{await a.core._reactor.pushOps([["restore-attr",l]]),i({attrs:o.attrs.filter(m=>m.id!==l)??[],"grace-period-days":o["grace-period-days"]});const f=o.attrs.find(m=>m.id===l);if(f){const m=va(f);m&&n.setNote(l,m)}}catch(f){console.error(f),f instanceof xe.InstantAPIError?f.body?.type==="record-not-unique"?oe("Attribute already exists. Rename existing attribute first and then try again to restore."):oe(f.message):oe("Failed to restore attr")}},d=e.attrs.find(l=>l.name==="id")?.id||"unk",u=o?.attrs?.filter(l=>l.metadata?.soft_delete_snapshot?.id_attr_id===d);return b.useEffect(()=>{u?.length===0&&p.onClose()},[u]),s||!u||u.length===0?null:t.jsxs("div",{className:"pb-2",children:[t.jsx(ot,{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(V.ClockIcon,{width:16}),"Recently Deleted"]})}),t.jsx("div",{className:"flex flex-col gap-2",children:u?.map(l=>t.jsx(ma,{isExpanded:g===l.id,setIsExpanded:f=>{c(f?l.id:null)},attr:l,gracePeriodDays:o?.["grace-period-days"]||2,onRestore:h},l.id))})]})},Qt="_deleted$",wa=e=>{const r={...e},[a,n,o]=e["forward-identity"];if(r["forward-identity"]=[a,dt(n),dt(o)],e["reverse-identity"]){const[i,s,g]=e["reverse-identity"];r["reverse-identity"]=[i,dt(s),dt(g)]}return r},dt=e=>{const r=e.indexOf(Qt);return r===-1?e:e.slice(r+Qt.length)},va=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 ya({db:e,onClose:r}){const[a,n]=b.useState("");async function o(){const i={id:Ie.id(),"forward-identity":[Ie.id(),a,"id"],"value-type":"blob",cardinality:"one","unique?":!0,"index?":!1},s=[["add-attr",i]];await e.core._reactor.pushOps(s),r({id:i.id,name:a})}return t.jsxs(ce,{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(ke,{value:a,placeholder:"Name your namespace",onChange:i=>n(i),autoFocus:!0}),t.jsx(be,{type:"submit",label:"Create",submitLabel:"Creating...",errorMessage:"Failed to create namespace",disabled:!a,onClick:o})]})}const ka=[["$files","url"]],er=[":",">","<"];function ja(e){let r=0,a,n;const o=[];let i=-1;for(const s of e){if(i++,s===" "&&!er.includes(e[i+1])){r=i+1;continue}if(er.includes(s)){a&&n!=null&&(a.value=e.substring(n,r).trim(),o.push(a)),a={field:e.substring(r,i).trim(),operator:s,value:""},n=i+1;continue}}return a&&n!=null&&(a.value=e.substring(n).trim(),o.push(a)),o}function Ke(e){switch(e){case":":return"=";case"<":return"$lt";case">":return"$gt";default:throw new Error("what kind of op is this? "+e)}}function Sa({query:e,attrsByName:r,stringIndexed:a}){if(!e.trim())return[];const n=ja(e),o=n.flatMap(i=>{const s=r[i.field];if(!s||!i.value)return[];if(i.value.toLowerCase()==="null"&&i.operator===":"&&!s.isRequired)return[[i.field,"$isNull",null]];const g=[];if(s.checkedDataType&&s.isIndex){if(s.checkedDataType==="string"){const c=i.value;return[[i.field,c===c.toLowerCase()?"$ilike":"$like",`%${i.value}%`]]}if(s.checkedDataType==="number")try{return[[i.field,Ke(i.operator),JSON.parse(i.value)]]}catch{}if(s.checkedDataType==="date")try{return[[i.field,Ke(i.operator),JSON.parse(i.value)]]}catch{return[[i.field,Ke(i.operator),i.value]]}}for(const c of s.inferredTypes||["json"])switch(c){case"boolean":case"number":{try{g.push([i.field,Ke(i.operator),JSON.parse(i.value)])}catch{}break}default:{g.push([i.field,Ke(i.operator),i.value]);break}}return g});if(!n.length&&e.trim()&&a.length)for(const i of a)o.push([i.name,e.toLowerCase()===e?"$ilike":"$like",`%${e.trim()}%`]);return o}function Na(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 Ea({onSearchChange:e,attrs:r,initialFilters:a=[]}){const[n,o]=b.useState(""),i=b.useRef(a),{attrsByName:s,stringIndexed:g}=b.useMemo(()=>{const l={},f=[];for(const m of r||[])l[m.name]=m,m.isIndex&&m.checkedDataType==="string"&&f.push(m);return{attrsByName:l,stringIndexed:f}},[r]),c=b.useCallback(fe.debounce(l=>{const f=Sa({query:l,attrsByName:s,stringIndexed:g});Na(i.current,f)||(i.current=f,e(f))},80),[s,g,i]),p=n.indexOf(":")!==-1?fe.last(n.split(" ")):n,h=(r||[]).flatMap(l=>{const f=ka.some(([w,y])=>w===l.namespace&&y===l.name);if(l.type==="ref"||f)return[];const m=[],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)(!p||w.display.startsWith(p)&&w.display!==p)&&m.push(w);return m}),d=b.useRef(null);function u(l){let f;p&&l.startsWith(p)?f=`${n}${l.substring(p.length)}`:f=`${n.trim()} ${l}`,o(f),c(f)}return b.useEffect(()=>{a.length>0&&!n&&o(a.map(l=>`${l[0]}:${l[2]}`).join(" "))},[a]),t.jsxs(Z.Combobox,{value:n,onChange:l=>{l&&u(l)},immediate:!0,children:[t.jsx(Z.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),c(l.target.value)},onKeyDown:l=>{if(l.key==="Tab"&&h.length){l.preventDefault();const f=d.current||h[0];f&&u(f.display)}},placeholder:"Filter..."}),t.jsx(Z.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:h.map((l,f)=>t.jsx(Z.ComboboxOption,{value:l.display,className:R("px-3 py-1 data-focus:bg-blue-100 dark:text-white dark:data-focus:bg-neutral-700",{}),children:({focus:m})=>(m&&(d.current=l),t.jsx("span",{children:l.display}))},f))})]})}function Ca(e){const[,r,a]=e["forward-identity"];return e.catalog!=="system"||r==="$users"||r==="$files"}function Ia(e){const r={},a={};for(const[o,i]of Object.entries(e))Ca(i)&&(a[o]=i);for(const o of Object.values(a)){const[,i]=o["forward-identity"];r[i]||(r[i]={id:i,name:i,attrs:{}})}for(const o of Object.values(a)){const i={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[h,d,u,l]=o["forward-identity"],f=o.id+"-forward";l!==!1&&(r[d].attrs[f]={id:o.id,isForward:!0,namespace:d,name:u,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],isPrimary:o["primary?"],cardinality:o.cardinality,linkConfig:i,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[s,g,c,p]=o["reverse-identity"];if(r[g]&&p!==!1){const h=o.id+"-reverse";r[g].attrs[h]={id:o.id,isForward:!1,namespace:g,name:c,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],cardinality:o.cardinality,linkConfig:i,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(tr)})).sort(tr)}function tr(e,r){return e.name==="id"?-1:r.name==="id"?1:e.name<r.name?-1:e.name>r.name?1:0}function Aa(e,r){const a={};return e&&(a[e[0]]=e[1]),r?.length&&(a.or=r.map(([n,o,i])=>{switch(o){case"=":return{[n]:i};case"$isNull":return{[n]:{[o]:!0}};default:return{[n]:{[o]:i}}}})),a}function Ra(e,r,a,n,o,i,s,g){const c=g?"asc":"desc",p=Aa(a,n),h=r?{[r.name]:{...Object.fromEntries(r.attrs.filter(f=>f.type==="ref").map(f=>[f.name,{$:{fields:["id"]}}])),$:{...p?{where:p}:{},...o?{limit:o}:{},...i?{offset:i}:{},order:{[s]:c}}}}:{},d=e.useQuery(h),l=e.useQuery(r?{[r.name]:{$:{aggregate:"count",...p?{where:p}:{}}}}:{}).aggregate?.[r?.name??""]?.count??null;return{itemsRes:d,allCount:l}}function Ta(e){const[r,a]=b.useState({namespaces:null,attrs:null});return e.useQuery({____explorer___:{}}),b.useEffect(()=>{function n(o){a({attrs:o,namespaces:Ia(o)})}return e._core._reactor.subscribeAttrs(n)},[e]),r}const rr=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),{}}},Oa=e=>{const[r,a]=b.useState(rr(e.appId));return b.useEffect(()=>{localStorage.setItem(`columnVisibility_${e.appId}`,JSON.stringify(r))},[e.appId,r]),b.useEffect(()=>{a(rr(e.appId))},[e.appId]),{visibility:r,setVisibility:a,attrs:e.attrs}};function ar(e){if(typeof window>"u")return;let r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{}}function _a(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 Da(e,r){const a=b.useRef(ar(e)||r),n=b.useCallback(i=>{const s=()=>{a.current=ar(e)||r,i()};return window.addEventListener("storage",s),()=>{window.removeEventListener("storage",s)}},[]);return[b.useSyncExternalStore(n,()=>a.current,()=>r),i=>_a(e,i)]}function Fa(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 La=(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 i=a.cloneNode(!0);i.style.display="inline-block",i.style.overflow="visible",i.style.width="auto",i.style.maxWidth="none",i.style.whiteSpace="nowrap",o.appendChild(i);const s=i.scrollWidth,g=Array.from(n).map(d=>{const u=d.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}),c=g.length>0?Math.max(...g):0,h=Math.max(s,c)+12;return Math.min(h,r)}finally{document.body.removeChild(o)}};function $a(){const e=b.useRef(null),[r,a]=b.useState(!1);return b.useLayoutEffect(()=>{const{current:n}=e;n&&(()=>{const i=n.scrollWidth>n.clientWidth||n.scrollHeight>n.clientHeight;a(i)})()},[e]),{ref:e,isOverflow:r,setIsOverflow:a}}const Ma=({header:e,table:r,headerGroup:a,index:n,setMinViableColWidth:o,onSort:i,currentSortAttr:s,currentSortAsc:g})=>{const{attributes:c,setActivatorNodeRef:p,isDragging:h,listeners:d,setNodeRef:u,transform:l}=Ce.useSortable({id:e.column.id,disabled:e.id==="select-col"}),f={opacity:h?.8:1,position:"relative",transform:e.id==="select-col"?void 0:ur.CSS.Translate.toString(l),transition:"width transform 0.2s ease-in-out",whiteSpace:"nowrap",width:e.column.getSize(),zIndex:h?1:0},x=!!e.column.columnDef?.meta?.sortable,w=typeof e.column.columnDef.header=="string"?e.column.columnDef.header:"",y=s===w||s==="serverCreatedAt"&&w==="id";return t.jsxs("div",{ref:u,className:Me("group relative z-10 h-8 w-full whitespace-nowrap select-none"),style:{...f,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",...c,...d,ref:p,style:{pointerEvents:"auto"}}),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:()=>{i&&i(w==="id"?"serverCreatedAt":w,s,g)},children:[t.jsx("span",{className:R(y&&"underline"),children:e.isPlaceholder?null:Fe.flexRender(e.column.columnDef.header,e.getContext())}),t.jsx("span",{className:"opacity-50 transition-opacity group-hover:opacity-70",style:{opacity:y?1:void 0,fontWeight:y?"bold":"normal"},children:y?g?t.jsx(V.ArrowUpIcon,{strokeWidth:3,width:10}):t.jsx(V.ArrowDownIcon,{strokeWidth:3,width:10}):t.jsx(V.ArrowsUpDownIcon,{strokeWidth:3,width:10})})]}):t.jsx(t.Fragment,{children:e.isPlaceholder?null:Fe.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:k=>(k.stopPropagation(),e.getResizeHandler()(k)),onTouchStart:e.getResizeHandler(),className:R(`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)},za=({cell:e})=>{const r=e.column.getIsResizing(),{history:a}=ut(),n=e.column.columnDef.meta,{isDragging:o,setNodeRef:i,transform:s}=Ce.useSortable({id:e.column.id,disabled:e.column.id==="select-col"}),[g,c]=b.useState(!1),{ref:p,isOverflow:h,setIsOverflow:d}=$a(),u=(h||fe.isObject(e.getValue()))&&!n?.isLink;b.useEffect(()=>{const x=new ResizeObserver(()=>{const w=p.current.scrollWidth>p.current.clientWidth||p.current.scrollHeight>p.current.clientHeight;d(w)});return x.observe(p.current),()=>{x.disconnect()}},[p.current]);const l={opacity:o?.8:1,position:"relative",transform:e.column.id==="select-col"?void 0:ur.CSS.Translate.toString(s),transition:"width transform 0.2s ease-in-out",width:e.column.getSize(),zIndex:o?1:0},f=n?.disablePadding??!1,m=e.getValue();return t.jsxs(Be,{children:[" ",t.jsx(qe,{className:"text-left",asChild:!0,children:t.jsx("div",{ref:x=>{i(x),p.current=x},style:{...l,padding:f?0:"0.5rem"},className:R("cursor-default truncate whitespace-nowrap"),children:t.jsx("span",{className:R(`h-full min-h-full cursor-pointer td-${e.column.id}`,f?"":"pr-2"),onClick:()=>{if(n?.isLink&&n.attr&&Array.isArray(m)&&m.length>0){const x=n.attr,w=x.linkConfig[x.isForward?"reverse":"forward"];if(w){a.push({namespace:w.namespace,where:[`${w.attr}.id`,e.row.original.id]});return}}n?.copyable&&et(mr(m))&&(c(!0),setTimeout(()=>c(!1),1e3))},children:g?t.jsx("div",{className:"h-1",children:"Copied!"}):Fe.flexRender(e.column.columnDef.cell,e.getContext())})},e.id)}),u&&!r&&t.jsx(Ue,{className:R(fe.isObject(m)&&"p-0"),side:"bottom",children:typeof m=="string"?Fe.flexRender(e.column.columnDef.cell,e.getContext()):t.jsx(Ba,{pretty:!0,data:m})})]})};function mr(e,r){return fe.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function Ba({data:e,pretty:r}){const a=mr(e,r),n=ie();return r&&fe.isObject(e)?t.jsx(mt,{darkMode:n.darkMode,code:a,language:"json"}):t.jsx(t.Fragment,{children:a})}const qa=({visiblity:e,localDates:r,setLocalDates:a})=>{const[n,o]=b.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(nt,{icon:t.jsx(V.Cog6ToothIcon,{width:16}),label:"View Settings",onClick:()=>o(!0)}),t.jsxs(he,{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(V.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(i=>t.jsx("div",{className:"flex gap-2",children:t.jsx(J,{label:i.name,checked:e.visibility[i.id+i.name]!==!1,onChange:s=>e.setVisibility(g=>({...g,[i.id+i.name]:s}))})},i.id+i.name))})]}),t.jsx(ot,{className:"py-2"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{children:"Show Dates in Local Time"}),t.jsx(qt,{onClick:i=>{a(!r)},checked:r})]}),t.jsx("div",{className:"text-xs opacity-40",children:"Copy to clipboard will still use the original value."})]})]})};async function Ua({appId:e,attrId:r,jobType:a,checkedDataType:n,apiURI:o},i){return(await(await fetch(`${o}/dash/apps/${e}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({"app-id":e,"attr-id":r,"job-type":a,"checked-data-type":n})})).json()).job}function br(e,r,a,n){let o=!1,i=!1,s=20,g=null;const c=h=>{if(h!==g)return s=20,g=h,s;const d=s;return s=Math.min(1e4,s*2),d},p=async h=>{for(;!o&&!i;)try{const u=await(await fetch(`${n}/dash/apps/${e}/indexing-jobs/${r}`,{headers:{authorization:`Bearer ${a}`}})).text(),f=JSON.parse(u).job;if(h(f),f.job_status!=="processing"&&f.job_status!=="waiting")return f;await new Promise(m=>setTimeout(m,c(u)))}catch(d){console.error("Job polling error:",d),i=!0,h(null,d)}};return{start:async h=>p(h),stop:()=>{o=!0}}}function ve(e){return e.job_status==="errored"}function ye(e){return e.job_status==="completed"||e.job_status==="errored"}const Pa=({attr:e,appId:r,isRequired:a,isIndexed:n,isUnique:o,checkedDataType:i,token:s})=>{const[g,c]=b.useState({}),[p,h]=b.useState({}),[d,u]=b.useState({}),l=ie();b.useEffect(()=>{Object.values(p).some(k=>k.job_status!=="completed"&&k.job_status!=="errored")||(a===e.isRequired?c(k=>({...k,require:void 0})):a?c(k=>({...k,require:{jobType:"required"}})):a||c(k=>({...k,require:{jobType:"remove-required"}})),n===e.isIndex?c(k=>({...k,index:void 0})):n?c(k=>({...k,index:{jobType:"index"}})):n||c(k=>({...k,index:{jobType:"remove-index"}})),o===e.isUniq?c(k=>({...k,unique:void 0})):o?c(k=>({...k,unique:{jobType:"unique"}})):o||c(k=>({...k,unique:{jobType:"remove-unique"}})),i===(e.checkedDataType||"any")?c(k=>({...k,type:void 0})):c(i==="any"?k=>({...k,type:{jobType:"remove-data-type"}}):k=>({...k,type:{jobType:"check-data-type",checkedDataType:i}})))},[a,n,o,i,e,p]);const[f,m]=b.useState(!1),x=async()=>{f||(h({}),m(!0),Object.entries(g).forEach(async([y,k])=>{if(!k)return;const q=await(await fetch(`${l.apiURI}/dash/apps/${r}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json"},body:JSON.stringify({"app-id":r,"attr-id":e.id,"job-type":k.jobType,"checked-data-type":k.checkedDataType})})).json();h(_=>({..._,[y]:q.job})),c(_=>({..._,[y]:void 0})),m(!1);const M=br(r,q.job.id,s,l.apiURI);await M.start((_,U)=>{if(!U&&_){const P=_.work_estimate??5e4,W=_.work_completed??0,L=Math.floor(W/P*100);u($=>({...$,[y]:L})),h($=>({...$,[y]:_}))}}),M.stop()}))},w=b.useMemo(()=>Object.values(d).filter(y=>y>0&&y<100).reduce((y,k)=>y+k,0)/Object.values(d).filter(y=>y>0&&y<100).length,[d]);return{isPending:Object.values(g).filter(Boolean).length>0,progress:w,isRunning:Object.values(p).some(y=>y.job_status!=="completed"&&y.job_status!=="errored"),pending:g,running:p,apply:x}},Ga=()=>{const[e,r]=b.useState({});return{notes:e,setNote:(o,i)=>{r(s=>({...s,[o]:{message:i}}))},removeNote:o=>{r(i=>{const s={...i};return delete s[o],s})}}},Ha=(e,r,a)=>{const n=r.name,o=[];return r.attrs.forEach(i=>{o.push(["update-attr",{id:i.id,"forward-identity":[i.linkConfig.forward.id,e,i.linkConfig.forward.attr]}])}),a.forEach(i=>{i.attrs.forEach(s=>{s.linkConfig.reverse?.namespace===n&&o.push(["update-attr",{id:s.id,"reverse-identity":[s.linkConfig.reverse.id,e,s.linkConfig.reverse.attr]}])})}),o};function Wa({db:e,namespace:r,namespaces:a,onClose:n,isSystemCatalogNs:o}){const s=ie().appId,{history:g}=ut(),{mutate:c}=St.useSWRConfig(),[p,h]=b.useState({type:"main"}),[d,u]=b.useState(r.name),[l,f]=b.useState(null);async function m(){const k=r.attrs.map(T=>["delete-attr",T.id]);await e.core._reactor.pushOps(k),setTimeout(()=>{c(["recently-deleted",s])},500),n({ok:!0})}async function x(k){if(k.startsWith("$")){f("Namespace name cannot start with $");return}const T=Ha(k,r,a);await e.core._reactor.pushOps(T),g.push({namespace:k},!0),ne("Renamed namespace to "+k),u(""),h({type:"main"})}const w=Ga(),y=b.useMemo(()=>p.type==="edit"&&r.attrs.find(k=>k.id===p.attrId&&k.isForward===p.isForward),[p.type==="edit"?p.attrId:null,p.type==="edit"?p.isForward:null,r.attrs]);return t.jsxs(t.Fragment,{children:[p.type==="rename"&&t.jsxs("div",{className:"px-2",children:[t.jsx("button",{onClick:()=>{h({type:"main"})},className:"mb-3",children:t.jsx(B.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:k=>{k.preventDefault(),x(d)},children:[t.jsxs(at,{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(ke,{disabled:o,value:d,onChange:k=>u(k)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsxs(H,{type:"submit",disabled:d.startsWith("$")||d.length===0,children:["Rename ",r.name," → ",d]})})]})," "]}),p.type==="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(nt,{variant:"subtle",onClick:()=>{h({type:"rename"})},icon:t.jsx(B.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:()=>h({type:"delete"}),children:[t.jsx(B.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:r.attrs.map(k=>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:k.name}),w.notes[k.id]?.message&&t.jsx(ht,{children:t.jsx("div",{className:"px-2 text-xs text-gray-500 dark:text-neutral-400",children:w.notes[k.id].message})})]}),k.name!=="id"?t.jsx(H,{className:"px-2",size:"mini",variant:"subtle",onClick:()=>{w.removeNote(k.id),h({type:"edit",attrId:k.id,isForward:k.isForward})},children:"Edit"}):null]},k.id+"-"+k.name))}),t.jsx("div",{children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>h({type:"add"}),children:[t.jsx(B.PlusIcon,{className:"inline",height:"12px"}),"New attribute"]})}),t.jsx(xa,{notes:w,db:e,appId:s,namespace:r})]}):p.type==="add"?t.jsx(Va,{db:e,namespace:r,namespaces:a,onClose:()=>h({type:"main"}),constraints:nr({namespaceName:r.name,isSystemCatalogNs:o})}):p.type==="delete"?t.jsx(xr,{name:r.name,type:"namespace",onClose:n,onConfirm:m}):p.type==="edit"&&y?t.jsx(rn,{db:e,attr:y,onClose:()=>h({type:"main"}),constraints:nr({namespaceName:r.name,isSystemCatalogNs:o,attr:y})}):null]})}function xr({name:e,type:r,onClose:a,onConfirm:n}){return t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(B.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(be,{variant:"destructive",label:`Delete ${e}`,submitLabel:"Deleting...",errorMessage:"Failed to delete",onClick:n})]})]})}function Va({db:e,namespace:r,namespaces:a,onClose:n,constraints:o}){const[i,s]=b.useState(!1),[g,c]=b.useState(!1),[p,h]=b.useState(!1),[d,u]=b.useState(!1),[l,f]=b.useState(!1),[m,x]=b.useState(null),[w,y]=b.useState("blob"),[k,T]=b.useState("many-many"),[q,M]=b.useState(()=>a.find(C=>C.name!==r.name)??a[0]),[_,U]=b.useState(""),[P,W]=b.useState(r.name),L=k==="one-one"||k==="one-many",$=k==="one-one"||k==="many-one",j=vr({attrName:_,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:q?.name}),A=w==="blob"?_:j.isValidLink;b.useEffect(()=>{if(w!=="ref"||!q)return;const C=q.name===r.name;U(C?"parent":q.name),W(C?"children":r.name),C&&T("one-many")},[w,q]);async function E(){if(w==="blob"){const O=[["add-attr",{id:xe.id(),"forward-identity":[xe.id(),r.name,_],"value-type":"blob",cardinality:"one","unique?":p,"index?":g,"required?":i,"checked-data-type":m??void 0}]];await e._core._reactor.pushOps(O),n()}else{if(!q)throw new Error("No reverse namespace");const O=[["add-attr",{id:xe.id(),...Nt[k],"forward-identity":[xe.id(),r.name,_],"reverse-identity":[xe.id(),q.name,P],"value-type":"ref","index?":!1,"required?":i,"on-delete":L&&d?"cascade":void 0,"on-delete-reverse":$&&l?"cascade":void 0}]];await e._core._reactor.pushOps(O),n()}}return t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(B.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(Rt,{ariaLabel:"Text alignment",selectedId:w,items:[{id:"blob",label:"Data"},{id:"ref",label:"Link"}],onChange:C=>y(C.id)})]}),w==="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(ke,{value:_,onChange:C=>U(C)})]}),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(J,{disabled:o.require.disabled,checked:i,onChange:C=>s(C),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(J,{checked:g,onChange:C=>c(C),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(J,{checked:p,onChange:C=>h(C),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(me,{value:m||"none",onChange:C=>{if(!C)return;const{value:O}=C;O==="none"&&x(null),x(O)},options:[{label:"Any (not enforced)",value:"none"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]})})]})]}):w==="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(me,{value:q?.id??void 0,options:a.map(C=>({label:C.name+(C.name===r.name?" (self-link)":""),value:C.id})),onChange:C=>{if(!C)return;const O=a.find(D=>D.id===C.value);M(O)}})]}),t.jsx(wr,{relationship:k,attrName:_,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:q?.name,setAttrName:U,setReverseAttrName:W,setRelationship:T,isCascadeAllowed:L,isCascade:d,setIsCascade:u,isCascadeReverseAllowed:$,isCascadeReverse:l,setIsCascadeReverse:f,isRequired:i,setIsRequired:s,constraints:o})]}):null,t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(be,{type:"submit",label:"Create attribute",submitLabel:"Creating attribute...",errorMessage:"Failed to create attribute",disabled:!A,className:"border-gray-500 disabled:opacity-20",onClick:E}),j.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})}function ct({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 tt({indexingJob:e,attr:r,onClose:a}){const{history:n}=ut();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(ct,{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(ct,{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(ct,{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(ct,{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 wr({attrName:e,reverseAttrName:r,namespaceName:a,reverseNamespaceName:n,relationship:o,setAttrName:i,setReverseAttrName:s,setRelationship:g,isCascade:c,setIsCascade:p,isCascadeAllowed:h,isCascadeReverse:d,setIsCascadeReverse:u,isCascadeReverseAllowed:l,isRequired:f,setIsRequired:m,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(ke,{disabled:x.attr.disabled,title:x.attr.message,value:e,onChange:y=>i(y)}),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(ke,{disabled:x.attr.disabled,title:x.attr.message,value:r,onChange:y=>s(y)}),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(Ya,{disabled:!w||x.attr.disabled,value:o,onChange:y=>{g(y.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?Ka[o](a,n,e,r):t.jsx(t.Fragment,{children:" "})})]}),t.jsx("div",{className:"flex gap-2",children:t.jsx(J,{checked:h&&c,disabled:!h||x.attr.disabled,onChange:p,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(J,{checked:l&&d,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(J,{disabled:x.require.disabled,title:x.require.message,checked:f,onChange:y=>m(y),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})})})]})]})}function Ya({value:e,disabled:r,onChange:a,namespace:n,attr:o,reverseNamespace:i,reverseAttr:s,title:g}){return t.jsx(me,{disabled:r,value:e,onChange:c=>{c&&a(c)},options:[{label:"Many-to-many",value:"many-many"},{label:"One-to-one",value:"one-one"},{label:`${n} has-many ${o||"---"} / ${i} has-one ${s||"---"}`,value:"many-one"},{label:`${n} has-one ${o||"---"} / ${i} has-many ${s||"---"}`,value:"one-many"}],title:g})}const Ka={"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 Xa({appId:e,attr:r,isRequired:a,authToken:n,setIndexingJob:o,stopFetchLoop:i,apiURI:s}){if(!n||a===r.isRequired)return;i.current?.();const g=`${r.namespace}.${r.name}`;try{const c=await Ua({appId:e,attrId:r.id,jobType:a?"required":"remove-required",apiURI:s},n);o(c);const p=br(e,c.id,n,s);i.current=p.stop;const h=await p.start((d,u)=>{u&&oe(`Error while marking ${g} as required.`),d&&o(d)});if(h){if(h.job_status==="completed")return ne(a?`Marked ${g} as required.`:`Marked ${g} as optional.`),"completed";if(h.job_status==="canceled")return oe("Marking required was canceled."),"canceled";if(h.job_status==="errored")return h.error==="invalid-triple-error"?oe(`Found invalid data while updating ${g}.`):oe(`Encountered an error while updating ${g}.`),"errored"}}catch(c){return console.error(c),oe(`Unexpected error while updating ${g}`),"errored"}}const Za=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=!r||ye(r),c=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.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(ht,{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(me,{className:R(e&&"border-[#606AF4] ring-1 ring-[#606AF4] ring-inset focus:ring-[#606AF4]"),disabled:o||r&&!ye(r),title:o?i:void 0,value:a,onChange:p=>{p&&n(p.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&&g&&t.jsx(B.ArrowUturnLeftIcon,{onClick:()=>{n(s.checkedDataType||"any")},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:c})]})},Ja=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isRequired||!1)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},Qa=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isIndex)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},en=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isUniq)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},tn=({appId:e,attr:r,constraints:a})=>{const[n,o]=b.useState(r.isRequired||!1),[i,s]=b.useState(r.isIndex),[g,c]=b.useState(r.isUniq),[p,h]=b.useState(r.checkedDataType||"any"),d=ie(),{isPending:u,pending:l,apply:f,isRunning:m,running:x,progress:w}=Pa({attr:r,appId:e,token:d.adminToken,isRequired:n,isIndexed:i,isUnique:g,checkedDataType:p});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(Ja,{pendingJob:l.require,runningJob:x.require,value:n,setValue:o,disabled:a.require.disabled,disabledReason:a.require.message,attr:r}),t.jsx(Qa,{pendingJob:l.index,runningJob:x.index,value:i,setValue:s,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(en,{pendingJob:l.unique,runningJob:x.unique,value:g,setValue:c,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Za,{pendingJob:l.type,runningJob:x.type,value:p,setValue:h,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Dt,{loading:!!w,percentage:w||0,variant:u||m?"primary":"secondary",className:"border",onClick:()=>f(),disabled:!u&&!w,children:m?"Updating Constraints...":"Update Constraints"})]})})};function rn({db:e,attr:r,onClose:a,constraints:n}){const i=ie().appId,{mutate:s}=St.useSWRConfig(),[g,c]=b.useState({type:"main"}),[p,h]=b.useState(r.linkConfig.forward.attr),[d,u]=b.useState(r.linkConfig.reverse?.attr),[l,f]=b.useState(()=>{const D=`${r.cardinality}-${r.isUniq}`;return hr[D]}),m=ie(),[x,w]=b.useState(()=>r.onDelete==="cascade"),[y,k]=b.useState(()=>r.onDeleteReverse==="cascade"),[T,q]=b.useState(r.isRequired||!1),[M,_]=b.useState(T),[U,P]=b.useState(null),W=b.useRef(null),L=Z.useClose();b.useEffect(()=>()=>W.current?.(),[W]);const $=l==="one-one"||l==="one-many",j=l==="one-one"||l==="many-one",A=vr({attrName:p,reverseAttrName:d,namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse?.namespace});async function E(){if(!r.linkConfig.reverse)throw new Error("No reverse link config");if(T!==M&&await Xa({appId:i,attr:r,isRequired:T,authToken:m.adminToken,setIndexingJob:P,stopFetchLoop:W,apiURI:m.apiURI})!="completed")return;const D=[["update-attr",{id:r.id,...Nt[l],"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,p],"reverse-identity":[r.linkConfig.reverse.id,r.linkConfig.reverse.namespace,d],"on-delete":$&&x?"cascade":null,"on-delete-reverse":j&&y?"cascade":null}]];await e.core._reactor.pushOps(D),T==M&&ne("Updated attribute")}async function C(){const D=[["update-attr",{id:r.id,"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,p]}]];await e.core._reactor.pushOps(D),ne("Renamed attribute")}async function O(){await e.core._reactor.pushOps([["delete-attr",r.id]]),setTimeout(()=>{s(["recently-deleted",i])},500),a()}return g.type==="delete"?t.jsx(xr,{onConfirm:O,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(B.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:()=>c({type:"delete"}),children:[t.jsx(B.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),r.type==="blob"?t.jsxs(t.Fragment,{children:[t.jsx(tn,{appId:i,attr:r,constraints:n}),t.jsx(ot,{}),t.jsxs(ce,{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Rename"}),t.jsxs(at,{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(ke,{disabled:n.attr.disabled,title:n.attr.message,value:p,onChange:D=>h(D)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsx(be,{type:"submit",label:`Rename ${r.name} → ${p}`,submitLabel:"Renaming attribute...",errorMessage:"Failed to rename attribute",disabled:n.attr.disabled||!p||p===r.name,title:n.attr.message,onClick:C})})]})]}):t.jsxs(ce,{className:"flex flex-col gap-6",children:[t.jsx(wr,{relationship:l,attrName:p,reverseAttrName:d??"",namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse.namespace,setAttrName:h,setReverseAttrName:u,setRelationship:f,isCascadeAllowed:$,isCascade:x,setIsCascade:w,isCascadeReverseAllowed:j,isCascadeReverse:y,setIsCascadeReverse:k,isRequired:T,setIsRequired:q,constraints:n}),t.jsx(tt,{indexingJob:U,attr:r,onClose:()=>{L(),a()}}),t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(be,{disabled:n.attr.disabled||!A.isValidLink,type:"submit",label:"Update relationship",submitLabel:"Updating relationship...",errorMessage:"Failed to update relationship",onClick:E,title:n.attr.message}),A.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})]})}function vr({reverseNamespaceName:e,namespaceName:r,attrName:a,reverseAttrName:n}){const o=e&&e===r,i=a&&r&&e&&n,s=a!==n;return{isSelfLink:o,isNonEmptyLink:i,isValidLink:i&&(o?s:!0),shouldShowSelfLinkNameError:i&&o&&!s}}function nr({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,i=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:i}}}const Je=[{value:"string",label:"string"},{value:"number",label:"number"},{value:"boolean",label:"boolean"},{value:"json",label:"json"}];function an({onSave:e,onChange:r,onKeyDown:a,...n}){const o=b.useRef(null),i=s=>{const g=s.closest(".overflow-y-auto"),c=g?.scrollTop||0;s.style.height="auto",s.style.height=s.scrollHeight+"px",g&&(g.scrollTop=c)};return b.useEffect(()=>{o.current&&(i(o.current),o.current&&i(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:s=>{r?.(s),i(s.target)},onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&e&&(s.preventDefault(),e()),a?.(s)}})}const vt={string:"",number:0,boolean:!1,json:{}};function nn(e){return e?e==="date"?Je.filter(r=>r.value==="string"||r.value==="number"):Je.filter(r=>r.value===e):Je}const yr=e=>!!e&&typeof e=="object";function on(e){try{return JSON.parse(e),!0}catch{return!1}}function sn(e){try{return JSON.parse(e)}catch{return e}}function ln(e,r){if(e.checkedDataType)return e.checkedDataType==="date"?"string":e.checkedDataType;if(r!=null){const a=yr(r)?"json":typeof r,n=Je.find(o=>o.value===a);if(n)return n.value}return e.inferredTypes?.length?e.inferredTypes[0]:Je[0].value}function or(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 yr(e)?JSON.stringify(e):String(e);if(r==="json")return sn(e)}return e}function dn(e){return la.validate(e)?null:"Invalid UUID."}function sr({db:e,namespace:r,item:a}){const[n,o]=b.useState(!1),[i,s]=b.useState(!1),{data:g,isLoading:c}=e.useQuery(n||i?{[r.name]:{$:{where:{id:a.id}}}}:null);return t.jsx(ae.Provider,{children:t.jsxs(ae.Root,{delayDuration:0,open:n,children:[t.jsx(ae.Trigger,{asChild:!0,onMouseEnter:()=>s(!0),onTouchStart:()=>s(!0),children:t.jsx("span",{children:t.jsx(H,{size:"mini",variant:"subtle",onClick:()=>o(p=>!p),children:t.jsx(B.InformationCircleIcon,{height:14})})})}),t.jsx(ae.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(g?.[r.name]?.[0]||a,null,2)}),c?t.jsx("div",{className:"absolute top-0 right-0 animate-spin p-2 opacity-50",children:t.jsx(B.Cog8ToothIcon,{width:12})}):null]})})]})})}function cn({q:e,option:r,uniqueAttrs:a,filterableAttrs:n}){const[o,i]=b.useState(!1);return t.jsx(Z.ComboboxOption,{value:r,className:Me("cursor-pointer px-3 py-1 data-focus:bg-blue-100 dark:border-neutral-700 dark:bg-neutral-800",{}),children:t.jsx(ae.Provider,{children:t.jsxs(ae.Root,{delayDuration:0,open:o,children:[t.jsx(ae.Trigger,{asChild:!0,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:t.jsxs("div",{children:[t.jsx("div",{children:t.jsx("code",{children:r.id})}),t.jsxs("div",{className:"truncate",children:[n.filter(s=>r.hasOwnProperty(s.name)&&!s.isUniq&&e&&JSON.stringify(r[s.name]).toLowerCase().indexOf(e.toLowerCase())!==-1).slice(0,3).map(s=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:s.name}),":"," ",JSON.stringify(r[s.name])]},s.id)),a.filter(s=>r.hasOwnProperty(s.name)).slice(0,3).map(s=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:s.name}),":"," ",JSON.stringify(r[s.name])]},s.id))]})]})}),t.jsx(ae.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 un({db:e,namespace:r,onLinkRef:a,ignoreIds:n,onClose:o}){const[i,s]=b.useState(""),g=b.useRef(null),{uniqueAttrs:c,filterableAttrs:p}=b.useMemo(()=>{const f=[],m=[];for(const[x,w]of Object.entries(r.attrs))w.isUniq&&w.name!=="id"&&w.type==="blob"&&f.push(w),w.isIndex&&(w.checkedDataType==="string"||w.checkedDataType==="number")&&m.push(w);return{uniqueAttrs:f,filterableAttrs:m}},[r.attrs]),h=b.useMemo(()=>{const f=[{$entityIdStartsWith:i}];let m;try{const x=JSON.parse(i);typeof x=="number"&&(m=x)}catch{}for(const x of p)x.checkedDataType==="string"&&i.trim()&&f.push({[x.name]:{$ilike:`%${i.trim()}%`}}),x.checkedDataType==="number"&&m!=null&&f.push({[x.name]:m});for(const x of c)x.checkedDataType||(f.push({[x.name]:i}),m!=null&&f.push({[x.name]:m}));return{[r.name]:{$:{where:{or:f},limit:20}}}},[r.name,p,i]),{data:d,isLoading:u}=e.useQuery(h),l=d?.[r.name]?.filter(f=>!n.has(f.id));return t.jsx("div",{className:"relative mt-1 w-full",children:t.jsxs(Z.Combobox,{onChange:f=>{f&&(a(f),s(""),o())},onClose:o,immediate:!0,children:[t.jsx(Z.ComboboxInput,{ref:g,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:i,onChange:f=>{s(f.target.value)},placeholder:`Search ${r.name}...`}),t.jsx(Z.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(f=>t.jsx(cn,{q:i,option:f,uniqueAttrs:c,filterableAttrs:p},f.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 pn({db:e,item:r,attr:a,namespace:n,refUpdates:o,handleLinkRef:i,handleUnlinkRef:s}){const[g,c]=b.useState(!1),p=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]),h=a.cardinality,d=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(sr,{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?i(a,u):s(a,u.id),children:l?t.jsx(B.ArrowUturnLeftIcon,{height:14}):t.jsx(B.TrashIcon,{height:14})})]},u.id)}),Object.entries(o||{}).map(([u,{action:l,item:f}])=>{if(l==="link")return t.jsxs("div",{children:[t.jsx("code",{children:u}),t.jsx(sr,{db:e,namespace:n,item:f}),t.jsx(H,{title:"Remove",type:"link",size:"mini",variant:"destructive",className:"border-none",onClick:()=>s(a,u),children:t.jsx(B.TrashIcon,{height:14})})]},u)}),g?t.jsx(un,{namespace:n,onLinkRef:u=>i(a,u),db:e,ignoreIds:p,onClose:()=>c(!1)}):t.jsx(H,{variant:"secondary",onClick:()=>c(!0),children:h==="many"||!d?"Add link":"Replace link"})]})}const gn=(e,r)=>r.type==="blob"&&e.name!=="$files"||e.name==="$files"&&r.type==="blob"&&r.name==="path";function ir({db:e,namespace:r,item:a,onClose:n}){const o=a.id?"edit":"add",i=ie(),s=[],g=[];for(const j of r.attrs)j.name!=="id"&&(gn(r,j)&&s.push(j),j.type==="ref"&&g.push(j));const c=s.reduce((j,A)=>{const E=a[A.name],C=ln(A,E),O=o==="add"?A.isRequired?vt[C]:null:E;return{...j,[A.name]:{type:C,value:O,error:null}}},{}),[p,h]=b.useState({...c,...o==="add"?{id:{type:"string",value:Ie.id()}}:{}}),[d,u]=b.useState({}),[l,f]=b.useState({}),[m,x]=b.useState(s.reduce((j,A)=>({...j,[A.name]:o==="edit"?a[A.name]===null||a[A.name]===void 0:p[A.name].value===null}),{})),w=Object.values(p).some(j=>!!j.error),[y,k]=b.useState(!1),T=()=>{u({}),h({...c}),x(s.reduce((A,E)=>({...A,[E.name]:o==="edit"?a[E.name]===null||a[E.name]===void 0:!1}),{}));const j={};s.forEach(A=>{c[A.name]?.type==="json"&&a[A.name]!==void 0&&(j[A.name]=a[A.name]===null?"null":JSON.stringify(a[A.name],null,2))}),f(j),k(!1)},q=(j,A)=>{h(E=>{const C=E[j]?.value;return{...E,[j]:{type:A,value:or(C,A)}}})},M=(j,A,E)=>{const C=E?E(A):null;h(O=>{const D=O[j]?.type||"string";return{...O,[j]:{type:D,value:or(A,D),error:C}}})},_=(j,A)=>{f(E=>({...E,[j]:A})),h(E=>{const C=E[j]||{};return A===""?{...E,[j]:{type:"json",value:void 0,error:"Invalid JSON"}}:{...E,[j]:on(A)?{type:"json",value:JSON.parse(A),error:null}:{...C,type:"json",error:"Invalid JSON"}}})},U=(j,A)=>{x(C=>({...C,[j]:A}));const E=p[j]?.type||"string";A?(h(C=>({...C,[j]:{type:E,value:null,error:null}})),E==="json"&&f(C=>({...C,[j]:"null"}))):(h(C=>({...C,[j]:{type:E,value:vt[E],error:null}})),E==="json"&&f(C=>({...C,[j]:"{}"})))},P=(j,A)=>{u(E=>{if(a[j.name]?.find(X=>X.id===A))return{...E,[j.name]:{...E[j.name]||{},[A]:{action:"unlink",item:null}}};const{[A]:O,...D}=E[j.name]||{};return{...E,[j.name]:D}})},W=(j,A)=>{u(E=>{const C=A.id,O=E[j.name]?.[C];if(O&&O.action==="unlink"){if(j.cardinality==="one"){const{[j.name]:ee,...G}=E;return G}const{[C]:D,...X}=E[j.name];return{...E,[j.name]:X}}if(j.cardinality==="one"&&a[j.name]?.length){const D=a[j.name][0];return{...E,[j.name]:{[C]:{action:"link",item:A},[D.id]:{action:"unlink",item:null}}}}return{...E,[j.name]:{...E[j.name]||{},[C]:{action:"link",item:A}}}})},L=j=>{requestAnimationFrame(()=>{const A=document.querySelector(`[tabindex="${j}"]`);A&&A instanceof HTMLElement&&A.focus()})},$=async()=>{if(w){k(!0);return}const j=Object.fromEntries(Object.entries(p).map(([E,{value:C}])=>[E,C])),A=a.id||j.id||Ie.id();delete j.id;try{let E=Ie.tx[r.name][A];const C=[],O=[];for(const[D,X]of Object.entries(d))for(const[ee,{action:G}]of Object.entries(X))G==="link"&&O.push({[D]:ee}),G==="unlink"&&C.push({[D]:ee});for(const D of C)E=E.unlink(D);E=E.update(j);for(const D of O)E=E.link(D);await e.transact(E),n(),ne("Successfully updated row!")}catch(E){const C=E.message;if(C)oe(`Failed to save row: ${C}`);else throw E}};return t.jsxs(ce,{className:"p-4",children:[t.jsx("h5",{className:"flex text-lg font-bold",children:o=="edit"?"Edit row":"Add row"}),t.jsx("code",{className:"font-mono text-sm font-medium text-gray-500 dark:text-neutral-500",children:o=="edit"?t.jsxs(t.Fragment,{children:[r.name,"['",a.id,"']"]}):t.jsx(t.Fragment,{children:r.name})}),t.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[o==="add"?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx(Ae,{className:"font-mono",children:t.jsxs("div",{className:"flex gap-1",children:["id"," ",t.jsx(H,{type:"link",size:"mini",variant:"subtle",onClick:()=>M("id",Ie.id()),children:t.jsx(B.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:p.id?.value??"",onChange:j=>M("id",j.target.value,dn)})})," ",p.id?.error&&y&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:p.id.error})]},"id"):null,s.map((j,A)=>{const E=A+1,{type:C,value:O,error:D}=p[j.name]||{type:"string",value:vt.string},X=l[j.name]||(O!==null?JSON.stringify(O,null,2):"null"),ee=m[j.name];return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Ae,{className:"font-mono",children:j.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center",children:!j.isRequired&&t.jsx(J,{checked:ee,onChange:G=>U(j.name,G),label:t.jsx("span",{className:"text-[10px] text-gray-600 uppercase dark:text-neutral-600",children:"null"})})}),t.jsx(me,{className:"w-24 rounded-sm px-2 py-0.5 text-sm",value:C,options:nn(j.checkedDataType),onChange:G=>q(j.name,G.value)})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[ee?t.jsx("button",{onClick:()=>{U(j.name,!1),L(E)},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:C==="json"?t.jsx("div",{className:"h-32 w-full rounded-sm border",children:t.jsx(ft,{darkMode:i.darkMode,tabIndex:E,language:"json",value:X,onChange:G=>_(j.name,G)})}):C==="boolean"?t.jsx(me,{tabIndex:E,value:O,options:[{value:"false",label:"false"},{value:"true",label:"true"}],onChange:G=>M(j.name,G.value)}):C==="number"?t.jsx("input",{tabIndex:E,type:"number",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:O??"",onChange:G=>M(j.name,G.target.value)}):t.jsx(an,{tabIndex:E,value:O??"",onChange:G=>M(j.name,G.target.value),onSave:$})}),j.checkedDataType==="date"&&t.jsxs(H,{variant:"subtle",size:"mini",onClick:()=>{M(j.name,C==="number"?Date.now():new Date().toISOString())},children:[t.jsx(V.ClockIcon,{height:14}),"now"]})]}),D&&y&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:D})]})]},j.name)}),g.map((j,A)=>{const E=j.isForward?j.linkConfig.reverse.nsMap:j.linkConfig.forward.nsMap;return E?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Ae,{className:"font-mono",children:j.name}),t.jsxs("span",{className:"rounded-sm px-2 py-0.5 text-sm",children:["Link to ",t.jsx("code",{children:E.name})]})]}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx(pn,{db:e,item:a,namespace:E,attr:j,refUpdates:d[j.name],handleLinkRef:W,handleUnlinkRef:P})})]},j.name):null})]}),t.jsxs("div",{className:"mt-8 flex flex-row items-center justify-between gap-1",children:[y&&w?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:T,children:"Reset"}),t.jsx(be,{tabIndex:s.length+1,type:"submit",variant:"primary",label:"Save",submitLabel:"Saving...",errorMessage:"Failed to save row.",onClick:$})]})]})]})}const hn=[];function fn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(c=>c.id!=="select-col"&&c.header!==void 0&&!c.meta?.isLink),i=e.map(c=>{const p={};return o.forEach(h=>{const d=c[h.header];d==null?p[h.header]="":typeof d=="object"?p[h.header]=JSON.stringify(d):p[h.header]=d}),p}),s=wt.mkConfig({fieldSeparator:",",filename:`${a}_export`,decimalSeparator:".",useKeysAsHeaders:!0}),g=wt.generateCsv(s)(i);n?(wt.download(s)(g),ne("CSV file downloaded")):(et(g.toString()),ne("CSV copied to clipboard"))}function mn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(c=>c.id!=="select-col"&&c.header!==void 0&&!c.meta?.isLink),i=o.map(c=>c.header),s=e.map(c=>o.map(p=>{const h=c[p.header];return h==null?" ":typeof h=="object"?JSON.stringify(h):String(h)})),g=oa.markdownTable([i,...s]);if(n){const c=new Blob([g],{type:"text/markdown"}),p=URL.createObjectURL(c),h=document.createElement("a");h.href=p,h.download=`${a}_export.md`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(p),ne("Markdown file downloaded")}else et(g),ne("Markdown copied to clipboard")}function bn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(g=>g.id!=="select-col"&&g.header!==void 0&&!g.meta?.isLink),i=e.map(g=>{const c={};return o.forEach(p=>{const h=g[p.header];c[p.header]=h}),c}),s=JSON.stringify(i,null,2);if(n){const g=new Blob([s],{type:"application/json"}),c=URL.createObjectURL(g),p=document.createElement("a");p.href=c,p.download=`${a}_export.json`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(c),ne("JSON file downloaded")}else et(s),ne("JSON copied to clipboard")}const xn=({db:e,namespaces:r})=>{const{explorerState:a,history:n}=ut(),o=ie(),i=a,s=r.find(N=>N.id===i.namespace),[g,c]=b.useState(50),[p,h]=b.useState([]),[d,u]=b.useState(!1),[l,f]=b.useState(""),[m,x]=b.useState(!1),[w,y]=b.useState(null),[k,T]=b.useState(null),[q,M]=b.useState(!1);b.useRef(null);const _=b.useRef(null),[U,P]=b.useState({}),W=b.useRef(null),L=s?.name?.startsWith("$")??!1,$=s?.name??"",j=L&&!["$users","$files"].includes($),A=U[$]||0,E=i?.sortAttr||"serverCreatedAt",C=i?.sortAsc??!0,O=(N,S)=>{const I=re.options.data.map(ue=>ue.id),F=I.indexOf(N),z=I.indexOf(_.current),[Y,Q]=[Math.min(F,z),Math.max(F,z)];Re(ue=>{const Ye={...ue};for(let Oe=Y;Oe<=Q;Oe++){const lt=I[Oe];S?Ye[lt]=!0:delete Ye[lt]}return Ye})},[D,X]=b.useState([]),{itemsRes:ee,allCount:G}=Ra(e,s,i?.where,i?.filters||D,g,A,E,C),te=ee.data?.[s?.name??""]??hn;function je(N,S){return N.filter(I=>S[I.id])}const le=G?Math.ceil(G/g):1,K=A/g+1,[Se,zr]=Da("localDates",!1),Br=async()=>{try{if(u(!0),p.length===0)return;const[N]=p;await yn(o.adminToken,o.appId,N,l,o.apiURI)&&(h([]),f(""),W.current&&(W.current.value="")),ne("Successfully uploaded!")}catch(N){console.error("Failed to upload:",N),oe(`Failed to upload: ${N.body.message}`)}finally{u(!1)}},Ut=b.useMemo(()=>te,[te]),Pe=b.useRef(null),[Pt,Gt]=b.useState(0),[Ht,Wt]=b.useState(1),[Vt,Yt]=b.useState(!1),qr=N=>{if(re?.getColumn(N)?.columnDef.header==="id"){Kt(N,285);return}const S=La(N,800);Kt(N,S)},Kt=(N,S=200)=>{if(!s)return;const I={};s?.attrs.forEach(F=>{I[F.id+F.name]=re.getColumn(F.id+F.name)?.getSize()||0}),re.setColumnSizing({...I,[N]:S})},Ge=b.useMemo(()=>{const N=[];return N.push({id:"select-col",enableSorting:!1,accessorFn:()=>null,enableHiding:!1,enableResizing:!1,size:52,header:({table:S})=>t.jsx(J,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",style:{pointerEvents:"auto"},checked:S.getIsAllRowsSelected(),onChange:I=>{I?(S.toggleAllRowsSelected(),te.length>0&&(_.current=te[0].id)):(Re({}),_.current=null)}}),cell:({row:S,column:I})=>t.jsxs("div",{className:"flex h-1 justify-around gap-2",children:[t.jsx(J,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",checked:S.getIsSelected(),onChange:(F,z)=>{(z.nativeEvent?z.nativeEvent.shiftKey:!1)&&_.current?O(S.id,z.target.checked):Re(Q=>{const ue={...Q};return z.target.checked?ue[S.id]=!0:delete ue[S.id],ue}),_.current=S.id}}),j?null:t.jsx("button",{className:"translate-y-0.5 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>T(S.id),children:t.jsx(V.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})})]})}),s?.attrs?.forEach(S=>{N.push({id:S.id+S.name,header:S.name,enableSorting:!0,enableResizing:!0,accessorFn:I=>I[S.name],meta:{sortable:S.sortable||S.name==="id",copyable:!0,isLink:S.type==="ref",attr:S,disablePadding:S.namespace==="$files"&&S.name==="url"},cell:I=>{if(I.row.original[S.name]===null||I.row.original[S.name]===void 0)return t.jsx("div",{className:"h-1",children:"-"});if(S.type==="ref"){const F=I.row.original[S.name].length;return t.jsxs("div",{className:R("h-1 translate-y-0.5",F<1&&"opacity-50"),children:[F," link",F===1?"":"s"]})}if(S.namespace==="$files"){if(S.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:I.row.original.url,target:"_blank",children:"View File"});if(S.name==="size")return Fa(I.row.original[S.name])}if(S.checkedDataType==="boolean")return I.row.original[S.name]?"true":"false";if(S.checkedDataType==="date"){const F=xe.coerceToDate(I.row.original[S.name]);return Se&&F?.toLocaleString()||I.row.original[S.name]}return fe.isObject(I.row.original[S.name])?t.jsx(vn,{data:I.row.original[S.name]}):I.row.original[S.name]}})}),N},[s?.attrs,Se]),[Ur,Pr]=b.useState({}),Gr=()=>{const N=Object.entries(re.getState().columnSizing).reduce((z,[Y,Q])=>st.visibility[Y]!==!1?{...z,[Y]:Q}:z,{}),S=Pe.current?.clientWidth||-1,I=Object.values(N).reduce((z,Y)=>z+Y,0),F=S-52-I;if(F>0){const z=Object.keys(N).length,Y=F/z;Object.keys(N).forEach(Q=>{N[Q]+=Y})}Yt(!1),re.setColumnSizing(()=>({...N}))},Hr="onChange",Wr="ltr",st=Oa({appId:o.appId,attrs:s?.attrs,namespaceId:s?.id}),[He,it]=b.useState(()=>Ge.map(N=>N.id));b.useLayoutEffect(()=>{if(s?.attrs){const N=localStorage.getItem(`order-${s.id}-${o.appId}`);if(N)it(JSON.parse(N));else{const S=s.attrs.map(I=>I.id+I.name);it(["select-col",...S])}}},[s?.attrs]),b.useEffect(()=>{s?.id&&localStorage.setItem(`order-${s.id}-${o.appId}`,JSON.stringify(He))},[He,s?.id]);const[Ne,Re]=b.useState({});b.useEffect(()=>{Re({}),_.current=null},[s?.id]);const We=Object.keys(Ne).length,Te=$==="$files"?We===1?"file":"files":We===1?"row":"rows",re=Fe.useReactTable({columnResizeDirection:Wr,columnResizeMode:Hr,onColumnVisibilityChange:st.setVisibility,columns:Ge,data:Ut,enableColumnResizing:!0,enableRowSelection:!0,getCoreRowModel:Fe.getCoreRowModel(),getRowId:N=>N.id,onColumnOrderChange:it,onRowSelectionChange:Re,onColumnSizingChange:Pr,state:{columnSizing:Ur,columnOrder:He,columnVisibility:st.visibility,rowSelection:Ne}}),[Ee,bt]=b.useState(!1);b.useEffect(()=>{const N=F=>{F.key==="Shift"&&bt(!0)},S=F=>{F.key==="Shift"&&bt(!1)},I=()=>{bt(!1)};return window.addEventListener("keydown",N),window.addEventListener("keyup",S),window.addEventListener("blur",I),()=>{window.removeEventListener("keydown",N),window.removeEventListener("keyup",S),window.removeEventListener("blur-sm",I)}},[]);const[Vr,Ve]=b.useState(!1);function Yr(N){const{active:S,over:I}=N;S&&I&&S.id!==I.id&&S.id!=="select-col"&&I.id!=="select-col"&&it(F=>{const z=F.indexOf(S.id),Y=F.indexOf(I.id);return Ce.arrayMove(F,z,Y)})}const xt=b.useMemo(()=>te.find(N=>N.id===k),[te.length,k]);b.useEffect(()=>{const N=Pe.current;if(!N)return;const S=()=>{const z=re.getCenterTotalSize(),Y=N.clientWidth;Yt(z<Y-5);const{scrollLeft:Q,scrollWidth:ue,clientWidth:Ye}=N,Oe=ue-Ye;if(Oe<=0){Gt(0),Wt(0);return}const lt=Math.min(Q/30,1);Gt(lt);const Qr=Math.min((Oe-Q)/30,1);Wt(Qr)};S(),N.addEventListener("scroll",S);const I=new ResizeObserver(S);I.observe(N);const F=N.firstElementChild;return F&&I.observe(F),window.addEventListener("resize",S),()=>{N.removeEventListener("scroll",S),I.disconnect(),window.removeEventListener("resize",S)}},[s,Ut]);const Kr=pe.useSensors(pe.useSensor(pe.MouseSensor,{}),pe.useSensor(pe.TouchSensor,{}),pe.useSensor(pe.KeyboardSensor,{})),Xr=n.items.length>=1,Zr=N=>N==="id"?140:N==="url"?120:N.length*7.2+50;if(b.useLayoutEffect(()=>{if(s?.id){if(localStorage.getItem(`$sizing-${s.id}-${o.appId}`)){const z=JSON.parse(localStorage.getItem(`sizing-${s.id}-${o.appId}`)||"{}");re.setColumnSizing(()=>({...z}));return}const N=Pe.current?.clientWidth||-1,S={};s?.attrs.forEach(z=>{S[z.id+z.name]=Zr(z.name)});const I=Object.values(S).reduce((z,Y)=>z+Y,0),F=N-52-I;if(F>0){const z=Object.keys(S).length,Y=F/z;Object.keys(S).forEach(Q=>{S[Q]+=Y})}re.setColumnSizing(S)}},[Pe.current,s]),!s)return null;const Jr=s.id;return t.jsxs(t.Fragment,{children:[t.jsx(he,{title:"Delete Rows",open:m,onClose:()=>x(!1),children:s?t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex text-lg font-bold",children:["Delete ",Te]}),t.jsxs(at,{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 ",We," ",Te," "]}),"associated with"," ",t.jsx("strong",{className:"dark:text-white",children:s.name}),"."]}),t.jsx(be,{type:"submit",disabled:j,label:`Delete ${Te}`,submitLabel:`Deleting ${Te}...`,errorMessage:`Failed to delete ${Te}`,className:"border-red-500 text-red-500",title:j?`The ${s?.name} namespace is read-only.`:void 0,onClick:async()=>{try{if(s.name==="$files"){const N=te.filter(S=>S.id in Ne).map(S=>S.path);await kn(o.adminToken,o.appId,N,o.apiURI)}else await e.transact(Object.keys(Ne).map(N=>xe.tx[s.name][N].delete()))}catch(N){const S=N.message;oe(`Failed to delete ${Te}${S?`: ${S}`:""}`);return}Re({}),x(!1)}})]}):null}),t.jsx(he,{title:"Edit Row",open:q,onClose:()=>M(!1),children:s?t.jsx(ir,{db:e,item:{},namespace:s,onClose:()=>M(!1)}):null}),t.jsx(he,{title:"Edit Row",open:!!xt,onClose:()=>T(null),children:s&&xt?t.jsx(ir,{db:e,namespace:s,item:xt,onClose:()=>T(null)}):null}),t.jsx(he,{title:"Edit Namespace",stopFocusPropagation:!0,open:!!w,onClose:()=>y(null),children:s?t.jsx(Wa,{readOnly:j,isSystemCatalogNs:L,db:e,namespace:s,namespaces:r??[],onClose:N=>{y(null),N?.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 flex-1 flex-col justify-between py-2 md:flex-row md:items-center",children:[t.jsxs("div",{className:"flex items-center overflow-hidden border-b px-2 py-1 pl-4 md:border-b-0 dark:border-neutral-700",children:[Xr?t.jsx(ge.ArrowLeftIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>n.pop()}):null,i.where?t.jsx(V.XMarkIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>{n.push({namespace:s.id},!0)}}):null,t.jsxs("div",{className:"text-ellipses shrink truncate overflow-hidden font-mono text-xs whitespace-nowrap dark:text-white",children:[t.jsx("strong",{children:s.name})," ",i.where?t.jsxs(t.Fragment,{children:[" ","where ",t.jsx("strong",{children:i.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(i.where[1])})]}):null,i?.filters?.length?t.jsx("span",{title:i.filters.map(([N,S,I])=>`${N} ${S} ${I}`).join(" || "),children:i.filters.map(([N,S,I],F)=>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:[N," ",S," ",I]}),i?.filters?.length&&F<i.filters.length-1?" || ":null]},N))}):null]})]}),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:()=>{y(s)},children:"Edit Schema"}),t.jsx(Ea,{onSearchChange:N=>X(N),attrs:s?.attrs,initialFilters:i?.filters||[]},Jr)]})]})}),s.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:W,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:N=>{const S=N.target.files;h(S),S?.[0]&&f(S[0].name)}}),t.jsx(H,{variant:"primary",disabled:p.length===0,size:"mini",loading:d,onClick:Br,className:"rounded-sm",children:d?"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:N=>f(N.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:[s.name!=="$files"?t.jsxs(H,{disabled:j,title:j?`The ${s?.name} namespace is read-only.`:void 0,size:"mini",variant:"secondary",onClick:()=>{M(!0)},children:[t.jsx(ge.PlusIcon,{width:12}),"Add row"]}):null,t.jsx("div",{className:R("px-1",s.name==="$files"&&"pb-1"),children:t.jsx(me,{className:"rounded-sm text-xs",onChange:N=>{if(!N)return;const S=parseInt(N.value,10);c(S),n.push(I=>({...I,limit:S}))},value:`${g}`,options:[{label:"25/page",value:"25"},{label:"50/page",value:"50"},{label:"100/page",value:"100"}]})}),t.jsx("div",{className:"w-[62px]",children:G!==void 0&&(G===0?t.jsx(t.Fragment,{children:"No Results"}):t.jsxs(t.Fragment,{children:[(K-1)*g+1," -"," ",Math.min(G,K*g)," of ",G]}))}),t.jsx("button",{className:"flex items-center justify-center",disabled:K<=1,onClick:()=>{P({...U,[s.name]:Math.max(0,A-g)}),n.push(N=>({...N,page:Math.max(1,K-1)}))},children:t.jsx(ge.ArrowLeftIcon,{className:R("inline",{"opacity-40":K<=1}),height:"1rem"})}),t.jsx("div",{className:"flex items-center space-x-1 overflow-hidden",children:[...new Array(le)].map((N,S)=>{const I=S+1;return le>6&&I!==1&&I!==le&&I!==K&&I!==K-1&&I!==K+1?I===K-2||I===K+2?t.jsx("div",{children:"..."},I):null:t.jsx("button",{className:R("rounded-md px-3 py-1 text-neutral-600 dark:text-neutral-300",I===K?"bg-neutral-200 dark:bg-neutral-700":"hover:bg-neutral-100 dark:hover:bg-neutral-800"),onClick:()=>{P({...U,[s.name]:S*g}),n.push(F=>({...F,page:I}))},disabled:I===K,children:I},I)})}),t.jsx("button",{className:"flex items-center justify-center",disabled:K>=le,onClick:()=>{P({...U,[s.name]:A+g}),n.push(N=>({...N,page:Math.min(le,K+1)}))},children:t.jsx(ge.ArrowRightIcon,{className:R("inline",{"opacity-40":K>=le}),height:"1rem"})}),We>0&&t.jsxs("div",{className:"flex items-center gap-2 pl-4",children:[t.jsxs(Lt,{open:Vr,onOpenChange:Ve,children:[t.jsx($t,{children:t.jsxs(H,{onClick:()=>{Ve(!0)},variant:"secondary",children:[t.jsx(V.ArrowUpOnSquareIcon,{width:14}),"Export (",We,")"]})}),t.jsxs(Mt,{className:"z-100",align:"end",side:"bottom",sideOffset:5,children:[t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);fn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.Table,{width:12}),Ee?"Download as CSV":"Copy as CSV"]}),t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);mn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.FileDown,{width:12}),Ee?"Download as Markdown":"Copy as Markdown"]}),t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);bn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.CurlyBraces,{width:12}),Ee?"Download as JSON":"Copy as JSON"]}),!Ee&&t.jsxs(t.Fragment,{children:[t.jsx(zt,{}),t.jsx(_e,{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(V.TrashIcon,{width:14}),"Delete Selected Rows"]})]}),t.jsx("div",{className:"grow"}),t.jsx("div",{className:"px-2",children:t.jsx(qa,{localDates:Se,setLocalDates:zr,visiblity:st})})]}),t.jsx(pe.DndContext,{collisionDetection:pe.closestCenter,modifiers:[sa.restrictToHorizontalAxis],onDragEnd:Yr,sensors:Kr,children:t.jsxs("div",{className:"relative flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-900/50",children:[!Vt&&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:Ht,display:Ht==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:Pt,display:Pt==0?"none":void 0}}),t.jsxs("div",{ref:Pe,className:"h-full w-full overflow-auto",children:[t.jsxs("div",{style:{width:re.getCenterTotalSize()},className:"z-0 inline-block text-left align-top 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:re.getHeaderGroups().map(N=>t.jsx("div",{className:"flex w-full",children:t.jsx(Ce.SortableContext,{items:He,strategy:Ce.horizontalListSortingStrategy,children:N.headers.map((S,I)=>t.jsx(Ma,{header:S,table:re,headerGroup:N,index:I,setMinViableColWidth:qr,onSort:(F,z,Y)=>{n.push(Q=>({...Q,sortAttr:F,sortAsc:z!==F?!0:!Y}))},currentSortAttr:i?.sortAttr,currentSortAsc:i?.sortAsc},S.id))})},N.id))}),t.jsx("div",{children:re.getRowModel().rows.map(N=>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:N.getVisibleCells().map(S=>t.jsx(Ce.SortableContext,{items:He,strategy:Ce.horizontalListSortingStrategy,children:t.jsx(za,{cell:S},S.id)},S.id))},N.id))})]}),Vt&&t.jsx("div",{className:"sticky top-0 inline-block align-top",children:t.jsx(nt,{className:"opacity-60",labelDirection:"bottom",label:"Fill Width",icon:t.jsx(ge.ArrowRightFromLine,{}),onClick:Gr})})]})]})})]})]})};function wn(e,r){return fe.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function vn({data:e,pretty:r}){const a=ie(),n=wn(e,r);return r&&fe.isObject(e)?t.jsx(mt,{darkMode:a.darkMode,code:n,language:"json"}):t.jsx(t.Fragment,{children:n})}async function kr(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 yn(e,r,a,n,o){const i={app_id:r,path:n||a.name,authorization:`Bearer ${e}`,"content-type":a.type};return await kr(`${o}/dash/apps/${r}/storage/upload`,{method:"PUT",headers:i,body:a})}async function kn(e,r,a,n){const{data:o}=await kr(`${n}/dash/apps/${r}/storage/files/delete`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({filenames:a})});return o}function jn(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 Sn=({namespaces:e,db:r})=>{const a=ie(),n=Qe(),o=Qe(),i=e.find(h=>h.id===a.explorerState?.namespace),[s,g]=b.useState(!1),c=b.useRef(null);jn(c,()=>{g(!1)}),b.useEffect(()=>{!i&&e.length>0&&a.setExplorerState({namespace:e[0].id})},[i,e,a]);const p=fr(a.appId);return t.jsxs("div",{className:R("relative flex w-full flex-1 overflow-hidden border-solid dark:bg-neutral-800",a.className),children:[t.jsx(he,{title:"Recently Deleted Namespaces",...n,children:t.jsx(ba,{appId:a.appId,db:r})}),t.jsx(he,{title:"New Namespace",...o,children:t.jsx(ya,{db:r,onClose:h=>{o.onClose(),h?.name&&a.setExplorerState({namespace:h.name})}})}),t.jsxs("div",{ref:c,className:R("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:!s}),children:[t.jsxs("div",{className:"flex items-center gap-1 text-sm font-semibold dark:text-white",children:[t.jsx(B.ChevronLeftIcon,{height:"1rem",className:"cursor-pointer md:hidden dark:text-white",onClick:()=>g(!1)}),"Namespaces"]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-hidden overflow-y-auto",children:e.length?t.jsx(At,{className:"text-sm",selectedId:a.explorerState?.namespace,items:e.map(h=>({id:h.id,label:h.name})),onChange:h=>{a.setExplorerState({namespace:h.id})}}):null}),t.jsxs(H,{variant:"secondary",size:"mini",className:"justify-center",onClick:o.onOpen,children:[t.jsx(B.PlusIcon,{height:"1rem"})," Create"]}),p.length?t.jsxs(H,{className:"justify-start gap-2 rounded-sm p-2",variant:"subtle",size:"nano",onClick:n.onOpen,children:[t.jsx("span",{className:"rounded-sm bg-gray-200 px-1",children:p.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((h,d)=>t.jsx("div",{className:"h-4 w-full rounded-md bg-neutral-300 dark:bg-neutral-700"},d))})]}),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:h=>{h.stopPropagation(),g(!0)},children:t.jsx(B.Bars3Icon,{height:"1rem",className:"dark:text-white"})})}),a.explorerState&&t.jsx(xn,{namespaces:e,db:r})]})},Nn=({appId:e,apiURI:r,websocketURI:a,adminToken:n})=>b.useMemo(()=>Ie.init({appId:e,apiURI:r,websocketURI:a,__adminToken:n,disableValidation:!0}),[e,r,a,n]);class En 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(V.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 Ct=b.createContext({props:null,history:{push:()=>{},pop:()=>{},items:[]}}),ie=()=>{const e=b.useContext(Ct);if(!e.props)throw new Error("useExplorerProps must be used within an Explorer component");return e.props},ut=()=>{const e=b.useContext(Ct);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}},jr=e=>e.explorerState!==void 0||e.setExplorerState!==void 0,Cn=(e,r,a)=>{const n=jr(e);return{...e,apiURI:e.apiURI||Jt.apiURI,websocketURI:e.websocketURI||Jt.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}},In=e=>{const[r,a]=b.useState(null),n=Cn(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:i}=n,[s,g]=b.useState([]),c=b.useCallback((x,w=!1)=>{g(y=>!w&&o?[...y,o]:y),i(x)},[o,i]),p=b.useCallback(()=>{g(x=>{if(x.length>0){const[w,...y]=x;return i(w),y}return x})},[i]),h=Nn({appId:n.appId,apiURI:n.apiURI,websocketURI:n.websocketURI,adminToken:n.adminToken}),d=b.useRef(!0),u=b.useRef(n.appId);b.useEffect(()=>{if(d.current){d.current=!1;return}u.current!==n.appId&&(u.current=n.appId,g([]),jr(e)||a(null))},[n.appId,e]);const l=Ta(h),f=b.useMemo(()=>({props:n,history:{push:c,pop:p,items:s}}),[n,c,p,s]),m=n.useShadowDOM?Sr:b.Fragment;return t.jsx(Ct.Provider,{value:f,children:t.jsx(m,{children:t.jsx(En,{children:t.jsx(Sn,{db:h,namespaces:l.namespaces||[]})})})})},It=b.createContext({shadowRoot:null,container:null,darkMode:!1});function rt(){return b.useContext(It).container}function pt(){return b.useContext(It).darkMode}const Sr=({children:e})=>{const r=b.useRef(null),a=b.useRef(null),[n,o]=b.useState(null),s=ie().darkMode;b.useEffect(()=>{if(r.current&&!n)try{const c=r.current.attachShadow({mode:"open"});a.current=c;const p=document.createElement("style");p.textContent=ha;const h=document.createElement("div");h.setAttribute("class",s?"h-full dark":"h-full"),c.appendChild(p),c.appendChild(h),o(h)}catch{}},[n]),b.useEffect(()=>{n&&n.setAttribute("class",s?"h-full dark":"h-full")},[s,n]);const g=b.useMemo(()=>({shadowRoot:a.current,container:n,darkMode:s}),[n,s]);return t.jsx("div",{ref:r,style:{height:"100%"},className:R("h-full"),children:t.jsx(It.Provider,{value:g,children:n?na.createPortal(e,n):null})})};function An({...e}){return t.jsx(se.Root,{"data-slot":"select",...e})}function Rn({...e}){return t.jsx(se.Value,{className:"content-[hi]","data-slot":"select-value",...e})}function Tn({className:e,size:r="default",children:a,...n}){return t.jsxs(se.Trigger,{"data-slot":"select-trigger","data-size":r,className:R("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(se.Icon,{asChild:!0,children:t.jsx(V.ChevronDownIcon,{width:14})})]})}function On({className:e,children:r,position:a="popper",...n}){const o=rt(),i=pt();return t.jsx(se.Portal,{container:o,children:t.jsxs(se.Content,{"data-slot":"select-content",className:R("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",i?"dark":"",e),position:a,...n,children:[t.jsx(Dn,{}),t.jsx(se.Viewport,{className:R("p-1",a==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:r}),t.jsx(Fn,{})]})})}function _n({className:e,children:r,...a}){return t.jsxs(se.Item,{"data-slot":"select-item",className:R("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(se.ItemIndicator,{children:t.jsx(V.CheckIcon,{width:12,className:"size-4"})})}),t.jsx(se.ItemText,{children:r})]})}function Dn({className:e,...r}){return t.jsx(se.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:R("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(V.ChevronUpIcon,{className:"size-4"})})}function Fn({className:e,...r}){return t.jsx(se.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:R("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(V.ChevronDownIcon,{className:"size-4"})})}/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),De=require("sonner"),ea=require("@radix-ui/react-visually-hidden"),ta=require("@monaco-editor/react"),Me=require("clsx"),et=require("copy-to-clipboard"),b=require("react"),ra=require("tailwind-merge"),aa=require("@radix-ui/react-select"),V=require("@heroicons/react/24/outline"),na=require("react-dom"),St=require("swr"),xe=require("@instantdb/core"),Ze=require("date-fns"),B=require("@heroicons/react/24/solid"),Ie=require("@instantdb/react"),pe=require("@dnd-kit/core"),oa=require("markdown-table"),wt=require("export-to-csv"),sa=require("@dnd-kit/modifiers"),Ce=require("@dnd-kit/sortable"),Fe=require("@tanstack/react-table"),ge=require("lucide-react"),Z=require("@headlessui/react"),fe=require("lodash"),ur=require("@dnd-kit/utilities");require("swr/subscription");const ia=require("@radix-ui/react-tooltip"),la=require("uuid"),da=require("@radix-ui/react-dialog"),ca=require("json5"),ua=require("@radix-ui/react-dropdown-menu"),pa=require("@radix-ui/react-toggle-group"),pr=require("react-copy-to-clipboard"),ga=require("@radix-ui/react-switch");function ze(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 se=ze(aa),ae=ze(ia),Le=ze(da),$e=ze(ua),Xt=ze(pa),Zt=ze(ga),ha=`/*! 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-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--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;--container-2xl:42rem;--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:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@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}[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-4{top:calc(var(--spacing)*4)}.top-\\[18px\\]{top:18px}.top-\\[50\\%\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.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-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)}.mt-8{margin-top:calc(var(--spacing)*8)}.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-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-2xl{max-width:var(--container-2xl)}.max-w-\\[67vw\\]{max-width:67vw}.max-w-\\[calc\\(100\\%-2rem\\)\\]{max-width:calc(100% - 2rem)}.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-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,)}.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-around{justify-content:space-around}.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)))}.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-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-gray-500{background-color:var(--color-gray-500)}.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-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.px-1{padding-inline:calc(var(--spacing)*1)}.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)}.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-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)}.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}.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 *){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\\: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-\\[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-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-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-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\\:ring-neutral-400:where(.dark,.dark *):focus-visible{--tw-ring-color:var(--color-neutral-400)}@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)}.\\[\\&_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)}}@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}}`,gr=typeof window<"u",fa=kt("devBackend");let yt="8888";if(fa&&gr){const e=new URL(location.href).searchParams.get("port");e&&(yt=e)}const Jt={apiURI:kt("devBackend")?`http://localhost:${yt}`:"https://api.instantdb.com",websocketURI:kt("devBackend")?`ws://localhost:${yt}/runtime/session`:"wss://api.instantdb.com/runtime/session"};function kt(e){if(!gr)return null;try{const r=localStorage.getItem(e);return r?JSON.parse(r):null}catch{return null}}function ne(e){De.toast.success(e,{richColors:!0})}function oe(e,r){De.toast.error(e,{duration:r?.autoClose,richColors:!0})}const Nt={"many-many":{cardinality:"many","unique?":!1},"one-one":{cardinality:"one","unique?":!0},"many-one":{cardinality:"many","unique?":!0},"one-many":{cardinality:"one","unique?":!1}},hr=Object.fromEntries(Object.entries(Nt).map(([e,r])=>[`${r.cardinality}-${r["unique?"]}`,e])),ma=({attr:e,gracePeriodDays:r,isExpanded:a,setIsExpanded:n,onRestore:o})=>{const i=Ze.add(new Date(e["deletion-marked-at"]),{days:r}),s=()=>e["forward-identity"][2],g=()=>e["reverse-identity"]?.[2],c=()=>{const l=e["forward-identity"][1],f=e["reverse-identity"]?.[1];return{forwardEtype:l,reverseEtype:f}},p=()=>{const l=`${e.cardinality}-${e["unique?"]}`;return hr[l]},h=()=>{n(!a)},d=(()=>{if(e["value-type"]==="blob")return[];const l=p(),{forwardEtype:f,reverseEtype:m}=c(),x=s(),w=g(),y=(k,T)=>k==="one-one"?"has one":k==="many-many"?"has many":k==="one-many"?T?"has one":"has many":k==="many-one"?T?"has many":"has one":"has";return[{label:"forward",value:t.jsxs("span",{children:[t.jsx("strong",{children:f})," ",y(l,!0)," ",t.jsx("strong",{children:x})]})},{label:"reverse",value:t.jsxs("span",{children:[t.jsx("strong",{children:m})," ",y(l,!1)," ",t.jsx("strong",{children:w})]})}]})(),u=[{label:"type",value:e["value-type"]},...d];return t.jsxs("div",{children:[t.jsxs("div",{className:"flex cursor-pointer items-center justify-between",onClick:h,children:[t.jsxs("div",{className:"flex items-center gap-3",children:[a?t.jsx(V.ChevronDownIcon,{width:14,className:"text-gray-400"}):t.jsx(V.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 ",Ze.formatDistanceToNow(i,{includeSeconds:!1})]})]}),t.jsxs(H,{className:"px-1",size:"mini",variant:"subtle",onClick:l=>{l.stopPropagation(),o(e.id)},children:[t.jsx(V.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,f)=>t.jsxs("tr",{className:f===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))})})})]})},Et=e=>{const r=ie(),a=r.adminToken;return St(["recently-deleted",e],async()=>{const o=await fetch(`${r.apiURI}/dash/apps/${e}/soft_deleted_attrs`,{method:"GET",headers:{Authorization:`Bearer ${a}`}}),i=await o.json();if(!o.ok)throw console.error("Failed to fetch recently deleted attrs",i),new Error("Failed to fetch recently deleted attrs"+JSON.stringify(i));return{...i,attrs:i.attrs.map(wa)}})},fr=e=>{const{data:r}=Et(e);return b.useMemo(()=>{const n=r?.attrs||[];return n.filter(s=>s["forward-identity"][2]==="id").map(s=>{const g=n.filter(c=>c.metadata.soft_delete_snapshot?.id_attr_id===s.id);return{idAttr:s,remainingCols:g.filter(c=>s.id!==c.id)}})},[r?.attrs])};function ba({appId:e,db:r}){const{data:a,mutate:n}=Et(e),o=fr(e),i=a?.["grace-period-days"]||2,s=async({idAttr:g,remainingCols:c})=>{if(!r||!a)return;const p=[g,...c].map(d=>d.id);await r.core._reactor.pushOps(p.map(d=>["restore-attr",d]));const h=new Set(p);n({...a,attrs:a.attrs.filter(d=>!h.has(d.id))})};return t.jsxs(ce,{className:"flex max-w-2xl flex-col gap-4",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",children:o.toSorted((g,c)=>+new Date(c.idAttr["deletion-marked-at"])-+new Date(g.idAttr["deletion-marked-at"])).map(g=>{const c=new Date(g.idAttr["deletion-marked-at"]),p=Ze.add(c,{days:i});return t.jsxs("div",{className:"flex items-start justify-between gap-4 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:"font-semibold dark:text-white",children:g.idAttr["forward-identity"][1]}),t.jsxs("div",{className:"mt-1 text-xs text-neutral-500 dark:text-neutral-400",children:["Deleted ",Ze.format(c,"MMM d, h:mm a")," ·"," ","expires"," ",Ze.formatDistanceToNow(p,{includeSeconds:!1})]}),g.remainingCols.length>0?t.jsxs("div",{className:"mt-1 truncate text-xs text-neutral-500 dark:text-neutral-400",children:["Columns:"," ",g.remainingCols.map(h=>h["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:()=>s(g),children:[t.jsx(V.ArrowPathIcon,{className:"h-3.5 w-3.5"}),"Restore"]})})]},g.idAttr.id)})}):t.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:"No recently deleted namespaces."})]})}const xa=({namespace:e,appId:r,db:a,notes:n})=>{const{data:o,mutate:i,error:s}=Et(r),[g,c]=b.useState(null),p=Qe(),h=async l=>{if(a&&o)try{await a.core._reactor.pushOps([["restore-attr",l]]),i({attrs:o.attrs.filter(m=>m.id!==l)??[],"grace-period-days":o["grace-period-days"]});const f=o.attrs.find(m=>m.id===l);if(f){const m=va(f);m&&n.setNote(l,m)}}catch(f){console.error(f),f instanceof xe.InstantAPIError?f.body?.type==="record-not-unique"?oe("Attribute already exists. Rename existing attribute first and then try again to restore."):oe(f.message):oe("Failed to restore attr")}},d=e.attrs.find(l=>l.name==="id")?.id||"unk",u=o?.attrs?.filter(l=>l.metadata?.soft_delete_snapshot?.id_attr_id===d);return b.useEffect(()=>{u?.length===0&&p.onClose()},[u]),s||!u||u.length===0?null:t.jsxs("div",{className:"pb-2",children:[t.jsx(ot,{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(V.ClockIcon,{width:16}),"Recently Deleted"]})}),t.jsx("div",{className:"flex flex-col gap-2",children:u?.map(l=>t.jsx(ma,{isExpanded:g===l.id,setIsExpanded:f=>{c(f?l.id:null)},attr:l,gracePeriodDays:o?.["grace-period-days"]||2,onRestore:h},l.id))})]})},Qt="_deleted$",wa=e=>{const r={...e},[a,n,o]=e["forward-identity"];if(r["forward-identity"]=[a,dt(n),dt(o)],e["reverse-identity"]){const[i,s,g]=e["reverse-identity"];r["reverse-identity"]=[i,dt(s),dt(g)]}return r},dt=e=>{const r=e.indexOf(Qt);return r===-1?e:e.slice(r+Qt.length)},va=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 ya({db:e,onClose:r}){const[a,n]=b.useState("");async function o(){const i={id:Ie.id(),"forward-identity":[Ie.id(),a,"id"],"value-type":"blob",cardinality:"one","unique?":!0,"index?":!1},s=[["add-attr",i]];await e.core._reactor.pushOps(s),r({id:i.id,name:a})}return t.jsxs(ce,{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(ke,{value:a,placeholder:"Name your namespace",onChange:i=>n(i),autoFocus:!0}),t.jsx(be,{type:"submit",label:"Create",submitLabel:"Creating...",errorMessage:"Failed to create namespace",disabled:!a,onClick:o})]})}const ka=[["$files","url"]],er=[":",">","<"];function ja(e){let r=0,a,n;const o=[];let i=-1;for(const s of e){if(i++,s===" "&&!er.includes(e[i+1])){r=i+1;continue}if(er.includes(s)){a&&n!=null&&(a.value=e.substring(n,r).trim(),o.push(a)),a={field:e.substring(r,i).trim(),operator:s,value:""},n=i+1;continue}}return a&&n!=null&&(a.value=e.substring(n).trim(),o.push(a)),o}function Ke(e){switch(e){case":":return"=";case"<":return"$lt";case">":return"$gt";default:throw new Error("what kind of op is this? "+e)}}function Sa({query:e,attrsByName:r,stringIndexed:a}){if(!e.trim())return[];const n=ja(e),o=n.flatMap(i=>{const s=r[i.field];if(!s||!i.value)return[];if(i.value.toLowerCase()==="null"&&i.operator===":"&&!s.isRequired)return[[i.field,"$isNull",null]];const g=[];if(s.checkedDataType&&s.isIndex){if(s.checkedDataType==="string"){const c=i.value;return[[i.field,c===c.toLowerCase()?"$ilike":"$like",`%${i.value}%`]]}if(s.checkedDataType==="number")try{return[[i.field,Ke(i.operator),JSON.parse(i.value)]]}catch{}if(s.checkedDataType==="date")try{return[[i.field,Ke(i.operator),JSON.parse(i.value)]]}catch{return[[i.field,Ke(i.operator),i.value]]}}for(const c of s.inferredTypes||["json"])switch(c){case"boolean":case"number":{try{g.push([i.field,Ke(i.operator),JSON.parse(i.value)])}catch{}break}default:{g.push([i.field,Ke(i.operator),i.value]);break}}return g});if(!n.length&&e.trim()&&a.length)for(const i of a)o.push([i.name,e.toLowerCase()===e?"$ilike":"$like",`%${e.trim()}%`]);return o}function Na(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 Ea({onSearchChange:e,attrs:r,initialFilters:a=[]}){const[n,o]=b.useState(""),i=b.useRef(a),{attrsByName:s,stringIndexed:g}=b.useMemo(()=>{const l={},f=[];for(const m of r||[])l[m.name]=m,m.isIndex&&m.checkedDataType==="string"&&f.push(m);return{attrsByName:l,stringIndexed:f}},[r]),c=b.useCallback(fe.debounce(l=>{const f=Sa({query:l,attrsByName:s,stringIndexed:g});Na(i.current,f)||(i.current=f,e(f))},80),[s,g,i]),p=n.indexOf(":")!==-1?fe.last(n.split(" ")):n,h=(r||[]).flatMap(l=>{const f=ka.some(([w,y])=>w===l.namespace&&y===l.name);if(l.type==="ref"||f)return[];const m=[],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)(!p||w.display.startsWith(p)&&w.display!==p)&&m.push(w);return m}),d=b.useRef(null);function u(l){let f;p&&l.startsWith(p)?f=`${n}${l.substring(p.length)}`:f=`${n.trim()} ${l}`,o(f),c(f)}return b.useEffect(()=>{a.length>0&&!n&&o(a.map(l=>`${l[0]}:${l[2]}`).join(" "))},[a]),t.jsxs(Z.Combobox,{value:n,onChange:l=>{l&&u(l)},immediate:!0,children:[t.jsx(Z.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),c(l.target.value)},onKeyDown:l=>{if(l.key==="Tab"&&h.length){l.preventDefault();const f=d.current||h[0];f&&u(f.display)}},placeholder:"Filter..."}),t.jsx(Z.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:h.map((l,f)=>t.jsx(Z.ComboboxOption,{value:l.display,className:R("px-3 py-1 data-focus:bg-blue-100 dark:text-white dark:data-focus:bg-neutral-700",{}),children:({focus:m})=>(m&&(d.current=l),t.jsx("span",{children:l.display}))},f))})]})}function Ca(e){const[,r,a]=e["forward-identity"];return e.catalog!=="system"||r==="$users"||r==="$files"}function Ia(e){const r={},a={};for(const[o,i]of Object.entries(e))Ca(i)&&(a[o]=i);for(const o of Object.values(a)){const[,i]=o["forward-identity"];r[i]||(r[i]={id:i,name:i,attrs:{}})}for(const o of Object.values(a)){const i={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[h,d,u,l]=o["forward-identity"],f=o.id+"-forward";l!==!1&&(r[d].attrs[f]={id:o.id,isForward:!0,namespace:d,name:u,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],isPrimary:o["primary?"],cardinality:o.cardinality,linkConfig:i,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[s,g,c,p]=o["reverse-identity"];if(r[g]&&p!==!1){const h=o.id+"-reverse";r[g].attrs[h]={id:o.id,isForward:!1,namespace:g,name:c,type:o["value-type"],isIndex:o["index?"],isUniq:o["unique?"],isRequired:o["required?"],cardinality:o.cardinality,linkConfig:i,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(tr)})).sort(tr)}function tr(e,r){return e.name==="id"?-1:r.name==="id"?1:e.name<r.name?-1:e.name>r.name?1:0}function Aa(e,r){const a={};return e&&(a[e[0]]=e[1]),r?.length&&(a.or=r.map(([n,o,i])=>{switch(o){case"=":return{[n]:i};case"$isNull":return{[n]:{[o]:!0}};default:return{[n]:{[o]:i}}}})),a}function Ra(e,r,a,n,o,i,s,g){const c=g?"asc":"desc",p=Aa(a,n),h=r?{[r.name]:{...Object.fromEntries(r.attrs.filter(f=>f.type==="ref").map(f=>[f.name,{$:{fields:["id"]}}])),$:{...p?{where:p}:{},...o?{limit:o}:{},...i?{offset:i}:{},order:{[s]:c}}}}:{},d=e.useQuery(h),l=e.useQuery(r?{[r.name]:{$:{aggregate:"count",...p?{where:p}:{}}}}:{}).aggregate?.[r?.name??""]?.count??null;return{itemsRes:d,allCount:l}}function Ta(e){const[r,a]=b.useState({namespaces:null,attrs:null});return e.useQuery({____explorer___:{}}),b.useEffect(()=>{function n(o){a({attrs:o,namespaces:Ia(o)})}return e._core._reactor.subscribeAttrs(n)},[e]),r}const rr=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),{}}},Oa=e=>{const[r,a]=b.useState(rr(e.appId));return b.useEffect(()=>{localStorage.setItem(`columnVisibility_${e.appId}`,JSON.stringify(r))},[e.appId,r]),b.useEffect(()=>{a(rr(e.appId))},[e.appId]),{visibility:r,setVisibility:a,attrs:e.attrs}};function ar(e){if(typeof window>"u")return;let r=window.localStorage.getItem(e);if(r)try{return JSON.parse(r)}catch{}}function _a(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 Da(e,r){const a=b.useRef(ar(e)||r),n=b.useCallback(i=>{const s=()=>{a.current=ar(e)||r,i()};return window.addEventListener("storage",s),()=>{window.removeEventListener("storage",s)}},[]);return[b.useSyncExternalStore(n,()=>a.current,()=>r),i=>_a(e,i)]}function Fa(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 La=(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 i=a.cloneNode(!0);i.style.display="inline-block",i.style.overflow="visible",i.style.width="auto",i.style.maxWidth="none",i.style.whiteSpace="nowrap",o.appendChild(i);const s=i.scrollWidth,g=Array.from(n).map(d=>{const u=d.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}),c=g.length>0?Math.max(...g):0,h=Math.max(s,c)+12;return Math.min(h,r)}finally{document.body.removeChild(o)}};function $a(){const e=b.useRef(null),[r,a]=b.useState(!1);return b.useLayoutEffect(()=>{const{current:n}=e;n&&(()=>{const i=n.scrollWidth>n.clientWidth||n.scrollHeight>n.clientHeight;a(i)})()},[e]),{ref:e,isOverflow:r,setIsOverflow:a}}const Ma=({header:e,table:r,headerGroup:a,index:n,setMinViableColWidth:o,onSort:i,currentSortAttr:s,currentSortAsc:g})=>{const{attributes:c,setActivatorNodeRef:p,isDragging:h,listeners:d,setNodeRef:u,transform:l}=Ce.useSortable({id:e.column.id,disabled:e.id==="select-col"}),f={opacity:h?.8:1,position:"relative",transform:e.id==="select-col"?void 0:ur.CSS.Translate.toString(l),transition:"width transform 0.2s ease-in-out",whiteSpace:"nowrap",width:e.column.getSize(),zIndex:h?1:0},x=!!e.column.columnDef?.meta?.sortable,w=typeof e.column.columnDef.header=="string"?e.column.columnDef.header:"",y=s===w||s==="serverCreatedAt"&&w==="id";return t.jsxs("div",{ref:u,className:Me("group relative z-10 h-8 w-full whitespace-nowrap select-none"),style:{...f,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",...c,...d,ref:p,style:{pointerEvents:"auto"}}),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:()=>{i&&i(w==="id"?"serverCreatedAt":w,s,g)},children:[t.jsx("span",{className:R(y&&"underline"),children:e.isPlaceholder?null:Fe.flexRender(e.column.columnDef.header,e.getContext())}),t.jsx("span",{className:"opacity-50 transition-opacity group-hover:opacity-70",style:{opacity:y?1:void 0,fontWeight:y?"bold":"normal"},children:y?g?t.jsx(V.ArrowUpIcon,{strokeWidth:3,width:10}):t.jsx(V.ArrowDownIcon,{strokeWidth:3,width:10}):t.jsx(V.ArrowsUpDownIcon,{strokeWidth:3,width:10})})]}):t.jsx(t.Fragment,{children:e.isPlaceholder?null:Fe.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:k=>(k.stopPropagation(),e.getResizeHandler()(k)),onTouchStart:e.getResizeHandler(),className:R(`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)},za=({cell:e})=>{const r=e.column.getIsResizing(),{history:a}=ut(),n=e.column.columnDef.meta,{isDragging:o,setNodeRef:i,transform:s}=Ce.useSortable({id:e.column.id,disabled:e.column.id==="select-col"}),[g,c]=b.useState(!1),{ref:p,isOverflow:h,setIsOverflow:d}=$a(),u=(h||fe.isObject(e.getValue()))&&!n?.isLink;b.useEffect(()=>{const x=new ResizeObserver(()=>{const w=p.current.scrollWidth>p.current.clientWidth||p.current.scrollHeight>p.current.clientHeight;d(w)});return x.observe(p.current),()=>{x.disconnect()}},[p.current]);const l={opacity:o?.8:1,position:"relative",transform:e.column.id==="select-col"?void 0:ur.CSS.Translate.toString(s),transition:"width transform 0.2s ease-in-out",width:e.column.getSize(),zIndex:o?1:0},f=n?.disablePadding??!1,m=e.getValue();return t.jsxs(Be,{children:[" ",t.jsx(qe,{className:"text-left",asChild:!0,children:t.jsx("div",{ref:x=>{i(x),p.current=x},style:{...l,padding:f?0:"0.5rem"},className:R("cursor-default truncate whitespace-nowrap"),children:t.jsx("span",{className:R(`h-full min-h-full cursor-pointer td-${e.column.id}`,f?"":"pr-2"),onClick:()=>{if(n?.isLink&&n.attr&&Array.isArray(m)&&m.length>0){const x=n.attr,w=x.linkConfig[x.isForward?"reverse":"forward"];if(w){a.push({namespace:w.namespace,where:[`${w.attr}.id`,e.row.original.id]});return}}n?.copyable&&et(mr(m))&&(c(!0),setTimeout(()=>c(!1),1e3))},children:g?t.jsx("div",{className:"h-1",children:"Copied!"}):Fe.flexRender(e.column.columnDef.cell,e.getContext())})},e.id)}),u&&!r&&t.jsx(Ue,{className:R(fe.isObject(m)&&"p-0"),side:"bottom",children:typeof m=="string"?Fe.flexRender(e.column.columnDef.cell,e.getContext()):t.jsx(Ba,{pretty:!0,data:m})})]})};function mr(e,r){return fe.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function Ba({data:e,pretty:r}){const a=mr(e,r),n=ie();return r&&fe.isObject(e)?t.jsx(mt,{darkMode:n.darkMode,code:a,language:"json"}):t.jsx(t.Fragment,{children:a})}const qa=({visiblity:e,localDates:r,setLocalDates:a})=>{const[n,o]=b.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx(nt,{icon:t.jsx(V.Cog6ToothIcon,{width:16}),label:"View Settings",onClick:()=>o(!0)}),t.jsxs(he,{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(V.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(i=>t.jsx("div",{className:"flex gap-2",children:t.jsx(J,{label:i.name,checked:e.visibility[i.id+i.name]!==!1,onChange:s=>e.setVisibility(g=>({...g,[i.id+i.name]:s}))})},i.id+i.name))})]}),t.jsx(ot,{className:"py-2"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{children:"Show Dates in Local Time"}),t.jsx(qt,{onClick:i=>{a(!r)},checked:r})]}),t.jsx("div",{className:"text-xs opacity-40",children:"Copy to clipboard will still use the original value."})]})]})};async function Ua({appId:e,attrId:r,jobType:a,checkedDataType:n,apiURI:o},i){return(await(await fetch(`${o}/dash/apps/${e}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${i}`,"content-type":"application/json"},body:JSON.stringify({"app-id":e,"attr-id":r,"job-type":a,"checked-data-type":n})})).json()).job}function br(e,r,a,n){let o=!1,i=!1,s=20,g=null;const c=h=>{if(h!==g)return s=20,g=h,s;const d=s;return s=Math.min(1e4,s*2),d},p=async h=>{for(;!o&&!i;)try{const u=await(await fetch(`${n}/dash/apps/${e}/indexing-jobs/${r}`,{headers:{authorization:`Bearer ${a}`}})).text(),f=JSON.parse(u).job;if(h(f),f.job_status!=="processing"&&f.job_status!=="waiting")return f;await new Promise(m=>setTimeout(m,c(u)))}catch(d){console.error("Job polling error:",d),i=!0,h(null,d)}};return{start:async h=>p(h),stop:()=>{o=!0}}}function ve(e){return e.job_status==="errored"}function ye(e){return e.job_status==="completed"||e.job_status==="errored"}const Pa=({attr:e,appId:r,isRequired:a,isIndexed:n,isUnique:o,checkedDataType:i,token:s})=>{const[g,c]=b.useState({}),[p,h]=b.useState({}),[d,u]=b.useState({}),l=ie();b.useEffect(()=>{Object.values(p).some(k=>k.job_status!=="completed"&&k.job_status!=="errored")||(a===e.isRequired?c(k=>({...k,require:void 0})):a?c(k=>({...k,require:{jobType:"required"}})):a||c(k=>({...k,require:{jobType:"remove-required"}})),n===e.isIndex?c(k=>({...k,index:void 0})):n?c(k=>({...k,index:{jobType:"index"}})):n||c(k=>({...k,index:{jobType:"remove-index"}})),o===e.isUniq?c(k=>({...k,unique:void 0})):o?c(k=>({...k,unique:{jobType:"unique"}})):o||c(k=>({...k,unique:{jobType:"remove-unique"}})),i===(e.checkedDataType||"any")?c(k=>({...k,type:void 0})):c(i==="any"?k=>({...k,type:{jobType:"remove-data-type"}}):k=>({...k,type:{jobType:"check-data-type",checkedDataType:i}})))},[a,n,o,i,e,p]);const[f,m]=b.useState(!1),x=async()=>{f||(h({}),m(!0),Object.entries(g).forEach(async([y,k])=>{if(!k)return;const q=await(await fetch(`${l.apiURI}/dash/apps/${r}/indexing-jobs`,{method:"POST",headers:{authorization:`Bearer ${s}`,"content-type":"application/json"},body:JSON.stringify({"app-id":r,"attr-id":e.id,"job-type":k.jobType,"checked-data-type":k.checkedDataType})})).json();h(_=>({..._,[y]:q.job})),c(_=>({..._,[y]:void 0})),m(!1);const M=br(r,q.job.id,s,l.apiURI);await M.start((_,U)=>{if(!U&&_){const P=_.work_estimate??5e4,W=_.work_completed??0,L=Math.floor(W/P*100);u($=>({...$,[y]:L})),h($=>({...$,[y]:_}))}}),M.stop()}))},w=b.useMemo(()=>Object.values(d).filter(y=>y>0&&y<100).reduce((y,k)=>y+k,0)/Object.values(d).filter(y=>y>0&&y<100).length,[d]);return{isPending:Object.values(g).filter(Boolean).length>0,progress:w,isRunning:Object.values(p).some(y=>y.job_status!=="completed"&&y.job_status!=="errored"),pending:g,running:p,apply:x}},Ga=()=>{const[e,r]=b.useState({});return{notes:e,setNote:(o,i)=>{r(s=>({...s,[o]:{message:i}}))},removeNote:o=>{r(i=>{const s={...i};return delete s[o],s})}}},Ha=(e,r,a)=>{const n=r.name,o=[];return r.attrs.forEach(i=>{o.push(["update-attr",{id:i.id,"forward-identity":[i.linkConfig.forward.id,e,i.linkConfig.forward.attr]}])}),a.forEach(i=>{i.attrs.forEach(s=>{s.linkConfig.reverse?.namespace===n&&o.push(["update-attr",{id:s.id,"reverse-identity":[s.linkConfig.reverse.id,e,s.linkConfig.reverse.attr]}])})}),o};function Wa({db:e,namespace:r,namespaces:a,onClose:n,isSystemCatalogNs:o}){const s=ie().appId,{history:g}=ut(),{mutate:c}=St.useSWRConfig(),[p,h]=b.useState({type:"main"}),[d,u]=b.useState(r.name),[l,f]=b.useState(null);async function m(){const k=r.attrs.map(T=>["delete-attr",T.id]);await e.core._reactor.pushOps(k),setTimeout(()=>{c(["recently-deleted",s])},500),n({ok:!0})}async function x(k){if(k.startsWith("$")){f("Namespace name cannot start with $");return}const T=Ha(k,r,a);await e.core._reactor.pushOps(T),g.push({namespace:k},!0),ne("Renamed namespace to "+k),u(""),h({type:"main"})}const w=Ga(),y=b.useMemo(()=>p.type==="edit"&&r.attrs.find(k=>k.id===p.attrId&&k.isForward===p.isForward),[p.type==="edit"?p.attrId:null,p.type==="edit"?p.isForward:null,r.attrs]);return t.jsxs(t.Fragment,{children:[p.type==="rename"&&t.jsxs("div",{className:"px-2",children:[t.jsx("button",{onClick:()=>{h({type:"main"})},className:"mb-3",children:t.jsx(B.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:k=>{k.preventDefault(),x(d)},children:[t.jsxs(at,{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(ke,{disabled:o,value:d,onChange:k=>u(k)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsxs(H,{type:"submit",disabled:d.startsWith("$")||d.length===0,children:["Rename ",r.name," → ",d]})})]})," "]}),p.type==="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(nt,{variant:"subtle",onClick:()=>{h({type:"rename"})},icon:t.jsx(B.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:()=>h({type:"delete"}),children:[t.jsx(B.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),t.jsx("div",{className:"flex flex-col gap-2",children:r.attrs.map(k=>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:k.name}),w.notes[k.id]?.message&&t.jsx(ht,{children:t.jsx("div",{className:"px-2 text-xs text-gray-500 dark:text-neutral-400",children:w.notes[k.id].message})})]}),k.name!=="id"?t.jsx(H,{className:"px-2",size:"mini",variant:"subtle",onClick:()=>{w.removeNote(k.id),h({type:"edit",attrId:k.id,isForward:k.isForward})},children:"Edit"}):null]},k.id+"-"+k.name))}),t.jsx("div",{children:t.jsxs(H,{size:"mini",variant:"secondary",onClick:()=>h({type:"add"}),children:[t.jsx(B.PlusIcon,{className:"inline",height:"12px"}),"New attribute"]})}),t.jsx(xa,{notes:w,db:e,appId:s,namespace:r})]}):p.type==="add"?t.jsx(Va,{db:e,namespace:r,namespaces:a,onClose:()=>h({type:"main"}),constraints:nr({namespaceName:r.name,isSystemCatalogNs:o})}):p.type==="delete"?t.jsx(xr,{name:r.name,type:"namespace",onClose:n,onConfirm:m}):p.type==="edit"&&y?t.jsx(rn,{db:e,attr:y,onClose:()=>h({type:"main"}),constraints:nr({namespaceName:r.name,isSystemCatalogNs:o,attr:y})}):null]})}function xr({name:e,type:r,onClose:a,onConfirm:n}){return t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(B.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(be,{variant:"destructive",label:`Delete ${e}`,submitLabel:"Deleting...",errorMessage:"Failed to delete",onClick:n})]})]})}function Va({db:e,namespace:r,namespaces:a,onClose:n,constraints:o}){const[i,s]=b.useState(!1),[g,c]=b.useState(!1),[p,h]=b.useState(!1),[d,u]=b.useState(!1),[l,f]=b.useState(!1),[m,x]=b.useState(null),[w,y]=b.useState("blob"),[k,T]=b.useState("many-many"),[q,M]=b.useState(()=>a.find(C=>C.name!==r.name)??a[0]),[_,U]=b.useState(""),[P,W]=b.useState(r.name),L=k==="one-one"||k==="one-many",$=k==="one-one"||k==="many-one",j=vr({attrName:_,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:q?.name}),A=w==="blob"?_:j.isValidLink;b.useEffect(()=>{if(w!=="ref"||!q)return;const C=q.name===r.name;U(C?"parent":q.name),W(C?"children":r.name),C&&T("one-many")},[w,q]);async function E(){if(w==="blob"){const O=[["add-attr",{id:xe.id(),"forward-identity":[xe.id(),r.name,_],"value-type":"blob",cardinality:"one","unique?":p,"index?":g,"required?":i,"checked-data-type":m??void 0}]];await e._core._reactor.pushOps(O),n()}else{if(!q)throw new Error("No reverse namespace");const O=[["add-attr",{id:xe.id(),...Nt[k],"forward-identity":[xe.id(),r.name,_],"reverse-identity":[xe.id(),q.name,P],"value-type":"ref","index?":!1,"required?":i,"on-delete":L&&d?"cascade":void 0,"on-delete-reverse":$&&l?"cascade":void 0}]];await e._core._reactor.pushOps(O),n()}}return t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex items-center gap-2 text-lg font-bold",children:[t.jsx(B.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(Rt,{ariaLabel:"Text alignment",selectedId:w,items:[{id:"blob",label:"Data"},{id:"ref",label:"Link"}],onChange:C=>y(C.id)})]}),w==="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(ke,{value:_,onChange:C=>U(C)})]}),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(J,{disabled:o.require.disabled,checked:i,onChange:C=>s(C),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(J,{checked:g,onChange:C=>c(C),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(J,{checked:p,onChange:C=>h(C),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(me,{value:m||"none",onChange:C=>{if(!C)return;const{value:O}=C;O==="none"&&x(null),x(O)},options:[{label:"Any (not enforced)",value:"none"},{label:"String",value:"string"},{label:"Number",value:"number"},{label:"Boolean",value:"boolean"},{label:"Date",value:"date"}]})})]})]}):w==="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(me,{value:q?.id??void 0,options:a.map(C=>({label:C.name+(C.name===r.name?" (self-link)":""),value:C.id})),onChange:C=>{if(!C)return;const O=a.find(D=>D.id===C.value);M(O)}})]}),t.jsx(wr,{relationship:k,attrName:_,reverseAttrName:P,namespaceName:r.name,reverseNamespaceName:q?.name,setAttrName:U,setReverseAttrName:W,setRelationship:T,isCascadeAllowed:L,isCascade:d,setIsCascade:u,isCascadeReverseAllowed:$,isCascadeReverse:l,setIsCascadeReverse:f,isRequired:i,setIsRequired:s,constraints:o})]}):null,t.jsxs("div",{className:"flex flex-col gap-2",children:[t.jsx(be,{type:"submit",label:"Create attribute",submitLabel:"Creating attribute...",errorMessage:"Failed to create attribute",disabled:!A,className:"border-gray-500 disabled:opacity-20",onClick:E}),j.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})}function ct({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 tt({indexingJob:e,attr:r,onClose:a}){const{history:n}=ut();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(ct,{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(ct,{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(ct,{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(ct,{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 wr({attrName:e,reverseAttrName:r,namespaceName:a,reverseNamespaceName:n,relationship:o,setAttrName:i,setReverseAttrName:s,setRelationship:g,isCascade:c,setIsCascade:p,isCascadeAllowed:h,isCascadeReverse:d,setIsCascadeReverse:u,isCascadeReverseAllowed:l,isRequired:f,setIsRequired:m,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(ke,{disabled:x.attr.disabled,title:x.attr.message,value:e,onChange:y=>i(y)}),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(ke,{disabled:x.attr.disabled,title:x.attr.message,value:r,onChange:y=>s(y)}),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(Ya,{disabled:!w||x.attr.disabled,value:o,onChange:y=>{g(y.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?Ka[o](a,n,e,r):t.jsx(t.Fragment,{children:" "})})]}),t.jsx("div",{className:"flex gap-2",children:t.jsx(J,{checked:h&&c,disabled:!h||x.attr.disabled,onChange:p,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(J,{checked:l&&d,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(J,{disabled:x.require.disabled,title:x.require.message,checked:f,onChange:y=>m(y),label:t.jsxs("span",{children:[t.jsx("strong",{children:"Require this attribute"})," so all entities will be guaranteed to have it"]})})})]})]})}function Ya({value:e,disabled:r,onChange:a,namespace:n,attr:o,reverseNamespace:i,reverseAttr:s,title:g}){return t.jsx(me,{disabled:r,value:e,onChange:c=>{c&&a(c)},options:[{label:"Many-to-many",value:"many-many"},{label:"One-to-one",value:"one-one"},{label:`${n} has-many ${o||"---"} / ${i} has-one ${s||"---"}`,value:"many-one"},{label:`${n} has-one ${o||"---"} / ${i} has-many ${s||"---"}`,value:"one-many"}],title:g})}const Ka={"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 Xa({appId:e,attr:r,isRequired:a,authToken:n,setIndexingJob:o,stopFetchLoop:i,apiURI:s}){if(!n||a===r.isRequired)return;i.current?.();const g=`${r.namespace}.${r.name}`;try{const c=await Ua({appId:e,attrId:r.id,jobType:a?"required":"remove-required",apiURI:s},n);o(c);const p=br(e,c.id,n,s);i.current=p.stop;const h=await p.start((d,u)=>{u&&oe(`Error while marking ${g} as required.`),d&&o(d)});if(h){if(h.job_status==="completed")return ne(a?`Marked ${g} as required.`:`Marked ${g} as optional.`),"completed";if(h.job_status==="canceled")return oe("Marking required was canceled."),"canceled";if(h.job_status==="errored")return h.error==="invalid-triple-error"?oe(`Found invalid data while updating ${g}.`):oe(`Encountered an error while updating ${g}.`),"errored"}}catch(c){return console.error(c),oe(`Unexpected error while updating ${g}`),"errored"}}const Za=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=!r||ye(r),c=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.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(ht,{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(me,{className:R(e&&"border-[#606AF4] ring-1 ring-[#606AF4] ring-inset focus:ring-[#606AF4]"),disabled:o||r&&!ye(r),title:o?i:void 0,value:a,onChange:p=>{p&&n(p.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&&g&&t.jsx(B.ArrowUturnLeftIcon,{onClick:()=>{n(s.checkedDataType||"any")},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:c})]})},Ja=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isRequired||!1)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},Qa=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isIndex)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},en=({pendingJob:e,runningJob:r,value:a,setValue:n,disabled:o,disabledReason:i,attr:s})=>{const g=Z.useClose();return b.useEffect(()=>{r&&ve(r)&&n(s.isUniq)},[r]),t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx(J,{disabled:o||r&&!ye(r),title:o?i:void 0,checked:a,onChange:c=>n(c),label:t.jsxs("span",{className:R(o||r&&!ye(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(B.ArrowUturnLeftIcon,{onClick:()=>{n(!a)},height:"1.2rem",className:"cursor-pointer pr-2 text-[#606AF4]"})]}),r&&ve(r)&&t.jsx(tt,{indexingJob:r,attr:s,onClose:g})]})},tn=({appId:e,attr:r,constraints:a})=>{const[n,o]=b.useState(r.isRequired||!1),[i,s]=b.useState(r.isIndex),[g,c]=b.useState(r.isUniq),[p,h]=b.useState(r.checkedDataType||"any"),d=ie(),{isPending:u,pending:l,apply:f,isRunning:m,running:x,progress:w}=Pa({attr:r,appId:e,token:d.adminToken,isRequired:n,isIndexed:i,isUnique:g,checkedDataType:p});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(Ja,{pendingJob:l.require,runningJob:x.require,value:n,setValue:o,disabled:a.require.disabled,disabledReason:a.require.message,attr:r}),t.jsx(Qa,{pendingJob:l.index,runningJob:x.index,value:i,setValue:s,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(en,{pendingJob:l.unique,runningJob:x.unique,value:g,setValue:c,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Za,{pendingJob:l.type,runningJob:x.type,value:p,setValue:h,disabled:a.attr.disabled,disabledReason:a.attr.message,attr:r}),t.jsx(Dt,{loading:!!w,percentage:w||0,variant:u||m?"primary":"secondary",className:"border",onClick:()=>f(),disabled:!u&&!w,children:m?"Updating Constraints...":"Update Constraints"})]})})};function rn({db:e,attr:r,onClose:a,constraints:n}){const i=ie().appId,{mutate:s}=St.useSWRConfig(),[g,c]=b.useState({type:"main"}),[p,h]=b.useState(r.linkConfig.forward.attr),[d,u]=b.useState(r.linkConfig.reverse?.attr),[l,f]=b.useState(()=>{const D=`${r.cardinality}-${r.isUniq}`;return hr[D]}),m=ie(),[x,w]=b.useState(()=>r.onDelete==="cascade"),[y,k]=b.useState(()=>r.onDeleteReverse==="cascade"),[T,q]=b.useState(r.isRequired||!1),[M,_]=b.useState(T),[U,P]=b.useState(null),W=b.useRef(null),L=Z.useClose();b.useEffect(()=>()=>W.current?.(),[W]);const $=l==="one-one"||l==="one-many",j=l==="one-one"||l==="many-one",A=vr({attrName:p,reverseAttrName:d,namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse?.namespace});async function E(){if(!r.linkConfig.reverse)throw new Error("No reverse link config");if(T!==M&&await Xa({appId:i,attr:r,isRequired:T,authToken:m.adminToken,setIndexingJob:P,stopFetchLoop:W,apiURI:m.apiURI})!="completed")return;const D=[["update-attr",{id:r.id,...Nt[l],"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,p],"reverse-identity":[r.linkConfig.reverse.id,r.linkConfig.reverse.namespace,d],"on-delete":$&&x?"cascade":null,"on-delete-reverse":j&&y?"cascade":null}]];await e.core._reactor.pushOps(D),T==M&&ne("Updated attribute")}async function C(){const D=[["update-attr",{id:r.id,"forward-identity":[r.linkConfig.forward.id,r.linkConfig.forward.namespace,p]}]];await e.core._reactor.pushOps(D),ne("Renamed attribute")}async function O(){await e.core._reactor.pushOps([["delete-attr",r.id]]),setTimeout(()=>{s(["recently-deleted",i])},500),a()}return g.type==="delete"?t.jsx(xr,{onConfirm:O,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(B.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:()=>c({type:"delete"}),children:[t.jsx(B.TrashIcon,{className:"inline",height:"1rem"}),"Delete"]})]}),r.type==="blob"?t.jsxs(t.Fragment,{children:[t.jsx(tn,{appId:i,attr:r,constraints:n}),t.jsx(ot,{}),t.jsxs(ce,{className:"flex flex-col gap-1",children:[t.jsx("h6",{className:"text-md font-bold",children:"Rename"}),t.jsxs(at,{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(ke,{disabled:n.attr.disabled,title:n.attr.message,value:p,onChange:D=>h(D)}),t.jsx("div",{className:"flex flex-col gap-2 rounded-sm py-2",children:t.jsx(be,{type:"submit",label:`Rename ${r.name} → ${p}`,submitLabel:"Renaming attribute...",errorMessage:"Failed to rename attribute",disabled:n.attr.disabled||!p||p===r.name,title:n.attr.message,onClick:C})})]})]}):t.jsxs(ce,{className:"flex flex-col gap-6",children:[t.jsx(wr,{relationship:l,attrName:p,reverseAttrName:d??"",namespaceName:r.linkConfig.forward.namespace,reverseNamespaceName:r.linkConfig.reverse.namespace,setAttrName:h,setReverseAttrName:u,setRelationship:f,isCascadeAllowed:$,isCascade:x,setIsCascade:w,isCascadeReverseAllowed:j,isCascadeReverse:y,setIsCascadeReverse:k,isRequired:T,setIsRequired:q,constraints:n}),t.jsx(tt,{indexingJob:U,attr:r,onClose:()=>{L(),a()}}),t.jsxs("div",{className:"flex flex-col gap-6",children:[t.jsx(be,{disabled:n.attr.disabled||!A.isValidLink,type:"submit",label:"Update relationship",submitLabel:"Updating relationship...",errorMessage:"Failed to update relationship",onClick:E,title:n.attr.message}),A.shouldShowSelfLinkNameError?t.jsx("span",{className:"text-red-500",children:"Self-links must have different attribute names."}):null]})]})]})}function vr({reverseNamespaceName:e,namespaceName:r,attrName:a,reverseAttrName:n}){const o=e&&e===r,i=a&&r&&e&&n,s=a!==n;return{isSelfLink:o,isNonEmptyLink:i,isValidLink:i&&(o?s:!0),shouldShowSelfLinkNameError:i&&o&&!s}}function nr({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,i=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:i}}}const Je=[{value:"string",label:"string"},{value:"number",label:"number"},{value:"boolean",label:"boolean"},{value:"json",label:"json"}];function an({onSave:e,onChange:r,onKeyDown:a,...n}){const o=b.useRef(null),i=s=>{const g=s.closest(".overflow-y-auto"),c=g?.scrollTop||0;s.style.height="auto",s.style.height=s.scrollHeight+"px",g&&(g.scrollTop=c)};return b.useEffect(()=>{o.current&&(i(o.current),o.current&&i(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:s=>{r?.(s),i(s.target)},onKeyDown:s=>{s.key==="Enter"&&!s.shiftKey&&e&&(s.preventDefault(),e()),a?.(s)}})}const vt={string:"",number:0,boolean:!1,json:{}};function nn(e){return e?e==="date"?Je.filter(r=>r.value==="string"||r.value==="number"):Je.filter(r=>r.value===e):Je}const yr=e=>!!e&&typeof e=="object";function on(e){try{return JSON.parse(e),!0}catch{return!1}}function sn(e){try{return JSON.parse(e)}catch{return e}}function ln(e,r){if(e.checkedDataType)return e.checkedDataType==="date"?"string":e.checkedDataType;if(r!=null){const a=yr(r)?"json":typeof r,n=Je.find(o=>o.value===a);if(n)return n.value}return e.inferredTypes?.length?e.inferredTypes[0]:Je[0].value}function or(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 yr(e)?JSON.stringify(e):String(e);if(r==="json")return sn(e)}return e}function dn(e){return la.validate(e)?null:"Invalid UUID."}function sr({db:e,namespace:r,item:a}){const[n,o]=b.useState(!1),[i,s]=b.useState(!1),{data:g,isLoading:c}=e.useQuery(n||i?{[r.name]:{$:{where:{id:a.id}}}}:null);return t.jsx(ae.Provider,{children:t.jsxs(ae.Root,{delayDuration:0,open:n,children:[t.jsx(ae.Trigger,{asChild:!0,onMouseEnter:()=>s(!0),onTouchStart:()=>s(!0),children:t.jsx("span",{children:t.jsx(H,{size:"mini",variant:"subtle",onClick:()=>o(p=>!p),children:t.jsx(B.InformationCircleIcon,{height:14})})})}),t.jsx(ae.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(g?.[r.name]?.[0]||a,null,2)}),c?t.jsx("div",{className:"absolute top-0 right-0 animate-spin p-2 opacity-50",children:t.jsx(B.Cog8ToothIcon,{width:12})}):null]})})]})})}function cn({q:e,option:r,uniqueAttrs:a,filterableAttrs:n}){const[o,i]=b.useState(!1);return t.jsx(Z.ComboboxOption,{value:r,className:Me("cursor-pointer px-3 py-1 data-focus:bg-blue-100 dark:border-neutral-700 dark:bg-neutral-800",{}),children:t.jsx(ae.Provider,{children:t.jsxs(ae.Root,{delayDuration:0,open:o,children:[t.jsx(ae.Trigger,{asChild:!0,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:t.jsxs("div",{children:[t.jsx("div",{children:t.jsx("code",{children:r.id})}),t.jsxs("div",{className:"truncate",children:[n.filter(s=>r.hasOwnProperty(s.name)&&!s.isUniq&&e&&JSON.stringify(r[s.name]).toLowerCase().indexOf(e.toLowerCase())!==-1).slice(0,3).map(s=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:s.name}),":"," ",JSON.stringify(r[s.name])]},s.id)),a.filter(s=>r.hasOwnProperty(s.name)).slice(0,3).map(s=>t.jsxs("div",{children:[t.jsx("span",{className:"font-medium",children:s.name}),":"," ",JSON.stringify(r[s.name])]},s.id))]})]})}),t.jsx(ae.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 un({db:e,namespace:r,onLinkRef:a,ignoreIds:n,onClose:o}){const[i,s]=b.useState(""),g=b.useRef(null),{uniqueAttrs:c,filterableAttrs:p}=b.useMemo(()=>{const f=[],m=[];for(const[x,w]of Object.entries(r.attrs))w.isUniq&&w.name!=="id"&&w.type==="blob"&&f.push(w),w.isIndex&&(w.checkedDataType==="string"||w.checkedDataType==="number")&&m.push(w);return{uniqueAttrs:f,filterableAttrs:m}},[r.attrs]),h=b.useMemo(()=>{const f=[{$entityIdStartsWith:i}];let m;try{const x=JSON.parse(i);typeof x=="number"&&(m=x)}catch{}for(const x of p)x.checkedDataType==="string"&&i.trim()&&f.push({[x.name]:{$ilike:`%${i.trim()}%`}}),x.checkedDataType==="number"&&m!=null&&f.push({[x.name]:m});for(const x of c)x.checkedDataType||(f.push({[x.name]:i}),m!=null&&f.push({[x.name]:m}));return{[r.name]:{$:{where:{or:f},limit:20}}}},[r.name,p,i]),{data:d,isLoading:u}=e.useQuery(h),l=d?.[r.name]?.filter(f=>!n.has(f.id));return t.jsx("div",{className:"relative mt-1 w-full",children:t.jsxs(Z.Combobox,{onChange:f=>{f&&(a(f),s(""),o())},onClose:o,immediate:!0,children:[t.jsx(Z.ComboboxInput,{ref:g,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:i,onChange:f=>{s(f.target.value)},placeholder:`Search ${r.name}...`}),t.jsx(Z.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(f=>t.jsx(cn,{q:i,option:f,uniqueAttrs:c,filterableAttrs:p},f.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 pn({db:e,item:r,attr:a,namespace:n,refUpdates:o,handleLinkRef:i,handleUnlinkRef:s}){const[g,c]=b.useState(!1),p=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]),h=a.cardinality,d=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(sr,{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?i(a,u):s(a,u.id),children:l?t.jsx(B.ArrowUturnLeftIcon,{height:14}):t.jsx(B.TrashIcon,{height:14})})]},u.id)}),Object.entries(o||{}).map(([u,{action:l,item:f}])=>{if(l==="link")return t.jsxs("div",{children:[t.jsx("code",{children:u}),t.jsx(sr,{db:e,namespace:n,item:f}),t.jsx(H,{title:"Remove",type:"link",size:"mini",variant:"destructive",className:"border-none",onClick:()=>s(a,u),children:t.jsx(B.TrashIcon,{height:14})})]},u)}),g?t.jsx(un,{namespace:n,onLinkRef:u=>i(a,u),db:e,ignoreIds:p,onClose:()=>c(!1)}):t.jsx(H,{variant:"secondary",onClick:()=>c(!0),children:h==="many"||!d?"Add link":"Replace link"})]})}const gn=(e,r)=>r.type==="blob"&&e.name!=="$files"||e.name==="$files"&&r.type==="blob"&&r.name==="path";function ir({db:e,namespace:r,item:a,onClose:n}){const o=a.id?"edit":"add",i=ie(),s=[],g=[];for(const j of r.attrs)j.name!=="id"&&(gn(r,j)&&s.push(j),j.type==="ref"&&g.push(j));const c=s.reduce((j,A)=>{const E=a[A.name],C=ln(A,E),O=o==="add"?A.isRequired?vt[C]:null:E;return{...j,[A.name]:{type:C,value:O,error:null}}},{}),[p,h]=b.useState({...c,...o==="add"?{id:{type:"string",value:Ie.id()}}:{}}),[d,u]=b.useState({}),[l,f]=b.useState({}),[m,x]=b.useState(s.reduce((j,A)=>({...j,[A.name]:o==="edit"?a[A.name]===null||a[A.name]===void 0:p[A.name].value===null}),{})),w=Object.values(p).some(j=>!!j.error),[y,k]=b.useState(!1),T=()=>{u({}),h({...c}),x(s.reduce((A,E)=>({...A,[E.name]:o==="edit"?a[E.name]===null||a[E.name]===void 0:!1}),{}));const j={};s.forEach(A=>{c[A.name]?.type==="json"&&a[A.name]!==void 0&&(j[A.name]=a[A.name]===null?"null":JSON.stringify(a[A.name],null,2))}),f(j),k(!1)},q=(j,A)=>{h(E=>{const C=E[j]?.value;return{...E,[j]:{type:A,value:or(C,A)}}})},M=(j,A,E)=>{const C=E?E(A):null;h(O=>{const D=O[j]?.type||"string";return{...O,[j]:{type:D,value:or(A,D),error:C}}})},_=(j,A)=>{f(E=>({...E,[j]:A})),h(E=>{const C=E[j]||{};return A===""?{...E,[j]:{type:"json",value:void 0,error:"Invalid JSON"}}:{...E,[j]:on(A)?{type:"json",value:JSON.parse(A),error:null}:{...C,type:"json",error:"Invalid JSON"}}})},U=(j,A)=>{x(C=>({...C,[j]:A}));const E=p[j]?.type||"string";A?(h(C=>({...C,[j]:{type:E,value:null,error:null}})),E==="json"&&f(C=>({...C,[j]:"null"}))):(h(C=>({...C,[j]:{type:E,value:vt[E],error:null}})),E==="json"&&f(C=>({...C,[j]:"{}"})))},P=(j,A)=>{u(E=>{if(a[j.name]?.find(X=>X.id===A))return{...E,[j.name]:{...E[j.name]||{},[A]:{action:"unlink",item:null}}};const{[A]:O,...D}=E[j.name]||{};return{...E,[j.name]:D}})},W=(j,A)=>{u(E=>{const C=A.id,O=E[j.name]?.[C];if(O&&O.action==="unlink"){if(j.cardinality==="one"){const{[j.name]:ee,...G}=E;return G}const{[C]:D,...X}=E[j.name];return{...E,[j.name]:X}}if(j.cardinality==="one"&&a[j.name]?.length){const D=a[j.name][0];return{...E,[j.name]:{[C]:{action:"link",item:A},[D.id]:{action:"unlink",item:null}}}}return{...E,[j.name]:{...E[j.name]||{},[C]:{action:"link",item:A}}}})},L=j=>{requestAnimationFrame(()=>{const A=document.querySelector(`[tabindex="${j}"]`);A&&A instanceof HTMLElement&&A.focus()})},$=async()=>{if(w){k(!0);return}const j=Object.fromEntries(Object.entries(p).map(([E,{value:C}])=>[E,C])),A=a.id||j.id||Ie.id();delete j.id;try{let E=Ie.tx[r.name][A];const C=[],O=[];for(const[D,X]of Object.entries(d))for(const[ee,{action:G}]of Object.entries(X))G==="link"&&O.push({[D]:ee}),G==="unlink"&&C.push({[D]:ee});for(const D of C)E=E.unlink(D);E=E.update(j);for(const D of O)E=E.link(D);await e.transact(E),n(),ne("Successfully updated row!")}catch(E){const C=E.message;if(C)oe(`Failed to save row: ${C}`);else throw E}};return t.jsxs(ce,{className:"p-4",children:[t.jsx("h5",{className:"flex text-lg font-bold",children:o=="edit"?"Edit row":"Add row"}),t.jsx("code",{className:"font-mono text-sm font-medium text-gray-500 dark:text-neutral-500",children:o=="edit"?t.jsxs(t.Fragment,{children:[r.name,"['",a.id,"']"]}):t.jsx(t.Fragment,{children:r.name})}),t.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[o==="add"?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsx("div",{className:"flex items-center justify-between",children:t.jsx(Ae,{className:"font-mono",children:t.jsxs("div",{className:"flex gap-1",children:["id"," ",t.jsx(H,{type:"link",size:"mini",variant:"subtle",onClick:()=>M("id",Ie.id()),children:t.jsx(B.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:p.id?.value??"",onChange:j=>M("id",j.target.value,dn)})})," ",p.id?.error&&y&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:p.id.error})]},"id"):null,s.map((j,A)=>{const E=A+1,{type:C,value:O,error:D}=p[j.name]||{type:"string",value:vt.string},X=l[j.name]||(O!==null?JSON.stringify(O,null,2):"null"),ee=m[j.name];return t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Ae,{className:"font-mono",children:j.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center",children:!j.isRequired&&t.jsx(J,{checked:ee,onChange:G=>U(j.name,G),label:t.jsx("span",{className:"text-[10px] text-gray-600 uppercase dark:text-neutral-600",children:"null"})})}),t.jsx(me,{className:"w-24 rounded-sm px-2 py-0.5 text-sm",value:C,options:nn(j.checkedDataType),onChange:G=>q(j.name,G.value)})]})]}),t.jsxs("div",{className:"flex flex-col gap-1",children:[ee?t.jsx("button",{onClick:()=>{U(j.name,!1),L(E)},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:C==="json"?t.jsx("div",{className:"h-32 w-full rounded-sm border",children:t.jsx(ft,{darkMode:i.darkMode,tabIndex:E,language:"json",value:X,onChange:G=>_(j.name,G)})}):C==="boolean"?t.jsx(me,{tabIndex:E,value:O,options:[{value:"false",label:"false"},{value:"true",label:"true"}],onChange:G=>M(j.name,G.value)}):C==="number"?t.jsx("input",{tabIndex:E,type:"number",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:O??"",onChange:G=>M(j.name,G.target.value)}):t.jsx(an,{tabIndex:E,value:O??"",onChange:G=>M(j.name,G.target.value),onSave:$})}),j.checkedDataType==="date"&&t.jsxs(H,{variant:"subtle",size:"mini",onClick:()=>{M(j.name,C==="number"?Date.now():new Date().toISOString())},children:[t.jsx(V.ClockIcon,{height:14}),"now"]})]}),D&&y&&t.jsx("span",{className:"text-sm font-medium text-red-500",children:D})]})]},j.name)}),g.map((j,A)=>{const E=j.isForward?j.linkConfig.reverse.nsMap:j.linkConfig.forward.nsMap;return E?t.jsxs("div",{className:"flex flex-col gap-1",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx(Ae,{className:"font-mono",children:j.name}),t.jsxs("span",{className:"rounded-sm px-2 py-0.5 text-sm",children:["Link to ",t.jsx("code",{children:E.name})]})]}),t.jsx("div",{className:"flex flex-col gap-1",children:t.jsx(pn,{db:e,item:a,namespace:E,attr:j,refUpdates:d[j.name],handleLinkRef:W,handleUnlinkRef:P})})]},j.name):null})]}),t.jsxs("div",{className:"mt-8 flex flex-row items-center justify-between gap-1",children:[y&&w?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:T,children:"Reset"}),t.jsx(be,{tabIndex:s.length+1,type:"submit",variant:"primary",label:"Save",submitLabel:"Saving...",errorMessage:"Failed to save row.",onClick:$})]})]})]})}const hn=[];function fn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(c=>c.id!=="select-col"&&c.header!==void 0&&!c.meta?.isLink),i=e.map(c=>{const p={};return o.forEach(h=>{const d=c[h.header];d==null?p[h.header]="":typeof d=="object"?p[h.header]=JSON.stringify(d):p[h.header]=d}),p}),s=wt.mkConfig({fieldSeparator:",",filename:`${a}_export`,decimalSeparator:".",useKeysAsHeaders:!0}),g=wt.generateCsv(s)(i);n?(wt.download(s)(g),ne("CSV file downloaded")):(et(g.toString()),ne("CSV copied to clipboard"))}function mn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(c=>c.id!=="select-col"&&c.header!==void 0&&!c.meta?.isLink),i=o.map(c=>c.header),s=e.map(c=>o.map(p=>{const h=c[p.header];return h==null?" ":typeof h=="object"?JSON.stringify(h):String(h)})),g=oa.markdownTable([i,...s]);if(n){const c=new Blob([g],{type:"text/markdown"}),p=URL.createObjectURL(c),h=document.createElement("a");h.href=p,h.download=`${a}_export.md`,document.body.appendChild(h),h.click(),document.body.removeChild(h),URL.revokeObjectURL(p),ne("Markdown file downloaded")}else et(g),ne("Markdown copied to clipboard")}function bn(e,r,a,n=!1){if(e.length===0)return;const o=r.filter(g=>g.id!=="select-col"&&g.header!==void 0&&!g.meta?.isLink),i=e.map(g=>{const c={};return o.forEach(p=>{const h=g[p.header];c[p.header]=h}),c}),s=JSON.stringify(i,null,2);if(n){const g=new Blob([s],{type:"application/json"}),c=URL.createObjectURL(g),p=document.createElement("a");p.href=c,p.download=`${a}_export.json`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(c),ne("JSON file downloaded")}else et(s),ne("JSON copied to clipboard")}const xn=({db:e,namespaces:r})=>{const{explorerState:a,history:n}=ut(),o=ie(),i=a,s=r.find(N=>N.id===i.namespace),[g,c]=b.useState(50),[p,h]=b.useState([]),[d,u]=b.useState(!1),[l,f]=b.useState(""),[m,x]=b.useState(!1),[w,y]=b.useState(null),[k,T]=b.useState(null),[q,M]=b.useState(!1);b.useRef(null);const _=b.useRef(null),[U,P]=b.useState({}),W=b.useRef(null),L=s?.name?.startsWith("$")??!1,$=s?.name??"",j=L&&!["$users","$files"].includes($),A=U[$]||0,E=i?.sortAttr||"serverCreatedAt",C=i?.sortAsc??!0,O=(N,S)=>{const I=re.options.data.map(ue=>ue.id),F=I.indexOf(N),z=I.indexOf(_.current),[Y,Q]=[Math.min(F,z),Math.max(F,z)];Re(ue=>{const Ye={...ue};for(let Oe=Y;Oe<=Q;Oe++){const lt=I[Oe];S?Ye[lt]=!0:delete Ye[lt]}return Ye})},[D,X]=b.useState([]),{itemsRes:ee,allCount:G}=Ra(e,s,i?.where,i?.filters||D,g,A,E,C),te=ee.data?.[s?.name??""]??hn;function je(N,S){return N.filter(I=>S[I.id])}const le=G?Math.ceil(G/g):1,K=A/g+1,[Se,zr]=Da("localDates",!1),Br=async()=>{try{if(u(!0),p.length===0)return;const[N]=p;await yn(o.adminToken,o.appId,N,l,o.apiURI)&&(h([]),f(""),W.current&&(W.current.value="")),ne("Successfully uploaded!")}catch(N){console.error("Failed to upload:",N),oe(`Failed to upload: ${N.body.message}`)}finally{u(!1)}},Ut=b.useMemo(()=>te,[te]),Pe=b.useRef(null),[Pt,Gt]=b.useState(0),[Ht,Wt]=b.useState(1),[Vt,Yt]=b.useState(!1),qr=N=>{if(re?.getColumn(N)?.columnDef.header==="id"){Kt(N,285);return}const S=La(N,800);Kt(N,S)},Kt=(N,S=200)=>{if(!s)return;const I={};s?.attrs.forEach(F=>{I[F.id+F.name]=re.getColumn(F.id+F.name)?.getSize()||0}),re.setColumnSizing({...I,[N]:S})},Ge=b.useMemo(()=>{const N=[];return N.push({id:"select-col",enableSorting:!1,accessorFn:()=>null,enableHiding:!1,enableResizing:!1,size:52,header:({table:S})=>t.jsx(J,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",style:{pointerEvents:"auto"},checked:S.getIsAllRowsSelected(),onChange:I=>{I?(S.toggleAllRowsSelected(),te.length>0&&(_.current=te[0].id)):(Re({}),_.current=null)}}),cell:({row:S,column:I})=>t.jsxs("div",{className:"flex h-1 justify-around gap-2",children:[t.jsx(J,{className:"relative z-10 text-[#2563EB] dark:checked:border-[#2563EB] dark:checked:bg-[#2563EB]",checked:S.getIsSelected(),onChange:(F,z)=>{(z.nativeEvent?z.nativeEvent.shiftKey:!1)&&_.current?O(S.id,z.target.checked):Re(Q=>{const ue={...Q};return z.target.checked?ue[S.id]=!0:delete ue[S.id],ue}),_.current=S.id}}),j?null:t.jsx("button",{className:"translate-y-0.5 opacity-0 transition-opacity group-hover:opacity-100",onClick:()=>T(S.id),children:t.jsx(V.PencilSquareIcon,{className:"h-4 w-4 text-neutral-500 dark:text-neutral-400"})})]})}),s?.attrs?.forEach(S=>{N.push({id:S.id+S.name,header:S.name,enableSorting:!0,enableResizing:!0,accessorFn:I=>I[S.name],meta:{sortable:S.sortable||S.name==="id",copyable:!0,isLink:S.type==="ref",attr:S,disablePadding:S.namespace==="$files"&&S.name==="url"},cell:I=>{if(I.row.original[S.name]===null||I.row.original[S.name]===void 0)return t.jsx("div",{className:"h-1",children:"-"});if(S.type==="ref"){const F=I.row.original[S.name].length;return t.jsxs("div",{className:R("h-1 translate-y-0.5",F<1&&"opacity-50"),children:[F," link",F===1?"":"s"]})}if(S.namespace==="$files"){if(S.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:I.row.original.url,target:"_blank",children:"View File"});if(S.name==="size")return Fa(I.row.original[S.name])}if(S.checkedDataType==="boolean")return I.row.original[S.name]?"true":"false";if(S.checkedDataType==="date"){const F=xe.coerceToDate(I.row.original[S.name]);return Se&&F?.toLocaleString()||I.row.original[S.name]}return fe.isObject(I.row.original[S.name])?t.jsx(vn,{data:I.row.original[S.name]}):I.row.original[S.name]}})}),N},[s?.attrs,Se]),[Ur,Pr]=b.useState({}),Gr=()=>{const N=Object.entries(re.getState().columnSizing).reduce((z,[Y,Q])=>st.visibility[Y]!==!1?{...z,[Y]:Q}:z,{}),S=Pe.current?.clientWidth||-1,I=Object.values(N).reduce((z,Y)=>z+Y,0),F=S-52-I;if(F>0){const z=Object.keys(N).length,Y=F/z;Object.keys(N).forEach(Q=>{N[Q]+=Y})}Yt(!1),re.setColumnSizing(()=>({...N}))},Hr="onChange",Wr="ltr",st=Oa({appId:o.appId,attrs:s?.attrs,namespaceId:s?.id}),[He,it]=b.useState(()=>Ge.map(N=>N.id));b.useLayoutEffect(()=>{if(s?.attrs){const N=localStorage.getItem(`order-${s.id}-${o.appId}`);if(N)it(JSON.parse(N));else{const S=s.attrs.map(I=>I.id+I.name);it(["select-col",...S])}}},[s?.attrs]),b.useEffect(()=>{s?.id&&localStorage.setItem(`order-${s.id}-${o.appId}`,JSON.stringify(He))},[He,s?.id]);const[Ne,Re]=b.useState({});b.useEffect(()=>{Re({}),_.current=null},[s?.id]);const We=Object.keys(Ne).length,Te=$==="$files"?We===1?"file":"files":We===1?"row":"rows",re=Fe.useReactTable({columnResizeDirection:Wr,columnResizeMode:Hr,onColumnVisibilityChange:st.setVisibility,columns:Ge,data:Ut,enableColumnResizing:!0,enableRowSelection:!0,getCoreRowModel:Fe.getCoreRowModel(),getRowId:N=>N.id,onColumnOrderChange:it,onRowSelectionChange:Re,onColumnSizingChange:Pr,state:{columnSizing:Ur,columnOrder:He,columnVisibility:st.visibility,rowSelection:Ne}}),[Ee,bt]=b.useState(!1);b.useEffect(()=>{const N=F=>{F.key==="Shift"&&bt(!0)},S=F=>{F.key==="Shift"&&bt(!1)},I=()=>{bt(!1)};return window.addEventListener("keydown",N),window.addEventListener("keyup",S),window.addEventListener("blur",I),()=>{window.removeEventListener("keydown",N),window.removeEventListener("keyup",S),window.removeEventListener("blur-sm",I)}},[]);const[Vr,Ve]=b.useState(!1);function Yr(N){const{active:S,over:I}=N;S&&I&&S.id!==I.id&&S.id!=="select-col"&&I.id!=="select-col"&&it(F=>{const z=F.indexOf(S.id),Y=F.indexOf(I.id);return Ce.arrayMove(F,z,Y)})}const xt=b.useMemo(()=>te.find(N=>N.id===k),[te.length,k]);b.useEffect(()=>{const N=Pe.current;if(!N)return;const S=()=>{const z=re.getCenterTotalSize(),Y=N.clientWidth;Yt(z<Y-5);const{scrollLeft:Q,scrollWidth:ue,clientWidth:Ye}=N,Oe=ue-Ye;if(Oe<=0){Gt(0),Wt(0);return}const lt=Math.min(Q/30,1);Gt(lt);const Qr=Math.min((Oe-Q)/30,1);Wt(Qr)};S(),N.addEventListener("scroll",S);const I=new ResizeObserver(S);I.observe(N);const F=N.firstElementChild;return F&&I.observe(F),window.addEventListener("resize",S),()=>{N.removeEventListener("scroll",S),I.disconnect(),window.removeEventListener("resize",S)}},[s,Ut]);const Kr=pe.useSensors(pe.useSensor(pe.MouseSensor,{}),pe.useSensor(pe.TouchSensor,{}),pe.useSensor(pe.KeyboardSensor,{})),Xr=n.items.length>=1,Zr=N=>N==="id"?140:N==="url"?120:N.length*7.2+50;if(b.useLayoutEffect(()=>{if(s?.id){if(localStorage.getItem(`$sizing-${s.id}-${o.appId}`)){const z=JSON.parse(localStorage.getItem(`sizing-${s.id}-${o.appId}`)||"{}");re.setColumnSizing(()=>({...z}));return}const N=Pe.current?.clientWidth||-1,S={};s?.attrs.forEach(z=>{S[z.id+z.name]=Zr(z.name)});const I=Object.values(S).reduce((z,Y)=>z+Y,0),F=N-52-I;if(F>0){const z=Object.keys(S).length,Y=F/z;Object.keys(S).forEach(Q=>{S[Q]+=Y})}re.setColumnSizing(S)}},[Pe.current,s]),!s)return null;const Jr=s.id;return t.jsxs(t.Fragment,{children:[t.jsx(he,{title:"Delete Rows",open:m,onClose:()=>x(!1),children:s?t.jsxs(ce,{className:"min flex flex-col gap-4",children:[t.jsxs("h5",{className:"flex text-lg font-bold",children:["Delete ",Te]}),t.jsxs(at,{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 ",We," ",Te," "]}),"associated with"," ",t.jsx("strong",{className:"dark:text-white",children:s.name}),"."]}),t.jsx(be,{type:"submit",disabled:j,label:`Delete ${Te}`,submitLabel:`Deleting ${Te}...`,errorMessage:`Failed to delete ${Te}`,className:"border-red-500 text-red-500",title:j?`The ${s?.name} namespace is read-only.`:void 0,onClick:async()=>{try{if(s.name==="$files"){const N=te.filter(S=>S.id in Ne).map(S=>S.path);await kn(o.adminToken,o.appId,N,o.apiURI)}else await e.transact(Object.keys(Ne).map(N=>xe.tx[s.name][N].delete()))}catch(N){const S=N.message;oe(`Failed to delete ${Te}${S?`: ${S}`:""}`);return}Re({}),x(!1)}})]}):null}),t.jsx(he,{title:"Edit Row",open:q,onClose:()=>M(!1),children:s?t.jsx(ir,{db:e,item:{},namespace:s,onClose:()=>M(!1)}):null}),t.jsx(he,{title:"Edit Row",open:!!xt,onClose:()=>T(null),children:s&&xt?t.jsx(ir,{db:e,namespace:s,item:xt,onClose:()=>T(null)}):null}),t.jsx(he,{title:"Edit Namespace",stopFocusPropagation:!0,open:!!w,onClose:()=>y(null),children:s?t.jsx(Wa,{readOnly:j,isSystemCatalogNs:L,db:e,namespace:s,namespaces:r??[],onClose:N=>{y(null),N?.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 flex-1 flex-col justify-between py-2 md:flex-row md:items-center",children:[t.jsxs("div",{className:"flex items-center overflow-hidden border-b px-2 py-1 pl-4 md:border-b-0 dark:border-neutral-700",children:[Xr?t.jsx(ge.ArrowLeftIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>n.pop()}):null,i.where?t.jsx(V.XMarkIcon,{className:"mr-4 inline cursor-pointer",height:"1rem",onClick:()=>{n.push({namespace:s.id},!0)}}):null,t.jsxs("div",{className:"text-ellipses shrink truncate overflow-hidden font-mono text-xs whitespace-nowrap dark:text-white",children:[t.jsx("strong",{children:s.name})," ",i.where?t.jsxs(t.Fragment,{children:[" ","where ",t.jsx("strong",{children:i.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(i.where[1])})]}):null,i?.filters?.length?t.jsx("span",{title:i.filters.map(([N,S,I])=>`${N} ${S} ${I}`).join(" || "),children:i.filters.map(([N,S,I],F)=>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:[N," ",S," ",I]}),i?.filters?.length&&F<i.filters.length-1?" || ":null]},N))}):null]})]}),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:()=>{y(s)},children:"Edit Schema"}),t.jsx(Ea,{onSearchChange:N=>X(N),attrs:s?.attrs,initialFilters:i?.filters||[]},Jr)]})]})}),s.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:W,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:N=>{const S=N.target.files;h(S),S?.[0]&&f(S[0].name)}}),t.jsx(H,{variant:"primary",disabled:p.length===0,size:"mini",loading:d,onClick:Br,className:"rounded-sm",children:d?"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:N=>f(N.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:[s.name!=="$files"?t.jsxs(H,{disabled:j,title:j?`The ${s?.name} namespace is read-only.`:void 0,size:"mini",variant:"secondary",onClick:()=>{M(!0)},children:[t.jsx(ge.PlusIcon,{width:12}),"Add row"]}):null,t.jsx("div",{className:R("px-1",s.name==="$files"&&"pb-1"),children:t.jsx(me,{className:"rounded-sm text-xs",onChange:N=>{if(!N)return;const S=parseInt(N.value,10);c(S),n.push(I=>({...I,limit:S}))},value:`${g}`,options:[{label:"25/page",value:"25"},{label:"50/page",value:"50"},{label:"100/page",value:"100"}]})}),t.jsx("div",{className:"w-[62px]",children:G!==void 0&&(G===0?t.jsx(t.Fragment,{children:"No Results"}):t.jsxs(t.Fragment,{children:[(K-1)*g+1," -"," ",Math.min(G,K*g)," of ",G]}))}),t.jsx("button",{className:"flex items-center justify-center",disabled:K<=1,onClick:()=>{P({...U,[s.name]:Math.max(0,A-g)}),n.push(N=>({...N,page:Math.max(1,K-1)}))},children:t.jsx(ge.ArrowLeftIcon,{className:R("inline",{"opacity-40":K<=1}),height:"1rem"})}),t.jsx("div",{className:"flex items-center space-x-1 overflow-hidden",children:[...new Array(le)].map((N,S)=>{const I=S+1;return le>6&&I!==1&&I!==le&&I!==K&&I!==K-1&&I!==K+1?I===K-2||I===K+2?t.jsx("div",{children:"..."},I):null:t.jsx("button",{className:R("rounded-md px-3 py-1 text-neutral-600 dark:text-neutral-300",I===K?"bg-neutral-200 dark:bg-neutral-700":"hover:bg-neutral-100 dark:hover:bg-neutral-800"),onClick:()=>{P({...U,[s.name]:S*g}),n.push(F=>({...F,page:I}))},disabled:I===K,children:I},I)})}),t.jsx("button",{className:"flex items-center justify-center",disabled:K>=le,onClick:()=>{P({...U,[s.name]:A+g}),n.push(N=>({...N,page:Math.min(le,K+1)}))},children:t.jsx(ge.ArrowRightIcon,{className:R("inline",{"opacity-40":K>=le}),height:"1rem"})}),We>0&&t.jsxs("div",{className:"flex items-center gap-2 pl-4",children:[t.jsxs(Lt,{open:Vr,onOpenChange:Ve,children:[t.jsx($t,{children:t.jsxs(H,{onClick:()=>{Ve(!0)},variant:"secondary",children:[t.jsx(V.ArrowUpOnSquareIcon,{width:14}),"Export (",We,")"]})}),t.jsxs(Mt,{className:"z-100",align:"end",side:"bottom",sideOffset:5,children:[t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);fn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.Table,{width:12}),Ee?"Download as CSV":"Copy as CSV"]}),t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);mn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.FileDown,{width:12}),Ee?"Download as Markdown":"Copy as Markdown"]}),t.jsxs(_e,{onSelect:N=>{N.preventDefault();const S=je(te,Ne);bn(S,Ge,s.name,Ee),Ve(!1)},className:"flex items-center gap-2",children:[t.jsx(ge.CurlyBraces,{width:12}),Ee?"Download as JSON":"Copy as JSON"]}),!Ee&&t.jsxs(t.Fragment,{children:[t.jsx(zt,{}),t.jsx(_e,{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(V.TrashIcon,{width:14}),"Delete Selected Rows"]})]}),t.jsx("div",{className:"grow"}),t.jsx("div",{className:"px-2",children:t.jsx(qa,{localDates:Se,setLocalDates:zr,visiblity:st})})]}),t.jsx(pe.DndContext,{collisionDetection:pe.closestCenter,modifiers:[sa.restrictToHorizontalAxis],onDragEnd:Yr,sensors:Kr,children:t.jsxs("div",{className:"relative flex-1 overflow-hidden bg-neutral-100 dark:bg-neutral-900/50",children:[!Vt&&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:Ht,display:Ht==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:Pt,display:Pt==0?"none":void 0}}),t.jsx("div",{ref:Pe,className:"h-full w-full overflow-auto",children:t.jsxs("div",{className:"flex w-max items-start",children:[t.jsxs("div",{style:{width:re.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:re.getHeaderGroups().map(N=>t.jsx("div",{className:"flex w-full",children:t.jsx(Ce.SortableContext,{items:He,strategy:Ce.horizontalListSortingStrategy,children:N.headers.map((S,I)=>t.jsx(Ma,{header:S,table:re,headerGroup:N,index:I,setMinViableColWidth:qr,onSort:(F,z,Y)=>{n.push(Q=>({...Q,sortAttr:F,sortAsc:z!==F?!0:!Y}))},currentSortAttr:i?.sortAttr,currentSortAsc:i?.sortAsc},S.id))})},N.id))}),t.jsx("div",{children:re.getRowModel().rows.map(N=>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:N.getVisibleCells().map(S=>t.jsx(Ce.SortableContext,{items:He,strategy:Ce.horizontalListSortingStrategy,children:t.jsx(za,{cell:S},S.id)},S.id))},N.id))})]}),Vt&&t.jsx("div",{className:"sticky top-0",children:t.jsx(nt,{className:"opacity-60",labelDirection:"bottom",label:"Fill Width",icon:t.jsx(ge.ArrowRightFromLine,{}),onClick:Gr})})]})})]})})]})]})};function wn(e,r){return fe.isObject(e)?JSON.stringify(e,null,r?2:void 0):String(e)}function vn({data:e,pretty:r}){const a=ie(),n=wn(e,r);return r&&fe.isObject(e)?t.jsx(mt,{darkMode:a.darkMode,code:n,language:"json"}):t.jsx(t.Fragment,{children:n})}async function kr(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 yn(e,r,a,n,o){const i={app_id:r,path:n||a.name,authorization:`Bearer ${e}`,"content-type":a.type};return await kr(`${o}/dash/apps/${r}/storage/upload`,{method:"PUT",headers:i,body:a})}async function kn(e,r,a,n){const{data:o}=await kr(`${n}/dash/apps/${r}/storage/files/delete`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({filenames:a})});return o}function jn(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 Sn=({namespaces:e,db:r})=>{const a=ie(),n=Qe(),o=Qe(),i=e.find(h=>h.id===a.explorerState?.namespace),[s,g]=b.useState(!1),c=b.useRef(null);jn(c,()=>{g(!1)}),b.useEffect(()=>{!i&&e.length>0&&a.setExplorerState({namespace:e[0].id})},[i,e,a]);const p=fr(a.appId);return t.jsxs("div",{className:R("relative flex w-full flex-1 overflow-hidden border-solid dark:bg-neutral-800",a.className),children:[t.jsx(he,{title:"Recently Deleted Namespaces",...n,children:t.jsx(ba,{appId:a.appId,db:r})}),t.jsx(he,{title:"New Namespace",...o,children:t.jsx(ya,{db:r,onClose:h=>{o.onClose(),h?.name&&a.setExplorerState({namespace:h.name})}})}),t.jsxs("div",{ref:c,className:R("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:!s}),children:[t.jsxs("div",{className:"flex items-center gap-1 text-sm font-semibold dark:text-white",children:[t.jsx(B.ChevronLeftIcon,{height:"1rem",className:"cursor-pointer md:hidden dark:text-white",onClick:()=>g(!1)}),"Namespaces"]}),e?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"overflow-x-hidden overflow-y-auto",children:e.length?t.jsx(At,{className:"text-sm",selectedId:a.explorerState?.namespace,items:e.map(h=>({id:h.id,label:h.name})),onChange:h=>{a.setExplorerState({namespace:h.id})}}):null}),t.jsxs(H,{variant:"secondary",size:"mini",className:"justify-center",onClick:o.onOpen,children:[t.jsx(B.PlusIcon,{height:"1rem"})," Create"]}),p.length?t.jsxs(H,{className:"justify-start gap-2 rounded-sm p-2",variant:"subtle",size:"nano",onClick:n.onOpen,children:[t.jsx("span",{className:"rounded-sm bg-gray-200 px-1",children:p.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((h,d)=>t.jsx("div",{className:"h-4 w-full rounded-md bg-neutral-300 dark:bg-neutral-700"},d))})]}),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:h=>{h.stopPropagation(),g(!0)},children:t.jsx(B.Bars3Icon,{height:"1rem",className:"dark:text-white"})})}),a.explorerState&&t.jsx(xn,{namespaces:e,db:r})]})},Nn=({appId:e,apiURI:r,websocketURI:a,adminToken:n})=>b.useMemo(()=>Ie.init({appId:e,apiURI:r,websocketURI:a,__adminToken:n,disableValidation:!0}),[e,r,a,n]);class En 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(V.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 Ct=b.createContext({props:null,history:{push:()=>{},pop:()=>{},items:[]}}),ie=()=>{const e=b.useContext(Ct);if(!e.props)throw new Error("useExplorerProps must be used within an Explorer component");return e.props},ut=()=>{const e=b.useContext(Ct);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}},jr=e=>e.explorerState!==void 0||e.setExplorerState!==void 0,Cn=(e,r,a)=>{const n=jr(e);return{...e,apiURI:e.apiURI||Jt.apiURI,websocketURI:e.websocketURI||Jt.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}},In=e=>{const[r,a]=b.useState(null),n=Cn(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:i}=n,[s,g]=b.useState([]),c=b.useCallback((x,w=!1)=>{g(y=>!w&&o?[...y,o]:y),i(x)},[o,i]),p=b.useCallback(()=>{g(x=>{if(x.length>0){const[w,...y]=x;return i(w),y}return x})},[i]),h=Nn({appId:n.appId,apiURI:n.apiURI,websocketURI:n.websocketURI,adminToken:n.adminToken}),d=b.useRef(!0),u=b.useRef(n.appId);b.useEffect(()=>{if(d.current){d.current=!1;return}u.current!==n.appId&&(u.current=n.appId,g([]),jr(e)||a(null))},[n.appId,e]);const l=Ta(h),f=b.useMemo(()=>({props:n,history:{push:c,pop:p,items:s}}),[n,c,p,s]),m=n.useShadowDOM?Sr:b.Fragment;return t.jsx(Ct.Provider,{value:f,children:t.jsx(m,{children:t.jsx(En,{children:t.jsx(Sn,{db:h,namespaces:l.namespaces||[]})})})})},It=b.createContext({shadowRoot:null,container:null,darkMode:!1});function rt(){return b.useContext(It).container}function pt(){return b.useContext(It).darkMode}const Sr=({children:e})=>{const r=b.useRef(null),a=b.useRef(null),[n,o]=b.useState(null),s=ie().darkMode;b.useEffect(()=>{if(r.current&&!n)try{const c=r.current.attachShadow({mode:"open"});a.current=c;const p=document.createElement("style");p.textContent=ha;const h=document.createElement("div");h.setAttribute("class",s?"h-full dark":"h-full"),c.appendChild(p),c.appendChild(h),o(h)}catch{}},[n]),b.useEffect(()=>{n&&n.setAttribute("class",s?"h-full dark":"h-full")},[s,n]);const g=b.useMemo(()=>({shadowRoot:a.current,container:n,darkMode:s}),[n,s]);return t.jsx("div",{ref:r,style:{height:"100%"},className:R("h-full"),children:t.jsx(It.Provider,{value:g,children:n?na.createPortal(e,n):null})})};function An({...e}){return t.jsx(se.Root,{"data-slot":"select",...e})}function Rn({...e}){return t.jsx(se.Value,{className:"content-[hi]","data-slot":"select-value",...e})}function Tn({className:e,size:r="default",children:a,...n}){return t.jsxs(se.Trigger,{"data-slot":"select-trigger","data-size":r,className:R("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(se.Icon,{asChild:!0,children:t.jsx(V.ChevronDownIcon,{width:14})})]})}function On({className:e,children:r,position:a="popper",...n}){const o=rt(),i=pt();return t.jsx(se.Portal,{container:o,children:t.jsxs(se.Content,{"data-slot":"select-content",className:R("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",i?"dark":"",e),position:a,...n,children:[t.jsx(Dn,{}),t.jsx(se.Viewport,{className:R("p-1",a==="popper"&&"h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"),children:r}),t.jsx(Fn,{})]})})}function _n({className:e,children:r,...a}){return t.jsxs(se.Item,{"data-slot":"select-item",className:R("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(se.ItemIndicator,{children:t.jsx(V.CheckIcon,{width:12,className:"size-4"})})}),t.jsx(se.ItemText,{children:r})]})}function Dn({className:e,...r}){return t.jsx(se.ScrollUpButton,{"data-slot":"select-scroll-up-button",className:R("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(V.ChevronUpIcon,{className:"size-4"})})}function Fn({className:e,...r}){return t.jsx(se.ScrollDownButton,{"data-slot":"select-scroll-down-button",className:R("flex cursor-default items-center justify-center py-1",e),...r,children:t.jsx(V.ChevronDownIcon,{className:"size-4"})})}/**
|
|
2
2
|
* Prism: Lightweight, robust, elegant syntax highlighting
|
|
3
3
|
*
|
|
4
4
|
* @license MIT <https://opensource.org/licenses/MIT>
|