UNPKG

bknd

Version:

Lightweight Firebase/Supabase alternative built to run anywhere — incl. Next.js, React Router, Astro, Cloudflare, Bun, Node, AWS Lambda & more.

2 lines (1 loc) 23.5 kB
import{u as ne,r as d,n as ae,M as le,a as re,j as e,S as q,B as ie,D as G,I as V,T as oe,b as ce,c as p,d as de,e as ue,f as me,t as F,g as xe,h as pe,G as v,L as w,i as Q,k as y,N as he,J as Y,l as b,m as fe,o as je,p as K,q as ge,A as be,s as ye,v as E,F as ve,w as X,x as we,y as C,z as S,C as Se,E as M,H as O,K as D,O as Ne,P as _,Q as J,R as Te,U as Ie,V as Ce,W as Oe,X as De,Y as $,Z as Ee,_ as Z,$ as ke,a0 as ee,a1 as Ae,a2 as L,a3 as Fe,a4 as Me,a5 as Je,a6 as $e,a7 as Le,a8 as Pe,a9 as qe,aa as H,ab as Ve,ac as ze,ad as Be,ae as Re,af as _e,ag as k,ah as He,ai as U,aj as te,ak as Ue,al as We,am as Ge,an as Qe,ao as Ye}from"./main-CLGi5LHT.js";import"./TextareaWidget-CZG2muYB.js";function Ke(s,t){return ne("(prefers-color-scheme: dark)",s==="dark",t)?"dark":"light"}function Xe(s=[]){const[t,n]=d.useState(s);return[t,{setState:n,append:(...i)=>n(o=>[...o,...i]),prepend:(...i)=>n(o=>[...i,...o]),insert:(i,...o)=>n(m=>[...m.slice(0,i),...o,...m.slice(i)]),pop:()=>n(i=>{const o=[...i];return o.pop(),o}),shift:()=>n(i=>{const o=[...i];return o.shift(),o}),apply:i=>n(o=>o.map((m,u)=>i(m,u))),applyWhere:(i,o)=>n(m=>m.map((u,g)=>i(u,g)?o(u,g):u)),remove:(...i)=>n(o=>o.filter((m,u)=>!i.includes(u))),reorder:({from:i,to:o})=>n(m=>{const u=[...m],g=m[i];return u.splice(i,1),u.splice(o,0,g),u}),swap:({from:i,to:o})=>n(m=>{const u=[...m],g=u[i],se=u[o];return u.splice(o,1,g),u.splice(i,1,se),u}),setItem:(i,o)=>n(m=>{const u=[...m];return u[i]=o,u}),setItemProp:(i,o,m)=>n(u=>{const g=[...u];return g[i]={...g[i],[o]:m},g}),filter:i=>{n(o=>o.filter(i))}}]}function W(s){const t=document.createElement("style");return t.setAttribute("data-mantine-styles","inline"),t.innerHTML="*, *::before, *::after {transition: none !important;}",t.setAttribute("data-mantine-disable-transition","true"),s&&t.setAttribute("nonce",s),document.head.appendChild(t),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(a=>a.remove())}function Ze({keepTransitions:s}={}){const t=d.useRef(ae),n=d.useRef(-1),a=d.useContext(le),l=re(),r=d.useRef(l==null?void 0:l());if(!a)throw new Error("[@mantine/core] MantineProvider was not found in tree");const c=f=>{a.setColorScheme(f),t.current=s?()=>{}:W(r.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var j;(j=t.current)==null||j.call(t)},10)},h=()=>{a.clearColorScheme(),t.current=s?()=>{}:W(r.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var f;(f=t.current)==null||f.call(t)},10)},N=Ke("light",{getInitialValueInEffect:!1}),T=a.colorScheme==="auto"?N:a.colorScheme,x=d.useCallback(()=>c(T==="light"?"dark":"light"),[c,T]);return d.useEffect(()=>()=>{var f;(f=t.current)==null||f.call(t),window.clearTimeout(n.current)},[]),{colorScheme:a.colorScheme,setColorScheme:c,clearColorScheme:h,toggleColorScheme:x}}const A=({title:s,open:t,toggle:n,ActiveIcon:a=xe,children:l,renderHeaderRight:r})=>e.jsxs("div",{style:{minHeight:49},className:F("flex flex-col flex-animate overflow-hidden",t?"flex-open border-b border-b-muted":"flex-initial cursor-pointer hover:bg-primary/5"),children:[e.jsxs("div",{className:F("flex flex-row border-muted border-b h-14 py-4 pr-4 pl-2 items-center gap-2"),onClick:n,children:[e.jsx(V,{Icon:t?a:pe,disabled:t}),e.jsx("h2",{className:"text-lg dark:font-bold font-semibold select-text",children:s}),e.jsx("div",{className:"flex flex-grow"}),r==null?void 0:r({open:t})]}),e.jsx("div",{className:F("overflow-y-scroll transition-all",t?" flex-grow":"h-0 opacity-0"),children:e.jsx("div",{className:"flex flex-col gap-5 p-4 ",children:l})})]});function et(){const[s,t]=d.useState("1");function n(a){return()=>t(a)}return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(q,{right:e.jsx(G,{items:[{label:"Settings"}],position:"bottom-end",children:e.jsx(V,{Icon:oe})}),className:"pl-3",children:e.jsx(ie,{path:[{label:"Schema",href:"/"},{label:"Quizzes"}],backTo:"/"})}),e.jsx(A,{title:"Fields",open:s==="1",toggle:n("1"),ActiveIcon:ce,renderHeaderRight:({open:a})=>a?e.jsx(p,{variant:"primary",disabled:!a,children:"Update"}):null}),e.jsx(A,{title:"Settings",open:s==="2",toggle:n("2"),ActiveIcon:de}),e.jsx(A,{title:"Relations",open:s==="3",toggle:n("3"),ActiveIcon:ue}),e.jsx(A,{title:"Indices",open:s==="4",toggle:n("4"),ActiveIcon:me})]})}function tt(){return e.jsxs("div",{className:"flex flex-col gap-3",children:["formy",e.jsxs(v,{children:[e.jsx(w,{children:"label"}),e.jsx(Q,{onCheckedChange:console.log})]}),e.jsxs(v,{children:[e.jsx(w,{children:"label"}),e.jsx(y,{})]})]})}function st(){const[s,t]=d.useState(),[n,a]=d.useState();return e.jsxs("div",{className:"flex flex-col p-3",children:[e.jsx("h1",{children:"html"}),e.jsxs(he,{className:"flex flex-col gap-3",validateOn:"change",onChange:t,onSubmit:l=>console.log("submit",l),onSubmitInvalid:l=>console.log("invalid",l),onError:a,reportValidity:!0,clean:!0,children:[e.jsx(y,{type:"text",name:"what",minLength:2,maxLength:5,required:!0}),e.jsx("div",{"data-role":"input-error","data-name":"what"}),e.jsx(y,{type:"number",name:"age",step:5,required:!0}),e.jsx(y,{type:"checkbox",name:"verified"}),e.jsx(y,{type:"text",name:"tag",minLength:1,required:!0}),e.jsx(y,{type:"number",name:"tag"}),e.jsx(p,{type:"submit",children:"submit"})]}),e.jsx(Y,{json:{data:s,errors:n},expand:9})]})}function nt(){return d.useEffect(()=>{const s=document.createElement("script");return s.src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js",s.crossOrigin="anonymous",s.async=!0,s.onload=()=>{window.SwaggerUIBundle&&(window.ui=window.SwaggerUIBundle({url:"http://localhost:28623/api/system/openapi.json",dom_id:"#swagger-ui"}))},document.body.appendChild(s),()=>{document.body.removeChild(s)}},[]),e.jsxs(e.Fragment,{children:[e.jsx("link",{rel:"stylesheet",href:"https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css"}),e.jsx(b,{children:e.jsx("div",{id:"swagger-ui"})})]})}function at(){const[s,t]=d.useState(""),{data:n,...a}=fe(r=>r.data.readOne("comments",1),{refine:r=>r.data,revalidateOnFocus:!0}),l=n||null;return d.useEffect(()=>{t((l==null?void 0:l.content)??"")},[l]),e.jsxs(b,{children:[e.jsx("pre",{children:JSON.stringify(a.key)}),a.error&&e.jsx("div",{children:"failed to load"}),a.isLoading&&e.jsx("div",{children:"loading..."}),n&&e.jsx("pre",{children:JSON.stringify(n,null,2)}),n&&e.jsxs("form",{onSubmit:async r=>{if(r.preventDefault(),!!l)return!1},children:[e.jsx("input",{type:"text",value:s,onChange:r=>t(r.target.value)}),e.jsx("button",{type:"submit",children:"submit"})]})]})}function lt(){return e.jsxs(b,{children:["asdf",e.jsx(ot,{}),e.jsx(it,{}),e.jsx(rt,{})]})}function rt(){const{mutate:s}=ge("comments"),{data:t,...n}=K("comments",void 0,{limit:2});return e.jsxs("div",{children:["bla",e.jsx("pre",{children:JSON.stringify(n.key)}),n.error&&e.jsx("div",{children:"failed to load"}),n.isLoading&&e.jsx("div",{children:"loading..."}),t&&e.jsx("pre",{children:JSON.stringify(t,null,2)}),t&&e.jsx("div",{children:t.map(a=>e.jsx("input",{type:"text",value:a.content,onChange:async l=>{await s(a.id,{content:l.target.value})},className:"border border-black"},String(a.id)))})]})}function it(){const{data:s,update:t,...n}=K("users",void 0,{sort:{by:"id",dir:"asc"},limit:3});return e.jsxs("div",{children:[e.jsx("pre",{children:JSON.stringify(n.key)}),n.error&&e.jsx("div",{children:"failed to load"}),n.isLoading&&e.jsx("div",{children:"loading..."}),s&&e.jsx("pre",{children:JSON.stringify(s,null,2)})]})}function ot(){const[s,t]=d.useState(),{read:n}=je("comments");return d.useEffect(()=>{n().then(a=>t(a))},[]),e.jsx("pre",{children:JSON.stringify(s,null,2)})}function ct(){const s=new be().getSchema(),[t,n]=d.useState(ye(s,{}));return e.jsxs(b,{children:[e.jsx("div",{className:"flex flex-col p-3",children:e.jsx(E,{schema:s,onChange:n,className:"legacy hide-required-mark"})}),e.jsx(Y,{json:t,expand:9})]})}function dt({task:s,onChange:t,...n}){const a=s.constructor.schema,l=s.params;return Object.fromEntries(Object.keys(a.properties).map(r=>[r,{"ui:field":"template","ui:fieldReplacesAnyOrOneOf":!0}])),e.jsx(E,{className:"legacy",schema:a,onChange:t,formData:l,...n})}function ut(){const[s,t]=d.useState(null),n=new ve("Fetch Something",{url:"https://jsonplaceholder.typicode.com/todos/1",method:"{{ input.mode }}"});return e.jsxs("div",{className:"flex flex-col p-3",children:[e.jsx(dt,{task:n,onChange:t}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})}function mt(){const[s,{open:t,close:n}]=X(!0);return e.jsxs("div",{className:"flex flex-col w-full h-full justify-center items-center",children:[e.jsx("button",{onClick:t,children:"Open"}),e.jsx(we,{open:s,onClose:n,children:e.jsxs("div",{className:"border-blue-500 border-2 p-10",children:["Modal content ",e.jsx("button",{onClick:n,children:"close"})]})})]})}const xt={definitions:{primitive:{anyOf:[{title:"String",type:"string"},{title:"Number",type:"number"},{title:"Boolean",type:"boolean"}]},numeric:{anyOf:[{title:"Number",type:"number"},{title:"Datetime",type:"string",format:"date-time"},{title:"Date",type:"string",format:"date"},{title:"Time",type:"string",format:"time"}]},boolean:{title:"Boolean",type:"boolean"}},type:"object",properties:{operand:{enum:["$and","$or"],default:"$and",type:"string"},conditions:{type:"array",items:{type:"object",properties:{operand:{enum:["$and","$or"],default:"$and",type:"string"},key:{type:"string"},operator:{type:"array",items:{anyOf:[{title:"Equals",type:"object",properties:{$eq:{$ref:"#/definitions/primitive"}},required:["$eq"]},{title:"Lower than",type:"object",properties:{$lt:{$ref:"#/definitions/numeric"}},required:["$lt"]},{title:"Greather than",type:"object",properties:{$gt:{$ref:"#/definitions/numeric"}},required:["$gt"]},{title:"Between",type:"object",properties:{$between:{type:"array",items:{$ref:"#/definitions/numeric"},minItems:2,maxItems:2}},required:["$between"]},{title:"In",type:"object",properties:{$in:{type:"array",items:{$ref:"#/definitions/primitive"},minItems:1}}}]},minItems:1}},required:["key","operator"]},minItems:1}},required:["operand","conditions"]};function pt(){const[s,t]=d.useState(null);return e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col gap-3 p-3",children:[e.jsx(E,{schema:xt,onChange:t}),e.jsx("pre",{children:JSON.stringify(s,null,2)})]})})}function ht(){return e.jsx("div",{className:"flex flex-col w-full h-full justify-center items-center",children:e.jsx(G,{items:[{label:"Item 1",value:"item1"},{label:"Item 2",value:"item2"},{label:"Item 3",value:"item3"}],children:e.jsx("button",{children:"Dropdown"})})})}function ft(){return e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col w-full h-full p-4 gap-4",children:[e.jsxs("div",{children:[e.jsx("b",{children:"Dropzone User Avatar 1 (overwrite)"}),e.jsx(C.Dropzone,{entity:{name:"models",id:38,field:"inputs"},maxItems:6,autoUpload:!1})]}),e.jsxs("div",{children:[e.jsx("b",{children:"Dropzone User Avatar 1 (overwrite)"}),e.jsx(C.Dropzone,{entity:{name:"models",id:38,field:"outputs"},maxItems:6,autoUpload:!1,children:e.jsx(jt,{})})]})]})})}function jt(){const{wrapperRef:s,inputProps:t,showPlaceholder:n,actions:{openFileInput:a}}=C.useDropzone(),{isOver:l,isOverAccepted:r,files:c}=C.useDropzoneState();return e.jsxs("div",{ref:s,className:"size-32 rounded-full border border-gray-200 flex justify-center items-center leading-none overflow-hidden",children:[e.jsx("div",{className:"hidden",children:e.jsx("input",{...t})}),e.jsx("span",{children:"asdf"}),n&&e.jsx(e.Fragment,{children:l&&r?"let it drop":"drop here"}),c.map(h=>e.jsx(C.Preview,{file:h,className:"object-cover w-full h-full",onClick:a},h.path))]})}function gt(){return e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col justify-center p-4 w-full h-full items-center gap-10",children:[e.jsx(bt,{}),e.jsx(vt,{}),e.jsx(yt,{})]})})}const z=({Icon:s,iconProps:t,rightSection:n,initialValue:a,onChange:l})=>e.jsxs(S.Header,{className:"justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-row flex-grow gap-1 items-center",children:[e.jsx(s,{width:16,height:16,...t??{}}),e.jsx("input",{type:"text",value:a,onChange:l||(()=>{}),className:"font-mono font-semibold bg-transparent w-full rounded-lg outline-none pl-1.5 hover:bg-background/30 transition-colors focus:bg-background/60"})]}),e.jsx("div",{children:e.jsx(V,{Icon:Ee,size:"sm"})})]}),bt=()=>e.jsxs(S,{className:"w-96",children:[e.jsx(z,{Icon:Se,initialValue:"test_flow"}),e.jsxs(S.Content,{className:"gap-3",children:[e.jsxs("div",{className:"flex flex-row justify-between items-center",children:[e.jsx(M,{label:"Trigger Type",defaultValue:"manual",data:[{label:"Manual",value:"manual"},{label:"HTTP",value:"http"},{label:"Event",value:"event",disabled:!0}]}),e.jsx(M,{label:"Execution Mode",defaultValue:"async",data:[{label:"Async",value:"async"},{label:"Sync",value:"sync"}]})]}),e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsx(O,{className:"w-36",label:"Method",defaultValue:"GET",data:["GET","POST","PATCH","PUT","DEL"]}),e.jsx(D,{className:"w-full",label:"Mapping Path",placeholder:"/trigger_http",classNames:{wrapper:"font-mono pt-px"}})]}),e.jsx("div",{className:"flex flex-row gap-2 items-center",children:e.jsx(M,{className:"w-full",label:"Response Type",defaultValue:"json",data:[{label:"JSON",value:"json"},{label:"HTML",value:"html"},{label:"Text",value:"text"}]})})]})]}),yt=()=>{const[s,t]=Ie([!0,!1]);return e.jsxs(S,{className:"w-[400px]",children:[e.jsx(z,{Icon:Ce,initialValue:"fetch_something"}),e.jsxs(S.Content,{className:"gap-3",children:[e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsx(O,{className:"w-36",label:"Method",defaultValue:"GET",data:["GET","POST","PATCH","PUT","DEL"]}),e.jsx(D,{className:"w-full",label:"Mapping Path",placeholder:"/trigger_http",classNames:{wrapper:"font-mono pt-px"}})]}),e.jsx(p,{onClick:t,className:"justify-center",size:"small",variant:"ghost",iconSize:14,IconLeft:s?Oe:De,children:"More options"}),s&&e.jsxs(e.Fragment,{children:[e.jsx($,{label:"URL query"}),e.jsx($,{label:"Headers"}),e.jsx("div",{className:"flex flex-row gap-2 items-center",children:e.jsxs(J.Wrapper,{className:"w-full",children:[e.jsx(J.Label,{children:"Body"}),e.jsx(M,{data:["None","Form","JSON"],defaultValue:"JSON"}),e.jsx($,{label:""})]})})]})]})]})},vt=()=>e.jsxs(S,{className:"w-[400px]",children:[e.jsx(z,{Icon:Ne,initialValue:"query_multiple"}),e.jsxs(S.Content,{className:"gap-3",children:[e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsx(O,{className:"w-6/12",label:"Entity",placeholder:"Select entity",data:["users","posts","comments"]}),e.jsx(O,{className:"w-4/12",label:"Sort by",data:["id","title","username"],defaultValue:"id"}),e.jsx(O,{className:"w-2/12",label:"Sort dir",data:["asc","desc"],defaultValue:"asc"})]}),e.jsx(_,{label:"Select properties",data:["id","title","username"],placeholder:"All selected"}),e.jsx(_,{label:"Embed relations",data:["posts","comments"],placeholder:"None selected"}),e.jsxs(J.Wrapper,{className:"w-full",children:[e.jsx(J.Label,{children:"Where object"}),e.jsx("div",{className:"text-sm placeholder:text-slate-400 placeholder:opacity-80",children:e.jsx(Te,{basicSetup:{lineNumbers:!1,foldGutter:!1}})})]})]})]}),wt={debug:!0};function St(){const{schema:s,config:t}=Z(),n=JSON.parse(JSON.stringify(s));return t.media.storage.body_max_size=1,n.media.properties.storage.properties.body_max_size.minimum=0,n.media.if={properties:{enabled:{const:!0}}},n.media.then={required:["adapter"]},e.jsx(b,{children:e.jsx("div",{className:"flex flex-col p-3",children:e.jsx(ke,{schema:s.auth.toJSON(),options:wt})})})}function Nt(){const s={type:"object",properties:{name:{type:"string",title:"Name",minLength:3},variants:{anyOf:[{type:"string"},{type:"number"}]}}},t=d.useRef(null);function n(){var a,l;console.log("submit",(a=t.current)==null?void 0:a.formData()),console.log("isvalid",(l=t.current)==null?void 0:l.validateForm())}return e.jsxs(e.Fragment,{children:[e.jsx(q,{right:e.jsx(p,{type:"button",variant:"primary",onClick:n,children:"Submit"}),children:"JSON Schema"}),e.jsx("div",{children:e.jsxs("div",{className:"flex flex-grow flex-col gap-3 p-3",children:[e.jsxs(v,{children:[e.jsx(w,{htmlFor:"name",children:"Name"}),e.jsx(y,{id:"name",name:"name"})]}),e.jsx(v,{children:e.jsx(E,{ref:t,schema:s})}),e.jsxs(v,{children:[e.jsx(w,{htmlFor:"name",children:"Options"}),e.jsx(ee,{id:"options",name:"options"})]})]})})]})}function Tt(){return e.jsxs("div",{className:"flex flex-col p-4 gap-3",children:[e.jsx("h1",{children:"LiquidJsTest"}),e.jsx(Ae,{}),e.jsx(D,{}),e.jsx(y,{})]})}function It(){return e.jsxs("div",{className:"p-4 flex flex-col gap-2 items-start",children:[e.jsx("h1",{children:"mantine"}),e.jsxs("div",{className:"flex flex-row gap-2 justify-center content-center items-center",children:[e.jsx(L,{color:"blue",children:"Mantine"}),e.jsx(p,{children:"Button"}),e.jsx(p,{variant:"primary",children:"Button"}),e.jsx(L,{onClick:()=>{Fe.show({title:"Notification",message:"This is a notification",autoClose:!1,color:"blue"})},children:"Notification"})]}),e.jsx(Ct,{}),e.jsx(Ot,{}),e.jsx(Me,{defaultChecked:!0,label:"I agree to sell my privacy"})]})}function Ct(){const[s,{open:t,close:n}]=X(!1);return e.jsxs(e.Fragment,{children:[e.jsx(Je,{opened:s,onClose:n,title:"Authentication",children:e.jsx("div",{children:"Modal content"})}),e.jsx(L,{onClick:t,children:"Open modal"})]})}function Ot(){const{colorScheme:s}=Ze();return e.jsx($e,{label:"Tooltip",children:e.jsxs("span",{children:["Hover me (",s,")"]})})}const Dt=qe({example:H().optional(),exampleRequired:H({minLength:2})});function Et(){var r;const{register:s,handleSubmit:t,watch:n,formState:{errors:a}}=Le({resolver:Pe(Dt)});n();const l=c=>console.log(c);return console.log(n("example")),console.log("errors",a),e.jsxs("form",{onSubmit:t(l),children:[e.jsx(D,{defaultValue:"test",...s("example")}),e.jsx(D,{...s("exampleRequired"),error:(r=a.exampleRequired)==null?void 0:r.message}),e.jsx("div",{children:e.jsx("input",{type:"submit"})}),e.jsx("div",{children:Object.entries(a).map(([c,h])=>e.jsxs("p",{children:[c,": ",h.message]},c))})]})}const kt=[{id:"1",position:{x:0,y:0},data:{label:"1"}},{id:"2",position:{x:0,y:100},data:{label:"2"}}],At=[{id:"e1-2",source:"1",target:"2"}];function Ft(){return e.jsx("div",{style:{width:"100vw",height:"100vh"},children:e.jsx(Ve,{nodes:kt,edges:At})})}const Mt={auth:{jwt:{basepath:{"ui:options":{label:!1}},fields:{"ui:options":{label:!1,orderable:!1}}},strategies:{additionalProperties:{"ui:widget":"select",type:{"ui:widget":"hidden"}},type:{"ui:widget":"hidden"}}},server:{cors:{allow_methods:{"ui:widget":"checkboxes"},allow_headers:{"ui:options":{orderable:!1}}}},media:{adapter:{"ui:options":{label:!1},type:{"ui:widget":"hidden"}}}};function Jt(){const{app:s,schema:t}=Z(),n=["auth","server","media","data"],[a,l]=d.useState(n[0]);if(console.log("schema",t,s.config),!t)return;const r={key:a,schema:t[a],uiSchema:Mt[a]||{},config:s.config[a]};return console.log("current",r),e.jsx(b,{children:e.jsxs("div",{className:"flex flex-col gap-2 p-3",children:[e.jsx("div",{className:"flex flex-row gap-2",children:n.map(c=>e.jsx("button",{role:"button",className:F("flex py-2 px-3",c===a&&"bg-primary/5"),onClick:()=>l(c),children:c},c))}),e.jsx(E,{schema:r.schema,formData:r.config,uiSchema:r.uiSchema,onChange:console.log,className:"legacy"})]})})}function $t(){return e.jsxs("div",{children:["sortable",e.jsx("div",{className:"p-4",children:e.jsx(Lt,{data:[{id:"C",name:"Carbon"},{id:"N",name:"Nitrogen"},{id:"Y",name:"Yttrium"},{id:"Ba",name:"Barium"},{id:"Ce",name:"Cerium"}],onReordered:(...s)=>console.log("reordered",s),onChange:s=>console.log("changed",s)})})]})}function Lt({data:s=[],extractId:t,renderItem:n,dndProps:a={droppableId:"sortable-list",direction:"vertical"},onReordered:l,onChange:r}){const[c,h]=Xe(s);function N({destination:x,source:f}){const j={from:f.index,to:(x==null?void 0:x.index)||0};h.reorder(j),l==null||l(j.from,j.to)}d.useEffect(()=>{r==null||r(c)},[c]);const T=c.map((x,f)=>{const j=t?t(x):d.useId();return e.jsx(ze,{index:f,draggableId:j,children:(I,B,R)=>n?n({...x,dnd:{provided:I,snapshot:B,rubic:R}}):e.jsxs("div",{className:"flex flex-row gap-2 p-2 border border-gray-200 rounded-md mb-3 bg-white items-center",ref:I.innerRef,...I.draggableProps,children:[e.jsx("div",{...I.dragHandleProps,children:e.jsx(Be,{className:"size-5",stroke:1.5})}),e.jsx("p",{children:JSON.stringify(x)})]})},j)});return e.jsx(Re,{onDragEnd:N,children:e.jsx(_e,{...a,children:x=>e.jsxs("div",{...x.droppableProps,ref:x.innerRef,children:[T,x.placeholder]})})})}function Pt(){const[s,t]=d.useState([]),[n,a]=d.useState(!1);async function l(){if(n)return;t([]),a(!0);const r=new EventSource("/api/system/test/sql");r.onmessage=c=>{if(c.data==="[DONE]"){a(!1),r.close();return}const h=JSON.parse(c.data);t(N=>[...N,h]),console.log("data",h)}}return e.jsxs("div",{className:"flex flex-col gap-2 p-4",children:[e.jsx("h1",{children:"ai sql test"}),e.jsx("button",{onClick:l,children:n?"...":"start"}),e.jsx("div",{children:s.map((r,c)=>e.jsx("span",{children:r.response},c))})]})}function qt(){return e.jsxs("div",{className:"flex flex-col p-3 gap-4",children:[e.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[e.jsx(p,{size:"small",children:"Small"}),e.jsx(p,{children:"Default"}),e.jsx(p,{variant:"primary",children:"Primary"}),e.jsx(p,{variant:"ghost",children:"Ghost"}),e.jsx(p,{variant:"outline",children:"Outline"}),e.jsx(p,{variant:"red",children:"Red"}),e.jsx(p,{variant:"subtlered",children:"Subtlered"}),e.jsx(p,{size:"large",children:"Large"})]}),e.jsxs("div",{className:"flex flex-row gap-1",children:[e.jsx(k.Exception,{title:"Exception",children:"Alert.Exception"}),e.jsx(k.Info,{title:"Info",children:"Alert.Info"}),e.jsx(k.Success,{title:"Success",children:"Alert.Success"}),e.jsx(k.Warning,{title:"Warning",children:"Alert.Warning"})]}),e.jsxs("div",{className:"flex flex-row gap-3 items-start",children:[e.jsxs(v,{children:[e.jsx(w,{children:"Input"}),e.jsx(y,{placeholder:"Input"})]}),e.jsxs(v,{children:[e.jsx(w,{children:"Checkbox"}),e.jsx(He,{})]}),e.jsxs(v,{children:[e.jsx(w,{children:"Switch"}),e.jsx(Q,{})]}),e.jsxs(v,{children:[e.jsx(w,{children:"Select"}),e.jsxs(ee,{children:[e.jsx("option",{value:""}),e.jsx("option",{value:"1",children:"Option 1"}),e.jsx("option",{value:"2",children:"Option 2"})]})]})]})]})}const P={DropdownTest:ht,Themes:qt,ModalTest:mt,JsonFormTest:Nt,FlowFormTest:ut,QueryJsonFormTest:pt,FlowCreateSchemaTest:ct,ReactFlowTest:Ft,SchemaTest:Jt,MantineTest:It,LiquidJsTest:Tt,SqlAiTest:Pt,SortableTest:$t,ReactHookErrors:Et,FlowsTest:gt,AppShellAccordionsTest:et,SwaggerTest:nt,SWRAndAPI:at,SwrAndDataApi:lt,DropzoneElementTest:ft,JsonSchemaForm3:St,FormyTest:tt,HtmlFormTest:st};function _t(){return e.jsxs(zt,{children:[e.jsx(U,{path:"/",component:()=>e.jsx(te,{title:"Test",description:"Select one."})}),e.jsx(U,{path:"/:test",component:Vt})]})}function Vt(){const s=Ye();if(!s.test||!(s.test in P))return e.jsx(te,{title:"Test not found"});const t=P[s.test];return e.jsx(t,{})}function zt({children:s}){return e.jsxs(e.Fragment,{children:[e.jsxs(Ue,{children:[e.jsx(q,{children:"Tests"}),e.jsx(b,{initialOffset:96,children:e.jsx("div",{className:"flex flex-col flex-grow p-3 gap-3",children:e.jsx("nav",{className:"flex flex-col flex-1 gap-1",children:Object.entries(P).map(([t,n])=>e.jsx(We,{as:Ge,href:`/${t}`,children:t},t))})})})]}),e.jsx(Qe,{children:s})]})}export{_t as default};