1import{n as e,r as t,t as n}from"./string-coerce-BuYUxt7q.js";var r=`main`,i=`main`,a=/^[a-z0-9][a-z0-9_-]{0,63}$/i,o=/[^a-z0-9_-]+/g,s=/^-+/,c=/-+$/;function l(e){let r=n(e);if(!r)return null;let i=r.split(`:`).filter(Boolean);if(i.length<3||i[0]!==`agent`)return null;let a=t(i[1]),o=i.slice(2).join(`:`);return!a||!o?null:{agentId:a,rest:o}}function u(t){return e(t)??`main`}function d(e){let n=t(e);if(!n)return``;let r=n.split(`:`),i=0;for(;r.length-i>=3&&r[i]?.toLowerCase()===`agent`;)r[i]=`agent`,r[i+1]=r[i+1]?.toLowerCase()??``,i+=2;for(;i<r.length&&!r[i]?.trim();)i+=1;let a=r[i]?.toLowerCase(),o=r[i+1]?.toLowerCase(),s=a===`matrix`&&(o===`channel`||o===`group`);if(!s&&!(a===`signal`&&o===`group`))return n.toLowerCase();if(r[i]=a,r[i+1]=o,s){for(let e=r.length-2;e>=i+2;--e)if(r[e]?.toLowerCase()===`thread`){r[e]=`thread`;break}}else{r[i+2]=r[i+2]?.trim()??``;for(let e=i+3;e<r.length;e+=1)r[e]=r[e]?.toLowerCase()??``}return r.join(`:`)}function f(e){let t=e.hello?.snapshot;if(!t||typeof t!=`object`||!(`sessionDefaults`in t))return;let n=t.sessionDefaults;return n&&typeof n==`object`?n:void 0}function p(e){return u(e.agentsList?.mainKey??f(e)?.mainKey)}function m(e){return E(e.agentsList?.defaultId??f(e)?.defaultAgentId??`main`)}function h(e){let t=e.assistantAgentId??e.agentsList?.defaultId??f(e)?.defaultAgentId;return t?E(t):void 0}function g(e){return h(e)??`main`}function _(e,t,r){let i=l(t);if(!i)return null;let a=n(i.rest);return a===`global`?E(i.agentId):a!==`main`&&a!==p(e)||r?.requireGlobalRowForMainAlias&&r.rowKind!==`global`?null:E(i.agentId)}function v(e){return n(e)===`global`}function y(e,t){let r=l(t);if(!r)return null;let i=n(r.rest),a=p(e);return i===`main`||i===a?E(r.agentId):null}function b(e){return t(f(e)?.mainSessionKey)??D({agentId:m(e),mainKey:p(e)})}function x(e,r){let a=t(r);if(!a)return null;let o=p(e),s=m(e),c=b(e),l=new Set([i,o,c,D({agentId:s,mainKey:i}),D({agentId:s,mainKey:o})].filter(e=>!!e).map(n)),u=n(a);return l.has(u)?n(c):u}function S(e,n,r){let i=t(n);if(!i)return!0;let a=x(e,i)===x(e,e.sessionKey),o=y(e,e.sessionKey),s=o!==null&&v(i)&&o===E(r??m(e));if(!a&&!s)return!1;if(!v(e.sessionKey)||!v(i))return!0;let c=g(e),l=t(r);return l?E(l)===c:c===m(e)}function C(e){return v(e)?!0:n(l(e)?.rest)===i}function w(e,t=e.sessionKey){let n=l(t);return n?.agentId?E(n.agentId):h(e)}
1function T(e,t,n){return k(t,n)?!0:!!(v(t)&&_(e,n))}function E(e){let i=t(e)??``;return i?a.test(i)?n(i):n(i).replace(o,`-`).replace(s,``).replace(c,``).slice(0,64)||`main`:r}function D(e){return`agent:${E(e.agentId)}:${u(e.mainKey)}`}function O(e){let t=d(e);return t===`main`?D({agentId:r,mainKey:i}):t}function k(e,t){let n=O(e),r=O(t);return!!(n&&r&&n===r)}function A(e){return E(l(e)?.agentId??`main`)}function j(e,t){return e.hasActiveRun===!0||e.kind===`global`||e.kind===`unknown`?!1:!(e.key===`main`||n(l(e.key)?.rest)===u(t))}function M(e,t,n=r){let i=E(t),a=l(e);return a?E(a.agentId)===i:i===E(n)}function N(e){let r=t(e)??``;return r?n(r).startsWith(`subagent:`)?!0:n(l(r)?.rest).startsWith(`subagent:`):!1}export{g as _,j as a,T as b,v as c,l as d,A as f,h as g,_ as h,D as i,C as l,m,i as n,M as o,p,k as r,N as s,r as t,E as u,w as v,S as y}; 2//# sourceMappingURL=session-key-O2mAF18C.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.