json-schema-builder-react 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),y=require("react"),be=require("@radix-ui/react-slot"),le=require("class-variance-authority"),Ne=require("clsx"),we=require("tailwind-merge"),f=require("lucide-react"),Ce=require("@radix-ui/react-tooltip"),ke=require("@radix-ui/react-select"),Se=require("@radix-ui/react-dialog"),Ie=require("@radix-ui/react-label"),Te=require("@radix-ui/react-checkbox");function z(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(a,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return a.default=t,Object.freeze(a)}const v=z(y),F=z(Ce),w=z(ke),P=z(Se),de=z(Ie),X=z(Te);function x(...t){return we.twMerge(Ne.clsx(t))}const De=le.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=v.forwardRef(({className:t,variant:a,size:s,asChild:n=!1,...i},r)=>{const l=n?be.Slot:"button";return e.jsx(l,{className:x(De({variant:a,size:s,className:t})),ref:r,...i})});T.displayName="Button";const q=v.forwardRef(({className:t,type:a,...s},n)=>e.jsx("input",{type:a,className:x("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...s}));q.displayName="Input";const qe=F.Provider,Re=F.Root,Ee=F.Trigger,oe=v.forwardRef(({className:t,sideOffset:a=4,...s},n)=>e.jsx(F.Portal,{children:e.jsx(F.Content,{ref:n,sideOffset:a,className:x("z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",t),...s})}));oe.displayName=F.Content.displayName;const G=w.Root,Q=w.Value,J=v.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(w.Trigger,{ref:n,className:x("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...s,children:[a,e.jsx(w.Icon,{asChild:!0,children:e.jsx(f.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));J.displayName=w.Trigger.displayName;const ce=v.forwardRef(({className:t,...a},s)=>e.jsx(w.ScrollUpButton,{ref:s,className:x("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronUp,{className:"h-4 w-4"})}));ce.displayName=w.ScrollUpButton.displayName;const me=v.forwardRef(({className:t,...a},s)=>e.jsx(w.ScrollDownButton,{ref:s,className:x("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronDown,{className:"h-4 w-4"})}));me.displayName=w.ScrollDownButton.displayName;const V=v.forwardRef(({className:t,children:a,position:s="popper",...n},i)=>e.jsx(w.Portal,{children:e.jsxs(w.Content,{ref:i,className:x("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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 origin-[--radix-select-content-transform-origin]",s==="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",t),position:s,...n,children:[e.jsx(ce,{}),e.jsx(w.Viewport,{className:x("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),e.jsx(me,{})]})}));V.displayName=w.Content.displayName;const Pe=v.forwardRef(({className:t,...a},s)=>e.jsx(w.Label,{ref:s,className:x("px-2 py-1.5 text-sm font-semibold",t),...a}));Pe.displayName=w.Label.displayName;const I=v.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(w.Item,{ref:n,className:x("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(w.ItemIndicator,{children:e.jsx(f.Check,{className:"h-4 w-4"})})}),e.jsx(w.ItemText,{children:a})]}));I.displayName=w.Item.displayName;const Le=v.forwardRef(({className:t,...a},s)=>e.jsx(w.Separator,{ref:s,className:x("-mx-1 my-1 h-px bg-muted",t),...a}));Le.displayName=w.Separator.displayName;const Oe=P.Root,Fe=P.Portal,ue=v.forwardRef(({className:t,...a},s)=>e.jsx(P.Overlay,{ref:s,className:x("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a}));ue.displayName=P.Overlay.displayName;const he=v.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(Fe,{children:[e.jsx(ue,{}),e.jsxs(P.Content,{ref:n,className:x("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s,children:[a,e.jsxs(P.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(f.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));he.displayName=P.Content.displayName;const xe=({className:t,...a})=>e.jsx("div",{className:x("flex flex-col space-y-1.5 text-center sm:text-left",t),...a});xe.displayName="DialogHeader";const fe=({className:t,...a})=>e.jsx("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});fe.displayName="DialogFooter";const pe=v.forwardRef(({className:t,...a},s)=>e.jsx(P.Title,{ref:s,className:x("text-lg font-semibold leading-none tracking-tight",t),...a}));pe.displayName=P.Title.displayName;const ze=v.forwardRef(({className:t,...a},s)=>e.jsx(P.Description,{ref:s,className:x("text-sm text-muted-foreground",t),...a}));ze.displayName=P.Description.displayName;const Be=le.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),N=v.forwardRef(({className:t,...a},s)=>e.jsx(de.Root,{ref:s,className:x(Be(),t),...a}));N.displayName=de.Root.displayName;const W=v.forwardRef(({className:t,...a},s)=>e.jsx(X.Root,{ref:s,className:x("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...a,children:e.jsx(X.Indicator,{className:x("grid place-content-center text-current"),children:e.jsx(f.Check,{className:"h-4 w-4"})})}));W.displayName=X.Root.displayName;const se=v.forwardRef(({className:t,...a},s)=>e.jsx("textarea",{className:x("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...a}));se.displayName="Textarea";const Ae=t=>t.trim().toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g,"_"),Me=(t,a,s=!1,n=!1)=>{const i=(u,g)=>{a({...t,[u]:g})};return{handleTitleChange:u=>{i("title",u)},handleTitleBlur:()=>{if(s&&t.title){const u=Ae(t.title);i("key",u)}},handleKeyChange:u=>{(s||n)&&i("key",u)},handleFieldChange:i,handleConstraintChange:(u,g)=>{a({...t,[u]:g})}}},Y={string:"String",number:"Number",integer:"Integer",boolean:"Boolean",object:"Object",array:"Array",null:"Null",file:"File"},M={getTypeLabel:t=>Y[t],typeLabels:Y,propertyLabel:{singular:"property",plural:"properties"},showRegex:!1,keyEditable:!1,readonly:!1},ge=y.createContext(M);function _e({children:t,config:a={}}){const s={...Y,...a.typeLabels},n=a.propertyLabel||M.propertyLabel,i=a.showRegex??M.showRegex,r=a.keyEditable??M.keyEditable,l=a.readonly??M.readonly,o=C=>s[C]||C;return e.jsx(ge.Provider,{value:{getTypeLabel:o,typeLabels:s,propertyLabel:n,showRegex:i,keyEditable:r,readonly:l},children:t})}function je(){return y.useContext(ge)}function H({property:t,open:a,onOpenChange:s,onSave:n,isArrayItem:i=!1,isNewProperty:r=!1,propertyLabel:l,showRegex:o,keyEditable:C,typeLabels:u}){const g=je(),h=u||g.typeLabels,j=l||g.propertyLabel,b=o??g.showRegex,c=C??g.keyEditable,[d,k]=y.useState(t);y.useEffect(()=>{a&&k(t)},[t,a]);const{handleTitleChange:E,handleTitleBlur:O,handleKeyChange:D,handleFieldChange:p,handleConstraintChange:R}=Me(d,k,r,c),L=()=>{d.title?.trim()&&(n(d),s(!1))},U=()=>{k(t),s(!1)};return e.jsx(Oe,{open:a,onOpenChange:s,children:e.jsxs(he,{className:"max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0","data-testid":"dialog-edit-property",children:[e.jsx(xe,{className:"px-6 pt-6 pb-4 shrink-0",children:e.jsx(pe,{children:r?`Add ${j.singular}`:`Edit ${j.singular}`})}),e.jsxs("div",{className:"space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Type"]}),e.jsxs(G,{value:d.type,onValueChange:m=>p("type",m),"data-testid":"select-type-dialog",children:[e.jsx(J,{children:e.jsx(Q,{})}),e.jsxs(V,{children:[e.jsx(I,{value:"string",children:h.string}),e.jsx(I,{value:"number",children:h.number}),e.jsx(I,{value:"integer",children:h.integer}),e.jsx(I,{value:"boolean",children:h.boolean}),e.jsx(I,{value:"object",children:h.object}),e.jsx(I,{value:"array",children:h.array}),e.jsx(I,{value:"file",children:h.file}),e.jsx(I,{value:"null",children:h.null})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Title"]}),e.jsx(q,{value:d.title||"",onChange:m=>E(m.target.value),onBlur:O,placeholder:"Property Title","data-testid":"input-title-dialog",required:!0}),!r&&d.key&&e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Key: ",d.key]})]}),(r||c)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Key"}),e.jsx(q,{value:d.key,onChange:m=>D(m.target.value),placeholder:"property_key","data-testid":"input-key-dialog"}),!r&&e.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-500",children:"⚠️ Changing the key may break existing references to this property"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Description"}),e.jsx(se,{placeholder:"Optional description",value:d.description||"",onChange:m=>p("description",m.target.value),rows:2,"data-testid":"input-edit-description"})]}),d.type==="array"&&e.jsxs("div",{className:"space-y-2 border-l-2 border-border pl-4 mt-2",children:[e.jsxs(N,{className:"font-semibold text-xs text-muted-foreground",children:[h.array," Items"]}),d.items?e.jsxs("div",{className:"bg-muted/40 p-2 rounded",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Item Type"}),e.jsxs(G,{value:d.items.type,onValueChange:m=>k({...d,items:{...d.items,type:m}}),children:[e.jsx(J,{children:e.jsx(Q,{})}),e.jsxs(V,{children:[e.jsx(I,{value:"string",children:h.string}),e.jsx(I,{value:"number",children:h.number}),e.jsx(I,{value:"integer",children:h.integer}),e.jsx(I,{value:"boolean",children:h.boolean}),e.jsx(I,{value:"object",children:h.object}),e.jsx(I,{value:"array",children:h.array}),e.jsx(I,{value:"file",children:h.file}),e.jsx(I,{value:"null",children:h.null})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Item Title"}),e.jsx(q,{value:d.items.title||"",onChange:m=>k({...d,items:{...d.items,title:m.target.value}}),placeholder:"Item Title"})]}),e.jsxs(T,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>k({...d,items:void 0}),children:["Remove ",h.array," Item Schema"]})]}):e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{k({...d,items:{id:Date.now().toString()+Math.random(),key:"item",type:"string",required:!1}})},children:["Add ",h.array," Item Schema"]})]}),!i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{id:"prop-required",checked:d.required,onCheckedChange:m=>p("required",m),"data-testid":"checkbox-edit-required"}),e.jsx(N,{htmlFor:"prop-required",className:"cursor-pointer",children:"Required field"})]}),d.type==="string"&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsxs("h4",{className:"text-sm font-medium inline",children:[h.string," Constraints"]})}),e.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"min-length",children:"Minimum Length"}),e.jsx(q,{id:"min-length",type:"number",placeholder:"0",value:d.minLength||"",onChange:m=>R("minLength",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-minlength"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"max-length",children:"Maximum Length"}),e.jsx(q,{id:"max-length",type:"number",placeholder:"∞",value:d.maxLength||"",onChange:m=>R("maxLength",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-maxlength"})]})]}),b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"pattern",children:"Pattern (regex)"}),e.jsx(q,{id:"pattern",placeholder:"^[a-z]+$",value:d.pattern||"",onChange:m=>R("pattern",m.target.value),className:"font-mono text-sm","data-testid":"input-edit-pattern"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Enum Values"}),e.jsx("div",{className:"space-y-2",children:[...d.enum||[],""].map((m,S)=>e.jsx(q,{placeholder:S===(d.enum?.length||0)?"Add new value...":"Enum value",value:m,onChange:B=>{const _=B.target.value,$=d.enum||[];if(S===$.length)_.trim()&&R("enum",[...$,_.trim()]);else if(_.trim()){const A=[...$];A[S]=_.trim(),R("enum",A)}else{const A=$.filter((st,ve)=>ve!==S);R("enum",A.length>0?A:void 0)}},"data-testid":`input-edit-enum-${S}`},S))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter allowed values (empty fields will be removed)"})]})]})]}),(d.type==="number"||d.type==="integer")&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsx("h4",{className:"text-sm font-medium inline",children:"Numeric Constraints"})}),e.jsx("div",{className:"space-y-4 p-4 pt-0",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"minimum",children:"Minimum Value"}),e.jsx(q,{id:"minimum",type:"number",placeholder:"-∞",value:d.minimum??"",onChange:m=>R("minimum",m.target.value?parseFloat(m.target.value):void 0),"data-testid":"input-edit-minimum"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"maximum",children:"Maximum Value"}),e.jsx(q,{id:"maximum",type:"number",placeholder:"∞",value:d.maximum??"",onChange:m=>R("maximum",m.target.value?parseFloat(m.target.value):void 0),"data-testid":"input-edit-maximum"})]})]})})]}),d.type==="array"&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsxs("h4",{className:"text-sm font-medium inline",children:[h.array," Constraints"]})}),e.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"min-items",children:"Minimum Items"}),e.jsx(q,{id:"min-items",type:"number",placeholder:"0",value:d.minItems||"",onChange:m=>R("minItems",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-minitems"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"max-items",children:"Maximum Items"}),e.jsx(q,{id:"max-items",type:"number",placeholder:"∞",value:d.maxItems||"",onChange:m=>R("maxItems",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-maxitems"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{id:"unique-items",checked:d.uniqueItems||!1,onCheckedChange:m=>R("uniqueItems",m),"data-testid":"checkbox-edit-unique"}),e.jsx(N,{htmlFor:"unique-items",className:"cursor-pointer",children:"All items must be unique"})]})]})]})]}),e.jsxs(fe,{className:"px-6 py-4 border-t bg-background shrink-0",children:[e.jsx(T,{variant:"outline",onClick:U,"data-testid":"button-cancel",children:"Cancel"}),e.jsx(T,{onClick:L,"data-testid":"button-save",disabled:!d.title?.trim(),children:"Save Changes"})]})]})})}function re(t,a,s={}){const{allowEmpty:n=!1,onEditStart:i,onEditCancel:r}=s,[l,o]=y.useState(!1),[C,u]=y.useState(t);y.useEffect(()=>{l||u(t)},[t,l]);const g=()=>{u(t),o(!0),i?.()},h=c=>{u(c)},j=()=>{const c=C.trim();if(!n&&!c){u(t),o(!1);return}c!==t&&a(c),o(!1)};return{isEditing:l,value:C,startEdit:g,handleChange:h,handleBlur:j,handleKeyDown:c=>{c.key==="Enter"?j():c.key==="Escape"&&(u(t),o(!1),r?.())}}}function $e(t,a){const[s,n]=y.useState(!1);return{isChangingType:s,setIsChangingType:n,handleTypeChange:l=>{const o={...t,type:l};l!=="string"&&(delete o.minLength,delete o.maxLength,delete o.pattern,delete o.enum),l!=="number"&&l!=="integer"&&(delete o.minimum,delete o.maximum),l!=="array"&&(delete o.minItems,delete o.maxItems,delete o.uniqueItems,delete o.items),l!=="object"&&delete o.children,a(o),n(!1)},availableTypes:["string","number","integer","boolean","object","array","file"]}}const ae=()=>`${Date.now()}-${Math.random()}`;function ie(t={}){const{onConfirm:a,onCancel:s,createInitialData:n}=t,[i,r]=y.useState(!1),[l,o]=y.useState(null),C=j=>{const b=j??(n?n():null);o(b),r(!0)},u=()=>{r(!1),o(null),s?.()};return{isOpen:i,data:l,open:C,close:u,confirm:j=>{a?.(j),r(!1),o(null)},setIsOpen:j=>{j?r(!0):u()}}}function Ke(t,a){const s=ie({createInitialData:()=>({id:ae(),key:"",type:"string",required:!1}),onConfirm:r=>{a({...t,children:[...t.children||[],r]})}});return{addChild:()=>s.open(),updateChild:(r,l)=>{const o=t.children.map(C=>C.id===r?l:C);a({...t,children:o})},deleteChild:r=>{const l=t.children.filter(o=>o.id!==r);a({...t,children:l})},addChildDialog:{isOpen:s.isOpen,data:s.data,setIsOpen:s.setIsOpen,confirm:s.confirm}}}function Z({property:t,onUpdate:a,onDelete:s,level:n=1,isArrayItem:i=!1}){const{getTypeLabel:r,typeLabels:l,showRegex:o,keyEditable:C,readonly:u}=je(),g=ie(),h=re(t.title||t.key||"",p=>a({...t,title:p}),{allowEmpty:!1}),j=re(t.description||"",p=>a({...t,description:p||void 0}),{allowEmpty:!0}),b=$e(t,a),c=Ke(t,a),d=`h${Math.min(n,6)}`,k=t.type==="object",E=k&&t.children&&t.children.length>0,O={1:"text-lg font-semibold",2:"text-base",3:"text-base",4:"text-base",5:"text-sm",6:"text-sm"}[n]||"text-sm",D={1:"h-5 w-5",2:"h-4 w-4",3:"h-4 w-4",4:"h-4 w-4",5:"h-4 w-4",6:"h-4 w-4"}[n]||"h-5 w-5";return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start gap-3",children:[!i&&e.jsx("button",{onClick:()=>!u&&a({...t,required:!t.required}),className:u?"shrink-0 -mt-[3px] cursor-default":"shrink-0 transition-all hover:scale-110 -mt-[3px]",title:u?t.required?"Required field":"Optional field":t.required?"Required field - click to make optional":"Optional field - click to make required",children:t.required?e.jsx(f.Asterisk,{className:"w-6 h-6 text-primary"}):e.jsx(f.Asterisk,{className:"w-6 h-6 text-border"})}),h.isEditing?e.jsx(q,{value:h.value,onChange:p=>h.handleChange(p.target.value),onBlur:h.handleBlur,onKeyDown:h.handleKeyDown,autoFocus:!0,className:O,placeholder:"Enter title"}):e.jsxs("div",{className:"flex gap-2 flex-wrap flex-1",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(d,{className:u?`${O} leading-none`:`${O} cursor-pointer hover:text-primary transition-colors leading-none`,onClick:u?void 0:h.startEdit,children:t.title||t.key||e.jsx("span",{className:"text-muted-foreground italic",children:"unnamed"})}),b.isChangingType?e.jsxs(G,{value:t.type,onValueChange:p=>b.handleTypeChange(p),open:b.isChangingType,onOpenChange:b.setIsChangingType,children:[e.jsx(J,{className:"w-[140px] h-7",children:e.jsx(Q,{})}),e.jsx(V,{children:b.availableTypes.map(p=>e.jsx(I,{value:p,children:l[p]},p))})]}):e.jsx(qe,{children:e.jsxs(Re,{children:[e.jsx(Ee,{asChild:!0,children:e.jsxs("button",{onClick:()=>!u&&b.setIsChangingType(!0),className:u?"rounded p-0.5 -mt-0.5 cursor-default":"cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",children:[t.type==="string"&&e.jsx(f.Type,{className:x(D,"text-muted-foreground")}),t.type==="number"&&e.jsx(f.Hash,{className:x(D,"text-muted-foreground")}),t.type==="integer"&&e.jsx(f.Hash,{className:x(D,"text-muted-foreground")}),t.type==="boolean"&&e.jsx(f.CheckSquare,{className:x(D,"text-muted-foreground")}),t.type==="object"&&e.jsx(f.Braces,{className:x(D,"text-muted-foreground")}),t.type==="array"&&e.jsx(f.List,{className:x(D,"text-muted-foreground")}),t.type==="file"&&e.jsx(f.FileText,{className:x(D,"text-muted-foreground")})]})}),e.jsxs(oe,{children:[r(t.type),t.type==="array"&&t.items?` of ${r(t.items.type)}`:"",!u&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Click to change type"})]})]})}),t.type==="object"&&!u&&e.jsx(T,{variant:"ghost",size:"icon",className:"h-4 w-4",onClick:c.addChild,"data-testid":`button-add-child-${t.id}`,children:e.jsx(f.Plus,{})})]}),e.jsx("div",{className:"flex-1",children:j.isEditing?e.jsx(q,{value:j.value,onChange:p=>j.handleChange(p.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,autoFocus:!0,className:"text-sm flex-1",placeholder:"Enter description"}):e.jsx(e.Fragment,{children:t.description?e.jsx("p",{className:u?"text-sm text-muted-foreground flex-1 min-w-[200px]":"text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors","data-testid":`text-description-${t.id}`,onClick:u?void 0:j.startEdit,children:t.description}):!u&&e.jsx("p",{className:"text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",onClick:j.startEdit,children:"Add description..."})})})]})]})}),!u&&e.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g.open(t),"data-testid":`button-edit-${t.id}`,children:e.jsx(f.Pencil,{className:"w-3 h-3"})}),k&&t.type!=="object"&&e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c.addChild,"data-testid":`button-add-child-${t.id}`,children:e.jsx(f.Plus,{className:"w-3 h-3"})}),e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:s,"data-testid":`button-delete-${t.id}`,children:e.jsx(f.Trash2,{className:"w-3 h-3"})})]})]}),E&&e.jsx("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:t.children.map(p=>e.jsx(Z,{property:p,onUpdate:R=>c.updateChild(p.id,R),onDelete:()=>c.deleteChild(p.id),level:n+1},p.id))}),t.type==="array"&&t.items&&e.jsxs("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:[e.jsxs("div",{className:"mb-2 text-xs text-muted-foreground font-semibold uppercase",children:[r("array")," Items"]}),e.jsx(Z,{property:t.items,onUpdate:p=>a({...t,items:p}),onDelete:()=>a({...t,items:void 0}),level:n+1,isArrayItem:!0})]}),e.jsx(H,{property:g.data||t,open:g.isOpen,onOpenChange:g.setIsOpen,onSave:p=>{a(p),g.close()},isArrayItem:i,isNewProperty:!1}),c.addChildDialog.isOpen&&c.addChildDialog.data&&e.jsx(H,{property:c.addChildDialog.data,open:c.addChildDialog.isOpen,isNewProperty:!0,onOpenChange:c.addChildDialog.setIsOpen,onSave:c.addChildDialog.confirm})]})}const ne=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("rounded-xl border bg-card text-card-foreground",t),...a}));ne.displayName="Card";const Je=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("flex flex-col space-y-1.5 p-6",t),...a}));Je.displayName="CardHeader";const Ve=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("font-semibold leading-none tracking-tight",t),...a}));Ve.displayName="CardTitle";const He=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("text-sm text-muted-foreground",t),...a}));He.displayName="CardDescription";const Ue=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("p-6 pt-0",t),...a}));Ue.displayName="CardContent";const Xe=v.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("flex items-center p-6 pt-0",t),...a}));Xe.displayName="CardFooter";const Ge=()=>new Promise((t,a)=>{const s=document.createElement("input");s.type="file",s.accept=".json",s.onchange=n=>{const i=n.target.files?.[0];if(!i){a(new Error("No file selected"));return}const r=new FileReader;r.onload=l=>{try{const o=JSON.parse(l.target?.result);t(o)}catch{a(new Error("Invalid JSON file"))}},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(i)},s.click()}),ye=(t,a="schema.json")=>{const s=JSON.stringify(t,null,2),n=new Blob([s],{type:"application/json"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.download=a,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)};function Qe({schema:t}){const[a,s]=y.useState(!1),n=JSON.stringify(t,null,2),i=async()=>{await navigator.clipboard.writeText(n),s(!0),setTimeout(()=>s(!1),2e3)},r=()=>{ye(t,"schema.json")};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h2",{className:"text-sm font-medium",children:"JSON Schema Output"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{variant:"outline",size:"sm",onClick:i,"data-testid":"button-copy",children:a?e.jsx(f.CheckCircle2,{className:"w-4 h-4"}):e.jsx(f.Copy,{className:"w-4 h-4"})}),e.jsx(T,{variant:"outline",size:"sm",onClick:r,"data-testid":"button-download",children:e.jsx(f.Download,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx(ne,{className:"m-4 bg-muted/30",children:e.jsx("pre",{className:"p-6 text-xs font-mono overflow-auto","data-testid":"text-json-output",children:e.jsx("code",{children:n})})})})]})}function We({title:t,description:a,version:s,onUpdate:n,readonly:i=!1}){const[r,l]=y.useState(!1);return e.jsxs(ne,{className:"p-4",children:[e.jsxs(T,{variant:"ghost",onClick:()=>l(!r),className:"w-full justify-between px-2 h-auto hover:bg-transparent","data-testid":"button-toggle-metadata",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Schema Metadata"}),r?e.jsx(f.ChevronDown,{className:"w-4 h-4"}):e.jsx(f.ChevronRight,{className:"w-4 h-4"})]}),r&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-title",className:"text-xs text-muted-foreground",children:"Title"}),e.jsx(q,{id:"schema-title",placeholder:"My Schema",value:t,onChange:o=>n("title",o.target.value),"data-testid":"input-title",disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-description",className:"text-xs text-muted-foreground",children:"Description"}),e.jsx(se,{id:"schema-description",placeholder:"Describe your schema...",value:a,onChange:o=>n("description",o.target.value),className:"resize-none",rows:3,"data-testid":"input-schema-description",disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-version",className:"text-xs text-muted-foreground",children:"Version"}),e.jsx(q,{id:"schema-version",placeholder:"1.0.0",value:s,onChange:o=>n("version",o.target.value),"data-testid":"input-version",disabled:i})]})]})]})}const K=(t,a,s=!0)=>{const n={type:"object"};s&&a&&(a.title&&(n.title=a.title),a.description&&(n.description=a.description));const i=ee(t);Object.keys(i).length>0&&(n.properties=i);const r=t.filter(l=>l.required&&l.key).map(l=>l.key);return r.length>0&&(n.required=r),n},ee=t=>{const a={};return t.forEach(s=>{if(!s.key)return;const i={type:s.type==="file"?"string":s.type};if(s.title&&(i.title=s.title),s.description&&(i.description=s.description),s.type==="file"&&(i.format="filename"),s.type==="string"&&(s.minLength!==void 0&&(i.minLength=s.minLength),s.maxLength!==void 0&&(i.maxLength=s.maxLength),s.pattern&&(i.pattern=s.pattern),s.enum&&s.enum.length>0&&(i.enum=s.enum)),(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(i.minimum=s.minimum),s.maximum!==void 0&&(i.maximum=s.maximum)),s.type==="array"&&(s.minItems!==void 0&&(i.minItems=s.minItems),s.maxItems!==void 0&&(i.maxItems=s.maxItems),s.uniqueItems&&(i.uniqueItems=s.uniqueItems),s.items&&(i.items=ee([s.items])[s.items.key]||{type:s.items.type})),s.type==="object"&&s.children&&s.children.length>0){i.properties=ee(s.children);const r=s.children.filter(l=>l.required&&l.key).map(l=>l.key);r.length>0&&(i.required=r)}a[s.key]=i}),a},Ye=t=>{const a={properties:[]};return(t.title||t.description)&&(a.metadata={title:typeof t.title=="string"?t.title:"",description:typeof t.description=="string"?t.description:"",version:"1.0.0"}),t.properties&&typeof t.properties=="object"&&(a.properties=te(t.properties,Array.isArray(t.required)?t.required:[])),a},te=(t,a=[])=>t?Object.entries(t).filter(([,s])=>typeof s=="object").map(([s,n])=>{const i=n;let r=typeof i.type=="string"?i.type:"string";r==="string"&&i.format==="filename"&&(r="file");const l={id:ae(),key:s,title:typeof i.title=="string"?i.title:void 0,type:r,description:typeof i.description=="string"?i.description:void 0,required:a.includes(s)};return i.minLength!==void 0&&(l.minLength=i.minLength),i.maxLength!==void 0&&(l.maxLength=i.maxLength),i.pattern&&(l.pattern=i.pattern),i.enum&&Array.isArray(i.enum)&&(l.enum=i.enum),i.minimum!==void 0&&(l.minimum=i.minimum),i.maximum!==void 0&&(l.maximum=i.maximum),i.minItems!==void 0&&(l.minItems=i.minItems),i.maxItems!==void 0&&(l.maxItems=i.maxItems),i.uniqueItems&&(l.uniqueItems=i.uniqueItems),l.type==="array"&&i.items&&typeof i.items=="object"&&!Array.isArray(i.items)&&(l.items=te({item:i.items},[]).find(o=>o.key==="item")),i.properties&&typeof i.properties=="object"&&(l.children=te(i.properties,Array.isArray(i.required)?i.required:[])),l}):[],Ze=({schema:t,onChange:a,includeMetadata:s=!0})=>{const{properties:n,metadata:i}=y.useMemo(()=>Ye(t),[t]),r=n,l=i||{title:"",description:"",version:""},o=y.useCallback(()=>({id:ae(),key:"",type:"string",required:!1}),[]),C=y.useCallback((c,d)=>{const k=r.some(D=>D.id===c);let E;k?E=r.map(D=>D.id===c?d:D):E=[...r,d];const O=K(E,l,s);a(O)},[r,l,s,a]),u=y.useCallback(c=>{const d=r.filter(E=>E.id!==c),k=K(d,l,s);a(k)},[r,l,s,a]),g=y.useCallback(()=>{const d=K([],{title:"",description:""},s);a(d)},[s,a]),h=y.useCallback((c,d)=>{const k={...l,[c]:d},E=K(r,k,s);a(E)},[r,l,s,a]),j=y.useCallback(async()=>{const c=await Ge();a(c)},[a]),b=y.useCallback(()=>{ye(t,"schema.json")},[t]);return{properties:r,metadata:l,addProperty:o,updateProperty:C,deleteProperty:u,clearAll:g,updateMetadata:h,importSchema:j,downloadSchema:b}};function et(){const[t,a]=y.useState("light");y.useEffect(()=>{const i=localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");a(i),document.documentElement.classList.toggle("dark",i==="dark")},[]);const s=()=>{const n=t==="light"?"dark":"light";a(n),localStorage.setItem("theme",n),document.documentElement.classList.toggle("dark",n==="dark")};return e.jsx(T,{variant:"ghost",size:"icon",onClick:s,"data-testid":"button-theme-toggle",children:t==="light"?e.jsx(f.Moon,{className:"w-4 h-4"}):e.jsx(f.Sun,{className:"w-4 h-4"})})}function tt({schema:t,onChange:a,showMetadata:s=!1,showImport:n=!0,showClear:i=!0,showOutput:r=!0,showHeader:l=!0,className:o="",showSummary:C=!1,typeLabels:u,propertyLabel:g={singular:"property",plural:"properties"},showRegex:h=!1,keyEditable:j=!1,readonly:b=!1}){const{properties:c,metadata:d,addProperty:k,updateProperty:E,deleteProperty:O,clearAll:D,updateMetadata:p,importSchema:R}=Ze({schema:t,onChange:a??(()=>{}),includeMetadata:s}),L=ie({createInitialData:()=>k(),onConfirm:S=>{E(S.id,S)}}),U=()=>{D()},m=async()=>{await R()};return e.jsx(_e,{config:{typeLabels:u,propertyLabel:g,showRegex:h,keyEditable:j,readonly:b},children:e.jsxs("div",{className:`${o} flex flex-col json-schema-builder-react`,children:[l&&e.jsx("header",{className:"h-16 border-b flex items-center justify-between px-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[!b&&n&&e.jsx(T,{variant:"outline",size:"sm",onClick:m,"data-testid":"button-import",children:e.jsx(f.Upload,{className:"w-4 h-4"})}),!b&&i&&e.jsx(T,{variant:"outline",size:"sm",onClick:U,disabled:c.length===0,"data-testid":"button-clear",children:e.jsx(f.Trash2,{className:"w-4 h-4"})}),e.jsx(et,{})]})}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:r?"w-3/5 border-r":"w-full",children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-1 overflow-auto p-2 space-y-4",children:[s&&e.jsx(We,{title:d.title,description:d.description,version:d.version,onUpdate:(S,B)=>p(S,B),readonly:b}),c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-4 text-center",children:[!b&&e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4",children:e.jsx(f.Plus,{className:"w-8 h-8 text-muted-foreground"})}),e.jsxs("h2",{className:"text-lg font-medium mb-2",children:["No ",g.plural," yet"]}),!b&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:["Start building your JSON schema by adding your first"," ",g.singular]}),e.jsxs(T,{onClick:()=>L.open(),"data-testid":"button-add-first",children:[e.jsx(f.Plus,{className:"w-4 h-4 mr-2"}),"Add ",g.singular]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-1",children:c.map(S=>e.jsx(Z,{property:S,onUpdate:B=>E(S.id,B),onDelete:()=>O(S.id)},S.id))}),C&&e.jsxs("div",{className:"pt-4 border-t flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[c.length," ",c.length===1?g.singular:g.plural]}),e.jsxs("span",{children:[c.filter(S=>S.required).length," required"]})]})]})]}),c.length>0&&!b&&e.jsx("div",{className:"border-t p-2 pt-4 bg-background",children:e.jsxs(T,{onClick:()=>L.open(),className:"w-full",variant:"outline","data-testid":"button-add-property",children:[e.jsx(f.Plus,{className:"w-4 h-4"}),"Add ",g.singular]})})]})}),r&&e.jsx("div",{className:"w-2/5",children:e.jsx(Qe,{schema:t})})]}),L.isOpen&&L.data&&e.jsx(H,{property:L.data,open:L.isOpen,isNewProperty:!0,onOpenChange:L.setIsOpen,onSave:L.confirm})]})})}exports.JsonSchemaBuilder=tt;exports.PropertyEditDialog=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),be=require("@radix-ui/react-slot"),le=require("class-variance-authority"),Ne=require("clsx"),we=require("tailwind-merge"),f=require("lucide-react"),Ce=require("@radix-ui/react-tooltip"),ke=require("@radix-ui/react-select"),Se=require("@radix-ui/react-dialog"),Ie=require("@radix-ui/react-label"),Te=require("@radix-ui/react-checkbox");function z(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(a,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return a.default=t,Object.freeze(a)}const y=z(v),F=z(Ce),w=z(ke),P=z(Se),oe=z(Ie),X=z(Te);function x(...t){return we.twMerge(Ne.clsx(t))}const De=le.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-full px-3 text-xs",lg:"h-10 rounded-full px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),T=y.forwardRef(({className:t,variant:a,size:s,asChild:n=!1,...i},r)=>{const l=n?be.Slot:"button";return e.jsx(l,{className:x(De({variant:a,size:s,className:t})),ref:r,...i})});T.displayName="Button";const q=y.forwardRef(({className:t,type:a,...s},n)=>e.jsx("input",{type:a,className:x("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...s}));q.displayName="Input";const qe=F.Provider,Re=F.Root,Ee=F.Trigger,de=y.forwardRef(({className:t,sideOffset:a=4,...s},n)=>e.jsx(F.Portal,{children:e.jsx(F.Content,{ref:n,sideOffset:a,className:x("z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",t),...s})}));de.displayName=F.Content.displayName;const G=w.Root,Q=w.Value,J=y.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(w.Trigger,{ref:n,className:x("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...s,children:[a,e.jsx(w.Icon,{asChild:!0,children:e.jsx(f.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));J.displayName=w.Trigger.displayName;const ce=y.forwardRef(({className:t,...a},s)=>e.jsx(w.ScrollUpButton,{ref:s,className:x("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronUp,{className:"h-4 w-4"})}));ce.displayName=w.ScrollUpButton.displayName;const me=y.forwardRef(({className:t,...a},s)=>e.jsx(w.ScrollDownButton,{ref:s,className:x("flex cursor-default items-center justify-center py-1",t),...a,children:e.jsx(f.ChevronDown,{className:"h-4 w-4"})}));me.displayName=w.ScrollDownButton.displayName;const V=y.forwardRef(({className:t,children:a,position:s="popper",...n},i)=>e.jsx(w.Portal,{children:e.jsxs(w.Content,{ref:i,className:x("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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 origin-[--radix-select-content-transform-origin]",s==="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",t),position:s,...n,children:[e.jsx(ce,{}),e.jsx(w.Viewport,{className:x("p-1",s==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),e.jsx(me,{})]})}));V.displayName=w.Content.displayName;const Pe=y.forwardRef(({className:t,...a},s)=>e.jsx(w.Label,{ref:s,className:x("px-2 py-1.5 text-sm font-semibold",t),...a}));Pe.displayName=w.Label.displayName;const I=y.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(w.Item,{ref:n,className:x("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(w.ItemIndicator,{children:e.jsx(f.Check,{className:"h-4 w-4"})})}),e.jsx(w.ItemText,{children:a})]}));I.displayName=w.Item.displayName;const Le=y.forwardRef(({className:t,...a},s)=>e.jsx(w.Separator,{ref:s,className:x("-mx-1 my-1 h-px bg-muted",t),...a}));Le.displayName=w.Separator.displayName;const Oe=P.Root,Fe=P.Portal,ue=y.forwardRef(({className:t,...a},s)=>e.jsx(P.Overlay,{ref:s,className:x("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a}));ue.displayName=P.Overlay.displayName;const he=y.forwardRef(({className:t,children:a,...s},n)=>e.jsxs(Fe,{children:[e.jsx(ue,{}),e.jsxs(P.Content,{ref:n,className:x("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s,children:[a,e.jsxs(P.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(f.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));he.displayName=P.Content.displayName;const xe=({className:t,...a})=>e.jsx("div",{className:x("flex flex-col space-y-1.5 text-center sm:text-left",t),...a});xe.displayName="DialogHeader";const fe=({className:t,...a})=>e.jsx("div",{className:x("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});fe.displayName="DialogFooter";const pe=y.forwardRef(({className:t,...a},s)=>e.jsx(P.Title,{ref:s,className:x("text-lg font-semibold leading-none tracking-tight",t),...a}));pe.displayName=P.Title.displayName;const ze=y.forwardRef(({className:t,...a},s)=>e.jsx(P.Description,{ref:s,className:x("text-sm text-muted-foreground",t),...a}));ze.displayName=P.Description.displayName;const Be=le.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),N=y.forwardRef(({className:t,...a},s)=>e.jsx(oe.Root,{ref:s,className:x(Be(),t),...a}));N.displayName=oe.Root.displayName;const W=y.forwardRef(({className:t,...a},s)=>e.jsx(X.Root,{ref:s,className:x("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...a,children:e.jsx(X.Indicator,{className:x("grid place-content-center text-current"),children:e.jsx(f.Check,{className:"h-4 w-4"})})}));W.displayName=X.Root.displayName;const se=y.forwardRef(({className:t,...a},s)=>e.jsx("textarea",{className:x("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...a}));se.displayName="Textarea";const Ae=t=>t.trim().toLowerCase().replace(/[^\w\s]/g,"").replace(/\s+/g,"_"),Me=(t,a,s=!1,n=!1)=>{const i=(u,g)=>{a({...t,[u]:g})};return{handleTitleChange:u=>{i("title",u)},handleTitleBlur:()=>{if(s&&t.title){const u=Ae(t.title);i("key",u)}},handleKeyChange:u=>{(s||n)&&i("key",u)},handleFieldChange:i,handleConstraintChange:(u,g)=>{a({...t,[u]:g})}}},Y={string:"String",number:"Number",integer:"Integer",boolean:"Boolean",object:"Object",array:"Array",null:"Null",file:"File"},M={getTypeLabel:t=>Y[t],typeLabels:Y,propertyLabel:{singular:"property",plural:"properties"},showRegex:!1,keyEditable:!1,readonly:!1},ge=v.createContext(M);function _e({children:t,config:a={}}){const s={...Y,...a.typeLabels},n=a.propertyLabel||M.propertyLabel,i=a.showRegex??M.showRegex,r=a.keyEditable??M.keyEditable,l=a.readonly??M.readonly,d=C=>s[C]||C;return e.jsx(ge.Provider,{value:{getTypeLabel:d,typeLabels:s,propertyLabel:n,showRegex:i,keyEditable:r,readonly:l},children:t})}function je(){return v.useContext(ge)}function H({property:t,open:a,onOpenChange:s,onSave:n,isArrayItem:i=!1,isNewProperty:r=!1,propertyLabel:l,showRegex:d,keyEditable:C,typeLabels:u}){const g=je(),h=u||g.typeLabels,j=l||g.propertyLabel,b=d??g.showRegex,c=C??g.keyEditable,[o,k]=v.useState(t);v.useEffect(()=>{a&&k(t)},[t,a]);const{handleTitleChange:E,handleTitleBlur:O,handleKeyChange:D,handleFieldChange:p,handleConstraintChange:R}=Me(o,k,r,c),L=()=>{o.title?.trim()&&(n(o),s(!1))},U=()=>{k(t),s(!1)};return e.jsx(Oe,{open:a,onOpenChange:s,children:e.jsxs(he,{className:"max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0","data-testid":"dialog-edit-property",children:[e.jsx(xe,{className:"px-6 pt-6 pb-4 shrink-0",children:e.jsx(pe,{children:r?`Add ${j.singular}`:`Edit ${j.singular}`})}),e.jsxs("div",{className:"space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Type"]}),e.jsxs(G,{value:o.type,onValueChange:m=>p("type",m),"data-testid":"select-type-dialog",children:[e.jsx(J,{children:e.jsx(Q,{})}),e.jsxs(V,{children:[e.jsx(I,{value:"string",children:h.string}),e.jsx(I,{value:"number",children:h.number}),e.jsx(I,{value:"integer",children:h.integer}),e.jsx(I,{value:"boolean",children:h.boolean}),e.jsx(I,{value:"object",children:h.object}),e.jsx(I,{value:"array",children:h.array}),e.jsx(I,{value:"file",children:h.file}),e.jsx(I,{value:"null",children:h.null})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(N,{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-red-500"}),"Title"]}),e.jsx(q,{value:o.title||"",onChange:m=>E(m.target.value),onBlur:O,placeholder:"Property Title","data-testid":"input-title-dialog",required:!0}),!r&&o.key&&e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["Key: ",o.key]})]}),(r||c)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Key"}),e.jsx(q,{value:o.key,onChange:m=>D(m.target.value),placeholder:"property_key","data-testid":"input-key-dialog"}),!r&&e.jsx("p",{className:"text-xs text-yellow-600 dark:text-yellow-500",children:"⚠️ Changing the key may break existing references to this property"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Description"}),e.jsx(se,{placeholder:"Optional description",value:o.description||"",onChange:m=>p("description",m.target.value),rows:2,"data-testid":"input-edit-description"})]}),o.type==="array"&&e.jsxs("div",{className:"space-y-2 border-l-2 border-border pl-4 mt-2",children:[e.jsxs(N,{className:"font-semibold text-xs text-muted-foreground",children:[h.array," Items"]}),o.items?e.jsxs("div",{className:"bg-muted/40 p-2 rounded",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Item Type"}),e.jsxs(G,{value:o.items.type,onValueChange:m=>k({...o,items:{...o.items,type:m}}),children:[e.jsx(J,{children:e.jsx(Q,{})}),e.jsxs(V,{children:[e.jsx(I,{value:"string",children:h.string}),e.jsx(I,{value:"number",children:h.number}),e.jsx(I,{value:"integer",children:h.integer}),e.jsx(I,{value:"boolean",children:h.boolean}),e.jsx(I,{value:"object",children:h.object}),e.jsx(I,{value:"array",children:h.array}),e.jsx(I,{value:"file",children:h.file}),e.jsx(I,{value:"null",children:h.null})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Item Title"}),e.jsx(q,{value:o.items.title||"",onChange:m=>k({...o,items:{...o.items,title:m.target.value}}),placeholder:"Item Title"})]}),e.jsxs(T,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>k({...o,items:void 0}),children:["Remove ",h.array," Item Schema"]})]}):e.jsxs(T,{variant:"outline",size:"sm",onClick:()=>{k({...o,items:{id:Date.now().toString()+Math.random(),key:"item",type:"string",required:!1}})},children:["Add ",h.array," Item Schema"]})]}),!i&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{id:"prop-required",checked:o.required,onCheckedChange:m=>p("required",m),"data-testid":"checkbox-edit-required"}),e.jsx(N,{htmlFor:"prop-required",className:"cursor-pointer",children:"Required field"})]}),o.type==="string"&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsxs("h4",{className:"text-sm font-medium inline",children:[h.string," Constraints"]})}),e.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"min-length",children:"Minimum Length"}),e.jsx(q,{id:"min-length",type:"number",placeholder:"0",value:o.minLength||"",onChange:m=>R("minLength",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-minlength"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"max-length",children:"Maximum Length"}),e.jsx(q,{id:"max-length",type:"number",placeholder:"∞",value:o.maxLength||"",onChange:m=>R("maxLength",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-maxlength"})]})]}),b&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"pattern",children:"Pattern (regex)"}),e.jsx(q,{id:"pattern",placeholder:"^[a-z]+$",value:o.pattern||"",onChange:m=>R("pattern",m.target.value),className:"font-mono text-sm","data-testid":"input-edit-pattern"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{children:"Enum Values"}),e.jsx("div",{className:"space-y-2",children:[...o.enum||[],""].map((m,S)=>e.jsx(q,{placeholder:S===(o.enum?.length||0)?"Add new value...":"Enum value",value:m,onChange:B=>{const _=B.target.value,$=o.enum||[];if(S===$.length)_.trim()&&R("enum",[...$,_.trim()]);else if(_.trim()){const A=[...$];A[S]=_.trim(),R("enum",A)}else{const A=$.filter((st,ye)=>ye!==S);R("enum",A.length>0?A:void 0)}},"data-testid":`input-edit-enum-${S}`},S))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter allowed values (empty fields will be removed)"})]})]})]}),(o.type==="number"||o.type==="integer")&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsx("h4",{className:"text-sm font-medium inline",children:"Numeric Constraints"})}),e.jsx("div",{className:"space-y-4 p-4 pt-0",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"minimum",children:"Minimum Value"}),e.jsx(q,{id:"minimum",type:"number",placeholder:"-∞",value:o.minimum??"",onChange:m=>R("minimum",m.target.value?parseFloat(m.target.value):void 0),"data-testid":"input-edit-minimum"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"maximum",children:"Maximum Value"}),e.jsx(q,{id:"maximum",type:"number",placeholder:"∞",value:o.maximum??"",onChange:m=>R("maximum",m.target.value?parseFloat(m.target.value):void 0),"data-testid":"input-edit-maximum"})]})]})})]}),o.type==="array"&&e.jsxs("details",{className:"border rounded-md",children:[e.jsx("summary",{className:"p-4 cursor-pointer hover:bg-accent/50 transition-colors",children:e.jsxs("h4",{className:"text-sm font-medium inline",children:[h.array," Constraints"]})}),e.jsxs("div",{className:"space-y-4 p-4 pt-0",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"min-items",children:"Minimum Items"}),e.jsx(q,{id:"min-items",type:"number",placeholder:"0",value:o.minItems||"",onChange:m=>R("minItems",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-minitems"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"max-items",children:"Maximum Items"}),e.jsx(q,{id:"max-items",type:"number",placeholder:"∞",value:o.maxItems||"",onChange:m=>R("maxItems",m.target.value?parseInt(m.target.value):void 0),"data-testid":"input-edit-maxitems"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(W,{id:"unique-items",checked:o.uniqueItems||!1,onCheckedChange:m=>R("uniqueItems",m),"data-testid":"checkbox-edit-unique"}),e.jsx(N,{htmlFor:"unique-items",className:"cursor-pointer",children:"All items must be unique"})]})]})]})]}),e.jsxs(fe,{className:"px-6 py-4 border-t bg-background shrink-0",children:[e.jsx(T,{variant:"outline",onClick:U,"data-testid":"button-cancel",children:"Cancel"}),e.jsx(T,{onClick:L,"data-testid":"button-save",disabled:!o.title?.trim(),children:"Save Changes"})]})]})})}function re(t,a,s={}){const{allowEmpty:n=!1,onEditStart:i,onEditCancel:r}=s,[l,d]=v.useState(!1),[C,u]=v.useState(t);v.useEffect(()=>{l||u(t)},[t,l]);const g=()=>{u(t),d(!0),i?.()},h=c=>{u(c)},j=()=>{const c=C.trim();if(!n&&!c){u(t),d(!1);return}c!==t&&a(c),d(!1)};return{isEditing:l,value:C,startEdit:g,handleChange:h,handleBlur:j,handleKeyDown:c=>{c.key==="Enter"?j():c.key==="Escape"&&(u(t),d(!1),r?.())}}}function $e(t,a){const[s,n]=v.useState(!1);return{isChangingType:s,setIsChangingType:n,handleTypeChange:l=>{const d={...t,type:l};l!=="string"&&(delete d.minLength,delete d.maxLength,delete d.pattern,delete d.enum),l!=="number"&&l!=="integer"&&(delete d.minimum,delete d.maximum),l!=="array"&&(delete d.minItems,delete d.maxItems,delete d.uniqueItems,delete d.items),l!=="object"&&delete d.children,a(d),n(!1)},availableTypes:["string","number","integer","boolean","object","array","file"]}}const ae=()=>`${Date.now()}-${Math.random()}`;function ie(t={}){const{onConfirm:a,onCancel:s,createInitialData:n}=t,[i,r]=v.useState(!1),[l,d]=v.useState(null),C=j=>{const b=j??(n?n():null);d(b),r(!0)},u=()=>{r(!1),d(null),s?.()};return{isOpen:i,data:l,open:C,close:u,confirm:j=>{a?.(j),r(!1),d(null)},setIsOpen:j=>{j?r(!0):u()}}}function Ke(t,a){const s=ie({createInitialData:()=>({id:ae(),key:"",type:"string",required:!1}),onConfirm:r=>{a({...t,children:[...t.children||[],r]})}});return{addChild:()=>s.open(),updateChild:(r,l)=>{const d=t.children.map(C=>C.id===r?l:C);a({...t,children:d})},deleteChild:r=>{const l=t.children.filter(d=>d.id!==r);a({...t,children:l})},addChildDialog:{isOpen:s.isOpen,data:s.data,setIsOpen:s.setIsOpen,confirm:s.confirm}}}function Z({property:t,onUpdate:a,onDelete:s,level:n=1,isArrayItem:i=!1}){const{getTypeLabel:r,typeLabels:l,showRegex:d,keyEditable:C,readonly:u}=je(),g=ie(),h=re(t.title||t.key||"",p=>a({...t,title:p}),{allowEmpty:!1}),j=re(t.description||"",p=>a({...t,description:p||void 0}),{allowEmpty:!0}),b=$e(t,a),c=Ke(t,a),o=`h${Math.min(n,6)}`,k=t.type==="object",E=k&&t.children&&t.children.length>0,O={1:"text-lg font-semibold",2:"text-base",3:"text-base",4:"text-base",5:"text-sm",6:"text-sm"}[n]||"text-sm",D={1:"h-5 w-5",2:"h-4 w-4",3:"h-4 w-4",4:"h-4 w-4",5:"h-4 w-4",6:"h-4 w-4"}[n]||"h-5 w-5";return e.jsxs("div",{className:"group",children:[e.jsxs("div",{className:"flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50",children:[e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start gap-3",children:[!i&&e.jsx("button",{onClick:()=>!u&&a({...t,required:!t.required}),className:u?"shrink-0 -mt-[3px] cursor-default":"shrink-0 transition-all hover:scale-110 -mt-[3px]",title:u?t.required?"Required field":"Optional field":t.required?"Required field - click to make optional":"Optional field - click to make required",children:t.required?e.jsx(f.Asterisk,{className:"w-6 h-6 text-primary"}):e.jsx(f.Asterisk,{className:"w-6 h-6 text-border"})}),h.isEditing?e.jsx(q,{value:h.value,onChange:p=>h.handleChange(p.target.value),onBlur:h.handleBlur,onKeyDown:h.handleKeyDown,autoFocus:!0,className:O,placeholder:"Enter title"}):e.jsxs("div",{className:"flex gap-2 flex-wrap flex-1",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(o,{className:u?`${O} leading-none`:`${O} cursor-pointer hover:text-primary transition-colors leading-none`,onClick:u?void 0:h.startEdit,children:t.title||t.key||e.jsx("span",{className:"text-muted-foreground italic",children:"unnamed"})}),b.isChangingType?e.jsxs(G,{value:t.type,onValueChange:p=>b.handleTypeChange(p),open:b.isChangingType,onOpenChange:b.setIsChangingType,children:[e.jsx(J,{className:"w-[140px] h-7",children:e.jsx(Q,{})}),e.jsx(V,{children:b.availableTypes.map(p=>e.jsx(I,{value:p,children:l[p]},p))})]}):e.jsx(qe,{children:e.jsxs(Re,{children:[e.jsx(Ee,{asChild:!0,children:e.jsxs("button",{onClick:()=>!u&&b.setIsChangingType(!0),className:u?"rounded p-0.5 -mt-0.5 cursor-default":"cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",children:[t.type==="string"&&e.jsx(f.Type,{className:x(D,"text-muted-foreground")}),t.type==="number"&&e.jsx(f.Hash,{className:x(D,"text-muted-foreground")}),t.type==="integer"&&e.jsx(f.Hash,{className:x(D,"text-muted-foreground")}),t.type==="boolean"&&e.jsx(f.CheckSquare,{className:x(D,"text-muted-foreground")}),t.type==="object"&&e.jsx(f.Braces,{className:x(D,"text-muted-foreground")}),t.type==="array"&&e.jsx(f.List,{className:x(D,"text-muted-foreground")}),t.type==="file"&&e.jsx(f.FileText,{className:x(D,"text-muted-foreground")})]})}),e.jsxs(de,{children:[r(t.type),t.type==="array"&&t.items?` of ${r(t.items.type)}`:"",!u&&e.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:"Click to change type"})]})]})}),t.type==="object"&&!u&&e.jsx(T,{variant:"ghost",size:"icon",className:"h-4 w-4",onClick:c.addChild,"data-testid":`button-add-child-${t.id}`,children:e.jsx(f.Plus,{})})]}),e.jsx("div",{className:"flex-1",children:j.isEditing?e.jsx(q,{value:j.value,onChange:p=>j.handleChange(p.target.value),onBlur:j.handleBlur,onKeyDown:j.handleKeyDown,autoFocus:!0,className:"text-sm flex-1",placeholder:"Enter description"}):e.jsx(e.Fragment,{children:t.description?e.jsx("p",{className:u?"text-sm text-muted-foreground flex-1 min-w-[200px]":"text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors","data-testid":`text-description-${t.id}`,onClick:u?void 0:j.startEdit,children:t.description}):!u&&e.jsx("p",{className:"text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",onClick:j.startEdit,children:"Add description..."})})})]})]})}),!u&&e.jsxs("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0",children:[e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>g.open(t),"data-testid":`button-edit-${t.id}`,children:e.jsx(f.Pencil,{className:"w-3 h-3"})}),k&&t.type!=="object"&&e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:c.addChild,"data-testid":`button-add-child-${t.id}`,children:e.jsx(f.Plus,{className:"w-3 h-3"})}),e.jsx(T,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:s,"data-testid":`button-delete-${t.id}`,children:e.jsx(f.Trash2,{className:"w-3 h-3"})})]})]}),E&&e.jsx("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:t.children.map(p=>e.jsx(Z,{property:p,onUpdate:R=>c.updateChild(p.id,R),onDelete:()=>c.deleteChild(p.id),level:n+1},p.id))}),t.type==="array"&&t.items&&e.jsxs("div",{className:n===1?"ml-6 mt-1 border-l-2 border-border pl-6":"ml-4 mt-1 border-l border-border pl-4",children:[e.jsxs("div",{className:"mb-2 text-xs text-muted-foreground font-semibold uppercase",children:[r("array")," Items"]}),e.jsx(Z,{property:t.items,onUpdate:p=>a({...t,items:p}),onDelete:()=>a({...t,items:void 0}),level:n+1,isArrayItem:!0})]}),e.jsx(H,{property:g.data||t,open:g.isOpen,onOpenChange:g.setIsOpen,onSave:p=>{a(p),g.close()},isArrayItem:i,isNewProperty:!1}),c.addChildDialog.isOpen&&c.addChildDialog.data&&e.jsx(H,{property:c.addChildDialog.data,open:c.addChildDialog.isOpen,isNewProperty:!0,onOpenChange:c.addChildDialog.setIsOpen,onSave:c.addChildDialog.confirm})]})}const ne=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("rounded-xl border bg-card text-card-foreground",t),...a}));ne.displayName="Card";const Je=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("flex flex-col space-y-1.5 p-6",t),...a}));Je.displayName="CardHeader";const Ve=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("font-semibold leading-none tracking-tight",t),...a}));Ve.displayName="CardTitle";const He=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("text-sm text-muted-foreground",t),...a}));He.displayName="CardDescription";const Ue=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("p-6 pt-0",t),...a}));Ue.displayName="CardContent";const Xe=y.forwardRef(({className:t,...a},s)=>e.jsx("div",{ref:s,className:x("flex items-center p-6 pt-0",t),...a}));Xe.displayName="CardFooter";const Ge=()=>new Promise((t,a)=>{const s=document.createElement("input");s.type="file",s.accept=".json",s.onchange=n=>{const i=n.target.files?.[0];if(!i){a(new Error("No file selected"));return}const r=new FileReader;r.onload=l=>{try{const d=JSON.parse(l.target?.result);t(d)}catch{a(new Error("Invalid JSON file"))}},r.onerror=()=>a(new Error("Failed to read file")),r.readAsText(i)},s.click()}),ve=(t,a="schema.json")=>{const s=JSON.stringify(t,null,2),n=new Blob([s],{type:"application/json"}),i=URL.createObjectURL(n),r=document.createElement("a");r.href=i,r.download=a,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(i)};function Qe({schema:t}){const[a,s]=v.useState(!1),n=JSON.stringify(t,null,2),i=async()=>{await navigator.clipboard.writeText(n),s(!0),setTimeout(()=>s(!1),2e3)},r=()=>{ve(t,"schema.json")};return e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h2",{className:"text-sm font-medium",children:"JSON Schema Output"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(T,{variant:"outline",size:"sm",onClick:i,"data-testid":"button-copy",children:a?e.jsx(f.CheckCircle2,{className:"w-4 h-4"}):e.jsx(f.Copy,{className:"w-4 h-4"})}),e.jsx(T,{variant:"outline",size:"sm",onClick:r,"data-testid":"button-download",children:e.jsx(f.Download,{className:"w-4 h-4"})})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx(ne,{className:"m-4 bg-muted/30",children:e.jsx("pre",{className:"p-6 text-xs font-mono overflow-auto","data-testid":"text-json-output",children:e.jsx("code",{children:n})})})})]})}function We({title:t,description:a,version:s,onUpdate:n,readonly:i=!1}){const[r,l]=v.useState(!1);return e.jsxs(ne,{className:"p-4",children:[e.jsxs(T,{variant:"ghost",onClick:()=>l(!r),className:"w-full justify-between px-2 h-auto hover:bg-transparent","data-testid":"button-toggle-metadata",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Schema Metadata"}),r?e.jsx(f.ChevronDown,{className:"w-4 h-4"}):e.jsx(f.ChevronRight,{className:"w-4 h-4"})]}),r&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-title",className:"text-xs text-muted-foreground",children:"Title"}),e.jsx(q,{id:"schema-title",placeholder:"My Schema",value:t,onChange:d=>n("title",d.target.value),"data-testid":"input-title",disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-description",className:"text-xs text-muted-foreground",children:"Description"}),e.jsx(se,{id:"schema-description",placeholder:"Describe your schema...",value:a,onChange:d=>n("description",d.target.value),className:"resize-none",rows:3,"data-testid":"input-schema-description",disabled:i})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(N,{htmlFor:"schema-version",className:"text-xs text-muted-foreground",children:"Version"}),e.jsx(q,{id:"schema-version",placeholder:"1.0.0",value:s,onChange:d=>n("version",d.target.value),"data-testid":"input-version",disabled:i})]})]})]})}const K=(t,a,s=!0)=>{const n={type:"object"};s&&a&&(a.title&&(n.title=a.title),a.description&&(n.description=a.description),a.version&&(n.version=a.version));const i=ee(t);Object.keys(i).length>0&&(n.properties=i);const r=t.filter(l=>l.required&&l.key).map(l=>l.key);return r.length>0&&(n.required=r),n},ee=t=>{const a={};return t.forEach(s=>{if(!s.key)return;const i={type:s.type==="file"?"string":s.type};if(s.title&&(i.title=s.title),s.description&&(i.description=s.description),s.type==="file"&&(i.format="filename"),s.type==="string"&&(s.minLength!==void 0&&(i.minLength=s.minLength),s.maxLength!==void 0&&(i.maxLength=s.maxLength),s.pattern&&(i.pattern=s.pattern),s.enum&&s.enum.length>0&&(i.enum=s.enum)),(s.type==="number"||s.type==="integer")&&(s.minimum!==void 0&&(i.minimum=s.minimum),s.maximum!==void 0&&(i.maximum=s.maximum)),s.type==="array"&&(s.minItems!==void 0&&(i.minItems=s.minItems),s.maxItems!==void 0&&(i.maxItems=s.maxItems),s.uniqueItems&&(i.uniqueItems=s.uniqueItems),s.items&&(i.items=ee([s.items])[s.items.key]||{type:s.items.type})),s.type==="object"&&s.children&&s.children.length>0){i.properties=ee(s.children);const r=s.children.filter(l=>l.required&&l.key).map(l=>l.key);r.length>0&&(i.required=r)}a[s.key]=i}),a},Ye=t=>{const a={properties:[]};return(t.title||t.description||t.version)&&(a.metadata={title:typeof t.title=="string"?t.title:"",description:typeof t.description=="string"?t.description:"",version:typeof t.version=="string"?t.version:"1.0.0"}),t.properties&&typeof t.properties=="object"&&(a.properties=te(t.properties,Array.isArray(t.required)?t.required:[])),a},te=(t,a=[])=>t?Object.entries(t).filter(([,s])=>typeof s=="object").map(([s,n])=>{const i=n;let r=typeof i.type=="string"?i.type:"string";r==="string"&&i.format==="filename"&&(r="file");const l={id:ae(),key:s,title:typeof i.title=="string"?i.title:void 0,type:r,description:typeof i.description=="string"?i.description:void 0,required:a.includes(s)};return i.minLength!==void 0&&(l.minLength=i.minLength),i.maxLength!==void 0&&(l.maxLength=i.maxLength),i.pattern&&(l.pattern=i.pattern),i.enum&&Array.isArray(i.enum)&&(l.enum=i.enum),i.minimum!==void 0&&(l.minimum=i.minimum),i.maximum!==void 0&&(l.maximum=i.maximum),i.minItems!==void 0&&(l.minItems=i.minItems),i.maxItems!==void 0&&(l.maxItems=i.maxItems),i.uniqueItems&&(l.uniqueItems=i.uniqueItems),l.type==="array"&&i.items&&typeof i.items=="object"&&!Array.isArray(i.items)&&(l.items=te({item:i.items},[]).find(d=>d.key==="item")),i.properties&&typeof i.properties=="object"&&(l.children=te(i.properties,Array.isArray(i.required)?i.required:[])),l}):[],Ze=({schema:t,onChange:a,includeMetadata:s=!0})=>{const{properties:n,metadata:i}=v.useMemo(()=>Ye(t),[t]),r=n,l=i||{title:"",description:"",version:""},d=v.useCallback(()=>({id:ae(),key:"",type:"string",required:!1}),[]),C=v.useCallback((c,o)=>{const k=r.some(D=>D.id===c);let E;k?E=r.map(D=>D.id===c?o:D):E=[...r,o];const O=K(E,l,s);a(O)},[r,l,s,a]),u=v.useCallback(c=>{const o=r.filter(E=>E.id!==c),k=K(o,l,s);a(k)},[r,l,s,a]),g=v.useCallback(()=>{const o=K([],{title:"",description:"",version:""},s);a(o)},[s,a]),h=v.useCallback((c,o)=>{const k={...l,[c]:o},E=K(r,k,s);a(E)},[r,l,s,a]),j=v.useCallback(async()=>{const c=await Ge();a(c)},[a]),b=v.useCallback(()=>{ve(t,"schema.json")},[t]);return{properties:r,metadata:l,addProperty:d,updateProperty:C,deleteProperty:u,clearAll:g,updateMetadata:h,importSchema:j,downloadSchema:b}};function et(){const[t,a]=v.useState("light");v.useEffect(()=>{const i=localStorage.getItem("theme")||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");a(i),document.documentElement.classList.toggle("dark",i==="dark")},[]);const s=()=>{const n=t==="light"?"dark":"light";a(n),localStorage.setItem("theme",n),document.documentElement.classList.toggle("dark",n==="dark")};return e.jsx(T,{variant:"ghost",size:"icon",onClick:s,"data-testid":"button-theme-toggle",children:t==="light"?e.jsx(f.Moon,{className:"w-4 h-4"}):e.jsx(f.Sun,{className:"w-4 h-4"})})}function tt({schema:t,onChange:a,showMetadata:s=!1,showImport:n=!0,showClear:i=!0,showOutput:r=!0,showHeader:l=!0,className:d="",showSummary:C=!1,typeLabels:u,propertyLabel:g={singular:"property",plural:"properties"},showRegex:h=!1,keyEditable:j=!1,readonly:b=!1}){const{properties:c,metadata:o,addProperty:k,updateProperty:E,deleteProperty:O,clearAll:D,updateMetadata:p,importSchema:R}=Ze({schema:t,onChange:a??(()=>{}),includeMetadata:s}),L=ie({createInitialData:()=>k(),onConfirm:S=>{E(S.id,S)}}),U=()=>{D()},m=async()=>{await R()};return e.jsx(_e,{config:{typeLabels:u,propertyLabel:g,showRegex:h,keyEditable:j,readonly:b},children:e.jsxs("div",{className:`${d} flex flex-col json-schema-builder-react`,children:[l&&e.jsx("header",{className:"h-16 border-b flex items-center justify-between px-6",children:e.jsxs("div",{className:"flex items-center gap-3",children:[!b&&n&&e.jsx(T,{variant:"outline",size:"sm",onClick:m,"data-testid":"button-import",children:e.jsx(f.Upload,{className:"w-4 h-4"})}),!b&&i&&e.jsx(T,{variant:"outline",size:"sm",onClick:U,disabled:c.length===0,"data-testid":"button-clear",children:e.jsx(f.Trash2,{className:"w-4 h-4"})}),e.jsx(et,{})]})}),e.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[e.jsx("div",{className:r?"w-3/5 border-r":"w-full",children:e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex-1 overflow-auto p-2 space-y-4",children:[s&&e.jsx(We,{title:o.title,description:o.description,version:o.version,onUpdate:(S,B)=>p(S,B),readonly:b}),c.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-4 text-center",children:[!b&&e.jsx("div",{className:"w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4",children:e.jsx(f.Plus,{className:"w-8 h-8 text-muted-foreground"})}),e.jsxs("h2",{className:"text-lg font-medium mb-2",children:["No ",g.plural," yet"]}),!b&&e.jsxs(e.Fragment,{children:[e.jsxs("p",{className:"text-sm text-muted-foreground mb-6 max-w-sm",children:["Start building your JSON schema by adding your first"," ",g.singular]}),e.jsxs(T,{onClick:()=>L.open(),"data-testid":"button-add-first",children:[e.jsx(f.Plus,{className:"w-4 h-4 mr-2"}),"Add ",g.singular]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-1",children:c.map(S=>e.jsx(Z,{property:S,onUpdate:B=>E(S.id,B),onDelete:()=>O(S.id)},S.id))}),C&&e.jsxs("div",{className:"pt-4 border-t flex items-center justify-between text-sm text-muted-foreground",children:[e.jsxs("span",{children:[c.length," ",c.length===1?g.singular:g.plural]}),e.jsxs("span",{children:[c.filter(S=>S.required).length," required"]})]})]})]}),c.length>0&&!b&&e.jsx("div",{className:"border-t p-2 pt-4 bg-background",children:e.jsxs(T,{onClick:()=>L.open(),className:"w-full",variant:"outline","data-testid":"button-add-property",children:[e.jsx(f.Plus,{className:"w-4 h-4"}),"Add ",g.singular]})})]})}),r&&e.jsx("div",{className:"w-2/5",children:e.jsx(Qe,{schema:t})})]}),L.isOpen&&L.data&&e.jsx(H,{property:L.data,open:L.isOpen,isNewProperty:!0,onOpenChange:L.setIsOpen,onSave:L.confirm})]})})}exports.JsonSchemaBuilder=tt;exports.PropertyEditDialog=H;
package/dist-lib/index.js CHANGED
@@ -39,18 +39,18 @@ const Qe = he(
39
39
  }
