UNPKG

agent-device

Version:

Open source device layer for AI coding agents: a CLI, MCP server, and typed Node.js API to control mobile, web, TV, and desktop apps on devices and simulators, locally or in the cloud.

1 lines • 978 B
import{r as e}from"./rolldown-runtime.js";import t from"node:fs";var n=e({findMp4Atom:()=>r});function r(e,n){if(n.length===0)return;let r;try{r=t.openSync(e,`r`);let a={type:``,offset:0,headerSize:0,size:t.fstatSync(r).size};return i(r,a,n,0)}catch{return}finally{r!==void 0&&t.closeSync(r)}}function i(e,t,n,r){for(let o of a(e,t)){if(o.type!==n[r])continue;if(r+1===n.length)return o;let t=i(e,o,n,r+1);if(t)return t}}function*a(e,t){let n=t.offset+t.size,r=t.offset+t.headerSize;for(let t=0;r+8<=n&&t<32;t+=1){let t=o(e,r,n);if(!t||(yield t,!Number.isSafeInteger(t.size)||t.size<t.headerSize||t.offset+t.size>n))return;r+=t.size}}function o(e,t,n){let r=s(e,t,8);if(!r)return;let i=r.readUInt32BE(0),a=8;if(i===1){let n=s(e,t+8,8);if(!n)return;i=Number(n.readBigUInt64BE(0)),a+=8}return{type:r.toString(`latin1`,4,8),offset:t,headerSize:a,size:i===0?n-t:i}}function s(e,n,r){let i=Buffer.alloc(r);try{return t.readSync(e,i,0,r,n)===r?i:void 0}catch{return}}export{n,r as t};