@vyuh/sanity-schema-system
Version:
Essential building block schemas for using the Sanity CMS with the Vyuh Framework
5 lines • 50.5 kB
JavaScript
import {defineType,defineField,set,unset,useClient}from'sanity';import {RxSection,RxValueNone,RxComponentBoolean,RxButton}from'react-icons/rx';import {FeatureDescriptor,DefaultFieldsModifier,BuiltContentSchemaBuilder,defaultLayoutConfiguration,ContentDescriptor,buildGroupsFromContentDescriptors,ContentSchemaBuilder,DefaultFieldGroupName}from'@vyuh/sanity-schema-core';import {BsFile,BsFileCode,BsWindow,BsFullscreen,BsLightningFill,BsCardImage,BsLayoutWtf}from'react-icons/bs';import {groupBy,flatMap}from'lodash-es';import {GrTextWrap}from'react-icons/gr';import {HiOutlineRectangleGroup,HiDocumentText,HiMiniDocumentText,HiDocumentDuplicate}from'react-icons/hi2';import {IoMdArrowForward,IoIosRefresh,IoMdArrowBack,IoMdGitBranch}from'react-icons/io';import {useState,useCallback,useEffect}from'react';import {Autocomplete,Card,Flex,Stack,Box,Text}from'@sanity/ui';import {SearchIcon,DocumentIcon,LinkIcon}from'@sanity/icons';import so from'lodash-es/uniqBy';import {jsxs,jsx}from'react/jsx-runtime';import {MdRestartAlt,MdDevices,MdCallToAction,MdOutlineAltRoute}from'react-icons/md';import {AiOutlineApi,AiOutlineLine}from'react-icons/ai';import {TfiLayoutCtaLeft,TfiLayoutAccordionMerged}from'react-icons/tfi';import {IoTabletPortraitOutline}from'react-icons/io5';import {FaCodeBranch,FaExternalLinkAlt}from'react-icons/fa';import {TbFlagCheck,TbAlertSquare,TbHourglass,TbApi}from'react-icons/tb';import {CgDarkMode,CgToolbarTop}from'react-icons/cg';import {FaPalette,FaUserCheck,FaVideo}from'react-icons/fa6';import {ImDrawer}from'react-icons/im';import {HiViewList}from'react-icons/hi';import {BiCategory}from'react-icons/bi';var Ai=Object.defineProperty;var ki=(e,i,t)=>i in e?Ai(e,i,{enumerable:true,configurable:true,writable:true,value:t}):e[i]=t;var o=(e,i,t)=>ki(e,typeof i!="symbol"?i+"":i,t);var Pe=defineType({name:"vyuh.region",title:"Region",type:"document",icon:RxSection,fields:[defineField({name:"identifier",title:"Identifier",type:"string",validation:e=>e.required()}),defineField({name:"title",title:"Title",type:"string",validation:e=>e.required()})],preview:{select:{title:"title",subtitle:"identifier"}}}),rt=defineType({title:"Region",name:"region",type:"object",icon:RxSection,fields:[defineField({title:"Region",name:"region",type:"reference",to:[{type:"vyuh.region"}],weak:true}),defineField({name:"items",title:"Items",type:"array",of:[],options:{insertMenu:{groups:[]}}})],preview:{select:{title:"region.title",subtitle:"region.identifier"}}});var ee=class ee extends ContentDescriptor{constructor(t){super(ee.schemaType,t);o(this,"annotations");o(this,"blocks");this.annotations=t.annotations??[],this.blocks=t.blocks??[];}};o(ee,"schemaType","vyuh.portableText");var y=ee,_=class extends ContentSchemaBuilder{constructor(){super(y.schemaType);o(this,"schema",defineType({title:"Portable Text",name:y.schemaType,type:"object",icon:GrTextWrap,fields:[defineField({name:"blocks",type:"array",of:[{title:"Block",type:"block",styles:[{title:"Normal",value:"normal"},{title:"H1",value:"h1"},{title:"H2",value:"h2"},{title:"H3",value:"h3"},{title:"H4",value:"h4"},{title:"H5",value:"h5"},{title:"H6",value:"h6"},{title:"Quote",value:"blockquote"}],lists:[{title:"Bullet",value:"bullet"},{title:"Number",value:"number"}],marks:{decorators:[{title:"Strong",value:"strong"},{title:"Emphasis",value:"em"},{title:"Strike Through",value:"strike-through"},{title:"Code",value:"code"},{title:"Underline",value:"underline"}],annotations:[]}}]})],preview:{select:{blocks:"blocks"},prepare(t){let a=t.blocks?.find(r=>r._type==="block")?.children?.find(r=>r._type==="span")?.text;return {title:"Portable Text",subtitle:`Blocks: ${t.blocks?.length??0} | Content: ${a??"---"}`}}}}));}build(t){let n=t,a=flatMap(n,m=>m.annotations),r=flatMap(n,m=>m.blocks),l=this.schema,s=l.fields.find(m=>m.name==="blocks"),p=s.of.find(m=>m.type=="block");return p.marks.annotations=a,s.of.push(...r),l}};var ie=class ie extends ContentDescriptor{constructor(i){super(ie.schemaType,i);}};o(ie,"schemaType","vyuh.card");var h=ie,te=class extends ContentSchemaBuilder{constructor(){super(h.schemaType);o(this,"schema",defineType({type:"object",name:h.schemaType,title:"Card",icon:BsCardImage,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"description",title:"Description",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"content",title:"Portable Text Content",type:y.schemaType,group:DefaultFieldGroupName.main,options:{collapsed:true,collapsible:true}}),defineField({name:"image",title:"Image",type:"image",options:{metadata:["lqip","blurhash"]},group:DefaultFieldGroupName.main}),defineField({name:"action",title:"Action",type:"vyuh.action",group:DefaultFieldGroupName.main}),defineField({name:"secondaryAction",title:"Secondary Action",type:"vyuh.action",group:DefaultFieldGroupName.main}),defineField({name:"tertiaryAction",title:"Tertiary Action",type:"vyuh.action",group:DefaultFieldGroupName.main})],preview:{select:{title:"title",subtitle:"description",media:"image"},prepare(t){return {title:`Card (${t.title??"---"})`,subtitle:t.subtitle,media:t.media}}}}));}build(t){return this.schema}},st=defineType({name:`${h.schemaType}.layout.default`,title:"Default",type:"object",fields:[defineField({name:"maxDescriptionLines",title:"Maximum Lines for Description",type:"number",initialValue:2})],preview:{select:{maxDescriptionLines:"maxDescriptionLines"},prepare(e){return {title:"Default",subtitle:`Max Description Lines: ${e.maxDescriptionLines??2}`}}}}),pt=defineType({name:`${h.schemaType}.layout.button`,title:"Button",type:"object",fields:[defineField({name:"buttonType",title:"Button Type",type:"string",initialValue:"filled",options:{list:[{title:"Filled",value:"filled"},{title:"Outlined",value:"outlined"},{title:"Text",value:"text"}]}}),defineField({name:"isStretched",title:"Is Stretched",type:"boolean",initialValue:false})],preview:{select:{buttonType:"buttonType",isStretched:"isStretched"},prepare(e){return {title:"Button",subtitle:`Type: ${e.buttonType??"filled"} | Stretched: ${e.isStretched??false}`}}}});var ne=class ne extends ContentDescriptor{constructor(t){super(ne.schemaType,t);o(this,"items");this.items=t.items??[];}};o(ne,"schemaType","vyuh.group");var f=ne,oe=class extends ContentSchemaBuilder{constructor(){super(f.schemaType);o(this,"schema",defineType({type:"object",name:f.schemaType,title:"Group",icon:HiOutlineRectangleGroup,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"description",title:"Description",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"items",title:"Items",type:"array",of:[],group:DefaultFieldGroupName.main,options:{insertMenu:{groups:[]}}})],preview:{select:{title:"title",items:"items",description:"description"},prepare({title:t,description:n,items:a}){return {title:`Group (${t??"---"})`,subtitle:`Items: ${(a??[]).length} | Description: ${n??"---"}`}}}}));}build(t){let a=flatMap(t,l=>l.items),r=this.schema.fields.find(l=>l.name==="items");return r.of=a,r.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,l=>l.items.map(s=>s.type)),this.schema}},ct=defineType({name:`${f.schemaType}.layout.carousel`,type:"object",title:"Carousel",fields:[defineField({name:"viewportFraction",title:"Viewport Fraction",description:"Max-width of an item as a fraction of the viewport",type:"number",initialValue:.75,options:{list:[{title:"0.25",value:.25},{title:"0.5",value:.5},{title:"0.75",value:.75},{title:"0.9",value:.9},{title:"1.0",value:1}]}})],preview:{select:{viewportFraction:"viewportFraction"},prepare({viewportFraction:e}){return {title:"Carousel",subtitle:`Viewport Fraction: ${e??"---"}`}}}}),mt=defineType({name:`${f.schemaType}.layout.grid`,type:"object",title:"Grid",fields:[defineField({name:"columns",title:"Columns",type:"number",validation:e=>e.min(1).max(4).required(),initialValue:2}),defineField({name:"scrollable",title:"Scrollable",type:"boolean",initialValue:false}),defineField({name:"aspectRatio",title:"Aspect Ratio",type:"number",options:{list:[{title:"1:1",value:1},{title:"4:3",value:1.33},{title:"3:4",value:.75},{title:"2:3",value:.67},{title:"2:1",value:2},{title:"1:2",value:.5},{title:"3:2",value:1.5}]},initialValue:1})],preview:{select:{columns:"columns",aspectRatio:"aspectRatio",scrollable:"scrollable"},prepare({columns:e,aspectRatio:i,scrollable:t}){return {title:"Grid",subtitle:`Columns: ${e} | Aspect Ratio: ${i} | Scrollable: ${t?"Yes":"No"}`}}}}),ut=defineType({name:`${f.schemaType}.layout.list`,type:"object",title:"List",fields:[defineField({name:"percentHeight",title:"Percent Height of Screen",type:"number",initialValue:.5,options:{list:[{title:"25%",value:.2},{title:"50%",value:.5},{title:"75%",value:.75},{title:"80%",value:.8},{title:"90%",value:.9},{title:"100%",value:1}]}})],preview:{select:{percentHeight:"percentHeight"},prepare(e){return {title:"Vertical List",subtitle:`Percent Height: ${e.percentHeight??"---"}`}}}});var Oe=defineType({name:"vyuh.empty",title:"Empty",type:"object",icon:RxValueNone,fields:[defineField({name:"title",title:"Title",type:"string"})],preview:{select:{title:"title"},prepare({title:e}){return {title:"Empty",subtitle:e}}}});var Xi=defineType({name:"caseItem",type:"object",fields:[defineField({name:"value",title:"Value",type:"string"}),defineField({name:"item",title:"Item",type:"array",of:[],validation:e=>e.length(1),options:{insertMenu:{groups:[]}}})]}),le=class le extends ContentDescriptor{constructor(t){super(le.schemaType,t);o(this,"items");this.items=t.items??[];}};o(le,"schemaType","vyuh.conditional");var D=le,re=class extends ContentSchemaBuilder{constructor(){super(D.schemaType);o(this,"schema",defineType({name:D.schemaType,title:"Conditional",type:"object",icon:IoMdGitBranch,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"condition",title:"Condition",type:"vyuh.condition",group:DefaultFieldGroupName.main}),defineField({name:"defaultCase",title:"Default Case",description:"Default case to use when the condition evaluation fails",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"cases",title:"Cases",type:"array",of:[Xi],group:DefaultFieldGroupName.main}),defineField({name:"showPending",title:"Show Pending Indicator",description:"Show a pending indicator when the condition is being evaluated",type:"boolean",initialValue:false,group:DefaultFieldGroupName.main})],preview:{select:{title:"title",condition:"condition",cases:"cases",defaultCase:"defaultCase"},prepare(t){let n=t.cases??[],a=t.defaultCase??"---",r=t.condition.configuration[0]?._type??"---";return {title:`Conditional (${t.title??"---"})`,subtitle:`Type: ${r} | Cases: ${n.length} | Default Case: ${a}`}}}}));}build(t){let n=t,a=this.schema,l=a.fields.find(s=>s.name==="cases").of[0].fields.find(s=>s.name==="item");return l.of=flatMap(n,s=>s.items),l.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,s=>s.items.map(p=>p.type)),a}};var po={apiVersion:"2024-10-01"},co=`
*[_type == "vyuh.route" && (path match "*" + $searchText + "*" || title match "*" + $searchText + "*")]
| order(path asc)
{ path, title }[0..10]
`;function mo(e){return so(e,t=>t.path).map(t=>({value:t.path,title:t.title,valid:true}))}var uo=e=>({value:e,title:e,valid:false});function Tt(e){let{onChange:i}=e,[t,n]=useState([]),[a,r]=useState(""),[l,s]=useState(false),p=useCallback(d=>{i(d?set(d):unset());},[i]),m=useCallback(d=>{r(d??"");},[]),u=useClient(po);return useEffect(()=>{(async()=>{if(!a)n([]),s(false);else try{s(!0);let c=await u.fetch(co,{searchText:a}),Ve=c.length>0?mo(c):[uo(a)];n(Ve);}finally{s(false);}})();},[a]),jsx(Autocomplete,{id:e.id,loading:l,filterOption:(d,c)=>true,icon:SearchIcon,options:t,onChange:p,onQueryChange:m,placeholder:"Search for a path or specify an external URL",renderOption:d=>jsx(Card,{as:"button",children:jsxs(Flex,{children:[jsx(Flex,{padding:1,align:"center",justify:"center",children:d.valid?jsx(DocumentIcon,{width:24,height:24}):jsx(LinkIcon,{width:24,height:24})}),jsxs(Stack,{padding:1,flex:1,children:[jsx(Box,{padding:1,children:jsx(Text,{children:d.value})}),jsx(Box,{padding:1,children:jsx(Text,{size:0,muted:true,children:d.title})})]})]})}),value:e.value,renderValue:(d,c)=>c?.value??d})}var pe=[defineField({name:"linkType",type:"string",title:"Link Type",options:{layout:"radio",list:[{value:"url",title:"Url"},{value:"route",title:"Route"}]},initialValue:"url"}),defineField({name:"url",type:"url",title:"Url",description:jsxs("div",{children:["Url to navigate to.",jsxs("ul",{children:[jsxs("li",{children:["Use a Url if you want to use a ",jsx("b",{children:"Conditional Route"}),"."]}),jsxs("li",{children:["Web Urls must start with ",jsx("code",{children:"http://"})," or"," ",jsx("code",{children:"https://"}),"."]}),jsxs("li",{children:["This can be used in conjunction with the"," ",jsx("code",{children:"CMS Path Resolver"})," for template routes."]})]})]}),components:{input:Tt},hidden:e=>e.parent?.linkType!=="url",validation:e=>e.custom((i,t)=>t.parent.linkType==="url"&&i===void 0?"Url is required":true).uri({allowRelative:true,scheme:["http","https","sms","tel","mailto"]})}),defineField({name:"route",title:"Route",type:"reference",to:[{type:"vyuh.route"},{type:"vyuh.conditionalRoute"}],weak:true,hidden:e=>e.parent?.linkType!=="route",validation:e=>e.custom((i,t)=>t.parent.linkType==="route"&&i===void 0?"Route is required":true)})];var bt=defineType({name:"vyuh.action.navigation",type:"object",title:"Navigation",icon:IoMdArrowForward,fields:[defineField({name:"title",type:"string",title:"Title"}),...pe,defineField({name:"navigationType",type:"string",options:{list:[{value:"go",title:"Go"},{value:"push",title:"Push"},{value:"replace",title:"Replace"}]},initialValue:"push"})],preview:{select:{linkType:"linkType",navigationType:"navigationType",route:"route.path",url:"url"},prepare(e){let i=e.route??e.url??"---";return {title:"Navigation",subtitle:`${e.linkType} | ${e.navigationType??"push"} | Path: ${i}`}}}});var vo=defineType({type:"object",title:"Linked Route",icon:BsFile,fields:[defineField({name:"title",title:"Title",type:"string",validation:e=>e.required()}),defineField({name:"description",title:"Description",type:"string"}),defineField({name:"identifier",title:"Identifier",type:"string",validation:e=>e.required()}),defineField({name:"route",title:"Route",type:"reference",to:[{type:"vyuh.route"}],weak:true,validation:e=>e.required()})]}),Ue=defineType({name:"vyuh.route.layout.tabs",type:"object",title:"Tab Layout",fields:[defineField({name:"routes",title:"Linked Routes",type:"array",of:[vo],validation:e=>[e.min(2),e.custom((i,t)=>{let n="drafts.",a=(i??[]).map(s=>s.route._ref.replace(n,"")),r=t.document._id.replace(n,"");return a.includes(r)?"Linked Route should not link to itself":true}),e.custom((i,t)=>{let n=(i??[]).map(l=>l.identifier),a=groupBy(n);return n.length>0&&n.length>Object.keys(a).length?`Duplicate identifier(s) found in the linked routes: [${Object.keys(a).filter(s=>a[s].length>1).join(", ")}]`:true})]})],preview:{select:{routes:"routes"},prepare(e){return {title:"Tab Layout",subtitle:(e.routes??[]).map(i=>i.title).join(", ")}}}});var It=defineType({name:"vyuh.condition.boolean",title:"Simple Boolean",type:"object",icon:RxComponentBoolean,fields:[defineField({name:"value",type:"boolean",title:"Value",description:jsxs("div",{children:["Returns the boolean state as one of:",jsxs("ul",{children:[jsx("li",{children:"true"}),jsx("li",{children:"false"})]})]})}),defineField({name:"evaluationDelayInSeconds",type:"number",title:"Evaluation Delay in seconds",initialValue:0,description:"A simulated delay on the Client side for evaluating this condition",validation:e=>e.min(0).max(5).integer(),options:{list:[0,1,3,5,7,10],layout:"radio",direction:"horizontal"}})],preview:{select:{value:"value",evaluationDelayInSeconds:"evaluationDelayInSeconds"},prepare(e){let i=e.evaluationDelayInSeconds??0,t=`${i} ${i===1?"second":"seconds"}`;return {title:"Boolean",subtitle:`Value: ${e.value??false} | Delay: ${t}`}}}});var me=class me extends ContentDescriptor{constructor(t){super(me.schemaType,t);o(this,"routeTypes");o(this,"regionItems");o(this,"lifecycleHandlers");this.regionItems=t.regionItems??[],this.lifecycleHandlers=t.lifecycleHandlers??[],this.routeTypes=t.routeTypes??[];}};o(me,"schemaType","vyuh.route");var C=me,ce=class extends ContentSchemaBuilder{constructor(){super(C.schemaType);o(this,"schema",defineType({name:C.schemaType,title:"Route",type:"document",icon:BsFile,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"routeType",title:"Route Type",group:DefaultFieldGroupName.main,type:"array",of:[]}),defineField({name:"path",title:"Path",type:"url",validation:t=>t.required().uri({allowRelative:true,relativeOnly:true}),group:DefaultFieldGroupName.main}),defineField({title:"Category",name:"category",type:"reference",to:[{type:"vyuh.category"}],group:DefaultFieldGroupName.main}),defineField({name:"regions",title:"Regions",type:"array",of:[rt],group:DefaultFieldGroupName.main}),defineField({name:"lifecycleHandlers",title:"Lifecycle Handlers",description:"The set of lifecycle handlers to use while this route is active",type:"array",of:[],group:DefaultFieldGroupName.configuration})],preview:{select:{title:"title",path:"path"},prepare(t){return {title:t.title,subtitle:t.path}}}}));}build(t){let n=t,a=flatMap(n,c=>c.regionItems),s=this.schema.fields.find(c=>c.name==="regions").of[0].fields.find(c=>c.name==="items");s.of=a,s.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,c=>c.regionItems.map(Ve=>Ve.type));let p=flatMap(n,c=>c.lifecycleHandlers),m=this.schema.fields.find(c=>c.name==="lifecycleHandlers");m.of=p;let u=flatMap(n,c=>c.routeTypes),d=this.schema.fields.find(c=>c.name==="routeType");return d.of=u,this.schema}};var de=class de extends ContentDescriptor{constructor(i){super(de.schemaType,i);}};o(de,"schemaType","vyuh.conditionalRoute");var S=de,ko=defineType({name:"caseItem",type:"object",fields:[defineField({name:"value",title:"Value",type:"string",validation:e=>e.required()}),defineField({name:"item",title:"Item",type:"reference",weak:true,to:[{type:C.schemaType},{type:S.schemaType}],validation:e=>e.required()})],preview:{select:{title:"value",item:"item"},prepare(e){return {title:e.title,subtitle:e.item?._ref??"---"}}}}),ue=class extends ContentSchemaBuilder{constructor(){super(S.schemaType);o(this,"schema",defineType({name:S.schemaType,title:"Conditional Route",type:"document",icon:MdOutlineAltRoute,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"path",title:"Path",type:"string",group:DefaultFieldGroupName.main}),defineField({title:"Category",name:"category",type:"reference",to:[{type:"vyuh.category"}],group:DefaultFieldGroupName.main}),defineField({name:"condition",title:"Condition",type:"vyuh.condition",group:DefaultFieldGroupName.main}),defineField({name:"defaultCase",title:"Default Case",description:"Default case to use when the condition evaluation fails",type:"string",group:DefaultFieldGroupName.main}),defineField({title:"Cases",name:"cases",type:"array",of:[ko],group:DefaultFieldGroupName.main})],preview:{select:{title:"title",subtitle:"path"}}}));}build(t){return this.schema}};var kt=defineType({name:"vyuh.action.javascript",type:"object",title:"JavaScript Action",icon:BsFileCode,fields:[defineField({name:"script",type:"text",title:"Script",validation:e=>e.required()}),defineField({name:"isAsync",type:"boolean",title:"Async",initialValue:false})],preview:{prepare(e){return {title:"<JavaScript>"}}}});var fe=class fe extends ContentDescriptor{constructor(i={}){super(fe.schemaType,i);}};o(fe,"schemaType","vyuh.divider");var w=fe,ye=class extends ContentSchemaBuilder{constructor(){super(w.schemaType);o(this,"schema",defineType({name:w.schemaType,title:"Divider",type:"object",icon:AiOutlineLine,fields:[defineField({name:"thickness",title:"Thickness",type:"number"}),defineField({name:"indent",title:"Indent",type:"number"})],preview:{select:{thickness:"thickness",indent:"indent"},prepare:({thickness:t,indent:n})=>({title:"Divider",subtitle:`Thickness: ${t||"Default"} | Indent: ${n||"Default"}`})}}));}build(t){return this.schema}};var ge=class ge extends ContentDescriptor{constructor(t){super(ge.schemaType,t);o(this,"items");this.items=t.items??[];}};o(ge,"schemaType","vyuh.accordion");var v=ge,Uo=defineType({name:`${v.schemaType}.item`,title:"Accordion Item",type:"object",icon:TfiLayoutCtaLeft,fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"content",title:"Content",type:"array",of:[],validation:e=>e.length(1),options:{insertMenu:{groups:[]}}})],preview:{select:{title:"title",content:"content"},prepare(e){return {title:`Accordion Item (${e.title??"---"})`,subtitle:`Content Items: ${e.content?.length??0}`}}}}),he=class extends ContentSchemaBuilder{constructor(){super(v.schemaType);o(this,"schema",defineType({type:"object",name:v.schemaType,title:"Accordion",icon:TfiLayoutAccordionMerged,fields:[defineField({name:"title",title:"Title",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"description",title:"Description",type:"string",group:DefaultFieldGroupName.main}),defineField({name:"items",title:"Items",type:"array",of:[Uo],group:DefaultFieldGroupName.main})],preview:{select:{title:"title",items:"items"},prepare(t){return {title:`Accordion (${t.title??"---"})`,subtitle:`Items: ${(t.items??[]).length}`}}}}));}build(t){let a=flatMap(t,s=>s.items),l=this.schema.fields.find(s=>s.name==="items").of[0].fields.find(s=>s.name==="content");return l.of=a,l.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,s=>s.items.map(p=>p.type)),this.schema}};var Mt=defineType({name:"vyuh.route.page",title:"Page",type:"object",icon:IoTabletPortraitOutline,fields:[defineField({name:"behavior",title:"Behavior",type:"string",initialValue:"material",options:{list:[{value:"material",title:"Material"},{value:"cupertino",title:"Cupertino"}]}})],preview:{select:{behavior:"behavior"},prepare({behavior:e}){return {title:"Page",subtitle:e}}}}),Vt=defineType({name:"vyuh.route.dialog",title:"Dialog",type:"object",icon:BsWindow,fields:[defineField({name:"behavior",title:"Behavior",type:"string",initialValue:"modalBottomSheet",options:{list:[{value:"modalBottomSheet",title:"Modal Bottom Sheet"},{value:"fullscreen",title:"Fullscreen"}]}})],preview:{select:{behavior:"behavior"},prepare({behavior:e}){return {title:"Dialog",subtitle:e}}}});var zo=defineType({type:"object",title:"Case-specific Action",icon:RxButton,fields:[defineField({name:"value",title:"Value",type:"string"}),defineField({name:"action",title:"Action",type:"vyuh.action"})]}),jt=defineType({name:"vyuh.action.conditional",type:"object",title:"Conditional Action",icon:FaCodeBranch,fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"condition",title:"Condition",type:"vyuh.condition"}),defineField({name:"defaultCase",title:"Default Case",description:"Default case to use when the condition evaluation fails",type:"string"}),defineField({name:"cases",title:"Cases",type:"array",of:[zo]})],preview:{select:{title:"title",condition:"condition",cases:"cases",defaultCase:"defaultCase"},prepare(e){let i=e.cases.map(a=>a.value).join(", "),t=e.defaultCase??"---";return {title:`Conditional Action ${e.title?`(${e.title})`:""}`,subtitle:`[${i}] (default: ${t})`}}}});var ve=defineType({type:"object",name:"vyuh.route.menu.action",title:"Menu Action",fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"icon",title:"Icon",type:"string",options:{list:[{value:"home",title:"Home"},{value:"category",title:"Category"},{value:"settings",title:"Settings"},{value:"account",title:"Account"},{value:"menu",title:"Menu"}]}}),defineField({name:"action",type:"vyuh.action",title:"Action"})],preview:{select:{title:"title",icon:"icon"},prepare(e){return {title:`Menu Action (${e.title??"---"})`,subtitle:e.icon}}}});var ze=defineType({name:"vyuh.route.layout.default",type:"object",title:"System Default",fields:[defineField({name:"showAppBar",title:"Show App Bar",type:"boolean",initialValue:true}),defineField({name:"useSafeArea",title:"Use Safe Area",type:"boolean",initialValue:true}),defineField({name:"actions",title:"Actions",type:"array",of:[ve]})],preview:{select:{showAppBar:"showAppBar",useSafeArea:"useSafeArea",actions:"actions"},prepare(e){let i=(e.actions??[]).map(t=>t.title).join(", ");return {title:"System Default",subtitle:`SafeArea: ${e.useSafeArea??false} | AppBar: ${e.showAppBar??false} | Actions: ${i.length}`}}}});var De=class De extends ContentDescriptor{constructor(t){super(De.schemaType,t);o(this,"configurations");this.configurations=t.configurations??[];}};o(De,"schemaType","vyuh.apiContent");var k=De,Te=class extends ContentSchemaBuilder{constructor(){super(k.schemaType);o(this,"schema",defineType({type:"object",name:k.schemaType,title:"API Content",icon:TbApi,fields:[defineField({name:"configuration",title:"Configuration",type:"array",of:[],options:{insertMenu:{groups:[]}}}),defineField({name:"showPending",title:"Show Pending",description:"Show visual feedback during the Pending state of the API",type:"boolean",initialValue:false}),defineField({name:"showError",title:"Show Error",description:"Show visual feedback for the Error state of the API",type:"boolean",initialValue:false})],preview:{select:{configuration:"configuration",showPending:"showPending",showError:"showError"},prepare({configuration:t,showError:n,showPending:a}){let r=t&&t[0];return {title:`API Content (${r?.title??r?._type})`,subtitle:`showPending: ${a??false} | showError: ${n??false}`}}}}));}build(t){let a=flatMap(t,l=>l.configurations),r=this.schema.fields.find(l=>l.name==="configuration");return r.of=a,r.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,l=>l.configurations.map(s=>s.name)),this.schema}};var qt=defineType({name:"nameValuePair",title:"Name-Value Pair",type:"object",fields:[{name:"name",title:"Name",type:"string"},{name:"value",title:"Value",type:"string"}]}),Ht=defineType({type:"object",name:"vyuh.apiContent.configuration.jsonPath",title:"JSON Path Configuration",icon:AiOutlineApi,fieldsets:[{name:"request",title:"Request"},{name:"response",title:"Response"}],fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"url",title:"API Endpoint Url",type:"url",fieldset:"request",validation:e=>e.required().uri({allowRelative:false,scheme:["https","http"]})}),defineField({name:"headers",title:"Request Headers",type:"array",of:[qt],fieldset:"request"}),defineField({name:"body",title:"Request Body",type:"array",of:[qt],fieldset:"request"}),defineField({name:"rootField",title:"Root Field",description:"JSON Path to the root field in the response",type:"string",fieldset:"response"}),defineField({name:"fieldMap",title:"Field Map",description:jsxs("div",{children:["Map the display fields to the JSON Paths from the payload.",jsx("br",{}),"Refer to ",jsx("a",{href:"https://jsonpath.com",children:"https://jsonpath.com"})," for more details."]}),type:"object",fieldset:"response",fields:[defineField({name:"title",title:"Title",description:'JSON Path expression to a "title" value',type:"string"}),defineField({name:"description",title:"Description",description:'JSON Path expression to a "description" value',type:"string"}),defineField({name:"imageUrl",title:"Image Url",description:'JSON Path expression to an "image url" value',type:"string"})]})],preview:{select:{url:"url"},prepare({url:e}){return {title:"JSON Path",subtitle:`Url: ${e}`}}}});var Ke=defineType({name:"vyuh.route.layout.single",type:"object",title:"Single Item Layout",fields:[defineField({name:"useSafeArea",title:"Use Safe Area",type:"boolean"}),defineField({name:"showAppBar",title:"Show App Bar",type:"boolean"}),defineField({name:"actions",title:"Actions",type:"array",of:[ve]})],preview:{select:{useSafeArea:"useSafeArea",showAppBar:"showAppBar",actions:"actions"},prepare(e){let i=(e.actions??[]).map(t=>t.title).join(", ");return {title:"Single Item Layout",subtitle:`Safe Area: ${e.useSafeArea?"Yes":"No"} | AppBar: ${e.showAppBar?"Yes":"No"} | Actions: ${i||"---"}`}}}});var be=class{constructor(){o(this,"name","modifier.conditionalLayout");}merge(i){}modify(i,t,n){let a=i,r=a.fields.find(p=>p.name==="layout");if(!r||r.of.length===0)return a;let l=buildGroupsFromContentDescriptors(t,p=>p.layouts.map(m=>m.name)),s=sn(a.name,r.of,l);return r.of.push(s),a}};function sn(e,i,t){let n=defineType({type:"object",fields:[defineField({name:"value",title:"Value",type:"string"}),defineField({name:"item",title:"Item",type:"array",of:[...i],validation:r=>r.length(1),options:{insertMenu:{groups:t}}})]});return defineType({name:`${e}.layout.conditional`,title:"Conditional Layout",type:"object",icon:BsLayoutWtf,fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"condition",title:"Condition",type:"vyuh.condition"}),defineField({name:"defaultCase",title:"Default Case",description:"Default case to use when the condition evaluation fails",type:"string"}),defineField({name:"cases",title:"Cases",type:"array",of:[n]})],preview:{select:{title:"title",condition:"condition",cases:"cases",defaultCase:"defaultCase"},prepare(r){let l=r.cases.map(p=>p.value).join(", "),s=r.defaultCase??"";return {title:`Conditional Layout (${r.title??"Untitled"})`,subtitle:`[${l}] (default: ${s})`}}}})}var Gt=defineType({name:"vyuh.action.routeRefresh",type:"object",title:"Route Refresh",icon:IoIosRefresh,fields:[defineField({name:"title",type:"string",title:"Title",initialValue:"Route Refresh",readOnly:true})],preview:{select:{title:"title"},prepare(e){return {title:"Route Refresh"}}}});var Qt=defineType({name:"vyuh.condition.featureFlag",title:"Feature Flag Condition",type:"object",icon:TbFlagCheck,fields:[defineField({name:"flagName",type:"string",title:"Flag Name",description:"Name of the Feature Flag",validation:e=>e.required()}),defineField({name:"dataType",type:"string",title:"Data Type",description:"Data type used for the Feature Flag value",validation:e=>e.required(),initialValue:"string",options:{list:[{value:"string",title:"String"},{value:"boolean",title:"Boolean"},{value:"number",title:"Number"},{value:"json",title:"JSON"}]}})],preview:{select:{flagName:"flagName",dataType:"dataType"},prepare(e){return {title:"Feature Flag",subtitle:`Name: ${e.flagName??"---"} | Type: ${e.dataType??"---"}`}}}});var Jt=defineType({name:"vyuh.action.restart",title:"Restart Application",type:"object",icon:MdRestartAlt,fields:[defineField({name:"title",title:"Title",initialValue:"Restart Application",type:"string",readOnly:true})]});var zt=defineType({name:"vyuh.action.toggleTheme",title:"Toggle Light/Dark Theme",type:"object",icon:CgDarkMode,fields:[defineField({name:"title",title:"Title",initialValue:"Toggle between light and dark theme",type:"string",readOnly:true})]});var Yt=defineType({name:"vyuh.condition.screenSize",title:"Current Screen Size",type:"object",icon:BsFullscreen,fields:[defineField({name:"title",type:"string",title:"Title",description:jsxs("div",{children:["Returns the current screen size as one of:",jsxs("ul",{children:[jsx("li",{children:"small"}),jsx("li",{children:"medium"}),jsx("li",{children:"large"}),jsx("li",{children:"xlarge"})]})]}),initialValue:"Current Screen Size",readOnly:true})]});var Zt=defineType({name:"vyuh.condition.themeMode",title:"Current Theme Mode",type:"object",icon:CgDarkMode,fields:[defineField({name:"title",type:"string",title:"Title",description:jsxs("div",{children:["Returns the current theme mode as one of:",jsxs("ul",{children:[jsx("li",{children:"light"}),jsx("li",{children:"dark"})]})]}),initialValue:"Current Theme Mode",readOnly:true})]});var ei=defineType({name:"vyuh.condition.platform",title:"Current Platform",type:"object",icon:MdDevices,fields:[defineField({name:"title",type:"string",title:"Title",description:jsxs("div",{children:["Returns the current platform as one of:",jsxs("ul",{children:[jsx("li",{children:"ios"}),jsx("li",{children:"android"}),jsx("li",{children:"web"})]})]}),initialValue:"Current Platform",readOnly:true})]});var oi={type:"object",name:"vyuh.condition.userAuthenticated",title:"User Authenticated",icon:FaUserCheck,fields:[{name:"title",title:"Title",type:"string",description:jsxs("div",{children:["Returns the current authentication state as one of:",jsxs("ul",{children:[jsx("li",{children:"true"}),jsx("li",{children:"false"})]})]}),initialValue:"User Authenticated",readonly:true}]};var ni=defineType({name:"vyuh.action.openUrl",type:"object",title:"Open Url",icon:FaExternalLinkAlt,fields:[defineField({name:"title",type:"string",title:"Title",initialValue:"Open Url"}),defineField({name:"url",type:"url",title:"Url",description:"A Url can be a http(s):, mailto:, sms:, or a tel: link",validation:e=>e.uri({scheme:["http","https","mailto","sms","tel"],allowRelative:false}).required()}),defineField({name:"mode",type:"string",title:"Launch Mode",description:"The launch behavior to use when invoking this url",initialValue:"platformDefault",options:{list:[{title:"Platform Default",value:"platformDefault"},{title:"In App",value:"inApp"},{title:"External App",value:"externalApp"}]}})],preview:{select:{title:"title",url:"url",mode:"mode"},prepare(e){return {title:e.title??"Open Url",subtitle:`Url: ${e.url??"---"} | Mode: ${e.mode??"---"}`}}}});var ai=defineType({name:"vyuh.action.navigation.back",type:"object",title:"Navigate Back",icon:IoMdArrowBack,fields:[defineField({name:"title",type:"string",title:"Title",initialValue:"Navigate Back",readOnly:true})],preview:{select:{title:"title"},prepare(e){return {title:"Navigate Back"}}}});var si=defineType({name:"vyuh.action.snackbar.show",type:"object",title:"Show Snack Bar",icon:CgToolbarTop,fields:[defineField({name:"title",type:"string",title:"Title"}),defineField({name:"showForSeconds",type:"number",title:"Duration to show (in seconds)",initialValue:3}),defineField({name:"allowClosing",type:"boolean",title:"Allow Closing",initialValue:false}),defineField({name:"behavior",type:"string",title:"Behavior",initialValue:"fixed",options:{list:[{title:"Fixed",value:"fixed"},{title:"Floating",value:"floating"}]}})],preview:{select:{title:"title",allowClosing:"allowClosing",behavior:"behavior",showForSeconds:"showForSeconds"},prepare(e){return {title:e.title??"Show Snack Bar",subtitle:`${e.allowClosing?"Allow Closing":"No Closing"} | ${e.behavior} | ${e.showForSeconds}s`}}}}),pi=defineType({name:"vyuh.action.snackbar.hide",type:"object",title:"Hide Snack Bar",icon:CgToolbarTop,fields:[defineField({name:"title",type:"string",title:"Title",initialValue:"Hide Snack Bar"}),defineField({name:"immediately",type:"boolean",title:"Hide Immediately",initialValue:false})],preview:{select:{title:"title",immediately:"immediately"},prepare(e){return {title:e.title??"Show Snack Bar",subtitle:`${e.immediately?"Hide Immediately":"Hide with Animation"}`}}}});var ci=defineType({name:"vyuh.action.openInDialog",type:"object",title:"Open in Dialog",icon:BsWindow,fields:[...pe,defineField({name:"behavior",title:"Dialog Behavior",type:"string",options:{list:[{value:"modalBottomSheet",title:"Modal Bottom Sheet"},{value:"fullscreen",title:"Full Screen"}]},initialValue:"modalBottomSheet"})],preview:{select:{linkType:"linkType",behavior:"behavior"},prepare(e){return {title:"Open in Dialog",subtitle:`${e.linkType??"---"} | ${e.behavior??"---"}`}}}});var mi=defineType({name:"vyuh.action.drawer",type:"object",title:"Open / Close Drawer",icon:ImDrawer,fields:[defineField({name:"title",type:"string",title:"Title",initialValue:"Drawer"}),defineField({name:"isEndDrawer",type:"boolean",title:"Is End Drawer",initialValue:false}),defineField({name:"actionType",title:"Drawer Action Type",type:"string",options:{list:[{value:"open",title:"Open Drawer"},{value:"close",title:"Close Drawer"}]},initialValue:"open"})],preview:{select:{title:"title",isEndDrawer:"isEndDrawer",actionType:"actionType"},prepare(e){return {title:e.title??"Drawer",subtitle:`${e.actionType} | ${e.isEndDrawer?"End Drawer":"Drawer"}`}}}});var Un=defineType({name:"vyuh.action.alert.userAction",title:"User Action",type:"object",icon:MdCallToAction,fields:[defineField({name:"title",type:"string",title:"Title",validation:e=>e.required()}),defineField({name:"action",type:"vyuh.action",title:"Action"})]}),di=defineType({name:"vyuh.action.alert",type:"object",title:"Show Alert",icon:TbAlertSquare,fields:[defineField({name:"title",type:"string",title:"Title",validation:e=>e.required()}),defineField({name:"message",type:"string",title:"Message"}),defineField({name:"actions",type:"array",of:[Un],title:"Actions"}),defineField({name:"barrierDismissible",type:"boolean",title:"Dismissible with outside tap/click",initialValue:true})],preview:{select:{title:"title",actions:"actions",barrierDismissible:"barrierDismissible"},prepare(e){let i=e.actions||[];return {title:"Show Alert",subtitle:`Title: ${e.title} | Actions: ${i.length} | Dismissible: ${e.barrierDismissible?"Yes":"No"}`}}}});var fi=defineType({name:"vyuh.action.delay",type:"object",title:"Delay",icon:TbHourglass,fields:[defineField({name:"milliseconds",title:"Milliseconds (ms)",type:"number",validation:e=>e.required(),initialValue:0}),defineField({name:"message",type:"string",title:"Message",initialValue:""})],preview:{select:{title:"title",milliseconds:"milliseconds",message:"message"},prepare(e){return {title:"Delay",subtitle:`Ms: ${e.milliseconds??"0"} | Message: ${e.message??"---"}`}}}});var we=class we extends ContentDescriptor{constructor(i){super(we.schemaType,i);}};o(we,"schemaType","vyuh.videoPlayer");var L=we,Se=class extends ContentSchemaBuilder{constructor(){super(L.schemaType);o(this,"schema",defineType({name:L.schemaType,title:"Video Player",type:"object",icon:FaVideo,fieldsets:[{name:"controls",title:"Controls",options:{columns:2}},{name:"video",title:"Video"}],fields:[defineField({name:"title",title:"Title",description:"A caption or a title that can be shown next to the video",type:"string"}),defineField({name:"linkType",type:"string",title:"Link Type",options:{layout:"radio",list:[{value:"url",title:"Url"},{value:"file",title:"File"}]},initialValue:"url",fieldset:"video"}),defineField({name:"url",title:"Url",type:"url",hidden:t=>t.parent?.linkType!=="url",validation:t=>t.custom((n,a)=>a.parent.linkType==="url"&&n===void 0?"Url is required":true).uri({allowRelative:false,scheme:["http","https"]}),fieldset:"video"}),defineField({name:"file",title:"File",type:"file",options:{accept:"video/*"},hidden:t=>t.parent?.linkType!=="file",validation:t=>t.custom((n,a)=>a.parent.linkType==="file"&&n===void 0?"File is required":true),fieldset:"video"}),defineField({name:"loop",title:"Loop",description:"Loop the video after reaching the end.",type:"boolean",initialValue:false,fieldset:"controls"}),defineField({name:"autoplay",title:"Autoplay",description:"Start playing the video automatically on launch.",type:"boolean",initialValue:false,fieldset:"controls"}),defineField({name:"muted",title:"Muted",description:"Mute the video on launch.",type:"boolean",initialValue:false,fieldset:"controls"})],preview:{select:{url:"url"},prepare({url:t}){return {title:"Video Player",subtitle:`Url: ${t??"---"}`}}}}));}build(t){return this.schema}};var Ie=class Ie extends ContentDescriptor{constructor(t){super(Ie.schemaType,t);o(this,"documentTypes",[]);o(this,"queryConfigurations",[]);o(this,"items",[]);this.documentTypes=t.documentTypes??[],this.items=t.items??[],this.queryConfigurations=t.queryConfigurations??[];}};o(Ie,"schemaType","vyuh.document.view");var I=Ie,xe=class extends ContentSchemaBuilder{constructor(){super(I.schemaType);o(this,"schema",defineType({name:I.schemaType,title:"Document View",type:"object",icon:HiDocumentText,fieldsets:[{name:"strategy",title:"Strategy"}],fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"loadStrategy",title:"Load Strategy",description:"How should the document be loaded?",type:"string",options:{list:[{title:"By Reference",value:"reference"},{title:"By Query",value:"query"}]},initialValue:"reference",fieldset:"strategy"}),defineField({name:"reference",title:"Document Reference",description:"A fixed reference to a document that should be loaded",type:"reference",weak:true,to:[],hidden:t=>t.parent.loadStrategy!=="reference",validation:t=>t.custom((n,a)=>a.parent.loadStrategy==="reference"&&n===void 0?"Document Reference is required":true),fieldset:"strategy"}),defineField({name:"query",title:"Document Query Configuration",description:"A custom query configuration for loading the document.",type:"array",of:[],options:{insertMenu:{groups:[]}},hidden:t=>t.parent.loadStrategy!=="query",validation:t=>t.custom((n,a)=>a.parent.loadStrategy==="query"&&n===void 0?"Query Configuration is required":true).length(1),fieldset:"strategy"}),defineField({name:"items",title:"Items",type:"array",of:[],options:{insertMenu:{groups:[]}}})],preview:{select:{title:"title",loadStrategy:"loadStrategy"},prepare({title:t,loadStrategy:n}){return {title:`Document (${t??"---"})`,subtitle:`Load Strategy: ${n??"---"}`}}}}));}build(t){let n=t,a=flatMap(n,u=>u.documentTypes),r=this.schema.fields.find(u=>u.name==="reference");r.to=a.length===0?[{type:"vyuh.route"}]:a;let l=flatMap(n,u=>u.queryConfigurations),s=this.schema.fields.find(u=>u.name==="query");s.of=l,s.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,u=>u.queryConfigurations.map(d=>d.type));let p=flatMap(n,u=>u.items),m=this.schema.fields.find(u=>u.name==="items");return m.of=p,m.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,u=>u.items.map(d=>d.type)),this.schema}};var Ae=class Ae extends ContentDescriptor{constructor(t){super(Ae.schemaType,t);o(this,"configurations",[]);this.configurations=t.configurations??[];}};o(Ae,"schemaType","vyuh.document.section");var M=Ae,Fe=class extends ContentSchemaBuilder{constructor(){super(M.schemaType);o(this,"schema",defineType({name:M.schemaType,title:"Document Section",type:"object",icon:HiMiniDocumentText,fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"configuration",title:"Configuration",type:"array",of:[],options:{insertMenu:{groups:[]}},validation:t=>t.required().length(1)})],preview:{select:{title:"title",configuration:"configuration"},prepare({title:t,configuration:n}){let a=n&&n[0];return {title:`Document Section (${t??"---"})`,subtitle:`Configuration: ${a?._type??"---"}`}}}}));}build(t){let a=flatMap(t,l=>l.configurations),r=this.schema.fields.find(l=>l.name==="configuration");return r.of=a,r.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,l=>l.configurations.map(s=>s.type)),this.schema}};var $e=class $e extends ContentDescriptor{constructor(t){super($e.schemaType,t);o(this,"queryConfigurations",[]);o(this,"listItemConfigurations",[]);this.queryConfigurations=t.queryConfigurations??[],this.listItemConfigurations=t.listItemConfigurations??[];}};o($e,"schemaType","vyuh.document.list");var T=$e,ke=class extends ContentSchemaBuilder{constructor(){super(T.schemaType);o(this,"schema",defineType({name:T.schemaType,title:"Document List",type:"object",icon:HiDocumentDuplicate,fields:[defineField({name:"title",title:"Title",type:"string"}),defineField({name:"query",title:"Query Configuration",type:"array",of:[],options:{insertMenu:{groups:[]}},validation:t=>t.required().length(1)}),defineField({name:"listItem",title:"List Item Configuration",type:"array",of:[],options:{insertMenu:{groups:[]}},validation:t=>t.required().length(1)})],preview:{select:{title:"title",query:"query",listItem:"listItem"},prepare({title:t,query:n,listItem:a}){let r=n&&n[0],l=a&&a[0];return {title:`Document List (${t??"---"})`,subtitle:`Query: ${r?._type??"---"} | List Item: ${l?._type??"---"}`}}}}));}build(t){let n=t,a=flatMap(n,p=>p.queryConfigurations),r=this.schema.fields.find(p=>p.name==="query");r.of=a,r.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,p=>p.queryConfigurations.map(m=>m.type));let l=flatMap(n,p=>p.listItemConfigurations),s=this.schema.fields.find(p=>p.name==="listItem");return s.of=l,s.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,p=>p.listItemConfigurations.map(m=>m.type)),this.schema}};var Di=defineType({name:`${T.schemaType}.layout.default`,title:"Default Document List Layout",type:"object",icon:HiViewList,fields:[defineField({name:"mode",title:"List View Mode",type:"string",initialValue:"list",options:{list:[{title:"List",value:"list"},{title:"Grid",value:"grid"}]}}),defineField({name:"aspectRatio",title:"Aspect Ratio",type:"number",initialValue:1,options:{list:[{title:"1:2",value:.5},{title:"2:3",value:.67},{title:"3:4",value:.75},{title:"1:1",value:1},{title:"3:2",value:1.5},{title:"4:3",value:1.33},{title:"2:1",value:2}]}}),defineField({name:"columns",title:"Columns",type:"number",initialValue:2,options:{list:[{title:"2 Columns",value:2},{title:"3 Columns",value:3},{title:"4 Columns",value:4}]},hidden:({parent:e})=>e?.mode!=="grid"})],preview:{select:{mode:"mode",aspectRatio:"aspectRatio",columns:"columns"},prepare(e){return {title:"Default Document List Layout",subtitle:[`Mode: ${e.mode??"list"}`,e.mode==="grid"?`Columns: ${e.columns??"---"}`:"",`Aspect Ratio: ${e.aspectRatio??"1.0"}`].filter(i=>i!=="").join(" | ")}}}});var bi=defineType({name:"vyuh.content.modifier.theme",type:"object",title:"Theme",icon:FaPalette,fields:[{name:"mode",title:"Mode",type:"string",initialValue:"light",options:{list:[{title:"Light",value:"light"},{title:"Dark",value:"dark"},{title:"System",value:"system"}]}}],preview:{select:{mode:"mode"},prepare(e){return {title:"Theme",subtitle:`Mode: ${e.mode??"light"}`}}}});var Re=class Re extends ContentDescriptor{constructor(i){super(Re.schemaType,i);}};o(Re,"schemaType","vyuh.category");var Y=Re,Be=class extends ContentSchemaBuilder{constructor(){super(Y.schemaType);o(this,"schema",defineType({name:"vyuh.category",title:"Category",type:"document",icon:BiCategory,fields:[defineField({name:"identifier",title:"Identifier",type:"string",validation:t=>t.required()}),defineField({name:"title",title:"Title",type:"string",validation:t=>t.required()})],preview:{select:{title:"title",subtitle:"identifier"}}}));}build(t){return this.schema}};var Me=class Me extends ContentDescriptor{constructor(t){super(Me.schemaType,t);o(this,"items");this.items=t.items??[];}};o(Me,"schemaType","vyuh.document");var V=Me,Le=class extends ContentSchemaBuilder{constructor(){super(V.schemaType);o(this,"schema",defineType({name:"vyuh.document",type:"document",title:"Document",icon:BsCardImage,fields:[defineField({name:"title",title:"Title",type:"string",validation:t=>t.required()}),defineField({name:"identifier",title:"Identifier",type:"slug",validation:t=>t.required(),options:{source:"title",maxLength:96}}),defineField({name:"description",title:"Description",type:"string"}),defineField({name:"items",title:"Items",type:"array",validation:t=>t.min(1),of:[],options:{insertMenu:{groups:[]}}})],preview:{select:{title:"title",items:"items"},prepare(t){let n=(t.items??[]).length;return {title:`Document (${t.title})`,subtitle:`Items: ${n}`}}}}));}build(t){let a=flatMap(t,l=>l.items),r=this.schema.fields.find(l=>l.name==="items");return r.of=a,r.options.insertMenu.groups=buildGroupsFromContentDescriptors(t,l=>l.items.map(s=>s.type)),this.schema}},wi=defineType({name:`${V.schemaType}.layout.default`,type:"object",title:"Default",fields:[defineField({name:"mode",title:"Render Mode",description:"Render as a single or a list of items",type:"string",initialValue:"single",options:{layout:"radio",list:[{title:"Single",value:"single"},{title:"List",value:"list"}]}})],preview:{select:{mode:"mode"},prepare(e){return {title:"Default Document Layout",subtitle:`Mode: ${e.mode??"single"}`}}}});var ot=[{type:h.schemaType},{type:f.schemaType},{type:D.schemaType},{type:w.schemaType},{type:k.schemaType},{type:L.schemaType}],X=[...ot,{type:y.schemaType},{type:v.schemaType}],Uc=new FeatureDescriptor({name:"system",title:"System",description:"Core System feature of the framework",contents:[new C({regionItems:[...X,{type:I.schemaType},{type:T.schemaType}],routeTypes:[Mt,Vt],layouts:[ze,Ue,Ke]}),new Y({layouts:[ze,Ue,Ke]}),new V({items:[...X],layouts:[wi]}),new h({layouts:[st,defineType({name:`${h.schemaType}.layout.listItem`,title:"List Item",type:"object",fields:[defineField({name:"title",title:"Title",type:"string",readOnly:true,initialValue:"List Item"})]}),pt]}),new D({items:X,layouts:[defaultLayoutConfiguration(`${D.schemaType}.layout.default`)]}),new S({layouts:[defaultLayoutConfiguration(`${S.schemaType}.layout.default`)]}),new f({items:X,layouts:[defaultLayoutConfiguration(`${f.schemaType}.layout.default`),ct,mt,ut]}),new y({blocks:ot,annotations:[defineType({name:"invokeAction",title:"Invoke Action",type:"object",icon:BsLightningFill,fields:[defineField({name:"action",title:"Action",type:"vyuh.action"})]})],layouts:[defaultLayoutConfiguration(`${y.schemaType}.layout.default`)]}),new w({layouts:[defaultLayoutConfiguration(`${w.schemaType}.layout.default`)]}),new v({items:[...ot,{type:y.schemaType}],layouts:[defaultLayoutConfiguration(`${v.schemaType}.layout.default`)]}),new k({configurations:[Ht]}),new I({documentTypes:[{type:"vyuh.document"}],items:[...X,{type:M.schemaType}],layouts:[defaultLayoutConfiguration(`${I.schemaType}.layout.default`)]}),new T({layouts:[Di]})],contentSchemaBuilders:[new ce,new ue,new BuiltContentSchemaBuilder(Pe),new Be,new Le,new te,new oe,new _,new re,new Se,new BuiltContentSchemaBuilder(Oe),new ye,new he,new Te,new xe,new Fe,new ke],contentSchemaModifiers:[new DefaultFieldsModifier({excludedSchemaTypes:[{type:Pe.name}]}),new be],contentModifiers:[bi],actions:[bt,ai,ci,ni,zt,Gt,kt,Jt,si,pi,