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