openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 866 B
JavaScript
import{n as e}from"./rolldown-runtime-8BhlS34s.js";import{xr as t}from"./control-ui-boot-shared-umGE-sEP.js";import{hi as n}from"./ui-DuRgK6kL.js";function r(e){let t=e.get(`content-length`);if(!t||!/^\d+$/u.test(t))return null;let n=Number(t);return Number.isSafeInteger(n)?n:1/0}async function i(e,n){let i=r(e.headers);if(i!==null&&i>n.maxBytes)throw e.body?.cancel().catch(()=>void 0),Error(n.tooLargeMessage);if(!e.body){if(n.missingBodyMessage)throw Error(n.missingBodyMessage);return``}let a=e.body.getReader(),o=new TextDecoder,s=[];try{await t({maxBytes:n.maxBytes,skipEmptyChunks:!1,read:()=>a.read(),onChunk:e=>{s.push(o.decode(e,{stream:!0}))},onLimit:()=>{throw a.cancel().catch(()=>void 0),Error(n.tooLargeMessage)}});let e=o.decode();e&&s.push(e)}finally{a.releaseLock()}return s.join(``)}function a(){return(a=e((()=>{n()})))()}export{i as n,a as t};