opengrok-mcp-server 3.3.3 → 3.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -23,6 +23,28 @@ Native MCP integration, OS keychain credentials, 8 OpenGrok tools, SSRF protecti
23
23
 
24
24
  ---
25
25
 
26
+ ## [3.3.5] - 2026-03-15
27
+
28
+ ### Changed
29
+
30
+ - **Rebrand**: Extension `displayName` renamed to **OpenGrok MCP Server**.
31
+ - **Description**: Updated to "MCP server bridging OpenGrok search engines with AI for deep, instant context across massive codebases" across `package.json`, `server.json`, and `README.md`.
32
+ - **License**: Added `LICENSE-COMMERCIAL.md` clearly describing commercial/enterprise licensing terms. Updated `LICENSE` Required Notice with author attribution. README license section now explicitly states commercial use restrictions with contact info.
33
+ - **Installation docs**: README now lists npm (`npx opengrok-mcp-server`) and MCP Registry (`io.github.IcyHot09/opengrok`) as first-class installation options alongside VS Code Marketplace.
34
+ - **MCP Registry badge**: Added to README header badges.
35
+ - **Release tooling**: Fixed wrong GitHub repo URL in `generate-release-notes.js`. Release script now syncs `server.json` version on each release.
36
+
37
+ ---
38
+
39
+ ## [3.3.4] - 2026-03-14
40
+
41
+ ### Changed
42
+
43
+ - **MCP Registry Support**: Added `mcpName` property to `package.json` and created `server.json` to publish the extension to the official Model Context Protocol (MCP) Registry.
44
+ - Updated extension description to meet registry character limits and content guidelines.
45
+
46
+ ---
47
+
26
48
  ## [3.3.3] - 2026-03-14
27
49
 
28
50
  ### Fixed
package/LICENSE CHANGED
@@ -4,50 +4,29 @@
4
4
 
5
5
  ## Acceptance
6
6
 
7
- In order to get any license under these terms, you must agree
8
- to them as both strict obligations and conditions to all
9
- your licenses.
7
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
10
8
 
11
9
  ## Copyright License
12
10
 
