openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 1.71 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{dl as t,pl as n}from"./_4____________________________.js";import{r}from"./deferred-ui-support-DZEPWjAk.js";function i(e,t=`local`){let n=t===`utc`?e.getUTCFullYear():e.getFullYear(),r=(t===`utc`?e.getUTCMonth():e.getMonth())+1,i=t===`utc`?e.getUTCDate():e.getDate();return`${n}-${String(r).padStart(2,`0`)}-${String(i).padStart(2,`0`)}`}function a(e=new Date){let t=new Date(e);return t.setDate(t.getDate()-29),{startDate:i(t),endDate:i(e)}}function o(e,t,n){let r=Number(e.slice(0,4)),i=Number(e.slice(5,7))-1,a=Number(e.slice(8,10))+n;return t===`utc`?Date.UTC(r,i,a):new Date(r,i,a).getTime()}function s(e){let{startDate:t,endDate:n,selectedDays:r,timeZone:a}=e,s=t?o(t,a,0):0,c=n?o(n,a,1):1/0,l=r.length?new Set(r):void 0;return{timeZone:a,matches:t||n||l?e=>e>=s&&e<c&&(!l||l.has(i(new Date(e),a))):void 0}}function c(e,t,n,r,i){if(r&&e.length>0)for(let r of e.slice(-1)){let i=n.indexOf(r),a=n.indexOf(t);if(i!==-1&&a!==-1){let[t,r]=i<a?[i,a]:[a,i];return[...new Set([...e,...n.slice(t,r+1)])]}}return i===`replace`?e.length===1&&e[0]===t?[]:[t]:e.includes(t)?e.filter(e=>e!==t):i===`append`?[...e,t]:[t]}function l(e){let t=new Map;for(let n of e.content.split(`
`)){let e=/^\[Tool:\s*([^\]]+)\]/.exec(n.trim())?.[1];e&&t.set(e,(t.get(e)??0)+1)}return{log:e,toolInfo:{tools:Array.from(t).toSorted((e,t)=>t[1]-e[1])}}}var u;function d(){return(d=e((()=>{u={sort:`cost`,sortDirection:`desc`}})))()}async function f(e,i,a){try{return n(await r(e,i,{projection:`overview`,signal:a}))}catch(e){if(a?.aborted)throw e;return t({cause:e})}}function p(){return(p=e((()=>{})))()}export{i as a,s as c,a as i,c as l,f as n,d as o,u as r,l as s,p as t};