40
40
  }
41
41
  ), T = x.forwardRef(
42
- ({ className: t, variant: i, size: a, asChild: l = !1, ...n }, r) => /* @__PURE__ */ e(
43
- l ? qe : "button",
42
+ ({ className: t, variant: i, size: a, asChild: r = !1, ...n }, l) => /* @__PURE__ */ e(
43
+ r ? qe : "button",
44
44
  {
45
45
  className: p(Qe({ variant: i, size: a, className: t })),
46
- ref: r,
46
+ ref: l,
47
47
  ...n
48
48
  }
49
49
  )
50
50
  );
51
51
  T.displayName = "Button";
52
52
  const R = x.forwardRef(
53
- ({ className: t, type: i, ...a }, l) => /* @__PURE__ */ e(
53
+ ({ className: t, type: i, ...a }, r) => /* @__PURE__ */ e(
54
54
  "input",
55
55
  {
56
56
  type: i,
@@ -58,16 +58,16 @@ const R = x.forwardRef(
58
58
  "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
59
59
  t
60
60
  ),
61
- ref: l,
61
+ ref: r,
62
62
  ...a
63
63
  }
64
64
  )
65
65
  );
66
66
  R.displayName = "Input";
67
- const We = z.Provider, Ye = z.Root, Ze = z.Trigger, ye = x.forwardRef(({ className: t, sideOffset: i = 4, ...a }, l) => /* @__PURE__ */ e(z.Portal, { children: /* @__PURE__ */ e(
67
+ const We = z.Provider, Ye = z.Root, Ze = z.Trigger, ye = x.forwardRef(({ className: t, sideOffset: i = 4, ...a }, r) => /* @__PURE__ */ e(z.Portal, { children: /* @__PURE__ */ e(
68
68
  z.Content,
69
69
  {
70
- ref: l,
70
+ ref: r,
71
71
  sideOffset: i,
72
72
  className: p(
73
73
  "z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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 origin-[--radix-tooltip-content-transform-origin]",
@@ -77,10 +77,10 @@ const We = z.Provider, Ye = z.Root, Ze = z.Trigger, ye = x.forwardRef(({ classNa
77
77
  }
78
78
  ) }));
79
79
  ye.displayName = z.Content.displayName;
80
- const Q = w.Root, W = w.Value, H = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
80
+ const Q = w.Root, W = w.Value, H = x.forwardRef(({ className: t, children: i, ...a }, r) => /* @__PURE__ */ s(
81
81
  w.Trigger,
82
82
  {
83
- ref: l,
83
+ ref: r,
84
84
  className: p(
85
85
  "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
86
86
  t
@@ -119,7 +119,7 @@ const xe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
119
119
  }
120
120
  ));
121
121
  xe.displayName = w.ScrollDownButton.displayName;
122
- const _ = x.forwardRef(({ className: t, children: i, position: a = "popper", ...l }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
122
+ const _ = x.forwardRef(({ className: t, children: i, position: a = "popper", ...r }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
123
123
  w.Content,
124
124
  {
125
125
  ref: n,
@@ -129,7 +129,7 @@ const _ = x.forwardRef(({ className: t, children: i, position: a = "popper", ...
129
129
  t
130
130
  ),
131
131
  position: a,
132
- ...l,
132
+ ...r,
133
133
  children: [
134
134
  /* @__PURE__ */ e(ve, {}),
135
135
  /* @__PURE__ */ e(
@@ -156,10 +156,10 @@ const et = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
156
156
  }
157
157
  ));
158
158
  et.displayName = w.Label.displayName;
159
- const S = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
159
+ const S = x.forwardRef(({ className: t, children: i, ...a }, r) => /* @__PURE__ */ s(
160
160
  w.Item,
161
161
  {
162
- ref: l,
162
+ ref: r,
163
163
  className: p(
164
164
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
165
165
  t
@@ -193,12 +193,12 @@ const at = q.Root, it = q.Portal, be = x.forwardRef(({ className: t, ...i }, a)
193
193
  }
194
194
  ));
195
195
  be.displayName = q.Overlay.displayName;
196
- const Ne = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(it, { children: [
196
+ const Ne = x.forwardRef(({ className: t, children: i, ...a }, r) => /* @__PURE__ */ s(it, { children: [
197
197
  /* @__PURE__ */ e(be, {}),
198
198
  /* @__PURE__ */ s(
199
199
  q.Content,
200
200
  {
201
- ref: l,
201
+ ref: r,
202
202
  className: p(
203
203
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
204
204
  t
@@ -306,7 +306,7 @@ const re = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
306
306
  }
307
307
  ));
308
308
  re.displayName = "Textarea";
309
- const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), lt = (t, i, a = !1, l = !1) => {
309
+ const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), lt = (t, i, a = !1, r = !1) => {
310
310
  const n = (h, y) => {
311
311
  i({ ...t, [h]: y });
312
312
  };
@@ -321,7 +321,7 @@ const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g,
321
321
  }
322
322
  },
323
323
  handleKeyChange: (h) => {
324
- (a || l) && n("key", h);
324
+ (a || r) && n("key", h);
325
325
  },
326
326
  handleFieldChange: n,
327
327
  handleConstraintChange: (h, y) => {
@@ -348,15 +348,15 @@ const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g,
348
348
  keyEditable: !1,
349
349
  readonly: !1
350
350
  }, Ie = Ee(M);
351
- function dt({
351
+ function ot({
352
352
  children: t,
353
353
  config: i = {}
354
354
  }) {
355
- const a = { ...Z, ...i.typeLabels }, l = i.propertyLabel || M.propertyLabel, n = i.showRegex ?? M.showRegex, r = i.keyEditable ?? M.keyEditable, d = i.readonly ?? M.readonly, c = (C) => a[C] || C;
355
+ const a = { ...Z, ...i.typeLabels }, r = i.propertyLabel || M.propertyLabel, n = i.showRegex ?? M.showRegex, l = i.keyEditable ?? M.keyEditable, o = i.readonly ?? M.readonly, c = (C) => a[C] || C;
356
356
  return /* @__PURE__ */ e(
357
357
  Ie.Provider,
358
358
  {
359
- value: { getTypeLabel: c, typeLabels: a, propertyLabel: l, showRegex: n, keyEditable: r, readonly: d },
359
+ value: { getTypeLabel: c, typeLabels: a, propertyLabel: r, showRegex: n, keyEditable: l, readonly: o },
360
360
  children: t
361
361
  }
362
362
  );
@@ -368,15 +368,15 @@ function ee({
368
368
  property: t,
369
369
  open: i,
370
370
  onOpenChange: a,
371
- onSave: l,
371
+ onSave: r,
372
372
  isArrayItem: n = !1,
373
- isNewProperty: r = !1,
374
- propertyLabel: d,
373
+ isNewProperty: l = !1,
374
+ propertyLabel: o,
375
375
  showRegex: c,
376
376
  keyEditable: C,
377
377
  typeLabels: h
378
378
  }) {
379
- const y = Se(), f = h || y.typeLabels, v = d || y.propertyLabel, b = c ?? y.showRegex, m = C ?? y.keyEditable, [o, k] = P(t);
379
+ const y = Se(), f = h || y.typeLabels, v = o || y.propertyLabel, b = c ?? y.showRegex, m = C ?? y.keyEditable, [d, k] = P(t);
380
380
  ne(() => {
381
381
  i && k(t);
382
382
  }, [t, i]);
@@ -387,12 +387,12 @@ function ee({
387
387
  handleFieldChange: g,
388
388
  handleConstraintChange: E
389
389
  } = lt(
390
- o,
390
+ d,
391
391
  k,
392
- r,
392
+ l,
393
393
  m
394
394
  ), j = () => {
395
- o.title?.trim() && (l(o), a(!1));
395
+ d.title?.trim() && (r(d), a(!1));
396
396
  }, U = () => {
397
397
  k(t), a(!1);
398
398
  };
@@ -402,7 +402,7 @@ function ee({
402
402
  className: "max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0",
403
403
  "data-testid": "dialog-edit-property",
404
404
  children: [
405
- /* @__PURE__ */ e(we, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(ke, { children: r ? `Add ${v.singular}` : `Edit ${v.singular}` }) }),
405
+ /* @__PURE__ */ e(we, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(ke, { children: l ? `Add ${v.singular}` : `Edit ${v.singular}` }) }),
406
406
  /* @__PURE__ */ s("div", { className: "space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0", children: [
407
407
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
408
408
  /* @__PURE__ */ s(N, { className: "flex items-center gap-1.5", children: [
@@ -412,7 +412,7 @@ function ee({
412
412
  /* @__PURE__ */ s(
413
413
  Q,
414
414
  {
415
- value: o.type,
415
+ value: d.type,
416
416
  onValueChange: (u) => g("type", u),
417
417
  "data-testid": "select-type-dialog",
418
418
  children: [
@@ -439,7 +439,7 @@ function ee({
439
439
  /* @__PURE__ */ e(
440
440
  R,
441
441
  {
442
- value: o.title || "",
442
+ value: d.title || "",
443
443
  onChange: (u) => L(u.target.value),
444
444
  onBlur: O,
445
445
  placeholder: "Property Title",
@@ -447,23 +447,23 @@ function ee({
447
447
  required: !0
448
448
  }
449
449
  ),
450
- !r && o.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
450
+ !l && d.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
451
451
  "Key: ",
452
- o.key
452
+ d.key
453
453
  ] })
454
454
  ] }),
455
- (r || m) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
455
+ (l || m) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
456
456
  /* @__PURE__ */ e(N, { children: "Key" }),
457
457
  /* @__PURE__ */ e(
458
458
  R,
459
459
  {
460
- value: o.key,
460
+ value: d.key,
461
461
  onChange: (u) => D(u.target.value),
462
462
  placeholder: "property_key",
463
463
  "data-testid": "input-key-dialog"
464
464
  }
465
465
  ),
466
- !r && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
466
+ !l && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
467
467
  ] }),
468
468
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
469
469
  /* @__PURE__ */ e(N, { children: "Description" }),
@@ -471,29 +471,29 @@ function ee({
471
471
  re,
472
472
  {
473
473
  placeholder: "Optional description",
474
- value: o.description || "",
474
+ value: d.description || "",
475
475
  onChange: (u) => g("description", u.target.value),
476
476
  rows: 2,
477
477
  "data-testid": "input-edit-description"
478
478
  }
479
479
  )
480
480
  ] }),
481
- o.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
481
+ d.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
482
482
  /* @__PURE__ */ s(N, { className: "font-semibold text-xs text-muted-foreground", children: [
483
483
  f.array,
484
484
  " Items"
485
485
  ] }),
486
- o.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
486
+ d.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
487
487
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
488
488
  /* @__PURE__ */ e(N, { children: "Item Type" }),
489
489
  /* @__PURE__ */ s(
490
490
  Q,
491
491
  {
492
- value: o.items.type,
492
+ value: d.items.type,
493
493
  onValueChange: (u) => k({
494
- ...o,
494
+ ...d,
495
495
  items: {
496
- ...o.items,
496
+ ...d.items,
497
497
  type: u
498
498
  }
499
499
  }),
@@ -518,11 +518,11 @@ function ee({
518
518
  /* @__PURE__ */ e(
519
519
  R,
520
520
  {
521
- value: o.items.title || "",
521
+ value: d.items.title || "",
522
522
  onChange: (u) => k({
523
- ...o,
523
+ ...d,
524
524
  items: {
525
- ...o.items,
525
+ ...d.items,
526
526
  title: u.target.value
527
527
  }
528
528
  }),
@@ -536,7 +536,7 @@ function ee({
536
536
  variant: "ghost",
537
537
  size: "sm",
538
538
  className: "mt-2",
539
- onClick: () => k({ ...o, items: void 0 }),
539
+ onClick: () => k({ ...d, items: void 0 }),
540
540
  children: [
541
541
  "Remove ",
542
542
  f.array,
@@ -551,7 +551,7 @@ function ee({
551
551
  size: "sm",
552
552
  onClick: () => {
553
553
  k({
554
- ...o,
554
+ ...d,
555
555
  items: {
556
556
  id: Date.now().toString() + Math.random(),
557
557
  key: "item",
@@ -573,14 +573,14 @@ function ee({
573
573
  Y,
574
574
  {
575
575
  id: "prop-required",
576
- checked: o.required,
576
+ checked: d.required,
577
577
  onCheckedChange: (u) => g("required", u),
578
578
  "data-testid": "checkbox-edit-required"
579
579
  }
580
580
  ),
581
581
  /* @__PURE__ */ e(N, { htmlFor: "prop-required", className: "cursor-pointer", children: "Required field" })
582
582
  ] }),
583
- o.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
583
+ d.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
584
584
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
585
585
  f.string,
586
586
  " Constraints"
@@ -595,7 +595,7 @@ function ee({
595
595
  id: "min-length",
596
596
  type: "number",
597
597
  placeholder: "0",
598
- value: o.minLength || "",
598
+ value: d.minLength || "",
599
599
  onChange: (u) => E(
600
600
  "minLength",
601
601
  u.target.value ? parseInt(u.target.value) : void 0
@@ -612,7 +612,7 @@ function ee({
612
612
  id: "max-length",
613
613
  type: "number",
614
614
  placeholder: "∞",
615
- value: o.maxLength || "",
615
+ value: d.maxLength || "",
616
616
  onChange: (u) => E(
617
617
  "maxLength",
618
618
  u.target.value ? parseInt(u.target.value) : void 0
@@ -629,7 +629,7 @@ function ee({
629
629
  {
630
630
  id: "pattern",
631
631
  placeholder: "^[a-z]+$",
632
- value: o.pattern || "",
632
+ value: d.pattern || "",
633
633
  onChange: (u) => E("pattern", u.target.value),
634
634
  className: "font-mono text-sm",
635
635
  "data-testid": "input-edit-pattern"
@@ -638,13 +638,13 @@ function ee({
638
638
  ] }),
639
639
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
640
640
  /* @__PURE__ */ e(N, { children: "Enum Values" }),
641
- /* @__PURE__ */ e("div", { className: "space-y-2", children: [...o.enum || [], ""].map((u, I) => /* @__PURE__ */ e(
641
+ /* @__PURE__ */ e("div", { className: "space-y-2", children: [...d.enum || [], ""].map((u, I) => /* @__PURE__ */ e(
642
642
  R,
643
643
  {
644
- placeholder: I === (o.enum?.length || 0) ? "Add new value..." : "Enum value",
644
+ placeholder: I === (d.enum?.length || 0) ? "Add new value..." : "Enum value",
645
645
  value: u,
646
646
  onChange: (B) => {
647
- const K = B.target.value, J = o.enum || [];
647
+ const K = B.target.value, J = d.enum || [];
648
648
  if (I === J.length)
649
649
  K.trim() && E("enum", [
650
650
  ...J,
@@ -671,7 +671,7 @@ function ee({
671
671
  ] })
672
672
  ] })
673
673
  ] }),
674
- (o.type === "number" || o.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
674
+ (d.type === "number" || d.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
675
675
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ e("h4", { className: "text-sm font-medium inline", children: "Numeric Constraints" }) }),
676
676
  /* @__PURE__ */ e("div", { className: "space-y-4 p-4 pt-0", children: /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
677
677
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
@@ -682,7 +682,7 @@ function ee({
682
682
  id: "minimum",
683
683
  type: "number",
684
684
  placeholder: "-∞",
685
- value: o.minimum ?? "",
685
+ value: d.minimum ?? "",
686
686
  onChange: (u) => E(
687
687
  "minimum",
688
688
  u.target.value ? parseFloat(u.target.value) : void 0
@@ -699,7 +699,7 @@ function ee({
699
699
  id: "maximum",
700
700
  type: "number",
701
701
  placeholder: "∞",
702
- value: o.maximum ?? "",
702
+ value: d.maximum ?? "",
703
703
  onChange: (u) => E(
704
704
  "maximum",
705
705
  u.target.value ? parseFloat(u.target.value) : void 0
@@ -710,7 +710,7 @@ function ee({
710
710
  ] })
711
711
  ] }) })
712
712
  ] }),
713
- o.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
713
+ d.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
714
714
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
715
715
  f.array,
716
716
  " Constraints"
@@ -725,7 +725,7 @@ function ee({
725
725
  id: "min-items",
726
726
  type: "number",
727
727
  placeholder: "0",
728
- value: o.minItems || "",
728
+ value: d.minItems || "",
729
729
  onChange: (u) => E(
730
730
  "minItems",
731
731
  u.target.value ? parseInt(u.target.value) : void 0
@@ -742,7 +742,7 @@ function ee({
742
742
  id: "max-items",
743
743
  type: "number",
744
744
  placeholder: "∞",
745
- value: o.maxItems || "",
745
+ value: d.maxItems || "",
746
746
  onChange: (u) => E(
747
747
  "maxItems",
748
748
  u.target.value ? parseInt(u.target.value) : void 0
@@ -757,7 +757,7 @@ function ee({
757
757
  Y,
758
758
  {
759
759
  id: "unique-items",
760
- checked: o.uniqueItems || !1,
760
+ checked: d.uniqueItems || !1,
761
761
  onCheckedChange: (u) => E("uniqueItems", u),
762
762
  "data-testid": "checkbox-edit-unique"
763
763
  }
@@ -782,7 +782,7 @@ function ee({
782
782
  {
783
783
  onClick: j,
784
784
  "data-testid": "button-save",
785
- disabled: !o.title?.trim(),
785
+ disabled: !d.title?.trim(),
786
786
  children: "Save Changes"
787
787
  }
788
788
  )
@@ -792,41 +792,41 @@ function ee({
792
792
  ) });
793
793
  }
794
794
  function ue(t, i, a = {}) {
795
- const { allowEmpty: l = !1, onEditStart: n, onEditCancel: r } = a, [d, c] = P(!1), [C, h] = P(t);
795
+ const { allowEmpty: r = !1, onEditStart: n, onEditCancel: l } = a, [o, c] = P(!1), [C, h] = P(t);
796
796
  ne(() => {
797
- d || h(t);
798
- }, [t, d]);
797
+ o || h(t);
798
+ }, [t, o]);
799
799
  const y = () => {
800
800
  h(t), c(!0), n?.();
801
801
  }, f = (m) => {
802
802
  h(m);
803
803
  }, v = () => {
804
804
  const m = C.trim();
805
- if (!l && !m) {
805
+ if (!r && !m) {
806
806
  h(t), c(!1);
807
807
  return;
808
808
  }
809
809
  m !== t && i(m), c(!1);
810
810
  };
811
811
  return {
812
- isEditing: d,
812
+ isEditing: o,
813
813
  value: C,
814
814
  startEdit: y,
815
815
  handleChange: f,
816
816
  handleBlur: v,
817
817
  handleKeyDown: (m) => {
818
- m.key === "Enter" ? v() : m.key === "Escape" && (h(t), c(!1), r?.());
818
+ m.key === "Enter" ? v() : m.key === "Escape" && (h(t), c(!1), l?.());
819
819
  }
820
820
  };
821
821
  }
822
- function ot(t, i) {
823
- const [a, l] = P(!1);
822
+ function dt(t, i) {
823
+ const [a, r] = P(!1);
824
824
  return {
825
825
  isChangingType: a,
826
- setIsChangingType: l,
827
- handleTypeChange: (d) => {
828
- const c = { ...t, type: d };
829
- d !== "string" && (delete c.minLength, delete c.maxLength, delete c.pattern, delete c.enum), d !== "number" && d !== "integer" && (delete c.minimum, delete c.maximum), d !== "array" && (delete c.minItems, delete c.maxItems, delete c.uniqueItems, delete c.items), d !== "object" && delete c.children, i(c), l(!1);
826
+ setIsChangingType: r,
827
+ handleTypeChange: (o) => {
828
+ const c = { ...t, type: o };
829
+ o !== "string" && (delete c.minLength, delete c.maxLength, delete c.pattern, delete c.enum), o !== "number" && o !== "integer" && (delete c.minimum, delete c.maximum), o !== "array" && (delete c.minItems, delete c.maxItems, delete c.uniqueItems, delete c.items), o !== "object" && delete c.children, i(c), r(!1);
830
830
  },
831
831
  availableTypes: [
832
832
  "string",
@@ -840,52 +840,52 @@ function ot(t, i) {
840
840
  };
841
841
  }
842
842
  const le = () => `${Date.now()}-${Math.random()}`;
843
- function de(t = {}) {
844
- const { onConfirm: i, onCancel: a, createInitialData: l } = t, [n, r] = P(!1), [d, c] = P(null), C = (v) => {
845
- const b = v ?? (l ? l() : null);
846
- c(b), r(!0);
843
+ function oe(t = {}) {
844
+ const { onConfirm: i, onCancel: a, createInitialData: r } = t, [n, l] = P(!1), [o, c] = P(null), C = (v) => {
845
+ const b = v ?? (r ? r() : null);
846
+ c(b), l(!0);
847
847
  }, h = () => {
848
- r(!1), c(null), a?.();
848
+ l(!1), c(null), a?.();
849
849
  };
850
850
  return {
851
851
  isOpen: n,
852
- data: d,
852
+ data: o,
853
853
  open: C,
854
854
  close: h,
855
855
  confirm: (v) => {
856
- i?.(v), r(!1), c(null);
856
+ i?.(v), l(!1), c(null);
857
857
  },
858
858
  setIsOpen: (v) => {
859
- v ? r(!0) : h();
859
+ v ? l(!0) : h();
860
860
  }
861
861
  };
862
862
  }
863
863
  function ct(t, i) {
864
- const a = de({
864
+ const a = oe({
865
865
  createInitialData: () => ({
866
866
  id: le(),
867
867
  key: "",
868
868
  type: "string",
869
869
  required: !1
870
870
  }),
871
- onConfirm: (r) => {
871
+ onConfirm: (l) => {
872
872
  i({
873
873
  ...t,
874
- children: [...t.children || [], r]
874
+ children: [...t.children || [], l]
875
875
  });
876
876
  }
877
877
  });
878
878
  return {
879
879
  addChild: () => a.open(),
880
- updateChild: (r, d) => {
880
+ updateChild: (l, o) => {
881
881
  const c = t.children.map(
882
- (C) => C.id === r ? d : C
882
+ (C) => C.id === l ? o : C
883
883
  );
884
884
  i({ ...t, children: c });
885
885
  },
886
- deleteChild: (r) => {
887
- const d = t.children.filter((c) => c.id !== r);
888
- i({ ...t, children: d });
886
+ deleteChild: (l) => {
887
+ const o = t.children.filter((c) => c.id !== l);
888
+ i({ ...t, children: o });
889
889
  },
890
890
  addChildDialog: {
891
891
  isOpen: a.isOpen,
@@ -899,10 +899,10 @@ function te({
899
899
  property: t,
900
900
  onUpdate: i,
901
901
  onDelete: a,
902
- level: l = 1,
902
+ level: r = 1,
903
903
  isArrayItem: n = !1
904
904
  }) {
905
- const { getTypeLabel: r, typeLabels: d, showRegex: c, keyEditable: C, readonly: h } = Se(), y = de(), f = ue(
905
+ const { getTypeLabel: l, typeLabels: o, showRegex: c, keyEditable: C, readonly: h } = Se(), y = oe(), f = ue(
906
906
  t.title || t.key || "",
907
907
  (g) => i({ ...t, title: g }),
908
908
  { allowEmpty: !1 }
@@ -910,21 +910,21 @@ function te({
910
910
  t.description || "",
911
911
  (g) => i({ ...t, description: g || void 0 }),
912
912
  { allowEmpty: !0 }
913
- ), b = ot(t, i), m = ct(t, i), o = `h${Math.min(l, 6)}`, k = t.type === "object", L = k && t.children && t.children.length > 0, O = {
913
+ ), b = dt(t, i), m = ct(t, i), d = `h${Math.min(r, 6)}`, k = t.type === "object", L = k && t.children && t.children.length > 0, O = {
914
914
  1: "text-lg font-semibold",
915
915
  2: "text-base",
916
916
  3: "text-base",
917
917
  4: "text-base",
918
918
  5: "text-sm",
919
919
  6: "text-sm"
920
- }[l] || "text-sm", D = {
920
+ }[r] || "text-sm", D = {
921
921
  1: "h-5 w-5",
922
922
  2: "h-4 w-4",
923
923
  3: "h-4 w-4",
924
924
  4: "h-4 w-4",
925
925
  5: "h-4 w-4",
926
926
  6: "h-4 w-4"
927
- }[l] || "h-5 w-5";
927
+ }[r] || "h-5 w-5";
928
928
  return /* @__PURE__ */ s("div", { className: "group", children: [
929
929
  /* @__PURE__ */ s("div", { className: "flex gap-4 items-center rounded-md -mx-2 px-2 py-1 transition-colors hover:bg-accent/50", children: [
930
930
  /* @__PURE__ */ e("div", { className: "flex-1 min-w-0", children: /* @__PURE__ */ s("div", { className: "flex items-start gap-3", children: [
@@ -957,7 +957,7 @@ function te({
957
957
  ) : /* @__PURE__ */ s("div", { className: "flex gap-2 flex-wrap flex-1", children: [
958
958
  /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
959
959
  /* @__PURE__ */ e(
960
- o,
960
+ d,
961
961
  {
962
962
  className: h ? `${O} leading-none` : `${O} cursor-pointer hover:text-primary transition-colors leading-none`,
963
963
  onClick: h ? void 0 : f.startEdit,
@@ -973,7 +973,7 @@ function te({
973
973
  onOpenChange: b.setIsChangingType,
974
974
  children: [
975
975
  /* @__PURE__ */ e(H, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(W, {}) }),
976
- /* @__PURE__ */ e(_, { children: b.availableTypes.map((g) => /* @__PURE__ */ e(S, { value: g, children: d[g] }, g)) })
976
+ /* @__PURE__ */ e(_, { children: b.availableTypes.map((g) => /* @__PURE__ */ e(S, { value: g, children: o[g] }, g)) })
977
977
  ]
978
978
  }
979
979
  ) : /* @__PURE__ */ e(We, { children: /* @__PURE__ */ s(Ye, { children: [
@@ -1050,8 +1050,8 @@ function te({
1050
1050
  }
1051
1051
  ) }),
1052
1052
  /* @__PURE__ */ s(ye, { children: [
1053
- r(t.type),
1054
- t.type === "array" && t.items ? ` of ${r(t.items.type)}` : "",
1053
+ l(t.type),
1054
+ t.type === "array" && t.items ? ` of ${l(t.items.type)}` : "",
1055
1055
  !h && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to change type" })
1056
1056
  ] })
1057
1057
  ] }) }),
@@ -1135,14 +1135,14 @@ function te({
1135
1135
  L && /* @__PURE__ */ e(
1136
1136
  "div",
1137
1137
  {
1138
- className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1138
+ className: r === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1139
1139
  children: t.children.map((g) => /* @__PURE__ */ e(
1140
1140
  te,
1141
1141
  {
1142
1142
  property: g,
1143
1143
  onUpdate: (E) => m.updateChild(g.id, E),
1144
1144
  onDelete: () => m.deleteChild(g.id),
1145
- level: l + 1
1145
+ level: r + 1
1146
1146
  },
1147
1147
  g.id
1148
1148
  ))
@@ -1151,10 +1151,10 @@ function te({
1151
1151
  t.type === "array" && t.items && /* @__PURE__ */ s(
1152
1152
  "div",
1153
1153
  {
1154
- className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1154
+ className: r === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1155
1155
  children: [
1156
1156
  /* @__PURE__ */ s("div", { className: "mb-2 text-xs text-muted-foreground font-semibold uppercase", children: [
1157
- r("array"),
1157
+ l("array"),
1158
1158
  " Items"
1159
1159
  ] }),
1160
1160
  /* @__PURE__ */ e(
@@ -1163,7 +1163,7 @@ function te({
1163
1163
  property: t.items,
1164
1164
  onUpdate: (g) => i({ ...t, items: g }),
1165
1165
  onDelete: () => i({ ...t, items: void 0 }),
1166
- level: l + 1,
1166
+ level: r + 1,
1167
1167
  isArrayItem: !0
1168
1168
  }
1169
1169
  )
@@ -1195,7 +1195,7 @@ function te({
1195
1195
  )
1196
1196
  ] });
1197
1197
  }
1198
- const oe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1198
+ const de = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1199
1199
  "div",
1200
1200
  {
1201
1201
  ref: a,
@@ -1203,7 +1203,7 @@ const oe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1203
1203
  ...i
1204
1204
  }
1205
1205
  ));
1206
- oe.displayName = "Card";
1206
+ de.displayName = "Card";
1207
1207
  const mt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1208
1208
  "div",
1209
1209
  {
@@ -1244,28 +1244,28 @@ const pt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1244
1244
  pt.displayName = "CardFooter";
1245
1245
  const gt = () => new Promise((t, i) => {
1246
1246
  const a = document.createElement("input");
1247
- a.type = "file", a.accept = ".json", a.onchange = (l) => {
1248
- const n = l.target.files?.[0];
1247
+ a.type = "file", a.accept = ".json", a.onchange = (r) => {
1248
+ const n = r.target.files?.[0];
1249
1249
  if (!n) {
1250
1250
  i(new Error("No file selected"));
1251
1251
  return;
1252
1252
  }
1253
- const r = new FileReader();
1254
- r.onload = (d) => {
1253
+ const l = new FileReader();
1254
+ l.onload = (o) => {
1255
1255
  try {
1256
- const c = JSON.parse(d.target?.result);
1256
+ const c = JSON.parse(o.target?.result);
1257
1257
  t(c);
1258
1258
  } catch {
1259
1259
  i(new Error("Invalid JSON file"));
1260
1260
  }
1261
- }, r.onerror = () => i(new Error("Failed to read file")), r.readAsText(n);
1261
+ }, l.onerror = () => i(new Error("Failed to read file")), l.readAsText(n);
1262
1262
  }, a.click();
1263
1263
  }), Te = (t, i = "schema.json") => {
1264
- const a = JSON.stringify(t, null, 2), l = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(l), r = document.createElement("a");
1265
- r.href = n, r.download = i, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
1264
+ const a = JSON.stringify(t, null, 2), r = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(r), l = document.createElement("a");
1265
+ l.href = n, l.download = i, document.body.appendChild(l), l.click(), document.body.removeChild(l), URL.revokeObjectURL(n);
1266
1266
  };
1267
1267
  function yt({ schema: t }) {
1268
- const [i, a] = P(!1), l = JSON.stringify(t, null, 2);
1268
+ const [i, a] = P(!1), r = JSON.stringify(t, null, 2);
1269
1269
  return /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1270
1270
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between p-4 border-b", children: [
1271
1271
  /* @__PURE__ */ e("h2", { className: "text-sm font-medium", children: "JSON Schema Output" }),
@@ -1276,7 +1276,7 @@ function yt({ schema: t }) {
1276
1276
  variant: "outline",
1277
1277
  size: "sm",
1278
1278
  onClick: async () => {
1279
- await navigator.clipboard.writeText(l), a(!0), setTimeout(() => a(!1), 2e3);
1279
+ await navigator.clipboard.writeText(r), a(!0), setTimeout(() => a(!1), 2e3);
1280
1280
  },
1281
1281
  "data-testid": "button-copy",
1282
1282
  children: i ? /* @__PURE__ */ e(Je, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Ve, { className: "w-4 h-4" })
@@ -1296,12 +1296,12 @@ function yt({ schema: t }) {
1296
1296
  )
1297
1297
  ] })
1298
1298
  ] }),
1299
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(oe, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1299
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(de, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1300
1300
  "pre",
1301
1301
  {
1302
1302
  className: "p-6 text-xs font-mono overflow-auto",
1303
1303
  "data-testid": "text-json-output",
1304
- children: /* @__PURE__ */ e("code", { children: l })
1304
+ children: /* @__PURE__ */ e("code", { children: r })
1305
1305
  }
1306
1306
  ) }) })
1307
1307
  ] });
@@ -1310,25 +1310,25 @@ function vt({
1310
1310
  title: t,
1311
1311
  description: i,
1312
1312
  version: a,
1313
- onUpdate: l,
1313
+ onUpdate: r,
1314
1314
  readonly: n = !1
1315
1315
  }) {
1316
- const [r, d] = P(!1);
1317
- return /* @__PURE__ */ s(oe, { className: "p-4", children: [
1316
+ const [l, o] = P(!1);
1317
+ return /* @__PURE__ */ s(de, { className: "p-4", children: [
1318
1318
  /* @__PURE__ */ s(
1319
1319
  T,
1320
1320
  {
1321
1321
  variant: "ghost",
1322
- onClick: () => d(!r),
1322
+ onClick: () => o(!l),
1323
1323
  className: "w-full justify-between px-2 h-auto hover:bg-transparent",
1324
1324
  "data-testid": "button-toggle-metadata",
1325
1325
  children: [
1326
1326
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium", children: "Schema Metadata" }),
1327
- r ? /* @__PURE__ */ e(se, { className: "w-4 h-4" }) : /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
1327
+ l ? /* @__PURE__ */ e(se, { className: "w-4 h-4" }) : /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
1328
1328
  ]
1329
1329
  }
1330
1330
  ),
1331
- r && /* @__PURE__ */ s("div", { className: "mt-4 space-y-4", children: [
1331
+ l && /* @__PURE__ */ s("div", { className: "mt-4 space-y-4", children: [
1332
1332
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
1333
1333
  /* @__PURE__ */ e(
1334
1334
  N,
@@ -1344,7 +1344,7 @@ function vt({
1344
1344
  id: "schema-title",
1345
1345
  placeholder: "My Schema",
1346
1346
  value: t,
1347
- onChange: (c) => l("title", c.target.value),
1347
+ onChange: (c) => r("title", c.target.value),
1348
1348
  "data-testid": "input-title",
1349
1349
  disabled: n
1350
1350
  }
@@ -1365,7 +1365,7 @@ function vt({
1365
1365
  id: "schema-description",
1366
1366
  placeholder: "Describe your schema...",
1367
1367
  value: i,
1368
- onChange: (c) => l("description", c.target.value),
1368
+ onChange: (c) => r("description", c.target.value),
1369
1369
  className: "resize-none",
1370
1370
  rows: 3,
1371
1371
  "data-testid": "input-schema-description",
@@ -1388,7 +1388,7 @@ function vt({
1388
1388
  id: "schema-version",
1389
1389
  placeholder: "1.0.0",
1390
1390
  value: a,
1391
- onChange: (c) => l("version", c.target.value),
1391
+ onChange: (c) => r("version", c.target.value),
1392
1392
  "data-testid": "input-version",
1393
1393
  disabled: n
1394
1394
  }
@@ -1398,14 +1398,14 @@ function vt({
1398
1398
  ] });
1399
1399
  }
1400
1400
  const V = (t, i, a = !0) => {
1401
- const l = {
1401
+ const r = {
1402
1402
  type: "object"
1403
1403
  };
1404
- a && i && (i.title && (l.title = i.title), i.description && (l.description = i.description));
1404
+ a && i && (i.title && (r.title = i.title), i.description && (r.description = i.description), i.version && (r.version = i.version));
1405
1405
  const n = ae(t);
1406
- Object.keys(n).length > 0 && (l.properties = n);
1407
- const r = t.filter((d) => d.required && d.key).map((d) => d.key);
1408
- return r.length > 0 && (l.required = r), l;
1406
+ Object.keys(n).length > 0 && (r.properties = n);
1407
+ const l = t.filter((o) => o.required && o.key).map((o) => o.key);
1408
+ return l.length > 0 && (r.required = l), r;
1409
1409
  }, ae = (t) => {
1410
1410
  const i = {};
1411
1411
  return t.forEach((a) => {
@@ -1415,8 +1415,8 @@ const V = (t, i, a = !0) => {
1415
1415
  type: a.items.type
1416
1416
  })), a.type === "object" && a.children && a.children.length > 0) {
1417
1417
  n.properties = ae(a.children);
1418
- const r = a.children.filter((d) => d.required && d.key).map((d) => d.key);
1419
- r.length > 0 && (n.required = r);
1418
+ const l = a.children.filter((o) => o.required && o.key).map((o) => o.key);
1419
+ l.length > 0 && (n.required = l);
1420
1420
  }
1421
1421
  i[a.key] = n;
1422
1422
  }), i;
@@ -1424,43 +1424,42 @@ const V = (t, i, a = !0) => {
1424
1424
  const i = {
1425
1425
  properties: []
1426
1426
  };
1427
- return (t.title || t.description) && (i.metadata = {
1427
+ return (t.title || t.description || t.version) && (i.metadata = {
1428
1428
  title: typeof t.title == "string" ? t.title : "",
1429
1429
  description: typeof t.description == "string" ? t.description : "",
1430
- version: "1.0.0"
1431
- // Default version
1430
+ version: typeof t.version == "string" ? t.version : "1.0.0"
1432
1431
  }), t.properties && typeof t.properties == "object" && (i.properties = ie(
1433
1432
  t.properties,
1434
1433
  Array.isArray(t.required) ? t.required : []
1435
1434
  )), i;
1436
- }, ie = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, l]) => {
1437
- const n = l;
1438
- let r = typeof n.type == "string" ? n.type : "string";
1439
- r === "string" && n.format === "filename" && (r = "file");
1440
- const d = {
1435
+ }, ie = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, r]) => {
1436
+ const n = r;
1437
+ let l = typeof n.type == "string" ? n.type : "string";
1438
+ l === "string" && n.format === "filename" && (l = "file");
1439
+ const o = {
1441
1440
  id: le(),
1442
1441
  key: a,
1443
1442
  title: typeof n.title == "string" ? n.title : void 0,
1444
- type: r,
1443
+ type: l,
1445
1444
  description: typeof n.description == "string" ? n.description : void 0,
1446
1445
  required: i.includes(a)
1447
1446
  };
1448
- return n.minLength !== void 0 && (d.minLength = n.minLength), n.maxLength !== void 0 && (d.maxLength = n.maxLength), n.pattern && (d.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (d.enum = n.enum), n.minimum !== void 0 && (d.minimum = n.minimum), n.maximum !== void 0 && (d.maximum = n.maximum), n.minItems !== void 0 && (d.minItems = n.minItems), n.maxItems !== void 0 && (d.maxItems = n.maxItems), n.uniqueItems && (d.uniqueItems = n.uniqueItems), d.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (d.items = ie(
1447
+ return n.minLength !== void 0 && (o.minLength = n.minLength), n.maxLength !== void 0 && (o.maxLength = n.maxLength), n.pattern && (o.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (o.enum = n.enum), n.minimum !== void 0 && (o.minimum = n.minimum), n.maximum !== void 0 && (o.maximum = n.maximum), n.minItems !== void 0 && (o.minItems = n.minItems), n.maxItems !== void 0 && (o.maxItems = n.maxItems), n.uniqueItems && (o.uniqueItems = n.uniqueItems), o.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (o.items = ie(
1449
1448
  { item: n.items },
1450
1449
  []
1451
- ).find((c) => c.key === "item")), n.properties && typeof n.properties == "object" && (d.children = ie(
1450
+ ).find((c) => c.key === "item")), n.properties && typeof n.properties == "object" && (o.children = ie(
1452
1451
  n.properties,
1453
1452
  Array.isArray(n.required) ? n.required : []
1454
- )), d;
1453
+ )), o;
1455
1454
  }) : [], bt = ({
1456
1455
  schema: t,
1457
1456
  onChange: i,
1458
1457
  includeMetadata: a = !0
1459
1458
  }) => {
1460
- const { properties: l, metadata: n } = Le(
1459
+ const { properties: r, metadata: n } = Le(
1461
1460
  () => xt(t),
1462
1461
  [t]
1463
- ), r = l, d = n || {
1462
+ ), l = r, o = n || {
1464
1463
  title: "",
1465
1464
  description: "",
1466
1465
  version: ""
@@ -1470,41 +1469,41 @@ const V = (t, i, a = !0) => {
1470
1469
  type: "string",
1471
1470
  required: !1
1472
1471
  }), []), C = F(
1473
- (m, o) => {
1474
- const k = r.some((D) => D.id === m);
1472
+ (m, d) => {
1473
+ const k = l.some((D) => D.id === m);
1475
1474
  let L;
1476
- k ? L = r.map((D) => D.id === m ? o : D) : L = [...r, o];
1475
+ k ? L = l.map((D) => D.id === m ? d : D) : L = [...l, d];
1477
1476
  const O = V(
1478
1477
  L,
1479
- d,
1478
+ o,
1480
1479
  a
1481
1480
  );
1482
1481
  i(O);
1483
1482
  },
1484
- [r, d, a, i]
1483
+ [l, o, a, i]
1485
1484
  ), h = F(
1486
1485
  (m) => {
1487
- const o = r.filter((L) => L.id !== m), k = V(
1488
- o,
1486
+ const d = l.filter((L) => L.id !== m), k = V(
1489
1487
  d,
1488
+ o,
1490
1489
  a
1491
1490
  );
1492
1491
  i(k);
1493
1492
  },
1494
- [r, d, a, i]
1493
+ [l, o, a, i]
1495
1494
  ), y = F(() => {
1496
- const o = V([], { title: "", description: "" }, a);
1497
- i(o);
1495
+ const d = V([], { title: "", description: "", version: "" }, a);
1496
+ i(d);
1498
1497
  }, [a, i]), f = F(
1499
- (m, o) => {
1500
- const k = { ...d, [m]: o }, L = V(
1501
- r,
1498
+ (m, d) => {
1499
+ const k = { ...o, [m]: d }, L = V(
1500
+ l,
1502
1501
  k,
1503
1502
  a
1504
1503
  );
1505
1504
  i(L);
1506
1505
  },
1507
- [r, d, a, i]
1506
+ [l, o, a, i]
1508
1507
  ), v = F(async () => {
1509
1508
  const m = await gt();
1510
1509
  i(m);
@@ -1512,8 +1511,8 @@ const V = (t, i, a = !0) => {
1512
1511
  Te(t, "schema.json");
1513
1512
  }, [t]);
1514
1513
  return {
1515
- properties: r,
1516
- metadata: d,
1514
+ properties: l,
1515
+ metadata: o,
1517
1516
  addProperty: c,
1518
1517
  updateProperty: C,
1519
1518
  deleteProperty: h,
@@ -1534,8 +1533,8 @@ function Nt() {
1534
1533
  variant: "ghost",
1535
1534
  size: "icon",
1536
1535
  onClick: () => {
1537
- const l = t === "light" ? "dark" : "light";
1538
- i(l), localStorage.setItem("theme", l), document.documentElement.classList.toggle("dark", l === "dark");
1536
+ const r = t === "light" ? "dark" : "light";
1537
+ i(r), localStorage.setItem("theme", r), document.documentElement.classList.toggle("dark", r === "dark");
1539
1538
  },
1540
1539
  "data-testid": "button-theme-toggle",
1541
1540
  children: t === "light" ? /* @__PURE__ */ e(Ue, { className: "w-4 h-4" }) : /* @__PURE__ */ e(Xe, { className: "w-4 h-4" })
@@ -1546,10 +1545,10 @@ function Et({
1546
1545
  schema: t,
1547
1546
  onChange: i,
1548
1547
  showMetadata: a = !1,
1549
- showImport: l = !0,
1548
+ showImport: r = !0,
1550
1549
  showClear: n = !0,
1551
- showOutput: r = !0,
1552
- showHeader: d = !0,
1550
+ showOutput: l = !0,
1551
+ showHeader: o = !0,
1553
1552
  className: c = "",
1554
1553
  showSummary: C = !1,
1555
1554
  typeLabels: h,
@@ -1560,7 +1559,7 @@ function Et({
1560
1559
  }) {
1561
1560
  const {
1562
1561
  properties: m,
1563
- metadata: o,
1562
+ metadata: d,
1564
1563
  addProperty: k,
1565
1564
  updateProperty: L,
1566
1565
  deleteProperty: O,
@@ -1572,7 +1571,7 @@ function Et({
1572
1571
  onChange: i ?? (() => {
1573
1572
  }),
1574
1573
  includeMetadata: a
1575
- }), j = de({
1574
+ }), j = oe({
1576
1575
  createInitialData: () => k(),
1577
1576
  onConfirm: (I) => {
1578
1577
  L(I.id, I);
@@ -1583,7 +1582,7 @@ function Et({
1583
1582
  await E();
1584
1583
  };
1585
1584
  return /* @__PURE__ */ e(
1586
- dt,
1585
+ ot,
1587
1586
  {
1588
1587
  config: {
1589
1588
  typeLabels: h,
@@ -1593,8 +1592,8 @@ function Et({
1593
1592
  readonly: b
1594
1593
  },
1595
1594
  children: /* @__PURE__ */ s("div", { className: `${c} flex flex-col json-schema-builder-react`, children: [
1596
- d && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1597
- !b && l && /* @__PURE__ */ e(
1595
+ o && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1596
+ !b && r && /* @__PURE__ */ e(
1598
1597
  T,
1599
1598
  {
1600
1599
  variant: "outline",
@@ -1618,14 +1617,14 @@ function Et({
1618
1617
  /* @__PURE__ */ e(Nt, {})
1619
1618
  ] }) }),
1620
1619
  /* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
1621
- /* @__PURE__ */ e("div", { className: r ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1620
+ /* @__PURE__ */ e("div", { className: l ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1622
1621
  /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-2 space-y-4", children: [
1623
1622
  a && /* @__PURE__ */ e(
1624
1623
  vt,
1625
1624
  {
1626
- title: o.title,
1627
- description: o.description,
1628
- version: o.version,
1625
+ title: d.title,
1626
+ description: d.description,
1627
+ version: d.version,
1629
1628
  onUpdate: (I, B) => g(I, B),
1630
1629
  readonly: b
1631
1630
  }
@@ -1694,7 +1693,7 @@ function Et({
1694
1693
  }
1695
1694
  ) })
1696
1695
  ] }) }),
1697
- r && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(yt, { schema: t }) })
1696
+ l && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(yt, { schema: t }) })
1698
1697
  ] }),
1699
1698
  j.isOpen && j.data && /* @__PURE__ */ e(
1700
1699
  ee,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-schema-builder-react",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A React component library for building and editing JSON schemas visually",
5
5
  "type": "module",
6
6
  "license": "MIT",