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