UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

1 lines • 3.8 kB
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{Ju as t,Yu as n}from"./_4____________________________.js";import{K as r,mt as i}from"./deferred-ui-support-DZEPWjAk.js";import{n as a,t as o}from"./schema-VvtGzI60.js";function s(e){let t=[],n=0;for(let r of e){if(r.keyword===`boolean`){t.push(r),n+=1;continue}let e=r.params?.additionalProperties;r.keyword===`additionalProperties`&&typeof r.schemaPath==`string`&&typeof r.instancePath==`string`&&Array.isArray(e)&&e.length>0&&e.length<=n&&t.slice(-e.length).every((t,n)=>{let i=e[n];return typeof i==`string`&&t.schemaPath===`${r.schemaPath}/additionalProperties`&&t.instancePath===`${r.instancePath}/${i.replace(/~/g,`~0`).replace(/\//g,`~1`)}`})&&(t.length-=e.length),t.push(r),n=0}return t}function c(e,r,i=[]){if(Array.isArray(e))return e.map(e=>c(e,r,i));if(!t(e))return e;let a=[...i,e];return Object.fromEntries(Object.entries(r(e,i)).map(([e,i])=>{if(y.has(e)){let o=e===`dependencies`;return[e,t(i)?Object.fromEntries(Object.entries(i).map(([e,t])=>[e,o&&n(t)?t:c(t,r,a)])):i]}return b.has(e)?[e,c(i,r,a)]:[e,i]}))}function l(e,t){return c(e,t)}function u(e){try{return new RegExp(e,`u`),!0}catch{return!1}}function d(e){if(u(e))return e;let t=e.replace(/\\([^\\])/g,(e,t)=>t===`:`||t===`/`?t:e);return u(t)?t:e}function f(e){let t=new Map;for(let[n,r]of Object.entries(e)){let e=d(n),i=t.get(e);t.set(e,i===void 0?r:{allOf:[i,r]})}return Object.fromEntries(t)}function p(e){let{nullable:t,type:n,...r}=e,i=Array.isArray(n)?[...n]:typeof n==`string`?[n]:null;if(!i||(t===!0&&!i.includes(`null`)&&i.push(`null`),i.length===1&&!Array.isArray(n)))return e;let a=Object.entries(r),o=a.filter(([e])=>x.has(e)),s=Object.fromEntries(a.filter(([e])=>!x.has(e)));return{...Object.fromEntries(o),anyOf:i.map(e=>Object.assign({},s,{type:e}))}}function m(e){if(!t(e.additionalProperties)||t(e.properties)||t(e.patternProperties))return e;let{additionalProperties:n,...r}=e;return{...r,patternProperties:{".*":n},additionalProperties:!1}}function h(e,t=new WeakSet,n=new WeakSet){if(e===null||typeof e==`string`||typeof e==`boolean`)return!0;if(typeof e==`number`)return Number.isFinite(e);if(typeof e!=`object`)return!1;let r;try{if(Array.isArray(e)){let t=Reflect.ownKeys(e);if(t.length!==e.length+1||t.some(t=>{if(t===`length`)return!1;if(typeof t!=`string`)return!0;let n=Number(t);return!Number.isSafeInteger(n)||n<0||n>=e.length||String(n)!==t}))return!1;r=e}else{let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null||Reflect.ownKeys(e).some(t=>typeof t!=`string`||!Object.prototype.propertyIsEnumerable.call(e,t)))return!1;r=Object.values(e)}}catch{return!1}if(n.has(e))return!0;if(t.has(e))return!1;t.add(e);let i=r.every(e=>h(e,t,n));return t.delete(e),i&&n.add(e),i}function g(e,n={}){return l(e,e=>{let r=m(p(e.nullable===!0&&e.enumIncludesNull===!0&&Array.isArray(e.enum)&&!e.enum.some(e=>e===null)?{...e,enum:[...e.enum,null]}:e));return Object.fromEntries(Object.entries(r).filter(([e])=>e!==`format`||n.format!==`annotation`).map(([e,n])=>e===`$dynamicRef`&&r.$ref===void 0?[`$ref`,n]:e===`pattern`&&typeof n==`string`?[e,d(n)]:e===`patternProperties`&&t(n)?[e,f(n)]:[e,n]))})}function _(e,t){if(!h(e)||!h(t))return!1;try{return i(e,t)}catch{return!1}}function v(e,t){if(!h(t))return!1;try{return a(g(e),t)}catch{return!1}}var y,b,x;function S(){return(S=e((()=>{r(),o(),y=new Set([`$defs`,`definitions`,`dependentSchemas`,`dependencies`,`patternProperties`,`properties`]),b=new Set([`additionalItems`,`additionalProperties`,`allOf`,`anyOf`,`contains`,`else`,`if`,`items`,`not`,`oneOf`,`prefixItems`,`propertyNames`,`then`,`unevaluatedItems`,`unevaluatedProperties`]),x=new Set([`$anchor`,`$defs`,`$dynamicAnchor`,`$id`,`$recursiveAnchor`,`$schema`,`$vocabulary`,`definitions`])})))()}export{s as i,v as n,_ as r,S as t};