@uibot/application 0.18.0 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collection-application.js +9 -9
- package/dist/creation-aesthetic-review.d.ts +16 -0
- package/dist/creation-apps.d.ts +3 -0
- package/dist/creation-design-context.d.ts +28 -0
- package/dist/creation-edit-context.d.ts +6 -0
- package/dist/creation-http.d.ts +22 -2
- package/dist/creation-linked-spec.d.ts +3 -0
- package/dist/creation-prompt.d.ts +17 -0
- package/dist/creation-render-review.d.ts +74 -0
- package/dist/creation-requirements.d.ts +8 -1
- package/dist/creation-routes.d.ts +5 -1
- package/dist/creation-spec-prompt.d.ts +7 -1
- package/dist/creation-store.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +277 -221
- package/dist/prompt.d.ts +7 -1
- package/dist/studio-http.d.ts +3 -1
- package/dist/ui-craft-baseline.d.ts +4 -0
- package/package.json +12 -12
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
function te(e){return{...e,components:e.components,actions:e.actions??{},templates:e.templates??{}}}var ne=["SetState","ResetState","Request","Link","Validate","DisplayMessage","Login","Logout","CallMethod"],H={SetState:{name:"SetState",description:"Set a page state path to an evaluated declarative value",params:{path:{type:"string"},value:{description:"Literal or supported PropValue expression"}},generation:{evaluatedParams:["value"],prerequisites:["Declare the state path on the same page"],example:{action:"SetState",params:{path:"open",value:{_not:{_state:"open"}}}}}},ResetState:{name:"ResetState",description:"Restore paths from the supplied initial map; missing values become null",params:{paths:{type:"array",items:{type:"string"}},initial:{type:"object"}},generation:{evaluatedParams:[],prerequisites:["Supply literal initial values; omitting paths resets keys in initial"],example:{action:"ResetState",params:{paths:["open"],initial:{open:!1}}}}},Request:{name:"Request",description:"Execute a configured connection request",params:{connectionId:{type:"string"},request:{type:"object"},loadingPath:{type:"string"},responsePath:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:["connectionId","request"],prerequisites:["Host must inject the declared connection driver and secrets; Studio local Spec preview does not"],example:{action:"Request",params:{connectionId:"projects",request:{id:"list",connectionId:"projects",payload:{operation:"FindAll",resource:"projects"}},responsePath:"rows"}}}},Link:{name:"Link",description:"Emit navigation to a literal URL or page path",params:{path:{type:"string"},url:{type:"string"},target:{enum:["_self","_blank"]}},generation:{evaluatedParams:[],prerequisites:["Host handles navigation; local page paths must exist"],example:{action:"Link",params:{path:"/details"}}}},Validate:{name:"Validate",description:"Emit form validation event; does not itself throw for invalid fields",params:{formId:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host form:validate listener; prefer native required controls and Form.Submit"],example:{action:"Validate",params:{formId:"contact"}}}},DisplayMessage:{name:"DisplayMessage",description:"Emit an evaluated message for the host to display",params:{message:{description:"Literal or supported PropValue expression"},level:{enum:["info","success","warning","error"]},duration:{type:"number"}},generation:{evaluatedParams:["message"],prerequisites:["Requires host message:display listener"],example:{action:"DisplayMessage",params:{message:"Saved locally",level:"success"}}}},Login:{name:"Login",description:"Set a supplied local session user or request external login",params:{user:{type:"object"},provider:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host session/auth; setting a local user is not server authentication"],example:{action:"Login",params:{provider:"configured-provider"}}}},Logout:{name:"Logout",description:"Clear the local session and emit auth:logout",params:{},generation:{evaluatedParams:[],prerequisites:["Host owns server session invalidation"],example:{action:"Logout",params:{}}}},CallMethod:{name:"CallMethod",description:"Emit a call to an existing block method",params:{blockId:{type:"string"},method:{type:"string"},args:{type:"array"}},generation:{evaluatedParams:["args"],prerequisites:["Requires an explicitly documented installed block method/listener; never invent a method"],example:{action:"CallMethod",params:{blockId:"documented-block",method:"documented-method",args:[]}}}}};var z={navigation:["sidebar","navbar"],container:["default","fluid","boxed"],navigationStyle:["attached","floating"],offcanvas:["attached","floating"],sidebar:["expanded","folded","hover"]},re={navigation:"sidebar",container:"fluid",navigationStyle:"attached",offcanvas:"attached",sidebar:"expanded"};var Ne={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},Bn=Array.from(new Set(Object.values(Ne).flat()));var Vn=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var je=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],qn=[...je,"radius","font-display","font-body","font-mono"];var P=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),S=(e,t)=>Object.keys(e).every((n)=>t.includes(n)),R=(e,t)=>typeof e==="string"&&e.length>0&&e.length<=t,oe=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>0,L=(e)=>typeof e==="string"&&/^[A-Za-z0-9_]{1,64}$/.test(e),ie=(e,t=100)=>Array.isArray(e)&&e.length<=t&&e.every(L)&&new Set(e).size===e.length;function Ve(e){if(!P(e)||!S(e,["id","name","type","required","options","link","lookup","formula","rollup"])||!L(e.id)||!R(e.name,200)||!["singleLineText","longText","number","checkbox","date","singleSelect","multipleSelect","linkedRecord","lookup","formula","rollup"].includes(String(e.type))||e.required!==void 0&&typeof e.required!=="boolean")return!1;if(e.options!==void 0&&(!Array.isArray(e.options)||e.options.length>100||e.options.some((t)=>!P(t)||!S(t,["id","name"])||!L(t.id)||!R(t.name,200))||new Set(e.options.map((t)=>t.id)).size!==e.options.length))return!1;if(e.options!==void 0&&!["singleSelect","multipleSelect"].includes(String(e.type)))return!1;for(let[t,n,r]of[["linkedRecord","link",["collectionId","displayFieldId"]],["lookup","lookup",["linkFieldId","targetFieldId"]],["formula","formula",["expression"]],["rollup","rollup",["linkFieldId","targetFieldId","function"]]]){let o=e[n];if(e.type===t!==(o!==void 0))return!1;if(o!==void 0&&(!P(o)||!S(o,[...r])||r.some((i)=>!R(o[i],i==="expression"?2048:512))))return!1}return!0}function se(e){if(!P(e)||!S(e,["id","collectionId","descriptor","view","uibotCommit","authorId","createdAt","digest"])||!/^[a-f0-9]{64}$/.test(String(e.id))||!/^[a-f0-9]{64}$/.test(String(e.digest))||!/^[a-f0-9]{40}$/.test(String(e.uibotCommit))||!R(e.collectionId,512)||!R(e.authorId,512)||typeof e.createdAt!=="string"||!/^\d{4}-\d{2}-\d{2}T/.test(e.createdAt)||!Number.isFinite(Date.parse(e.createdAt)))return!1;try{if(new TextEncoder().encode(JSON.stringify(e)).length>131072)return!1}catch{return!1}let{descriptor:t,view:n}=e;if(!P(t)||!S(t,["id","name","schemaVersion","fields"])||t.id!==e.collectionId||!R(t.name,200)||!oe(t.schemaVersion)||!Array.isArray(t.fields)||t.fields.length<1||t.fields.length>100||!t.fields.every(Ve)||new Set(t.fields.map((i)=>i.id)).size!==t.fields.length)return!1;if(!P(n)||!S(n,["id","name","version","type","groupByFieldId","dateFieldId","search","filter","sort","columnOrder","hiddenColumns","columnWidths"])||!L(n.id)||!R(n.name,200)||!oe(n.version)||!ie(n.columnOrder)||!ie(n.hiddenColumns)||!P(n.columnWidths)||Object.values(n.columnWidths).some((i)=>typeof i!=="number"||!Number.isInteger(i)||i<72||i>800))return!1;let r=t.fields,o=(i)=>r.some((s)=>P(s)&&s.id===i);if([...n.columnOrder,...n.hiddenColumns,...Object.keys(n.columnWidths)].some((i)=>!o(i)))return!1;if(n.type!==void 0&&!["grid","kanban","gallery","calendar","form"].includes(String(n.type)))return!1;if(n.type==="kanban"&&!t.fields.some((i)=>i.id===n.groupByFieldId&&["singleSelect","checkbox"].includes(i.type)))return!1;if(n.type==="calendar"&&!t.fields.some((i)=>i.id===n.dateFieldId&&i.type==="date"))return!1;if(n.search!==void 0&&(typeof n.search!=="string"||n.search.length>200))return!1;if(n.sort!==void 0&&(!Array.isArray(n.sort)||n.sort.length>4||n.sort.some((i)=>!P(i)||!S(i,["fieldId","direction"])||!o(i.fieldId)||!["asc","desc"].includes(String(i.direction)))))return!1;return!0}import{parse as ho}from"yaml";class h extends Error{code;details;constructor(e,t,n){super(t);this.name="CompileSpecError",this.code=e,this.details=n}}function Ue(e,t){let n=Object.hasOwn(t,e)?t[e]:void 0;if(!n)throw new h("unknown-template",`unknown template "${e}"`,{template:e});let r=n.pages[0]?.blocks[0];if(!r||r.type!=="PageLayout")throw new h("invalid-shell-root",`template "${e}" root is not PageLayout`,{template:e});return r}function M(e,t,n,r){let o=e;if(e.template){if(n.has(e.template))throw new h("template-cycle",`template cycle at "${e.template}"`,{template:e.template});let i=Ue(e.template,t),s=new Set(n);s.add(e.template);let a={...i.slots,...e.slots};if(r&&!e.slots?.sidebar)delete a.sidebar;let l=e.children??i.children,c=e.events??i.events,p=e.visible??i.visible;return o={...i,...e.id?{id:e.id}:{},props:{...i.props,...e.props},slots:a,...l?{children:l}:{},...c?{events:c}:{},...p!==void 0?{visible:p}:{}},M(o,t,s,r)}return{...o,...o.children?{children:o.children.map((i)=>M(i,t,n,r))}:{},...o.slots?{slots:Object.fromEntries(Object.entries(o.slots).map(([i,s])=>[i,s.map((a)=>M(a,t,n,r))]))}:{}}}function $e(e){let t=(n)=>{if(n.template)return!0;if(n.children?.some(t))return!0;return Object.values(n.slots??{}).some((r)=>r.some(t))};return e.pages.some((n)=>n.blocks.some(t))}function ae(e,t){return e.map((n)=>{if("children"in n&&Array.isArray(n.children))return{type:"MenuGroup",props:{title:n.label},children:ae(n.children,t)};let r=n,o={label:r.label,href:r.path};if(r.icon)o.icon=r.icon;if(r.path===t)o.active=!0;return{type:"MenuLink",props:o}})}function qe(e){let t=e.menus?.items;if(!t?.length)return e;return{...e,pages:e.pages.map((n)=>({...n,blocks:n.blocks.map((r)=>{if(r.type!=="PageLayout")return r;if(r.slots?.sidebar?.length)return r;return{...r,slots:{...r.slots,sidebar:[{type:"PageSiderMenu",props:{title:n.title??r.props?.title??"Menu"},children:ae(t,n.path)}]}}})}))}}function W(e,t={}){let n=Boolean(e.menus?.items?.length),r=$e(e)?{...e,pages:e.pages.map((o)=>({...o,blocks:o.blocks.map((i)=>M(i,t,new Set,n))}))}:e;return qe(r)}function le(e,t){if(e===void 0)return;function n(){throw new h("invalid-layout","Invalid application or page layout",{...t?{pageId:t}:{}})}if(!e||typeof e!=="object"||Array.isArray(e))n();for(let[r,o]of Object.entries(e)){if(t!==void 0&&r==="inherit"&&typeof o==="boolean")continue;let i=z[r];if(!Object.hasOwn(z,r)||!i?.includes(o))n()}}function ce(e,t){if(le(e.layout),le(t.layout,t.id),!t.blocks.some((s)=>s.type==="PageLayout"&&s.props?.appearance!=="standalone")){if(!t.layout)return t.blocks;if(Object.keys(t.layout).some((a)=>a!=="inherit"&&a!=="container"))throw new h("invalid-layout","Standalone pages only support container layout",{pageId:t.id});if(t.blocks.some((a)=>a.type==="PageLayout"&&a.props?.appearance==="standalone"))return t.blocks.map((a)=>a.type==="PageLayout"?{...a,props:{...a.props,layout:{container:t.layout?.container??"fluid"}}}:a);return[{type:"PageLayout",props:{appearance:"standalone",layout:{container:t.layout.container??"fluid"}},children:t.blocks}]}if(!e.layout&&!t.layout)return t.blocks;let{inherit:r,...o}=t.layout??{},i={...re,...t.layout?.inherit===!1?{}:e.layout,...o};return t.blocks.map((s)=>s.type==="PageLayout"?{...s,props:{...s.props,layout:i}}:s)}function He(e){let t=new Map,n=new Map,r=new Map,o=(i,s)=>{if(i.id!==void 0){if(r.has(i.id)){let a=r.get(i.id);throw new h("duplicate-block-id",`Block id "${i.id}" is declared more than once`,{blockId:i.id,firstPageId:a,pageId:s})}r.set(i.id,s)}for(let a of i.children??[])o(a,s);for(let a of Object.values(i.slots??{}))for(let l of a)o(l,s)};return e.pages.forEach((i,s)=>{let a=t.get(i.id);if(a!==void 0)throw new h("duplicate-page-id",`Page id "${i.id}" is declared more than once`,{pageId:i.id,firstIndex:a,pageIndex:s});if(t.set(i.id,s),n.has(i.path)){let l=n.get(i.path);throw new h("duplicate-page-path",`Page path "${i.path}" is declared more than once`,{path:i.path,firstPageId:l,pageId:i.id})}n.set(i.path,i.id);for(let l of i.blocks)o(l,i.id)}),new Set(r.keys())}function ze(e,t,n){while(!0){let r=t.counter++,o=n?`${n}_${r}`:`${e}_${r}`;if(!t.reservedIds.has(o)&&!t.assignedIds.has(o))return o}}function G(e,t,n,r,o,i){let s=e.id??ze(t,r,i??o);if(r.assignedIds.has(s))throw new h("duplicate-block-id",`Block id "${s}" is declared more than once`,{blockId:s,pageId:t});r.assignedIds.add(s);let a=(e.children??[]).map((p)=>G(p,t,n,r,s,s)),l={};for(let[p,u]of Object.entries(e.slots??{}))l[p]=u.map((d)=>G(d,t,n,r,s,`${s}_${p}`));let c={id:s,pageId:t,type:e.type,...o?{parentId:o}:{},...e.props?{props:e.props}:{},...a.length?{children:a}:{},...Object.keys(l).length?{slots:l}:{},...e.events?{events:e.events}:{},...e.visible!==void 0?{visible:e.visible}:{},...e.template?{template:e.template}:{},...e.variant?{variant:e.variant}:{}};return n[s]=c,s}function Y(e,t={}){e=W(e,t);let r={counter:0,reservedIds:He(e),assignedIds:new Set},o=Object.create(null);return{version:"2.0",pages:e.pages.map((s)=>{let a=[];for(let l of ce(e,s))a.push(G(l,s.id,o,r));return{id:s.id,path:s.path,...s.title?{title:s.title}:{},rootBlockIds:a,...s.state?{state:s.state}:{},...s.auth?{auth:s.auth}:{},...s.lifecycle?{lifecycle:s.lifecycle}:{},...s.computed?{computed:s.computed}:{},...s.urlState?{urlState:s.urlState}:{}}}),...e.design?{design:e.design}:{},...e.connections?{connections:e.connections.map((s)=>({...s}))}:{},blocks:o}}var T=[{id:"_state",generation:{syntax:"page-state path",positions:["props","computed","action-value","visible"],example:{_state:"open"},prerequisite:"Declare the path on the same page"},bucket:"client",description:"Reads a value from the page state store"},{id:"_bindState",generation:{syntax:"page-state path",positions:["binding"],example:{_bindState:"name"},prerequisite:"Only installed controls implementing two-way binding"},bucket:"client",description:"Two-way state binding (read + write)"},{id:"_payload",generation:{syntax:"payload field",positions:["request-context"],example:{_payload:"name"},prerequisite:"Caller must supply request payload; ordinary preview props have no payload"},bucket:"client",description:"Request payload field"},{id:"_event",generation:{syntax:"event field",positions:["action-value"],example:{_event:"value"},prerequisite:"Only within an event action; permitted fields: type,name,value,checked,values"},bucket:"client",description:"Event payload field (e.g. form submit value)"},{id:"_global",generation:{syntax:"host-global field",positions:["host-context"],example:{_global:"configuredValue"},prerequisite:"Host-dependent and excluded from ordinary creation; no secrets"},bucket:"client",description:"Global (window) property access"},{id:"_if",generation:{syntax:"[condition, then, else]",positions:["props","computed","action-value"],example:{_if:[{_state:"open"},"Open","Closed"]}},bucket:"client",description:"Conditional ternary: [condition, then, else]"},{id:"_eq",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_eq:[{_state:"status"},"Active"]}},bucket:"client",description:"Equality: [a, b] → a === b"},{id:"_ne",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_ne:[{_state:"status"},"Active"]}},bucket:"client",description:"Inequality: [a, b] → a !== b"},{id:"_contains",generation:{syntax:"[haystack, needle]",positions:["props","computed","action-value","visible","predicate"],example:{_contains:[{_state:"name"},"orion"]}},bucket:"client",description:"Case-insensitive substring match: [haystack, needle] → haystack contains needle (empty needle → true)"},{id:"_gt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gt:[{_state:"count"},0]}},bucket:"client",description:"Greater-than for finite numbers: [a, b] → a > b. Non-numbers are false"},{id:"_lt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lt:[{_state:"count"},10]}},bucket:"client",description:"Less-than for finite numbers: [a, b] → a < b. Non-numbers are false"},{id:"_gte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gte:[{_state:"count"},0]}},bucket:"client",description:"Greater-or-equal for finite numbers: [a, b] → a >= b. Non-numbers are false"},{id:"_lte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lte:[{_state:"count"},10]}},bucket:"client",description:"Less-or-equal for finite numbers: [a, b] → a <= b. Non-numbers are false"},{id:"_in",generation:{syntax:"[value, array]",positions:["props","computed","action-value","visible","predicate"],example:{_in:[{_state:"status"},["Active","Draft"]]}},bucket:"client",description:"Membership: [value, array] → array includes value"},{id:"_not",generation:{syntax:"condition",positions:["props","computed","action-value","visible","predicate"],example:{_not:{_state:"open"}}},bucket:"client",description:"Logical NOT"},{id:"_and",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_and:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical AND over a list of conditions"},{id:"_or",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_or:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical OR over a list of conditions"},{id:"_user",generation:{syntax:"session user field",positions:["props","computed","action-value"],example:{_user:"name"},prerequisite:"Requires injected host session; no server ACL guarantee"},bucket:"client",description:"Current session user field (client-visible)"},{id:"_item",generation:{syntax:"item field or empty string",positions:["predicate","loop-props"],example:{_item:"name"},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list item in a loop scope"},{id:"_index",generation:{syntax:"ignored scalar marker",positions:["predicate","loop-props"],example:{_index:0},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list index in a loop scope"},{id:"_array.length",generation:{syntax:"array expression",positions:["props","computed","action-value"],example:{"_array.length":{_state:"rows"}}},bucket:"client",description:"Array length"},{id:"_string.concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{"_string.concat":["Hello ",{_state:"name"}]}},bucket:"client",description:"String concatenation over a list"},{id:"_number.add",generation:{syntax:"[left, right] (finite numbers)",positions:["action-value"],example:{"_number.add":[{_state:"count"},1]},prerequisite:"Both operands must evaluate to finite numbers or the action fails and writes nothing; use it in SetState value for counters (e.g. SetState count = count + 1), never for strings or arrays"},bucket:"client",description:"Finite number addition: [left, right] → left + right. Throws on non-number, non-finite or overflowing operands (no coercion, no fallback to 0)"},{id:"_computed",generation:{syntax:"computed name",positions:["props","computed","action-value","visible"],example:{_computed:"filtered"},prerequisite:"Declare page computed expression"},bucket:"client",description:"Reads a derived (computed) state value by name from the __computed namespace"},{id:"_filter",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_filter:[{_state:"rows"},{_eq:[{_item:"status"},"Active"]}]}},bucket:"client",description:"Filters an array: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_find",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_find:[{_state:"rows"},{_eq:[{_item:"name"},"Orion"]}]}},bucket:"client",description:"Finds the first matching element: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_len",generation:{syntax:"array/string/object expression",positions:["props","computed","action-value"],example:{_len:{_state:"rows"}}},bucket:"client",description:"Length of an array, string, or object (0 if empty)"},{id:"_concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{_concat:[[1],[2]]},prerequisite:"Concatenation is not numeric addition"},bucket:"client",description:"Concatenates a list: arrays are joined, otherwise values are string-concatenated"},{id:"_count",generation:{syntax:"array or [array, predicate?]",positions:["props","computed","action-value"],example:{_count:[{_state:"rows"}]}},bucket:"client",description:"Count of an array, or of elements matching a predicate: [array, predicate?]"},{id:"_groupCount",generation:{syntax:"[array, field]",positions:["props","computed","action-value"],example:{_groupCount:[{_state:"rows"},"status"]}},bucket:"client",description:"Counts array items by a field in one pass: [array, field] → { value: count }"},{id:"_sort",generation:{syntax:"[array, {by, order?, rank?}]",positions:["props","computed","action-value"],example:{_sort:[{_state:"rows"},{by:"name",order:"asc"}]}},bucket:"client",description:"Stable sort: [array, { by, order?: asc|desc, rank?: { field: values[] } }]. rank is enum order"},{id:"_js",generation:{syntax:"disabled",positions:[],example:{_js:"disabled"},prerequisite:"Arbitrary code execution is disabled; permissions do not enable it",disabled:!0},bucket:"client",description:"Legacy JS expression; execution is always disabled"}],B=new Set(T.map((e)=>e.id));var pe=new Set(ne),We=new Map(T.map((e)=>[e.id,e])),ge=new Set(["array","boolean","integer","null","number","object","string"]),me=new Set(["default","description","enum","items","properties","required","type"]);function de(e){if(!e)return[];return Object.keys(e)}function Ge(e){if(!e||e.type!=="array")return;let t=e.items;if(!t||typeof t!=="object"||t.type!=="object"||!t.properties)return;return new Set(Object.keys(t.properties))}function K(e,t,n){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let[r,o]of e.entries())K(o,`${t}[${r}]`,n);return}for(let[r,o]of Object.entries(e)){let i=t?`${t}.${r}`:r;n(r,o,i),K(o,i,n)}}function N(e,t,n,r,o,i,s,a){K(r,o,(l,c,p)=>{if((l==="_state"||l==="_bindState")&&typeof c==="string"){let u=c.split("."),d=u[0]??"";if(d==="__computed"){let g=u[1]??"";if(!s.has(g))e.push({code:"refs:computed-declared",message:`${t}: _computed "${g}" is not declared`,elementKey:n,path:p});return}if(!i.has(d))e.push({code:"refs:state-declared",message:`${t}: _state "${d}" is not declared in state`,elementKey:n,path:p})}if(l==="_computed"&&typeof c==="string"&&!s.has(c))e.push({code:"refs:computed-declared",message:`${t}: _computed "${c}" is not declared`,elementKey:n,path:p});if(l==="_item"&&typeof c==="string"&&c!==""&&a&&!a.has(c))e.push({code:"item:field-exists",message:`${t}: _item "${c}" is not in the item schema`,elementKey:n,path:p})})}function b(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function O(e){return b(e)&&Object.keys(e).some((t)=>t.startsWith("_"))}var ue=new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_not","_and","_or"]);function Ye(e,t){if(new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_filter","_find","_groupCount","_sort","_number.add"]).has(e)){if(!Array.isArray(t)||t.length!==2)return!1;if(e==="_groupCount")return typeof t[1]==="string";if(e==="_sort"){let r=t[1];if(!b(r))return!1;if(!(typeof r.by==="string"&&r.by.length>0||Array.isArray(r.by)&&r.by.length>0&&r.by.every((i)=>typeof i==="string"&&i.length>0)))return!1;if(r.order!==void 0&&r.order!=="asc"&&r.order!=="desc")return!1;if(r.rank!==void 0&&(!b(r.rank)||Object.values(r.rank).some((i)=>!Array.isArray(i))))return!1;return Object.keys(r).every((i)=>["by","order","rank"].includes(i))}return!0}if(e==="_if")return Array.isArray(t)&&t.length===3;if(e==="_and"||e==="_or")return Array.isArray(t)&&t.length>0;if(e==="_string.concat"||e==="_concat")return Array.isArray(t)&&t.length>0;if(e==="_count")return!Array.isArray(t)||t.length===1||t.length===2;if(e==="_index")return typeof t==="number"&&Number.isFinite(t);if(["_state","_bindState","_computed","_event","_global","_payload","_user"].includes(e))return typeof t==="string"&&t.length>0;if(e==="_item")return typeof t==="string";return!0}function fe(e){return e.enum===void 0||Array.isArray(e.enum)&&e.enum.length>0&&e.enum.every((t)=>t===null||typeof t==="string"||typeof t==="boolean"||typeof t==="number"&&Number.isFinite(t))}function I(e,t,n,r,o,i){if(n==="predicate"&&(!O(e)||!ue.has(Object.keys(e)[0]??"")))return r.push({code:"props:expression",message:`${o}: predicate must be a supported expression node`,elementKey:i,path:t}),!1;if(e===void 0)return r.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;if(Array.isArray(e))return e.reduce((d,g,m)=>I(g,`${t}[${m}]`,n,r,o,i)&&d,!0);if(!b(e)){if(typeof e==="number"&&!Number.isFinite(e)||e!==null&&!["string","number","boolean"].includes(typeof e))return r.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;return e===null||["string","number","boolean"].includes(typeof e)}let s=Object.keys(e).filter((d)=>d.startsWith("_"));if(s.length===0)return Object.entries(e).reduce((d,[g,m])=>I(m,`${t}.${g}`,n,r,o,i)&&d,!0);let a=s[0]??"",l=We.get(a),c=`${t}.${a}`;if(s.length!==1||Object.keys(e).length!==1||!l)return r.push({code:"props:expression",message:`${o}: expression shape is not supported`,elementKey:i,path:c}),!1;if(l.generation?.disabled||!l.generation?.positions.includes(n)&&!(n==="props"&&l.generation?.positions.includes("binding"))&&!(n==="predicate-value"&&l.generation?.positions.some((d)=>["props","computed","predicate"].includes(d))))return r.push({code:"props:expression",message:`${o}: expression is not supported in this value position`,elementKey:i,path:c}),!1;let p=e[a];if(!Ye(a,p))return r.push({code:"props:expression",message:`${o}: expression operand shape is not supported`,elementKey:i,path:c}),!1;let u=(d)=>O(d)||Array.isArray(d);if(["_filter","_find","_groupCount","_sort"].includes(a)&&!u(Array.isArray(p)?p[0]:void 0)||a==="_in"&&!u(Array.isArray(p)?p[1]:void 0))return r.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(a==="_count"&&(Array.isArray(p)?!u(p[0]):!u(p))||a==="_array.length"&&!u(p))return r.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(["_gt","_lt","_gte","_lte"].includes(a)&&Array.isArray(p)){if(p.some((g)=>!O(g)&&(typeof g!=="number"||!Number.isFinite(g))))return r.push({code:"props:expression",message:`${o}: numeric comparison literals must be finite numbers`,elementKey:i,path:c}),!1}if(Array.isArray(p))return p.reduce((d,g,m)=>{let y=n;if((["_filter","_find"].includes(a)||a==="_count")&&m===1)y="predicate";else if(n==="predicate"||n==="predicate-value"){if(y=ue.has(a)?"predicate-value":n,n==="predicate"&&["_and","_or"].includes(a))y="predicate"}return I(g,`${c}[${m}]`,y,r,o,i)&&d},!0);if(b(p))return I(p,c,n==="predicate"&&a==="_not"?"predicate-value":n,r,o,i);return!0}function J(e,t,n,r,o,i,s){let a=(u)=>s==="props"?`props:${u}`:`actions:params-${u}`;if(Object.keys(t).filter((u)=>!me.has(u)).length>0){r.push({code:"schema:unsupported",message:`${o}: schema contains unsupported constraints`,elementKey:i,path:n});return}if(t.type!==void 0&&!ge.has(t.type)){r.push({code:"schema:unsupported",message:`${o}: schema type is not supported`,elementKey:i,path:n});return}if(!fe(t)){r.push({code:"schema:unsupported",message:`${o}: schema enum is not supported`,elementKey:i,path:n});return}if(t.required!==void 0&&(!Array.isArray(t.required)||t.required.some((u)=>typeof u!=="string"))){r.push({code:"schema:unsupported",message:`${o}: schema required list is not supported`,elementKey:i,path:n});return}if(t.items!==void 0&&(t.type!=="array"||!b(t.items))){r.push({code:"schema:unsupported",message:`${o}: schema items must describe an array`,elementKey:i,path:n});return}if(t.properties!==void 0&&(t.type!=="object"||!b(t.properties))){r.push({code:"schema:unsupported",message:`${o}: schema properties must describe an object`,elementKey:i,path:n});return}if(t.required?.length&&t.type!=="object"){r.push({code:"schema:unsupported",message:`${o}: schema required list is only supported for objects`,elementKey:i,path:n});return}if(O(e))return;let c=t.type;if(!(c===void 0||c==="null"&&e===null||c==="string"&&typeof e==="string"||c==="boolean"&&typeof e==="boolean"||c==="number"&&typeof e==="number"&&Number.isFinite(e)||c==="integer"&&typeof e==="number"&&Number.isInteger(e)||c==="array"&&Array.isArray(e)||c==="object"&&b(e))){r.push({code:a("type"),message:`${o}: value does not match the declared type`,elementKey:i,path:n});return}if(t.enum&&!t.enum.some((u)=>Object.is(u,e)))r.push({code:a("enum"),message:`${o}: value is outside the declared enum`,elementKey:i,path:n});if(c==="object"&&b(e)){for(let u of t.required??[])if(!Object.hasOwn(e,u))r.push({code:a("required"),message:`${o}: required object field is missing`,elementKey:i,path:`${n}.${u}`});for(let[u,d]of Object.entries(t.properties??{}))if(Object.hasOwn(e,u))J(e[u],d,`${n}.${u}`,r,o,i,s)}if(c==="array"&&Array.isArray(e)&&t.items)e.forEach((u,d)=>{J(u,t.items,`${n}[${d}]`,r,o,i,s)})}function ye(e,t,n,r,o,i,s){if(!n)return;for(let[a,l]of Object.entries(n)){let c=`${r}.${a}`;if(X(l,c,e,o,i)&&t&&Object.hasOwn(t,a))J(t[a],l,c,e,o,i,s)}}function he(e,t,n,r,o,i,s={}){for(let[a,l]of Object.entries(t??{})){let c=r==="action-value"&&!s.evaluatedParams?.has(a)?"action-literal":r;I(l,`${n}.${a}`,c,e,o,i)}}function X(e,t,n,r,o){if(Object.keys(e).some((s)=>!me.has(s))||e.type!==void 0&&!ge.has(e.type)||!fe(e)||e.required!==void 0&&(!Array.isArray(e.required)||e.required.some((s)=>typeof s!=="string"))||e.items!==void 0&&(e.type!=="array"||!b(e.items))||e.properties!==void 0&&(e.type!=="object"||!b(e.properties))||Boolean(e.required?.length)&&e.type!=="object")return n.push({code:"schema:unsupported",message:`${r}: schema contains unsupported constraints`,elementKey:o,path:t}),!1;for(let[s,a]of Object.entries(e.properties??{}))if(!X(a,`${t}.${s}`,n,r,o))return!1;if(e.items&&!X(e.items,`${t}[]`,n,r,o))return!1;return!0}function j(e,t,n,r,o,i,s){if(!Array.isArray(r)){if(s)e.push({code:"actions:chain",message:`${t}: action chain must be an array`,elementKey:n,path:o});return}for(let[a,l]of r.entries()){if(!b(l)){if(s)e.push({code:"actions:chain",message:`${t}: action step must be an object`,elementKey:n,path:`${o}[${a}]`});continue}let c=l.action,p=`${o}[${a}]`;if(s&&(typeof c!=="string"||c.length===0))e.push({code:"actions:chain",message:`${t}: action step needs an action name`,elementKey:n,path:`${p}.action`});if(typeof c==="string"&&!pe.has(c)&&!Object.hasOwn(i.actions??{},c))e.push({code:"actions:registered",message:`${t}: action "${c}" is not in the catalog. Registered actions: ${[...pe,...Object.keys(i.actions??{})].join(", ")}. No equivalent is guaranteed: preserve the requirement and report unsupported behavior instead of disabling it.`,elementKey:n,path:`${p}.action`});if(s&&typeof c==="string"){let u=Object.hasOwn(i.actions??{},c)?i.actions[c]:Object.hasOwn(H,c)?H[c]:void 0,d=l.params;if(d!==void 0&&!b(d))e.push({code:"actions:chain",message:`${t}: action params must be an object`,elementKey:n,path:`${p}.params`});else{if(b(d))he(e,d,`${p}.params`,"action-value",t,n,{evaluatedParams:new Set(u?.generation?.evaluatedParams??[])});if(u)ye(e,b(d)?d:void 0,u.params,`${p}.params`,t,n,"actions:params")}}if(Object.hasOwn(l,"onSuccess"))j(e,t,n,l.onSuccess,`${p}.onSuccess`,i,s);if(Object.hasOwn(l,"onError"))j(e,t,n,l.onError,`${p}.onError`,i,s)}}function Ce(e,t,n=!1){let r=[],o=new Set([...de(e.state),...e.connectionIds??[]]),i=new Set(de(e.computed)),s=e.pageId??e.root;if(e.computed)for(let[a,l]of Object.entries(e.computed)){if(n)I(l,`computed.${a}`,"computed",r,`${s}.computed`,s);N(r,`${s}.computed`,s,l,`computed.${a}`,o,i,Ke(e,t))}if(e.urlState)for(let[a,l]of Object.entries(e.urlState)){if(!o.has(a))r.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" is not declared in state`,elementKey:s,path:`urlState.${a}`});if(!l||typeof l.param!=="string"||l.param.length===0)r.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" needs a param name`,elementKey:s,path:`urlState.${a}.param`})}for(let[a,l]of Object.entries(e.elements)){let c=Object.hasOwn(t.components,l.type)?t.components[l.type]:void 0;if(!c)continue;let p=`${s}/${a}`,u=be(c.props);if(n)he(r,l.props,"props","props",p,a);if(l.visible!==null&&typeof l.visible==="object"){let d=Object.keys(l.visible);if(Array.isArray(l.visible)||d.length!==1||!d[0]?.startsWith("_"))r.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression, not a literal record`,elementKey:a,path:"visible"})}if(n&&l.visible!==void 0)if(typeof l.visible!=="boolean"&&!O(l.visible))r.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression`,elementKey:a,path:"visible"});else I(l.visible,"visible","visible",r,p,a);if(N(r,p,a,l.props,"props",o,i,u),N(r,p,a,l.visible,"visible",o,i,u),N(r,p,a,l.events,"events",o,i,u),c.props){let d=new Set(Object.keys(c.props));for(let g of Object.keys(l.props??{}))if(!d.has(g))r.push({code:"props:declared",message:`${p}: prop "${g}" is not declared on ${l.type}`,elementKey:a,path:`props.${g}`});if(n)ye(r,l.props,c.props,"props",p,a,"props")}if(c.events){let d=new Set(Object.keys(c.events));for(let[g,m]of Object.entries(l.events??{})){if(!d.has(g))r.push({code:"events:declared",message:`${p}: event "${g}" is not declared on ${l.type}`,elementKey:a,path:`events.${g}`});j(r,p,a,m,`events.${g}`,t,n)}}else for(let[d,g]of Object.entries(l.events??{}))j(r,p,a,g,`events.${d}`,t,n)}return r.map((a)=>({...a,path:a.elementKey===s?`${s}/${a.path}`:`${s}/${a.elementKey}/${a.path}`}))}function be(e){let t=new Set;for(let n of Object.values(e??{})){let r=Ge(n);if(!r)continue;for(let o of r)t.add(o)}return t.size>0?t:void 0}function Ke(e,t){let n=new Set;for(let r of Object.values(e.elements)){let o=Object.hasOwn(t.components,r.type)?t.components[r.type]:void 0,i=be(o?.props);if(!i)continue;for(let s of i)n.add(s)}return n.size>0?n:void 0}function xe(e){return e.map((t)=>({code:t.code,message:t.message,elementKey:t.elementKey,path:t.path}))}var Pe=[{id:"_request",bucket:"server",description:"Executes a connection request server-side and injects the result"},{id:"_secret",bucket:"server",description:"Reads a server-side secret value; never transmitted to the client"}],V=new Set(Pe.map((e)=>e.id));function Z(e){return{...e,...e.props?{props:{...e.props}}:{},...e.children?{children:[...e.children]}:{},...e.slots?{slots:{...e.slots}}:{},...e.events?{events:{...e.events}}:{}}}function ke(e){return{...e,...e.roots?{roots:[...e.roots]}:{},...e.state?{state:{...e.state}}:{},elements:Object.fromEntries(Object.entries(e.elements).map(([t,n])=>[t,Z(n)]))}}function Xe(e){return e.type==="compiler:operator"}function Ze(e){return e.type==="compiler:validator"}class D{operators;validators;constructor(e={}){let t=(e.capabilities??[]).filter(Xe).map((r)=>r.contribution),n=(e.capabilities??[]).filter(Ze).map((r)=>r.contribution);this.operators=[...e.operators??[],...t],this.validators=[...e.validators??[],...n]}merge(e){if(e instanceof D)return new D({operators:[...this.operators,...e.operators],validators:[...this.validators,...e.validators]});return new D({operators:[...this.operators,...e.operators??[]],validators:[...this.validators,...e.validators??[]],...e.capabilities?{capabilities:e.capabilities}:{}})}}function Qe(e={}){return new D(e)}function et(e,t,n){let r=e.pages.find((s)=>s.id===t),o=[...r?.rootBlockIds??[]],i=Object.fromEntries(Object.entries(e.blocks).filter(([,s])=>s.pageId===t).map(([s,a])=>{let{id:l,pageId:c,parentId:p,...u}=a;return[s,Z(u)]}));if(n&&o.length===0){let s=e.blocks.__empty__?`__empty__:${t}`:"__empty__";o.push(s),i[s]={type:"Empty"}}return{version:e.version,root:o[0]??"__empty__",roots:o,pageId:t,...r?.state?{state:r.state}:{},...r?.computed?{computed:r.computed}:{},...r?.urlState?{urlState:r.urlState}:{},...e.connections?{connectionIds:e.connections.map((s)=>s.id)}:{},elements:i}}function tt(e,t){let n=[...t.roots??e.roots??[]];if(n.length>0&&t.root!==e.root)n[0]=t.root;else if(n.length===0&&t.elements[t.root])n.push(t.root);return n}async function nt(e,t,n,r){let o=ke(e);for(let i of n.operators){let s={spec:o,catalog:t,warnings:r,getElement(l){return o.elements[l]},updateElement(l,c){o={...o,elements:{...o.elements,[l]:Z(c)}}},addWarning(l){r.push(l)}},a=await i.apply(s);if(a)o=ke(a)}return o}function Se(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function rt(e,t,n,r,o){let i=Object.entries(e.elements);for(let a of e.roots?.length?e.roots:[e.root])if(!e.elements[a])n.push({code:"missing-root",message:`Root element "${a}" is missing from the elements map`,elementKey:a});for(let[a,l]of i){if(!(Se(t.components,l.type)??Se(t.templates,l.type)))r.push({missingType:l.type,elementKey:a,reason:l.template?"missing-template":"missing-component",context:`Element ${a} references ${l.type}`,path:`blocks.${a}.type`});for(let p of l.children??[])if(!e.elements[p])n.push({code:"dangling-child",message:`Element "${a}" references missing child "${p}"`,elementKey:a})}let s=Ce(e,t,o);if(o){for(let a of s)r.push({missingType:a.code,elementKey:a.elementKey,reason:"invalid-spec",context:a.message,code:a.code,path:a.path});return}n.push(...xe(s))}async function ot(e,t,n,r,o){for(let i of n.validators){let s={spec:e,catalog:t,warnings:r,gaps:o,addWarning(a){r.push(a)},addGap(a){o.push(a)}};await i.validate(s)}}function A(e,t){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let n of e)A(n,t);return}for(let[n,r]of Object.entries(e)){if(n.startsWith("_"))t.add(n);A(r,t)}}function it(e){let t=new Map;for(let[r,o]of Object.entries(e.blocks)){let i=new Set;A(o.props,i),A(o.visible,i);for(let s of i){let a=t.get(s)??new Set;a.add(r),t.set(s,a)}}for(let r of e.pages){let o=new Set;A(r.computed,o),A(r.lifecycle,o);for(let i of o){let s=t.get(i)??new Set;s.add(r.id),t.set(i,s)}}let n=[];for(let[r,o]of t){let i=B.has(r)?"client":V.has(r)?"server":r==="_ref"?"build":"shared";n.push({operatorId:r,bucket:i,blockIds:[...o]})}return n}async function Re(e,t,n={}){let r=[],o=[],i=n.registry??Qe(),s=Y(e,n.templates),a=Object.create(null),l=[];for(let[u,d]of s.pages.entries()){let g=et(s,d.id,u===0),m=await nt(g,t,i,r);rt(m,t,r,o,n.strict===!0),await ot(m,t,i,r,o);for(let[y,_]of Object.entries(m.elements)){let ee=a[y];if(ee)throw new h("duplicate-block-id",`Compiler output block id "${y}" conflicts across pages`,{blockId:y,firstPageId:ee.pageId,pageId:d.id});let q=s.blocks[y];a[y]={..._,id:y,pageId:d.id,...q?.pageId===d.id&&q.parentId?{parentId:q.parentId}:{}}}l.push({...d,rootBlockIds:tt(g,m)})}let c={version:"2.0",pages:l,...s.design?{design:s.design}:{},...s.connections?{connections:s.connections.map((u)=>({...u}))}:{},blocks:a};if(n.strict===!0&&e.version!=="2.0")o.push({missingType:"spec:version",elementKey:"spec",reason:"invalid-spec",context:"Native Spec version must be 2.0",code:"spec:version",path:"version"});let p=it(c);return{spec:c,gaps:o,warnings:r,...p.length>0?{operatorUsage:p}:{}}}function _e(e){let t=Fe(e.title??Nt(e.source)??"artifact");switch(e.format){case"html":return{bytes:we(Ie(e.source,e.title)),filename:`${t}.html`,contentType:"text/html; charset=utf-8"};case"markdown":return{bytes:we(e.source),filename:`${t}.md`,contentType:"text/markdown; charset=utf-8"};case"zip":{let n=st(t),o=((e.files?.length)?e.files:[{path:"index.html",content:Ie(e.source,e.title)}]).map((a)=>({...a,path:`${n}/${a.path}`})),i=e.title??t,s=[...o,{path:`${n}/DESIGN-HANDOFF.md`,content:lt(i,o,n)},{path:`${n}/design-manifest.json`,content:JSON.stringify(at(i,o),null,2)}];return{bytes:Te(s),filename:`${t}.zip`,contentType:"application/zip"}}case"pptx":return{bytes:yt(e.source,e.title??t),filename:`${t}.pptx`,contentType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}}}function st(e){return Fe(e??"artifact")}function at(e,t){return{contract:"uibot.artifact.zip",title:e,generator:"UIBot",files:t.map((n)=>n.path)}}function lt(e,t,n){let r=t.map((l)=>`- \`${l.path}\``).join(`
|
|
1
|
+
function re(e){return{...e,components:e.components,actions:e.actions??{},templates:e.templates??{}}}var oe=["SetState","ResetState","Request","Link","Validate","DisplayMessage","Login","Logout","CallMethod"],W={SetState:{name:"SetState",description:"Set a page state path to an evaluated declarative value",params:{path:{type:"string"},value:{description:"Literal or supported PropValue expression"}},generation:{evaluatedParams:["value"],prerequisites:["Declare the state path on the same page"],example:{action:"SetState",params:{path:"open",value:{_not:{_state:"open"}}}}}},ResetState:{name:"ResetState",description:"Restore paths from the supplied initial map; missing values become null",params:{paths:{type:"array",items:{type:"string"}},initial:{type:"object"}},generation:{evaluatedParams:[],prerequisites:["Supply literal initial values; omitting paths resets keys in initial"],example:{action:"ResetState",params:{paths:["open"],initial:{open:!1}}}}},Request:{name:"Request",description:"Execute a configured connection request",params:{connectionId:{type:"string"},request:{type:"object"},loadingPath:{type:"string"},responsePath:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:["connectionId","request"],prerequisites:["Host must inject the declared connection driver; no implicit secrets or persistence"],example:{action:"Request",params:{connectionId:"projects",request:{id:"list",connectionId:"projects",payload:{operation:"FindAll",resource:"projects"}},responsePath:"rows"}}}},Link:{name:"Link",description:"Emit navigation to a literal URL or page path",params:{path:{type:"string"},url:{type:"string"},target:{enum:["_self","_blank"]}},generation:{evaluatedParams:[],prerequisites:["Host handles navigation; local page paths must exist"],example:{action:"Link",params:{path:"/details"}}}},Validate:{name:"Validate",description:"Emit form validation event; does not itself throw for invalid fields",params:{formId:{type:"string"},errorPath:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host form:validate listener; prefer native required controls and Form.Submit"],example:{action:"Validate",params:{formId:"contact"}}}},DisplayMessage:{name:"DisplayMessage",description:"Emit an evaluated message for the host to display",params:{message:{description:"Literal or supported PropValue expression"},level:{enum:["info","success","warning","error"]},duration:{type:"number"}},generation:{evaluatedParams:["message"],prerequisites:["Requires host message:display listener"],example:{action:"DisplayMessage",params:{message:"Saved locally",level:"success"}}}},Login:{name:"Login",description:"Set a supplied local session user or request external login",params:{user:{type:"object"},provider:{type:"string"}},generation:{evaluatedParams:[],prerequisites:["Requires host session/auth; setting a local user is not server authentication"],example:{action:"Login",params:{provider:"configured-provider"}}}},Logout:{name:"Logout",description:"Clear the local session and emit auth:logout",params:{},generation:{evaluatedParams:[],prerequisites:["Host owns server session invalidation"],example:{action:"Logout",params:{}}}},CallMethod:{name:"CallMethod",description:"Emit a call to an existing block method",params:{blockId:{type:"string"},method:{type:"string"},args:{type:"array"}},generation:{evaluatedParams:["args"],prerequisites:["Requires an explicitly documented installed block method/listener; never invent a method"],example:{action:"CallMethod",params:{blockId:"documented-block",method:"documented-method",args:[]}}}}};var G={navigation:["sidebar","navbar"],container:["default","fluid","boxed"],navigationStyle:["attached","floating"],offcanvas:["attached","floating"],sidebar:["expanded","folded","hover"]},ie={navigation:"sidebar",container:"fluid",navigationStyle:"attached",offcanvas:"attached",sidebar:"expanded"};var Ue={spec:["html","markdown","zip"],prototype:["html","zip"],deck:["html","pptx","zip"],poster:["html","zip"]},$n=Array.from(new Set(Object.values(Ue).flat()));var Hn=Object.freeze([Object.freeze({name:"manifest",summary:"Describe query operations and list the derived resource index.",positionals:Object.freeze([]),options:Object.freeze([])}),Object.freeze({name:"search",summary:"Search resources with deterministic bilingual ranking and reasons.",positionals:Object.freeze([Object.freeze({name:"text",property:"text",type:"string",required:!1})]),options:Object.freeze([...[["function","functions"],["scenario","scenarios"],["unit","units"],["industry","industries"]].map(([e,t])=>Object.freeze({name:e,property:t,type:"string",multiple:!0,cliEncoding:"comma-separated"})),Object.freeze({name:"kind",property:"kinds",type:"resource-kind",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"tag",property:"tags",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"category",property:"categories",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"capability",property:"capabilities",type:"string",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"maturity",property:"maturities",type:"resource-maturity",multiple:!0,cliEncoding:"comma-separated"}),Object.freeze({name:"limit",property:"limit",type:"positive-integer"})])}),Object.freeze({name:"get",summary:"Resolve one canonical resource id or unambiguous alias.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])}),Object.freeze({name:"build",summary:"Plan dependency closure and gaps without writing or installing.",positionals:Object.freeze([Object.freeze({name:"root",property:"roots",type:"string",required:!0,variadic:!0})]),options:Object.freeze([])}),Object.freeze({name:"docs",summary:"Read curated public documentation for one resource.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"locale",property:"locale",type:"string"},{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"examples",summary:"Read one bounded page of examples and exact dependencies. Follow nextPage for complete source.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([{name:"page",property:"page",type:"positive-integer"}])}),Object.freeze({name:"install-plan",summary:"Describe distribution channels and fixed snapshot identity/closure without installing or writing.",positionals:Object.freeze([Object.freeze({name:"id-or-alias",property:"id",type:"string",required:!0})]),options:Object.freeze([])})]);var qe=["background","foreground","card","card-foreground","popover","popover-foreground","primary","primary-foreground","secondary","secondary-foreground","muted","muted-foreground","accent","accent-foreground","border","input","ring","destructive","destructive-foreground","success","success-foreground","warning","warning-foreground"],Gn=[...qe,"radius","font-display","font-body","font-mono"];var S=(e)=>e!==null&&typeof e==="object"&&!Array.isArray(e),R=(e,t)=>Object.keys(e).every((n)=>t.includes(n)),v=(e,t)=>typeof e==="string"&&e.length>0&&e.length<=t,se=(e)=>typeof e==="number"&&Number.isSafeInteger(e)&&e>0,M=(e)=>typeof e==="string"&&/^[A-Za-z0-9_]{1,64}$/.test(e),ae=(e,t=100)=>Array.isArray(e)&&e.length<=t&&e.every(M)&&new Set(e).size===e.length;function He(e){if(!S(e)||!R(e,["id","name","type","required","options","link","lookup","formula","rollup"])||!M(e.id)||!v(e.name,200)||!["singleLineText","longText","number","checkbox","date","singleSelect","multipleSelect","linkedRecord","lookup","formula","rollup"].includes(String(e.type))||e.required!==void 0&&typeof e.required!=="boolean")return!1;if(e.options!==void 0&&(!Array.isArray(e.options)||e.options.length>100||e.options.some((t)=>!S(t)||!R(t,["id","name"])||!M(t.id)||!v(t.name,200))||new Set(e.options.map((t)=>t.id)).size!==e.options.length))return!1;if(e.options!==void 0&&!["singleSelect","multipleSelect"].includes(String(e.type)))return!1;for(let[t,n,r]of[["linkedRecord","link",["collectionId","displayFieldId"]],["lookup","lookup",["linkFieldId","targetFieldId"]],["formula","formula",["expression"]],["rollup","rollup",["linkFieldId","targetFieldId","function"]]]){let o=e[n];if(e.type===t!==(o!==void 0))return!1;if(o!==void 0&&(!S(o)||!R(o,[...r])||r.some((i)=>!v(o[i],i==="expression"?2048:512))))return!1}return!0}function le(e){if(!S(e)||!R(e,["id","collectionId","descriptor","view","uibotCommit","authorId","createdAt","digest"])||!/^[a-f0-9]{64}$/.test(String(e.id))||!/^[a-f0-9]{64}$/.test(String(e.digest))||!/^[a-f0-9]{40}$/.test(String(e.uibotCommit))||!v(e.collectionId,512)||!v(e.authorId,512)||typeof e.createdAt!=="string"||!/^\d{4}-\d{2}-\d{2}T/.test(e.createdAt)||!Number.isFinite(Date.parse(e.createdAt)))return!1;try{if(new TextEncoder().encode(JSON.stringify(e)).length>131072)return!1}catch{return!1}let{descriptor:t,view:n}=e;if(!S(t)||!R(t,["id","name","schemaVersion","fields"])||t.id!==e.collectionId||!v(t.name,200)||!se(t.schemaVersion)||!Array.isArray(t.fields)||t.fields.length<1||t.fields.length>100||!t.fields.every(He)||new Set(t.fields.map((i)=>i.id)).size!==t.fields.length)return!1;if(!S(n)||!R(n,["id","name","version","type","groupByFieldId","dateFieldId","search","filter","sort","columnOrder","hiddenColumns","columnWidths"])||!M(n.id)||!v(n.name,200)||!se(n.version)||!ae(n.columnOrder)||!ae(n.hiddenColumns)||!S(n.columnWidths)||Object.values(n.columnWidths).some((i)=>typeof i!=="number"||!Number.isInteger(i)||i<72||i>800))return!1;let r=t.fields,o=(i)=>r.some((s)=>S(s)&&s.id===i);if([...n.columnOrder,...n.hiddenColumns,...Object.keys(n.columnWidths)].some((i)=>!o(i)))return!1;if(n.type!==void 0&&!["grid","kanban","gallery","calendar","form"].includes(String(n.type)))return!1;if(n.type==="kanban"&&!t.fields.some((i)=>i.id===n.groupByFieldId&&["singleSelect","checkbox"].includes(i.type)))return!1;if(n.type==="calendar"&&!t.fields.some((i)=>i.id===n.dateFieldId&&i.type==="date"))return!1;if(n.search!==void 0&&(typeof n.search!=="string"||n.search.length>200))return!1;if(n.sort!==void 0&&(!Array.isArray(n.sort)||n.sort.length>4||n.sort.some((i)=>!S(i)||!R(i,["fieldId","direction"])||!o(i.fieldId)||!["asc","desc"].includes(String(i.direction)))))return!1;return!0}var I=(e)=>!!e&&typeof e==="object"&&!Array.isArray(e),x=(e)=>typeof e==="string"&&e.length>0&&!["__proto__","prototype","constructor"].includes(e),ce=(e)=>I(e)&&Object.entries(e).every(([t,n])=>x(t)&&x(n));function pe(e){if(e.composition===void 0)return;let t=e.composition;if(!I(t)||t.schema!=="uibot.solution-composition.v1"||!Array.isArray(t.pages))throw Error("invalid-solution-composition");let n=new Set;for(let r of t.pages){if(!I(r)||!x(r.resourceId)||!x(r.version)||typeof r.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(r.sourceHash)||!x(r.sourcePageId)||!x(r.targetPageId)||n.has(r.targetPageId)||!I(r.baseline)||r.baseline.id!==r.targetPageId||typeof r.baseline.path!=="string"||!Array.isArray(r.baseline.blocks)||!I(r.bindings)||!["source","target"].includes(String(r.bindings.layout))||!ce(r.bindings.paths)||!ce(r.bindings.connections)||r.bindings.frame!==void 0&&(!I(r.bindings.frame)||Object.keys(r.bindings.frame).some((o)=>!["props","slots","events"].includes(o)))||r.detached!==void 0&&typeof r.detached!=="boolean"||r.configuration!==void 0&&(!I(r.configuration)||Object.entries(r.configuration).some(([o,i])=>!x(o)||!["string","number","boolean"].includes(typeof i)||typeof i==="number"&&!Number.isFinite(i))))throw Error("invalid-solution-adoption");n.add(r.targetPageId)}if(t.regions!==void 0){if(!Array.isArray(t.regions))throw Error("invalid-solution-regions");let r=new Set;for(let o of t.regions){if(!I(o)||!x(o.resourceId)||!x(o.version)||typeof o.sourceHash!=="string"||!/^[a-f0-9]{64}$/.test(o.sourceHash)||!x(o.targetPageId)||r.has(o.targetPageId)||!x(o.role)||o.target!=="page-frame"||!x(o.contentBlockId)||!I(o.baseline)||!x(o.baseline.type))throw Error("invalid-solution-region");r.add(o.targetPageId)}}}import{parse as Wo}from"yaml";class h extends Error{code;details;constructor(e,t,n){super(t);this.name="CompileSpecError",this.code=e,this.details=n}}function ze(e,t){let n=Object.hasOwn(t,e)?t[e]:void 0;if(!n)throw new h("unknown-template",`unknown template "${e}"`,{template:e});let r=n.pages[0]?.blocks[0];if(!r||r.type!=="PageLayout")throw new h("invalid-shell-root",`template "${e}" root is not PageLayout`,{template:e});return r}function B(e,t,n,r){let o=e;if(e.template){if(n.has(e.template))throw new h("template-cycle",`template cycle at "${e.template}"`,{template:e.template});let i=ze(e.template,t),s=new Set(n);s.add(e.template);let a={...i.slots,...e.slots};if(r&&!e.slots?.sidebar)delete a.sidebar;let l=e.children??i.children,c=e.events??i.events,p=e.visible??i.visible;return o={...i,...e.id?{id:e.id}:{},props:{...i.props,...e.props},slots:a,...l?{children:l}:{},...c?{events:c}:{},...p!==void 0?{visible:p}:{}},B(o,t,s,r)}return{...o,...o.children?{children:o.children.map((i)=>B(i,t,n,r))}:{},...o.slots?{slots:Object.fromEntries(Object.entries(o.slots).map(([i,s])=>[i,s.map((a)=>B(a,t,n,r))]))}:{}}}function We(e){let t=(n)=>{if(n.template)return!0;if(n.children?.some(t))return!0;return Object.values(n.slots??{}).some((r)=>r.some(t))};return e.pages.some((n)=>n.blocks.some(t))}function de(e,t){return e.map((n)=>{if("children"in n&&Array.isArray(n.children))return{type:"MenuGroup",props:{title:n.label},children:de(n.children,t)};let r=n,o={label:r.label,href:r.path};if(r.icon)o.icon=r.icon;if(r.path===t)o.active=!0;return{type:"MenuLink",props:o}})}function Ge(e){let t=e.menus?.items;if(!t?.length)return e;return{...e,pages:e.pages.map((n)=>({...n,blocks:n.blocks.map((r)=>{if(r.type!=="PageLayout")return r;if(r.slots?.sidebar?.length)return r;return{...r,slots:{...r.slots,sidebar:[{type:"PageSiderMenu",props:{title:n.title??r.props?.title??"Menu"},children:de(t,n.path)}]}}})}))}}function Y(e,t={}){let n=Boolean(e.menus?.items?.length),r=We(e)?{...e,pages:e.pages.map((o)=>({...o,blocks:o.blocks.map((i)=>B(i,t,new Set,n))}))}:e;return Ge(r)}function ue(e,t){if(e===void 0)return;function n(){throw new h("invalid-layout","Invalid application or page layout",{...t?{pageId:t}:{}})}if(!e||typeof e!=="object"||Array.isArray(e))n();for(let[r,o]of Object.entries(e)){if(t!==void 0&&r==="inherit"&&typeof o==="boolean")continue;let i=G[r];if(!Object.hasOwn(G,r)||!i?.includes(o))n()}}function ge(e,t){if(ue(e.layout),ue(t.layout,t.id),!t.blocks.some((s)=>s.type==="PageLayout"&&s.props?.appearance!=="standalone")){if(!t.layout)return t.blocks;if(Object.keys(t.layout).some((a)=>a!=="inherit"&&a!=="container"))throw new h("invalid-layout","Standalone pages only support container layout",{pageId:t.id});if(t.blocks.some((a)=>a.type==="PageLayout"&&a.props?.appearance==="standalone"))return t.blocks.map((a)=>a.type==="PageLayout"?{...a,props:{...a.props,layout:{container:t.layout?.container??"fluid"}}}:a);return[{type:"PageLayout",props:{appearance:"standalone",layout:{container:t.layout.container??"fluid"}},children:t.blocks}]}if(!e.layout&&!t.layout)return t.blocks;let{inherit:r,...o}=t.layout??{},i={...ie,...t.layout?.inherit===!1?{}:e.layout,...o};return t.blocks.map((s)=>s.type==="PageLayout"?{...s,props:{...s.props,layout:i}}:s)}function Ye(e){pe(e);let t=new Map,n=new Map,r=new Map,o=(i,s)=>{if(i.id!==void 0){if(r.has(i.id)){let a=r.get(i.id);throw new h("duplicate-block-id",`Block id "${i.id}" is declared more than once`,{blockId:i.id,firstPageId:a,pageId:s})}r.set(i.id,s)}for(let a of i.children??[])o(a,s);for(let a of Object.values(i.slots??{}))for(let l of a)o(l,s)};return e.pages.forEach((i,s)=>{let a=t.get(i.id);if(a!==void 0)throw new h("duplicate-page-id",`Page id "${i.id}" is declared more than once`,{pageId:i.id,firstIndex:a,pageIndex:s});if(t.set(i.id,s),n.has(i.path)){let l=n.get(i.path);throw new h("duplicate-page-path",`Page path "${i.path}" is declared more than once`,{path:i.path,firstPageId:l,pageId:i.id})}n.set(i.path,i.id);for(let l of i.blocks)o(l,i.id)}),new Set(r.keys())}function Ke(e,t,n){while(!0){let r=t.counter++,o=n?`${n}_${r}`:`${e}_${r}`;if(!t.reservedIds.has(o)&&!t.assignedIds.has(o))return o}}function K(e,t,n,r,o,i){let s=e.id??Ke(t,r,i??o);if(r.assignedIds.has(s))throw new h("duplicate-block-id",`Block id "${s}" is declared more than once`,{blockId:s,pageId:t});r.assignedIds.add(s);let a=(e.children??[]).map((p)=>K(p,t,n,r,s,s)),l={};for(let[p,u]of Object.entries(e.slots??{}))l[p]=u.map((d)=>K(d,t,n,r,s,`${s}_${p}`));let c={id:s,pageId:t,type:e.type,...o?{parentId:o}:{},...e.props?{props:e.props}:{},...a.length?{children:a}:{},...Object.keys(l).length?{slots:l}:{},...e.events?{events:e.events}:{},...e.visible!==void 0?{visible:e.visible}:{},...e.template?{template:e.template}:{},...e.variant?{variant:e.variant}:{}};return n[s]=c,s}function J(e,t={}){e=Y(e,t);let r={counter:0,reservedIds:Ye(e),assignedIds:new Set},o=Object.create(null);return{version:"2.0",pages:e.pages.map((s)=>{let a=[];for(let l of ge(e,s))a.push(K(l,s.id,o,r));return{id:s.id,path:s.path,...s.title?{title:s.title}:{},rootBlockIds:a,...s.state?{state:s.state}:{},...s.auth?{auth:s.auth}:{},...s.lifecycle?{lifecycle:s.lifecycle}:{},...s.computed?{computed:s.computed}:{},...s.urlState?{urlState:s.urlState}:{}}}),...e.design?{design:e.design}:{},...e.connections?{connections:e.connections.map((s)=>({...s}))}:{},blocks:o}}var O=[{id:"_state",generation:{syntax:"page-state path",positions:["props","computed","action-value","visible"],example:{_state:"open"},prerequisite:"Declare the path on the same page"},bucket:"client",description:"Reads a value from the page state store"},{id:"_bindState",generation:{syntax:"page-state path",positions:["binding"],example:{_bindState:"name"},prerequisite:"Only installed controls implementing two-way binding"},bucket:"client",description:"Two-way state binding (read + write)"},{id:"_payload",generation:{syntax:"payload field",positions:["request-context"],example:{_payload:"name"},prerequisite:"Caller must supply request payload; ordinary preview props have no payload"},bucket:"client",description:"Request payload field"},{id:"_event",generation:{syntax:"event field",positions:["action-value"],example:{_event:"value"},prerequisite:"Only within an event action; permitted fields: type,name,value,checked,values. Read own-property dotted paths such as values.id or values.name"},bucket:"client",description:"Event payload field (e.g. form submit value)"},{id:"_global",generation:{syntax:"host-global field",positions:["host-context"],example:{_global:"configuredValue"},prerequisite:"Host-dependent and excluded from ordinary creation; no secrets"},bucket:"client",description:"Global (window) property access"},{id:"_if",generation:{syntax:"[condition, then, else]",positions:["props","computed","action-value"],example:{_if:[{_state:"open"},"Open","Closed"]}},bucket:"client",description:"Conditional ternary: [condition, then, else]"},{id:"_eq",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_eq:[{_state:"status"},"Active"]}},bucket:"client",description:"Equality: [a, b] → a === b"},{id:"_ne",generation:{syntax:"[a, b]",positions:["props","computed","action-value","visible","predicate"],example:{_ne:[{_state:"status"},"Active"]}},bucket:"client",description:"Inequality: [a, b] → a !== b"},{id:"_contains",generation:{syntax:"[haystack, needle]",positions:["props","computed","action-value","visible","predicate"],example:{_contains:[{_state:"name"},"orion"]}},bucket:"client",description:"Case-insensitive substring match: [haystack, needle] → haystack contains needle (empty needle → true)"},{id:"_gt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gt:[{_state:"count"},0]}},bucket:"client",description:"Greater-than for finite numbers: [a, b] → a > b. Non-numbers are false"},{id:"_lt",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lt:[{_state:"count"},10]}},bucket:"client",description:"Less-than for finite numbers: [a, b] → a < b. Non-numbers are false"},{id:"_gte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_gte:[{_state:"count"},0]}},bucket:"client",description:"Greater-or-equal for finite numbers: [a, b] → a >= b. Non-numbers are false"},{id:"_lte",generation:{syntax:"[finite-number, finite-number]",positions:["props","computed","action-value","visible","predicate"],example:{_lte:[{_state:"count"},10]}},bucket:"client",description:"Less-or-equal for finite numbers: [a, b] → a <= b. Non-numbers are false"},{id:"_in",generation:{syntax:"[value, array]",positions:["props","computed","action-value","visible","predicate"],example:{_in:[{_state:"status"},["Active","Draft"]]}},bucket:"client",description:"Membership: [value, array] → array includes value"},{id:"_not",generation:{syntax:"condition",positions:["props","computed","action-value","visible","predicate"],example:{_not:{_state:"open"}}},bucket:"client",description:"Logical NOT"},{id:"_and",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_and:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical AND over a list of conditions"},{id:"_or",generation:{syntax:"[condition, ...]",positions:["props","computed","action-value","visible","predicate"],example:{_or:[{_state:"ready"},{_state:"open"}]}},bucket:"client",description:"Logical OR over a list of conditions"},{id:"_user",generation:{syntax:"session user field",positions:["props","computed","action-value"],example:{_user:"name"},prerequisite:"Requires injected host session; no server ACL guarantee"},bucket:"client",description:"Current session user field (client-visible)"},{id:"_item",generation:{syntax:"item field or empty string",positions:["predicate","loop-props"],example:{_item:"name"},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list item in a loop scope"},{id:"_index",generation:{syntax:"ignored scalar marker",positions:["predicate","loop-props"],example:{_index:0},prerequisite:"Only inside a declared loop or filter/find predicate"},bucket:"client",description:"Current list index in a loop scope"},{id:"_array.length",generation:{syntax:"array expression",positions:["props","computed","action-value"],example:{"_array.length":{_state:"rows"}}},bucket:"client",description:"Array length"},{id:"_string.concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{"_string.concat":["Hello ",{_state:"name"}]}},bucket:"client",description:"String concatenation over a list"},{id:"_number.add",generation:{syntax:"[left, right] (finite numbers)",positions:["action-value"],example:{"_number.add":[{_state:"count"},1]},prerequisite:"Both operands must evaluate to finite numbers or the action fails and writes nothing; use it in SetState value for counters (e.g. SetState count = count + 1), never for strings or arrays"},bucket:"client",description:"Finite number addition: [left, right] → left + right. Throws on non-number, non-finite or overflowing operands (no coercion, no fallback to 0)"},{id:"_computed",generation:{syntax:"computed name",positions:["props","computed","action-value","visible"],example:{_computed:"filtered"},prerequisite:"Declare page computed expression"},bucket:"client",description:"Reads a derived (computed) state value by name from the __computed namespace"},{id:"_filter",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_filter:[{_state:"rows"},{_eq:[{_item:"status"},"Active"]}]}},bucket:"client",description:"Filters an array: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_find",generation:{syntax:"[array, predicate]",positions:["props","computed","action-value"],example:{_find:[{_state:"rows"},{_eq:[{_item:"name"},"Orion"]}]}},bucket:"client",description:"Finds the first matching element: [arrayExpr, predExpr] with { _item, _index } scope"},{id:"_len",generation:{syntax:"array/string/object expression",positions:["props","computed","action-value"],example:{_len:{_state:"rows"}}},bucket:"client",description:"Length of an array, string, or object (0 if empty)"},{id:"_concat",generation:{syntax:"[value, ...]",positions:["props","computed","action-value"],example:{_concat:[[1],[2]]},prerequisite:"Concatenation is not numeric addition"},bucket:"client",description:"Concatenates a list: arrays are joined, otherwise values are string-concatenated"},{id:"_count",generation:{syntax:"array or [array, predicate?]",positions:["props","computed","action-value"],example:{_count:[{_state:"rows"}]}},bucket:"client",description:"Count of an array, or of elements matching a predicate: [array, predicate?]"},{id:"_groupCount",generation:{syntax:"[array, field]",positions:["props","computed","action-value"],example:{_groupCount:[{_state:"rows"},"status"]}},bucket:"client",description:"Counts array items by a field in one pass: [array, field] → { value: count }"},{id:"_sort",generation:{syntax:"[array, {by, order?, rank?}]",positions:["props","computed","action-value"],example:{_sort:[{_state:"rows"},{by:"name",order:"asc"}]}},bucket:"client",description:"Stable sort: [array, { by, order?: asc|desc, rank?: { field: values[] } }]. rank is enum order"},{id:"_js",generation:{syntax:"disabled",positions:[],example:{_js:"disabled"},prerequisite:"Arbitrary code execution is disabled; permissions do not enable it",disabled:!0},bucket:"client",description:"Legacy JS expression; execution is always disabled"}],j=new Set(O.map((e)=>e.id));var me=new Set(oe),Je=new Map(O.map((e)=>[e.id,e])),he=new Set(["array","boolean","integer","null","number","object","string"]),be=new Set(["additionalProperties","default","description","enum","items","properties","required","type"]);function fe(e){if(!e)return[];return Object.keys(e)}function Ze(e){if(!e||e.type!=="array")return;let t=e.items;if(!t||typeof t!=="object"||t.type!=="object"||!t.properties)return;return new Set(Object.keys(t.properties))}function Z(e,t,n){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let[r,o]of e.entries())Z(o,`${t}[${r}]`,n);return}for(let[r,o]of Object.entries(e)){let i=t?`${t}.${r}`:r;n(r,o,i),Z(o,i,n)}}function V(e,t,n,r,o,i,s,a){Z(r,o,(l,c,p)=>{if((l==="_state"||l==="_bindState")&&typeof c==="string"){let u=c.split("."),d=u[0]??"";if(d==="__computed"){let g=u[1]??"";if(!s.has(g))e.push({code:"refs:computed-declared",message:`${t}: _computed "${g}" is not declared`,elementKey:n,path:p});return}if(!i.has(d))e.push({code:"refs:state-declared",message:`${t}: _state "${d}" is not declared in state`,elementKey:n,path:p})}if(l==="_computed"&&typeof c==="string"&&!s.has(c))e.push({code:"refs:computed-declared",message:`${t}: _computed "${c}" is not declared`,elementKey:n,path:p});if(l==="_item"&&typeof c==="string"&&c!==""&&a&&!a.has(c))e.push({code:"item:field-exists",message:`${t}: _item "${c}" is not in the item schema`,elementKey:n,path:p})})}function C(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function F(e){return C(e)&&Object.keys(e).some((t)=>t.startsWith("_"))}var ye=new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_not","_and","_or"]);function Xe(e,t){if(new Set(["_eq","_ne","_contains","_gt","_lt","_gte","_lte","_in","_filter","_find","_groupCount","_sort","_number.add"]).has(e)){if(!Array.isArray(t)||t.length!==2)return!1;if(e==="_groupCount")return typeof t[1]==="string";if(e==="_sort"){let r=t[1];if(!C(r))return!1;if(!(typeof r.by==="string"&&r.by.length>0||Array.isArray(r.by)&&r.by.length>0&&r.by.every((i)=>typeof i==="string"&&i.length>0)))return!1;if(r.order!==void 0&&r.order!=="asc"&&r.order!=="desc")return!1;if(r.rank!==void 0&&(!C(r.rank)||Object.values(r.rank).some((i)=>!Array.isArray(i))))return!1;return Object.keys(r).every((i)=>["by","order","rank"].includes(i))}return!0}if(e==="_if")return Array.isArray(t)&&t.length===3;if(e==="_and"||e==="_or")return Array.isArray(t)&&t.length>0;if(e==="_string.concat"||e==="_concat")return Array.isArray(t)&&t.length>0;if(e==="_count")return!Array.isArray(t)||t.length===1||t.length===2;if(e==="_index")return typeof t==="number"&&Number.isFinite(t);if(["_state","_bindState","_computed","_event","_global","_payload","_user"].includes(e))return typeof t==="string"&&t.length>0;if(e==="_item")return typeof t==="string";return!0}function Ce(e){return e.enum===void 0||Array.isArray(e.enum)&&e.enum.length>0&&e.enum.every((t)=>t===null||typeof t==="string"||typeof t==="boolean"||typeof t==="number"&&Number.isFinite(t))}function A(e,t,n,r,o,i){if(n==="predicate"&&(!F(e)||!ye.has(Object.keys(e)[0]??"")))return r.push({code:"props:expression",message:`${o}: predicate must be a supported expression node`,elementKey:i,path:t}),!1;if(e===void 0)return r.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;if(Array.isArray(e))return e.reduce((d,g,m)=>A(g,`${t}[${m}]`,n,r,o,i)&&d,!0);if(!C(e)){if(typeof e==="number"&&!Number.isFinite(e)||e!==null&&!["string","number","boolean"].includes(typeof e))return r.push({code:"props:expression",message:`${o}: value is not part of the supported serialized expression syntax`,elementKey:i,path:t}),!1;return e===null||["string","number","boolean"].includes(typeof e)}let s=Object.keys(e).filter((d)=>d.startsWith("_"));if(s.length===0)return Object.entries(e).reduce((d,[g,m])=>A(m,`${t}.${g}`,n,r,o,i)&&d,!0);let a=s[0]??"",l=Je.get(a),c=`${t}.${a}`;if(s.length!==1||Object.keys(e).length!==1||!l)return r.push({code:"props:expression",message:`${o}: expression shape is not supported`,elementKey:i,path:c}),!1;if(l.generation?.disabled||!l.generation?.positions.includes(n)&&!(n==="props"&&l.generation?.positions.includes("binding"))&&!(n==="predicate-value"&&l.generation?.positions.some((d)=>["props","computed","predicate"].includes(d))))return r.push({code:"props:expression",message:`${o}: expression is not supported in this value position`,elementKey:i,path:c}),!1;let p=e[a];if(!Xe(a,p))return r.push({code:"props:expression",message:`${o}: expression operand shape is not supported`,elementKey:i,path:c}),!1;let u=(d)=>F(d)||Array.isArray(d);if(["_filter","_find","_groupCount","_sort"].includes(a)&&!u(Array.isArray(p)?p[0]:void 0)||a==="_in"&&!u(Array.isArray(p)?p[1]:void 0))return r.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(a==="_count"&&(Array.isArray(p)?!u(p[0]):!u(p))||a==="_array.length"&&!u(p))return r.push({code:"props:expression",message:`${o}: expression array operand has an unsupported literal shape`,elementKey:i,path:c}),!1;if(["_gt","_lt","_gte","_lte"].includes(a)&&Array.isArray(p)){if(p.some((g)=>!F(g)&&(typeof g!=="number"||!Number.isFinite(g))))return r.push({code:"props:expression",message:`${o}: numeric comparison literals must be finite numbers`,elementKey:i,path:c}),!1}if(Array.isArray(p))return p.reduce((d,g,m)=>{let y=n;if((["_filter","_find"].includes(a)||a==="_count")&&m===1)y="predicate";else if(n==="predicate"||n==="predicate-value"){if(y=ye.has(a)?"predicate-value":n,n==="predicate"&&["_and","_or"].includes(a))y="predicate"}return A(g,`${c}[${m}]`,y,r,o,i)&&d},!0);if(C(p))return A(p,c,n==="predicate"&&a==="_not"?"predicate-value":n,r,o,i);return!0}function X(e,t,n,r,o,i,s){let a=(u)=>s==="props"?`props:${u}`:`actions:params-${u}`;if(Object.keys(t).filter((u)=>!be.has(u)).length>0){r.push({code:"schema:unsupported",message:`${o}: schema contains unsupported constraints`,elementKey:i,path:n});return}if(t.type!==void 0&&!he.has(t.type)){r.push({code:"schema:unsupported",message:`${o}: schema type is not supported`,elementKey:i,path:n});return}if(!Ce(t)){r.push({code:"schema:unsupported",message:`${o}: schema enum is not supported`,elementKey:i,path:n});return}if(t.required!==void 0&&(!Array.isArray(t.required)||t.required.some((u)=>typeof u!=="string"))){r.push({code:"schema:unsupported",message:`${o}: schema required list is not supported`,elementKey:i,path:n});return}if(t.items!==void 0&&(t.type!=="array"||!C(t.items))){r.push({code:"schema:unsupported",message:`${o}: schema items must describe an array`,elementKey:i,path:n});return}if(t.properties!==void 0&&(t.type!=="object"||!C(t.properties))){r.push({code:"schema:unsupported",message:`${o}: schema properties must describe an object`,elementKey:i,path:n});return}if(t.required?.length&&t.type!=="object"){r.push({code:"schema:unsupported",message:`${o}: schema required list is only supported for objects`,elementKey:i,path:n});return}if(F(e))return;let c=t.type;if(!(c===void 0||c==="null"&&e===null||c==="string"&&typeof e==="string"||c==="boolean"&&typeof e==="boolean"||c==="number"&&typeof e==="number"&&Number.isFinite(e)||c==="integer"&&typeof e==="number"&&Number.isInteger(e)||c==="array"&&Array.isArray(e)||c==="object"&&C(e))){r.push({code:a("type"),message:`${o}: value does not match the declared type`,elementKey:i,path:n});return}if(t.enum&&!t.enum.some((u)=>Object.is(u,e)))r.push({code:a("enum"),message:`${o}: value is outside the declared enum`,elementKey:i,path:n});if(c==="object"&&C(e)){if(t.additionalProperties===!1){for(let u of Object.keys(e))if(!Object.hasOwn(t.properties??{},u))r.push({code:s==="props"?"props:unknown":"actions:params-unknown",message:`${o}: object field is not declared`,elementKey:i,path:`${n}.${u}`})}for(let u of t.required??[])if(!Object.hasOwn(e,u))r.push({code:a("required"),message:`${o}: required object field is missing`,elementKey:i,path:`${n}.${u}`});for(let[u,d]of Object.entries(t.properties??{}))if(Object.hasOwn(e,u))X(e[u],d,`${n}.${u}`,r,o,i,s)}if(c==="array"&&Array.isArray(e)&&t.items)e.forEach((u,d)=>{X(u,t.items,`${n}[${d}]`,r,o,i,s)})}function xe(e,t,n,r,o,i,s){if(!n)return;for(let[a,l]of Object.entries(n)){let c=`${r}.${a}`;if(Q(l,c,e,o,i)&&t&&Object.hasOwn(t,a))X(t[a],l,c,e,o,i,s)}}function ke(e,t,n,r,o,i,s={}){for(let[a,l]of Object.entries(t??{})){let c=r==="action-value"&&!s.evaluatedParams?.has(a)?"action-literal":r;A(l,`${n}.${a}`,c,e,o,i)}}function Q(e,t,n,r,o){if(Object.keys(e).some((s)=>!be.has(s))||e.type!==void 0&&!he.has(e.type)||!Ce(e)||e.required!==void 0&&(!Array.isArray(e.required)||e.required.some((s)=>typeof s!=="string"))||e.items!==void 0&&(e.type!=="array"||!C(e.items))||e.properties!==void 0&&(e.type!=="object"||!C(e.properties))||e.additionalProperties!==void 0&&(e.type!=="object"||typeof e.additionalProperties!=="boolean")||Boolean(e.required?.length)&&e.type!=="object")return n.push({code:"schema:unsupported",message:`${r}: schema contains unsupported constraints`,elementKey:o,path:t}),!1;for(let[s,a]of Object.entries(e.properties??{}))if(!Q(a,`${t}.${s}`,n,r,o))return!1;if(e.items&&!Q(e.items,`${t}[]`,n,r,o))return!1;return!0}function U(e,t,n,r,o,i,s){if(!Array.isArray(r)){if(s)e.push({code:"actions:chain",message:`${t}: action chain must be an array`,elementKey:n,path:o});return}for(let[a,l]of r.entries()){if(!C(l)){if(s)e.push({code:"actions:chain",message:`${t}: action step must be an object`,elementKey:n,path:`${o}[${a}]`});continue}let c=l.action,p=`${o}[${a}]`;if(s&&(typeof c!=="string"||c.length===0))e.push({code:"actions:chain",message:`${t}: action step needs an action name`,elementKey:n,path:`${p}.action`});if(typeof c==="string"&&!me.has(c)&&!Object.hasOwn(i.actions??{},c))e.push({code:"actions:registered",message:`${t}: action "${c}" is not in the catalog. Registered actions: ${[...me,...Object.keys(i.actions??{})].join(", ")}. No equivalent is guaranteed: preserve the requirement and report unsupported behavior instead of disabling it.`,elementKey:n,path:`${p}.action`});if(s&&typeof c==="string"){let u=Object.hasOwn(i.actions??{},c)?i.actions[c]:Object.hasOwn(W,c)?W[c]:void 0,d=l.params;if(d!==void 0&&!C(d))e.push({code:"actions:chain",message:`${t}: action params must be an object`,elementKey:n,path:`${p}.params`});else{if(C(d))ke(e,d,`${p}.params`,"action-value",t,n,{evaluatedParams:new Set(u?.generation?.evaluatedParams??[])});if(u)xe(e,C(d)?d:void 0,u.params,`${p}.params`,t,n,"actions:params")}}if(Object.hasOwn(l,"onSuccess"))U(e,t,n,l.onSuccess,`${p}.onSuccess`,i,s);if(Object.hasOwn(l,"onError"))U(e,t,n,l.onError,`${p}.onError`,i,s)}}function Se(e,t,n=!1){let r=[],o=new Set([...fe(e.state),...e.connectionIds??[]]),i=new Set(fe(e.computed)),s=e.pageId??e.root;if(e.computed)for(let[a,l]of Object.entries(e.computed)){if(n)A(l,`computed.${a}`,"computed",r,`${s}.computed`,s);V(r,`${s}.computed`,s,l,`computed.${a}`,o,i,Qe(e,t))}if(e.urlState)for(let[a,l]of Object.entries(e.urlState)){if(!o.has(a))r.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" is not declared in state`,elementKey:s,path:`urlState.${a}`});if(!l||typeof l.param!=="string"||l.param.length===0)r.push({code:"refs:url-state-declared",message:`${s}: urlState "${a}" needs a param name`,elementKey:s,path:`urlState.${a}.param`})}for(let[a,l]of Object.entries(e.elements)){let c=Object.hasOwn(t.components,l.type)?t.components[l.type]:void 0;if(!c)continue;let p=`${s}/${a}`,u=Ie(c.props);if(n)ke(r,l.props,"props","props",p,a);if(l.visible!==null&&typeof l.visible==="object"){let d=Object.keys(l.visible);if(Array.isArray(l.visible)||d.length!==1||!d[0]?.startsWith("_"))r.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression, not a literal record`,elementKey:a,path:"visible"})}if(n&&l.visible!==void 0)if(typeof l.visible!=="boolean"&&!F(l.visible))r.push({code:"visibility:expression",message:`${p}: visible must be a boolean or an operator expression`,elementKey:a,path:"visible"});else A(l.visible,"visible","visible",r,p,a);if(V(r,p,a,l.props,"props",o,i,u),V(r,p,a,l.visible,"visible",o,i,u),V(r,p,a,l.events,"events",o,i,u),c.props){let d=new Set(Object.keys(c.props));for(let g of Object.keys(l.props??{}))if(!d.has(g))r.push({code:"props:declared",message:`${p}: prop "${g}" is not declared on ${l.type}`,elementKey:a,path:`props.${g}`});if(n)xe(r,l.props,c.props,"props",p,a,"props")}if(c.events){let d=new Set(Object.keys(c.events));for(let[g,m]of Object.entries(l.events??{})){if(!d.has(g))r.push({code:"events:declared",message:`${p}: event "${g}" is not declared on ${l.type}`,elementKey:a,path:`events.${g}`});U(r,p,a,m,`events.${g}`,t,n)}}else for(let[d,g]of Object.entries(l.events??{}))U(r,p,a,g,`events.${d}`,t,n)}return r.map((a)=>({...a,path:a.elementKey===s?`${s}/${a.path}`:`${s}/${a.elementKey}/${a.path}`}))}function Ie(e){let t=new Set;for(let n of Object.values(e??{})){let r=Ze(n);if(!r)continue;for(let o of r)t.add(o)}return t.size>0?t:void 0}function Qe(e,t){let n=new Set;for(let r of Object.values(e.elements)){let o=Object.hasOwn(t.components,r.type)?t.components[r.type]:void 0,i=Ie(o?.props);if(!i)continue;for(let s of i)n.add(s)}return n.size>0?n:void 0}function Pe(e){return e.map((t)=>({code:t.code,message:t.message,elementKey:t.elementKey,path:t.path}))}var Re=[{id:"_request",bucket:"server",description:"Executes a connection request server-side and injects the result"},{id:"_secret",bucket:"server",description:"Reads a server-side secret value; never transmitted to the client"}],q=new Set(Re.map((e)=>e.id));function ee(e){return{...e,...e.props?{props:{...e.props}}:{},...e.children?{children:[...e.children]}:{},...e.slots?{slots:{...e.slots}}:{},...e.events?{events:{...e.events}}:{}}}function ve(e){return{...e,...e.roots?{roots:[...e.roots]}:{},...e.state?{state:{...e.state}}:{},elements:Object.fromEntries(Object.entries(e.elements).map(([t,n])=>[t,ee(n)]))}}function tt(e){return e.type==="compiler:operator"}function nt(e){return e.type==="compiler:validator"}class N{operators;validators;constructor(e={}){let t=(e.capabilities??[]).filter(tt).map((r)=>r.contribution),n=(e.capabilities??[]).filter(nt).map((r)=>r.contribution);this.operators=[...e.operators??[],...t],this.validators=[...e.validators??[],...n]}merge(e){if(e instanceof N)return new N({operators:[...this.operators,...e.operators],validators:[...this.validators,...e.validators]});return new N({operators:[...this.operators,...e.operators??[]],validators:[...this.validators,...e.validators??[]],...e.capabilities?{capabilities:e.capabilities}:{}})}}function rt(e={}){return new N(e)}function ot(e,t,n){let r=e.pages.find((s)=>s.id===t),o=[...r?.rootBlockIds??[]],i=Object.fromEntries(Object.entries(e.blocks).filter(([,s])=>s.pageId===t).map(([s,a])=>{let{id:l,pageId:c,parentId:p,...u}=a;return[s,ee(u)]}));if(n&&o.length===0){let s=e.blocks.__empty__?`__empty__:${t}`:"__empty__";o.push(s),i[s]={type:"Empty"}}return{version:e.version,root:o[0]??"__empty__",roots:o,pageId:t,...r?.state?{state:r.state}:{},...r?.computed?{computed:r.computed}:{},...r?.urlState?{urlState:r.urlState}:{},...e.connections?{connectionIds:e.connections.map((s)=>s.id)}:{},elements:i}}function it(e,t){let n=[...t.roots??e.roots??[]];if(n.length>0&&t.root!==e.root)n[0]=t.root;else if(n.length===0&&t.elements[t.root])n.push(t.root);return n}async function st(e,t,n,r){let o=ve(e);for(let i of n.operators){let s={spec:o,catalog:t,warnings:r,getElement(l){return o.elements[l]},updateElement(l,c){o={...o,elements:{...o.elements,[l]:ee(c)}}},addWarning(l){r.push(l)}},a=await i.apply(s);if(a)o=ve(a)}return o}function Ae(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function at(e,t,n,r,o){let i=Object.entries(e.elements);for(let a of e.roots?.length?e.roots:[e.root])if(!e.elements[a])n.push({code:"missing-root",message:`Root element "${a}" is missing from the elements map`,elementKey:a});for(let[a,l]of i){if(!(Ae(t.components,l.type)??Ae(t.templates,l.type)))r.push({missingType:l.type,elementKey:a,reason:l.template?"missing-template":"missing-component",context:`Element ${a} references ${l.type}`,path:`blocks.${a}.type`});for(let p of l.children??[])if(!e.elements[p])n.push({code:"dangling-child",message:`Element "${a}" references missing child "${p}"`,elementKey:a})}let s=Se(e,t,o);if(o){for(let a of s)r.push({missingType:a.code,elementKey:a.elementKey,reason:"invalid-spec",context:a.message,code:a.code,path:a.path});return}n.push(...Pe(s))}async function lt(e,t,n,r,o){for(let i of n.validators){let s={spec:e,catalog:t,warnings:r,gaps:o,addWarning(a){r.push(a)},addGap(a){o.push(a)}};await i.validate(s)}}function E(e,t){if(!e||typeof e!=="object")return;if(Array.isArray(e)){for(let n of e)E(n,t);return}for(let[n,r]of Object.entries(e)){if(n.startsWith("_"))t.add(n);E(r,t)}}function ct(e){let t=new Map;for(let[r,o]of Object.entries(e.blocks)){let i=new Set;E(o.props,i),E(o.visible,i);for(let s of i){let a=t.get(s)??new Set;a.add(r),t.set(s,a)}}for(let r of e.pages){let o=new Set;E(r.computed,o),E(r.lifecycle,o);for(let i of o){let s=t.get(i)??new Set;s.add(r.id),t.set(i,s)}}let n=[];for(let[r,o]of t){let i=j.has(r)?"client":q.has(r)?"server":r==="_ref"?"build":"shared";n.push({operatorId:r,bucket:i,blockIds:[...o]})}return n}async function we(e,t,n={}){let r=[],o=[],i=n.registry??rt(),s=J(e,n.templates),a=Object.create(null),l=[];for(let[u,d]of s.pages.entries()){let g=ot(s,d.id,u===0),m=await st(g,t,i,r);at(m,t,r,o,n.strict===!0),await lt(m,t,i,r,o);for(let[y,D]of Object.entries(m.elements)){let ne=a[y];if(ne)throw new h("duplicate-block-id",`Compiler output block id "${y}" conflicts across pages`,{blockId:y,firstPageId:ne.pageId,pageId:d.id});let z=s.blocks[y];a[y]={...D,id:y,pageId:d.id,...z?.pageId===d.id&&z.parentId?{parentId:z.parentId}:{}}}l.push({...d,rootBlockIds:it(g,m)})}let c={version:"2.0",pages:l,...s.design?{design:s.design}:{},...s.connections?{connections:s.connections.map((u)=>({...u}))}:{},blocks:a};if(n.strict===!0&&e.version!=="2.0")o.push({missingType:"spec:version",elementKey:"spec",reason:"invalid-spec",context:"Native Spec version must be 2.0",code:"spec:version",path:"version"});let p=ct(c);return{spec:c,gaps:o,warnings:r,...p.length>0?{operatorUsage:p}:{}}}function Fe(e){let t=Be(e.title??Ut(e.source)??"artifact");switch(e.format){case"html":return{bytes:De(Ee(e.source,e.title)),filename:`${t}.html`,contentType:"text/html; charset=utf-8"};case"markdown":return{bytes:De(e.source),filename:`${t}.md`,contentType:"text/markdown; charset=utf-8"};case"zip":{let n=pt(t),o=((e.files?.length)?e.files:[{path:"index.html",content:Ee(e.source,e.title)}]).map((a)=>({...a,path:`${n}/${a.path}`})),i=e.title??t,s=[...o,{path:`${n}/DESIGN-HANDOFF.md`,content:ut(i,o,n)},{path:`${n}/design-manifest.json`,content:JSON.stringify(dt(i,o),null,2)}];return{bytes:Ne(s),filename:`${t}.zip`,contentType:"application/zip"}}case"pptx":return{bytes:xt(e.source,e.title??t),filename:`${t}.pptx`,contentType:"application/vnd.openxmlformats-officedocument.presentationml.presentation"}}}function pt(e){return Be(e??"artifact")}function dt(e,t){return{contract:"uibot.artifact.zip",title:e,generator:"UIBot",files:t.map((n)=>n.path)}}function ut(e,t,n){let r=t.map((l)=>`- \`${l.path}\``).join(`
|
|
2
2
|
`),o=[],i=t.filter((l)=>/\.html?$/i.test(l.path)),s=t.filter((l)=>/\.md$/i.test(l.path)),a=t.filter((l)=>/\.ya?ml$/i.test(l.path));if(i.length>0)o.push(`- Preview the HTML files in a browser: ${i.map((l)=>`\`${l.path}\``).join(", ")} — no build step required.`);if(s.length>0)o.push(`- Read or edit the Markdown files in a Markdown reader or editor: ${s.map((l)=>`\`${l.path}\``).join(", ")}.`);if(a.length>0)o.push(`- Keep the Spec YAML files as editable source: ${a.map((l)=>`\`${l.path}\``).join(", ")}.`);if(o.length===0)o.push("- No HTML, Markdown, or Spec YAML files are included with specialized usage guidance.");return[`# ${e} — Design Handoff`,"","Exported from UIBot. This bundle is self-contained: the artifact files plus","this note and a machine-readable manifest.","","## Contents","",r,`- \`${n}/DESIGN-HANDOFF.md\` (this file)`,`- \`${n}/design-manifest.json\` (machine-readable file list)`,"","## Usage","",...o,"","_Generated by UIBot._"].join(`
|
|
3
|
-
`)}function
|
|
4
|
-
`)}var
|
|
3
|
+
`)}function Ee(e,t="UIBot artifact"){let n=e.trim(),r=n.slice(0,128).toLowerCase();if(r.startsWith("<!doctype")||r.startsWith("<html"))return n;return["<!doctype html>",'<html lang="en">',"<head>",' <meta charset="utf-8" />',' <meta name="viewport" content="width=device-width, initial-scale=1" />',` <title>${je(t)}</title>`,"</head>","<body>",e,"</body>","</html>"].join(`
|
|
4
|
+
`)}var gt=/^\uE000(ul|ol)(\d+)\uE001/;function mt(e){let t=[];return e.replace(/<(\/?)(ul|ol|li)\b[^>]*>/gi,(n,r,o)=>{let i=o.toLowerCase();if(i==="li"){if(r)return`
|
|
5
5
|
`;return`
|
|
6
6
|
${t[t.length-1]??"ul"}${Math.max(0,t.length-1)}`}if(r)t.pop();else t.push(i);return`
|
|
7
|
-
`})}function
|
|
7
|
+
`})}function ft(e){let t=gt.exec(e);if(!t)return{text:P(e)};return{text:P(e.slice(t[0].length)),list:{kind:t[1],lvl:Number(t[2])}}}function yt(e){let t=/<html\b[^>]*>/i.exec(e)?.[0];if(!t)return null;let n=/\s(?:xml:)?lang\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(t);return(n?.[1]??n?.[2]??n?.[3]??"").trim()||null}function ht(e){if(/[\u3040-\u30ff\u31f0-\u31ff\uff66-\uff9f]/.test(e))return"ja-JP";if(/[\uac00-\ud7af\u1100-\u11ff\u3130-\u318f]/.test(e))return"ko-KR";if(/[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/.test(e))return"zh-CN";return"en-US"}var bt=/^(?:zh|ja|ko)(?:-|$)/i;function te(e,t){let n=t??ht(e),r=bt.test(n)?' altLang="en-US"':"";return`lang="${T(n)}"${r}`}function Ct(e){let t=_(e,"section"),n=t.length>0?[]:Vt(e);return(t.length>0?t:n.length>0?n:_(e,"article").length>0?_(e,"article"):[e]).map((o,i)=>{let s=$t(o),a=s.reduce((m,y)=>m.replace(y,""),o),l=Me(a,["h1","h2","h3"])||Te(a,"data-title")||`Slide ${i+1}`,c=_(a,"li").map((m)=>P(w(m))).filter(Boolean),p=P(w(H(a,["script","style","svg"]))),u=s.flatMap((m)=>{if(P(w(H(m,["script","style","svg"]))))return m.split(/\n{2,}|<\/p>|<br\s*\/?>/i);let D=/^<[^>]*>/.exec(m)?.[0]??"";return[Te(D,"data-notes")]}).map((m)=>P(w(H(m,["script","style","svg"])))).filter(Boolean),d=H(a,["script","style","svg"]);for(let m of["h1","h2","h3"]){let y=_(d,m)[0];if(y){d=d.replace(y,"");break}}d=mt(d).replace(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi,(m,y)=>`${(y.match(/<t[dh]\b[^>]*>[\s\S]*?<\/t[dh]>/gi)??[]).map((D)=>P(w(D))).join(" | ")}
|
|
8
8
|
`).replace(/<\/(?:p|div|h[1-6]|table|header|footer)>/gi,`
|
|
9
|
-
`);let g=
|
|
10
|
-
`).map(dt).filter((m)=>m.text);return{title:k(l),bullets:c,body:p,notes:u,paragraphs:g}})}function yt(e,t="UIBot artifact"){let n=ft(e).flatMap(wt),r=ut(e),o=n.some((s)=>s.notes.length>0),i=[{path:"[Content_Types].xml",content:ht(n)},{path:"_rels/.rels",content:Ct()},{path:"docProps/app.xml",content:bt(n.length)},{path:"docProps/core.xml",content:xt(t)},{path:"ppt/presentation.xml",content:Pt(n.length,o)},{path:"ppt/_rels/presentation.xml.rels",content:kt(n.length,o)},{path:"ppt/theme/theme1.xml",content:Lt()},{path:"ppt/slideMasters/slideMaster1.xml",content:St()},{path:"ppt/slideMasters/_rels/slideMaster1.xml.rels",content:Rt()},{path:"ppt/slideLayouts/slideLayout1.xml",content:It()},{path:"ppt/slideLayouts/_rels/slideLayout1.xml.rels",content:vt()}];if(o)i.push({path:"ppt/notesMasters/notesMaster1.xml",content:Dt()}),i.push({path:"ppt/notesMasters/_rels/notesMaster1.xml.rels",content:Ft()});return n.forEach((s,a)=>{let l=a+1;if(i.push({path:`ppt/slides/slide${l}.xml`,content:_t(s,l,r)}),i.push({path:`ppt/slides/_rels/slide${l}.xml.rels`,content:At(l,s.notes.length>0)}),s.notes.length>0)i.push({path:`ppt/notesSlides/notesSlide${l}.xml`,content:Tt(s,l,r)}),i.push({path:`ppt/notesSlides/_rels/notesSlide${l}.xml.rels`,content:Ot(l)})}),Te(i)}function Te(e){let t=new TextEncoder,n=[],r=[],o=0;for(let l of e){let c=Vt(l.path),p=t.encode(c),u=typeof l.content==="string"?t.encode(l.content):l.content,d=Ut(u),g=F([x(67324752),f(20),f(2048),f(0),f(0),f(0),x(d),x(u.length),x(u.length),f(p.length),f(0),p,u]);n.push(g),r.push(F([x(33639248),f(20),f(20),f(2048),f(0),f(0),f(0),x(d),x(u.length),x(u.length),f(p.length),f(0),f(0),f(0),f(0),x(0),x(o),p])),o+=g.length}let i=o,s=F(r),a=F([x(101010256),f(0),f(0),f(e.length),f(e.length),x(s.length),x(i),f(0)]);return F([...n,s,a])}function ht(e){let t=e.map((r,o)=>`<Override PartName="/ppt/slides/slide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`).join(""),n=e.map((r,o)=>r.notes.length>0?`<Override PartName="/ppt/notesSlides/notesSlide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"/>`:"").join("");return C(['<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">','<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>','<Default Extension="xml" ContentType="application/xml"/>','<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>','<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>','<Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>','<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>','<Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>','<Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>',t,e.some((r)=>r.notes.length>0)?'<Override PartName="/ppt/notesMasters/notesMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"/>':"",n,"</Types>"])}function Ct(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>','<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>',"</Relationships>"])}function bt(e){return C(['<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">',"<Application>UIBot</Application>",`<Slides>${e}</Slides>`,"</Properties>"])}function xt(e){let t=new Date().toISOString();return C(['<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">',`<dc:title>${E(e)}</dc:title>`,"<dc:creator>UIBot</dc:creator>",`<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>`,`<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>`,"</cp:coreProperties>"])}function Pt(e,t){let n=Array.from({length:e},(r,o)=>`<p:sldId id="${256+o}" r:id="rId${o+2}"/>`).join("");return C(['<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>',t?'<p:notesMasterIdLst><p:notesMasterId r:id="rIdNotes"/></p:notesMasterIdLst>':"",`<p:sldIdLst>${n}</p:sldIdLst>`,'<p:sldSz cx="12192000" cy="6858000" type="screen16x9"/>','<p:notesSz cx="6858000" cy="9144000"/>',"</p:presentation>"])}function kt(e,t){let n=[t?'<Relationship Id="rIdNotes" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="notesMasters/notesMaster1.xml"/>':"",'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>',...Array.from({length:e},(r,o)=>`<Relationship Id="rId${o+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide${o+1}.xml"/>`)].join("");return C([`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${n}</Relationships>`])}function St(){return C(['<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>','<p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/></p:sldLayoutIdLst>',"<p:txStyles><p:titleStyle/><p:bodyStyle/><p:otherStyle/></p:txStyles>","</p:sldMaster>"])}function Rt(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function It(){return C(['<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1">','<p:cSld name="Blank"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>',"</p:sldLayout>"])}function vt(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>',"</Relationships>"])}function At(e,t){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>',t?`<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" Target="../notesSlides/notesSlide${e}.xml"/>`:"","</Relationships>"])}function wt(e){let t=[],n=[];for(let r of e.paragraphs){let o=r.text,i=!1,s=(c)=>{n.push(i?{...r,text:c,continued:!0}:{...r,text:c}),i=!0},a="",l=0;for(let c of o){let p=(c.codePointAt(0)??0)>255?2:/[MWmw]/.test(c)?1.8:1;if(l+p>64){let u=a.lastIndexOf(" "),d=u>0?u+1:a.length;s(a.slice(0,d)),a=a.slice(d),l=Array.from(a).reduce((g,m)=>g+((m.codePointAt(0)??0)>255?2:/[MWmw]/.test(m)?1.8:1),0)}if(n.length===8)t.push({...e,paragraphs:n}),n=[];a+=c,l+=p}if(a)s(a);if(n.length===8)t.push({...e,paragraphs:n}),n=[]}if(n.length>0||t.length===0)t.push({...e,paragraphs:n});return t}var ve=342900;function Et(e){if(!e.list)return'<a:pPr><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>';let{kind:n,lvl:r}=e.list,o=ve*(r+1);if(e.continued)return`<a:pPr marL="${o}" lvl="${r}" indent="0"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>`;return`<a:pPr marL="${o}" lvl="${r}" indent="-${ve}"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft>${n==="ol"?'<a:buAutoNum type="arabicPeriod"/>':'<a:buFont typeface="Arial"/><a:buChar char="•"/>'}</a:pPr>`}function _t(e,t,n=null){let r=e.paragraphs.map((o)=>`<a:p>${Et(o)}<a:r><a:rPr ${Q(o.text,n)} sz="2200"/><a:t xml:space="preserve">${E(o.text)}</a:t></a:r></a:p>`).join("");return C(['<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree>','<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',Oe(2,`Title ${t}`,e.title,685800,609600,10972800,914400,3600,!0,n),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Body ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="914400" y="1828800"/><a:ext cx="10363200" cy="4267200"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${r||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld>","</p:sld>"])}function Tt(e,t,n=null){let r=e.notes.map((o)=>`<a:p><a:r><a:rPr ${Q(o,n)} sz="1800"/><a:t>${E(o)}</a:t></a:r></a:p>`).join("");return C(['<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">',"<p:cSld><p:spTree>",'<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',Oe(2,`Notes title ${t}`,e.title,685800,457200,5486400,457200,1600,!0,n),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Speaker notes ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="685800" y="1066800"/><a:ext cx="5486400" cy="7010400"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${r||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>","</p:notes>"])}function Ot(e){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">',`<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="../slides/slide${e}.xml"/>`,'<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="../notesMasters/notesMaster1.xml"/>',"</Relationships>"])}function Dt(){return C(['<p:notesMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>',"<p:notesStyle/>","</p:notesMaster>"])}function Ft(){return C(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function Oe(e,t,n,r,o,i,s,a,l,c=null){let p=l?' b="1"':"";return`<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${E(t)}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="${r}" y="${o}"/><a:ext cx="${i}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/><a:p><a:r><a:rPr ${Q(n,c)} sz="${a}"${p}/><a:t>${E(n)}</a:t></a:r></a:p></p:txBody></p:sp>`}function Lt(){return C(['<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="UIBot">','<a:themeElements><a:clrScheme name="UIBot"><a:dk1><a:srgbClr val="111111"/></a:dk1><a:lt1><a:srgbClr val="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="222222"/></a:dk2><a:lt2><a:srgbClr val="F5F5F5"/></a:lt2><a:accent1><a:srgbClr val="C15F3C"/></a:accent1><a:accent2><a:srgbClr val="3C7A89"/></a:accent2><a:accent3><a:srgbClr val="E0B44C"/></a:accent3><a:accent4><a:srgbClr val="6F6A5F"/></a:accent4><a:accent5><a:srgbClr val="8F4D2F"/></a:accent5><a:accent6><a:srgbClr val="4D5D53"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="UIBot"><a:majorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="UIBot"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements>',"</a:theme>"])}function C(e){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${e.join("")}`}function w(e,t){let n=new RegExp(`<${t}\\b[^>]*>[\\s\\S]*?<\\/${t}>`,"gi");return e.match(n)??[]}function Mt(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:data-(?:pptx-)?slide(?:-container)?\b|class\s*=\s*["'][^"']*\bslide\b))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function Bt(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:\sdata-notes(?:\s|=|>)|class\s*=\s*["'][^"']*(?<![\w-])(?:notes|note|speaker-note)(?![\w-])))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function U(e,t){let n=e;for(let r of t)n=n.replace(new RegExp(`<${r}\\b[^>]*>[\\s\\S]*?<\\/${r}>`,"gi"),"");return n}function De(e,t){for(let n of t){let r=w(e,n)[0];if(r)return v(r)}return""}function Ae(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[1]??r?.[2]??""}function v(e){return e.replace(/<br\s*\/?>/gi,`
|
|
9
|
+
`);let g=w(d).split(`
|
|
10
|
+
`).map(ft).filter((m)=>m.text);return{title:P(l),bullets:c,body:p,notes:u,paragraphs:g}})}function xt(e,t="UIBot artifact"){let n=Ct(e).flatMap(Dt),r=yt(e),o=n.some((s)=>s.notes.length>0),i=[{path:"[Content_Types].xml",content:kt(n)},{path:"_rels/.rels",content:St()},{path:"docProps/app.xml",content:It(n.length)},{path:"docProps/core.xml",content:Pt(t)},{path:"ppt/presentation.xml",content:Rt(n.length,o)},{path:"ppt/_rels/presentation.xml.rels",content:vt(n.length,o)},{path:"ppt/theme/theme1.xml",content:jt()},{path:"ppt/slideMasters/slideMaster1.xml",content:At()},{path:"ppt/slideMasters/_rels/slideMaster1.xml.rels",content:wt()},{path:"ppt/slideLayouts/slideLayout1.xml",content:Et()},{path:"ppt/slideLayouts/_rels/slideLayout1.xml.rels",content:_t()}];if(o)i.push({path:"ppt/notesMasters/notesMaster1.xml",content:Mt()}),i.push({path:"ppt/notesMasters/_rels/notesMaster1.xml.rels",content:Bt()});return n.forEach((s,a)=>{let l=a+1;if(i.push({path:`ppt/slides/slide${l}.xml`,content:Ft(s,l,r)}),i.push({path:`ppt/slides/_rels/slide${l}.xml.rels`,content:Tt(l,s.notes.length>0)}),s.notes.length>0)i.push({path:`ppt/notesSlides/notesSlide${l}.xml`,content:Nt(s,l,r)}),i.push({path:`ppt/notesSlides/_rels/notesSlide${l}.xml.rels`,content:Lt(l)})}),Ne(i)}function Ne(e){let t=new TextEncoder,n=[],r=[],o=0;for(let l of e){let c=Ht(l.path),p=t.encode(c),u=typeof l.content==="string"?t.encode(l.content):l.content,d=zt(u),g=L([k(67324752),f(20),f(2048),f(0),f(0),f(0),k(d),k(u.length),k(u.length),f(p.length),f(0),p,u]);n.push(g),r.push(L([k(33639248),f(20),f(20),f(2048),f(0),f(0),f(0),k(d),k(u.length),k(u.length),f(p.length),f(0),f(0),f(0),f(0),k(0),k(o),p])),o+=g.length}let i=o,s=L(r),a=L([k(101010256),f(0),f(0),f(e.length),f(e.length),k(s.length),k(i),f(0)]);return L([...n,s,a])}function kt(e){let t=e.map((r,o)=>`<Override PartName="/ppt/slides/slide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slide+xml"/>`).join(""),n=e.map((r,o)=>r.notes.length>0?`<Override PartName="/ppt/notesSlides/notesSlide${o+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"/>`:"").join("");return b(['<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">','<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>','<Default Extension="xml" ContentType="application/xml"/>','<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>','<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>','<Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/>','<Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>','<Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/>','<Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/>',t,e.some((r)=>r.notes.length>0)?'<Override PartName="/ppt/notesMasters/notesMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"/>':"",n,"</Types>"])}function St(){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="ppt/presentation.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>','<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>',"</Relationships>"])}function It(e){return b(['<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">',"<Application>UIBot</Application>",`<Slides>${e}</Slides>`,"</Properties>"])}function Pt(e){let t=new Date().toISOString();return b(['<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">',`<dc:title>${T(e)}</dc:title>`,"<dc:creator>UIBot</dc:creator>",`<dcterms:created xsi:type="dcterms:W3CDTF">${t}</dcterms:created>`,`<dcterms:modified xsi:type="dcterms:W3CDTF">${t}</dcterms:modified>`,"</cp:coreProperties>"])}function Rt(e,t){let n=Array.from({length:e},(r,o)=>`<p:sldId id="${256+o}" r:id="rId${o+2}"/>`).join("");return b(['<p:presentation xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="rId1"/></p:sldMasterIdLst>',t?'<p:notesMasterIdLst><p:notesMasterId r:id="rIdNotes"/></p:notesMasterIdLst>':"",`<p:sldIdLst>${n}</p:sldIdLst>`,'<p:sldSz cx="12192000" cy="6858000" type="screen16x9"/>','<p:notesSz cx="6858000" cy="9144000"/>',"</p:presentation>"])}function vt(e,t){let n=[t?'<Relationship Id="rIdNotes" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="notesMasters/notesMaster1.xml"/>':"",'<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/>',...Array.from({length:e},(r,o)=>`<Relationship Id="rId${o+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="slides/slide${o+1}.xml"/>`)].join("");return b([`<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">${n}</Relationships>`])}function At(){return b(['<p:sldMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>','<p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="rId1"/></p:sldLayoutIdLst>',"<p:txStyles><p:titleStyle/><p:bodyStyle/><p:otherStyle/></p:txStyles>","</p:sldMaster>"])}function wt(){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>','<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function Et(){return b(['<p:sldLayout xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main" type="blank" preserve="1">','<p:cSld name="Blank"><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>',"</p:sldLayout>"])}function _t(){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="../slideMasters/slideMaster1.xml"/>',"</Relationships>"])}function Tt(e,t){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" Target="../slideLayouts/slideLayout1.xml"/>',t?`<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" Target="../notesSlides/notesSlide${e}.xml"/>`:"","</Relationships>"])}function Dt(e){let t=[],n=[];for(let r of e.paragraphs){let o=r.text,i=!1,s=(c)=>{n.push(i?{...r,text:c,continued:!0}:{...r,text:c}),i=!0},a="",l=0;for(let c of o){let p=(c.codePointAt(0)??0)>255?2:/[MWmw]/.test(c)?1.8:1;if(l+p>64){let u=a.lastIndexOf(" "),d=u>0?u+1:a.length;s(a.slice(0,d)),a=a.slice(d),l=Array.from(a).reduce((g,m)=>g+((m.codePointAt(0)??0)>255?2:/[MWmw]/.test(m)?1.8:1),0)}if(n.length===8)t.push({...e,paragraphs:n}),n=[];a+=c,l+=p}if(a)s(a);if(n.length===8)t.push({...e,paragraphs:n}),n=[]}if(n.length>0||t.length===0)t.push({...e,paragraphs:n});return t}var _e=342900;function Ot(e){if(!e.list)return'<a:pPr><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>';let{kind:n,lvl:r}=e.list,o=_e*(r+1);if(e.continued)return`<a:pPr marL="${o}" lvl="${r}" indent="0"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft><a:buNone/></a:pPr>`;return`<a:pPr marL="${o}" lvl="${r}" indent="-${_e}"><a:lnSpc><a:spcPct val="115000"/></a:lnSpc><a:spcAft><a:spcPts val="600"/></a:spcAft>${n==="ol"?'<a:buAutoNum type="arabicPeriod"/>':'<a:buFont typeface="Arial"/><a:buChar char="•"/>'}</a:pPr>`}function Ft(e,t,n=null){let r=e.paragraphs.map((o)=>`<a:p>${Ot(o)}<a:r><a:rPr ${te(o.text,n)} sz="2200"/><a:t xml:space="preserve">${T(o.text)}</a:t></a:r></a:p>`).join("");return b(['<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:bg><p:bgPr><a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill></p:bgPr></p:bg><p:spTree>','<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',Le(2,`Title ${t}`,e.title,685800,609600,10972800,914400,3600,!0,n),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Body ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="914400" y="1828800"/><a:ext cx="10363200" cy="4267200"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${r||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld>","</p:sld>"])}function Nt(e,t,n=null){let r=e.notes.map((o)=>`<a:p><a:r><a:rPr ${te(o,n)} sz="1800"/><a:t>${T(o)}</a:t></a:r></a:p>`).join("");return b(['<p:notes xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">',"<p:cSld><p:spTree>",'<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr>',Le(2,`Notes title ${t}`,e.title,685800,457200,5486400,457200,1600,!0,n),`<p:sp><p:nvSpPr><p:cNvPr id="3" name="Speaker notes ${t}"/><p:cNvSpPr txBox="1"/><p:nvPr><p:ph type="body" idx="1"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="685800" y="1066800"/><a:ext cx="5486400" cy="7010400"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/>${r||"<a:p/>"}</p:txBody></p:sp>`,"</p:spTree></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>","</p:notes>"])}function Lt(e){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">',`<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" Target="../slides/slide${e}.xml"/>`,'<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" Target="../notesMasters/notesMaster1.xml"/>',"</Relationships>"])}function Mt(){return b(['<p:notesMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">','<p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr></p:spTree></p:cSld>','<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>',"<p:notesStyle/>","</p:notesMaster>"])}function Bt(){return b(['<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">','<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="../theme/theme1.xml"/>',"</Relationships>"])}function Le(e,t,n,r,o,i,s,a,l,c=null){let p=l?' b="1"':"";return`<p:sp><p:nvSpPr><p:cNvPr id="${e}" name="${T(t)}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="${r}" y="${o}"/><a:ext cx="${i}" cy="${s}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap="square"/><a:lstStyle/><a:p><a:r><a:rPr ${te(n,c)} sz="${a}"${p}/><a:t>${T(n)}</a:t></a:r></a:p></p:txBody></p:sp>`}function jt(){return b(['<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="UIBot">','<a:themeElements><a:clrScheme name="UIBot"><a:dk1><a:srgbClr val="111111"/></a:dk1><a:lt1><a:srgbClr val="FFFFFF"/></a:lt1><a:dk2><a:srgbClr val="222222"/></a:dk2><a:lt2><a:srgbClr val="F5F5F5"/></a:lt2><a:accent1><a:srgbClr val="C15F3C"/></a:accent1><a:accent2><a:srgbClr val="3C7A89"/></a:accent2><a:accent3><a:srgbClr val="E0B44C"/></a:accent3><a:accent4><a:srgbClr val="6F6A5F"/></a:accent4><a:accent5><a:srgbClr val="8F4D2F"/></a:accent5><a:accent6><a:srgbClr val="4D5D53"/></a:accent6><a:hlink><a:srgbClr val="0563C1"/></a:hlink><a:folHlink><a:srgbClr val="954F72"/></a:folHlink></a:clrScheme><a:fontScheme name="UIBot"><a:majorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont><a:minorFont><a:latin typeface="Arial"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont></a:fontScheme><a:fmtScheme name="UIBot"><a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:fillStyleLst><a:lnStyleLst><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln><a:ln w="6350"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:ln></a:lnStyleLst><a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle></a:effectStyleLst><a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"/></a:solidFill></a:bgFillStyleLst></a:fmtScheme></a:themeElements>',"</a:theme>"])}function b(e){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>${e.join("")}`}function _(e,t){let n=new RegExp(`<${t}\\b[^>]*>[\\s\\S]*?<\\/${t}>`,"gi");return e.match(n)??[]}function Vt(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:data-(?:pptx-)?slide(?:-container)?\b|class\s*=\s*["'][^"']*\bslide\b))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function $t(e){let t=/<([a-z][\w:-]*)\b(?=[^>]*(?:\sdata-notes(?:\s|=|>)|class\s*=\s*["'][^"']*(?<![\w-])(?:notes|note|speaker-note)(?![\w-])))[^>]*>[\s\S]*?<\/\1>/gi;return e.match(t)??[]}function H(e,t){let n=e;for(let r of t)n=n.replace(new RegExp(`<${r}\\b[^>]*>[\\s\\S]*?<\\/${r}>`,"gi"),"");return n}function Me(e,t){for(let n of t){let r=_(e,n)[0];if(r)return w(r)}return""}function Te(e,t){let r=new RegExp(`\\b${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)')`,"i").exec(e);return r?.[1]??r?.[2]??""}function w(e){return e.replace(/<br\s*\/?>/gi,`
|
|
11
11
|
`).replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(?:10|13);/g,`
|
|
12
|
-
`)}function
|
|
12
|
+
`)}function P(e){return e.replace(/\s+/g," ").trim()}function Ut(e){return P(Me(e,["title","h1","h2"]))||null}function Be(e){return Array.from(e.trim().replace(/[^\p{L}\p{N}\p{M}_.-]+/gu,"-").replace(/^[.-]+|[.-]+$/g,"")).slice(0,80).join("")||"artifact"}function qt(e){let n=e.replaceAll("\\","/").replace(/^\/+/,"").split("/").filter(Boolean);if(n.length===0||n.some((r)=>r==="."||r===".."))return null;return n}function Ht(e){let t=qt(e);if(!t)throw Error(`invalid zip path: ${e}`);return t.join("/")}function je(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function T(e){return je(e).replace(/"/g,""").replace(/'/g,"'")}function De(e){return new TextEncoder().encode(e)}function L(e){let t=e.reduce((o,i)=>o+i.length,0),n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function f(e){let t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!0),t}function k(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}var Oe=null;function zt(e){let t=Oe??Wt();Oe=t;let n=4294967295;for(let r of e)n=t[(n^r)&255]^n>>>8;return(n^4294967295)>>>0}function Wt(){let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let r=0;r<8;r++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n>>>0}return e}async function Gt(e,t){if(!le(e))throw Error("Invalid application snapshot");if(e.uibotCommit!==t)throw Error("Application toolchain mismatch");let n=structuredClone(e),r={version:"2.0",pages:[{id:"main",path:"/",blocks:[{id:"collection_app",type:"CollectionApplication",props:{buildId:n.id}}]}]},o=re({components:{CollectionApplication:{name:"CollectionApplication",description:"Version-bound read-only paged Collection preview",category:"app",level:"L5",props:{buildId:{type:"string"}}}}}),i=await we(r,o,{strict:!0});if(i.gaps.length)throw Error("Application compile gaps");return{build:n,source:r,spec:i.spec}}async function ci(e,t){let n=await Gt(e,t),r=["# Collection application","","Read-only generated application. Inject an authenticated PagedCollectionApplicationClient in App.tsx; its rows port must use the version-fenced build endpoint. No credentials or records are included.","",`UIBot source: ${e.uibotCommit}`,`Build: ${e.id}`,`Schema: ${e.descriptor.schemaVersion}; view: ${e.view.id}@${e.view.version}`,"","Deployment and rollback require operator configuration; this archive is not a deployment receipt."].join(`
|
|
13
13
|
`),o=`import React from "react";
|
|
14
14
|
import { CollectionApplicationPreview } from "@uibot/renderer-react/collection-application";
|
|
15
15
|
import type { CompiledCollectionApplication, PagedCollectionApplicationClient } from "@uibot/contracts";
|
|
16
16
|
import artifact from "./application.json";
|
|
17
17
|
const application = artifact as CompiledCollectionApplication;
|
|
18
18
|
export default function App({ client }: { client: Pick<PagedCollectionApplicationClient, "rows"> }) { return <CollectionApplicationPreview application={application} client={client} />; }
|
|
19
|
-
`;return
|
|
19
|
+
`;return Fe({format:"zip",title:"collection-application",source:r,files:[{path:"application.json",content:JSON.stringify(n,null,2)},{path:"source.uibot.json",content:JSON.stringify(n.source,null,2)},{path:"App.tsx",content:`import React from "react";
|
|
20
20
|
import { CollectionApplicationPreview } from "@uibot/renderer-react/collection-application";
|
|
21
21
|
import type { CompiledCollectionApplication, PagedCollectionApplicationClient } from "@uibot/contracts";
|
|
22
22
|
import artifact from "./application.json";
|
|
23
23
|
const application = artifact as CompiledCollectionApplication;
|
|
24
24
|
export default function App({ client }: { client: Pick<PagedCollectionApplicationClient, "rows"> }) { return <CollectionApplicationPreview application={application} client={client} />; }
|
|
25
|
-
`},{path:"README.md",content:r}]})}export{
|
|
25
|
+
`},{path:"README.md",content:r}]})}export{Gt as compileCollectionApplication,ci as exportCollectionApplication};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type CreationRun } from "@uibot/contracts";
|
|
2
|
+
import type { CreationGenerateInput, CreationModelBinding } from "./creation-http.js";
|
|
3
|
+
import { type CreationRenderReviewer } from "./creation-render-review.js";
|
|
4
|
+
import { type CreationRepository } from "./creation-store.js";
|
|
5
|
+
export declare function createCreationAestheticReviewService(options: {
|
|
6
|
+
repository: CreationRepository;
|
|
7
|
+
renderer?: CreationRenderReviewer;
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
imageTokensPerCapture?: number;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
modelFor: (run: CreationRun) => Promise<CreationModelBinding>;
|
|
12
|
+
beforeModelRequest?: (input: CreationGenerateInput) => void;
|
|
13
|
+
}): {
|
|
14
|
+
review: (request: Request, projectId: string, artifactId: string) => Promise<Response>;
|
|
15
|
+
capture: (request: Request, projectId: string, artifactId: string) => Promise<Response>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreationRouteContext } from "./creation-routes.js";
|
|
2
|
+
/** Uses the same project transaction owner; application identity is the Web artifact identity. */
|
|
3
|
+
export declare function createCreationAppsHandler(context: CreationRouteContext): (request: Request, segments: string[]) => Promise<Response>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CreationDesignLane, CreationDesignTrace, DesignMdSelector, SkillSelector } from "@uibot/contracts";
|
|
2
|
+
import type { ResourceQueryService } from "@uibot/registry";
|
|
3
|
+
export interface CreationDesignContextOptions {
|
|
4
|
+
skillSelector?: SkillSelector;
|
|
5
|
+
designMdSelector?: DesignMdSelector;
|
|
6
|
+
craftResolver?: (slug: string) => {
|
|
7
|
+
title: string;
|
|
8
|
+
body: string;
|
|
9
|
+
} | null;
|
|
10
|
+
resourceQuery?: ResourceQueryService;
|
|
11
|
+
/** Upper bound only; selected material and output always reserve their budget first. */
|
|
12
|
+
maxTokens?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CreationDesignContextInput {
|
|
15
|
+
format: "html" | "spec";
|
|
16
|
+
kind: string;
|
|
17
|
+
intent: string;
|
|
18
|
+
guideIds: string[];
|
|
19
|
+
lane?: CreationDesignLane;
|
|
20
|
+
componentNames?: string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function creationDesignLane(input: Pick<CreationDesignContextInput, "kind" | "intent">, fallback?: CreationDesignLane): CreationDesignLane;
|
|
23
|
+
/** Only this opt-in section is reusable; legacy skills keep their complete output contract. */
|
|
24
|
+
export declare function creationDesignGuidance(body: string): string | undefined;
|
|
25
|
+
export declare function composeCreationDesignContext(options: CreationDesignContextOptions | undefined, input: CreationDesignContextInput, availableTokens: number): {
|
|
26
|
+
text: string;
|
|
27
|
+
trace: CreationDesignTrace;
|
|
28
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Catalog, CreationProject, CreationRequirementFinding, CreationRun } from "@uibot/contracts";
|
|
2
|
+
import type { ResourceQueryService } from "@uibot/registry";
|
|
3
|
+
/** Dictionary entries are literal path prefixes, never executable expressions. */
|
|
4
|
+
export declare function compactCreationFindings(findings: CreationRequirementFinding[]): string;
|
|
5
|
+
/** Existing source dependencies are mandatory; intent retrieval only adds installed entries. */
|
|
6
|
+
export declare function creationEditCatalog(project: CreationProject, run: CreationRun, catalog: Catalog, query?: ResourceQueryService): Catalog | undefined;
|
package/dist/creation-http.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
import { type CreationRenderReviewer } from "./creation-render-review.js";
|
|
2
|
+
export type { CreationRenderReviewInput, CreationRenderReviewer } from "./creation-render-review.js";
|
|
1
3
|
import type { CreationBrandAssets } from "./creation-brand.js";
|
|
2
4
|
import type { Catalog, CreationProject, CreationRun, CreationSourceFormat, DesignMdTokens, LLMBaseInferenceObservation, UIBotSpec } from "@uibot/contracts";
|
|
3
5
|
import type { CreationDomainDefinition } from "./creation-domains.js";
|
|
6
|
+
import type { CreationDesignContextOptions } from "./creation-design-context.js";
|
|
4
7
|
import { type CreationRepository } from "./creation-store.js";
|
|
5
8
|
import type { CreationWebDataGenerationGrant } from "./creation-web-data-prompt.js";
|
|
6
9
|
export type { CreationWebDataGenerationGrant } from "./creation-web-data-prompt.js";
|
|
7
10
|
export interface CreationGenerateInput {
|
|
8
11
|
inferenceId?: string;
|
|
9
|
-
purpose?: "generation" | "requirement-review";
|
|
12
|
+
purpose?: "generation" | "requirement-review" | "aesthetic-review";
|
|
13
|
+
/** Verified saved screenshot bytes only; never remote image URLs. */
|
|
14
|
+
images?: Array<{
|
|
15
|
+
type: "image_base64";
|
|
16
|
+
mediaType: "image/png";
|
|
17
|
+
data: string;
|
|
18
|
+
}>;
|
|
10
19
|
requestId?: string;
|
|
11
20
|
system: string;
|
|
12
21
|
prompt: string;
|
|
@@ -73,6 +82,17 @@ export interface CreateCreationHandlerOptions {
|
|
|
73
82
|
timeoutMs?: number;
|
|
74
83
|
/** Optional operator request ceiling; never substitutes model output. */
|
|
75
84
|
beforeModelRequest?: (input: CreationGenerateInput) => void;
|
|
85
|
+
/** Trusted, bounded design references. They never alter output or data authority. */
|
|
86
|
+
designContext?: CreationDesignContextOptions;
|
|
87
|
+
/** Optional read-only render evidence. Never invokes a model or confirms acceptance. */
|
|
88
|
+
renderReviewer?: CreationRenderReviewer;
|
|
89
|
+
/** Explicit opt-in. One page and at most two screenshots per model request. */
|
|
90
|
+
aestheticReview?: {
|
|
91
|
+
imageTokensPerCapture?: number;
|
|
92
|
+
timeoutMs?: number;
|
|
93
|
+
};
|
|
94
|
+
/** Host-installed session-local Mock.Collection driver for Spec previews. Default off. */
|
|
95
|
+
specPreviewCollections?: boolean;
|
|
76
96
|
/** Optional host-authorized data hint for plain HTML Web generation only. */
|
|
77
97
|
resolveWebData?: (request: CreationWebDataGenerationRequest) => Promise<CreationWebDataGenerationGrant | null | undefined>;
|
|
78
98
|
brandAssets?: CreationBrandAssets;
|
|
@@ -134,7 +154,7 @@ export declare function resolveCreationHtmlDesignTokens(option: CreationHtmlDesi
|
|
|
134
154
|
project: CreationProject;
|
|
135
155
|
run: CreationRun;
|
|
136
156
|
}): DesignMdTokens | undefined;
|
|
137
|
-
/**
|
|
157
|
+
/** Saved source selected by this run; legacy plain guides use the host resolver. */
|
|
138
158
|
export declare function htmlDesignTokensFromProjectGuide(tokensForGuide: (guideId: string) => DesignMdTokens | undefined): CreationHtmlDesignTokensResolver;
|
|
139
159
|
export type CreationHtmlSelfCheckResult = {
|
|
140
160
|
ok: true;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type CreationRepository } from "./creation-store.js";
|
|
2
|
+
/** Projects a single committed revision from the existing repository; it performs no writes. */
|
|
3
|
+
export declare function readCreationLinkedSpec(repository: CreationRepository, projectId: string, artifactId: string, request: Request): Promise<Response>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ContextFragment } from "@uibot/context";
|
|
2
|
+
import { type CreationDesignContextOptions } from "./creation-design-context.js";
|
|
2
3
|
import type { Catalog, CreationProject, CreationRun, DesignMdTokens } from "@uibot/contracts";
|
|
3
4
|
import type { CreationBrandAssets } from "./creation-brand.js";
|
|
4
5
|
import type { CreationDomainDefinition } from "./creation-domains.js";
|
|
@@ -15,6 +16,8 @@ export interface CreationPromptInput {
|
|
|
15
16
|
webDataHint?: string;
|
|
16
17
|
/** Same optional DESIGN.md tokens the HTML commit gate checks. */
|
|
17
18
|
htmlDesignTokens?: DesignMdTokens;
|
|
19
|
+
designContext?: CreationDesignContextOptions;
|
|
20
|
+
specPreviewCollections?: boolean;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Compose the system prompt and assemble the context pack for one run.
|
|
@@ -32,4 +35,18 @@ export declare function buildCreationPrompt(input: CreationPromptInput): Promise
|
|
|
32
35
|
pinnedBrand: import("@uibot/contracts").CreationBrandRevision | undefined;
|
|
33
36
|
pinnedTheme: import("@uibot/contracts").CreationThemeRevision | undefined;
|
|
34
37
|
context: import("@uibot/context").ContextPack;
|
|
38
|
+
designTrace: import("@uibot/contracts").CreationDesignTrace | undefined;
|
|
39
|
+
budgetTrace: {
|
|
40
|
+
version: 1;
|
|
41
|
+
systemTokens: number;
|
|
42
|
+
promptTokens: number;
|
|
43
|
+
outputTokens: number;
|
|
44
|
+
reserveTokens: number;
|
|
45
|
+
catalog?: {
|
|
46
|
+
mode: "full" | "scoped";
|
|
47
|
+
sha256: string;
|
|
48
|
+
included: string[];
|
|
49
|
+
omitted: string[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
35
52
|
}>;
|