"use strict";exports.id=4036,exports.ids=[4036],exports.modules={"./src/commands/search.ts"(e,t,n){n.a(e,(async(e,c)=>{try{n.r(t),n.d(t,{handleSearch:()=>b});var o=n("../context/dist/core.js"),r=n("../indexing-client/dist/index.js"),s=n("../proto/dist/generated/aiserver/v1/repository_connect.js"),i=n("../proto/dist/generated/aiserver/v1/repository_pb.js"),a=n("../../../../../../../../../../private/tmp/buildkite-job-019fcd9f-598c-4939-bffc-29839a3e908c/agent-cli-mac-macos-x64-019fcd9f-598c-4939-bffc-29839a3e908c.Hq0qNDa3/pnpm-virtual-store/@connectrpc+connect@1.6.1_patch_hash=c9c7616ccfc0246b19c6537f56676d8501713cb6c94b440d13_ef7275568c8b1f1f499006dc986c70d2/node_modules/@connectrpc/connect/dist/esm/promise-client.js"),l=n("../../../../../../../../../../private/tmp/buildkite-job-019fcd9f-598c-4939-bffc-29839a3e908c/agent-cli-mac-macos-x64-019fcd9f-598c-4939-bffc-29839a3e908c.Hq0qNDa3/pnpm-virtual-store/@connectrpc+connect-node@1.6.1_@bufbuild+protobuf@1.10.1_@connectrpc+connect@1.6.1_patc_c333e1fd2007e07028093d0fe22e3f55/node_modules/@connectrpc/connect-node/dist/esm/index.js"),p=n("../../../../../../../../../../private/tmp/buildkite-job-019fcd9f-598c-4939-bffc-29839a3e908c/agent-cli-mac-macos-x64-019fcd9f-598c-4939-bffc-29839a3e908c.Hq0qNDa3/pnpm-virtual-store/chalk@5.6.2/node_modules/chalk/source/index.js"),d=n("./src/components/path-display.tsx"),f=n("./src/console-io.ts"),u=e([d]),h=u.then?(await u)():u;d=h[0];var m=function(e,t,n,c){return new(n||(n=Promise))((function(o,r){function s(e){try{a(c.next(e))}catch(e){r(e)}}function i(e){try{a(c.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}a((c=c.apply(e,t||[])).next())}))};function v(e){return t=>n=>m(this,void 0,void 0,(function*(){const c=yield e.getAccessToken();if(!c)throw new Error("No access token found");n.header.set("authorization",`Bearer ${c}`);const o=null!=="2026.08.04-aaa8809"?"2026.08.04-aaa8809":"unknown";return n.header.set("x-cursor-client-version",`cli-${o}`),yield t(n)}))}class g{constructor(e,t,n){this.repoName=e,this.repoOwner=t,this.pathEncryptionKey=n}loadRepositoryIdentity(){const e=new r.Gv(this.pathEncryptionKey);return Promise.resolve({repoName:this.repoName,repoOwner:this.repoOwner,encryptionScheme:e})}}function y(e,t){var n,c,o,r,s;if(0===t.length)return p.Ay.yellow(`No results found for "${e}"`);const i=[];i.push(p.Ay.green.bold(`Found ${t.length} result${1!==t.length?"s":""} for "${e}"`));for(let e=0;e<t.length;e+=1){const a=t[e].codeBlock;if(!a)continue;const l=null!==(n=a.relativeWorkspacePath)&&void 0!==n?n:"",f=p.Ay.cyan.bold(`${(e+1).toString().padStart(3," ")}.`),u=(0,d.j)(l),h=p.Ay.dim(`(L${null===(o=null===(c=a.range)||void 0===c?void 0:c.startPosition)||void 0===o?void 0:o.line} - L${null===(s=null===(r=a.range)||void 0===r?void 0:r.endPosition)||void 0===s?void 0:s.line})`);i.push(`${f} ${u} ${h}`)}return i.join("\n")}function b(e,t,n,c){return m(this,void 0,void 0,(function*(){(0,f.OT)(`🔍 Searching for "${e}"...`);try{const d=(0,o.q6)(),u=yield t.getRepositoryInfo();u.repoName&&u.repoOwner||((0,f.p2)(p.Ay.red("❌ Repository not properly initialized")),process.exit(1));const h=(0,l.wQ)({baseUrl:c.repoEndpoint,httpVersion:c.repoHttpVersion,interceptors:[v(n)],nodeOptions:{rejectUnauthorized:!c.repoInsecure}}),m=(0,a.UU)(s.B,h),b=new i.Ym({}),x=new g(u.repoName,u.repoOwner,u.pathEncryptionKey||""),j=new r.q$(m,b,x,process.cwd()),w=yield j.search(d,e);(0,f.OT)("✅ Search completed"),(0,f.OT)(y(e,null!=w?w:[])),process.exit(0)}catch(e){(0,f.p2)(e instanceof Error?e.message:String(e)),process.exit(1)}}))}c()}catch(x){c(x)}}))},"./src/components/path-display.tsx"(e,t,n){n.a(e,(async(e,c)=>{try{n.d(t,{j:()=>i}),n("../../../../../../../../../../private/tmp/buildkite-job-019fcd9f-598c-4939-bffc-29839a3e908c/agent-cli-mac-macos-x64-019fcd9f-598c-4939-bffc-29839a3e908c.Hq0qNDa3/pnpm-virtual-store/react@19.2.4/node_modules/react/jsx-runtime.js");var o=n("../ink/build/index.js"),r=(n("../../../../../../../../../../private/tmp/buildkite-job-019fcd9f-598c-4939-bffc-29839a3e908c/agent-cli-mac-macos-x64-019fcd9f-598c-4939-bffc-29839a3e908c.Hq0qNDa3/pnpm-virtual-store/react@19.2.4/node_modules/react/index.js"),n("./src/constants.ts"),e([o]));function s(e,t){const n=e.includes("\\")?"\\":"/";if(e.length<=t)return{segments:e.split(n),separator:n};const c=e.split(n),o=c[c.length-1];if(o.length+3>t)return{segments:["...",o.substring(0,t-3)],ellipsisIndex:0,separator:n};const r=n.length,s=t-o.length-3;let i=0;const a=[];let l=-1;for(let e=0;e<c.length-1;e++){const t=c[e].length+(e>0?r:0);if(!(i+t<=s)){l=a.length;break}a.push(c[e]),i+=t}return-1!==l?(a.splice(l,0,"..."),a.push(o),{segments:a,ellipsisIndex:l,separator:n}):{segments:c,separator:n}}o=(r.then?(await r)():r)[0];const i=(e,t=50)=>{const{segments:n,separator:c}=s(e,t);let o="";return n.forEach(((e,t)=>{t>0&&"..."!==e&&(o+=c),o+=e})),o};c()}catch(a){c(a)}}))}};