import{Eq as D,Fq as hJ,Hl as R,Il as BJ,XB as k,YB as HJ,cn as G,fn as a}from"./cli-0.5.3-jbzr8k4s.mjs";import{$2 as ZJ,k3 as $J,z3 as bJ}from"./cli-0.5.3-1vt6twff.mjs";import{$7 as GJ,C$ as WJ,R$ as yJ,_7 as C,a8 as h,b8 as FJ,c8 as u,d8 as kJ}from"./cli-0.5.3-t65dek0m.mjs";import{Eca as q,Gca as s,Hca as Y,Ica as r}from"./cli-0.5.3-kavpx97n.mjs";import{Ida as x,Uda as gJ}from"./cli-0.5.3-1rg2r7n7.mjs";import{Aea as jJ,vea as M}from"./cli-0.5.3-6j2jk6dt.mjs";import{Yea as o,Zea as CJ,dfa as n,efa as EJ,nfa as l,ofa as TJ}from"./cli-0.5.3-n3cxyxpg.mjs";import{$ga as wJ,Mga as c,Nga as OJ,Rla as QJ,Sha as H,Tha as F,Uha as I,Vha as YJ,Wha as P,Xha as XJ,Yga as g,Zga as zJ,_ga as A,gma as mJ,kha as f,lha as PJ}from"./cli-0.5.3-qrvd6cmy.mjs";import{pma as K,qma as DJ}from"./cli-0.5.3-2dk1sk8w.mjs";import{Xma as B}from"./cli-0.5.3-0df3r78b.mjs";function UJ(J,Q){return Q.length<2?J:P(J,R(Q,0,-1))}var z;var L=B(()=>{XJ();BJ();z=UJ});function xJ(J,Q){Q=H(Q,J);var W=-1,$=Q.length;if(!$)return!0;while(++W<$){var Z=I(Q[W]);if(Z==="__proto__"&&!KJ.call(J,"__proto__"))return!1;if((Z==="constructor"||Z==="prototype")&&W<$-1)return!1}var X=z(J,Q);return X==null||delete X[I(k(Q))]}var IJ,KJ,N;var O=B(()=>{F();HJ();L();YJ();IJ=Object.prototype,KJ=IJ.hasOwnProperty;N=xJ});function MJ(J){return C(J)?void 0:J}var E;var T=B(()=>{GJ();E=MJ});function RJ(J){return A(J)||f(J)||!!(S&&J&&J[S])}var S,d;var _=B(()=>{DJ();PJ();wJ();S=K?K.isConcatSpreadable:void 0;d=RJ});function v(J,Q,W,$,Z){var X=-1,V=J.length;W||(W=d),Z||(Z=[]);while(++X<V){var U=J[X];if(Q>0&&W(U))if(Q>1)v(U,Q-1,W,$,Z);else g(Z,U);else if(!$)Z[Z.length]=U}return Z}var m;var j=B(()=>{zJ();_();m=v});function LJ(J){var Q=J==null?0:J.length;return Q?m(J,1):[]}var y;var b=B(()=>{j();y=LJ});function NJ(J){return u(h(J,void 0,y),J+"")}var i;var p=B(()=>{b();FJ();kJ();i=NJ});var SJ=1,AJ=2,fJ=4,dJ,NQ;var _J=B(()=>{OJ();TJ();O();F();EJ();T();p();CJ();dJ=i(function(J,Q){var W={};if(J==null)return W;var $=!1;if(Q=c(Q,function(X){return X=H(X,J),$||($=X.length>1),X}),n(J,o(J),W),$)W=l(W,SJ|AJ|fJ,E);var Z=Q.length;while(Z--)N(W,Q[Z]);return W}),NQ=dJ});function t(){let J=x("tengu_harbor_ledger",[]),Q=vJ().safeParse(J);return Q.success?Q.data:[]}function e(){return x("tengu_harbor",!1)}var vJ;var JJ=B(()=>{s();r();a();gJ();vJ=Y(()=>q.array(q.object({marketplace:q.string(),plugin:q.string()})))});function uQ(J,Q,W){let $=Object.entries(W??{}).filter(([Z])=>iJ.test(Z)).map(([Z,X])=>` ${Z}="${D(X)}"`).join("");return`<${M} source="${D(J)}"${$}>
${Q}
</${M}>`}function pJ(J,Q){if((J==="team"||J==="enterprise")&&Q)return{entries:Q,source:"org"};return{entries:t(),source:"ledger"}}function cJ(J,Q){let W=J.split(":");return Q.find(($)=>$.kind==="server"?J===$.name:W[0]==="plugin"&&W[1]===$.name)}function iQ(J,Q,W){if(!Q?.experimental?.["claude/channel"])return{action:"skip",kind:"capability",reason:"server did not declare claude/channel capability"};if(!e())return{action:"skip",kind:"disabled",reason:"channels feature is not currently available"};if(!ZJ()?.accessToken)return{action:"skip",kind:"auth",reason:"channels requires claude.ai authentication (run /login)"};let $=$J(),Z=$==="team"||$==="enterprise",X=Z?WJ("policySettings"):void 0;if(Z&&X?.channelsEnabled!==!0)return{action:"skip",kind:"policy",reason:"channels not enabled by org policy (set channelsEnabled: true in managed settings)"};let V=cJ(J,QJ());if(!V)return{action:"skip",kind:"session",reason:`server ${J} not in --channels list for this session`};if(V.kind==="plugin"){let U=W?G(W).marketplace:void 0;if(U!==V.marketplace)return{action:"skip",kind:"marketplace",reason:`you asked for plugin:${V.name}@${V.marketplace} but the installed ${V.name} plugin is from ${U??"an unknown source"}`};if(!V.dev){let{entries:qJ,source:VJ}=pJ($,X?.allowedChannelPlugins);if(!qJ.some((w)=>w.plugin===V.name&&w.marketplace===V.marketplace))return{action:"skip",kind:"allowlist",reason:VJ==="org"?`plugin ${V.name}@${V.marketplace} is not on your org's approved channels list (set allowedChannelPlugins in managed settings)`:`plugin ${V.name}@${V.marketplace} is not on the approved channels allowlist (use --dangerously-load-development-channels for local dev)`}}}else if(!V.dev)return{action:"skip",kind:"allowlist",reason:`server ${V.name} is not on the approved channels allowlist (use --dangerously-load-development-channels for local dev)`};return{action:"register"}}var bQ,uJ="notifications/claude/channel/permission",hQ,iJ;var oJ=B(()=>{s();mJ();jJ();bJ();r();a();yJ();hJ();JJ();bQ=Y(()=>q.object({method:q.literal("notifications/claude/channel"),params:q.object({content:q.string(),meta:q.record(q.string(),q.string()).optional()})})),hQ=Y(()=>q.object({method:q.literal(uJ),params:q.object({request_id:q.string(),behavior:q.enum(["allow","deny"])})})),iJ=/^[a-zA-Z_][a-zA-Z0-9_]*$/});
export{NQ as Se,_J as Te,JJ as Ue,bQ as Ve,uQ as We,cJ as Xe,iQ as Ye,oJ as Ze};
