function e(e){return!e.kind||e.kind===`terminal`}function t(e){if(!e)return!1;let t=e.replace(/\\/g,`/`);return t.includes(`/.claude/projects/`)&&t.endsWith(`.jsonl`)}function n(n){return e(n)?n.sessionType===`claude`||t(n.sessionFilePath)?`claude`:n.piSessionId||n.sessionFilePath||n.spawnPi||n.sessionType===`pi`?`pi`:`shell`:`shell`}function r(t){return e(t)}function i(e){return e===`browser`||e===`preview`||e===`artifact`||e===`files`||e===`picker`||e===`agentGraph`}function a(e){if(!e||!e.trim())return`/`;let t=e.trim();try{let e=new URL(t);return`${e.pathname||`/`}${e.search}${e.hash}`}catch{}return t.startsWith(`/`)?t:`/${t}`}function o(e,t){return e?`http://localhost:${e}${a(t)}`:`about:blank`}function s(e){if(!e)return!1;try{let t=new URL(e).host.toLowerCase();return t===`live.browser-use.com`||t.endsWith(`.browser-use.com`)}catch{return e.toLowerCase().includes(`live.browser-use.com`)||e.toLowerCase().includes(`.browser-use.com`)}}function c(e){return s(e)?`picture-in-picture`:void 0}function l(e){if(!e)return null;try{let t=new URL(e.trim());t.hash=``,(t.protocol===`http:`&&t.port===`80`||t.protocol===`https:`&&t.port===`443`)&&(t.port=``);let n=t.pathname===`/`?``:t.pathname.replace(/\/$/,``);return`${t.protocol}//${t.host}${n}${t.search}`.toLowerCase()}catch{let t=e.trim();return t?t.replace(/\/$/,``).toLowerCase():null}}function u(e){let t=e.kind??`terminal`;return t===`browser`?l(e.browserUrl):t===`preview`?l(e.browserUrl??(e.previewPort?o(e.previewPort,e.previewPath):null)):null}function d(e){return(e.kind??`terminal`)===`browser`&&s(e.browserUrl)?null:u(e)}function f(e,t){let n=u(e);return!!n&&n===u(t)}function p(e,t){let n=d(e);return!!n&&n===d(t)}export{d as a,t as c,a as d,n as f,c as i,i as l,f as n,p as o,r as p,o as r,s,u as t,l as u};