"use strict";var F=Object.create;var d=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var C=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},v=(e,t,o,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $(t))!b.call(e,s)&&s!==o&&d(e,s,{get:()=>t[s],enumerable:!(c=P(t,s))||c.enumerable});return e};var f=(e,t,o)=>(o=e!=null?F(C(e)):{},v(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),T=e=>v(d({},"__esModule",{value:!0}),e);var A={};S(A,{activate:()=>M,deactivate:()=>R});module.exports=T(A);var r=f(require("vscode"));var i=f(require("vscode"));function m(e){return`[${e}]`}function U(e,t,o,c,s){return`[${`${e} L${t}C${o}-L${c}C${s}`}]`}function k(e){return e.map(t=>m(t.filePath)).join("")}async function y(){let e=i.window.activeTextEditor;if(!e)return;let t=e.selection;if(t.isEmpty)return;let o=e.document,c=i.workspace.asRelativePath(o.uri),s=t.start.line+1,n=t.start.character+1,a=t.end.line+1,x=t.end.character+1,g=U(c,s,n,a,x);await i.env.clipboard.writeText(g),l(`$(clippy) Copied ${c}:${s}-${a}`)}async function h(){let e=i.window.activeTextEditor;if(!e)return;let t=e.document,o=i.workspace.asRelativePath(t.uri),c=m(o);await i.env.clipboard.writeText(c),l(`$(clippy) Copied file: ${o}`)}async function p(e){let t=i.workspace.asRelativePath(e),o=`[${t}]`;await i.env.clipboard.writeText(o),l(`$(clippy) Copied: ${t}`)}async function u(e){!e||e.length===0||await E(e)}async function w(e){let t=[],o=await i.workspace.fs.readDirectory(e);for(let[c,s]of o){let n=i.Uri.joinPath(e,c);if(s===i.FileType.Directory){let a=await w(n);t.push(...a)}else s===i.FileType.File&&t.push(n)}return t}async function E(e){let t=[];for(let c of e){let s=[c];try{(await i.workspace.fs.stat(c)).type===i.FileType.Directory&&(s=await w(c))}catch{}for(let n of s)t.push({filePath:i.workspace.asRelativePath(n)})}if(t.length===0)return;let o=k(t);await i.env.clipboard.writeText(o),l(`$(clippy) Copied ${t.length} file(s)`)}function l(e){i.window.setStatusBarMessage(e,3e3)}function M(e){console.log("[copy-ai-ctx] activating..."),e.subscriptions.push(r.commands.registerCommand("copy-ai-ctx.copySelection",()=>{y()})),e.subscriptions.push(r.commands.registerCommand("copy-ai-ctx.copyFile",()=>{h()})),e.subscriptions.push(r.commands.registerCommand("copy-ai-ctx.copySelectedFiles",t=>{if(!t){let o=r.window.activeTextEditor;if(!o)return;p(o.document.uri);return}p(t)})),e.subscriptions.push(r.commands.registerCommand("copy-ai-ctx.copyMultiFiles",(...t)=>{if(t.length<2){let c=r.window.activeTextEditor;if(!c)return;u([c.document.uri]);return}let o=Array.isArray(t[1])?t[1]:t.slice(1);o.length!==0&&u(o)})),console.log("[copy-ai-ctx] activated")}function R(){}0&&(module.exports={activate,deactivate});