13
- The licensor grants you a copyright license for the
14
- software to do everything you might do with the software
15
- that would otherwise infringe the licensor's copyright
16
- in it for any permitted purpose. However, you may
17
- only distribute the software according to [Distribution
18
- License](#distribution-license) and make changes or new works
19
- based on the software according to [Changes and New Works
20
- License](#changes-and-new-works-license).
11
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
21
12
 
22
13
  ## Distribution License
23
14
 
24
- The licensor grants you an additional copyright license
25
- to distribute copies of the software. Your license
26
- to distribute covers distributing the software with
27
- changes and new works permitted by [Changes and New Works
28
- License](#changes-and-new-works-license).
15
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
29
16
 
30
17
  ## Notices
31
18
 
32
- You must ensure that anyone who gets a copy of any part of
33
- the software from you also gets a copy of these terms or the
34
- URL for them above, as well as copies of any plain-text lines
35
- beginning with `Required Notice:` that the licensor provided
36
- with the software. For example:
19
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
37
20
 
38
- > Required Notice: Copyright Rudra Roy
21
+ > Required Notice: Copyright Rudra Roy (https://github.com/IcyHot09)
39
22
 
40
23
  ## Changes and New Works License
41
24
 
42
- The licensor grants you an additional copyright license to
43
- make changes and new works based on the software for any
44
- permitted purpose.
25
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
45
26
 
46
27
  ## Patent License
47
28
 
48
- The licensor grants you a patent license for the software that
49
- covers patent claims the licensor can license, or becomes able
50
- to license, that you would infringe by using the software.
29
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
51
30
 
52
31
  ## Noncommercial Purposes
53
32
 
@@ -55,77 +34,40 @@ Any noncommercial purpose is a permitted purpose.
55
34
 
56
35
  ## Personal Uses
57
36
 
58
- Personal use for research, experiment, and testing for
59
- the benefit of public knowledge, personal study, private
60
- entertainment, hobby projects, amateur pursuits, or religious
61
- observance, without any anticipated commercial application,
62
- is use for a permitted purpose.
37
+ Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, is use for a permitted purpose.
63
38
 
64
39
  ## Noncommercial Organizations
65
40
 
66
- Use by any charitable organization, educational institution,
67
- public research organization, public safety or health
68
- organization, environmental protection organization,
69
- or government institution is use for a permitted purpose
70
- regardless of the source of funding or obligations resulting
71
- from the funding.
41
+ Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution is use for a permitted purpose regardless of the source of funding or obligations resulting from the funding.
72
42
 
73
43
  ## Fair Use
74
44
 
75
- You may have "fair use" rights for the software under the
76
- law. These terms do not limit them.
45
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
77
46
 
78
47
  ## No Other Rights
79
48
 
80
- These terms do not allow you to sublicense or transfer any of
81
- your licenses to anyone else, or prevent the licensor from
82
- granting licenses to anyone else. These terms do not imply
83
- any other licenses.
49
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
84
50
 
85
51
  ## Patent Defense
86
52
 
87
- If you make any written claim that the software infringes or
88
- contributes to infringement of any patent, your patent license
89
- for the software granted under these terms ends immediately. If
90
- your company makes such a claim, your patent license ends
91
- immediately for work on behalf of your company.
53
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
92
54
 
93
55
  ## Violations
94
56
 
95
- The first time you are notified in writing that you have
96
- violated any of these terms, or done anything with the software
97
- not covered by your licenses, your licenses can nonetheless
98
- continue if you come into full compliance with these terms,
99
- and take practical steps to correct past violations, within
100
- 32 days of receiving notice. Otherwise, all your licenses
101
- end immediately.
57
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
102
58
 
103
59
  ## No Liability
104
60
 
105
- ***As far as the law allows, the software comes as is, without
106
- any warranty or condition, and the licensor will not be liable
107
- to you for any damages arising out of these terms or the use
108
- or nature of the software, under any kind of legal claim.***
61
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
109
62
 
110
63
  ## Definitions
111
64
 
112
- The **licensor** is the individual or entity offering these
113
- terms, and the **software** is the software the licensor makes
114
- available under these terms.
65
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
115
66
 
116
- **You** refers to the individual or entity agreeing to these
117
- terms.
67
+ **You** refers to the individual or entity agreeing to these terms.
118
68
 
119
- **Your company** is any legal entity, sole proprietorship,
120
- or other kind of organization that you work for, plus all
121
- organizations that have control over, are under the control of,
122
- or are under common control with that organization. **Control**
123
- means ownership of substantially all the assets of an entity,
124
- or the power to direct its management and policies by vote,
125
- contract, or otherwise. Control can be direct or indirect.
69
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
126
70
 
127
- **Your licenses** are all the licenses granted to you for the
128
- software under these terms.
71
+ **Your licenses** are all the licenses granted to you for the software under these terms.
129
72
 
130
- **Use** means anything you do with the software requiring one
131
- of your licenses.
73
+ **Use** means anything you do with the software requiring one of your licenses.
@@ -0,0 +1,27 @@
1
+ # Commercial License
2
+
3
+ The [PolyForm Noncommercial License 1.0.0](LICENSE) that governs this project **explicitly prohibits commercial and enterprise use**.
4
+
5
+ ## Who needs a commercial license?
6
+
7
+ You need a commercial license if you are using this software in any of the following contexts:
8
+
9
+ - Internal developer tooling at a company or organization
10
+ - SaaS products or hosted services
11
+ - CI/CD pipelines or automated build systems at a company
12
+ - Any project that generates revenue, directly or indirectly
13
+ - Any use by a for-profit organization, regardless of whether the specific use is revenue-generating
14
+
15
+ ## How to obtain a commercial license
16
+
17
+ Contact **Rudra Roy** at [rudroy09@gmail.com](mailto:rudroy09@gmail.com) with:
18
+
19
+ - Your company name and use case
20
+ - Estimated number of developers / servers
21
+ - Whether you need support, updates, or white-label rights
22
+
23
+ Commercial licenses are available as one-time or annual agreements at reasonable rates.
24
+
25
+ ---
26
+
27
+ *Using this software commercially without a commercial license is a violation of the PolyForm Noncommercial License 1.0.0 and applicable copyright law.*
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  # OpenGrok MCP Server
6
6
 
7
- **Search your OpenGrok code index directly from GitHub Copilot Chat**
7
+ **MCP server bridging OpenGrok code search engine with AI for deep, instant context across massive codebases**
8
8
 
9
- [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/IcyHot09.opengrok-mcp-server?label=VS%20Code%20Marketplace&logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=IcyHot09.opengrok-mcp-server) [![Installs](https://img.shields.io/visual-studio-marketplace/i/IcyHot09.opengrok-mcp-server)](https://marketplace.visualstudio.com/items?itemName=IcyHot09.opengrok-mcp-server) [![npm](https://img.shields.io/npm/v/opengrok-mcp-server?logo=npm)](https://www.npmjs.com/package/opengrok-mcp-server) [![CI](https://github.com/IcyHot09/opengrok-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/IcyHot09/opengrok-mcp-server/actions/workflows/ci.yml) [![GitHub Release](https://img.shields.io/github/v/release/IcyHot09/opengrok-mcp-server)](https://github.com/IcyHot09/opengrok-mcp-server/releases)
9
+ [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/IcyHot09.opengrok-mcp-server?label=VS%20Code%20Marketplace&logo=visualstudiocode)](https://marketplace.visualstudio.com/items?itemName=IcyHot09.opengrok-mcp-server) [![Installs](https://img.shields.io/visual-studio-marketplace/i/IcyHot09.opengrok-mcp-server)](https://marketplace.visualstudio.com/items?itemName=IcyHot09.opengrok-mcp-server) [![npm](https://img.shields.io/npm/v/opengrok-mcp-server?logo=npm)](https://www.npmjs.com/package/opengrok-mcp-server) [![MCP Registry](https://img.shields.io/badge/MCP_Registry-listed-blue)](https://registry.modelcontextprotocol.io) [![CI](https://github.com/IcyHot09/opengrok-mcp-server/actions/workflows/ci.yml/badge.svg)](https://github.com/IcyHot09/opengrok-mcp-server/actions/workflows/ci.yml) [![GitHub Release](https://img.shields.io/github/v/release/IcyHot09/opengrok-mcp-server)](https://github.com/IcyHot09/opengrok-mcp-server/releases)
10
10
 
11
11
  🔌 **Zero Install**  ·  🧠 **Compound Tools**  ·  🔄 **Auto-Updates**  ·  🔒 **Secure Credentials**
12
12
 
@@ -42,9 +42,25 @@
42
42
 
43
43
  ### Option 1 — VS Code Marketplace _(Recommended)_
44
44
 
45
- Search for **"OpenGrok Code Search for Copilot"** in the VS Code Extensions panel (`Ctrl+Shift+X`) and click Install.
45
+ Search for **"OpenGrok MCP Server"** in the VS Code Extensions panel (`Ctrl+Shift+X`) and click Install.
46
46
 
47
- ### Option 2 — Install pre-built VSIX
47
+ ### Option 2 — npm
48
+
49
+ ```bash
50
+ npx opengrok-mcp-server
51
+ ```
52
+
53
+ Or install globally:
54
+
55
+ ```bash
56
+ npm install -g opengrok-mcp-server
57
+ ```
58
+
59
+ ### Option 3 — MCP Registry
60
+
61
+ This server is listed on the [MCP Registry](https://registry.modelcontextprotocol.io) as `io.github.IcyHot09/opengrok`. Any MCP-compatible client that supports the registry can discover and install it automatically.
62
+
63
+ ### Option 4 — Install pre-built VSIX
48
64
 
49
65
  1. Download the latest VSIX file from [GitHub Releases](https://github.com/IcyHot09/opengrok-mcp-server/releases).
50
66
  2. Install it in VS Code:
@@ -53,7 +69,7 @@ Search for **"OpenGrok Code Search for Copilot"** in the VS Code Extensions pane
53
69
  3. **Updates are automatic** — the extension checks GitHub Releases once per day and offers one-click install.
54
70
 
55
71
  <details>
56
- <summary>🛠️ Option 3 — Build from source <em>(For developers)</em></summary>
72
+ <summary>🛠️ Option 5 — Build from source <em>(For developers)</em></summary>
57
73
 
58
74
  ```bash
59
75
  git clone https://github.com/IcyHot09/opengrok-mcp-server.git
@@ -231,4 +247,11 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development guide.
231
247
 
232
248
  This project is licensed under the [PolyForm Noncommercial License 1.0.0](LICENSE).
233
249
 
234
- **This project is free for personal and non-commercial use.** For enterprise or commercial licensing, please contact me at [rudroy09@gmail.com](mailto:rudroy09@gmail.com).
250
+ **Free for personal, hobby, research, educational, and non-commercial use**
251
+ ❌ **Not allowed for any commercial, business, enterprise, or paid use**
252
+
253
+ **Enterprises / Companies:**
254
+ If you want to use this MCP server in a commercial context (internal tools, production, SaaS, CI pipelines, etc.), you must purchase a commercial license.
255
+ Contact [rudroy09@gmail.com](mailto:rudroy09@gmail.com) for pricing and terms.
256
+
257
+ See [LICENSE-COMMERCIAL.md](LICENSE-COMMERCIAL.md) for details.
@@ -147,7 +147,7 @@ ${i}`:n.stack}O.exports.fetch=function(e,r=void 0){return qre(e,r).catch(o=>{thr
147
147
  missingProperty: ${o},
148
148
  depsCount: ${e},
149
149
  deps: ${r}}`};var whe={keyword:"dependencies",type:"object",schemaType:"object",error:vo.error,code(t){let[e,r]=She(t);vP(t,e),DP(t,r)}};function She({schema:t}){let e={},r={};for(let o in t){if(o==="__proto__")continue;let n=Array.isArray(t[o])?e:r;n[o]=t[o]}return[e,r]}function vP(t,e=t.schema){let{gen:r,data:o,it:n}=t;if(Object.keys(e).length===0)return;let i=r.let("missing");for(let s in e){let a=e[s];if(a.length===0)continue;let u=(0,Rf.propertyInData)(r,o,s,n.opts.ownProperties);t.setParams({property:s,depsCount:a.length,deps:a.join(", ")}),n.allErrors?r.if(u,()=>{for(let c of a)(0,Rf.checkReportMissingProp)(t,c)}):(r.if((0,iS._)`${u} && (${(0,Rf.checkMissingProp)(t,a,i)})`),(0,Rf.reportMissingProp)(t,i),r.else())}}vo.validatePropertyDeps=vP;function DP(t,e=t.schema){let{gen:r,data:o,keyword:n,it:i}=t,s=r.name("valid");for(let a in e)(0,Dhe.alwaysValidSchema)(i,e[a])||(r.if((0,Rf.propertyInData)(r,o,a,i.opts.ownProperties),()=>{let u=t.subschema({keyword:n,schemaProp:a},s);t.mergeValidEvaluated(u,s)},()=>r.var(s,!0)),t.ok(s))}vo.validateSchemaDeps=DP;vo.default=whe});var xP=m(sS=>{"use strict";Object.defineProperty(sS,"__esModule",{value:!0});var SP=ge(),xhe=Ne(),khe={message:"property name must be valid",params:({params:t})=>(0,SP._)`{propertyName: ${t.propertyName}}`},Nhe={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:khe,code(t){let{gen:e,schema:r,data:o,it:n}=t;if((0,xhe.alwaysValidSchema)(n,r))return;let i=e.name("valid");e.forIn("key",o,s=>{t.setParams({propertyName:s}),t.subschema({keyword:"propertyNames",data:s,dataTypes:["string"],propertyName:s,compositeRule:!0},i),e.if((0,SP.not)(i),()=>{t.error(!0),n.allErrors||e.break()})}),t.ok(i)}};sS.default=Nhe});var uS=m(aS=>{"use strict";Object.defineProperty(aS,"__esModule",{value:!0});var AI=En(),Vn=ge(),_he=ai(),lI=Ne(),Rhe={message:"must NOT have additional properties",params:({params:t})=>(0,Vn._)`{additionalProperty: ${t.additionalProperty}}`},The={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Rhe,code(t){let{gen:e,schema:r,parentSchema:o,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:a,opts:u}=s;if(s.props=!0,u.removeAdditional!=="all"&&(0,lI.alwaysValidSchema)(s,r))return;let c=(0,AI.allSchemaProperties)(o.properties),A=(0,AI.allSchemaProperties)(o.patternProperties);l(),t.ok((0,Vn._)`${i} === ${_he.default.errors}`);function l(){e.forIn("key",n,C=>{!c.length&&!A.length?g(C):e.if(f(C),()=>g(C))})}function f(C){let E;if(c.length>8){let y=(0,lI.schemaRefOrVal)(s,o.properties,"properties");E=(0,AI.isOwnProperty)(e,y,C)}else c.length?E=(0,Vn.or)(...c.map(y=>(0,Vn._)`${C} === ${y}`)):E=Vn.nil;return A.length&&(E=(0,Vn.or)(E,...A.map(y=>(0,Vn._)`${(0,AI.usePattern)(t,y)}.test(${C})`))),(0,Vn.not)(E)}function d(C){e.code((0,Vn._)`delete ${n}[${C}]`)}function g(C){if(u.removeAdditional==="all"||u.removeAdditional&&r===!1){d(C);return}if(r===!1){t.setParams({additionalProperty:C}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,lI.alwaysValidSchema)(s,r)){let E=e.name("valid");u.removeAdditional==="failing"?(h(C,E,!1),e.if((0,Vn.not)(E),()=>{t.reset(),d(C)})):(h(C,E),a||e.if((0,Vn.not)(E),()=>e.break()))}}function h(C,E,y){let I={keyword:"additionalProperties",dataProp:C,dataPropType:lI.Type.Str};y===!1&&Object.assign(I,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(I,E)}}};aS.default=The});var _P=m(AS=>{"use strict";Object.defineProperty(AS,"__esModule",{value:!0});var Fhe=If(),kP=En(),cS=Ne(),NP=uS(),Uhe={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:o,data:n,it:i}=t;i.opts.removeAdditional==="all"&&o.additionalProperties===void 0&&NP.default.code(new Fhe.KeywordCxt(i,NP.default,"additionalProperties"));let s=(0,kP.allSchemaProperties)(r);for(let l of s)i.definedProperties.add(l);i.opts.unevaluated&&s.length&&i.props!==!0&&(i.props=cS.mergeEvaluated.props(e,(0,cS.toHash)(s),i.props));let a=s.filter(l=>!(0,cS.alwaysValidSchema)(i,r[l]));if(a.length===0)return;let u=e.name("valid");for(let l of a)c(l)?A(l):(e.if((0,kP.propertyInData)(e,n,l,i.opts.ownProperties)),A(l),i.allErrors||e.else().var(u,!0),e.endIf()),t.it.definedProperties.add(l),t.ok(u);function c(l){return i.opts.useDefaults&&!i.compositeRule&&r[l].default!==void 0}function A(l){t.subschema({keyword:"properties",schemaProp:l,dataProp:l},u)}}};AS.default=Uhe});var UP=m(lS=>{"use strict";Object.defineProperty(lS,"__esModule",{value:!0});var RP=En(),dI=ge(),TP=Ne(),FP=Ne(),Mhe={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:o,parentSchema:n,it:i}=t,{opts:s}=i,a=(0,RP.allSchemaProperties)(r),u=a.filter(h=>(0,TP.alwaysValidSchema)(i,r[h]));if(a.length===0||u.length===a.length&&(!i.opts.unevaluated||i.props===!0))return;let c=s.strictSchema&&!s.allowMatchingProperties&&n.properties,A=e.name("valid");i.props!==!0&&!(i.props instanceof dI.Name)&&(i.props=(0,FP.evaluatedPropsToName)(e,i.props));let{props:l}=i;f();function f(){for(let h of a)c&&d(h),i.allErrors?g(h):(e.var(A,!0),g(h),e.if(A))}function d(h){for(let C in c)new RegExp(h).test(C)&&(0,TP.checkStrictMode)(i,`property ${C} matches pattern ${h} (use allowMatchingProperties)`)}function g(h){e.forIn("key",o,C=>{e.if((0,dI._)`${(0,RP.usePattern)(t,h)}.test(${C})`,()=>{let E=u.includes(h);E||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:C,dataPropType:FP.Type.Str},A),i.opts.unevaluated&&l!==!0?e.assign((0,dI._)`${l}[${C}]`,!0):!E&&!i.allErrors&&e.if((0,dI.not)(A),()=>e.break())})})}}};lS.default=Mhe});var MP=m(dS=>{"use strict";Object.defineProperty(dS,"__esModule",{value:!0});var Lhe=Ne(),$he={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:o}=t;if((0,Lhe.alwaysValidSchema)(o,r)){t.fail();return}let n=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},n),t.failResult(n,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};dS.default=$he});var LP=m(fS=>{"use strict";Object.defineProperty(fS,"__esModule",{value:!0});var Ohe=En(),Phe={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Ohe.validateUnion,error:{message:"must match a schema in anyOf"}};fS.default=Phe});var $P=m(gS=>{"use strict";Object.defineProperty(gS,"__esModule",{value:!0});var fI=ge(),qhe=Ne(),zhe={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,fI._)`{passingSchemas: ${t.passing}}`},Hhe={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:zhe,code(t){let{gen:e,schema:r,parentSchema:o,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(n.opts.discriminator&&o.discriminator)return;let i=r,s=e.let("valid",!1),a=e.let("passing",null),u=e.name("_valid");t.setParams({passing:a}),e.block(c),t.result(s,()=>t.reset(),()=>t.error(!0));function c(){i.forEach((A,l)=>{let f;(0,qhe.alwaysValidSchema)(n,A)?e.var(u,!0):f=t.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},u),l>0&&e.if((0,fI._)`${u} && ${s}`).assign(s,!1).assign(a,(0,fI._)`[${a}, ${l}]`).else(),e.if(u,()=>{e.assign(s,!0),e.assign(a,l),f&&t.mergeEvaluated(f,fI.Name)})})}}};gS.default=Hhe});var OP=m(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});var Vhe=Ne(),Ghe={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:o}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let n=e.name("valid");r.forEach((i,s)=>{if((0,Vhe.alwaysValidSchema)(o,i))return;let a=t.subschema({keyword:"allOf",schemaProp:s},n);t.ok(n),t.mergeEvaluated(a)})}};hS.default=Ghe});var zP=m(pS=>{"use strict";Object.defineProperty(pS,"__esModule",{value:!0});var gI=ge(),qP=Ne(),jhe={message:({params:t})=>(0,gI.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,gI._)`{failingKeyword: ${t.ifClause}}`},Yhe={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:jhe,code(t){let{gen:e,parentSchema:r,it:o}=t;r.then===void 0&&r.else===void 0&&(0,qP.checkStrictMode)(o,'"if" without "then" and "else" is ignored');let n=PP(o,"then"),i=PP(o,"else");if(!n&&!i)return;let s=e.let("valid",!0),a=e.name("_valid");if(u(),t.reset(),n&&i){let A=e.let("ifClause");t.setParams({ifClause:A}),e.if(a,c("then",A),c("else",A))}else n?e.if(a,c("then")):e.if((0,gI.not)(a),c("else"));t.pass(s,()=>t.error(!0));function u(){let A=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(A)}function c(A,l){return()=>{let f=t.subschema({keyword:A},a);e.assign(s,a),t.mergeValidEvaluated(f,s),l?e.assign(l,(0,gI._)`${A}`):t.setParams({ifClause:A})}}}};function PP(t,e){let r=t.schema[e];return r!==void 0&&!(0,qP.alwaysValidSchema)(t,r)}pS.default=Yhe});var HP=m(mS=>{"use strict";Object.defineProperty(mS,"__esModule",{value:!0});var Jhe=Ne(),Zhe={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Jhe.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};mS.default=Zhe});var VP=m(ES=>{"use strict";Object.defineProperty(ES,"__esModule",{value:!0});var Whe=eS(),Khe=yP(),Xhe=tS(),epe=QP(),tpe=bP(),rpe=wP(),npe=xP(),ope=uS(),ipe=_P(),spe=UP(),ape=MP(),upe=LP(),cpe=$P(),Ape=OP(),lpe=zP(),dpe=HP();function fpe(t=!1){let e=[ape.default,upe.default,cpe.default,Ape.default,lpe.default,dpe.default,npe.default,ope.default,rpe.default,ipe.default,spe.default];return t?e.push(Khe.default,epe.default):e.push(Whe.default,Xhe.default),e.push(tpe.default),e}ES.default=fpe});var GP=m(IS=>{"use strict";Object.defineProperty(IS,"__esModule",{value:!0});var It=ge(),gpe={message:({schemaCode:t})=>(0,It.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,It._)`{format: ${t}}`},hpe={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:gpe,code(t,e){let{gen:r,data:o,$data:n,schema:i,schemaCode:s,it:a}=t,{opts:u,errSchemaPath:c,schemaEnv:A,self:l}=a;if(!u.validateFormats)return;n?f():d();function f(){let g=r.scopeValue("formats",{ref:l.formats,code:u.code.formats}),h=r.const("fDef",(0,It._)`${g}[${s}]`),C=r.let("fType"),E=r.let("format");r.if((0,It._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(C,(0,It._)`${h}.type || "string"`).assign(E,(0,It._)`${h}.validate`),()=>r.assign(C,(0,It._)`"string"`).assign(E,h)),t.fail$data((0,It.or)(y(),I()));function y(){return u.strictSchema===!1?It.nil:(0,It._)`${s} && !${E}`}function I(){let D=A.$async?(0,It._)`(${h}.async ? await ${E}(${o}) : ${E}(${o}))`:(0,It._)`${E}(${o})`,w=(0,It._)`(typeof ${E} == "function" ? ${D} : ${E}.test(${o}))`;return(0,It._)`${E} && ${E} !== true && ${C} === ${e} && !${w}`}}function d(){let g=l.formats[i];if(!g){y();return}if(g===!0)return;let[h,C,E]=I(g);h===e&&t.pass(D());function y(){if(u.strictSchema===!1){l.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${i}" ignored in schema at path "${c}"`}}function I(w){let q=w instanceof RegExp?(0,It.regexpCode)(w):u.code.formats?(0,It._)`${u.code.formats}${(0,It.getProperty)(i)}`:void 0,T=r.scopeValue("formats",{key:i,ref:w,code:q});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,It._)`${T}.validate`]:["string",w,T]}function D(){if(typeof g=="object"&&!(g instanceof RegExp)&&g.async){if(!A.$async)throw new Error("async format in sync schema");return(0,It._)`await ${E}(${o})`}return typeof C=="function"?(0,It._)`${E}(${o})`:(0,It._)`${E}.test(${o})`}}}};IS.default=hpe});var jP=m(CS=>{"use strict";Object.defineProperty(CS,"__esModule",{value:!0});var ppe=GP(),mpe=[ppe.default];CS.default=mpe});var YP=m(Wc=>{"use strict";Object.defineProperty(Wc,"__esModule",{value:!0});Wc.contentVocabulary=Wc.metadataVocabulary=void 0;Wc.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Wc.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var ZP=m(yS=>{"use strict";Object.defineProperty(yS,"__esModule",{value:!0});var Epe=nP(),Ipe=mP(),Cpe=VP(),ype=jP(),JP=YP(),Bpe=[Epe.default,Ipe.default,(0,Cpe.default)(),ype.default,JP.metadataVocabulary,JP.contentVocabulary];yS.default=Bpe});var KP=m(hI=>{"use strict";Object.defineProperty(hI,"__esModule",{value:!0});hI.DiscrError=void 0;var WP;(function(t){t.Tag="tag",t.Mapping="mapping"})(WP||(hI.DiscrError=WP={}))});var eq=m(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var Kc=ge(),BS=KP(),XP=WE(),Qpe=Cf(),bpe=Ne(),vpe={message:({params:{discrError:t,tagName:e}})=>t===BS.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Kc._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},Dpe={keyword:"discriminator",type:"object",schemaType:"object",error:vpe,code(t){let{gen:e,data:r,schema:o,parentSchema:n,it:i}=t,{oneOf:s}=n;if(!i.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=o.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(o.mapping)throw new Error("discriminator: mapping is not supported");if(!s)throw new Error("discriminator: requires oneOf keyword");let u=e.let("valid",!1),c=e.const("tag",(0,Kc._)`${r}${(0,Kc.getProperty)(a)}`);e.if((0,Kc._)`typeof ${c} == "string"`,()=>A(),()=>t.error(!1,{discrError:BS.DiscrError.Tag,tag:c,tagName:a})),t.ok(u);function A(){let d=f();e.if(!1);for(let g in d)e.elseIf((0,Kc._)`${c} === ${g}`),e.assign(u,l(d[g]));e.else(),t.error(!1,{discrError:BS.DiscrError.Mapping,tag:c,tagName:a}),e.endIf()}function l(d){let g=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:d},g);return t.mergeEvaluated(h,Kc.Name),g}function f(){var d;let g={},h=E(n),C=!0;for(let D=0;D<s.length;D++){let w=s[D];if(w?.$ref&&!(0,bpe.schemaHasRulesButRef)(w,i.self.RULES)){let T=w.$ref;if(w=XP.resolveRef.call(i.self,i.schemaEnv.root,i.baseId,T),w instanceof XP.SchemaEnv&&(w=w.schema),w===void 0)throw new Qpe.default(i.opts.uriResolver,i.baseId,T)}let q=(d=w?.properties)===null||d===void 0?void 0:d[a];if(typeof q!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);C=C&&(h||E(w)),y(q,D)}if(!C)throw new Error(`discriminator: "${a}" must be required`);return g;function E({required:D}){return Array.isArray(D)&&D.includes(a)}function y(D,w){if(D.const)I(D.const,w);else if(D.enum)for(let q of D.enum)I(q,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function I(D,w){if(typeof D!="string"||D in g)throw new Error(`discriminator: "${a}" values must be unique strings`);g[D]=w}}}};QS.default=Dpe});var tq=m((kwe,wpe)=>{wpe.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var vS=m((it,bS)=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.MissingRefError=it.ValidationError=it.CodeGen=it.Name=it.nil=it.stringify=it.str=it._=it.KeywordCxt=it.Ajv=void 0;var Spe=W5(),xpe=ZP(),kpe=eq(),rq=tq(),Npe=["/properties"],pI="http://json-schema.org/draft-07/schema",Xc=class extends Spe.default{_addVocabularies(){super._addVocabularies(),xpe.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(kpe.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(rq,Npe):rq;this.addMetaSchema(e,pI,!1),this.refs["http://json-schema.org/schema"]=pI}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(pI)?pI:void 0)}};it.Ajv=Xc;bS.exports=it=Xc;bS.exports.Ajv=Xc;Object.defineProperty(it,"__esModule",{value:!0});it.default=Xc;var _pe=If();Object.defineProperty(it,"KeywordCxt",{enumerable:!0,get:function(){return _pe.KeywordCxt}});var eA=ge();Object.defineProperty(it,"_",{enumerable:!0,get:function(){return eA._}});Object.defineProperty(it,"str",{enumerable:!0,get:function(){return eA.str}});Object.defineProperty(it,"stringify",{enumerable:!0,get:function(){return eA.stringify}});Object.defineProperty(it,"nil",{enumerable:!0,get:function(){return eA.nil}});Object.defineProperty(it,"Name",{enumerable:!0,get:function(){return eA.Name}});Object.defineProperty(it,"CodeGen",{enumerable:!0,get:function(){return eA.CodeGen}});var Rpe=JE();Object.defineProperty(it,"ValidationError",{enumerable:!0,get:function(){return Rpe.default}});var Tpe=Cf();Object.defineProperty(it,"MissingRefError",{enumerable:!0,get:function(){return Tpe.default}})});var Aq=m(wo=>{"use strict";Object.defineProperty(wo,"__esModule",{value:!0});wo.formatNames=wo.fastFormats=wo.fullFormats=void 0;function Do(t,e){return{validate:t,compare:e}}wo.fullFormats={date:Do(sq,xS),time:Do(wS(!0),kS),"date-time":Do(nq(!0),uq),"iso-time":Do(wS(),aq),"iso-date-time":Do(nq(),cq),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri:Ope,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex:jpe,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte:Ppe,int32:{type:"number",validate:Hpe},int64:{type:"number",validate:Vpe},float:{type:"number",validate:iq},double:{type:"number",validate:iq},password:!0,binary:!0};wo.fastFormats={...wo.fullFormats,date:Do(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,xS),time:Do(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,kS),"date-time":Do(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,uq),"iso-time":Do(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,aq),"iso-date-time":Do(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,cq),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};wo.formatNames=Object.keys(wo.fullFormats);function Fpe(t){return t%4===0&&(t%100!==0||t%400===0)}var Upe=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Mpe=[0,31,28,31,30,31,30,31,31,30,31,30,31];function sq(t){let e=Upe.exec(t);if(!e)return!1;let r=+e[1],o=+e[2],n=+e[3];return o>=1&&o<=12&&n>=1&&n<=(o===2&&Fpe(r)?29:Mpe[o])}function xS(t,e){if(t&&e)return t>e?1:t<e?-1:0}var DS=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function wS(t){return function(r){let o=DS.exec(r);if(!o)return!1;let n=+o[1],i=+o[2],s=+o[3],a=o[4],u=o[5]==="-"?-1:1,c=+(o[6]||0),A=+(o[7]||0);if(c>23||A>59||t&&!a)return!1;if(n<=23&&i<=59&&s<60)return!0;let l=i-A*u,f=n-c*u-(l<0?1:0);return(f===23||f===-1)&&(l===59||l===-1)&&s<61}}function kS(t,e){if(!(t&&e))return;let r=new Date("2020-01-01T"+t).valueOf(),o=new Date("2020-01-01T"+e).valueOf();if(r&&o)return r-o}function aq(t,e){if(!(t&&e))return;let r=DS.exec(t),o=DS.exec(e);if(r&&o)return t=r[1]+r[2]+r[3],e=o[1]+o[2]+o[3],t>e?1:t<e?-1:0}var SS=/t|\s/i;function nq(t){let e=wS(t);return function(o){let n=o.split(SS);return n.length===2&&sq(n[0])&&e(n[1])}}function uq(t,e){if(!(t&&e))return;let r=new Date(t).valueOf(),o=new Date(e).valueOf();if(r&&o)return r-o}function cq(t,e){if(!(t&&e))return;let[r,o]=t.split(SS),[n,i]=e.split(SS),s=xS(r,n);if(s!==void 0)return s||kS(o,i)}var Lpe=/\/|:/,$pe=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function Ope(t){return Lpe.test(t)&&$pe.test(t)}var oq=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function Ppe(t){return oq.lastIndex=0,oq.test(t)}var qpe=-(2**31),zpe=2**31-1;function Hpe(t){return Number.isInteger(t)&&t<=zpe&&t>=qpe}function Vpe(t){return Number.isInteger(t)}function iq(){return!0}var Gpe=/[^\\]\\Z/;function jpe(t){if(Gpe.test(t))return!1;try{return new RegExp(t),!0}catch{return!1}}});var lq=m(tA=>{"use strict";Object.defineProperty(tA,"__esModule",{value:!0});tA.formatLimitDefinition=void 0;var Ype=vS(),Gn=ge(),Is=Gn.operators,mI={formatMaximum:{okStr:"<=",ok:Is.LTE,fail:Is.GT},formatMinimum:{okStr:">=",ok:Is.GTE,fail:Is.LT},formatExclusiveMaximum:{okStr:"<",ok:Is.LT,fail:Is.GTE},formatExclusiveMinimum:{okStr:">",ok:Is.GT,fail:Is.LTE}},Jpe={message:({keyword:t,schemaCode:e})=>(0,Gn.str)`should be ${mI[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Gn._)`{comparison: ${mI[t].okStr}, limit: ${e}}`};tA.formatLimitDefinition={keyword:Object.keys(mI),type:"string",schemaType:"string",$data:!0,error:Jpe,code(t){let{gen:e,data:r,schemaCode:o,keyword:n,it:i}=t,{opts:s,self:a}=i;if(!s.validateFormats)return;let u=new Ype.KeywordCxt(i,a.RULES.all.format.definition,"format");u.$data?c():A();function c(){let f=e.scopeValue("formats",{ref:a.formats,code:s.code.formats}),d=e.const("fmt",(0,Gn._)`${f}[${u.schemaCode}]`);t.fail$data((0,Gn.or)((0,Gn._)`typeof ${d} != "object"`,(0,Gn._)`${d} instanceof RegExp`,(0,Gn._)`typeof ${d}.compare != "function"`,l(d)))}function A(){let f=u.schema,d=a.formats[f];if(!d||d===!0)return;if(typeof d!="object"||d instanceof RegExp||typeof d.compare!="function")throw new Error(`"${n}": format "${f}" does not define "compare" function`);let g=e.scopeValue("formats",{key:f,ref:d,code:s.code.formats?(0,Gn._)`${s.code.formats}${(0,Gn.getProperty)(f)}`:void 0});t.fail$data(l(g))}function l(f){return(0,Gn._)`${f}.compare(${r}, ${o}) ${mI[n].fail} 0`}},dependencies:["format"]};var Zpe=t=>(t.addKeyword(tA.formatLimitDefinition),t);tA.default=Zpe});var hq=m((Tf,gq)=>{"use strict";Object.defineProperty(Tf,"__esModule",{value:!0});var rA=Aq(),Wpe=lq(),NS=ge(),dq=new NS.Name("fullFormats"),Kpe=new NS.Name("fastFormats"),_S=(t,e={keywords:!0})=>{if(Array.isArray(e))return fq(t,e,rA.fullFormats,dq),t;let[r,o]=e.mode==="fast"?[rA.fastFormats,Kpe]:[rA.fullFormats,dq],n=e.formats||rA.formatNames;return fq(t,n,r,o),e.keywords&&(0,Wpe.default)(t),t};_S.get=(t,e="full")=>{let o=(e==="fast"?rA.fastFormats:rA.fullFormats)[t];if(!o)throw new Error(`Unknown format "${t}"`);return o};function fq(t,e,r,o){var n,i;(n=(i=t.opts.code).formats)!==null&&n!==void 0||(i.formats=(0,NS._)`require("ajv-formats/dist/formats").${o}`);for(let s of e)t.addFormat(s,r[s])}gq.exports=Tf=_S;Object.defineProperty(Tf,"__esModule",{value:!0});Tf.default=_S});var zq=Object.prototype.toString,Hq=t=>zq.call(t)==="[object Error]",Vq=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function PI(t){if(!(t&&Hq(t)&&t.name==="TypeError"&&typeof t.message=="string"))return!1;let{message:r,stack:o}=t;return r==="Load failed"?o===void 0||"__sentry_captured__"in t:r.startsWith("error sending request for url")?!0:Vq.has(r)}function Gq(t){if(typeof t=="number"){if(t<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(t))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(t!==void 0)throw new TypeError("Expected `retries` to be a number or Infinity.")}function Of(t,e,{min:r=0,allowInfinity:o=!1}={}){if(e!==void 0){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected \`${t}\` to be a number${o?" or Infinity":""}.`);if(!o&&!Number.isFinite(e))throw new TypeError(`Expected \`${t}\` to be a finite number.`);if(e<r)throw new TypeError(`Expected \`${t}\` to be \u2265 ${r}.`)}}var nA=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,{message:e}=e):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function jq(t,e){let r=Math.max(1,t+1),o=e.randomize?Math.random()+1:1,n=Math.round(o*e.minTimeout*e.factor**(r-1));return n=Math.min(n,e.maxTimeout),n}function zS(t,e){return Number.isFinite(e)?e-(performance.now()-t):e}async function Yq({error:t,attemptNumber:e,retriesConsumed:r,startTime:o,options:n}){let i=t instanceof Error?t:new TypeError(`Non-error was thrown: "${t}". You should only throw errors.`);if(i instanceof nA)throw i.originalError;let s=Number.isFinite(n.retries)?Math.max(0,n.retries-r):n.retries,a=n.maxRetryTime??Number.POSITIVE_INFINITY,u=Object.freeze({error:i,attemptNumber:e,retriesLeft:s,retriesConsumed:r});if(await n.onFailedAttempt(u),zS(o,a)<=0)throw i;let c=await n.shouldConsumeRetry(u),A=zS(o,a);if(A<=0||s<=0)throw i;if(i instanceof TypeError&&!PI(i)){if(c)throw i;return n.signal?.throwIfAborted(),!1}if(!await n.shouldRetry(u))throw i;if(!c)return n.signal?.throwIfAborted(),!1;let l=jq(r,n),f=Math.min(l,A);return n.signal?.throwIfAborted(),f>0&&await new Promise((d,g)=>{let h=()=>{clearTimeout(C),n.signal?.removeEventListener("abort",h),g(n.signal.reason)},C=setTimeout(()=>{n.signal?.removeEventListener("abort",h),d()},f);n.unref&&C.unref?.(),n.signal?.addEventListener("abort",h,{once:!0})}),n.signal?.throwIfAborted(),!0}async function qI(t,e={}){if(e={...e},Gq(e.retries),Object.hasOwn(e,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");e.retries??=10,e.factor??=2,e.minTimeout??=1e3,e.maxTimeout??=Number.POSITIVE_INFINITY,e.maxRetryTime??=Number.POSITIVE_INFINITY,e.randomize??=!1,e.onFailedAttempt??=()=>{},e.shouldRetry??=()=>!0,e.shouldConsumeRetry??=()=>!0,Of("factor",e.factor,{min:0,allowInfinity:!1}),Of("minTimeout",e.minTimeout,{min:0,allowInfinity:!1}),Of("maxTimeout",e.maxTimeout,{min:0,allowInfinity:!0}),Of("maxRetryTime",e.maxRetryTime,{min:0,allowInfinity:!0}),e.factor>0||(e.factor=1),e.signal?.throwIfAborted();let r=0,o=0,n=performance.now();for(;!Number.isFinite(e.retries)||o<=e.retries;){r++;try{e.signal?.throwIfAborted();let i=await t(r);return e.signal?.throwIfAborted(),i}catch(i){await Yq({error:i,attemptNumber:r,retriesConsumed:o,startTime:n,options:e})&&o++}}throw new Error("Retry attempts exhausted without throwing an error.")}var _l=require("url"),SL=Xr(d3());var gt={info:(t,e)=>console.error(`[INFO] [opengrok-mcp] ${t}`,e??""),error:(t,e)=>console.error(`[ERROR] [opengrok-mcp] ${t}`,e??""),warn:(t,e)=>console.error(`[WARN] [opengrok-mcp] ${t}`,e??"")};var Pu=Xr(BL());function QL(t){let e=(0,Pu.parse)(t),r=[],o=e.querySelector("select#project")||e.querySelector("select[name=project]");if(!o){let i=new Set;for(let s of e.querySelectorAll("a[href]")){let a=s.getAttribute("href")??"",u=/\/xref\/([^/]+)\/?$/.exec(a);u&&!i.has(u[1])&&(i.add(u[1]),r.push({name:u[1]}))}return r}let n;for(let i of o.childNodes){let s=i.tagName?.toLowerCase();if(s==="optgroup"){let a=i;n=a.getAttribute("label")??void 0;for(let u of a.querySelectorAll("option")){let c=u.getAttribute("value")??"";c&&r.push({name:c,category:n})}}else if(s==="option"){let a=i.getAttribute?i.getAttribute("value")??"":"";a&&r.push({name:a,category:n})}}return r}function bL(t,e,r){let o=(0,Pu.parse)(t),n=[],i=o.querySelector("table#dirlist")||o.querySelector("table");if(!i){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");for(let c of o.querySelectorAll("a[href]")){let A=c.getAttribute("href")??"",l=new RegExp(`/xref/${u}/(.+)$`).exec(A);if(!l)continue;let f=l[1];f.replace(/\/$/,"")!==r.replace(/\/$/,"")&&n.push({name:f.replace(/\/$/,"").split("/").pop()??f,isDirectory:A.endsWith("/"),path:f.replace(/\/$/,"")})}return n}let s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`/xref/${s}/(.+)$`);for(let u of i.querySelectorAll("tr")){let c=u.querySelectorAll("td");if(c.length<1)continue;let A=null;for(let y=0;y<Math.min(c.length,3);y++){let I=c[y].querySelector("a");if(I){let D=I.getAttribute("href")??"";if(D&&D!=="#"){A=I;break}}}if(!A)continue;let l=A.text.trim(),f=A.getAttribute("href")??"",d=f.endsWith("/"),g=a.exec(f),h;if(g)h=g[1].replace(/\/$/,"");else{let y=f.replace(/\/$/,"");h=r?`${r}/${y}`:y}let C,E;for(let y=1;y<c.length;y++){let I=c[y].text.trim();!I||I==="-"||(/^\d+$/.test(I)&&C===void 0?C=parseInt(I,10):(/^\d{4}-\d{2}-\d{2}/.test(I)||/\w+\s+\d/.test(I))&&(E||(E=I)))}n.push({name:l,isDirectory:d,path:h,size:C,lastModified:E})}return n}function vL(t,e,r){let o=(0,Pu.parse)(t),n=[],i=o.querySelector("table#revisions")||o.querySelector("table");if(!i)return{project:e,path:r,entries:n};for(let s of i.querySelectorAll("tr")){let a=s.querySelectorAll("td");if(a.length<4)continue;let u=a[0].querySelectorAll("a"),c="";if(u.length>1)for(let h=u.length-1;h>=0;h--){let C=u[h].text.trim();if(C&&C!=="#"&&C.toLowerCase()!=="revision"){c=C;break}}else u.length===1&&(c=u[0].text.trim().replace(/^#/,""));if(c||(c=a[0].text.trim().replace(/^#/,"")),!c||c.toLowerCase()==="revision")continue;let A=a[2]?.text.trim()??"",l=a[3]?.text.trim()??"",f=a[a.length-1]?.text.trim()??"",d=/Update Form:?\s*(\d+)/.exec(f),g=/MR[-:]?\s*(\d+)/.exec(f);n.push({revision:c,date:A,author:l,message:f,updateForm:d?.[1],mergeRequest:g?.[1]})}return{project:e,path:r,entries:n}}function db(t,e,r){let o=(0,Pu.parse)(t,{blockTextElements:{script:!0,style:!0,noscript:!0}}),n=[],a=((o.querySelector("pre#src")||o.querySelector("pre"))??o).querySelectorAll("span.blame");if(a.length>0){let u=0;for(let c of a){u++;let A=c.getAttribute("title")||c.querySelector("a")?.getAttribute("title")||"",l=/(?:revision|changeset):\s*([a-f0-9]+)/i.exec(A)?.[1]??"",f=(/(?:author|user):\s*(.+?)(?=\s+(?:date|revision|changeset|version|summary):|\s*<[^>]*@[^>]*>|<br|$)/i.exec(A)?.[1]??"").replace(/\u00a0/g," ").trim(),d=(/date:\s*(.+?)(?=<br|$)/i.exec(A)?.[1]??"").replace(/\u00a0/g," ").trim(),g;if(c.querySelector("a.r")!==null){let h=c.parentNode,C=[],E=h.childNodes,y=E.indexOf(c);for(let I=y+1;I<E.length;I++){let D=E[I],w=typeof D.getAttribute=="function"?D.getAttribute("class")??"":"";if(w==="blame"||w.split(" ").includes("blame"))break;if(!w.includes("fold-space")){let q=D.text,T=q.indexOf(`
150
- `);if(T!==-1){T>0&&C.push(q.slice(0,T));break}q&&C.push(q)}}g=C.join("").trim()}else g=c.text;n.push({lineNumber:u,revision:l,author:f,date:d,content:g})}}if(n.length===0){let u=o.querySelector("table");if(u){let c=1;for(let A of u.querySelectorAll("tr")){let l=A.querySelectorAll("td");l.length<3||n.push({lineNumber:c++,revision:l[0].text.trim(),author:l[1]?.text.trim()??"",date:"",content:l[l.length-1]?.text??""})}}}return{project:e,path:r,lines:n}}function DL(t,e,r){let o=(0,Pu.parse)(t),n=[],s=o.querySelector("p.pagetitle")?.text??"",a=/of\s+(\d[\d,]*)/i.exec(s),u=a?parseInt(a[1].replace(/,/g,""),10):0,A=(o.querySelector("#results")||o).querySelectorAll("tr");for(let l of A){if(l.classNames?.includes("dir")||l.getAttribute("class")?.includes("dir"))continue;let f=l.querySelectorAll("td");if(f.length<2)continue;let g=(f.find(q=>q.getAttribute("class")?.includes("f"))??f[1])?.querySelector("a");if(!g)continue;let h=g.getAttribute("href")??"",C=/\/xref\/([^/]+)(\/.*?)$/.exec(h);if(!C)continue;let E=C[1],y=C[2],I=f.find(q=>q.querySelector("code.con"))??f[f.length-1],D=I?.querySelectorAll("a.s")??[],w=[];for(let q of D){let T=q.querySelector("span.l"),U=T?parseInt(T.text.trim(),10):0,G=q.text.trim();T&&(G=G.replace(/^\d+\s*/,"")),U>0&&w.push({lineNumber:U,lineContent:G})}if(w.length===0){let q=I?.querySelector("code.con");if(q){let T=/\#(\d+)/.exec(h),U=T?parseInt(T[1],10):0;U>0&&w.push({lineNumber:U,lineContent:q.text.trim().replace(/^\d+\s*/,"")})}}w.length>0&&n.push({project:E,path:y,matches:w})}return{query:r,searchType:e,totalCount:u,timeMs:0,results:n,startIndex:0,endIndex:n.length}}var use={xf:"function",xm:"macro",xc:"class",xe:"enum",xi:"interface",xn:"namespace",xs:"struct",xt:"typedef",xu:"union",xd:"definition"},cse=/<a\s+class="h?l"\s+(?:id|name)="(\d+)"/,Ase=/class="(x[a-z])\s+intelliWindow-symbol"[^>]*data-definition-place="def"[^>]*>([^<]+)<\/a>/,lse=/<span\s+class='scope-signature'>([^<]*(?:&[^;]+;[^<]*)*)<\/span>/;function dse(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#0?59;/g,";").replace(/&apos;/g,"'")}function wL(t){let e=[],r=new RegExp(`${cse.source}|${Ase.source}`,"g"),o=0,n;for(;(n=r.exec(t))!==null;)if(n[1])o=parseInt(n[1],10);else if(n[2]&&n[3]){let i=n[2],s=n[3],a=use[i];if(!a||!o)continue;let u=null;if(a==="function"){let c=Math.max(0,n.index-500),A=t.substring(c,n.index+n[0].length+500),l=lse.exec(A);l&&(u=dse(l[1]))}e.push({symbol:s,type:a,signature:u,line:o,lineStart:o,lineEnd:o,namespace:null})}return e}var fse="3.3.3",fb=class{rate;maxTokens;tokens;lastUpdate;queue=[];processing=!1;constructor(e){this.rate=e/60,this.maxTokens=e,this.tokens=e,this.lastUpdate=Date.now()}async acquire(){return new Promise(e=>{this.queue.push(e),this.processing||this.processQueue()})}async processQueue(){for(this.processing=!0;this.queue.length>0;){let e=Date.now(),r=(e-this.lastUpdate)/1e3;if(this.tokens=Math.min(this.maxTokens,this.tokens+r*this.rate),this.lastUpdate=e,this.tokens>=1)this.tokens-=1,this.queue.shift()();else{let o=(1-this.tokens)/this.rate*1e3;await gse(o)}}this.processing=!1}},qu=class{constructor(e,r,o){this.maxEntries=e;this.maxBytes=r;this.ttlMs=o}map=new Map;totalBytes=0;get(e){let r=this.map.get(e);if(r){if(Date.now()>r.expiresAt){this.totalBytes-=r.sizeBytes,this.map.delete(e);return}return r.value}}set(e,r,o){for(++this.writeCount%10===0&&this.evictExpired();this.map.size>=this.maxEntries||this.totalBytes+o>this.maxBytes;){let n=this.map.keys().next().value;if(n===void 0)break;let i=this.map.get(n);this.totalBytes-=i.sizeBytes,this.map.delete(n)}this.map.set(e,{value:r,expiresAt:Date.now()+this.ttlMs,sizeBytes:o}),this.totalBytes+=o}has(e){return this.get(e)!==void 0}writeCount=0;evictExpired(){let e=Date.now();for(let[r,o]of this.map)e>o.expiresAt&&(this.totalBytes-=o.sizeBytes,this.map.delete(r))}clear(){this.map.clear(),this.totalBytes=0}},Vr={search:6e4,suggest:1e4,file:3e4,default:3e4};function gse(t){return new Promise(e=>setTimeout(e,t))}function zu(t){if(t==null)return 0;if(typeof t=="string")return Buffer.byteLength(t,"utf8");if(typeof t=="number"||typeof t=="boolean")return 8;if(typeof t=="object"){let e=0;if(Array.isArray(t))for(let r of t)e+=zu(r);else for(let[r,o]of Object.entries(t))e+=Buffer.byteLength(r,"utf8")+zu(o);return e}return 0}function Ap(t,e,r){let o=1;for(let c=0;c<t.length;c++)t.charCodeAt(c)===10&&o++;if(e===void 0&&r===void 0)return{text:t,totalLines:o};let n=Math.max(0,(e??1)-1),i=Math.min(o,r??o),s=0;for(let c=0;c<n&&s<t.length;c++){let A=t.indexOf(`
150
+ `);if(T!==-1){T>0&&C.push(q.slice(0,T));break}q&&C.push(q)}}g=C.join("").trim()}else g=c.text;n.push({lineNumber:u,revision:l,author:f,date:d,content:g})}}if(n.length===0){let u=o.querySelector("table");if(u){let c=1;for(let A of u.querySelectorAll("tr")){let l=A.querySelectorAll("td");l.length<3||n.push({lineNumber:c++,revision:l[0].text.trim(),author:l[1]?.text.trim()??"",date:"",content:l[l.length-1]?.text??""})}}}return{project:e,path:r,lines:n}}function DL(t,e,r){let o=(0,Pu.parse)(t),n=[],s=o.querySelector("p.pagetitle")?.text??"",a=/of\s+(\d[\d,]*)/i.exec(s),u=a?parseInt(a[1].replace(/,/g,""),10):0,A=(o.querySelector("#results")||o).querySelectorAll("tr");for(let l of A){if(l.classNames?.includes("dir")||l.getAttribute("class")?.includes("dir"))continue;let f=l.querySelectorAll("td");if(f.length<2)continue;let g=(f.find(q=>q.getAttribute("class")?.includes("f"))??f[1])?.querySelector("a");if(!g)continue;let h=g.getAttribute("href")??"",C=/\/xref\/([^/]+)(\/.*?)$/.exec(h);if(!C)continue;let E=C[1],y=C[2],I=f.find(q=>q.querySelector("code.con"))??f[f.length-1],D=I?.querySelectorAll("a.s")??[],w=[];for(let q of D){let T=q.querySelector("span.l"),U=T?parseInt(T.text.trim(),10):0,G=q.text.trim();T&&(G=G.replace(/^\d+\s*/,"")),U>0&&w.push({lineNumber:U,lineContent:G})}if(w.length===0){let q=I?.querySelector("code.con");if(q){let T=/\#(\d+)/.exec(h),U=T?parseInt(T[1],10):0;U>0&&w.push({lineNumber:U,lineContent:q.text.trim().replace(/^\d+\s*/,"")})}}w.length>0&&n.push({project:E,path:y,matches:w})}return{query:r,searchType:e,totalCount:u,timeMs:0,results:n,startIndex:0,endIndex:n.length}}var use={xf:"function",xm:"macro",xc:"class",xe:"enum",xi:"interface",xn:"namespace",xs:"struct",xt:"typedef",xu:"union",xd:"definition"},cse=/<a\s+class="h?l"\s+(?:id|name)="(\d+)"/,Ase=/class="(x[a-z])\s+intelliWindow-symbol"[^>]*data-definition-place="def"[^>]*>([^<]+)<\/a>/,lse=/<span\s+class='scope-signature'>([^<]*(?:&[^;]+;[^<]*)*)<\/span>/;function dse(t){return t.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#0?59;/g,";").replace(/&apos;/g,"'")}function wL(t){let e=[],r=new RegExp(`${cse.source}|${Ase.source}`,"g"),o=0,n;for(;(n=r.exec(t))!==null;)if(n[1])o=parseInt(n[1],10);else if(n[2]&&n[3]){let i=n[2],s=n[3],a=use[i];if(!a||!o)continue;let u=null;if(a==="function"){let c=Math.max(0,n.index-500),A=t.substring(c,n.index+n[0].length+500),l=lse.exec(A);l&&(u=dse(l[1]))}e.push({symbol:s,type:a,signature:u,line:o,lineStart:o,lineEnd:o,namespace:null})}return e}var fse="3.3.5",fb=class{rate;maxTokens;tokens;lastUpdate;queue=[];processing=!1;constructor(e){this.rate=e/60,this.maxTokens=e,this.tokens=e,this.lastUpdate=Date.now()}async acquire(){return new Promise(e=>{this.queue.push(e),this.processing||this.processQueue()})}async processQueue(){for(this.processing=!0;this.queue.length>0;){let e=Date.now(),r=(e-this.lastUpdate)/1e3;if(this.tokens=Math.min(this.maxTokens,this.tokens+r*this.rate),this.lastUpdate=e,this.tokens>=1)this.tokens-=1,this.queue.shift()();else{let o=(1-this.tokens)/this.rate*1e3;await gse(o)}}this.processing=!1}},qu=class{constructor(e,r,o){this.maxEntries=e;this.maxBytes=r;this.ttlMs=o}map=new Map;totalBytes=0;get(e){let r=this.map.get(e);if(r){if(Date.now()>r.expiresAt){this.totalBytes-=r.sizeBytes,this.map.delete(e);return}return r.value}}set(e,r,o){for(++this.writeCount%10===0&&this.evictExpired();this.map.size>=this.maxEntries||this.totalBytes+o>this.maxBytes;){let n=this.map.keys().next().value;if(n===void 0)break;let i=this.map.get(n);this.totalBytes-=i.sizeBytes,this.map.delete(n)}this.map.set(e,{value:r,expiresAt:Date.now()+this.ttlMs,sizeBytes:o}),this.totalBytes+=o}has(e){return this.get(e)!==void 0}writeCount=0;evictExpired(){let e=Date.now();for(let[r,o]of this.map)e>o.expiresAt&&(this.totalBytes-=o.sizeBytes,this.map.delete(r))}clear(){this.map.clear(),this.totalBytes=0}},Vr={search:6e4,suggest:1e4,file:3e4,default:3e4};function gse(t){return new Promise(e=>setTimeout(e,t))}function zu(t){if(t==null)return 0;if(typeof t=="string")return Buffer.byteLength(t,"utf8");if(typeof t=="number"||typeof t=="boolean")return 8;if(typeof t=="object"){let e=0;if(Array.isArray(t))for(let r of t)e+=zu(r);else for(let[r,o]of Object.entries(t))e+=Buffer.byteLength(r,"utf8")+zu(o);return e}return 0}function Ap(t,e,r){let o=1;for(let c=0;c<t.length;c++)t.charCodeAt(c)===10&&o++;if(e===void 0&&r===void 0)return{text:t,totalLines:o};let n=Math.max(0,(e??1)-1),i=Math.min(o,r??o),s=0;for(let c=0;c<n&&s<t.length;c++){let A=t.indexOf(`
151
151
  `,s);if(A===-1){s=t.length;break}s=A+1}let a=s;for(let c=n;c<i&&a<=t.length;c++){let A=t.indexOf(`
152
152
  `,a);if(A===-1){a=t.length;break}a=A+(c<i-1?1:0)}a<t.length&&t.charCodeAt(a)===10&&a++;let u=t.substring(s,a);return u.endsWith(`
153
153
  `)&&(u=u.slice(0,-1)),{text:u,totalLines:o}}function Nl(t){let e=t.replace(/\\/g,"/");if(e.includes("/../")||e.startsWith("../")||e.endsWith("/..")||e==="..")throw new Error(`Unsafe path rejected: "${t}"`)}function Gr(t,...e){let r=e.map(n=>encodeURIComponent(n).replace(/%2F/g,"/")).join("/"),o=new _l.URL(r,t);if(o.hostname!==t.hostname||o.port!==t.port)throw new Error(`SSRF guard: resolved URL "${o}" escapes allowed host "${t.hostname}"`);return o}var cp=class{constructor(e){this.config=e;let r=e.OPENGROK_BASE_URL.endsWith("/")?e.OPENGROK_BASE_URL:e.OPENGROK_BASE_URL+"/";if(this.baseUrl=new _l.URL(r),this.verifySsl=e.OPENGROK_VERIFY_SSL,this.agent=this.verifySsl?void 0:new SL.Agent({connect:{rejectUnauthorized:!1}}),e.OPENGROK_USERNAME&&e.OPENGROK_PASSWORD){let n=Buffer.from(`${e.OPENGROK_USERNAME}:${e.OPENGROK_PASSWORD}`).toString("base64");this.authHeader=`Basic ${n}`}let o=Math.floor(e.OPENGROK_CACHE_MAX_BYTES/4);e.OPENGROK_CACHE_ENABLED&&(this.searchCache=new qu(e.OPENGROK_CACHE_MAX_SIZE,o,e.OPENGROK_CACHE_SEARCH_TTL*1e3),this.fileCache=new qu(e.OPENGROK_CACHE_MAX_SIZE,o,e.OPENGROK_CACHE_FILE_TTL*1e3),this.historyCache=new qu(e.OPENGROK_CACHE_MAX_SIZE,o,e.OPENGROK_CACHE_HISTORY_TTL*1e3),this.projectsCache=new qu(1,o,e.OPENGROK_CACHE_PROJECTS_TTL*1e3)),e.OPENGROK_RATELIMIT_ENABLED&&(this.rateLimiter=new fb(e.OPENGROK_RATELIMIT_RPM))}baseUrl;authHeader;verifySsl;rateLimiter;agent;annotateEndpoint=null;searchCache;fileCache;historyCache;projectsCache;async request(e,r=Vr.default,o="application/json, text/html, */*"){this.rateLimiter&&await this.rateLimiter.acquire();let n=e instanceof _l.URL?e:Gr(this.baseUrl,e),i={"User-Agent":`OpenGrok-MCP/${fse}`,Accept:o};this.authHeader&&(i.Authorization=this.authHeader);let s={headers:i,redirect:"manual",signal:AbortSignal.timeout(r)};return this.agent&&(s.dispatcher=this.agent),qI(async()=>{let u=n,c=0;for(;;){let A=await fetch(u.toString(),s);if([301,302,303,307,308].includes(A.status)){if(c>=10)throw new Error("Too many redirects");let l=A.headers.get("location");if(!l)throw new Error("Redirect with no location header");let f=new _l.URL(l,u);if(f.hostname!==this.baseUrl.hostname||f.port!==this.baseUrl.port)throw new Error(`SSRF guard: redirected URL "${f}" escapes allowed host "${this.baseUrl.hostname}"`);try{await A.text()}catch{}u=f,c++;continue}if(A.status===429||A.status>=500)throw new Error(`HTTP ${A.status} \u2013 ${A.statusText}`);if(!A.ok)throw new nA(`HTTP ${A.status} \u2013 ${A.statusText}`);return A}},{retries:3,minTimeout:1e3,maxTimeout:1e4,factor:2,onFailedAttempt:({error:u,attemptNumber:c,retriesLeft:A})=>{gt.warn(`Request to ${n.pathname} failed (attempt ${c}/${A+c}): ${u.message}`)}})}async search(e,r="full",o,n=this.config.OPENGROK_DEFAULT_MAX_RESULTS,i=0,s){let a=o?[...o].sort():void 0,u=`${r}:${e}:${JSON.stringify(a)}:${n}:${i}:${s??""}`,c=this.searchCache?.get(u);if(c)return c;if(r==="defs"||r==="refs"){let g=await this.searchWeb(e,r,o,n,s);return this.searchCache?.set(u,g,zu(g)),g}let A=Gr(this.baseUrl,"api/v1/search");A.searchParams.set(r,e),A.searchParams.set("maxresults",String(n)),o?.length&&A.searchParams.set("projects",a.join(",")),i>0&&A.searchParams.set("start",String(i)),s&&A.searchParams.set("type",s);let f=await(await this.request(A,Vr.search,"application/json")).json(),d=hse(f,r,e);return this.searchCache?.set(u,d,zu(d)),d}async searchWeb(e,r,o,n=25,i){let s=Gr(this.baseUrl,"search");if(s.searchParams.set(r,e),s.searchParams.set("n",String(n)),o?.length)for(let c of o)s.searchParams.append("project",c);i&&s.searchParams.set("type",i);let u=await(await this.request(s,Vr.search,"text/html, */*")).text();return DL(u,r,e)}async suggest(e,r,o="full"){let n=Gr(this.baseUrl,"api/v1/suggest");n.searchParams.set(o,e),n.searchParams.set("field",o),n.searchParams.set("caret",String(e.length)),r&&n.searchParams.set("projects",r);let s=await(await this.request(n,Vr.suggest,"application/json")).json();return{suggestions:s.suggestions??[],time:s.time??0,partialResult:s.partialResult??!1}}async getFileContent(e,r,o,n){Nl(r);let i=r.replace(/^\/+/,""),s=`${e}:${i}`,a,u=this.fileCache?.get(s);if(u!==void 0)a=u;else{let l=Gr(this.baseUrl,`raw/${encodeURIComponent(e)}/${i}`);a=await(await this.request(l,Vr.file,"text/plain, */*")).text(),this.fileCache?.set(s,a,Buffer.byteLength(a,"utf8"))}let{text:c,totalLines:A}=Ap(a,o,n);return{project:e,path:i,content:c,lineCount:A,sizeBytes:Buffer.byteLength(c,"utf8"),startLine:o}}async getFileHistory(e,r,o=10){Nl(r);let n=r.replace(/^\/+/,""),i=`${e}:${n}`,s=this.historyCache?.get(i);if(!s){let a=Gr(this.baseUrl,`history/${encodeURIComponent(e)}/${n}`),c=await(await this.request(a,Vr.default,"text/html, */*")).text();s=vL(c,e,n),this.historyCache?.set(i,s,zu(s))}return s.entries.length>o?{...s,entries:s.entries.slice(0,o)}:s}async getAnnotate(e,r){Nl(r);let o=r.replace(/^\/+/,"");if(this.annotateEndpoint!=="xref")try{let a=Gr(this.baseUrl,`annotate/${encodeURIComponent(e)}/${o}`),c=await(await this.request(a,Vr.file,"text/html, */*")).text();return this.annotateEndpoint="annotate",db(c,e,o)}catch{this.annotateEndpoint==="annotate"&&(this.annotateEndpoint=null)}let n=Gr(this.baseUrl,`xref/${encodeURIComponent(e)}/${o}`);n.searchParams.set("a","true");let s=await(await this.request(n,Vr.file,"text/html, */*")).text();return this.annotateEndpoint="xref",db(s,e,o)}async getFileSymbols(e,r){Nl(r);let o=r.replace(/^\/+/,""),n=`defs:${e}:${o}`,i=this.fileCache?.get(n);if(i!==void 0)return JSON.parse(i);let s=Gr(this.baseUrl,"api/v1/file/defs");s.searchParams.set("path","/"+o);try{let u=await(await this.request(s,Vr.file,"application/json")).json(),c={project:e,path:o,symbols:Array.isArray(u)?u:[]},A=JSON.stringify(c);return this.fileCache?.set(n,A,Buffer.byteLength(A,"utf8")),c}catch{try{let a=Gr(this.baseUrl,`xref/${encodeURIComponent(e)}/${o}`),c=await(await this.request(a,Vr.file,"text/html, */*")).text(),A=wL(c),l={project:e,path:o,symbols:A},f=JSON.stringify(l);return this.fileCache?.set(n,f,Buffer.byteLength(f,"utf8")),l}catch{return{project:e,path:o,symbols:[]}}}}async browseDirectory(e,r=""){r&&Nl(r);let o=r.replace(/^\/+|\/+$/g,""),n=o?`${o}/`:"",i=Gr(this.baseUrl,`xref/${encodeURIComponent(e)}/${n}`),a=await(await this.request(i,Vr.default,"text/html, */*")).text();return bL(a,e,o)}async listProjects(e){let r="projects",o=this.projectsCache?.get(r);if(!o){let n=Gr(this.baseUrl,""),s=await(await this.request(n,Vr.default,"text/html, */*")).text();o=QL(s),this.projectsCache?.set(r,o,zu(o))}if(e){if(e.length>100)throw new Error("Filter pattern too long (max 100 characters)");if(/\*{3,}|\?{3,}/.test(e))throw new Error("Filter pattern too complex (too many consecutive wildcards)");let s=(/[*?]/.test(e)?e:`*${e}*`).replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),a;try{a=new RegExp(`^${s}$`,"i")}catch{throw new Error("Invalid filter pattern")}return o.filter(u=>a.test(u.name))}return o}async testConnection(){try{let e=Gr(this.baseUrl,"api/v1/projects"),r=await this.request(e,Vr.suggest);if(!r.ok)return!1;let o=await r.json();return Array.isArray(o)}catch{return!1}}async close(){try{await this.agent?.close()}finally{this.searchCache?.clear(),this.fileCache?.clear(),this.historyCache?.clear(),this.projectsCache?.clear()}}};function hse(t,e,r){let o=t.results??{},n=[];for(let[i,s]of Object.entries(o)){let a=/^\/([^/]+)(\/.*)?$/.exec(i),u=a?.[1]??"unknown",c=a?.[2]??i;n.push({project:u,path:c,matches:s.map(A=>({lineNumber:Number(A.lineNumber??0),lineContent:String(A.line??"")}))})}return{query:r,searchType:e,totalCount:Number(t.resultCount??0),timeMs:Number(t.time??0),results:n,startIndex:Number(t.startDocument??0),endIndex:Number(t.endDocument??0)}}var F={};ko(F,{$brand:()=>Tl,$input:()=>G0,$output:()=>V0,NEVER:()=>lp,TimePrecision:()=>Z0,ZodAny:()=>DD,ZodArray:()=>kD,ZodBase64:()=>eE,ZodBase64URL:()=>tE,ZodBigInt:()=>Ec,ZodBigIntFormat:()=>oE,ZodBoolean:()=>mc,ZodCIDRv4:()=>Km,ZodCIDRv6:()=>Xm,ZodCUID:()=>Vm,ZodCUID2:()=>Gm,ZodCatch:()=>ZD,ZodCodec:()=>AE,ZodCustom:()=>_d,ZodCustomStringFormat:()=>hc,ZodDate:()=>wd,ZodDefault:()=>HD,ZodDiscriminatedUnion:()=>_D,ZodE164:()=>rE,ZodEmail:()=>qm,ZodEmoji:()=>zm,ZodEnum:()=>fc,ZodError:()=>cD,ZodExactOptional:()=>PD,ZodFile:()=>$D,ZodFirstPartyTypeKind:()=>uw,ZodFunction:()=>iw,ZodGUID:()=>Qd,ZodIPv4:()=>Zm,ZodIPv6:()=>Wm,ZodISODate:()=>Mm,ZodISODateTime:()=>Um,ZodISODuration:()=>$m,ZodISOTime:()=>Lm,ZodIntersection:()=>RD,ZodIssueCode:()=>kue,ZodJWT:()=>nE,ZodKSUID:()=>Jm,ZodLazy:()=>rw,ZodLiteral:()=>LD,ZodMAC:()=>BD,ZodMap:()=>UD,ZodNaN:()=>KD,ZodNanoID:()=>Hm,ZodNever:()=>SD,ZodNonOptional:()=>uE,ZodNull:()=>vD,ZodNullable:()=>zD,ZodNumber:()=>pc,ZodNumberFormat:()=>Da,ZodObject:()=>Sd,ZodOptional:()=>aE,ZodPipe:()=>cE,ZodPrefault:()=>GD,ZodPromise:()=>ow,ZodReadonly:()=>XD,ZodRealError:()=>Br,ZodRecord:()=>Nd,ZodSet:()=>MD,ZodString:()=>gc,ZodStringFormat:()=>Ye,ZodSuccess:()=>JD,ZodSymbol:()=>QD,ZodTemplateLiteral:()=>tw,ZodTransform:()=>OD,ZodTuple:()=>TD,ZodType:()=>ae,ZodULID:()=>jm,ZodURL:()=>Dd,ZodUUID:()=>Io,ZodUndefined:()=>bD,ZodUnion:()=>xd,ZodUnknown:()=>wD,ZodVoid:()=>xD,ZodXID:()=>Ym,ZodXor:()=>ND,_ZodString:()=>Pm,_default:()=>VD,_function:()=>pO,any:()=>K6,array:()=>he,base64:()=>F6,base64url:()=>U6,bigint:()=>j6,boolean:()=>Et,catch:()=>WD,check:()=>mO,cidrv4:()=>R6,cidrv6:()=>T6,clone:()=>Rt,codec:()=>fO,coerce:()=>cw,config:()=>ut,core:()=>Yr,cuid:()=>v6,cuid2:()=>D6,custom:()=>lE,date:()=>eO,decode:()=>hD,decodeAsync:()=>mD,describe:()=>EO,discriminatedUnion:()=>kd,e164:()=>M6,email:()=>h6,emoji:()=>Q6,encode:()=>gD,encodeAsync:()=>pD,endsWith:()=>Ia,enum:()=>Ut,exactOptional:()=>qD,file:()=>cO,flattenError:()=>ju,float32:()=>z6,float64:()=>H6,formatError:()=>Yu,fromJSONSchema:()=>bO,function:()=>pO,getErrorMap:()=>_ue,globalRegistry:()=>kt,gt:()=>Un,gte:()=>Tt,guid:()=>p6,hash:()=>q6,hex:()=>P6,hostname:()=>O6,httpUrl:()=>B6,includes:()=>ma,instanceof:()=>CO,int:()=>Om,int32:()=>V6,int64:()=>Y6,intersection:()=>Cc,ipv4:()=>k6,ipv6:()=>_6,iso:()=>is,json:()=>BO,jwt:()=>L6,keyof:()=>tO,ksuid:()=>x6,lazy:()=>nw,length:()=>ts,literal:()=>H,locales:()=>ac,looseObject:()=>Ft,looseRecord:()=>iO,lowercase:()=>ha,lt:()=>Fn,lte:()=>nr,mac:()=>N6,map:()=>sO,maxLength:()=>es,maxSize:()=>Xo,meta:()=>IO,mime:()=>Ca,minLength:()=>Eo,minSize:()=>Mn,multipleOf:()=>Ko,nan:()=>dO,nanoid:()=>b6,nativeEnum:()=>uO,negative:()=>Ed,never:()=>iE,nonnegative:()=>Cd,nonoptional:()=>YD,nonpositive:()=>Id,normalize:()=>ya,null:()=>Ic,nullable:()=>bd,nullish:()=>AO,number:()=>Ue,object:()=>$,optional:()=>Xe,overwrite:()=>fn,parse:()=>AD,parseAsync:()=>lD,partialRecord:()=>oO,pipe:()=>vd,positive:()=>md,prefault:()=>jD,preprocess:()=>Rd,prettifyError:()=>pp,promise:()=>hO,property:()=>yd,readonly:()=>ew,record:()=>We,refine:()=>sw,regex:()=>ga,regexes:()=>yr,registry:()=>Zl,safeDecode:()=>ID,safeDecodeAsync:()=>yD,safeEncode:()=>ED,safeEncodeAsync:()=>CD,safeParse:()=>dD,safeParseAsync:()=>fD,set:()=>aO,setErrorMap:()=>Nue,size:()=>Xi,slugify:()=>Ac,startsWith:()=>Ea,strictObject:()=>rO,string:()=>v,stringFormat:()=>$6,stringbool:()=>yO,success:()=>lO,superRefine:()=>aw,symbol:()=>Z6,templateLiteral:()=>gO,toJSONSchema:()=>dc,toLowerCase:()=>Qa,toUpperCase:()=>ba,transform:()=>sE,treeifyError:()=>hp,trim:()=>Ba,tuple:()=>FD,uint32:()=>G6,uint64:()=>J6,ulid:()=>w6,undefined:()=>W6,union:()=>Ge,unknown:()=>Je,uppercase:()=>pa,url:()=>y6,util:()=>x,uuid:()=>m6,uuidv4:()=>E6,uuidv6:()=>I6,uuidv7:()=>C6,void:()=>X6,xid:()=>S6,xor:()=>nO});var Yr={};ko(Yr,{$ZodAny:()=>A0,$ZodArray:()=>h0,$ZodAsyncError:()=>Tn,$ZodBase64:()=>e0,$ZodBase64URL:()=>t0,$ZodBigInt:()=>Gl,$ZodBigIntFormat:()=>s0,$ZodBoolean:()=>nc,$ZodCIDRv4:()=>Kp,$ZodCIDRv6:()=>Xp,$ZodCUID:()=>Op,$ZodCUID2:()=>Pp,$ZodCatch:()=>_0,$ZodCheck:()=>je,$ZodCheckBigIntFormat:()=>Xb,$ZodCheckEndsWith:()=>lv,$ZodCheckGreaterThan:()=>Sp,$ZodCheckIncludes:()=>cv,$ZodCheckLengthEquals:()=>iv,$ZodCheckLessThan:()=>wp,$ZodCheckLowerCase:()=>av,$ZodCheckMaxLength:()=>nv,$ZodCheckMaxSize:()=>ev,$ZodCheckMimeType:()=>fv,$ZodCheckMinLength:()=>ov,$ZodCheckMinSize:()=>tv,$ZodCheckMultipleOf:()=>Wb,$ZodCheckNumberFormat:()=>Kb,$ZodCheckOverwrite:()=>gv,$ZodCheckProperty:()=>dv,$ZodCheckRegex:()=>sv,$ZodCheckSizeEquals:()=>rv,$ZodCheckStartsWith:()=>Av,$ZodCheckStringFormat:()=>rc,$ZodCheckUpperCase:()=>uv,$ZodCodec:()=>ic,$ZodCustom:()=>O0,$ZodCustomStringFormat:()=>o0,$ZodDate:()=>g0,$ZodDefault:()=>S0,$ZodDiscriminatedUnion:()=>m0,$ZodE164:()=>r0,$ZodEmail:()=>Up,$ZodEmoji:()=>Lp,$ZodEncodeError:()=>ji,$ZodEnum:()=>B0,$ZodError:()=>Pl,$ZodExactOptional:()=>D0,$ZodFile:()=>b0,$ZodFunction:()=>M0,$ZodGUID:()=>Tp,$ZodIPv4:()=>Jp,$ZodIPv6:()=>Zp,$ZodISODate:()=>Gp,$ZodISODateTime:()=>Vp,$ZodISODuration:()=>Yp,$ZodISOTime:()=>jp,$ZodIntersection:()=>E0,$ZodJWT:()=>n0,$ZodKSUID:()=>Hp,$ZodLazy:()=>$0,$ZodLiteral:()=>Q0,$ZodMAC:()=>Wp,$ZodMap:()=>C0,$ZodNaN:()=>R0,$ZodNanoID:()=>$p,$ZodNever:()=>d0,$ZodNonOptional:()=>k0,$ZodNull:()=>c0,$ZodNullable:()=>w0,$ZodNumber:()=>Vl,$ZodNumberFormat:()=>i0,$ZodObject:()=>Ev,$ZodObjectJIT:()=>Iv,$ZodOptional:()=>Yl,$ZodPipe:()=>T0,$ZodPrefault:()=>x0,$ZodPromise:()=>L0,$ZodReadonly:()=>F0,$ZodRealError:()=>Cr,$ZodRecord:()=>I0,$ZodRegistry:()=>H0,$ZodSet:()=>y0,$ZodString:()=>Ki,$ZodStringFormat:()=>Ve,$ZodSuccess:()=>N0,$ZodSymbol:()=>a0,$ZodTemplateLiteral:()=>U0,$ZodTransform:()=>v0,$ZodTuple:()=>jl,$ZodType:()=>oe,$ZodULID:()=>qp,$ZodURL:()=>Mp,$ZodUUID:()=>Fp,$ZodUndefined:()=>u0,$ZodUnion:()=>oc,$ZodUnknown:()=>l0,$ZodVoid:()=>f0,$ZodXID:()=>zp,$ZodXor:()=>p0,$brand:()=>Tl,$constructor:()=>B,$input:()=>G0,$output:()=>V0,Doc:()=>Hl,JSONSchema:()=>f6,JSONSchemaGenerator:()=>Tm,NEVER:()=>lp,TimePrecision:()=>Z0,_any:()=>mm,_array:()=>Cv,_base64:()=>fd,_base64url:()=>gd,_bigint:()=>Am,_boolean:()=>um,_catch:()=>yue,_check:()=>d6,_cidrv4:()=>ld,_cidrv6:()=>dd,_coercedBigint:()=>lm,_coercedBoolean:()=>cm,_coercedDate:()=>Bm,_coercedNumber:()=>rm,_coercedString:()=>Y0,_cuid:()=>od,_cuid2:()=>id,_custom:()=>vm,_date:()=>ym,_decode:()=>Ep,_decodeAsync:()=>Cp,_default:()=>Eue,_discriminatedUnion:()=>sue,_e164:()=>hd,_email:()=>Wl,_emoji:()=>rd,_encode:()=>mp,_encodeAsync:()=>Ip,_endsWith:()=>Ia,_enum:()=>due,_file:()=>bm,_float32:()=>om,_float64:()=>im,_gt:()=>Un,_gte:()=>Tt,_guid:()=>uc,_includes:()=>ma,_int:()=>nm,_int32:()=>sm,_int64:()=>dm,_intersection:()=>aue,_ipv4:()=>cd,_ipv6:()=>Ad,_isoDate:()=>K0,_isoDateTime:()=>W0,_isoDuration:()=>em,_isoTime:()=>X0,_jwt:()=>pd,_ksuid:()=>ud,_lazy:()=>vue,_length:()=>ts,_literal:()=>gue,_lowercase:()=>ha,_lt:()=>Fn,_lte:()=>nr,_mac:()=>J0,_map:()=>Aue,_max:()=>nr,_maxLength:()=>es,_maxSize:()=>Xo,_mime:()=>Ca,_min:()=>Tt,_minLength:()=>Eo,_minSize:()=>Mn,_multipleOf:()=>Ko,_nan:()=>Qm,_nanoid:()=>nd,_nativeEnum:()=>fue,_negative:()=>Ed,_never:()=>Im,_nonnegative:()=>Cd,_nonoptional:()=>Iue,_nonpositive:()=>Id,_normalize:()=>ya,_null:()=>pm,_nullable:()=>mue,_number:()=>tm,_optional:()=>pue,_overwrite:()=>fn,_parse:()=>Ju,_parseAsync:()=>Wu,_pipe:()=>Bue,_positive:()=>md,_promise:()=>Due,_property:()=>yd,_readonly:()=>Que,_record:()=>cue,_refine:()=>Dm,_regex:()=>ga,_safeDecode:()=>Bp,_safeDecodeAsync:()=>bp,_safeEncode:()=>yp,_safeEncodeAsync:()=>Qp,_safeParse:()=>Xu,_safeParseAsync:()=>ec,_set:()=>lue,_size:()=>Xi,_slugify:()=>Ac,_startsWith:()=>Ea,_string:()=>j0,_stringFormat:()=>va,_stringbool:()=>km,_success:()=>Cue,_superRefine:()=>wm,_symbol:()=>gm,_templateLiteral:()=>bue,_toLowerCase:()=>Qa,_toUpperCase:()=>ba,_transform:()=>hue,_trim:()=>Ba,_tuple:()=>uue,_uint32:()=>am,_uint64:()=>fm,_ulid:()=>sd,_undefined:()=>hm,_union:()=>oue,_unknown:()=>Em,_uppercase:()=>pa,_url:()=>cc,_uuid:()=>Kl,_uuidv4:()=>Xl,_uuidv6:()=>ed,_uuidv7:()=>td,_void:()=>Cm,_xid:()=>ad,_xor:()=>iue,clone:()=>Rt,config:()=>ut,createStandardJSONSchemaMethod:()=>lc,createToJSONSchemaMethod:()=>yv,decode:()=>PL,decodeAsync:()=>zL,describe:()=>Sm,encode:()=>OL,encodeAsync:()=>qL,extractDefs:()=>ns,finalize:()=>os,flattenError:()=>ju,formatError:()=>Yu,globalConfig:()=>Rl,globalRegistry:()=>kt,initializeContext:()=>rs,isValidBase64:()=>mv,isValidBase64URL:()=>l$,isValidJWT:()=>d$,locales:()=>ac,meta:()=>xm,parse:()=>Zu,parseAsync:()=>Ku,prettifyError:()=>pp,process:()=>Pe,regexes:()=>yr,registry:()=>Zl,safeDecode:()=>VL,safeDecodeAsync:()=>jL,safeEncode:()=>HL,safeEncodeAsync:()=>GL,safeParse:()=>da,safeParseAsync:()=>tc,toDotPath:()=>$L,toJSONSchema:()=>dc,treeifyError:()=>hp,util:()=>x,version:()=>hv});var lp=Object.freeze({status:"aborted"});function B(t,e,r){function o(a,u){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:u,constr:s,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,u);let c=s.prototype,A=Object.keys(c);for(let l=0;l<A.length;l++){let f=A[l];f in a||(a[f]=c[f].bind(a))}}let n=r?.Parent??Object;class i extends n{}Object.defineProperty(i,"name",{value:t});function s(a){var u;let c=r?.Parent?new i:this;o(c,a),(u=c._zod).deferred??(u.deferred=[]);for(let A of c._zod.deferred)A();return c}return Object.defineProperty(s,"init",{value:o}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(s,"name",{value:t}),s}var Tl=Symbol("zod_brand"),Tn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},ji=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Rl={};function ut(t){return t&&Object.assign(Rl,t),Rl}var x={};ko(x,{BIGINT_FORMAT_RANGES:()=>Bb,Class:()=>hb,NUMBER_FORMAT_RANGES:()=>yb,aborted:()=>Wi,allowsEval:()=>Eb,assert:()=>Cse,assertEqual:()=>pse,assertIs:()=>Ese,assertNever:()=>Ise,assertNotEqual:()=>mse,assignProp:()=>Ji,base64ToUint8Array:()=>UL,base64urlToUint8Array:()=>Nse,cached:()=>Vu,captureStackTrace:()=>fp,cleanEnum:()=>kse,cleanRegex:()=>Ml,clone:()=>Rt,cloneDef:()=>Bse,createTransparentProxy:()=>Sse,defineLazy:()=>ce,esc:()=>dp,escapeRegex:()=>dn,extend:()=>_L,finalizeIssue:()=>Ir,floatSafeRemainder:()=>pb,getElementAtPath:()=>Qse,getEnumValues:()=>Ul,getLengthableOrigin:()=>Ol,getParsedType:()=>wse,getSizableOrigin:()=>$l,hexToUint8Array:()=>Rse,isObject:()=>la,isPlainObject:()=>Zi,issue:()=>Gu,joinValues:()=>b,jsonStringifyReplacer:()=>Hu,merge:()=>xse,mergeDefs:()=>Wo,normalizeParams:()=>R,nullish:()=>Yi,numKeys:()=>Dse,objectClone:()=>yse,omit:()=>NL,optionalKeys:()=>Cb,parsedType:()=>N,partial:()=>TL,pick:()=>kL,prefixIssues:()=>jr,primitiveTypes:()=>Ib,promiseAllObject:()=>bse,propertyKeyTypes:()=>Ll,randomString:()=>vse,required:()=>FL,safeExtend:()=>RL,shallowClone:()=>gp,slugify:()=>mb,stringifyPrimitive:()=>S,uint8ArrayToBase64:()=>ML,uint8ArrayToBase64url:()=>_se,uint8ArrayToHex:()=>Tse,unwrapMessage:()=>Fl});function pse(t){return t}function mse(t){return t}function Ese(t){}function Ise(t){throw new Error("Unexpected value in exhaustive check")}function Cse(t){}function Ul(t){let e=Object.values(t).filter(o=>typeof o=="number");return Object.entries(t).filter(([o,n])=>e.indexOf(+o)===-1).map(([o,n])=>n)}function b(t,e="|"){return t.map(r=>S(r)).join(e)}function Hu(t,e){return typeof e=="bigint"?e.toString():e}function Vu(t){return{get value(){{let r=t();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function Yi(t){return t==null}function Ml(t){let e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function pb(t,e){let r=(t.toString().split(".")[1]||"").length,o=e.toString(),n=(o.split(".")[1]||"").length;if(n===0&&/\d?e-\d?/.test(o)){let u=o.match(/\d?e-(\d?)/);u?.[1]&&(n=Number.parseInt(u[1]))}let i=r>n?r:n,s=Number.parseInt(t.toFixed(i).replace(".","")),a=Number.parseInt(e.toFixed(i).replace(".",""));return s%a/10**i}var xL=Symbol("evaluating");function ce(t,e,r){let o;Object.defineProperty(t,e,{get(){if(o!==xL)return o===void 0&&(o=xL,o=r()),o},set(n){Object.defineProperty(t,e,{value:n})},configurable:!0})}function yse(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Ji(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wo(...t){let e={};for(let r of t){let o=Object.getOwnPropertyDescriptors(r);Object.assign(e,o)}return Object.defineProperties({},e)}function Bse(t){return Wo(t._zod.def)}function Qse(t,e){return e?e.reduce((r,o)=>r?.[o],t):t}function bse(t){let e=Object.keys(t),r=e.map(o=>t[o]);return Promise.all(r).then(o=>{let n={};for(let i=0;i<e.length;i++)n[e[i]]=o[i];return n})}function vse(t=10){let e="abcdefghijklmnopqrstuvwxyz",r="";for(let o=0;o<t;o++)r+=e[Math.floor(Math.random()*e.length)];return r}function dp(t){return JSON.stringify(t)}function mb(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var fp="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function la(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var Eb=Vu(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Zi(t){if(la(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let r=e.prototype;return!(la(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function gp(t){return Zi(t)?{...t}:Array.isArray(t)?[...t]:t}function Dse(t){let e=0;for(let r in t)Object.prototype.hasOwnProperty.call(t,r)&&e++;return e}var wse=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},Ll=new Set(["string","number","symbol"]),Ib=new Set(["string","number","bigint","boolean","symbol","undefined"]);function dn(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Rt(t,e,r){let o=new t._zod.constr(e??t._zod.def);return(!e||r?.parent)&&(o._zod.parent=t),o}function R(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Sse(t){let e;return new Proxy({},{get(r,o,n){return e??(e=t()),Reflect.get(e,o,n)},set(r,o,n,i){return e??(e=t()),Reflect.set(e,o,n,i)},has(r,o){return e??(e=t()),Reflect.has(e,o)},deleteProperty(r,o){return e??(e=t()),Reflect.deleteProperty(e,o)},ownKeys(r){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(r,o){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,o)},defineProperty(r,o,n){return e??(e=t()),Reflect.defineProperty(e,o,n)}})}function S(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function Cb(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var yb={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Bb={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function kL(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i=Wo(t._zod.def,{get shape(){let s={};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(s[a]=r.shape[a])}return Ji(this,"shape",s),s},checks:[]});return Rt(t,i)}function NL(t,e){let r=t._zod.def,o=r.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=Wo(t._zod.def,{get shape(){let s={...t._zod.def.shape};for(let a in e){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete s[a]}return Ji(this,"shape",s),s},checks:[]});return Rt(t,i)}function _L(t,e){if(!Zi(e))throw new Error("Invalid input to extend: expected a plain object");let r=t._zod.def.checks;if(r&&r.length>0){let i=t._zod.def.shape;for(let s in e)if(Object.getOwnPropertyDescriptor(i,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let n=Wo(t._zod.def,{get shape(){let i={...t._zod.def.shape,...e};return Ji(this,"shape",i),i}});return Rt(t,n)}function RL(t,e){if(!Zi(e))throw new Error("Invalid input to safeExtend: expected a plain object");let r=Wo(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e};return Ji(this,"shape",o),o}});return Rt(t,r)}function xse(t,e){let r=Wo(t._zod.def,{get shape(){let o={...t._zod.def.shape,...e._zod.def.shape};return Ji(this,"shape",o),o},get catchall(){return e._zod.def.catchall},checks:[]});return Rt(t,r)}function TL(t,e,r){let n=e._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let s=Wo(e._zod.def,{get shape(){let a=e._zod.def.shape,u={...a};if(r)for(let c in r){if(!(c in a))throw new Error(`Unrecognized key: "${c}"`);r[c]&&(u[c]=t?new t({type:"optional",innerType:a[c]}):a[c])}else for(let c in a)u[c]=t?new t({type:"optional",innerType:a[c]}):a[c];return Ji(this,"shape",u),u},checks:[]});return Rt(e,s)}function FL(t,e,r){let o=Wo(e._zod.def,{get shape(){let n=e._zod.def.shape,i={...n};if(r)for(let s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new t({type:"nonoptional",innerType:n[s]}))}else for(let s in n)i[s]=new t({type:"nonoptional",innerType:n[s]});return Ji(this,"shape",i),i}});return Rt(e,o)}function Wi(t,e=0){if(t.aborted===!0)return!0;for(let r=e;r<t.issues.length;r++)if(t.issues[r]?.continue!==!0)return!0;return!1}function jr(t,e){return e.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(t),r})}function Fl(t){return typeof t=="string"?t:t?.message}function Ir(t,e,r){let o={...t,path:t.path??[]};if(!t.message){let n=Fl(t.inst?._zod.def?.error?.(t))??Fl(e?.error?.(t))??Fl(r.customError?.(t))??Fl(r.localeError?.(t))??"Invalid input";o.message=n}return delete o.inst,delete o.continue,e?.reportInput||delete o.input,o}function $l(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function Ol(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function N(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let r=t;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return e}function Gu(...t){let[e,r,o]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:o}:{...e}}function kse(t){return Object.entries(t).filter(([e,r])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function UL(t){let e=atob(t),r=new Uint8Array(e.length);for(let o=0;o<e.length;o++)r[o]=e.charCodeAt(o);return r}function ML(t){let e="";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return btoa(e)}function Nse(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-e.length%4)%4);return UL(e+r)}function _se(t){return ML(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Rse(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(e.length/2);for(let o=0;o<e.length;o+=2)r[o/2]=Number.parseInt(e.slice(o,o+2),16);return r}function Tse(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var hb=class{constructor(...e){}};var LL=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Hu,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Pl=B("$ZodError",LL),Cr=B("$ZodError",LL,{Parent:Error});function ju(t,e=r=>r.message){let r={},o=[];for(let n of t.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):o.push(e(n));return{formErrors:o,fieldErrors:r}}function Yu(t,e=r=>r.message){let r={_errors:[]},o=n=>{for(let i of n.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(s=>o({issues:s}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(e(i));else{let s=r,a=0;for(;a<i.path.length;){let u=i.path[a];a===i.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(e(i))):s[u]=s[u]||{_errors:[]},s=s[u],a++}}};return o(t),r}function hp(t,e=r=>r.message){let r={errors:[]},o=(n,i=[])=>{var s,a;for(let u of n.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(c=>o({issues:c},u.path));else if(u.code==="invalid_key")o({issues:u.issues},u.path);else if(u.code==="invalid_element")o({issues:u.issues},u.path);else{let c=[...i,...u.path];if(c.length===0){r.errors.push(e(u));continue}let A=r,l=0;for(;l<c.length;){let f=c[l],d=l===c.length-1;typeof f=="string"?(A.properties??(A.properties={}),(s=A.properties)[f]??(s[f]={errors:[]}),A=A.properties[f]):(A.items??(A.items=[]),(a=A.items)[f]??(a[f]={errors:[]}),A=A.items[f]),d&&A.errors.push(e(u)),l++}}};return o(t),r}function $L(t){let e=[],r=t.map(o=>typeof o=="object"?o.key:o);for(let o of r)typeof o=="number"?e.push(`[${o}]`):typeof o=="symbol"?e.push(`[${JSON.stringify(String(o))}]`):/[^\w$]/.test(o)?e.push(`[${JSON.stringify(o)}]`):(e.length&&e.push("."),e.push(o));return e.join("")}function pp(t){let e=[],r=[...t.issues].sort((o,n)=>(o.path??[]).length-(n.path??[]).length);for(let o of r)e.push(`\u2716 ${o.message}`),o.path?.length&&e.push(` \u2192 at ${$L(o.path)}`);return e.join(`
@@ -225,7 +225,7 @@ File symbols (${t.fileSymbols.length}):`);let r=new Map;for(let o of t.fileSymbo
225
225
  ${i} (${a.length}):`);for(let u of a){let c=u.lineStart??u.line,A=` ${u.symbol} L${c}`;if(u.signature){let l=u.signature.length>80?u.signature.slice(0,77)+"...":u.signature;A+=` ${l}`}r.push(A)}}return r.join(`
226
226
  `)}var So=Xr(require("fs")),pt=Xr(require("path"));function xq(t,e){let r;try{r=So.realpathSync(t)}catch{return null}for(let o of e)if(r===o||r.startsWith(o+pt.sep))return r;return null}function o0e(t){let e=[],r="",o=!1,n=!1;for(let i=0;i<t.length;i++){let s=t[i];if(s==="\\"&&!o&&i+1<t.length){let a=t[i+1];if(a==='"'||a==="'"||a==="\\"){r+=a,i++;continue}r+=s}else s==="'"&&!n?o=!o:s==='"'&&!o?n=!n:(s===" "||s===" ")&&!o&&!n?r.length&&(e.push(r),r=""):r+=s}return r.length&&e.push(r),e}function i0e(t,e,r){let o={compiler:"",includes:[],defines:[],standard:"",extraFlags:[]};if(!t.length)return o;o.compiler=pt.basename(t[0]);for(let n=1;n<t.length;n++){let i=t[n];if(i==="-o"){n++;continue}if(i!=="-c")if(i.startsWith("-I")&&i.length>2){let s=LS(i.slice(2),e,r);s&&o.includes.push(s)}else if(i==="-I"){let s=t[++n];if(s){let a=LS(s,e,r);a&&o.includes.push(a)}}else if(i==="-isystem"||i==="-iwithprefix"||i==="-iprefix"||i==="-isysroot"){let s=t[++n];if(s){let a=LS(s,e,r);a&&o.includes.push(a)}}else if(i.startsWith("-D")&&i.length>2)o.defines.push(i.slice(2));else if(i==="-D"){let s=t[++n];s&&o.defines.push(s)}else i.startsWith("-std=")?o.standard=i.slice(5):!i.startsWith("-")||i==="-"||o.extraFlags.push(i)}return o.includes=[...new Set(o.includes)],o}function LS(t,e,r){let o=pt.isAbsolute(t)?t:pt.resolve(e,t);return xq(o,r)}function kq(t){let e=[];for(let r of t)try{let o=So.realpathSync(r),n=So.statSync(o);e.push(n.isDirectory()?o:pt.dirname(o))}catch{}return[...new Set(e)]}function bI(t){let e=new Map;for(let r of t){let o;try{let i=So.realpathSync(r);o=So.statSync(i).isDirectory()?pt.join(i,"compile_commands.json"):i}catch{continue}if(e.has(o))continue;let n;try{n=JSON.parse(So.readFileSync(o,"utf8"))}catch{continue}Array.isArray(n)&&e.set(o,n)}return e}function Nq(t,e,r){let o=new Map;if(!e.length)return o;let n=r??bI(t);for(let[i,s]of n)for(let a of s){if(typeof a!="object"||a===null||!("file"in a)||typeof a.file!="string")continue;let u=a,c=u.directory?pt.resolve(u.directory):pt.dirname(i),A=pt.isAbsolute(u.file)?u.file:pt.resolve(c,u.file),l=xq(A,e);if(!l)continue;let f;if(Array.isArray(u.arguments)&&u.arguments.length>0)f=u.arguments.map(String);else if(typeof u.command=="string"&&u.command.length>0)f=o0e(u.command);else continue;let d=i0e(f,c,e);o.set(l,{file:l,directory:c,...d})}return o}function _q(t,e){let r=[],o=e??bI(t);for(let[,a]of o)for(let u of a)if(typeof u=="object"&&u!==null&&"directory"in u&&typeof u.directory=="string"){let c=u.directory.trim();c&&r.push(pt.resolve(c))}if(!r.length)return"";let n=[...new Set(r)];if(n.length===1)return n[0];let i=n[0].split(pt.sep),s=i.length;for(let a=1;a<n.length;a++){let u=n[a].split(pt.sep),c=0;for(;c<s&&c<u.length&&i[c]===u[c];)c++;if(s=c,!s)break}return s?i.slice(0,s).join(pt.sep)||pt.sep:pt.sep}var vI="Filter by language: c, cxx (C++), java, python, javascript, typescript, csharp, golang, ruby, perl, php, scala, kotlin, swift, rust, sql, xml, json, yaml, shell, makefile, etc.",DI=F.object({query:F.string().min(1,"query must not be empty").describe('Search query. Supports OpenGrok syntax: +required -excluded "exact phrase"'),search_type:F.enum(["full","defs","refs","path","hist"]).default("full"),projects:F.array(F.string()).optional().describe("Filter by project names. Omit to use the server default project."),max_results:F.number().int().min(1).max(100).default(10),start_index:F.number().int().min(0).default(0),file_type:F.string().optional().describe(vI)}),wI=F.object({path_pattern:F.string().min(1,"path_pattern must not be empty").describe("Path pattern (e.g., config.ts, test*.js)"),projects:F.array(F.string()).optional(),max_results:F.number().int().min(1).max(100).default(10),start_index:F.number().int().min(0).default(0)}),SI=F.object({project:F.string().min(1),path:F.string().min(1),start_line:F.number().int().min(1).optional().describe("Start line (1-indexed)"),end_line:F.number().int().min(1).optional().describe("End line (1-indexed)")}),xI=F.object({project:F.string().min(1),path:F.string().min(1),max_entries:F.number().int().min(1).max(50).default(10)}),kI=F.object({project:F.string().min(1),path:F.string().default("")}),NI=F.object({filter:F.string().optional().describe("Filter projects by substring or glob pattern (e.g., 'myproject', 'release-*')")}),_I=F.object({project:F.string().min(1),path:F.string().min(1),start_line:F.number().int().min(1).optional().describe("Start line (1-indexed)"),end_line:F.number().int().min(1).optional().describe("End line (1-indexed)")}),RI=F.object({query:F.string().min(1),project:F.string().optional(),field:F.enum(["full","defs","refs","path"]).default("full")}),TI=F.object({queries:F.array(F.object({query:F.string().min(1),search_type:F.enum(["full","defs","refs","path","hist"]).default("full"),max_results:F.number().int().min(1).max(25).default(5)})).min(1).max(5).describe("Search queries to execute in parallel"),projects:F.array(F.string()).optional(),file_type:F.string().optional().describe(vI)}),FI=F.object({query:F.string().min(1),search_type:F.enum(["full","defs","refs","path","hist"]).default("full"),projects:F.array(F.string()).optional(),context_lines:F.number().int().min(1).max(50).default(10).describe("Lines of context around each match"),max_results:F.number().int().min(1).max(10).default(3),file_type:F.string().optional().describe(vI)}),UI=F.object({symbol:F.string().min(1).describe("Symbol name (class, function, method, etc.)"),projects:F.array(F.string()).optional(),context_lines:F.number().int().min(5).max(50).default(20).describe("Lines of context around the definition"),max_refs:F.number().int().min(1).max(20).default(5),include_header:F.boolean().default(!0).describe("Also fetch corresponding .h/.hpp if a .cpp definition is found"),file_type:F.string().optional().describe(vI)}),MI=F.object({}),LI=F.object({path:F.string().min(1,"path must not be empty").describe("Source file path. Accepts absolute paths or OpenGrok-relative paths (e.g., GridNode/EventLoop.cpp).")}),$I=F.object({project:F.string().min(1).describe("OpenGrok project name"),path:F.string().min(1).describe("Path to the file within the project (e.g. GridNode/EventLoop.cpp)")});function wr(t){let e=FE(t,{target:"openApi3"});return delete e.$schema,delete e.additionalProperties,e}var Rq=[{name:"search_code",description:"Search OpenGrok. Types: full (text), defs (definitions), refs (references), path (filenames), hist (commit messages). Prefer defs/refs for known symbol names. Use batch_search for multiple queries.",inputSchema:wr(DI)},{name:"find_file",description:"Find files by name/path pattern across the codebase.",inputSchema:wr(wI)},{name:"get_file_content",description:"Get file contents. ALWAYS pass start_line/end_line \u2014 never fetch full files. Use search_code first to find line numbers. For full symbol context use get_symbol_context.",inputSchema:wr(SI)},{name:"get_file_history",description:"Commit history for a file.",inputSchema:wr(xI)},{name:"browse_directory",description:"List files/subdirectories at a path.",inputSchema:wr(kI)},{name:"list_projects",description:"List indexed OpenGrok projects.",inputSchema:wr(NI)},{name:"get_file_annotate",description:"Blame annotations (who changed each line). Use start_line/end_line to limit output.",inputSchema:wr(_I)},{name:"search_suggest",description:"Autocomplete suggestions for a partial query.",inputSchema:wr(RI)},{name:"batch_search",description:"Execute up to 5 searches in parallel in one call. Always prefer this over multiple search_code calls for the same investigation.",inputSchema:wr(TI)},{name:"search_and_read",description:"Search and return matching code with surrounding context in one call. Use instead of search_code + get_file_content. Never fetches full files.",inputSchema:wr(FI)},{name:"get_symbol_context",description:"Complete symbol investigation in one call: definition with context + corresponding header + references. Use this first for any unknown C++ symbol or function.",inputSchema:wr(UI)},{name:"index_health",description:"OpenGrok server connection status and diagnostics. Call if results seem stale or incomplete.",inputSchema:wr(MI)},{name:"get_compile_info",description:"Get compilation details for a source file: compiler, include paths, preprocessor defines, and language standard. Requires compile_commands.json to be present in the workspace.",inputSchema:wr(LI)},{name:"get_file_symbols",description:"List all symbols defined in a file: functions, classes, structs, macros with line numbers and signatures. Use this to understand a file's structure before reading it.",inputSchema:wr($I)}];var $S=parseInt(process.env.OPENGROK_MAX_RESPONSE_BYTES??"16384",10),s0e=parseInt(process.env.OPENGROK_SEARCH_AND_READ_CAP??"8192",10);function a0e(t){if(Buffer.byteLength(t,"utf8")<=$S)return t;let o=Buffer.from(t,"utf8").subarray(0,$S).toString("utf8"),n=o.lastIndexOf(`
227
227
  `);return(n>0?o.slice(0,n):o)+`
228
- [Response truncated at ${Math.round($S/1024)} KB. Narrow your query or use line ranges.]`}var Fq="3.3.3",u0e=`
228
+ [Response truncated at ${Math.round($S/1024)} KB. Narrow your query or use line ranges.]`}var Fq="3.3.5",u0e=`
229
229
  OpenGrok MCP server. Rules to maximise efficiency:
230
230
  - Use the configured default project unless the user specifies a different one.
231
231
  - Use get_symbol_context instead of separate search_code + get_file_content for symbol investigations.
@@ -241,7 +241,7 @@ OpenGrok MCP server. Rules to maximise efficiency:
241
241
  - list_projects: filter is a substring match (e.g. "release" matches all release-* projects).
242
242
  `.trim();function c0e(t){let e=t.OPENGROK_LOCAL_COMPILE_DB_PATHS.trim();if(!e)return{enabled:!1,roots:[],index:new Map,suffixIndex:new Map};let r=e.split(",").map(c=>c.trim()).filter(Boolean);if(!r.length)return{enabled:!1,roots:[],index:new Map,suffixIndex:new Map};let o=bI(r),n=_q(r,o),i;if(n)try{i=Tq.realpathSync(n)}catch{gt.warn(`Local layer: inferred build root not found locally: ${n}`)}let s=i?[i]:[];for(let c of kq(r))s.includes(c)||s.push(c);if(!s.length)return gt.warn("Local layer: no valid allowed roots \u2014 local layer disabled"),{enabled:!1,roots:[],index:new Map,suffixIndex:new Map};let a=Nq(r,s,o),u=new Map;for(let c of a.keys()){let l=c.replace(/\\/g,"/").split("/");for(let f=Math.max(0,l.length-4);f<l.length;f++){let d="/"+l.slice(f).join("/");u.has(d)||u.set(d,c)}}return gt.info(`Local layer enabled: ${a.size} compile entries from ${r.length} compile_commands.json`+(i?`, build root: ${i}`:"")),{enabled:!0,roots:s,index:a,suffixIndex:u}}async function A0e(t,e,r,o){let n=t.replace(/\\/g,"/").replace(/^\/+/,"");if(n.includes("../")||n.startsWith("../")||n.endsWith("/..")||n==="..")return null;for(let i of e){let s=jn.join(i,n),a;try{a=await $a.realpath(s)}catch{continue}if(!(!a.startsWith(i+jn.sep)&&a!==i))try{let u=await $a.readFile(a,"utf8"),{text:c,totalLines:A}=Ap(u,r,o);return{project:"local",path:n,content:c,lineCount:A,sizeBytes:Buffer.byteLength(c,"utf8"),startLine:r}}catch{continue}}return null}function l0e(t,e,r){if(!e.size)return null;if(e.has(t))return t;let n="/"+t.replace(/\\/g,"/").replace(/^\/+/,""),i=r.get(n);if(i)return i;for(let s of e.keys())if(s.replace(/\\/g,"/").endsWith(n))return s;return null}async function d0e(t,e,r){try{let o=await $a.readFile(t,"utf8"),{text:n,totalLines:i}=Ap(o,e,r);return{project:"local",path:jn.basename(t),content:n,lineCount:i,sizeBytes:Buffer.byteLength(n,"utf8"),startLine:e}}catch{return null}}function f0e(t,e){let r=new CI({name:"opengrok-mcp",version:Fq},{capabilities:{tools:{}},instructions:u0e}),o=c0e(e);return r.setRequestHandler(Nw,async()=>({tools:Rq})),r.setRequestHandler(tf,async n=>{let{name:i,arguments:s={}}=n.params;try{let a=await m0e(i,s,t,e,o);return{content:[{type:"text",text:a0e(a)}]}}catch(a){gt.error(`Tool "${i}" failed:`,a);let u;return a instanceof cD?u=`**Invalid arguments:** ${a.issues.map(A=>`${A.path.join(".")}: ${A.message}`).join("; ")}`:a instanceof Error?u=`**Error:** ${E0e(a.message)}`:u="**Error:** An unexpected error occurred. Check server logs.",{content:[{type:"text",text:u}]}}}),r}function Ff(t,e){if(t&&t.length>0)return t;let r=e.OPENGROK_DEFAULT_PROJECT?.trim();return r?[r]:t}async function g0e(t,e,r){let o=FI.parse(t),n=await e.search(o.query,o.search_type,Ff(o.projects,r),o.max_results,0,o.file_type),i=[],s=0;for(let a of n.results){if(!a.matches.length)continue;let u=a.matches[0],c=Math.max(1,u.lineNumber-o.context_lines),A=u.lineNumber+o.context_lines;try{let l=await e.getFileContent(a.project,a.path,c,A),f=a.path.includes(".")?a.path.split(".").pop()?.toLowerCase()??"":"",d=l.content;if(s+=Buffer.byteLength(d,"utf8"),i.push({project:a.project,path:a.path,matchLine:u.lineNumber,context:d,lang:f}),s>=s0e)break}catch{}}return vq(o.query,n.totalCount,i)}async function h0e(t,e,r){let o=UI.parse(t),n=Ff(o.projects,r),i=await e.search(o.symbol,"defs",n,3,0,o.file_type);if(!i.results.length||!i.results[0].matches.length){let y={found:!1,symbol:o.symbol,kind:"unknown",references:{totalFound:0,samples:[]}};return MS(y)}let s=i.results[0],a=s.matches[0],u=Math.max(1,a.lineNumber-o.context_lines),c=a.lineNumber+o.context_lines,A=s.path.includes(".")?s.path.split(".").pop()?.toLowerCase()??"":"",l=await e.getFileContent(s.project,s.path,u,c),f;try{let y=await e.getFileSymbols(s.project,s.path);y.symbols.length>0&&(f=y.symbols.map(I=>({symbol:I.symbol,type:I.type,line:I.lineStart??I.line})))}catch{}let d;if(o.include_header&&s.path.match(/\.(cpp|cc|cxx)$/i))try{let I=(await e.search(o.symbol,"defs",n,5,0,o.file_type)).results.find(D=>D.path.match(/\.(h|hpp|hxx)$/i));if(I&&I.matches.length){let D=I.matches[0].lineNumber,w=await e.getFileContent(I.project,I.path,Math.max(1,D-10),D+10),q=I.path.includes(".")?I.path.split(".").pop()?.toLowerCase()??"":"";d={project:I.project,path:I.path,context:w.content,lang:q}}}catch{}let g=await e.search(o.symbol,"refs",n,o.max_refs,0,o.file_type),h=g.results.flatMap(y=>y.matches.slice(0,2).map(I=>({path:y.path,project:y.project,lineNumber:I.lineNumber,content:I.lineContent}))),C=s.path.match(/\.(h|hpp|hxx)$/i)?"class/struct":"function/method",E={found:!0,symbol:o.symbol,kind:C,definition:{project:s.project,path:s.path,line:a.lineNumber,context:l.content,lang:A},header:d,references:{totalFound:g.totalCount,samples:h},fileSymbols:f};return MS(E)}async function p0e(t,e,r){let o=LI.parse(t);if(!r.enabled)return"Local layer is not enabled. Open a workspace containing compile_commands.json files to enable it automatically.";if(!r.index.size)return"Local layer is enabled but no compile entries were loaded. No compile_commands.json files found under the build root \u2014 build the project first.";let n=o.path,i;if(jn.isAbsolute(n))try{let s=await $a.realpath(n);i=r.index.get(s)}catch{}if(!i){let s=n.replace(/\\/g,"/").replace(/^\/+/,"");for(let a of r.roots)try{let u=await $a.realpath(jn.join(a,s));if(i=r.index.get(u),i)break}catch{}}if(!i){let s=jn.basename(n);for(let[a,u]of r.index)if(jn.basename(a)===s){i=u;break}}return wq(i??null,n)}async function m0e(t,e,r,o,n){switch(t){case"search_code":{let i=DI.parse(e),s=await r.search(i.query,i.search_type,Ff(i.projects,o),i.max_results,i.start_index,i.file_type);return US(s)}case"find_file":{let i=wI.parse(e),s=await r.search(i.path_pattern,"path",Ff(i.projects,o),i.max_results,i.start_index);return US(s)}case"get_file_content":{let i=SI.parse(e);if(n.enabled&&n.index.size>0){let a=l0e(i.path,n.index,n.suffixIndex);if(a){let u=await d0e(a,i.start_line,i.end_line);if(u)return QI(u)}}if(n.enabled&&n.roots.length>0){let a=await A0e(i.path,n.roots,i.start_line,i.end_line);if(a)return QI(a)}let s=await r.getFileContent(i.project,i.path,i.start_line,i.end_line);return QI(s)}case"get_file_history":{let i=xI.parse(e),s=await r.getFileHistory(i.project,i.path,i.max_entries);return yq(s)}case"browse_directory":{let i=kI.parse(e),s=await r.browseDirectory(i.project,i.path);return Bq(s,i.project,i.path)}case"list_projects":{let i=NI.parse(e),s=await r.listProjects(i.filter);return Qq(s)}case"get_file_annotate":{let i=_I.parse(e),s=await r.getAnnotate(i.project,i.path);return bq(s,i.start_line,i.end_line)}case"search_suggest":{let i=RI.parse(e),s=await r.suggest(i.query,i.project,i.field);return s.suggestions.length?`Suggestions:
243
243
  `+s.suggestions.map(a=>` ${a}`).join(`
244
- `):s.time===0?"No suggestions found. The suggester index appears to be empty \u2014 an OpenGrok admin may need to rebuild it.":"No suggestions found."}case"batch_search":{let i=TI.parse(e),s=Ff(i.projects,o),a=await Promise.all(i.queries.map(c=>r.search(c.query,c.search_type,s,c.max_results,0,i.file_type))),u=i.queries.map((c,A)=>({query:c.query,searchType:c.search_type,results:a[A]}));return Dq(u)}case"search_and_read":return g0e(e,r,o);case"get_symbol_context":return h0e(e,r,o);case"index_health":{MI.parse(e);let i=Date.now(),s=await r.testConnection(),a=Date.now()-i;return s?`OpenGrok: connected (${a}ms latency)`:"OpenGrok: connection failed"}case"get_compile_info":return p0e(e,o,n);case"get_file_symbols":{let i=$I.parse(e),s=await r.getFileSymbols(i.project,i.path);return s.symbols.length?Sq(s):`No symbols found for ${i.path} in project ${i.project}. The file may not be indexed or the OpenGrok instance does not support the /api/v1/file/defs endpoint.`}default:return`**Error:** Unknown tool: "${t}"`}}async function Uq(t,e){let r=f0e(t,e),o=new BI,n=async i=>{gt.info(`Received ${i}, shutting down...`),await t.close(),process.exit(0)};process.on("SIGINT",()=>n("SIGINT")),process.on("SIGTERM",()=>n("SIGTERM")),gt.info(`Starting server v${Fq}, connected to: ${e.OPENGROK_BASE_URL}`),e.OPENGROK_USERNAME||gt.warn("OPENGROK_USERNAME not configured. Set OPENGROK_USERNAME and OPENGROK_PASSWORD environment variables."),await r.connect(o)}function E0e(t){let e=t.replace(/Basic\s+[A-Za-z0-9+/=]+/gi,"Basic [REDACTED]");return e=e.replace(/:[^:@\s]+@/g,":***@"),e=e.replace(/\/(?:home|tmp|var|usr|build|opt|mnt|srv)(?:\/\S+)/g,"[path]"),e=e.replace(/[A-Z]:\\(?:Users|Windows|Program Files|build)(?:\\\S+)/gi,"[path]"),e}(process.argv.includes("--version")||process.argv.includes("-v"))&&(console.log("3.3.3"),process.exit(0));async function I0e(){let t=DO(),e=new cp(t);await Uq(e,t)}I0e().catch(t=>{gt.error("Fatal error:",t),process.exit(1)});
244
+ `):s.time===0?"No suggestions found. The suggester index appears to be empty \u2014 an OpenGrok admin may need to rebuild it.":"No suggestions found."}case"batch_search":{let i=TI.parse(e),s=Ff(i.projects,o),a=await Promise.all(i.queries.map(c=>r.search(c.query,c.search_type,s,c.max_results,0,i.file_type))),u=i.queries.map((c,A)=>({query:c.query,searchType:c.search_type,results:a[A]}));return Dq(u)}case"search_and_read":return g0e(e,r,o);case"get_symbol_context":return h0e(e,r,o);case"index_health":{MI.parse(e);let i=Date.now(),s=await r.testConnection(),a=Date.now()-i;return s?`OpenGrok: connected (${a}ms latency)`:"OpenGrok: connection failed"}case"get_compile_info":return p0e(e,o,n);case"get_file_symbols":{let i=$I.parse(e),s=await r.getFileSymbols(i.project,i.path);return s.symbols.length?Sq(s):`No symbols found for ${i.path} in project ${i.project}. The file may not be indexed or the OpenGrok instance does not support the /api/v1/file/defs endpoint.`}default:return`**Error:** Unknown tool: "${t}"`}}async function Uq(t,e){let r=f0e(t,e),o=new BI,n=async i=>{gt.info(`Received ${i}, shutting down...`),await t.close(),process.exit(0)};process.on("SIGINT",()=>n("SIGINT")),process.on("SIGTERM",()=>n("SIGTERM")),gt.info(`Starting server v${Fq}, connected to: ${e.OPENGROK_BASE_URL}`),e.OPENGROK_USERNAME||gt.warn("OPENGROK_USERNAME not configured. Set OPENGROK_USERNAME and OPENGROK_PASSWORD environment variables."),await r.connect(o)}function E0e(t){let e=t.replace(/Basic\s+[A-Za-z0-9+/=]+/gi,"Basic [REDACTED]");return e=e.replace(/:[^:@\s]+@/g,":***@"),e=e.replace(/\/(?:home|tmp|var|usr|build|opt|mnt|srv)(?:\/\S+)/g,"[path]"),e=e.replace(/[A-Z]:\\(?:Users|Windows|Program Files|build)(?:\\\S+)/gi,"[path]"),e}(process.argv.includes("--version")||process.argv.includes("-v"))&&(console.log("3.3.5"),process.exit(0));async function I0e(){let t=DO(),e=new cp(t);await Uq(e,t)}I0e().catch(t=>{gt.error("Fatal error:",t),process.exit(1)});
245
245
  /*! Bundled license information:
246
246
 
247
247
  undici/lib/web/fetch/body.js:
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "opengrok-mcp-server",
3
- "displayName": "OpenGrok Code Search for Copilot",
4
- "description": "Search your OpenGrok code index directly from GitHub Copilot Chat",
5
- "version": "3.3.3",
3
+ "displayName": "OpenGrok MCP Server",
4
+ "description": "MCP server bridging OpenGrok search engines with AI for deep, instant context across massive codebases",
5
+ "version": "3.3.5",
6
+ "mcpName": "io.github.IcyHot09/opengrok",
6
7
  "license": "PolyForm-Noncommercial-1.0.0",
7
8
  "publisher": "IcyHot09",
8
9
  "author": "Rudra Roy",
@@ -19,7 +19,7 @@ if (!ver) {
19
19
 
20
20
  const ROOT = path.resolve(__dirname, '..');
21
21
  const log = fs.readFileSync(path.join(ROOT, 'CHANGELOG.md'), 'utf8').replace(/\r\n/g, '\n');
22
- const base = 'https://github.com/Rud09/opengrok-mcp-server';
22
+ const base = 'https://github.com/IcyHot09/opengrok-mcp-server';
23
23
 
24
24
  const start = log.indexOf('## [' + ver + ']');
25
25
  if (start === -1) {
@@ -92,6 +92,18 @@ if ($Dry) {
92
92
  Write-Success "VSIX packaged: opengrok-mcp-$newVersion.vsix"
93
93
  }
94
94
 
95
+ # Sync server.json version
96
+ Write-Step "Syncing server.json version..."
97
+ if ($Dry) {
98
+ Write-Host "[DRY RUN] Would update server.json version to $newVersion" -ForegroundColor Yellow
99
+ } else {
100
+ $serverJson = Get-Content "server.json" -Raw | ConvertFrom-Json
101
+ $serverJson.version = $newVersion
102
+ $serverJson.packages[0].version = $newVersion
103
+ $serverJson | ConvertTo-Json -Depth 10 | Set-Content "server.json" -Encoding UTF8
104
+ Write-Success "server.json updated to $newVersion"
105
+ }
106
+
95
107
  # Git commit and tag
96
108
  Write-Step "Creating Git commit and tag..."
97
109
  if ($Dry) {
@@ -100,7 +112,7 @@ if ($Dry) {
100
112
  Write-Host " git commit -m 'chore: release v$newVersion'" -ForegroundColor Yellow
101
113
  Write-Host " git tag v$newVersion" -ForegroundColor Yellow
102
114
  } else {
103
- git add package.json CHANGELOG.md
115
+ git add package.json CHANGELOG.md server.json
104
116
  git commit -m "chore: release v$newVersion"
105
117
  git tag "v$newVersion"
106
118
  Write-Success "Created commit and tag v$newVersion"
package/server.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.IcyHot09/opengrok",
4
+ "description": "MCP server bridging OpenGrok search engines with AI for deep, instant context across massive codebases.",
5
+ "repository": {
6
+ "url": "https://github.com/IcyHot09/opengrok-mcp-server",
7
+ "source": "github"
8
+ },
9
+ "version": "3.3.5",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "opengrok-mcp-server",
14
+ "version": "3.3.5",
15
+ "transport": {
16
+ "type": "stdio"
17
+ }
18
+ }
19
+ ]
20
+ }