UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines 6.42 kB
import{n as e}from"./rolldown-runtime-DkW27tQK.js";import{Qi as t}from"./control-ui-foundation-Cydpkyqa.js";import{So as n,_o as r,go as i,vo as a}from"./control-ui-core-Rwzhj6nO.js";import{Yt as o,en as s}from"./control-ui-core-vvcQQV2m.js";function c(e){return{get label(){return s(`configForm.sections.${e}.label`)},get description(){return s(`configForm.sections.${e}.description`)}}}var l;function u(){return(u=e((()=>{o(),l={env:c(`env`),update:c(`update`),agents:c(`agents`),auth:c(`auth`),channels:c(`channels`),messages:c(`messages`),commands:c(`commands`),hooks:c(`hooks`),skills:c(`skills`),tools:c(`tools`),gateway:c(`gateway`),wizard:c(`wizard`),meta:c(`meta`),logging:c(`logging`),browser:c(`browser`),ui:c(`ui`),models:c(`models`),bindings:c(`bindings`),broadcast:c(`broadcast`),audio:c(`audio`),session:c(`session`),cron:c(`cron`),web:c(`web`),discovery:c(`discovery`),canvasHost:c(`canvasHost`),talk:c(`talk`),plugins:c(`plugins`),diagnostics:c(`diagnostics`),cli:c(`cli`),secrets:c(`secrets`),acp:c(`acp`),mcp:c(`mcp`)}})))()}function d(e){let t=[],n=[e],r=new Set;for(;n.length>0;){let e=n.pop();if(!(!e||r.has(e))){r.add(e),t.push(e);for(let t=(e.allOf?.length??0)-1;t>=0;--t){let r=e.allOf?.[t];r&&n.push(r)}}}return t}function f(e){let t=e.find(e=>n(e)!==void 0)??e[0];return!t||e.length===1?t:{...t,allOf:[...t.allOf??[],...e.filter(e=>e!==t)]}}function p(e,t){let n=[];for(let r of d(e))if(Array.isArray(r.items)){let e=r.items[t]??(r.additionalItems&&typeof r.additionalItems==`object`?r.additionalItems:void 0);e&&n.push(e)}else r.items&&n.push(r.items);return f(n)}function m(e){let t=0,n;for(let r of d(e))if(Array.isArray(r.items)){let e=r.additionalItems!==null&&typeof r.additionalItems==`object`;t=Math.max(t,r.items.length+ +!!e),r.additionalItems===!1&&(n=Math.min(n??1/0,r.items.length))}else r.items&&(t=Math.max(t,1));return n!==void 0&&(t=Math.min(t,n)),Array.from({length:t},(e,t)=>t)}function h(){return(h=e((()=>{a()})))()}function g(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function _(e){let n=[],r=new Set,i=e.trim().replace(/(^|\s)tag:([^\s]+)/gi,(e,i,a)=>{let o=t(a);return o&&!r.has(o)&&(r.add(o),n.push(o)),i});return{text:t(i),tags:n}}function v(e){if(!Array.isArray(e))return[];let n=new Set,r=[];for(let i of e){if(typeof i!=`string`)continue;let e=i.trim();if(!e)continue;let a=t(e);n.has(a)||(n.add(a),r.push(e))}return r}function y(e,t,n){let a=i(e,n),o=e.findLast(e=>typeof e==`string`)??e.at(-1),s=a?.label??t.title??r(String(o)),c=a?.help??t.description,l=v(t[`x-tags`]??t.tags),u=v(a?.tags);return{label:s,help:c,tags:u.length>0?u:l}}function b(e,n){return t(e).includes(t(n))}function x(e,t,n){return!e||t.some(t=>t!==void 0&&n(t,e))}function S(e,n){if(e.length===0)return!0;let r=new Set(n.map(e=>t(e)));return e.every(e=>r.has(e))}function C(e){let{schema:t,path:n,hints:r,criteria:i,textMatcher:a=b}=e;if(!g(i))return!0;let{label:o,help:s,tags:c}=y(n,t,r);if(!S(i.tags,c))return!1;if(!i.text)return!0;let l=n.filter(e=>typeof e==`string`).join(`.`),u=t.enum?.map(e=>String(e)).join(` `)??``;return x(i.text,[o,s,t.title,t.description,l,u],a)}function w(e){let{schema:t,value:r,path:i,hints:a,criteria:o,textMatcher:s=b}=e;if(!g(o)||C({schema:t,path:i,hints:a,criteria:o,textMatcher:s}))return!0;let c=n(t);if(c===`object`){let e=r??t.default,n=e&&typeof e==`object`&&!Array.isArray(e)?e:{},c=t.properties??{};for(let[e,t]of Object.entries(c))if(w({schema:t,value:n[e],path:[...i,e],hints:a,criteria:o,textMatcher:s}))return!0;let l=t.additionalProperties;if(l&&typeof l==`object`){let e=new Set(Object.keys(c)),t=Object.entries(n).filter(([t])=>!e.has(t));if(t.length===0)return w({schema:l,value:void 0,path:[...i,`*`],hints:a,criteria:o,textMatcher:s});for(let[e,n]of t)if(w({schema:l,value:n,path:[...i,e],hints:a,criteria:o,textMatcher:s}))return!0}return!1}if(c!==`array`)return!1;let l=Array.isArray(r)?r:Array.isArray(t.default)?t.default:[],u=Math.max(l.length,m(t).length);for(let e=0;e<u;e+=1){let n=p(t,e);if(n&&w({schema:n,value:l[e],path:[...i,e],hints:a,criteria:o,textMatcher:s}))return!0}return!1}function T(e){if(!e.query)return!0;let t=_(e.query);return t.tags.length===0&&t.text.length>0&&[e.key,e.label,e.description].some(n=>n!==void 0&&(e.textMatcher??b)(n,t.text))||w({schema:e.schema,value:e.value,path:[e.key],hints:e.hints,criteria:t,textMatcher:e.textMatcher})}function E(){return(E=e((()=>{a(),h()})))()}function D(e){let{schema:t,path:n,advanced:r,hints:a}=e,o=new Set;if(Array.isArray(t.items)||t.additionalProperties===!0)return(i(n,a)?.advanced??!0)===r?(o.add(n.join(`.`)),{schema:t,leaves:o}):{schema:null,leaves:o};let s={},c=!1;for(let[e,i]of Object.entries(t.properties??{})){c=!0;let t=D({schema:i,path:[...n,e],advanced:r,hints:a});t.schema&&(s[e]=t.schema);for(let e of t.leaves)o.add(e)}let l=t.additionalProperties;if(t.additionalProperties&&typeof t.additionalProperties==`object`){c=!0;let e=D({schema:t.additionalProperties,path:[...n,`*`],advanced:r,hints:a});l=e.schema??void 0;for(let t of e.leaves)o.add(t)}let u=t.items;if(t.items){c=!0;let e=[t.items].map(e=>D({schema:e,path:[...n,`*`],advanced:r,hints:a})).filter(e=>e.schema!==null);u=e[0]?.schema??void 0;for(let t of e)for(let e of t.leaves)o.add(e)}let d=e=>{if(!e)return;c=!0;let t=e.map(e=>D({schema:e,path:n,advanced:r,hints:a})).filter(e=>e.schema!==null);for(let e of t)for(let t of e.leaves)o.add(t);return t.length>0?t.map(e=>e.schema):void 0},f=d(t.anyOf),p=d(t.oneOf),m=d(t.allOf);if(!c){let e=n.join(`.`);return(i(n,a)?.advanced??!0)===r?(o.add(e),{schema:t,leaves:o}):{schema:null,leaves:o}}if(!(Object.keys(s).length>0||l!==void 0&&l!==!1||(Array.isArray(u)?u.length>0:u)||f?.length||p?.length||m?.length))return{schema:null,leaves:o};let h=t.required?.filter(e=>Object.hasOwn(s,e));return{schema:{...t,...t.properties?{properties:s}:{},...t.required?{required:h}:{},...t.additionalProperties===void 0?{}:{additionalProperties:l},...t.items===void 0?{}:{items:u},...t.anyOf?{anyOf:f}:{},...t.oneOf?{oneOf:p}:{},...t.allOf?{allOf:m}:{}},leaves:o}}function O(e){let t=D({...e,advanced:!1}),n=D({...e,advanced:!0});return{common:t.schema,advanced:n.schema,commonLeafCount:t.leaves.size,advancedLeafCount:n.leaves.size}}function k(){return(k=e((()=>{a()})))()}export{T as a,_ as c,m as d,d as f,u as g,l as h,E as i,y as l,h as m,O as n,w as o,f as p,g as r,C as s,k as t,p as u}; //# sourceMappingURL=config-form.tiers-DFD3a4dS.js.map