UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.98 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Mu as t,Vu as n,cu as r,iu as i}from"./_4____________________________.js";import{n as a}from"./_3_____________________________.js";import{T as o,h as s,i as c,m as l,n as u,p as d,t as f,y as p}from"./config-form-utils-runtime-CqcGJa6w.js";function m(e){return v.get(e.toLowerCase())}function h(e,t){return e.split(`-`).map((e,n)=>{let r=e.replace(/^[("'[]+|[)"'\],:.]+$/g,``),i=m(r);return i?e.replace(r,i):/^[A-Z][a-z]+$/.test(r)?t&&n===0?e:e.replace(r,r.toLowerCase()):e}).join(`-`)}function g(e){return e.replace(/\bGit Hub\b/i,`GitHub`).replace(/\bNo Vnc\b/i,`noVNC`).split(` `).map((e,t,n)=>h(e,t===0||n[t-1].endsWith(`:`))).join(` `).replace(/\bClaude code\b/,`Claude Code`)}function _(e){if(!y.test(e))return e;let[t=``,...n]=e.split(/[-_]/).map(e=>m(e)??e);return[t.charAt(0).toUpperCase()+t.slice(1),...n].join(` `)}var v,y;function b(){return(b=e((()=>{v=new Map(`ACP.AI.AppArmor.CA.CPUs.FS.MIME.MIMEs.noVNC.PIDs.VNC.API.AWS.CDP.ChatGPT.CLI.CPU.DM.DMs.DNS.GPT.HTTP.HTTPS.ID.IDs.IP.JSON.LAN.MCP.MB.OAuth.OTLP.PDF.RO.RW.SDK.SMS.SQLite.SSE.SSH.STT.TLS.TTL.TTS.UI.URL.URLs.WebRTC.WebSocket.AppleScript.Anthropic.Azure.Bedrock.Bun.Chrome.Chromium.Claude.Codex.DeepSeek.Discord.Docker.Feishu.GitHub.Git.Google.Lark.Lightpanda.Linux.Matrix.Mattermost.Microsoft.Ollama.OpenAI.OpenClaw.OpenRouter.OpenSSH.Postgres.Qwen.Signal.Slack.Tailscale.Teams.Telegram.Together.Twitter.Vertex.WhatsApp.Yarn.ZAI`.split(`.`).map(e=>[e.toLowerCase(),e])),y=/^[a-z][a-z0-9]*(?:[-_][a-z0-9]+)*$/})))()}function x(e){return!!(e&&(e.text.length>0||e.tags.length>0))}function S(e){let n=new Set,r=e.replace(/(?:^|\s)tag:([^\s]+)/gi,(e,r)=>{let i=t(r);return i&&n.add(i),``});return{text:t(r),tags:[...n]}}function C(e){return[...a(r(e),t).values()]}function w(e,t,n){let r=p(e,n),i=e.findLast(e=>typeof e==`string`)??e.at(-1),a=r?.label??t.title??l(String(i)),o=r?.label!==void 0&&r.label!==d(e,n)?.label?a:g(a),s=r?.help??t.description,c=C(t[`x-tags`]??t.tags),u=C(r?.tags);return{label:o,help:s,tags:u.length>0?u:c}}function T(e,n){return t(e).normalize(`NFC`).includes(t(n).normalize(`NFC`))}function E(e,n){if(e.length===0)return!0;let r=new Set(n.map(e=>t(e).normalize(`NFC`)));return e.every(e=>r.has(t(e).normalize(`NFC`)))}function D(e){let{schema:t,path:n,hints:r,criteria:i,textMatcher:a=T}=e;if(!x(i))return!0;let{label:o,help:s,tags:c}=w(n,t,r);if(!E(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[o,s,t.title,t.description,l,u].some(e=>e!==void 0&&a(e,i.text))}function O(e){let{schema:t,value:r,path:i,hints:a,criteria:s,textMatcher:c=T}=e;if(D({schema:t,path:i,hints:a,criteria:s,textMatcher:c}))return!0;let l=(t,n,r)=>O({...e,schema:t,value:n,path:[...i,r]}),d=o(t);if(d===`object`){let e=r??t.default,i=n(e),a=t.properties??{};if(Object.entries(a).some(([e,t])=>l(t,i[e],e)))return!0;let o=t.additionalProperties;if(o&&typeof o==`object`){let e=new Set(Object.keys(a)),t=Object.entries(i).filter(([t])=>!e.has(t));return t.length===0?l(o,void 0,`*`):t.some(([e,t])=>l(o,t,e))}return!1}if(d!==`array`)return!1;let p=Array.isArray(r)?r:Array.isArray(t.default)?t.default:[],m=Math.max(p.length,u(t).length);for(let e=0;e<m;e+=1){let n=f(t,e);if(n&&l(n,p[e],e))return!0}return!1}function k(e){let t=Object.entries(e.value).filter(([t])=>!e.reservedKeys.has(t)),n=e.searchCriteria,r=x(n),i=n&&r?t.filter(([t,r])=>O({schema:e.schema,value:r,path:[...e.path,t],hints:e.hints,criteria:n})):t;return{visibleEntries:i,visible:!r||i.length>0}}function A(e){if(!e.query)return!0;let t=S(e.query);return t.tags.length===0&&t.text.length>0&&[e.key,e.label,e.description].some(n=>n!==void 0&&(e.textMatcher??T)(n,t.text))||O({schema:e.schema,value:e.value,path:[e.key],hints:e.hints,criteria:t,textMatcher:e.textMatcher})}function j(){return(j=e((()=>{i(),s(),c(),b()})))()}export{D as a,k as c,O as i,_ as l,j as n,S as o,A as r,w as s,x as t,b as u};