@opensumi/cli-engine 3.8.1-next-1741331921.0 → 3.8.1

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.
@@ -30157,9 +30157,19 @@ and limitations under the License.
30157
30157
  `)[0];let l,y=g.match(QUERY_WORD_REGEX)[0];switch(u){case 2:l=new RangeError(`Bad node name '${y}'`);break;case 3:l=new RangeError(`Bad field name '${y}'`);break;case 4:l=new RangeError(`Bad capture name @${y}`);break;case 5:l=new TypeError(`Bad pattern structure at offset ${E}: '${g}'...`),y="";break;default:l=new SyntaxError(`Bad syntax at offset ${E}: '${g}'...`),y=""}throw l.index=E,l.length=y.length,C._free(n),l}const o=C._ts_query_string_count(r),c=C._ts_query_capture_count(r),p=C._ts_query_pattern_count(r),v=new Array(c),m=new Array(o);for(let u=0;u<c;u++){const d=C._ts_query_capture_name_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");v[u]=UTF8ToString(d,E)}for(let u=0;u<o;u++){const d=C._ts_query_string_value_for_id(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");m[u]=UTF8ToString(d,E)}const _=new Array(p),s=new Array(p),f=new Array(p),a=new Array(p),h=new Array(p);for(let u=0;u<p;u++){const d=C._ts_query_predicates_for_pattern(r,u,TRANSFER_BUFFER),E=getValue(TRANSFER_BUFFER,"i32");a[u]=[],h[u]=[];const g=[];let l=d;for(let y=0;y<E;y++){const b=getValue(l,"i32");l+=SIZE_OF_INT;const S=getValue(l,"i32");if(l+=SIZE_OF_INT,b===PREDICATE_STEP_TYPE_CAPTURE)g.push({type:"capture",name:v[S]});else if(b===PREDICATE_STEP_TYPE_STRING)g.push({type:"string",value:m[S]});else if(g.length>0){if(g[0].type!=="string")throw new Error("Predicates must begin with a literal value");const A=g[0].value;let w,T=!0,D=!0;switch(A){case"any-not-eq?":case"not-eq?":T=!1;case"any-eq?":case"eq?":if(g.length!==3)throw new Error(`Wrong number of arguments to \`#${A}\` predicate. Expected 2, got ${g.length-1}`);if(g[1].type!=="capture")throw new Error(`First argument of \`#${A}\` predicate must be a capture. Got "${g[1].value}"`);if(D=!A.startsWith("any-"),g[2].type==="capture"){const R=g[1].name,P=g[2].name;h[u].push(k=>{const F=[],L=[];for(const j of k)j.name===R&&F.push(j.node),j.name===P&&L.push(j.node);const N=(j,W,U)=>U?j.text===W.text:j.text!==W.text;return D?F.every(j=>L.some(W=>N(j,W,T))):F.some(j=>L.some(W=>N(j,W,T)))})}else{w=g[1].name;const R=g[2].value,P=F=>F.text===R,k=F=>F.text!==R;h[u].push(F=>{const L=[];for(const j of F)j.name===w&&L.push(j.node);const N=T?P:k;return D?L.every(N):L.some(N)})}break;case"any-not-match?":case"not-match?":T=!1;case"any-match?":case"match?":if(g.length!==3)throw new Error(`Wrong number of arguments to \`#${A}\` predicate. Expected 2, got ${g.length-1}.`);if(g[1].type!=="capture")throw new Error(`First argument of \`#${A}\` predicate must be a capture. Got "${g[1].value}".`);if(g[2].type!=="string")throw new Error(`Second argument of \`#${A}\` predicate must be a string. Got @${g[2].value}.`);w=g[1].name;const I=new RegExp(g[2].value);D=!A.startsWith("any-"),h[u].push(R=>{const P=[];for(const F of R)F.name===w&&P.push(F.node.text);const k=(F,L)=>L?I.test(F):!I.test(F);return P.length===0?!T:D?P.every(F=>k(F,T)):P.some(F=>k(F,T))});break;case"set!":if(g.length<2||g.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${g.length-1}.`);if(g.some(R=>R.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');_[u]||(_[u]={}),_[u][g[1].value]=g[2]?g[2].value:null;break;case"is?":case"is-not?":if(g.length<2||g.length>3)throw new Error(`Wrong number of arguments to \`#${A}\` predicate. Expected 1 or 2. Got ${g.length-1}.`);if(g.some(R=>R.type!=="string"))throw new Error(`Arguments to \`#${A}\` predicate must be a strings.".`);const O=A==="is?"?s:f;O[u]||(O[u]={}),O[u][g[1].value]=g[2]?g[2].value:null;break;case"not-any-of?":T=!1;case"any-of?":if(g.length<2)throw new Error(`Wrong number of arguments to \`#${A}\` predicate. Expected at least 1. Got ${g.length-1}.`);if(g[1].type!=="capture")throw new Error(`First argument of \`#${A}\` predicate must be a capture. Got "${g[1].value}".`);for(let R=2;R<g.length;R++)if(g[R].type!=="string")throw new Error(`Arguments to \`#${A}\` predicate must be a strings.".`);w=g[1].name;const M=g.slice(2).map(R=>R.value);h[u].push(R=>{const P=[];for(const k of R)k.name===w&&P.push(k.node.text);return P.length===0?!T:P.every(k=>M.includes(k))===T});break;default:a[u].push({operator:A,operands:g.slice(1)})}g.length=0}}Object.freeze(_[u]),Object.freeze(s[u]),Object.freeze(f[u])}return C._free(n),new Query(INTERNAL,r,v,h,a,Object.freeze(_),Object.freeze(s),Object.freeze(f))}static load(t){let e;if(t instanceof Uint8Array)e=Promise.resolve(t);else{const n=t;if(typeof process<"u"&&process.versions&&process.versions.node){const r=__webpack_require__(83078);e=Promise.resolve(r.readFileSync(n))}else e=fetch(n).then(r=>r.arrayBuffer().then(o=>{if(r.ok)return new Uint8Array(o);{const c=new TextDecoder("utf-8").decode(o);throw new Error(`Language.load failed with status ${r.status}.
30158
30158
 
30159
30159
  ${c}`)}}))}return e.then(n=>loadWebAssemblyModule(n,{loadAsync:!0})).then(n=>{const r=Object.keys(n),o=r.find(p=>LANGUAGE_FUNCTION_REGEX.test(p)&&!p.includes("external_scanner_"));o||console.log(`Couldn't find language function in WASM file. Symbols:
30160
- ${JSON.stringify(r,null,2)}`);const c=n[o]();return new Language(INTERNAL,c)})}}class LookaheadIterable{constructor(t,e,n){assertInternal(t),this[0]=e,this.language=n}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(t){return C._ts_lookahead_iterator_reset_state(this[0],t)}reset(t,e){return!!C._ts_lookahead_iterator_reset(this[0],t[0],e)&&(this.language=t,!0)}[Symbol.iterator](){const t=this;return{next:()=>C._ts_lookahead_iterator_next(t[0])?{done:!1,value:t.currentType}:{done:!0,value:""}}}}class Query{constructor(t,e,n,r,o,c,p,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=c,this.assertedProperties=p,this.refutedProperties=v,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:c=4294967295,maxStartDepth:p=4294967295}={}){if(typeof c!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,c,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!_;let f=0,a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const d=getValue(a,"i32");a+=SIZE_OF_INT;const E=new Array(d);if(a=unmarshalCaptures(this,t.tree,a,E),this.textPredicates[u].every(g=>g(E))){s[f]={pattern:u,captures:E};const g=this.setProperties[u];g&&(s[f].setProperties=g);const l=this.assertedProperties[u];l&&(s[f].assertedProperties=l);const y=this.refutedProperties[u];y&&(s[f].refutedProperties=y),f++}}return s.length=f,C._free(m),s}captures(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:c=4294967295,maxStartDepth:p=4294967295}={}){if(typeof c!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,c,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!_;const f=[];let a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const d=getValue(a,"i32");a+=SIZE_OF_INT;const E=getValue(a,"i32");if(a+=SIZE_OF_INT,f.length=d,a=unmarshalCaptures(this,t.tree,a,f),this.textPredicates[u].every(g=>g(f))){const g=f[E],l=this.setProperties[u];l&&(g.setProperties=l);const y=this.assertedProperties[u];y&&(g.assertedProperties=y);const b=this.refutedProperties[u];b&&(g.refutedProperties=b),s.push(g)}}return C._free(m),s}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){const e=lengthBytesUTF8(t),n=C._malloc(e+1);stringToUTF8(t,n,e+1),C._ts_query_disable_capture(this[0],n,e),C._free(n)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(x,t,e){const n=e-t;let r=x.textCallback(t,null,e);for(t+=r.length;t<e;){const o=x.textCallback(t,null,e);if(!(o&&o.length>0))break;t+=o.length,r+=o}return t>e&&(r=r.slice(0,n)),r}function unmarshalCaptures(x,t,e,n){for(let r=0,o=n.length;r<o;r++){const c=getValue(e,"i32"),p=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[c],node:p}}return e}function assertInternal(x){if(x!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(x){return x&&typeof x.row=="number"&&typeof x.column=="number"}function marshalNode(x){let t=TRANSFER_BUFFER;setValue(t,x.id,"i32"),t+=SIZE_OF_INT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.row,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.column,"i32"),t+=SIZE_OF_INT,setValue(t,x[0],"i32")}function unmarshalNode(x,t=TRANSFER_BUFFER){const e=getValue(t,"i32");if(e===0)return null;const n=getValue(t+=SIZE_OF_INT,"i32"),r=getValue(t+=SIZE_OF_INT,"i32"),o=getValue(t+=SIZE_OF_INT,"i32"),c=getValue(t+=SIZE_OF_INT,"i32"),p=new Node(INTERNAL,x);return p.id=e,p.startIndex=n,p.startPosition={row:r,column:o},p[0]=c,p}function marshalTreeCursor(x,t=TRANSFER_BUFFER){setValue(t+0*SIZE_OF_INT,x[0],"i32"),setValue(t+1*SIZE_OF_INT,x[1],"i32"),setValue(t+2*SIZE_OF_INT,x[2],"i32"),setValue(t+3*SIZE_OF_INT,x[3],"i32")}function unmarshalTreeCursor(x){x[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),x[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),x[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),x[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(x,t){setValue(x,t.row,"i32"),setValue(x+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(x){return{row:getValue(x,"i32")>>>0,column:getValue(x+SIZE_OF_INT,"i32")>>>0}}function marshalRange(x,t){marshalPoint(x,t.startPosition),marshalPoint(x+=SIZE_OF_POINT,t.endPosition),setValue(x+=SIZE_OF_POINT,t.startIndex,"i32"),setValue(x+=SIZE_OF_INT,t.endIndex,"i32"),x+=SIZE_OF_INT}function unmarshalRange(x){const t={};return t.startPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.startIndex=getValue(x,"i32")>>>0,x+=SIZE_OF_INT,t.endIndex=getValue(x,"i32")>>>0,t}function marshalEdit(x){let t=TRANSFER_BUFFER;marshalPoint(t,x.startPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.oldEndPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.newEndPosition),t+=SIZE_OF_POINT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.oldEndIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.newEndIndex,"i32"),t+=SIZE_OF_INT}for(const x of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,x,{value:ParserImpl.prototype[x],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();module.exports=TreeSitter},52730:(x,t,e)=>{"use strict";var n=e(80705),r=e(14834),o=e(28498),c=e(79818),p=e(69336),v=c("Object.prototype.toString"),m=e(51913)(),_=typeof globalThis>"u"?e.g:globalThis,s=r(),f=c("String.prototype.slice"),a=Object.getPrototypeOf,h=c("Array.prototype.indexOf",!0)||function(l,y){for(var b=0;b<l.length;b+=1)if(l[b]===y)return b;return-1},u={__proto__:null};m&&p&&a?n(s,function(g){var l=new _[g];if(Symbol.toStringTag in l){var y=a(l),b=p(y,Symbol.toStringTag);if(!b){var S=a(y);b=p(S,Symbol.toStringTag)}u["$"+g]=o(b.get)}}):n(s,function(g){var l=new _[g],y=l.slice||l.set;y&&(u["$"+g]=o(y))});var d=function(l){var y=!1;return n(u,function(b,S){if(!y)try{"$"+b(l)===S&&(y=f(S,1))}catch{}}),y},E=function(l){var y=!1;return n(u,function(b,S){if(!y)try{b(l),y=f(S,1)}catch{}}),y};x.exports=function(l){if(!l||typeof l!="object")return!1;if(!m){var y=f(v(l),8,-1);return h(s,y)>-1?y:y!=="Object"?!1:E(l)}return p?d(l):null}},97442:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const n=e(94705);t.ZodIssueCode=n.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);const r=c=>JSON.stringify(c,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(p){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const v=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,v):this.__proto__=v,this.name="ZodError",this.issues=p}format(p){const v=p||function(s){return s.message},m={_errors:[]},_=s=>{for(const f of s.issues)if(f.code==="invalid_union")f.unionErrors.map(_);else if(f.code==="invalid_return_type")_(f.returnTypeError);else if(f.code==="invalid_arguments")_(f.argumentsError);else if(f.path.length===0)m._errors.push(v(f));else{let a=m,h=0;for(;h<f.path.length;){const u=f.path[h];h===f.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(v(f))):a[u]=a[u]||{_errors:[]},a=a[u],h++}}};return _(this),m}static assert(p){if(!(p instanceof o))throw new Error(`Not a ZodError: ${p}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(p=v=>v.message){const v={},m=[];for(const _ of this.issues)_.path.length>0?(v[_.path[0]]=v[_.path[0]]||[],v[_.path[0]].push(p(_))):m.push(p(_));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=c=>new o(c)},30548:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const r=n(e(28412));t.defaultErrorMap=r.default;let o=r.default;function c(v){o=v}t.setErrorMap=c;function p(){return o}t.getErrorMap=p},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,c,p,v){v===void 0&&(v=p);var m=Object.getOwnPropertyDescriptor(c,p);(!m||("get"in m?!c.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return c[p]}}),Object.defineProperty(o,v,m)}:function(o,c,p,v){v===void 0&&(v=p),o[v]=c[p]}),r=this&&this.__exportStar||function(o,c){for(var p in o)p!=="default"&&!Object.prototype.hasOwnProperty.call(c,p)&&n(c,o,p)};Object.defineProperty(t,"__esModule",{value:!0}),r(e(30548),t),r(e(66258),t),r(e(29201),t),r(e(94705),t),r(e(75226),t),r(e(97442),t)},15759:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0;var e;(function(n){n.errToObj=r=>typeof r=="string"?{message:r}:r||{},n.toString=r=>typeof r=="string"?r:r?.message})(e||(t.errorUtil=e={}))},66258:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const r=e(30548),o=n(e(28412)),c=u=>{const{data:d,path:E,errorMaps:g,issueData:l}=u,y=[...E,...l.path||[]],b={...l,path:y};if(l.message!==void 0)return{...l,path:y,message:l.message};let S="";const A=g.filter(w=>!!w).slice().reverse();for(const w of A)S=w(b,{data:d,defaultError:S}).message;return{...l,path:y,message:S}};t.makeIssue=c,t.EMPTY_PATH=[];function p(u,d){const E=(0,r.getErrorMap)(),g=(0,t.makeIssue)({issueData:d,data:u.data,path:u.path,errorMaps:[u.common.contextualErrorMap,u.schemaErrorMap,E,E===o.default?void 0:o.default].filter(l=>!!l)});u.common.issues.push(g)}t.addIssueToContext=p;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(d,E){const g=[];for(const l of E){if(l.status==="aborted")return t.INVALID;l.status==="dirty"&&d.dirty(),g.push(l.value)}return{status:d.value,value:g}}static async mergeObjectAsync(d,E){const g=[];for(const l of E){const y=await l.key,b=await l.value;g.push({key:y,value:b})}return v.mergeObjectSync(d,g)}static mergeObjectSync(d,E){const g={};for(const l of E){const{key:y,value:b}=l;if(y.status==="aborted"||b.status==="aborted")return t.INVALID;y.status==="dirty"&&d.dirty(),b.status==="dirty"&&d.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||l.alwaysSet)&&(g[y.value]=b.value)}return{status:d.value,value:g}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const _=u=>({status:"valid",value:u});t.OK=_;const s=u=>u.status==="aborted";t.isAborted=s;const f=u=>u.status==="dirty";t.isDirty=f;const a=u=>u.status==="valid";t.isValid=a;const h=u=>typeof Promise<"u"&&u instanceof Promise;t.isAsync=h},29201:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},94705:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var e;(function(o){o.assertEqual=m=>m;function c(m){}o.assertIs=c;function p(m){throw new Error}o.assertNever=p,o.arrayToEnum=m=>{const _={};for(const s of m)_[s]=s;return _},o.getValidEnumValues=m=>{const _=o.objectKeys(m).filter(f=>typeof m[m[f]]!="number"),s={};for(const f of _)s[f]=m[f];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(_){return m[_]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const _=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&_.push(s);return _},o.find=(m,_)=>{for(const s of m)if(_(s))return s},o.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function v(m,_=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(_)}o.joinValues=v,o.jsonStringifyReplacer=(m,_)=>typeof _=="bigint"?_.toString():_})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(c,p)=>({...c,...p})})(n||(t.objectUtil=n={})),t.ZodParsedType=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=o=>{switch(typeof o){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(o)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(o)?t.ZodParsedType.array:o===null?t.ZodParsedType.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?t.ZodParsedType.promise:typeof Map<"u"&&o instanceof Map?t.ZodParsedType.map:typeof Set<"u"&&o instanceof Set?t.ZodParsedType.set:typeof Date<"u"&&o instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=r},75995:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(v,m,_,s){s===void 0&&(s=_);var f=Object.getOwnPropertyDescriptor(m,_);(!f||("get"in f?!m.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(v,s,f)}:function(v,m,_,s){s===void 0&&(s=_),v[s]=m[_]}),r=this&&this.__setModuleDefault||(Object.create?function(v,m){Object.defineProperty(v,"default",{enumerable:!0,value:m})}:function(v,m){v.default=m}),o=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var m={};if(v!=null)for(var _ in v)_!=="default"&&Object.prototype.hasOwnProperty.call(v,_)&&n(m,v,_);return r(m,v),m},c=this&&this.__exportStar||function(v,m){for(var _ in v)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&n(m,v,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const p=o(e(86340));t.z=p,c(e(86340),t),t.default=p},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(c,p)=>{let v;switch(c.code){case r.ZodIssueCode.invalid_type:c.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${c.expected}, received ${c.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(c.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(c.keys,", ")}`;break;case r.ZodIssueCode.invalid_union:v="Invalid input";break;case r.ZodIssueCode.invalid_union_discriminator:v=`Invalid discriminator value. Expected ${n.util.joinValues(c.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(c.options)}, received '${c.received}'`;break;case r.ZodIssueCode.invalid_arguments:v="Invalid function arguments";break;case r.ZodIssueCode.invalid_return_type:v="Invalid function return type";break;case r.ZodIssueCode.invalid_date:v="Invalid date";break;case r.ZodIssueCode.invalid_string:typeof c.validation=="object"?"includes"in c.validation?(v=`Invalid input: must include "${c.validation.includes}"`,typeof c.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${c.validation.position}`)):"startsWith"in c.validation?v=`Invalid input: must start with "${c.validation.startsWith}"`:"endsWith"in c.validation?v=`Invalid input: must end with "${c.validation.endsWith}"`:n.util.assertNever(c.validation):c.validation!=="regex"?v=`Invalid ${c.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:c.type==="array"?v=`Array must contain ${c.exact?"exactly":c.inclusive?"at least":"more than"} ${c.minimum} element(s)`:c.type==="string"?v=`String must contain ${c.exact?"exactly":c.inclusive?"at least":"over"} ${c.minimum} character(s)`:c.type==="number"?v=`Number must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${c.minimum}`:c.type==="date"?v=`Date must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(c.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:c.type==="array"?v=`Array must contain ${c.exact?"exactly":c.inclusive?"at most":"less than"} ${c.maximum} element(s)`:c.type==="string"?v=`String must contain ${c.exact?"exactly":c.inclusive?"at most":"under"} ${c.maximum} character(s)`:c.type==="number"?v=`Number must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="bigint"?v=`BigInt must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="date"?v=`Date must be ${c.exact?"exactly":c.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(c.maximum))}`:v="Invalid input";break;case r.ZodIssueCode.custom:v="Invalid input";break;case r.ZodIssueCode.invalid_intersection_types:v="Intersection results could not be merged";break;case r.ZodIssueCode.not_multiple_of:v=`Number must be a multiple of ${c.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=p.defaultError,n.util.assertNever(c)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(ln,at,Ht,on){if(Ht==="a"&&!on)throw new TypeError("Private accessor was defined without a getter");if(typeof at=="function"?ln!==at||!on:!at.has(ln))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Ht==="m"?on:Ht==="a"?on.call(ln):on?on.value:at.get(ln)},r=this&&this.__classPrivateFieldSet||function(ln,at,Ht,on,xn){if(on==="m")throw new TypeError("Private method is not writable");if(on==="a"&&!xn)throw new TypeError("Private accessor was defined without a setter");if(typeof at=="function"?ln!==at||!xn:!at.has(ln))throw new TypeError("Cannot write private member to an object whose class did not declare it");return on==="a"?xn.call(ln,Ht):xn?xn.value=Ht:at.set(ln,Ht),Ht},o,c;Object.defineProperty(t,"__esModule",{value:!0}),t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodReadonly=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.datetimeRegex=t.ZodType=void 0,t.NEVER=t.void=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t.null=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t.instanceof=t.function=t.enum=t.effect=t.discriminatedUnion=t.date=void 0;const p=e(30548),v=e(15759),m=e(66258),_=e(94705),s=e(97442);class f{constructor(at,Ht,on,xn){this._cachedPath=[],this.parent=at,this.data=Ht,this._path=on,this._key=xn}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const a=(ln,at)=>{if((0,m.isValid)(at))return{success:!0,data:at.value};if(!ln.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const Ht=new s.ZodError(ln.common.issues);return this._error=Ht,this._error}}};function h(ln){if(!ln)return{};const{errorMap:at,invalid_type_error:Ht,required_error:on,description:xn}=ln;if(at&&(Ht||on))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return at?{errorMap:at,description:xn}:{errorMap:(Gi,Fi)=>{var oo,Mi;const{message:no}=ln;return Gi.code==="invalid_enum_value"?{message:no??Fi.defaultError}:typeof Fi.data>"u"?{message:(oo=no??on)!==null&&oo!==void 0?oo:Fi.defaultError}:Gi.code!=="invalid_type"?{message:Fi.defaultError}:{message:(Mi=no??Ht)!==null&&Mi!==void 0?Mi:Fi.defaultError}},description:xn}}class u{get description(){return this._def.description}_getType(at){return(0,_.getParsedType)(at.data)}_getOrReturnCtx(at,Ht){return Ht||{common:at.parent.common,data:at.data,parsedType:(0,_.getParsedType)(at.data),schemaErrorMap:this._def.errorMap,path:at.path,parent:at.parent}}_processInputParams(at){return{status:new m.ParseStatus,ctx:{common:at.parent.common,data:at.data,parsedType:(0,_.getParsedType)(at.data),schemaErrorMap:this._def.errorMap,path:at.path,parent:at.parent}}}_parseSync(at){const Ht=this._parse(at);if((0,m.isAsync)(Ht))throw new Error("Synchronous parse encountered promise.");return Ht}_parseAsync(at){const Ht=this._parse(at);return Promise.resolve(Ht)}parse(at,Ht){const on=this.safeParse(at,Ht);if(on.success)return on.data;throw on.error}safeParse(at,Ht){var on;const xn={common:{issues:[],async:(on=Ht?.async)!==null&&on!==void 0?on:!1,contextualErrorMap:Ht?.errorMap},path:Ht?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)},Zn=this._parseSync({data:at,path:xn.path,parent:xn});return a(xn,Zn)}"~validate"(at){var Ht,on;const xn={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)};if(!this["~standard"].async)try{const Zn=this._parseSync({data:at,path:[],parent:xn});return(0,m.isValid)(Zn)?{value:Zn.value}:{issues:xn.common.issues}}catch(Zn){!((on=(Ht=Zn?.message)===null||Ht===void 0?void 0:Ht.toLowerCase())===null||on===void 0)&&on.includes("encountered")&&(this["~standard"].async=!0),xn.common={issues:[],async:!0}}return this._parseAsync({data:at,path:[],parent:xn}).then(Zn=>(0,m.isValid)(Zn)?{value:Zn.value}:{issues:xn.common.issues})}async parseAsync(at,Ht){const on=await this.safeParseAsync(at,Ht);if(on.success)return on.data;throw on.error}async safeParseAsync(at,Ht){const on={common:{issues:[],contextualErrorMap:Ht?.errorMap,async:!0},path:Ht?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)},xn=this._parse({data:at,path:on.path,parent:on}),Zn=await((0,m.isAsync)(xn)?xn:Promise.resolve(xn));return a(on,Zn)}refine(at,Ht){const on=xn=>typeof Ht=="string"||typeof Ht>"u"?{message:Ht}:typeof Ht=="function"?Ht(xn):Ht;return this._refinement((xn,Zn)=>{const Gi=at(xn),Fi=()=>Zn.addIssue({code:s.ZodIssueCode.custom,...on(xn)});return typeof Promise<"u"&&Gi instanceof Promise?Gi.then(oo=>oo?!0:(Fi(),!1)):Gi?!0:(Fi(),!1)})}refinement(at,Ht){return this._refinement((on,xn)=>at(on)?!0:(xn.addIssue(typeof Ht=="function"?Ht(on,xn):Ht),!1))}_refinement(at){return new $e({schema:this,typeName:bt.ZodEffects,effect:{type:"refinement",refinement:at}})}superRefine(at){return this._refinement(at)}constructor(at){this.spa=this.safeParseAsync,this._def=at,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:Ht=>this["~validate"](Ht)}}optional(){return Ve.create(this,this._def)}nullable(){return lt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this)}promise(){return Ue.create(this,this._def)}or(at){return fe.create([this,at],this._def)}and(at){return Se.create(this,at,this._def)}transform(at){return new $e({...h(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:at}})}default(at){const Ht=typeof at=="function"?at:()=>at;return new qe({...h(this._def),innerType:this,defaultValue:Ht,typeName:bt.ZodDefault})}brand(){return new St({typeName:bt.ZodBranded,type:this,...h(this._def)})}catch(at){const Ht=typeof at=="function"?at:()=>at;return new Rt({...h(this._def),innerType:this,catchValue:Ht,typeName:bt.ZodCatch})}describe(at){const Ht=this.constructor;return new Ht({...this._def,description:at})}pipe(at){return it.create(this,at)}readonly(){return st.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}t.ZodType=u,t.Schema=u,t.ZodSchema=u;const d=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,g=/^[0-9A-HJKMNP-TV-Z]{26}$/i,l=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,y=/^[a-z0-9_-]{21}$/i,b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,S=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T;const D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,O=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",F=new RegExp(`^${k}$`);function L(ln){let at="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return ln.precision?at=`${at}\\.\\d{${ln.precision}}`:ln.precision==null&&(at=`${at}(\\.\\d+)?`),at}function N(ln){return new RegExp(`^${L(ln)}$`)}function j(ln){let at=`${k}T${L(ln)}`;const Ht=[];return Ht.push(ln.local?"Z?":"Z"),ln.offset&&Ht.push("([+-]\\d{2}:?\\d{2})"),at=`${at}(${Ht.join("|")})`,new RegExp(`^${at}$`)}t.datetimeRegex=j;function W(ln,at){return!!((at==="v4"||!at)&&D.test(ln)||(at==="v6"||!at)&&O.test(ln))}function U(ln,at){if(!b.test(ln))return!1;try{const[Ht]=ln.split("."),on=Ht.replace(/-/g,"+").replace(/_/g,"/").padEnd(Ht.length+(4-Ht.length%4)%4,"="),xn=JSON.parse(atob(on));return!(typeof xn!="object"||xn===null||!xn.typ||!xn.alg||at&&xn.alg!==at)}catch{return!1}}function X(ln,at){return!!((at==="v4"||!at)&&I.test(ln)||(at==="v6"||!at)&&M.test(ln))}class V extends u{_parse(at){if(this._def.coerce&&(at.data=String(at.data)),this._getType(at)!==_.ZodParsedType.string){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.string,received:Zn.parsedType}),m.INVALID}const on=new m.ParseStatus;let xn;for(const Zn of this._def.checks)if(Zn.kind==="min")at.data.length<Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"string",inclusive:!0,exact:!1,message:Zn.message}),on.dirty());else if(Zn.kind==="max")at.data.length>Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"string",inclusive:!0,exact:!1,message:Zn.message}),on.dirty());else if(Zn.kind==="length"){const Gi=at.data.length>Zn.value,Fi=at.data.length<Zn.value;(Gi||Fi)&&(xn=this._getOrReturnCtx(at,xn),Gi?(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"string",inclusive:!0,exact:!0,message:Zn.message}):Fi&&(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"string",inclusive:!0,exact:!0,message:Zn.message}),on.dirty())}else if(Zn.kind==="email")A.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"email",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="emoji")T||(T=new RegExp(w,"u")),T.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="uuid")l.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="nanoid")y.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="cuid")d.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="cuid2")E.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="ulid")g.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="url")try{new URL(at.data)}catch{xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"url",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()}else Zn.kind==="regex"?(Zn.regex.lastIndex=0,Zn.regex.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty())):Zn.kind==="trim"?at.data=at.data.trim():Zn.kind==="includes"?at.data.includes(Zn.value,Zn.position)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{includes:Zn.value,position:Zn.position},message:Zn.message}),on.dirty()):Zn.kind==="toLowerCase"?at.data=at.data.toLowerCase():Zn.kind==="toUpperCase"?at.data=at.data.toUpperCase():Zn.kind==="startsWith"?at.data.startsWith(Zn.value)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:Zn.value},message:Zn.message}),on.dirty()):Zn.kind==="endsWith"?at.data.endsWith(Zn.value)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:Zn.value},message:Zn.message}),on.dirty()):Zn.kind==="datetime"?j(Zn).test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:Zn.message}),on.dirty()):Zn.kind==="date"?F.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"date",message:Zn.message}),on.dirty()):Zn.kind==="time"?N(Zn).test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"time",message:Zn.message}),on.dirty()):Zn.kind==="duration"?S.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="ip"?W(at.data,Zn.version)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="jwt"?U(at.data,Zn.alg)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="cidr"?X(at.data,Zn.version)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="base64"?R.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="base64url"?P.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):_.util.assertNever(Zn);return{status:on.value,value:at.data}}_regex(at,Ht,on){return this.refinement(xn=>at.test(xn),{validation:Ht,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(on)})}_addCheck(at){return new V({...this._def,checks:[...this._def.checks,at]})}email(at){return this._addCheck({kind:"email",...v.errorUtil.errToObj(at)})}url(at){return this._addCheck({kind:"url",...v.errorUtil.errToObj(at)})}emoji(at){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(at)})}uuid(at){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(at)})}nanoid(at){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(at)})}cuid(at){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(at)})}cuid2(at){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(at)})}ulid(at){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(at)})}base64(at){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(at)})}base64url(at){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(at)})}jwt(at){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(at)})}ip(at){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(at)})}cidr(at){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(at)})}datetime(at){var Ht,on;return typeof at=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:at}):this._addCheck({kind:"datetime",precision:typeof at?.precision>"u"?null:at?.precision,offset:(Ht=at?.offset)!==null&&Ht!==void 0?Ht:!1,local:(on=at?.local)!==null&&on!==void 0?on:!1,...v.errorUtil.errToObj(at?.message)})}date(at){return this._addCheck({kind:"date",message:at})}time(at){return typeof at=="string"?this._addCheck({kind:"time",precision:null,message:at}):this._addCheck({kind:"time",precision:typeof at?.precision>"u"?null:at?.precision,...v.errorUtil.errToObj(at?.message)})}duration(at){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(at)})}regex(at,Ht){return this._addCheck({kind:"regex",regex:at,...v.errorUtil.errToObj(Ht)})}includes(at,Ht){return this._addCheck({kind:"includes",value:at,position:Ht?.position,...v.errorUtil.errToObj(Ht?.message)})}startsWith(at,Ht){return this._addCheck({kind:"startsWith",value:at,...v.errorUtil.errToObj(Ht)})}endsWith(at,Ht){return this._addCheck({kind:"endsWith",value:at,...v.errorUtil.errToObj(Ht)})}min(at,Ht){return this._addCheck({kind:"min",value:at,...v.errorUtil.errToObj(Ht)})}max(at,Ht){return this._addCheck({kind:"max",value:at,...v.errorUtil.errToObj(Ht)})}length(at,Ht){return this._addCheck({kind:"length",value:at,...v.errorUtil.errToObj(Ht)})}nonempty(at){return this.min(1,v.errorUtil.errToObj(at))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(at=>at.kind==="datetime")}get isDate(){return!!this._def.checks.find(at=>at.kind==="date")}get isTime(){return!!this._def.checks.find(at=>at.kind==="time")}get isDuration(){return!!this._def.checks.find(at=>at.kind==="duration")}get isEmail(){return!!this._def.checks.find(at=>at.kind==="email")}get isURL(){return!!this._def.checks.find(at=>at.kind==="url")}get isEmoji(){return!!this._def.checks.find(at=>at.kind==="emoji")}get isUUID(){return!!this._def.checks.find(at=>at.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(at=>at.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(at=>at.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(at=>at.kind==="cuid2")}get isULID(){return!!this._def.checks.find(at=>at.kind==="ulid")}get isIP(){return!!this._def.checks.find(at=>at.kind==="ip")}get isCIDR(){return!!this._def.checks.find(at=>at.kind==="cidr")}get isBase64(){return!!this._def.checks.find(at=>at.kind==="base64")}get isBase64url(){return!!this._def.checks.find(at=>at.kind==="base64url")}get minLength(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxLength(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}}t.ZodString=V,V.create=ln=>{var at;return new V({checks:[],typeName:bt.ZodString,coerce:(at=ln?.coerce)!==null&&at!==void 0?at:!1,...h(ln)})};function $(ln,at){const Ht=(ln.toString().split(".")[1]||"").length,on=(at.toString().split(".")[1]||"").length,xn=Ht>on?Ht:on,Zn=parseInt(ln.toFixed(xn).replace(".","")),Gi=parseInt(at.toFixed(xn).replace(".",""));return Zn%Gi/Math.pow(10,xn)}class Y extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(at){if(this._def.coerce&&(at.data=Number(at.data)),this._getType(at)!==_.ZodParsedType.number){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.number,received:Zn.parsedType}),m.INVALID}let on;const xn=new m.ParseStatus;for(const Zn of this._def.checks)Zn.kind==="int"?_.util.isInteger(at.data)||(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:Zn.message}),xn.dirty()):Zn.kind==="min"?(Zn.inclusive?at.data<Zn.value:at.data<=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"number",inclusive:Zn.inclusive,exact:!1,message:Zn.message}),xn.dirty()):Zn.kind==="max"?(Zn.inclusive?at.data>Zn.value:at.data>=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"number",inclusive:Zn.inclusive,exact:!1,message:Zn.message}),xn.dirty()):Zn.kind==="multipleOf"?$(at.data,Zn.value)!==0&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Zn.value,message:Zn.message}),xn.dirty()):Zn.kind==="finite"?Number.isFinite(at.data)||(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_finite,message:Zn.message}),xn.dirty()):_.util.assertNever(Zn);return{status:xn.value,value:at.data}}gte(at,Ht){return this.setLimit("min",at,!0,v.errorUtil.toString(Ht))}gt(at,Ht){return this.setLimit("min",at,!1,v.errorUtil.toString(Ht))}lte(at,Ht){return this.setLimit("max",at,!0,v.errorUtil.toString(Ht))}lt(at,Ht){return this.setLimit("max",at,!1,v.errorUtil.toString(Ht))}setLimit(at,Ht,on,xn){return new Y({...this._def,checks:[...this._def.checks,{kind:at,value:Ht,inclusive:on,message:v.errorUtil.toString(xn)}]})}_addCheck(at){return new Y({...this._def,checks:[...this._def.checks,at]})}int(at){return this._addCheck({kind:"int",message:v.errorUtil.toString(at)})}positive(at){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(at)})}negative(at){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(at)})}nonpositive(at){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(at)})}nonnegative(at){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(at)})}multipleOf(at,Ht){return this._addCheck({kind:"multipleOf",value:at,message:v.errorUtil.toString(Ht)})}finite(at){return this._addCheck({kind:"finite",message:v.errorUtil.toString(at)})}safe(at){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(at)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(at)})}get minValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}get isInt(){return!!this._def.checks.find(at=>at.kind==="int"||at.kind==="multipleOf"&&_.util.isInteger(at.value))}get isFinite(){let at=null,Ht=null;for(const on of this._def.checks){if(on.kind==="finite"||on.kind==="int"||on.kind==="multipleOf")return!0;on.kind==="min"?(Ht===null||on.value>Ht)&&(Ht=on.value):on.kind==="max"&&(at===null||on.value<at)&&(at=on.value)}return Number.isFinite(Ht)&&Number.isFinite(at)}}t.ZodNumber=Y,Y.create=ln=>new Y({checks:[],typeName:bt.ZodNumber,coerce:ln?.coerce||!1,...h(ln)});class G extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(at){if(this._def.coerce)try{at.data=BigInt(at.data)}catch{return this._getInvalidInput(at)}if(this._getType(at)!==_.ZodParsedType.bigint)return this._getInvalidInput(at);let on;const xn=new m.ParseStatus;for(const Zn of this._def.checks)Zn.kind==="min"?(Zn.inclusive?at.data<Zn.value:at.data<=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:Zn.value,inclusive:Zn.inclusive,message:Zn.message}),xn.dirty()):Zn.kind==="max"?(Zn.inclusive?at.data>Zn.value:at.data>=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:Zn.value,inclusive:Zn.inclusive,message:Zn.message}),xn.dirty()):Zn.kind==="multipleOf"?at.data%Zn.value!==BigInt(0)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Zn.value,message:Zn.message}),xn.dirty()):_.util.assertNever(Zn);return{status:xn.value,value:at.data}}_getInvalidInput(at){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.bigint,received:Ht.parsedType}),m.INVALID}gte(at,Ht){return this.setLimit("min",at,!0,v.errorUtil.toString(Ht))}gt(at,Ht){return this.setLimit("min",at,!1,v.errorUtil.toString(Ht))}lte(at,Ht){return this.setLimit("max",at,!0,v.errorUtil.toString(Ht))}lt(at,Ht){return this.setLimit("max",at,!1,v.errorUtil.toString(Ht))}setLimit(at,Ht,on,xn){return new G({...this._def,checks:[...this._def.checks,{kind:at,value:Ht,inclusive:on,message:v.errorUtil.toString(xn)}]})}_addCheck(at){return new G({...this._def,checks:[...this._def.checks,at]})}positive(at){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(at)})}negative(at){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(at)})}nonpositive(at){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(at)})}nonnegative(at){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(at)})}multipleOf(at,Ht){return this._addCheck({kind:"multipleOf",value:at,message:v.errorUtil.toString(Ht)})}get minValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}}t.ZodBigInt=G,G.create=ln=>{var at;return new G({checks:[],typeName:bt.ZodBigInt,coerce:(at=ln?.coerce)!==null&&at!==void 0?at:!1,...h(ln)})};class H extends u{_parse(at){if(this._def.coerce&&(at.data=!!at.data),this._getType(at)!==_.ZodParsedType.boolean){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.boolean,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodBoolean=H,H.create=ln=>new H({typeName:bt.ZodBoolean,coerce:ln?.coerce||!1,...h(ln)});class K extends u{_parse(at){if(this._def.coerce&&(at.data=new Date(at.data)),this._getType(at)!==_.ZodParsedType.date){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.date,received:Zn.parsedType}),m.INVALID}if(isNaN(at.data.getTime())){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const on=new m.ParseStatus;let xn;for(const Zn of this._def.checks)Zn.kind==="min"?at.data.getTime()<Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,message:Zn.message,inclusive:!0,exact:!1,minimum:Zn.value,type:"date"}),on.dirty()):Zn.kind==="max"?at.data.getTime()>Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,message:Zn.message,inclusive:!0,exact:!1,maximum:Zn.value,type:"date"}),on.dirty()):_.util.assertNever(Zn);return{status:on.value,value:new Date(at.data.getTime())}}_addCheck(at){return new K({...this._def,checks:[...this._def.checks,at]})}min(at,Ht){return this._addCheck({kind:"min",value:at.getTime(),message:v.errorUtil.toString(Ht)})}max(at,Ht){return this._addCheck({kind:"max",value:at.getTime(),message:v.errorUtil.toString(Ht)})}get minDate(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at!=null?new Date(at):null}get maxDate(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at!=null?new Date(at):null}}t.ZodDate=K,K.create=ln=>new K({checks:[],coerce:ln?.coerce||!1,typeName:bt.ZodDate,...h(ln)});class Z extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.symbol){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.symbol,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodSymbol=Z,Z.create=ln=>new Z({typeName:bt.ZodSymbol,...h(ln)});class Q extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.undefined){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.undefined,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodUndefined=Q,Q.create=ln=>new Q({typeName:bt.ZodUndefined,...h(ln)});class oe extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.null){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.null,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodNull=oe,oe.create=ln=>new oe({typeName:bt.ZodNull,...h(ln)});class ne extends u{constructor(){super(...arguments),this._any=!0}_parse(at){return(0,m.OK)(at.data)}}t.ZodAny=ne,ne.create=ln=>new ne({typeName:bt.ZodAny,...h(ln)});class he extends u{constructor(){super(...arguments),this._unknown=!0}_parse(at){return(0,m.OK)(at.data)}}t.ZodUnknown=he,he.create=ln=>new he({typeName:bt.ZodUnknown,...h(ln)});class _e extends u{_parse(at){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.never,received:Ht.parsedType}),m.INVALID}}t.ZodNever=_e,_e.create=ln=>new _e({typeName:bt.ZodNever,...h(ln)});class q extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.undefined){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.void,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodVoid=q,q.create=ln=>new q({typeName:bt.ZodVoid,...h(ln)});class Re extends u{_parse(at){const{ctx:Ht,status:on}=this._processInputParams(at),xn=this._def;if(Ht.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Ht.parsedType}),m.INVALID;if(xn.exactLength!==null){const Gi=Ht.data.length>xn.exactLength.value,Fi=Ht.data.length<xn.exactLength.value;(Gi||Fi)&&((0,m.addIssueToContext)(Ht,{code:Gi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Fi?xn.exactLength.value:void 0,maximum:Gi?xn.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:xn.exactLength.message}),on.dirty())}if(xn.minLength!==null&&Ht.data.length<xn.minLength.value&&((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.too_small,minimum:xn.minLength.value,type:"array",inclusive:!0,exact:!1,message:xn.minLength.message}),on.dirty()),xn.maxLength!==null&&Ht.data.length>xn.maxLength.value&&((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.too_big,maximum:xn.maxLength.value,type:"array",inclusive:!0,exact:!1,message:xn.maxLength.message}),on.dirty()),Ht.common.async)return Promise.all([...Ht.data].map((Gi,Fi)=>xn.type._parseAsync(new f(Ht,Gi,Ht.path,Fi)))).then(Gi=>m.ParseStatus.mergeArray(on,Gi));const Zn=[...Ht.data].map((Gi,Fi)=>xn.type._parseSync(new f(Ht,Gi,Ht.path,Fi)));return m.ParseStatus.mergeArray(on,Zn)}get element(){return this._def.type}min(at,Ht){return new Re({...this._def,minLength:{value:at,message:v.errorUtil.toString(Ht)}})}max(at,Ht){return new Re({...this._def,maxLength:{value:at,message:v.errorUtil.toString(Ht)}})}length(at,Ht){return new Re({...this._def,exactLength:{value:at,message:v.errorUtil.toString(Ht)}})}nonempty(at){return this.min(1,at)}}t.ZodArray=Re,Re.create=(ln,at)=>new Re({type:ln,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...h(at)});function ve(ln){if(ln instanceof ie){const at={};for(const Ht in ln.shape){const on=ln.shape[Ht];at[Ht]=Ve.create(ve(on))}return new ie({...ln._def,shape:()=>at})}else return ln instanceof Re?new Re({...ln._def,type:ve(ln.element)}):ln instanceof Ve?Ve.create(ve(ln.unwrap())):ln instanceof lt?lt.create(ve(ln.unwrap())):ln instanceof Ee?Ee.create(ln.items.map(at=>ve(at))):ln}class ie extends u{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const at=this._def.shape(),Ht=_.util.objectKeys(at);return this._cached={shape:at,keys:Ht}}_parse(at){if(this._getType(at)!==_.ZodParsedType.object){const Mi=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Mi,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Mi.parsedType}),m.INVALID}const{status:on,ctx:xn}=this._processInputParams(at),{shape:Zn,keys:Gi}=this._getCached(),Fi=[];if(!(this._def.catchall instanceof _e&&this._def.unknownKeys==="strip"))for(const Mi in xn.data)Gi.includes(Mi)||Fi.push(Mi);const oo=[];for(const Mi of Gi){const no=Zn[Mi],uo=xn.data[Mi];oo.push({key:{status:"valid",value:Mi},value:no._parse(new f(xn,uo,xn.path,Mi)),alwaysSet:Mi in xn.data})}if(this._def.catchall instanceof _e){const Mi=this._def.unknownKeys;if(Mi==="passthrough")for(const no of Fi)oo.push({key:{status:"valid",value:no},value:{status:"valid",value:xn.data[no]}});else if(Mi==="strict")Fi.length>0&&((0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.unrecognized_keys,keys:Fi}),on.dirty());else if(Mi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const Mi=this._def.catchall;for(const no of Fi){const uo=xn.data[no];oo.push({key:{status:"valid",value:no},value:Mi._parse(new f(xn,uo,xn.path,no)),alwaysSet:no in xn.data})}}return xn.common.async?Promise.resolve().then(async()=>{const Mi=[];for(const no of oo){const uo=await no.key,Do=await no.value;Mi.push({key:uo,value:Do,alwaysSet:no.alwaysSet})}return Mi}).then(Mi=>m.ParseStatus.mergeObjectSync(on,Mi)):m.ParseStatus.mergeObjectSync(on,oo)}get shape(){return this._def.shape()}strict(at){return v.errorUtil.errToObj,new ie({...this._def,unknownKeys:"strict",...at!==void 0?{errorMap:(Ht,on)=>{var xn,Zn,Gi,Fi;const oo=(Gi=(Zn=(xn=this._def).errorMap)===null||Zn===void 0?void 0:Zn.call(xn,Ht,on).message)!==null&&Gi!==void 0?Gi:on.defaultError;return Ht.code==="unrecognized_keys"?{message:(Fi=v.errorUtil.errToObj(at).message)!==null&&Fi!==void 0?Fi:oo}:{message:oo}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(at){return new ie({...this._def,shape:()=>({...this._def.shape(),...at})})}merge(at){return new ie({unknownKeys:at._def.unknownKeys,catchall:at._def.catchall,shape:()=>({...this._def.shape(),...at._def.shape()}),typeName:bt.ZodObject})}setKey(at,Ht){return this.augment({[at]:Ht})}catchall(at){return new ie({...this._def,catchall:at})}pick(at){const Ht={};return _.util.objectKeys(at).forEach(on=>{at[on]&&this.shape[on]&&(Ht[on]=this.shape[on])}),new ie({...this._def,shape:()=>Ht})}omit(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{at[on]||(Ht[on]=this.shape[on])}),new ie({...this._def,shape:()=>Ht})}deepPartial(){return ve(this)}partial(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{const xn=this.shape[on];at&&!at[on]?Ht[on]=xn:Ht[on]=xn.optional()}),new ie({...this._def,shape:()=>Ht})}required(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{if(at&&!at[on])Ht[on]=this.shape[on];else{let Zn=this.shape[on];for(;Zn instanceof Ve;)Zn=Zn._def.innerType;Ht[on]=Zn}}),new ie({...this._def,shape:()=>Ht})}keyof(){return ue(_.util.objectKeys(this.shape))}}t.ZodObject=ie,ie.create=(ln,at)=>new ie({shape:()=>ln,unknownKeys:"strip",catchall:_e.create(),typeName:bt.ZodObject,...h(at)}),ie.strictCreate=(ln,at)=>new ie({shape:()=>ln,unknownKeys:"strict",catchall:_e.create(),typeName:bt.ZodObject,...h(at)}),ie.lazycreate=(ln,at)=>new ie({shape:ln,unknownKeys:"strip",catchall:_e.create(),typeName:bt.ZodObject,...h(at)});class fe extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on=this._def.options;function xn(Zn){for(const Fi of Zn)if(Fi.result.status==="valid")return Fi.result;for(const Fi of Zn)if(Fi.result.status==="dirty")return Ht.common.issues.push(...Fi.ctx.common.issues),Fi.result;const Gi=Zn.map(Fi=>new s.ZodError(Fi.ctx.common.issues));return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union,unionErrors:Gi}),m.INVALID}if(Ht.common.async)return Promise.all(on.map(async Zn=>{const Gi={...Ht,common:{...Ht.common,issues:[]},parent:null};return{result:await Zn._parseAsync({data:Ht.data,path:Ht.path,parent:Gi}),ctx:Gi}})).then(xn);{let Zn;const Gi=[];for(const oo of on){const Mi={...Ht,common:{...Ht.common,issues:[]},parent:null},no=oo._parseSync({data:Ht.data,path:Ht.path,parent:Mi});if(no.status==="valid")return no;no.status==="dirty"&&!Zn&&(Zn={result:no,ctx:Mi}),Mi.common.issues.length&&Gi.push(Mi.common.issues)}if(Zn)return Ht.common.issues.push(...Zn.ctx.common.issues),Zn.result;const Fi=Gi.map(oo=>new s.ZodError(oo));return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union,unionErrors:Fi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=fe,fe.create=(ln,at)=>new fe({options:ln,typeName:bt.ZodUnion,...h(at)});const Me=ln=>ln instanceof pe?Me(ln.schema):ln instanceof $e?Me(ln.innerType()):ln instanceof re?[ln.value]:ln instanceof Oe?ln.options:ln instanceof Ae?_.util.objectValues(ln.enum):ln instanceof qe?Me(ln._def.innerType):ln instanceof Q?[void 0]:ln instanceof oe?[null]:ln instanceof Ve?[void 0,...Me(ln.unwrap())]:ln instanceof lt?[null,...Me(ln.unwrap())]:ln instanceof St||ln instanceof st?Me(ln.unwrap()):ln instanceof Rt?Me(ln._def.innerType):[];class Le extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Ht.parsedType}),m.INVALID;const on=this.discriminator,xn=Ht.data[on],Zn=this.optionsMap.get(xn);return Zn?Ht.common.async?Zn._parseAsync({data:Ht.data,path:Ht.path,parent:Ht}):Zn._parseSync({data:Ht.data,path:Ht.path,parent:Ht}):((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[on]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(at,Ht,on){const xn=new Map;for(const Zn of Ht){const Gi=Me(Zn.shape[at]);if(!Gi.length)throw new Error(`A discriminator value for key \`${at}\` could not be extracted from all schema options`);for(const Fi of Gi){if(xn.has(Fi))throw new Error(`Discriminator property ${String(at)} has duplicate value ${String(Fi)}`);xn.set(Fi,Zn)}}return new Le({typeName:bt.ZodDiscriminatedUnion,discriminator:at,options:Ht,optionsMap:xn,...h(on)})}}t.ZodDiscriminatedUnion=Le;function Ce(ln,at){const Ht=(0,_.getParsedType)(ln),on=(0,_.getParsedType)(at);if(ln===at)return{valid:!0,data:ln};if(Ht===_.ZodParsedType.object&&on===_.ZodParsedType.object){const xn=_.util.objectKeys(at),Zn=_.util.objectKeys(ln).filter(Fi=>xn.indexOf(Fi)!==-1),Gi={...ln,...at};for(const Fi of Zn){const oo=Ce(ln[Fi],at[Fi]);if(!oo.valid)return{valid:!1};Gi[Fi]=oo.data}return{valid:!0,data:Gi}}else if(Ht===_.ZodParsedType.array&&on===_.ZodParsedType.array){if(ln.length!==at.length)return{valid:!1};const xn=[];for(let Zn=0;Zn<ln.length;Zn++){const Gi=ln[Zn],Fi=at[Zn],oo=Ce(Gi,Fi);if(!oo.valid)return{valid:!1};xn.push(oo.data)}return{valid:!0,data:xn}}else return Ht===_.ZodParsedType.date&&on===_.ZodParsedType.date&&+ln==+at?{valid:!0,data:ln}:{valid:!1}}class Se extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at),xn=(Zn,Gi)=>{if((0,m.isAborted)(Zn)||(0,m.isAborted)(Gi))return m.INVALID;const Fi=Ce(Zn.value,Gi.value);return Fi.valid?(((0,m.isDirty)(Zn)||(0,m.isDirty)(Gi))&&Ht.dirty(),{status:Ht.value,value:Fi.data}):((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return on.common.async?Promise.all([this._def.left._parseAsync({data:on.data,path:on.path,parent:on}),this._def.right._parseAsync({data:on.data,path:on.path,parent:on})]).then(([Zn,Gi])=>xn(Zn,Gi)):xn(this._def.left._parseSync({data:on.data,path:on.path,parent:on}),this._def.right._parseSync({data:on.data,path:on.path,parent:on}))}}t.ZodIntersection=Se,Se.create=(ln,at,Ht)=>new Se({left:ln,right:at,typeName:bt.ZodIntersection,...h(Ht)});class Ee extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:on.parsedType}),m.INVALID;if(on.data.length<this._def.items.length)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&on.data.length>this._def.items.length&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ht.dirty());const Zn=[...on.data].map((Gi,Fi)=>{const oo=this._def.items[Fi]||this._def.rest;return oo?oo._parse(new f(on,Gi,on.path,Fi)):null}).filter(Gi=>!!Gi);return on.common.async?Promise.all(Zn).then(Gi=>m.ParseStatus.mergeArray(Ht,Gi)):m.ParseStatus.mergeArray(Ht,Zn)}get items(){return this._def.items}rest(at){return new Ee({...this._def,rest:at})}}t.ZodTuple=Ee,Ee.create=(ln,at)=>{if(!Array.isArray(ln))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:ln,typeName:bt.ZodTuple,rest:null,...h(at)})};class ge extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:on.parsedType}),m.INVALID;const xn=[],Zn=this._def.keyType,Gi=this._def.valueType;for(const Fi in on.data)xn.push({key:Zn._parse(new f(on,Fi,on.path,Fi)),value:Gi._parse(new f(on,on.data[Fi],on.path,Fi)),alwaysSet:Fi in on.data});return on.common.async?m.ParseStatus.mergeObjectAsync(Ht,xn):m.ParseStatus.mergeObjectSync(Ht,xn)}get element(){return this._def.valueType}static create(at,Ht,on){return Ht instanceof u?new ge({keyType:at,valueType:Ht,typeName:bt.ZodRecord,...h(on)}):new ge({keyType:V.create(),valueType:at,typeName:bt.ZodRecord,...h(Ht)})}}t.ZodRecord=ge;class xe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.map)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.map,received:on.parsedType}),m.INVALID;const xn=this._def.keyType,Zn=this._def.valueType,Gi=[...on.data.entries()].map(([Fi,oo],Mi)=>({key:xn._parse(new f(on,Fi,on.path,[Mi,"key"])),value:Zn._parse(new f(on,oo,on.path,[Mi,"value"]))}));if(on.common.async){const Fi=new Map;return Promise.resolve().then(async()=>{for(const oo of Gi){const Mi=await oo.key,no=await oo.value;if(Mi.status==="aborted"||no.status==="aborted")return m.INVALID;(Mi.status==="dirty"||no.status==="dirty")&&Ht.dirty(),Fi.set(Mi.value,no.value)}return{status:Ht.value,value:Fi}})}else{const Fi=new Map;for(const oo of Gi){const Mi=oo.key,no=oo.value;if(Mi.status==="aborted"||no.status==="aborted")return m.INVALID;(Mi.status==="dirty"||no.status==="dirty")&&Ht.dirty(),Fi.set(Mi.value,no.value)}return{status:Ht.value,value:Fi}}}}t.ZodMap=xe,xe.create=(ln,at,Ht)=>new xe({valueType:at,keyType:ln,typeName:bt.ZodMap,...h(Ht)});class Te extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.set)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.set,received:on.parsedType}),m.INVALID;const xn=this._def;xn.minSize!==null&&on.data.size<xn.minSize.value&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:xn.minSize.value,type:"set",inclusive:!0,exact:!1,message:xn.minSize.message}),Ht.dirty()),xn.maxSize!==null&&on.data.size>xn.maxSize.value&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:xn.maxSize.value,type:"set",inclusive:!0,exact:!1,message:xn.maxSize.message}),Ht.dirty());const Zn=this._def.valueType;function Gi(oo){const Mi=new Set;for(const no of oo){if(no.status==="aborted")return m.INVALID;no.status==="dirty"&&Ht.dirty(),Mi.add(no.value)}return{status:Ht.value,value:Mi}}const Fi=[...on.data.values()].map((oo,Mi)=>Zn._parse(new f(on,oo,on.path,Mi)));return on.common.async?Promise.all(Fi).then(oo=>Gi(oo)):Gi(Fi)}min(at,Ht){return new Te({...this._def,minSize:{value:at,message:v.errorUtil.toString(Ht)}})}max(at,Ht){return new Te({...this._def,maxSize:{value:at,message:v.errorUtil.toString(Ht)}})}size(at,Ht){return this.min(at,Ht).max(at,Ht)}nonempty(at){return this.min(1,at)}}t.ZodSet=Te,Te.create=(ln,at)=>new Te({valueType:ln,minSize:null,maxSize:null,typeName:bt.ZodSet,...h(at)});class Fe extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.function)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.function,received:Ht.parsedType}),m.INVALID;function on(Fi,oo){return(0,m.makeIssue)({data:Fi,path:Ht.path,errorMaps:[Ht.common.contextualErrorMap,Ht.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(Mi=>!!Mi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:oo}})}function xn(Fi,oo){return(0,m.makeIssue)({data:Fi,path:Ht.path,errorMaps:[Ht.common.contextualErrorMap,Ht.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(Mi=>!!Mi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:oo}})}const Zn={errorMap:Ht.common.contextualErrorMap},Gi=Ht.data;if(this._def.returns instanceof Ue){const Fi=this;return(0,m.OK)(async function(...oo){const Mi=new s.ZodError([]),no=await Fi._def.args.parseAsync(oo,Zn).catch(jo=>{throw Mi.addIssue(on(oo,jo)),Mi}),uo=await Reflect.apply(Gi,this,no);return await Fi._def.returns._def.type.parseAsync(uo,Zn).catch(jo=>{throw Mi.addIssue(xn(uo,jo)),Mi})})}else{const Fi=this;return(0,m.OK)(function(...oo){const Mi=Fi._def.args.safeParse(oo,Zn);if(!Mi.success)throw new s.ZodError([on(oo,Mi.error)]);const no=Reflect.apply(Gi,this,Mi.data),uo=Fi._def.returns.safeParse(no,Zn);if(!uo.success)throw new s.ZodError([xn(no,uo.error)]);return uo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...at){return new Fe({...this._def,args:Ee.create(at).rest(he.create())})}returns(at){return new Fe({...this._def,returns:at})}implement(at){return this.parse(at)}strictImplement(at){return this.parse(at)}static create(at,Ht,on){return new Fe({args:at||Ee.create([]).rest(he.create()),returns:Ht||he.create(),typeName:bt.ZodFunction,...h(on)})}}t.ZodFunction=Fe;class pe extends u{get schema(){return this._def.getter()}_parse(at){const{ctx:Ht}=this._processInputParams(at);return this._def.getter()._parse({data:Ht.data,path:Ht.path,parent:Ht})}}t.ZodLazy=pe,pe.create=(ln,at)=>new pe({getter:ln,typeName:bt.ZodLazy,...h(at)});class re extends u{_parse(at){if(at.data!==this._def.value){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{received:Ht.data,code:s.ZodIssueCode.invalid_literal,expected:this._def.value}),m.INVALID}return{status:"valid",value:at.data}}get value(){return this._def.value}}t.ZodLiteral=re,re.create=(ln,at)=>new re({value:ln,typeName:bt.ZodLiteral,...h(at)});function ue(ln,at){return new Oe({values:ln,typeName:bt.ZodEnum,...h(at)})}class Oe extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(at){if(typeof at.data!="string"){const Ht=this._getOrReturnCtx(at),on=this._def.values;return(0,m.addIssueToContext)(Ht,{expected:_.util.joinValues(on),received:Ht.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,o,"f")||r(this,o,new Set(this._def.values),"f"),!n(this,o,"f").has(at.data)){const Ht=this._getOrReturnCtx(at),on=this._def.values;return(0,m.addIssueToContext)(Ht,{received:Ht.data,code:s.ZodIssueCode.invalid_enum_value,options:on}),m.INVALID}return(0,m.OK)(at.data)}get options(){return this._def.values}get enum(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}get Values(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}get Enum(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}extract(at,Ht=this._def){return Oe.create(at,{...this._def,...Ht})}exclude(at,Ht=this._def){return Oe.create(this.options.filter(on=>!at.includes(on)),{...this._def,...Ht})}}t.ZodEnum=Oe,o=new WeakMap,Oe.create=ue;class Ae extends u{constructor(){super(...arguments),c.set(this,void 0)}_parse(at){const Ht=_.util.getValidEnumValues(this._def.values),on=this._getOrReturnCtx(at);if(on.parsedType!==_.ZodParsedType.string&&on.parsedType!==_.ZodParsedType.number){const xn=_.util.objectValues(Ht);return(0,m.addIssueToContext)(on,{expected:_.util.joinValues(xn),received:on.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,c,"f")||r(this,c,new Set(_.util.getValidEnumValues(this._def.values)),"f"),!n(this,c,"f").has(at.data)){const xn=_.util.objectValues(Ht);return(0,m.addIssueToContext)(on,{received:on.data,code:s.ZodIssueCode.invalid_enum_value,options:xn}),m.INVALID}return(0,m.OK)(at.data)}get enum(){return this._def.values}}t.ZodNativeEnum=Ae,c=new WeakMap,Ae.create=(ln,at)=>new Ae({values:ln,typeName:bt.ZodNativeEnum,...h(at)});class Ue extends u{unwrap(){return this._def.type}_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.promise&&Ht.common.async===!1)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.promise,received:Ht.parsedType}),m.INVALID;const on=Ht.parsedType===_.ZodParsedType.promise?Ht.data:Promise.resolve(Ht.data);return(0,m.OK)(on.then(xn=>this._def.type.parseAsync(xn,{path:Ht.path,errorMap:Ht.common.contextualErrorMap})))}}t.ZodPromise=Ue,Ue.create=(ln,at)=>new Ue({type:ln,typeName:bt.ZodPromise,...h(at)});class $e extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at),xn=this._def.effect||null,Zn={addIssue:Gi=>{(0,m.addIssueToContext)(on,Gi),Gi.fatal?Ht.abort():Ht.dirty()},get path(){return on.path}};if(Zn.addIssue=Zn.addIssue.bind(Zn),xn.type==="preprocess"){const Gi=xn.transform(on.data,Zn);if(on.common.async)return Promise.resolve(Gi).then(async Fi=>{if(Ht.value==="aborted")return m.INVALID;const oo=await this._def.schema._parseAsync({data:Fi,path:on.path,parent:on});return oo.status==="aborted"?m.INVALID:oo.status==="dirty"||Ht.value==="dirty"?(0,m.DIRTY)(oo.value):oo});{if(Ht.value==="aborted")return m.INVALID;const Fi=this._def.schema._parseSync({data:Gi,path:on.path,parent:on});return Fi.status==="aborted"?m.INVALID:Fi.status==="dirty"||Ht.value==="dirty"?(0,m.DIRTY)(Fi.value):Fi}}if(xn.type==="refinement"){const Gi=Fi=>{const oo=xn.refinement(Fi,Zn);if(on.common.async)return Promise.resolve(oo);if(oo instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Fi};if(on.common.async===!1){const Fi=this._def.schema._parseSync({data:on.data,path:on.path,parent:on});return Fi.status==="aborted"?m.INVALID:(Fi.status==="dirty"&&Ht.dirty(),Gi(Fi.value),{status:Ht.value,value:Fi.value})}else return this._def.schema._parseAsync({data:on.data,path:on.path,parent:on}).then(Fi=>Fi.status==="aborted"?m.INVALID:(Fi.status==="dirty"&&Ht.dirty(),Gi(Fi.value).then(()=>({status:Ht.value,value:Fi.value}))))}if(xn.type==="transform")if(on.common.async===!1){const Gi=this._def.schema._parseSync({data:on.data,path:on.path,parent:on});if(!(0,m.isValid)(Gi))return Gi;const Fi=xn.transform(Gi.value,Zn);if(Fi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Ht.value,value:Fi}}else return this._def.schema._parseAsync({data:on.data,path:on.path,parent:on}).then(Gi=>(0,m.isValid)(Gi)?Promise.resolve(xn.transform(Gi.value,Zn)).then(Fi=>({status:Ht.value,value:Fi})):Gi);_.util.assertNever(xn)}}t.ZodEffects=$e,t.ZodTransformer=$e,$e.create=(ln,at,Ht)=>new $e({schema:ln,typeName:bt.ZodEffects,effect:at,...h(Ht)}),$e.createWithPreprocess=(ln,at,Ht)=>new $e({schema:at,effect:{type:"preprocess",transform:ln},typeName:bt.ZodEffects,...h(Ht)});class Ve extends u{_parse(at){return this._getType(at)===_.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(at)}unwrap(){return this._def.innerType}}t.ZodOptional=Ve,Ve.create=(ln,at)=>new Ve({innerType:ln,typeName:bt.ZodOptional,...h(at)});class lt extends u{_parse(at){return this._getType(at)===_.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(at)}unwrap(){return this._def.innerType}}t.ZodNullable=lt,lt.create=(ln,at)=>new lt({innerType:ln,typeName:bt.ZodNullable,...h(at)});class qe extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at);let on=Ht.data;return Ht.parsedType===_.ZodParsedType.undefined&&(on=this._def.defaultValue()),this._def.innerType._parse({data:on,path:Ht.path,parent:Ht})}removeDefault(){return this._def.innerType}}t.ZodDefault=qe,qe.create=(ln,at)=>new qe({innerType:ln,typeName:bt.ZodDefault,defaultValue:typeof at.default=="function"?at.default:()=>at.default,...h(at)});class Rt extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on={...Ht,common:{...Ht.common,issues:[]}},xn=this._def.innerType._parse({data:on.data,path:on.path,parent:{...on}});return(0,m.isAsync)(xn)?xn.then(Zn=>({status:"valid",value:Zn.status==="valid"?Zn.value:this._def.catchValue({get error(){return new s.ZodError(on.common.issues)},input:on.data})})):{status:"valid",value:xn.status==="valid"?xn.value:this._def.catchValue({get error(){return new s.ZodError(on.common.issues)},input:on.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Rt,Rt.create=(ln,at)=>new Rt({innerType:ln,typeName:bt.ZodCatch,catchValue:typeof at.catch=="function"?at.catch:()=>at.catch,...h(at)});class nt extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.nan){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.nan,received:on.parsedType}),m.INVALID}return{status:"valid",value:at.data}}}t.ZodNaN=nt,nt.create=ln=>new nt({typeName:bt.ZodNaN,...h(ln)}),t.BRAND=Symbol("zod_brand");class St extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on=Ht.data;return this._def.type._parse({data:on,path:Ht.path,parent:Ht})}unwrap(){return this._def.type}}t.ZodBranded=St;class it extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.common.async)return(async()=>{const Zn=await this._def.in._parseAsync({data:on.data,path:on.path,parent:on});return Zn.status==="aborted"?m.INVALID:Zn.status==="dirty"?(Ht.dirty(),(0,m.DIRTY)(Zn.value)):this._def.out._parseAsync({data:Zn.value,path:on.path,parent:on})})();{const xn=this._def.in._parseSync({data:on.data,path:on.path,parent:on});return xn.status==="aborted"?m.INVALID:xn.status==="dirty"?(Ht.dirty(),{status:"dirty",value:xn.value}):this._def.out._parseSync({data:xn.value,path:on.path,parent:on})}}static create(at,Ht){return new it({in:at,out:Ht,typeName:bt.ZodPipeline})}}t.ZodPipeline=it;class st extends u{_parse(at){const Ht=this._def.innerType._parse(at),on=xn=>((0,m.isValid)(xn)&&(xn.value=Object.freeze(xn.value)),xn);return(0,m.isAsync)(Ht)?Ht.then(xn=>on(xn)):on(Ht)}unwrap(){return this._def.innerType}}t.ZodReadonly=st,st.create=(ln,at)=>new st({innerType:ln,typeName:bt.ZodReadonly,...h(at)});function ct(ln,at={},Ht){return ln?ne.create().superRefine((on,xn)=>{var Zn,Gi;if(!ln(on)){const Fi=typeof at=="function"?at(on):typeof at=="string"?{message:at}:at,oo=(Gi=(Zn=Fi.fatal)!==null&&Zn!==void 0?Zn:Ht)!==null&&Gi!==void 0?Gi:!0,Mi=typeof Fi=="string"?{message:Fi}:Fi;xn.addIssue({code:"custom",...Mi,fatal:oo})}}):ne.create()}t.custom=ct,t.late={object:ie.lazycreate};var bt;(function(ln){ln.ZodString="ZodString",ln.ZodNumber="ZodNumber",ln.ZodNaN="ZodNaN",ln.ZodBigInt="ZodBigInt",ln.ZodBoolean="ZodBoolean",ln.ZodDate="ZodDate",ln.ZodSymbol="ZodSymbol",ln.ZodUndefined="ZodUndefined",ln.ZodNull="ZodNull",ln.ZodAny="ZodAny",ln.ZodUnknown="ZodUnknown",ln.ZodNever="ZodNever",ln.ZodVoid="ZodVoid",ln.ZodArray="ZodArray",ln.ZodObject="ZodObject",ln.ZodUnion="ZodUnion",ln.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ln.ZodIntersection="ZodIntersection",ln.ZodTuple="ZodTuple",ln.ZodRecord="ZodRecord",ln.ZodMap="ZodMap",ln.ZodSet="ZodSet",ln.ZodFunction="ZodFunction",ln.ZodLazy="ZodLazy",ln.ZodLiteral="ZodLiteral",ln.ZodEnum="ZodEnum",ln.ZodEffects="ZodEffects",ln.ZodNativeEnum="ZodNativeEnum",ln.ZodOptional="ZodOptional",ln.ZodNullable="ZodNullable",ln.ZodDefault="ZodDefault",ln.ZodCatch="ZodCatch",ln.ZodPromise="ZodPromise",ln.ZodBranded="ZodBranded",ln.ZodPipeline="ZodPipeline",ln.ZodReadonly="ZodReadonly"})(bt||(t.ZodFirstPartyTypeKind=bt={}));class Vt{constructor(...at){}}const _n=(ln,at={message:`Input not instance of ${ln.name}`})=>ct(Ht=>Ht instanceof ln,at);t.instanceof=_n;const Kn=V.create;t.string=Kn;const bi=Y.create;t.number=bi;const Un=nt.create;t.nan=Un;const hn=G.create;t.bigint=hn;const Xn=H.create;t.boolean=Xn;const vn=K.create;t.date=vn;const $t=Z.create;t.symbol=$t;const vt=Q.create;t.undefined=vt;const ze=oe.create;t.null=ze;const Je=ne.create;t.any=Je;const Dt=he.create;t.unknown=Dt;const Rn=_e.create;t.never=Rn;const ni=q.create;t.void=ni;const Li=Re.create;t.array=Li;const Wi=ie.create;t.object=Wi;const ao=ie.strictCreate;t.strictObject=ao;const qi=fe.create;t.union=qi;const fo=Le.create;t.discriminatedUnion=fo;const ci=Se.create;t.intersection=ci;const Gn=Ee.create;t.tuple=Gn;const Di=ge.create;t.record=Di;const zi=xe.create;t.map=zi;const to=Te.create;t.set=to;const Ki=Fe.create;t.function=Ki;const yn=pe.create;t.lazy=yn;const si=re.create;t.literal=si;const Ln=Oe.create;t.enum=Ln;const dt=Ae.create;t.nativeEnum=dt;const xt=Ue.create;t.promise=xt;const Tt=$e.create;t.effect=Tt,t.transformer=Tt;const At=Ve.create;t.optional=At;const Sn=lt.create;t.nullable=Sn;const fn=$e.createWithPreprocess;t.preprocess=fn;const an=it.create;t.pipeline=an;const Hn=()=>Kn().optional();t.ostring=Hn;const hi=()=>bi().optional();t.onumber=hi;const Ei=()=>Xn().optional();t.oboolean=Ei,t.coerce={string:ln=>V.create({...ln,coerce:!0}),number:ln=>Y.create({...ln,coerce:!0}),boolean:ln=>H.create({...ln,coerce:!0}),bigint:ln=>G.create({...ln,coerce:!0}),date:ln=>K.create({...ln,coerce:!0})},t.NEVER=m.INVALID},79682:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChromeDevtoolsContribution=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(65265),v=e(98295),m=e(27654);let _=n=class extends c.Disposable{constructor(){super(...arguments),this.lantencyHandler=f=>{const{command:a}=f.detail;a===p.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():a===p.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var f;this.appConfig.devtools&&(window.addEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(c.Disposable.create(()=>{window.removeEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.interval&&(clearInterval(this.interval),this.interval=void 0)})),!((f=window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__)===null||f===void 0)&&f.captureRPC&&(this.interval||this.startRTTInterval()))}startRTTInterval(){this.interval=setInterval(async()=>{const f=Date.now();await this.rttService.measure();const a=Date.now()-f;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=a)},n.INTERVAL)}};t.ChromeDevtoolsContribution=_,_.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(c.AppConfig),r.__metadata("design:type",Object)],_.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],_.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=_=n=r.__decorate([(0,v.Domain)(c.ClientAppContribution)],_)},72915:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTContribution=void 0;const r=e(85608),o=e(76003),c=e(26542),p=e(92323),v=e(98295),m=e(27654),_={id:"connection.start.rtt",label:"%connection.start.rtt%",category:"%command.category.developerTools%"},s={id:"connection.stop.rtt",label:"%connection.stop.rtt%",category:"%command.category.developerTools%"},f={alignment:c.StatusBarAlignment.LEFT,priority:1/0-1};let a=n=class{registerCommands(u){u.registerCommand(_,{execute:()=>{this.interval||this.startRTTInterval()}}),u.registerCommand(s,{execute:()=>{this.interval&&(clearInterval(this.interval),this.statusBar&&(this.statusBar.dispose(),this.statusBar=void 0))}})}startRTTInterval(){this.interval=setInterval(async()=>{const u=Date.now();await this.rttService.measure();const E={text:`${Date.now()-u}ms`};if(this.statusBar)this.statusBar.update({...E,...f});else{const g=this.statusBarService.addElement("connection-rtt",{...E,...f});this.statusBar=g}},n.INTERVAL)}};t.ConnectionRTTContribution=a,a.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(c.IStatusBarService),r.__metadata("design:type",Object)],a.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],a.prototype,"rttService",void 0),t.ConnectionRTTContribution=a=n=r.__decorate([(0,v.Domain)(p.CommandContribution)],a)},27654:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTBrowserService=t.ConnectionRTTBrowserServiceToken=void 0;const n=e(85608),r=e(76003),o=e(69452);t.ConnectionRTTBrowserServiceToken=Symbol("ConnectionRTTBrowserService");let c=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=c,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],c.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=c=n.__decorate([(0,r.Injectable)()],c)},17631:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(69452);let v=class extends c.WithEventBus{onDidDropFile(_){this.dropService.onDidDropFile(_)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(p.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,c.OnEvent)(c.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.FileTreeDropEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"onDidDropFile",null),t.FileDropContribution=v=n.__decorate([(0,r.Injectable)(),(0,o.Domain)(o.ClientAppContribution)],v)},22874:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(43718),v=e(42933),{Path:m}=p.path,_=e(69452);let s=class extends p.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(a){this.pending.add(a),this.createOrUpdateStatusBar()}onDidUploadFileEnd(a){this.pending.delete(a),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(a){if(this.pending.size===0){this.uploadStatus&&(this.uploadStatus.dispose(),this.uploadStatus=void 0);return}const h="sumi-upload-file-status",u=(0,o.formatLocalize)("workbench.uploadingFiles",this.pending.size,a||"0 MB"),d={text:u,alignment:c.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...d}):this.uploadStatus=this.statusBarService.addElement(h,d)}onDidDropFile(a){var h;const{payload:{event:u,targetDir:d}}=a;if(!d||!(!((h=u.dataTransfer)===null||h===void 0)&&h.files)||u.dataTransfer.files.length===0)return;const E=u.dataTransfer.items;let g=0;const l=Date.now(),y=b=>{g+=b;const S=Date.now(),w=`${(g/((S-l)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(w)};for(const b of E){const S=b.webkitGetAsEntry();this.processFilesEntry(d,S,y)}}async processFilesEntry(a,h,u){if(h.isFile)this.processFileEntry(h,a,u);else{const d=p.Uri.file(new m(a).join(h.fullPath).toString()).toString();await this.fs.createFolder(d),this.processDirEntry(h,a,u)}}toBinaryString(a){let h;const u=a.length;let d="";for(h=0;h<u;h+=1)d+=String.fromCharCode(a[h]);return d}async doUploadFile(a,h,u){var d;const E=new m(h).join(a.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(p.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(a.name,h);const g=a.stream().getReader();let l=await g.read();for(;!l.done;)await this.dropService.$writeStream(this.toBinaryString(l.value),a.name,h,l.done),u((d=l.value)===null||d===void 0?void 0:d.byteLength),l=await g.read();l.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(a,h,u){a.file(d=>{const E=new File([d],a.fullPath,{type:a.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(a,h,u){a.createReader().readEntries(E=>{E.forEach(async g=>{this.processFilesEntry(h,g,u)})},()=>{})}};t.FileDropService=s,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fs",void 0),n.__decorate([(0,r.Autowired)(_.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(c.IStatusBarService),n.__metadata("design:type",Object)],s.prototype,"statusBarService",void 0),t.FileDropService=s=n.__decorate([(0,r.Injectable)()],s)},79240:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchContribution=t.FileSearchQuickCommandHandler=t.matchLineReg=t.quickGoToSymbol=t.quickFileOpen=void 0,t.getValidateInput=y;const n=e(85608),r=n.__importDefault(e(39050)),o=e(76003),c=e(41869),p=e(26542),v=e(43718),m=e(98295),_=e(54414),s=e(17459),f=e(84660),a=n.__importStar(e(20868)),h=e(97821),u=e(80490),d=e(51500),E=e(30981),g=200;t.quickFileOpen={id:"workbench.action.quickOpen",category:"File",label:"Open File..."},t.quickGoToSymbol={id:"workbench.action.gotoSymbol",category:"File",label:"Open File Symbol..."},t.matchLineReg=/^([^:#(]*)[:#(]?L?(\d+)?[:,]?(\d+)?\)?/;function l(T=""){const D=T.match(t.matchLineReg)||[];if(D.length<2)return;const I={line:Number(D[2]||0),start:Number(D[3]||0)};return new a.Range(I.line,I.start,I.line,I.start)}function y(T){return T.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,c.localize)("quickOpen.openOnTheRightSide"),class:(0,c.getIcon)("embed")})}async run(D){await this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.getUri(),{preview:!1,split:_.EditorGroupSplitAction.Right,range:l(this.injector.get(A).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(c.CommandService),n.__metadata("design:type",Object)],b.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),b=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],b);let S=class{hasActions(){return!0}getActions(){return[this.fileSearchActionLeftRight]}getValidateInput(D){return y(D)}};n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",b)],S.prototype,"fileSearchActionLeftRight",void 0),S=n.__decorate([(0,o.Injectable)()],S);let A=class{constructor(){this.cancelIndicator=new v.CancellationTokenSource,this.default=!0,this.prefix="...",this.description=(0,c.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(D,I)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const O=this.cancelIndicator.token,M=new Set;let R=[];D=D.trim().replace(/\s/g,""),this.currentLookFor=D;const P=y(D),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(M,P,O);if(D&&(this.logger.debug("lookFor",D,P),R=await this.getFindOutItems(M,P,O)),O.isCancellationRequested)return;const L=F.concat(R);I(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(D.indexOf("@")>-1?"file-symbol":"file",{lookFor:D,stat:{recently:F.length,find:R.length}})}}}getOptions(){return{placeholder:(0,c.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:D=>new c.QuickOpenItem({label:(0,c.localize)(D.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(D){D&&this.prevEditorState.uri&&(this.workbenchEditorService.open(this.prevEditorState.uri,{range:this.prevEditorState.range}),this.prevEditorState={}),this.prevSelected=void 0,this.cancelIndicator.cancel()}onToggle(){this.cancelIndicator.cancel()}trySaveEditorState(){var D;if(this.workbenchEditorService.currentResource){let I={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const O=(D=this.workbenchEditorService.currentEditor)===null||D===void 0?void 0:D.getSelections();if(O){const{selectionStartLineNumber:M,selectionStartColumn:R,positionLineNumber:P,positionColumn:k}=O[0];I=new a.Range(M,R,P,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:I}}}async getFindOutItems(D,I,O){var M;let R;if(I.indexOf("@")>-1){this.trySaveEditorState(),R=[];const[P,k]=I.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(P){const L=await this.getQueryFiles(P,D,O);L.length&&(F=L[0].getUri())}else F=(M=this.workbenchEditorService.currentResource)===null||M===void 0?void 0:M.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],N=[];this.flattenSymbols({children:L},N),R=N.filter(W=>{const U=(0,E.matchesFuzzy)(k,W.name,!0)||[];return U&&(W.labelHighlights=U),U&&U.length}).map((W,U)=>{var X;return new c.QuickOpenItem({uri:F,label:W.name,iconClass:(0,c.getSymbolIcon)(W.kind),description:(X=W.parent)===null||X===void 0?void 0:X.name,labelHighlights:W.labelHighlights,groupLabel:U===0?(0,c.formatLocalize)("search.fileSymbolResults",N.length):"",showBorder:!1,run:V=>V===c.Mode.PREVIEW?(this.locateSymbol(F,W),!0):V===c.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(R=await this.getQueryFiles(I,D,O),R[0]){const P=await this.getItems([R[0].getUri().codeUri.fsPath],{groupLabel:(0,c.localize)("search.fileResults"),showBorder:!0});R[0]=P[0]}return R}async getQueryFiles(D,I,O){const R=(await this.workspaceService.roots).map(F=>new c.URI(F.uri).codeUri.fsPath),P=await this.fileSearchService.find(D,{rootUris:R,fuzzyMatch:!0,limit:g,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},O),k=await this.getItems(P.filter(F=>I.has(F)||O.isCancellationRequested?!1:(I.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(D,I){D.children.forEach(O=>{I.push(O),O.children&&this.flattenSymbols(O,I)})}async getRecentlyItems(D,I,O){const M=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(M.filter(R=>{const P=new c.URI(R);return D.has(R)||!r.default.test(I,P.displayName)||O.isCancellationRequested?!1:(D.add(R),!0)}),{groupLabel:(0,c.localize)("search.historyMatches")})}async getItems(D,I){const O=[];for(const[M,R]of D.entries()){const P=c.URI.isUriString(R)?new c.URI(R):c.URI.file(R),k=`file-icon ${this.labelService.getIcon(P.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(P.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new c.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const N=new c.QuickOpenItem({uri:P,label:P.displayName,tooltip:R,iconClass:k,description:F,groupLabel:M===0?I.groupLabel:"",showBorder:D.length>0&&M===0?I.showBorder:!1,run:j=>(j===c.Mode.PREVIEW&&(this.prevSelected=P),j===c.Mode.OPEN?(this.openFile(P),!0):!1)});O.push(N)}return O}openFile(D){const I=D.codeUri.fsPath;let O=l(this.currentLookFor);(!O||!O.startLineNumber&&!O.startColumn)&&(O=l(D.fragment?"#"+D.fragment:I)),this.currentLookFor="",this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.withoutFragment(),{preview:!1,range:O,focus:!0})}locateSymbol(D,I){this.workbenchEditorService.open(D,{range:I.range,preview:!0})}compareItems(D,I,O="getLabel"){function M(j){return j.trim().toLowerCase()}const R=M(y(this.currentLookFor));function P(j){const W=r.default.match(R,j);return W===null?0:W.score}let k=D[O](),F=I[O]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=M(k),F=M(F);const L=P(k),N=P(F);if(L===N){const j=k.indexOf(R),W=F.indexOf(R);return j===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?O==="getUri"?0:this.compareItems(D,I,"getUri"):F.localeCompare(k):j-W}return N-L}getPreferenceSearchExcludes(){const D=[],I=this.preferenceService.get("files.exclude"),O=this.preferenceService.get("search.exclude"),M=Object.assign({},I,O);for(const R of Object.keys(M))M[R]&&D.push(R);return D}};t.FileSearchQuickCommandHandler=A,n.__decorate([(0,o.Autowired)(c.CommandService),n.__metadata("design:type",Object)],A.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(f.FileSearchServicePath),n.__metadata("design:type",Object)],A.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],A.prototype,"workbenchEditorService",void 0),n.__decorate([(0,o.Autowired)(s.DocumentSymbolStore),n.__metadata("design:type",s.DocumentSymbolStore)],A.prototype,"documentSymbolStore",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",p.LabelService)],A.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(d.IWorkspaceService),n.__metadata("design:type",Object)],A.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(c.RecentFilesManager),n.__metadata("design:type",c.RecentFilesManager)],A.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(c.ILogger),n.__metadata("design:type",Object)],A.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",S)],A.prototype,"fileSearchActionProvider",void 0),n.__decorate([(0,o.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],A.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(v.IReporterService),n.__metadata("design:type",Object)],A.prototype,"reporterService",void 0),t.FileSearchQuickCommandHandler=A=n.__decorate([(0,o.Injectable)()],A);let w=class{registerQuickOpenHandlers(D){D.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,c.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(D){D.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),D.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(D){D.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=w,n.__decorate([(0,o.Autowired)(A),n.__metadata("design:type",A)],w.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),t.FileSearchContribution=w=n.__decorate([(0,m.Domain)(v.CommandContribution,c.KeybindingContribution,u.QuickOpenContribution)],w)},73827:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientAddonModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(69452),p=e(79682),v=e(72915),m=e(27654),_=e(17631),s=e(22874),f=e(79240),a=e(18256),h=e(7756),u=e(16426);let d=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[p.ChromeDevtoolsContribution,a.LanguageChangeHintContribution,f.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,_.FileDropContribution,v.ConnectionRTTContribution,{token:c.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:c.FileDropServicePath},{servicePath:c.ConnectionBackServicePath}]}};t.ClientAddonModule=d,t.ClientAddonModule=d=n.__decorate([(0,r.Injectable)()],d)},18256:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageChangeHintContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(72665);let p=class{onStart(){this.preferenceService.onSpecificPreferenceChange(o.GeneralSettingsId.Language,async m=>{(0,o.setLanguageId)(m.newValue),this.preferenceService.get("general.askReloadOnLanguageChange")&&await this.dialogService.info((0,o.localize)("preference.general.language.change.refresh.info","After changing the language, it should be restarted to take effect. Will it be refreshed immediately?"),[(0,o.localize)("preference.general.language.change.refresh.later","Later"),(0,o.localize)("preference.general.language.change.refresh.now","Now")])===(0,o.localize)("preference.general.language.change.refresh.now","Now")&&this.clientApp.fireOnReload()})}};t.LanguageChangeHintContribution=p,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],p.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],p.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(c.IDialogService),n.__metadata("design:type",Object)],p.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},7756:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBarContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718);let p=class extends c.WithEventBus{onStart(){}handleBrowserConnectionOpen(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--statusBar-background)"),this.logger.log("Browser connection open, change status bar background color")}handleBrowserConnectionClose(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--kt-statusbar-offline-background)"),this.logger.log("Browser connection close, change status bar background color")}};t.StatusBarContribution=p,n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],p.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=p=n.__decorate([(0,c.Domain)(o.ClientAppContribution)],p)},16426:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(93899),p=e(62132);let v=class{registerCommands(_){_.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(_){_.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:p.ToolbarCustomizeComponent}),this.config.layoutConfig[o.SlotLocation.extra]||(this.config.layoutConfig[o.SlotLocation.extra]={modules:[]}),this.config.layoutConfig[o.SlotLocation.extra].modules.push("addon/toolbar-customize")}registerMenus(_){_.registerMenuItem(c.MenuId.KTToolbarLocationContext,{command:{id:"toolbar.showCustomizePanel",label:(0,o.localize)("toolbar.customize.menu")}})}};t.ToolbarCustomizeContribution=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(p.ToolbarCustomizeViewService),n.__metadata("design:type",p.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,c.MenuContribution)],v)},62132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeComponent=t.ToolbarCustomizeViewService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(97267),p=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(f){this._setVisible=f}setVisible(f){this._setVisible(f)}async toggleActionVisibility(f,a,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[f]||(u[f]=[]),!h)u[f].indexOf(a)===-1&&u[f].push(a);else{const E=u[f].indexOf(a);E!==-1&&u[f].splice(E,1)}const d=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,d)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(p.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const _=()=>{const[s,f]=r.default.useState(!1),a=(0,p.useInjectable)(m),h=(0,p.useInjectable)(p.IToolbarRegistry),u=(0,p.useInjectable)(p.PreferenceService);if(a.bindSetVisibleHandle(f),!s)return null;const d=h.getAllLocations(),E=u.get("toolbar.ignoreActions")||{};let g=u.get("toolbar.buttonDisplay","iconAndText");function l(y){const b=[{id:"_head"},...h.getActionGroups(y)||[],{id:"_tail"}],S=[],A=E[y]||[];return b.forEach((w,T)=>{const D=h.getToolbarActions({location:y,group:w.id});D&&D.actions.length>0&&(S.length>0&&S.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+T})),D.actions.forEach((I,O)=>{var M;let R=A.indexOf(I.id)===-1;const P="action-toggle-"+I.id;S.push(r.default.createElement("div",{className:v.default["action-item"],key:O+"_"+I.id},r.default.createElement(c.CheckBox,{onChange:()=>{a.toggleActionVisibility(y,I.id,!R),R=!R},defaultChecked:R,id:P,label:(M=I.description)!==null&&M!==void 0?M:I.id})))}))}),S.length===0?null:r.default.createElement("div",{key:y,className:v.default["toolbar-customize-location"]},S)}return r.default.createElement("div",{className:v.default["toolbar-customize-overlay"]},r.default.createElement("div",{className:v.default["toolbar-customize"]},d.map(y=>l(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,p.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(c.Select,{options:[{label:(0,p.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,p.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:g,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;u.set("toolbar.buttonDisplay",y,b),g=y},className:v.default["button-display-select"]})),r.default.createElement("div",{className:v.default["customize-complete"]},r.default.createElement(c.Button,{type:"primary",onClick:()=>f(!1)},(0,p.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=_},69452:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IConnectionBackService=t.ConnectionBackServicePath=t.IFileDropFrontendServiceToken=t.IFileDropServiceToken=t.FileDropServicePath=void 0,t.FileDropServicePath="FileDropServicePath",t.IFileDropServiceToken=Symbol("IFileDropService"),t.IFileDropFrontendServiceToken=Symbol("IFileDropFrontendService"),t.ConnectionBackServicePath="ConnectionBackServicePath",t.IConnectionBackService=Symbol("IConnectionBackService")},77659:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(50394);let p=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=c.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=c.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=c.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=c.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=c.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=c.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=c.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=p=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],p)},32016:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeBrowserContribution=t.INLINE_DIFF_MANAGER_WIDGET_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(50394),v=e(1149),m=e(97222),_=e(43718),s=e(82353),f=e(54414),a=e(57517),h=e(51553),u=e(63067),d=e(46507),E=e(97682),g=e(68415),l=e(96640),y=e(19413),b=e(61282),S=e(51081),A=e(59347),w=e(76154),T=e(79559),D=e(57232),I=e(72991),O=e(71863),M=e(7511),R=e(42911),P=e(72801),k=e(87817),F=e(4972),L=e(82983),N=e(73974),j=e(77633),W=e(51221),U=e(2281),X=e(31031),V=e(95608),$=e(38890),Y=e(77886),G=e(89060),H=e(74353),K=e(22169),Z=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let Q=class{constructor(){this.registerFeature()}async initialize(){const{supportsChatAssistant:ne}=this.aiNativeConfigService.capabilities;ne&&(o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,y.AI_CHAT_VIEW_ID,y.AI_CHAT_CONTAINER_ID),o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,s.DESIGN_MENU_BAR_RIGHT,y.AI_CHAT_LOGO_AVATAR_ID),this.chatProxyService.registerDefaultAgent(),this.chatInternalService.init(),await this.chatManagerService.init())}registerEditorExtensionContribution(ne){const{supportsInlineChat:he,supportsInlineCompletion:_e,supportsProblemFix:q,supportsCodeAction:Re}=this.aiNativeConfigService.capabilities;ne($.InlineDiffController.ID,new l.SyncDescriptor($.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),Re&&ne(Z.SumiLightBulbWidget.ID,Z.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),he&&(ne(W.InlineChatEditorController.ID,new l.SyncDescriptor(W.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(ne(Y.InlineHintController.ID,new l.SyncDescriptor(Y.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),ne(G.InlineInputController.ID,new l.SyncDescriptor(G.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),_e&&(ne(M.IntelligentCompletionsController.ID,new l.SyncDescriptor(M.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),ne(I.InlineCompletionsController.ID,new l.SyncDescriptor(I.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),q&&ne(R.ProblemFixController.ID,new l.SyncDescriptor(R.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:ne}=this.aiNativeConfigService.capabilities;ne&&this.initMCPServers()}onDidStart(){(0,_.runWhenIdle)(()=>{const{supportsRenameSuggestions:ne,supportsInlineChat:he,supportsMCP:_e,supportsCustomLLMSettings:q}=this.aiNativeConfigService.capabilities,Re=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);Re==="always"?this.commandService.executeCommand(c.AI_CHAT_VISIBLE.id,!0):Re==="never"&&this.commandService.executeCommand(c.AI_CHAT_VISIBLE.id,!1),ne&&this.renameSingleHandler.load(),he&&this.codeActionSingleHandler.load(),q&&this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,ve=>{const ie=this.getModelByName(ve.newValue),fe=ie?Object.keys(ie):[],Me=fe.length?fe[0]:"",Le=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Le,default:Me,defaultValue:Me,enum:fe.length?fe:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,Me,ve.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,fe.reduce((Ce,Se)=>({...Ce,[Se]:Se}),{}))}),_e&&this.initMCPServers()})}initMCPServers(){var ne;const he=this.preferenceService.getValid(o.AINativeSettingSectionsId.MCPServers),_e=he?.find(q=>q.name===y.BUILTIN_MCP_SERVER_NAME);if(this.sumiMCPServerBackendProxy.initBuiltinMCPServer((ne=_e?.enabled)!==null&&ne!==void 0?ne:!0),he&&he.length>0){const q=he.filter(Re=>Re.name!==y.BUILTIN_MCP_SERVER_NAME);q.length>0&&this.sumiMCPServerBackendProxy.initExternalMCPServers(q)}}getModelByName(ne){switch(ne){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(ne=>{var he,_e,q,Re,ve,ie,fe,Me,Le;(he=ne.registerInlineChatFeature)===null||he===void 0||he.call(ne,this.inlineChatFeatureRegistry),(_e=ne.registerChatFeature)===null||_e===void 0||_e.call(ne,this.chatFeatureRegistry),(q=ne.registerResolveConflictFeature)===null||q===void 0||q.call(ne,this.resolveConflictRegistry),(Re=ne.registerRenameProvider)===null||Re===void 0||Re.call(ne,this.renameCandidatesProviderRegistry),(ve=ne.registerChatRender)===null||ve===void 0||ve.call(ne,this.chatRenderRegistry),(ie=ne.registerTerminalProvider)===null||ie===void 0||ie.call(ne,this.terminalProviderRegistry),(fe=ne.registerIntelligentCompletionFeature)===null||fe===void 0||fe.call(ne,this.intelligentCompletionsRegistry),(Me=ne.registerProblemFixFeature)===null||Me===void 0||Me.call(ne,this.problemFixProviderRegistry),(Le=ne.registerChatAgentPromptProvider)===null||Le===void 0||Le.call(ne)}),this.mcpServerContributions.getContributions().forEach(ne=>{ne.registerMCPServer(this.mcpServerRegistry)})}registerSetting(ne){ne.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:_.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.chat.title"),preferences:[{id:o.AINativeSettingSectionsId.ChatVisibleType,localized:"preference.ai.native.chat.visible.type"}]}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.interface.quick.title"),preferences:[{id:o.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled,localized:"preference.ai.native.interface.quick.navigation"}]}),this.aiNativeConfigService.capabilities.supportsInlineCompletion&&(ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.intelligentCompletions.title"),preferences:[{id:o.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled,localized:"preference.ai.native.intelligentCompletions.cache.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,localized:"preference.ai.native.intelligentCompletions.debounceTime"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,localized:"preference.ai.native.intelligentCompletions.promptEngineering.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible,localized:"preference.ai.native.intelligentCompletions.alwaysVisible"}]}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.codeEdits.title"),preferences:[{id:o.AINativeSettingSectionsId.CodeEditsLintErrors,localized:"preference.ai.native.codeEdits.lintErrors"},{id:o.AINativeSettingSectionsId.CodeEditsLineChange,localized:"preference.ai.native.codeEdits.lineChange"},{id:o.AINativeSettingSectionsId.CodeEditsTyping,localized:"preference.ai.native.codeEdits.typing"},{id:o.AINativeSettingSectionsId.CodeEditsRenderType,localized:"preference.ai.native.codeEdits.renderType"},{id:o.AINativeSettingSectionsId.SystemPrompt,localized:"preference.ai.native.chat.system.prompt"}]})),this.aiNativeConfigService.capabilities.supportsCustomLLMSettings&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.llm.apiSettings.title"),preferences:[{id:o.AINativeSettingSectionsId.LLMModelSelection,localized:"preference.ai.native.llm.model.selection"},{id:o.AINativeSettingSectionsId.ModelID,localized:"preference.ai.native.llm.model.id"},{id:o.AINativeSettingSectionsId.DeepseekApiKey,localized:"preference.ai.native.deepseek.apiKey"},{id:o.AINativeSettingSectionsId.AnthropicApiKey,localized:"preference.ai.native.anthropic.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiApiKey,localized:"preference.ai.native.openai.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiBaseURL,localized:"preference.ai.native.openai.baseURL"}]}),this.aiNativeConfigService.capabilities.supportsMCP&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.mcp.settings.title"),preferences:[{id:o.AINativeSettingSectionsId.MCPServers,localized:"preference.ai.native.mcp.servers"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.inlineChat.title"),preferences:[{id:o.AINativeSettingSectionsId.InlineChatAutoVisible,localized:"preference.ai.native.inlineChat.auto.visible"},{id:o.AINativeSettingSectionsId.InlineChatCodeActionEnabled,localized:"preference.ai.native.inlineChat.codeAction.enabled"},{id:o.AINativeSettingSectionsId.InlineDiffPreviewMode,localized:"preference.ai.native.inlineDiff.preview.mode"}]})}registerEditorFeature(ne){ne.registerEditorFeatureContribution({contribute:he=>{const{monacoEditor:_e}=he;return this.codeActionSingleHandler.mountEditor(he.monacoEditor),_e.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(ne){ne.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:V.InlineDiffManager,displaysOnResource:he=>{var _e;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((_e=this.applyService.getUriCodeBlocks(he.uri))===null||_e===void 0)&&_e.filter(q=>q.status==="pending").length))}})}registerCommands(ne){ne.registerCommand(c.AI_INLINE_CHAT_VISIBLE,{execute:he=>{this.aiInlineChatService._onInlineChatVisible.fire(he)}}),ne.registerCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async he=>{var _e;if(!he){this.inlineInputService.hide();return}this.commandService.executeCommand(c.AI_INLINE_CHAT_VISIBLE.id,!1);const q=this.workbenchEditorService.currentCodeEditor;if(!q)return;const Re=q.monacoEditor.getPosition();if(!Re)return;const ve=q.monacoEditor.getSelection();if(Re?((_e=q.monacoEditor.getModel())===null||_e===void 0?void 0:_e.getLineLength(Re.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(Re);return}if(ve&&!ve.isEmpty()){this.inlineInputService.visibleBySelection(ve);return}this.inlineInputService.visibleByNearestCodeBlock(Re,q.monacoEditor)}}),ne.registerCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var he;const _e=this.workbenchEditorService.currentCodeEditor;_e&&((he=G.InlineInputController.get(_e.monacoEditor))===null||he===void 0||he.cancelToken())}}),ne.registerCommand(c.AI_INLINE_COMPLETION_REPORTER,{execute:(he,_e,q,Re)=>{this.aiCompletionsService.report({sessionId:_e,accept:q,relationId:he,code:Re})}}),ne.registerCommand(c.AI_CHAT_VISIBLE,{execute:he=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,_.isUndefined)(he)?!0:he)}}),ne.registerCommand(c.AI_INLINE_COMPLETION_VISIBLE,{execute:async he=>{he||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),ne.registerCommand(c.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:he=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(he)}}),ne.afterExecuteCommand(g.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(c.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(ne){this.designLayoutConfig.supportExternalChatPanel?ne.registerSlotRenderer(y.AI_CHAT_VIEW_ID,F.AIChatTabRendererWithTab):ne.registerSlotRenderer(y.AI_CHAT_VIEW_ID,F.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(ne.registerSlotRenderer(o.SlotLocation.left,F.AILeftTabRenderer),ne.registerSlotRenderer(o.SlotLocation.right,F.AIRightTabRenderer))}registerComponent(ne){ne.register(y.AI_CHAT_CONTAINER_ID,[],{component:w.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),ne.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:k.AIRunToolbar}),ne.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:L.AIChatLogoAvatar})}registerKeybindings(ne){this.aiNativeConfigService.capabilities.supportsInlineChat&&(ne.registerKeybinding({command:c.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),ne.registerKeybinding({command:c.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${p.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${p.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${p.InlineInputWidgetIsVisible.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${p.InlineInputWidgetIsStreaming.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${p.InlineHintWidgetIsVisible.raw} && ${p.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),ne.registerKeybinding({command:c.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=Q,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],Q.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],Q.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],Q.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(j.AINativeCoreContribution),n.__metadata("design:type",Object)],Q.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(j.MCPServerContribution),n.__metadata("design:type",Object)],Q.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(j.TokenMCPServerRegistry),n.__metadata("design:type",Object)],Q.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",U.InlineChatFeatureRegistry)],Q.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatRenderRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(_.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.TerminalRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ProblemFixRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],Q.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],Q.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(O.AICompletionsService),n.__metadata("design:type",O.AICompletionsService)],Q.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(D.AIInlineCompletionsProvider),n.__metadata("design:type",D.AIInlineCompletionsProvider)],Q.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(_.CommandService),n.__metadata("design:type",Object)],Q.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],Q.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],Q.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],Q.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],Q.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",S.ChatProxyService)],Q.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",X.InlineChatService)],Q.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(H.InlineInputService),n.__metadata("design:type",H.InlineInputService)],Q.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(K.InlineStreamDiffService),n.__metadata("design:type",K.InlineStreamDiffService)],Q.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(P.RenameSingleHandler),n.__metadata("design:type",P.RenameSingleHandler)],Q.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(T.CodeActionSingleHandler),n.__metadata("design:type",T.CodeActionSingleHandler)],Q.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],Q.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(f.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],Q.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",b.ChatManagerService)],Q.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",A.ChatInternalService)],Q.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(N.BaseApplyService),n.__metadata("design:type",N.BaseApplyService)],Q.prototype,"applyService",void 0),t.AINativeBrowserContribution=Q=n.__decorate([(0,o.Domain)(o.ClientAppContribution,a.BrowserEditorContribution,o.CommandContribution,d.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution),n.__metadata("design:paramtypes",[])],Q)},74055:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentService=void 0;const n=e(85608),r=n.__importDefault(e(66652)),o=e(76003),c=e(43718),p=e(46044),v=e(73307),m=e(29770);let _=class extends c.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new c.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new c.Emitter,this.onDidSendMessage=this._onDidSendMessage.event,this.addDispose(this._onDidChangeAgents),this.addDispose(this.contextService.onDidContextFilesChangeEvent(f=>{f.version!==this.contextVersion&&(this.contextVersion=f.version,this.shouldUpdateContext=!0)}))}registerAgent(f){if(this.agents.has(f.id))throw new Error(`Already registered an agent with id ${f.id}`);return this.agents.set(f.id,{agent:f,commands:[]}),this._onDidChangeAgents.fire(),(0,c.toDisposable)(()=>{this.agents.delete(f.id)&&this._onDidChangeAgents.fire()})}async updateAgent(f,a){const h=this.agents.get(f);if(!h)throw new Error(`No agent with id ${f} registered`);h.agent.metadata={...h.agent.metadata,...a},h.commands=await h.agent.provideSlashCommands(c.CancellationToken.None),a.isDefault&&(this.defaultAgentId=f);const u=await h.agent.provideChatWelcomeMessage(c.CancellationToken.None);if(u){const{content:d,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(d,E)}this._onDidChangeAgents.fire()}getAgents(){return Array.from(this.agents.values(),f=>f.agent)}hasAgent(f){return this.agents.has(f)}getDefaultAgentId(){return this.defaultAgentId}getAgent(f){const a=this.agents.get(f);return a?.agent}async invokeAgent(f,a,h,u,d){const E=this.agents.get(f);if(!E)throw new Error(`No agent with id ${f}`);if(this.initialUserMessageMap.has(a.sessionId))(this.shouldUpdateContext||a.regenerate||u.length===0)&&(a.message=this.provideContextMessage(a.message,a.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(a.sessionId,a.message);const l=a.message;a.message=this.provideContextMessage(l,a.sessionId)}return await E.agent.invoke(a,h,u,d)}provideContextMessage(f,a){const h=this.contextService.serialize(),u=this.promptProvider.provideContextPrompt(h,f);return this.aiReporter.send({msgType:c.AIServiceType.Chat,actionType:c.ActionTypeEnum.ContextEnhance,actionSource:c.ActionSourceEnum.Chat,sessionId:a,message:u}),u}populateChatInput(f,a){this.aiChatService.sendMessage({...a,agentId:f,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:f,commands:a})=>a.map(h=>({...h,agentId:f.id}))))}async getFollowups(f,a,h){const u=this.agents.get(f);if(!u)throw new Error(`No agent with id ${f}`);return u.agent.provideFollowups?u.agent.provideFollowups(a,h):[]}async getSampleQuestions(f,a){const h=this.agents.get(f);if(!h)throw new Error(`No agent with id ${f}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(a):[]}async getAllSampleQuestions(){const f=await Promise.all(Array.from(this.agents.values()).map(async({agent:a})=>{try{return await this.getSampleQuestions(a.id,c.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(f)}sendMessage(f){this._onDidSendMessage.fire(f)}parseMessage(f,a){var h;const u={agentId:"",command:"",message:f};let d=a;const E=this.getAgents(),g=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),l=u.message.match(g);if(l){const y=E.find(b=>b.id.toLowerCase()===l[1].toLowerCase());if(!y)return u;d=y.id,u.agentId=d,u.message=u.message.replace(l[0],"")}if(d){const y=(h=this.agents.get(d))===null||h===void 0?void 0:h.commands;if(y?.length){const b=new RegExp(`^/\\s?(${y.map(A=>A.name).join("|")})(?:\\s+|$)`,"i"),S=u.message.match(b);if(S){const A=y.find(w=>w.name.toLowerCase()===S[1].toLowerCase());if(!A)return u;u.command=A.name,u.message=u.message.replace(S[0],"")}}}return u}};t.ChatAgentService=_,n.__decorate([(0,o.Autowired)(c.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(c.IAIReporter),n.__metadata("design:type",Object)],_.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(p.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"contextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],_.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(c.ChatServiceToken),n.__metadata("design:type",m.ChatService)],_.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(c.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],_.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=_=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],_)},84543:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(19413),p=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(_){return this.componentsMap.set(_.id,_),this.componentsDeferredMap.has(_.id)&&(this.componentsDeferredMap.get(_.id).resolve(_),this.componentsDeferredMap.delete(_.id)),{dispose:()=>{this.componentsMap.get(_.id)===_&&(this.componentsMap.delete(_.id),this.componentsDeferredMap.delete(_.id))}}}getChatComponent(_){return this.componentsMap.has(_)?this.componentsMap.get(_):(this.componentsDeferredMap.has(_)||this.componentsDeferredMap.set(_,new o.Deferred),null)}getChatComponentDeferred(_){return this.componentsDeferredMap.get(_)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(_=>_.id!==p.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(c.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},61282:(x,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),c=e(76003),p=e(43718),v=e(19413),m=e(44260),_=e(42033),s=20;let f=class extends p.Disposable{fromJSON(h){return h.map(u=>{const d=new _.ChatModel({sessionId:u.sessionId,history:new m.MsgHistoryManager(u.history)}),E=u.requests.map(g=>new _.ChatRequestModel(g.requestId,d,g.message,new _.ChatResponseModel(g.requestId,d,g.message.agentId,{responseContents:g.response.responseContents,isComplete:!0,responseText:g.response.responseText,responseParts:g.response.responseParts,errorDetails:g.response.errorDetails,followups:g.response.followups,isCanceled:g.response.isCanceled})));return d.restoreRequests(E),d})}constructor(){super(),n.set(this,this.registerDispose(new p.DisposableMap)),r.set(this,this.registerDispose(new p.DisposableMap)),this.storageInitEmitter=new p.Emitter,this.onStorageInit=this.storageInitEmitter.event}async init(){this._chatStorage=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT);const h=this._chatStorage.get("sessionModels",[]);this.fromJSON(h).forEach(d=>{o.__classPrivateFieldGet(this,n,"f").set(d.sessionId,d),this.listenSession(d)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){if(o.__classPrivateFieldGet(this,n,"f").size>=s)throw new Error((0,p.formatLocalize)("aiNative.chat.session.max",s.toString()));const h=new _.ChatModel;return o.__classPrivateFieldGet(this,n,"f").set(h.sessionId,h),this.listenSession(h),h}getSession(h){return o.__classPrivateFieldGet(this,n,"f").get(h)}clearSession(h){var u;if(!o.__classPrivateFieldGet(this,n,"f").get(h))throw new Error(`Unknown session: ${h}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(h),(u=o.__classPrivateFieldGet(this,r,"f").get(h))===null||u===void 0||u.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(h),this.saveSessions()}createRequest(h,u,d,E){const g=this.getSession(h);if(!g)throw new Error(`Unknown session: ${h}`);if(!o.__classPrivateFieldGet(this,r,"f").has(h))return g.addRequest({prompt:u,agentId:d,command:E})}async sendRequest(h,u,d){const E=this.getSession(h);if(!E)throw new Error(`Unknown session: ${h}`);const g=new p.CancellationTokenSource,l=g.token;o.__classPrivateFieldGet(this,r,"f").set(E.sessionId,g);const y=l.onCancellationRequested(()=>{u.response.cancel()}),b=E.messageHistory;try{const S=T=>{l.isCancellationRequested||E.acceptResponseProgress(u,T)},A={sessionId:h,requestId:u.requestId,message:u.message.prompt,command:u.message.command,regenerate:d},w=await this.chatAgentService.invokeAgent(u.message.agentId,A,S,b,l);l.isCancellationRequested||(w.errorDetails&&u.response.setErrorDetails(w.errorDetails),this.chatAgentService.getFollowups(u.message.agentId,h,p.CancellationToken.None).then(D=>{u.response.setFollowups(D),u.response.complete()}))}finally{y.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(E.sessionId),this.saveSessions()}}listenSession(h){this.addDispose(h.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(h){var u;(u=o.__classPrivateFieldGet(this,r,"f").get(h))===null||u===void 0||u.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(h),this.saveSessions()}};t.ChatManagerService=f,n=new WeakMap,r=new WeakMap,o.__decorate([(0,c.Autowired)(c.INJECTOR_TOKEN),o.__metadata("design:type",c.Injector)],f.prototype,"injector",void 0),o.__decorate([(0,c.Autowired)(v.IChatAgentService),o.__metadata("design:type",Object)],f.prototype,"chatAgentService",void 0),o.__decorate([(0,c.Autowired)(p.StorageProvider),o.__metadata("design:type",Function)],f.prototype,"storageProvider",void 0),o.__decorate([(0,p.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],f.prototype,"saveSessions",null),t.ChatManagerService=f=o.__decorate([(0,c.Injectable)(),o.__metadata("design:paramtypes",[])],f)},42033:(x,t,e)=>{"use strict";var n,r,o,c,p,v,m,_,s,f,a,h,u,d,E;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatSlashCommandItemModel=t.ChatWelcomeMessageModel=t.ChatModel=t.ChatRequestModel=t.ChatResponseModel=void 0;const g=e(85608),l=e(76003),y=e(43718),b=e(90684),S=e(19413),A=e(44260);class w extends y.Disposable{get responseParts(){return g.__classPrivateFieldGet(this,r,"f")}get responseContents(){return g.__classPrivateFieldGet(this,o,"f")}get isComplete(){return g.__classPrivateFieldGet(this,c,"f")}get isCanceled(){return g.__classPrivateFieldGet(this,p,"f")}get requestId(){return g.__classPrivateFieldGet(this,v,"f")}get responseText(){return g.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return g.__classPrivateFieldGet(this,_,"f")}get followups(){return g.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return g.__classPrivateFieldGet(this,f,"f").event}constructor(R,P,k,F){super(),n.add(this),this.session=P,this.agentId=k,r.set(this,[]),o.set(this,[]),c.set(this,!1),p.set(this,!1),v.set(this,void 0),m.set(this,""),_.set(this,void 0),s.set(this,void 0),f.set(this,this.registerDispose(new y.Emitter)),g.__classPrivateFieldSet(this,v,R,"f"),F&&(g.__classPrivateFieldSet(this,o,F.responseContents,"f"),g.__classPrivateFieldSet(this,r,F.responseParts||[],"f"),g.__classPrivateFieldSet(this,m,F.responseText,"f"),g.__classPrivateFieldSet(this,c,F.isComplete,"f"),g.__classPrivateFieldSet(this,p,F.isCanceled,"f"),g.__classPrivateFieldSet(this,_,F.errorDetails,"f"),g.__classPrivateFieldSet(this,s,F.followups,"f"))}updateContent(R,P){var k;const F=g.__classPrivateFieldGet(this,r,"f").length-1;if(R.kind==="content"||R.kind==="markdownContent"){const L=g.__classPrivateFieldGet(this,r,"f")[F];!L||L.kind!=="markdownContent"?R.kind==="content"?g.__classPrivateFieldGet(this,r,"f").push({content:new b.MarkdownString(R.content),kind:"markdownContent"}):g.__classPrivateFieldGet(this,r,"f").push(R):R.kind==="markdownContent"?g.__classPrivateFieldGet(this,r,"f")[F]={content:new b.MarkdownString(L.content.value+R.content.value),kind:"markdownContent"}:g.__classPrivateFieldGet(this,r,"f")[F]={content:new b.MarkdownString(L.content.value+R.content,L.content),kind:"markdownContent"},g.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(R.kind==="asyncContent"){const L=g.__classPrivateFieldGet(this,r,"f").push(R)-1;g.__classPrivateFieldGet(this,n,"m",a).call(this),(k=R.resolvedContent)===null||k===void 0||k.then(N=>{typeof N=="string"?g.__classPrivateFieldGet(this,r,"f")[L]={content:new b.MarkdownString(N),kind:"markdownContent"}:(0,b.isMarkdownString)(N)?g.__classPrivateFieldGet(this,r,"f")[L]={content:N,kind:"markdownContent"}:g.__classPrivateFieldGet(this,r,"f")[L]=N,g.__classPrivateFieldGet(this,n,"m",a).call(this,P)})}else if(R.kind==="treeData"||R.kind==="component")g.__classPrivateFieldGet(this,r,"f").push(R),g.__classPrivateFieldGet(this,n,"m",a).call(this,P);else if(R.kind==="toolCall"){const L=g.__classPrivateFieldGet(this,r,"f").find(N=>N.kind==="toolCall"&&N.content.id===R.content.id);L?L.content=R.content:g.__classPrivateFieldGet(this,r,"f").push(R),g.__classPrivateFieldGet(this,n,"m",a).call(this,P)}}complete(){g.__classPrivateFieldSet(this,c,!0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}cancel(){g.__classPrivateFieldSet(this,c,!0,"f"),g.__classPrivateFieldSet(this,p,!0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}reset(){g.__classPrivateFieldSet(this,o,[],"f"),g.__classPrivateFieldSet(this,r,[],"f"),g.__classPrivateFieldSet(this,m,"","f"),g.__classPrivateFieldSet(this,p,!1,"f"),g.__classPrivateFieldSet(this,c,!1,"f"),g.__classPrivateFieldSet(this,_,void 0,"f"),g.__classPrivateFieldSet(this,s,void 0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}setErrorDetails(R){g.__classPrivateFieldSet(this,_,R,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}setFollowups(R){g.__classPrivateFieldSet(this,s,R,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}toJSON(){return{isCanceled:this.isCanceled,responseContents:this.responseContents,responseText:this.responseText,responseParts:this.responseParts,errorDetails:this.errorDetails,followups:this.followups}}}t.ChatResponseModel=w,r=new WeakMap,o=new WeakMap,c=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,_=new WeakMap,s=new WeakMap,f=new WeakMap,n=new WeakSet,a=function(R){g.__classPrivateFieldSet(this,m,g.__classPrivateFieldGet(this,r,"f").map(k=>k.kind==="asyncContent"?k.content:k.kind==="treeData"||k.kind==="component"?"":k.kind==="toolCall"?k.content.function.name:k.content.value).join(`
30160
+ ${JSON.stringify(r,null,2)}`);const c=n[o]();return new Language(INTERNAL,c)})}}class LookaheadIterable{constructor(t,e,n){assertInternal(t),this[0]=e,this.language=n}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(t){return C._ts_lookahead_iterator_reset_state(this[0],t)}reset(t,e){return!!C._ts_lookahead_iterator_reset(this[0],t[0],e)&&(this.language=t,!0)}[Symbol.iterator](){const t=this;return{next:()=>C._ts_lookahead_iterator_next(t[0])?{done:!1,value:t.currentType}:{done:!0,value:""}}}}class Query{constructor(t,e,n,r,o,c,p,v){assertInternal(t),this[0]=e,this.captureNames=n,this.textPredicates=r,this.predicates=o,this.setProperties=c,this.assertedProperties=p,this.refutedProperties=v,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:c=4294967295,maxStartDepth:p=4294967295}={}){if(typeof c!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,c,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=new Array(v);this.exceededMatchLimit=!!_;let f=0,a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const d=getValue(a,"i32");a+=SIZE_OF_INT;const E=new Array(d);if(a=unmarshalCaptures(this,t.tree,a,E),this.textPredicates[u].every(g=>g(E))){s[f]={pattern:u,captures:E};const g=this.setProperties[u];g&&(s[f].setProperties=g);const l=this.assertedProperties[u];l&&(s[f].assertedProperties=l);const y=this.refutedProperties[u];y&&(s[f].refutedProperties=y),f++}}return s.length=f,C._free(m),s}captures(t,{startPosition:e=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:r=0,endIndex:o=0,matchLimit:c=4294967295,maxStartDepth:p=4294967295}={}){if(typeof c!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],e.row,e.column,n.row,n.column,r,o,c,p);const v=getValue(TRANSFER_BUFFER,"i32"),m=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),_=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),s=[];this.exceededMatchLimit=!!_;const f=[];let a=m;for(let h=0;h<v;h++){const u=getValue(a,"i32");a+=SIZE_OF_INT;const d=getValue(a,"i32");a+=SIZE_OF_INT;const E=getValue(a,"i32");if(a+=SIZE_OF_INT,f.length=d,a=unmarshalCaptures(this,t.tree,a,f),this.textPredicates[u].every(g=>g(f))){const g=f[E],l=this.setProperties[u];l&&(g.setProperties=l);const y=this.assertedProperties[u];y&&(g.assertedProperties=y);const b=this.refutedProperties[u];b&&(g.refutedProperties=b),s.push(g)}}return C._free(m),s}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){const e=lengthBytesUTF8(t),n=C._malloc(e+1);stringToUTF8(t,n,e+1),C._ts_query_disable_capture(this[0],n,e),C._free(n)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(x,t,e){const n=e-t;let r=x.textCallback(t,null,e);for(t+=r.length;t<e;){const o=x.textCallback(t,null,e);if(!(o&&o.length>0))break;t+=o.length,r+=o}return t>e&&(r=r.slice(0,n)),r}function unmarshalCaptures(x,t,e,n){for(let r=0,o=n.length;r<o;r++){const c=getValue(e,"i32"),p=unmarshalNode(t,e+=SIZE_OF_INT);e+=SIZE_OF_NODE,n[r]={name:x.captureNames[c],node:p}}return e}function assertInternal(x){if(x!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(x){return x&&typeof x.row=="number"&&typeof x.column=="number"}function marshalNode(x){let t=TRANSFER_BUFFER;setValue(t,x.id,"i32"),t+=SIZE_OF_INT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.row,"i32"),t+=SIZE_OF_INT,setValue(t,x.startPosition.column,"i32"),t+=SIZE_OF_INT,setValue(t,x[0],"i32")}function unmarshalNode(x,t=TRANSFER_BUFFER){const e=getValue(t,"i32");if(e===0)return null;const n=getValue(t+=SIZE_OF_INT,"i32"),r=getValue(t+=SIZE_OF_INT,"i32"),o=getValue(t+=SIZE_OF_INT,"i32"),c=getValue(t+=SIZE_OF_INT,"i32"),p=new Node(INTERNAL,x);return p.id=e,p.startIndex=n,p.startPosition={row:r,column:o},p[0]=c,p}function marshalTreeCursor(x,t=TRANSFER_BUFFER){setValue(t+0*SIZE_OF_INT,x[0],"i32"),setValue(t+1*SIZE_OF_INT,x[1],"i32"),setValue(t+2*SIZE_OF_INT,x[2],"i32"),setValue(t+3*SIZE_OF_INT,x[3],"i32")}function unmarshalTreeCursor(x){x[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),x[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),x[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),x[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(x,t){setValue(x,t.row,"i32"),setValue(x+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(x){return{row:getValue(x,"i32")>>>0,column:getValue(x+SIZE_OF_INT,"i32")>>>0}}function marshalRange(x,t){marshalPoint(x,t.startPosition),marshalPoint(x+=SIZE_OF_POINT,t.endPosition),setValue(x+=SIZE_OF_POINT,t.startIndex,"i32"),setValue(x+=SIZE_OF_INT,t.endIndex,"i32"),x+=SIZE_OF_INT}function unmarshalRange(x){const t={};return t.startPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(x),x+=SIZE_OF_POINT,t.startIndex=getValue(x,"i32")>>>0,x+=SIZE_OF_INT,t.endIndex=getValue(x,"i32")>>>0,t}function marshalEdit(x){let t=TRANSFER_BUFFER;marshalPoint(t,x.startPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.oldEndPosition),t+=SIZE_OF_POINT,marshalPoint(t,x.newEndPosition),t+=SIZE_OF_POINT,setValue(t,x.startIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.oldEndIndex,"i32"),t+=SIZE_OF_INT,setValue(t,x.newEndIndex,"i32"),t+=SIZE_OF_INT}for(const x of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,x,{value:ParserImpl.prototype[x],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();module.exports=TreeSitter},52730:(x,t,e)=>{"use strict";var n=e(80705),r=e(14834),o=e(28498),c=e(79818),p=e(69336),v=c("Object.prototype.toString"),m=e(51913)(),_=typeof globalThis>"u"?e.g:globalThis,s=r(),f=c("String.prototype.slice"),a=Object.getPrototypeOf,h=c("Array.prototype.indexOf",!0)||function(l,y){for(var b=0;b<l.length;b+=1)if(l[b]===y)return b;return-1},u={__proto__:null};m&&p&&a?n(s,function(g){var l=new _[g];if(Symbol.toStringTag in l){var y=a(l),b=p(y,Symbol.toStringTag);if(!b){var S=a(y);b=p(S,Symbol.toStringTag)}u["$"+g]=o(b.get)}}):n(s,function(g){var l=new _[g],y=l.slice||l.set;y&&(u["$"+g]=o(y))});var d=function(l){var y=!1;return n(u,function(b,S){if(!y)try{"$"+b(l)===S&&(y=f(S,1))}catch{}}),y},E=function(l){var y=!1;return n(u,function(b,S){if(!y)try{b(l),y=f(S,1)}catch{}}),y};x.exports=function(l){if(!l||typeof l!="object")return!1;if(!m){var y=f(v(l),8,-1);return h(s,y)>-1?y:y!=="Object"?!1:E(l)}return p?d(l):null}},97442:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ZodError=t.quotelessJson=t.ZodIssueCode=void 0;const n=e(94705);t.ZodIssueCode=n.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);const r=c=>JSON.stringify(c,null,2).replace(/"([^"]+)":/g,"$1:");t.quotelessJson=r;class o extends Error{get errors(){return this.issues}constructor(p){super(),this.issues=[],this.addIssue=m=>{this.issues=[...this.issues,m]},this.addIssues=(m=[])=>{this.issues=[...this.issues,...m]};const v=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,v):this.__proto__=v,this.name="ZodError",this.issues=p}format(p){const v=p||function(s){return s.message},m={_errors:[]},_=s=>{for(const f of s.issues)if(f.code==="invalid_union")f.unionErrors.map(_);else if(f.code==="invalid_return_type")_(f.returnTypeError);else if(f.code==="invalid_arguments")_(f.argumentsError);else if(f.path.length===0)m._errors.push(v(f));else{let a=m,h=0;for(;h<f.path.length;){const u=f.path[h];h===f.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(v(f))):a[u]=a[u]||{_errors:[]},a=a[u],h++}}};return _(this),m}static assert(p){if(!(p instanceof o))throw new Error(`Not a ZodError: ${p}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,n.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(p=v=>v.message){const v={},m=[];for(const _ of this.issues)_.path.length>0?(v[_.path[0]]=v[_.path[0]]||[],v[_.path[0]].push(p(_))):m.push(p(_));return{formErrors:m,fieldErrors:v}}get formErrors(){return this.flatten()}}t.ZodError=o,o.create=c=>new o(c)},30548:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorMap=t.setErrorMap=t.defaultErrorMap=void 0;const r=n(e(28412));t.defaultErrorMap=r.default;let o=r.default;function c(v){o=v}t.setErrorMap=c;function p(){return o}t.getErrorMap=p},86340:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(o,c,p,v){v===void 0&&(v=p);var m=Object.getOwnPropertyDescriptor(c,p);(!m||("get"in m?!c.__esModule:m.writable||m.configurable))&&(m={enumerable:!0,get:function(){return c[p]}}),Object.defineProperty(o,v,m)}:function(o,c,p,v){v===void 0&&(v=p),o[v]=c[p]}),r=this&&this.__exportStar||function(o,c){for(var p in o)p!=="default"&&!Object.prototype.hasOwnProperty.call(c,p)&&n(c,o,p)};Object.defineProperty(t,"__esModule",{value:!0}),r(e(30548),t),r(e(66258),t),r(e(29201),t),r(e(94705),t),r(e(75226),t),r(e(97442),t)},15759:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorUtil=void 0;var e;(function(n){n.errToObj=r=>typeof r=="string"?{message:r}:r||{},n.toString=r=>typeof r=="string"?r:r?.message})(e||(t.errorUtil=e={}))},66258:function(x,t,e){"use strict";var n=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.isAsync=t.isValid=t.isDirty=t.isAborted=t.OK=t.DIRTY=t.INVALID=t.ParseStatus=t.addIssueToContext=t.EMPTY_PATH=t.makeIssue=void 0;const r=e(30548),o=n(e(28412)),c=u=>{const{data:d,path:E,errorMaps:g,issueData:l}=u,y=[...E,...l.path||[]],b={...l,path:y};if(l.message!==void 0)return{...l,path:y,message:l.message};let S="";const A=g.filter(w=>!!w).slice().reverse();for(const w of A)S=w(b,{data:d,defaultError:S}).message;return{...l,path:y,message:S}};t.makeIssue=c,t.EMPTY_PATH=[];function p(u,d){const E=(0,r.getErrorMap)(),g=(0,t.makeIssue)({issueData:d,data:u.data,path:u.path,errorMaps:[u.common.contextualErrorMap,u.schemaErrorMap,E,E===o.default?void 0:o.default].filter(l=>!!l)});u.common.issues.push(g)}t.addIssueToContext=p;class v{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(d,E){const g=[];for(const l of E){if(l.status==="aborted")return t.INVALID;l.status==="dirty"&&d.dirty(),g.push(l.value)}return{status:d.value,value:g}}static async mergeObjectAsync(d,E){const g=[];for(const l of E){const y=await l.key,b=await l.value;g.push({key:y,value:b})}return v.mergeObjectSync(d,g)}static mergeObjectSync(d,E){const g={};for(const l of E){const{key:y,value:b}=l;if(y.status==="aborted"||b.status==="aborted")return t.INVALID;y.status==="dirty"&&d.dirty(),b.status==="dirty"&&d.dirty(),y.value!=="__proto__"&&(typeof b.value<"u"||l.alwaysSet)&&(g[y.value]=b.value)}return{status:d.value,value:g}}}t.ParseStatus=v,t.INVALID=Object.freeze({status:"aborted"});const m=u=>({status:"dirty",value:u});t.DIRTY=m;const _=u=>({status:"valid",value:u});t.OK=_;const s=u=>u.status==="aborted";t.isAborted=s;const f=u=>u.status==="dirty";t.isDirty=f;const a=u=>u.status==="valid";t.isValid=a;const h=u=>typeof Promise<"u"&&u instanceof Promise;t.isAsync=h},29201:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0})},94705:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getParsedType=t.ZodParsedType=t.objectUtil=t.util=void 0;var e;(function(o){o.assertEqual=m=>m;function c(m){}o.assertIs=c;function p(m){throw new Error}o.assertNever=p,o.arrayToEnum=m=>{const _={};for(const s of m)_[s]=s;return _},o.getValidEnumValues=m=>{const _=o.objectKeys(m).filter(f=>typeof m[m[f]]!="number"),s={};for(const f of _)s[f]=m[f];return o.objectValues(s)},o.objectValues=m=>o.objectKeys(m).map(function(_){return m[_]}),o.objectKeys=typeof Object.keys=="function"?m=>Object.keys(m):m=>{const _=[];for(const s in m)Object.prototype.hasOwnProperty.call(m,s)&&_.push(s);return _},o.find=(m,_)=>{for(const s of m)if(_(s))return s},o.isInteger=typeof Number.isInteger=="function"?m=>Number.isInteger(m):m=>typeof m=="number"&&isFinite(m)&&Math.floor(m)===m;function v(m,_=" | "){return m.map(s=>typeof s=="string"?`'${s}'`:s).join(_)}o.joinValues=v,o.jsonStringifyReplacer=(m,_)=>typeof _=="bigint"?_.toString():_})(e||(t.util=e={}));var n;(function(o){o.mergeShapes=(c,p)=>({...c,...p})})(n||(t.objectUtil=n={})),t.ZodParsedType=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);const r=o=>{switch(typeof o){case"undefined":return t.ZodParsedType.undefined;case"string":return t.ZodParsedType.string;case"number":return isNaN(o)?t.ZodParsedType.nan:t.ZodParsedType.number;case"boolean":return t.ZodParsedType.boolean;case"function":return t.ZodParsedType.function;case"bigint":return t.ZodParsedType.bigint;case"symbol":return t.ZodParsedType.symbol;case"object":return Array.isArray(o)?t.ZodParsedType.array:o===null?t.ZodParsedType.null:o.then&&typeof o.then=="function"&&o.catch&&typeof o.catch=="function"?t.ZodParsedType.promise:typeof Map<"u"&&o instanceof Map?t.ZodParsedType.map:typeof Set<"u"&&o instanceof Set?t.ZodParsedType.set:typeof Date<"u"&&o instanceof Date?t.ZodParsedType.date:t.ZodParsedType.object;default:return t.ZodParsedType.unknown}};t.getParsedType=r},75995:function(x,t,e){"use strict";var n=this&&this.__createBinding||(Object.create?function(v,m,_,s){s===void 0&&(s=_);var f=Object.getOwnPropertyDescriptor(m,_);(!f||("get"in f?!m.__esModule:f.writable||f.configurable))&&(f={enumerable:!0,get:function(){return m[_]}}),Object.defineProperty(v,s,f)}:function(v,m,_,s){s===void 0&&(s=_),v[s]=m[_]}),r=this&&this.__setModuleDefault||(Object.create?function(v,m){Object.defineProperty(v,"default",{enumerable:!0,value:m})}:function(v,m){v.default=m}),o=this&&this.__importStar||function(v){if(v&&v.__esModule)return v;var m={};if(v!=null)for(var _ in v)_!=="default"&&Object.prototype.hasOwnProperty.call(v,_)&&n(m,v,_);return r(m,v),m},c=this&&this.__exportStar||function(v,m){for(var _ in v)_!=="default"&&!Object.prototype.hasOwnProperty.call(m,_)&&n(m,v,_)};Object.defineProperty(t,"__esModule",{value:!0}),t.z=void 0;const p=o(e(86340));t.z=p,c(e(86340),t),t.default=p},28412:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(94705),r=e(97442),o=(c,p)=>{let v;switch(c.code){case r.ZodIssueCode.invalid_type:c.received===n.ZodParsedType.undefined?v="Required":v=`Expected ${c.expected}, received ${c.received}`;break;case r.ZodIssueCode.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(c.expected,n.util.jsonStringifyReplacer)}`;break;case r.ZodIssueCode.unrecognized_keys:v=`Unrecognized key(s) in object: ${n.util.joinValues(c.keys,", ")}`;break;case r.ZodIssueCode.invalid_union:v="Invalid input";break;case r.ZodIssueCode.invalid_union_discriminator:v=`Invalid discriminator value. Expected ${n.util.joinValues(c.options)}`;break;case r.ZodIssueCode.invalid_enum_value:v=`Invalid enum value. Expected ${n.util.joinValues(c.options)}, received '${c.received}'`;break;case r.ZodIssueCode.invalid_arguments:v="Invalid function arguments";break;case r.ZodIssueCode.invalid_return_type:v="Invalid function return type";break;case r.ZodIssueCode.invalid_date:v="Invalid date";break;case r.ZodIssueCode.invalid_string:typeof c.validation=="object"?"includes"in c.validation?(v=`Invalid input: must include "${c.validation.includes}"`,typeof c.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${c.validation.position}`)):"startsWith"in c.validation?v=`Invalid input: must start with "${c.validation.startsWith}"`:"endsWith"in c.validation?v=`Invalid input: must end with "${c.validation.endsWith}"`:n.util.assertNever(c.validation):c.validation!=="regex"?v=`Invalid ${c.validation}`:v="Invalid";break;case r.ZodIssueCode.too_small:c.type==="array"?v=`Array must contain ${c.exact?"exactly":c.inclusive?"at least":"more than"} ${c.minimum} element(s)`:c.type==="string"?v=`String must contain ${c.exact?"exactly":c.inclusive?"at least":"over"} ${c.minimum} character(s)`:c.type==="number"?v=`Number must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${c.minimum}`:c.type==="date"?v=`Date must be ${c.exact?"exactly equal to ":c.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(c.minimum))}`:v="Invalid input";break;case r.ZodIssueCode.too_big:c.type==="array"?v=`Array must contain ${c.exact?"exactly":c.inclusive?"at most":"less than"} ${c.maximum} element(s)`:c.type==="string"?v=`String must contain ${c.exact?"exactly":c.inclusive?"at most":"under"} ${c.maximum} character(s)`:c.type==="number"?v=`Number must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="bigint"?v=`BigInt must be ${c.exact?"exactly":c.inclusive?"less than or equal to":"less than"} ${c.maximum}`:c.type==="date"?v=`Date must be ${c.exact?"exactly":c.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(c.maximum))}`:v="Invalid input";break;case r.ZodIssueCode.custom:v="Invalid input";break;case r.ZodIssueCode.invalid_intersection_types:v="Intersection results could not be merged";break;case r.ZodIssueCode.not_multiple_of:v=`Number must be a multiple of ${c.multipleOf}`;break;case r.ZodIssueCode.not_finite:v="Number must be finite";break;default:v=p.defaultError,n.util.assertNever(c)}return{message:v}};t.default=o},75226:function(x,t,e){"use strict";var n=this&&this.__classPrivateFieldGet||function(ln,at,Ht,on){if(Ht==="a"&&!on)throw new TypeError("Private accessor was defined without a getter");if(typeof at=="function"?ln!==at||!on:!at.has(ln))throw new TypeError("Cannot read private member from an object whose class did not declare it");return Ht==="m"?on:Ht==="a"?on.call(ln):on?on.value:at.get(ln)},r=this&&this.__classPrivateFieldSet||function(ln,at,Ht,on,xn){if(on==="m")throw new TypeError("Private method is not writable");if(on==="a"&&!xn)throw new TypeError("Private accessor was defined without a setter");if(typeof at=="function"?ln!==at||!xn:!at.has(ln))throw new TypeError("Cannot write private member to an object whose class did not declare it");return on==="a"?xn.call(ln,Ht):xn?xn.value=Ht:at.set(ln,Ht),Ht},o,c;Object.defineProperty(t,"__esModule",{value:!0}),t.boolean=t.bigint=t.array=t.any=t.coerce=t.ZodFirstPartyTypeKind=t.late=t.ZodSchema=t.Schema=t.custom=t.ZodReadonly=t.ZodPipeline=t.ZodBranded=t.BRAND=t.ZodNaN=t.ZodCatch=t.ZodDefault=t.ZodNullable=t.ZodOptional=t.ZodTransformer=t.ZodEffects=t.ZodPromise=t.ZodNativeEnum=t.ZodEnum=t.ZodLiteral=t.ZodLazy=t.ZodFunction=t.ZodSet=t.ZodMap=t.ZodRecord=t.ZodTuple=t.ZodIntersection=t.ZodDiscriminatedUnion=t.ZodUnion=t.ZodObject=t.ZodArray=t.ZodVoid=t.ZodNever=t.ZodUnknown=t.ZodAny=t.ZodNull=t.ZodUndefined=t.ZodSymbol=t.ZodDate=t.ZodBoolean=t.ZodBigInt=t.ZodNumber=t.ZodString=t.datetimeRegex=t.ZodType=void 0,t.NEVER=t.void=t.unknown=t.union=t.undefined=t.tuple=t.transformer=t.symbol=t.string=t.strictObject=t.set=t.record=t.promise=t.preprocess=t.pipeline=t.ostring=t.optional=t.onumber=t.oboolean=t.object=t.number=t.nullable=t.null=t.never=t.nativeEnum=t.nan=t.map=t.literal=t.lazy=t.intersection=t.instanceof=t.function=t.enum=t.effect=t.discriminatedUnion=t.date=void 0;const p=e(30548),v=e(15759),m=e(66258),_=e(94705),s=e(97442);class f{constructor(at,Ht,on,xn){this._cachedPath=[],this.parent=at,this.data=Ht,this._path=on,this._key=xn}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const a=(ln,at)=>{if((0,m.isValid)(at))return{success:!0,data:at.value};if(!ln.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const Ht=new s.ZodError(ln.common.issues);return this._error=Ht,this._error}}};function h(ln){if(!ln)return{};const{errorMap:at,invalid_type_error:Ht,required_error:on,description:xn}=ln;if(at&&(Ht||on))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return at?{errorMap:at,description:xn}:{errorMap:(Gi,Fi)=>{var oo,Mi;const{message:no}=ln;return Gi.code==="invalid_enum_value"?{message:no??Fi.defaultError}:typeof Fi.data>"u"?{message:(oo=no??on)!==null&&oo!==void 0?oo:Fi.defaultError}:Gi.code!=="invalid_type"?{message:Fi.defaultError}:{message:(Mi=no??Ht)!==null&&Mi!==void 0?Mi:Fi.defaultError}},description:xn}}class u{get description(){return this._def.description}_getType(at){return(0,_.getParsedType)(at.data)}_getOrReturnCtx(at,Ht){return Ht||{common:at.parent.common,data:at.data,parsedType:(0,_.getParsedType)(at.data),schemaErrorMap:this._def.errorMap,path:at.path,parent:at.parent}}_processInputParams(at){return{status:new m.ParseStatus,ctx:{common:at.parent.common,data:at.data,parsedType:(0,_.getParsedType)(at.data),schemaErrorMap:this._def.errorMap,path:at.path,parent:at.parent}}}_parseSync(at){const Ht=this._parse(at);if((0,m.isAsync)(Ht))throw new Error("Synchronous parse encountered promise.");return Ht}_parseAsync(at){const Ht=this._parse(at);return Promise.resolve(Ht)}parse(at,Ht){const on=this.safeParse(at,Ht);if(on.success)return on.data;throw on.error}safeParse(at,Ht){var on;const xn={common:{issues:[],async:(on=Ht?.async)!==null&&on!==void 0?on:!1,contextualErrorMap:Ht?.errorMap},path:Ht?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)},Zn=this._parseSync({data:at,path:xn.path,parent:xn});return a(xn,Zn)}"~validate"(at){var Ht,on;const xn={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)};if(!this["~standard"].async)try{const Zn=this._parseSync({data:at,path:[],parent:xn});return(0,m.isValid)(Zn)?{value:Zn.value}:{issues:xn.common.issues}}catch(Zn){!((on=(Ht=Zn?.message)===null||Ht===void 0?void 0:Ht.toLowerCase())===null||on===void 0)&&on.includes("encountered")&&(this["~standard"].async=!0),xn.common={issues:[],async:!0}}return this._parseAsync({data:at,path:[],parent:xn}).then(Zn=>(0,m.isValid)(Zn)?{value:Zn.value}:{issues:xn.common.issues})}async parseAsync(at,Ht){const on=await this.safeParseAsync(at,Ht);if(on.success)return on.data;throw on.error}async safeParseAsync(at,Ht){const on={common:{issues:[],contextualErrorMap:Ht?.errorMap,async:!0},path:Ht?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:at,parsedType:(0,_.getParsedType)(at)},xn=this._parse({data:at,path:on.path,parent:on}),Zn=await((0,m.isAsync)(xn)?xn:Promise.resolve(xn));return a(on,Zn)}refine(at,Ht){const on=xn=>typeof Ht=="string"||typeof Ht>"u"?{message:Ht}:typeof Ht=="function"?Ht(xn):Ht;return this._refinement((xn,Zn)=>{const Gi=at(xn),Fi=()=>Zn.addIssue({code:s.ZodIssueCode.custom,...on(xn)});return typeof Promise<"u"&&Gi instanceof Promise?Gi.then(oo=>oo?!0:(Fi(),!1)):Gi?!0:(Fi(),!1)})}refinement(at,Ht){return this._refinement((on,xn)=>at(on)?!0:(xn.addIssue(typeof Ht=="function"?Ht(on,xn):Ht),!1))}_refinement(at){return new $e({schema:this,typeName:bt.ZodEffects,effect:{type:"refinement",refinement:at}})}superRefine(at){return this._refinement(at)}constructor(at){this.spa=this.safeParseAsync,this._def=at,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:Ht=>this["~validate"](Ht)}}optional(){return Ve.create(this,this._def)}nullable(){return lt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Re.create(this)}promise(){return Ue.create(this,this._def)}or(at){return fe.create([this,at],this._def)}and(at){return Se.create(this,at,this._def)}transform(at){return new $e({...h(this._def),schema:this,typeName:bt.ZodEffects,effect:{type:"transform",transform:at}})}default(at){const Ht=typeof at=="function"?at:()=>at;return new qe({...h(this._def),innerType:this,defaultValue:Ht,typeName:bt.ZodDefault})}brand(){return new St({typeName:bt.ZodBranded,type:this,...h(this._def)})}catch(at){const Ht=typeof at=="function"?at:()=>at;return new Rt({...h(this._def),innerType:this,catchValue:Ht,typeName:bt.ZodCatch})}describe(at){const Ht=this.constructor;return new Ht({...this._def,description:at})}pipe(at){return it.create(this,at)}readonly(){return st.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}t.ZodType=u,t.Schema=u,t.ZodSchema=u;const d=/^c[^\s-]{8,}$/i,E=/^[0-9a-z]+$/,g=/^[0-9A-HJKMNP-TV-Z]{26}$/i,l=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,y=/^[a-z0-9_-]{21}$/i,b=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,S=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,A=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,w="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let T;const D=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,I=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,O=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,M=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,R=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,P=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",F=new RegExp(`^${k}$`);function L(ln){let at="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return ln.precision?at=`${at}\\.\\d{${ln.precision}}`:ln.precision==null&&(at=`${at}(\\.\\d+)?`),at}function N(ln){return new RegExp(`^${L(ln)}$`)}function j(ln){let at=`${k}T${L(ln)}`;const Ht=[];return Ht.push(ln.local?"Z?":"Z"),ln.offset&&Ht.push("([+-]\\d{2}:?\\d{2})"),at=`${at}(${Ht.join("|")})`,new RegExp(`^${at}$`)}t.datetimeRegex=j;function W(ln,at){return!!((at==="v4"||!at)&&D.test(ln)||(at==="v6"||!at)&&O.test(ln))}function U(ln,at){if(!b.test(ln))return!1;try{const[Ht]=ln.split("."),on=Ht.replace(/-/g,"+").replace(/_/g,"/").padEnd(Ht.length+(4-Ht.length%4)%4,"="),xn=JSON.parse(atob(on));return!(typeof xn!="object"||xn===null||!xn.typ||!xn.alg||at&&xn.alg!==at)}catch{return!1}}function X(ln,at){return!!((at==="v4"||!at)&&I.test(ln)||(at==="v6"||!at)&&M.test(ln))}class V extends u{_parse(at){if(this._def.coerce&&(at.data=String(at.data)),this._getType(at)!==_.ZodParsedType.string){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.string,received:Zn.parsedType}),m.INVALID}const on=new m.ParseStatus;let xn;for(const Zn of this._def.checks)if(Zn.kind==="min")at.data.length<Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"string",inclusive:!0,exact:!1,message:Zn.message}),on.dirty());else if(Zn.kind==="max")at.data.length>Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"string",inclusive:!0,exact:!1,message:Zn.message}),on.dirty());else if(Zn.kind==="length"){const Gi=at.data.length>Zn.value,Fi=at.data.length<Zn.value;(Gi||Fi)&&(xn=this._getOrReturnCtx(at,xn),Gi?(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"string",inclusive:!0,exact:!0,message:Zn.message}):Fi&&(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"string",inclusive:!0,exact:!0,message:Zn.message}),on.dirty())}else if(Zn.kind==="email")A.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"email",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="emoji")T||(T=new RegExp(w,"u")),T.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"emoji",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="uuid")l.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"uuid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="nanoid")y.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"nanoid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="cuid")d.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cuid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="cuid2")E.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cuid2",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="ulid")g.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"ulid",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty());else if(Zn.kind==="url")try{new URL(at.data)}catch{xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"url",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()}else Zn.kind==="regex"?(Zn.regex.lastIndex=0,Zn.regex.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"regex",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty())):Zn.kind==="trim"?at.data=at.data.trim():Zn.kind==="includes"?at.data.includes(Zn.value,Zn.position)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{includes:Zn.value,position:Zn.position},message:Zn.message}),on.dirty()):Zn.kind==="toLowerCase"?at.data=at.data.toLowerCase():Zn.kind==="toUpperCase"?at.data=at.data.toUpperCase():Zn.kind==="startsWith"?at.data.startsWith(Zn.value)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{startsWith:Zn.value},message:Zn.message}),on.dirty()):Zn.kind==="endsWith"?at.data.endsWith(Zn.value)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:{endsWith:Zn.value},message:Zn.message}),on.dirty()):Zn.kind==="datetime"?j(Zn).test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"datetime",message:Zn.message}),on.dirty()):Zn.kind==="date"?F.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"date",message:Zn.message}),on.dirty()):Zn.kind==="time"?N(Zn).test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.invalid_string,validation:"time",message:Zn.message}),on.dirty()):Zn.kind==="duration"?S.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"duration",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="ip"?W(at.data,Zn.version)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"ip",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="jwt"?U(at.data,Zn.alg)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"jwt",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="cidr"?X(at.data,Zn.version)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"cidr",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="base64"?R.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"base64",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):Zn.kind==="base64url"?P.test(at.data)||(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{validation:"base64url",code:s.ZodIssueCode.invalid_string,message:Zn.message}),on.dirty()):_.util.assertNever(Zn);return{status:on.value,value:at.data}}_regex(at,Ht,on){return this.refinement(xn=>at.test(xn),{validation:Ht,code:s.ZodIssueCode.invalid_string,...v.errorUtil.errToObj(on)})}_addCheck(at){return new V({...this._def,checks:[...this._def.checks,at]})}email(at){return this._addCheck({kind:"email",...v.errorUtil.errToObj(at)})}url(at){return this._addCheck({kind:"url",...v.errorUtil.errToObj(at)})}emoji(at){return this._addCheck({kind:"emoji",...v.errorUtil.errToObj(at)})}uuid(at){return this._addCheck({kind:"uuid",...v.errorUtil.errToObj(at)})}nanoid(at){return this._addCheck({kind:"nanoid",...v.errorUtil.errToObj(at)})}cuid(at){return this._addCheck({kind:"cuid",...v.errorUtil.errToObj(at)})}cuid2(at){return this._addCheck({kind:"cuid2",...v.errorUtil.errToObj(at)})}ulid(at){return this._addCheck({kind:"ulid",...v.errorUtil.errToObj(at)})}base64(at){return this._addCheck({kind:"base64",...v.errorUtil.errToObj(at)})}base64url(at){return this._addCheck({kind:"base64url",...v.errorUtil.errToObj(at)})}jwt(at){return this._addCheck({kind:"jwt",...v.errorUtil.errToObj(at)})}ip(at){return this._addCheck({kind:"ip",...v.errorUtil.errToObj(at)})}cidr(at){return this._addCheck({kind:"cidr",...v.errorUtil.errToObj(at)})}datetime(at){var Ht,on;return typeof at=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:at}):this._addCheck({kind:"datetime",precision:typeof at?.precision>"u"?null:at?.precision,offset:(Ht=at?.offset)!==null&&Ht!==void 0?Ht:!1,local:(on=at?.local)!==null&&on!==void 0?on:!1,...v.errorUtil.errToObj(at?.message)})}date(at){return this._addCheck({kind:"date",message:at})}time(at){return typeof at=="string"?this._addCheck({kind:"time",precision:null,message:at}):this._addCheck({kind:"time",precision:typeof at?.precision>"u"?null:at?.precision,...v.errorUtil.errToObj(at?.message)})}duration(at){return this._addCheck({kind:"duration",...v.errorUtil.errToObj(at)})}regex(at,Ht){return this._addCheck({kind:"regex",regex:at,...v.errorUtil.errToObj(Ht)})}includes(at,Ht){return this._addCheck({kind:"includes",value:at,position:Ht?.position,...v.errorUtil.errToObj(Ht?.message)})}startsWith(at,Ht){return this._addCheck({kind:"startsWith",value:at,...v.errorUtil.errToObj(Ht)})}endsWith(at,Ht){return this._addCheck({kind:"endsWith",value:at,...v.errorUtil.errToObj(Ht)})}min(at,Ht){return this._addCheck({kind:"min",value:at,...v.errorUtil.errToObj(Ht)})}max(at,Ht){return this._addCheck({kind:"max",value:at,...v.errorUtil.errToObj(Ht)})}length(at,Ht){return this._addCheck({kind:"length",value:at,...v.errorUtil.errToObj(Ht)})}nonempty(at){return this.min(1,v.errorUtil.errToObj(at))}trim(){return new V({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new V({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(at=>at.kind==="datetime")}get isDate(){return!!this._def.checks.find(at=>at.kind==="date")}get isTime(){return!!this._def.checks.find(at=>at.kind==="time")}get isDuration(){return!!this._def.checks.find(at=>at.kind==="duration")}get isEmail(){return!!this._def.checks.find(at=>at.kind==="email")}get isURL(){return!!this._def.checks.find(at=>at.kind==="url")}get isEmoji(){return!!this._def.checks.find(at=>at.kind==="emoji")}get isUUID(){return!!this._def.checks.find(at=>at.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(at=>at.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(at=>at.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(at=>at.kind==="cuid2")}get isULID(){return!!this._def.checks.find(at=>at.kind==="ulid")}get isIP(){return!!this._def.checks.find(at=>at.kind==="ip")}get isCIDR(){return!!this._def.checks.find(at=>at.kind==="cidr")}get isBase64(){return!!this._def.checks.find(at=>at.kind==="base64")}get isBase64url(){return!!this._def.checks.find(at=>at.kind==="base64url")}get minLength(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxLength(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}}t.ZodString=V,V.create=ln=>{var at;return new V({checks:[],typeName:bt.ZodString,coerce:(at=ln?.coerce)!==null&&at!==void 0?at:!1,...h(ln)})};function $(ln,at){const Ht=(ln.toString().split(".")[1]||"").length,on=(at.toString().split(".")[1]||"").length,xn=Ht>on?Ht:on,Zn=parseInt(ln.toFixed(xn).replace(".","")),Gi=parseInt(at.toFixed(xn).replace(".",""));return Zn%Gi/Math.pow(10,xn)}class Y extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(at){if(this._def.coerce&&(at.data=Number(at.data)),this._getType(at)!==_.ZodParsedType.number){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.number,received:Zn.parsedType}),m.INVALID}let on;const xn=new m.ParseStatus;for(const Zn of this._def.checks)Zn.kind==="int"?_.util.isInteger(at.data)||(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:Zn.message}),xn.dirty()):Zn.kind==="min"?(Zn.inclusive?at.data<Zn.value:at.data<=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:Zn.value,type:"number",inclusive:Zn.inclusive,exact:!1,message:Zn.message}),xn.dirty()):Zn.kind==="max"?(Zn.inclusive?at.data>Zn.value:at.data>=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:Zn.value,type:"number",inclusive:Zn.inclusive,exact:!1,message:Zn.message}),xn.dirty()):Zn.kind==="multipleOf"?$(at.data,Zn.value)!==0&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Zn.value,message:Zn.message}),xn.dirty()):Zn.kind==="finite"?Number.isFinite(at.data)||(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_finite,message:Zn.message}),xn.dirty()):_.util.assertNever(Zn);return{status:xn.value,value:at.data}}gte(at,Ht){return this.setLimit("min",at,!0,v.errorUtil.toString(Ht))}gt(at,Ht){return this.setLimit("min",at,!1,v.errorUtil.toString(Ht))}lte(at,Ht){return this.setLimit("max",at,!0,v.errorUtil.toString(Ht))}lt(at,Ht){return this.setLimit("max",at,!1,v.errorUtil.toString(Ht))}setLimit(at,Ht,on,xn){return new Y({...this._def,checks:[...this._def.checks,{kind:at,value:Ht,inclusive:on,message:v.errorUtil.toString(xn)}]})}_addCheck(at){return new Y({...this._def,checks:[...this._def.checks,at]})}int(at){return this._addCheck({kind:"int",message:v.errorUtil.toString(at)})}positive(at){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.errorUtil.toString(at)})}negative(at){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.errorUtil.toString(at)})}nonpositive(at){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.errorUtil.toString(at)})}nonnegative(at){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.errorUtil.toString(at)})}multipleOf(at,Ht){return this._addCheck({kind:"multipleOf",value:at,message:v.errorUtil.toString(Ht)})}finite(at){return this._addCheck({kind:"finite",message:v.errorUtil.toString(at)})}safe(at){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.errorUtil.toString(at)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.errorUtil.toString(at)})}get minValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}get isInt(){return!!this._def.checks.find(at=>at.kind==="int"||at.kind==="multipleOf"&&_.util.isInteger(at.value))}get isFinite(){let at=null,Ht=null;for(const on of this._def.checks){if(on.kind==="finite"||on.kind==="int"||on.kind==="multipleOf")return!0;on.kind==="min"?(Ht===null||on.value>Ht)&&(Ht=on.value):on.kind==="max"&&(at===null||on.value<at)&&(at=on.value)}return Number.isFinite(Ht)&&Number.isFinite(at)}}t.ZodNumber=Y,Y.create=ln=>new Y({checks:[],typeName:bt.ZodNumber,coerce:ln?.coerce||!1,...h(ln)});class G extends u{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(at){if(this._def.coerce)try{at.data=BigInt(at.data)}catch{return this._getInvalidInput(at)}if(this._getType(at)!==_.ZodParsedType.bigint)return this._getInvalidInput(at);let on;const xn=new m.ParseStatus;for(const Zn of this._def.checks)Zn.kind==="min"?(Zn.inclusive?at.data<Zn.value:at.data<=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,type:"bigint",minimum:Zn.value,inclusive:Zn.inclusive,message:Zn.message}),xn.dirty()):Zn.kind==="max"?(Zn.inclusive?at.data>Zn.value:at.data>=Zn.value)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,type:"bigint",maximum:Zn.value,inclusive:Zn.inclusive,message:Zn.message}),xn.dirty()):Zn.kind==="multipleOf"?at.data%Zn.value!==BigInt(0)&&(on=this._getOrReturnCtx(at,on),(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.not_multiple_of,multipleOf:Zn.value,message:Zn.message}),xn.dirty()):_.util.assertNever(Zn);return{status:xn.value,value:at.data}}_getInvalidInput(at){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.bigint,received:Ht.parsedType}),m.INVALID}gte(at,Ht){return this.setLimit("min",at,!0,v.errorUtil.toString(Ht))}gt(at,Ht){return this.setLimit("min",at,!1,v.errorUtil.toString(Ht))}lte(at,Ht){return this.setLimit("max",at,!0,v.errorUtil.toString(Ht))}lt(at,Ht){return this.setLimit("max",at,!1,v.errorUtil.toString(Ht))}setLimit(at,Ht,on,xn){return new G({...this._def,checks:[...this._def.checks,{kind:at,value:Ht,inclusive:on,message:v.errorUtil.toString(xn)}]})}_addCheck(at){return new G({...this._def,checks:[...this._def.checks,at]})}positive(at){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(at)})}negative(at){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.errorUtil.toString(at)})}nonpositive(at){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(at)})}nonnegative(at){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.errorUtil.toString(at)})}multipleOf(at,Ht){return this._addCheck({kind:"multipleOf",value:at,message:v.errorUtil.toString(Ht)})}get minValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at}get maxValue(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at}}t.ZodBigInt=G,G.create=ln=>{var at;return new G({checks:[],typeName:bt.ZodBigInt,coerce:(at=ln?.coerce)!==null&&at!==void 0?at:!1,...h(ln)})};class H extends u{_parse(at){if(this._def.coerce&&(at.data=!!at.data),this._getType(at)!==_.ZodParsedType.boolean){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.boolean,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodBoolean=H,H.create=ln=>new H({typeName:bt.ZodBoolean,coerce:ln?.coerce||!1,...h(ln)});class K extends u{_parse(at){if(this._def.coerce&&(at.data=new Date(at.data)),this._getType(at)!==_.ZodParsedType.date){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.date,received:Zn.parsedType}),m.INVALID}if(isNaN(at.data.getTime())){const Zn=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Zn,{code:s.ZodIssueCode.invalid_date}),m.INVALID}const on=new m.ParseStatus;let xn;for(const Zn of this._def.checks)Zn.kind==="min"?at.data.getTime()<Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_small,message:Zn.message,inclusive:!0,exact:!1,minimum:Zn.value,type:"date"}),on.dirty()):Zn.kind==="max"?at.data.getTime()>Zn.value&&(xn=this._getOrReturnCtx(at,xn),(0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.too_big,message:Zn.message,inclusive:!0,exact:!1,maximum:Zn.value,type:"date"}),on.dirty()):_.util.assertNever(Zn);return{status:on.value,value:new Date(at.data.getTime())}}_addCheck(at){return new K({...this._def,checks:[...this._def.checks,at]})}min(at,Ht){return this._addCheck({kind:"min",value:at.getTime(),message:v.errorUtil.toString(Ht)})}max(at,Ht){return this._addCheck({kind:"max",value:at.getTime(),message:v.errorUtil.toString(Ht)})}get minDate(){let at=null;for(const Ht of this._def.checks)Ht.kind==="min"&&(at===null||Ht.value>at)&&(at=Ht.value);return at!=null?new Date(at):null}get maxDate(){let at=null;for(const Ht of this._def.checks)Ht.kind==="max"&&(at===null||Ht.value<at)&&(at=Ht.value);return at!=null?new Date(at):null}}t.ZodDate=K,K.create=ln=>new K({checks:[],coerce:ln?.coerce||!1,typeName:bt.ZodDate,...h(ln)});class Z extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.symbol){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.symbol,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodSymbol=Z,Z.create=ln=>new Z({typeName:bt.ZodSymbol,...h(ln)});class Q extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.undefined){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.undefined,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodUndefined=Q,Q.create=ln=>new Q({typeName:bt.ZodUndefined,...h(ln)});class oe extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.null){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.null,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodNull=oe,oe.create=ln=>new oe({typeName:bt.ZodNull,...h(ln)});class ne extends u{constructor(){super(...arguments),this._any=!0}_parse(at){return(0,m.OK)(at.data)}}t.ZodAny=ne,ne.create=ln=>new ne({typeName:bt.ZodAny,...h(ln)});class he extends u{constructor(){super(...arguments),this._unknown=!0}_parse(at){return(0,m.OK)(at.data)}}t.ZodUnknown=he,he.create=ln=>new he({typeName:bt.ZodUnknown,...h(ln)});class _e extends u{_parse(at){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.never,received:Ht.parsedType}),m.INVALID}}t.ZodNever=_e,_e.create=ln=>new _e({typeName:bt.ZodNever,...h(ln)});class q extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.undefined){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.void,received:on.parsedType}),m.INVALID}return(0,m.OK)(at.data)}}t.ZodVoid=q,q.create=ln=>new q({typeName:bt.ZodVoid,...h(ln)});class Re extends u{_parse(at){const{ctx:Ht,status:on}=this._processInputParams(at),xn=this._def;if(Ht.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:Ht.parsedType}),m.INVALID;if(xn.exactLength!==null){const Gi=Ht.data.length>xn.exactLength.value,Fi=Ht.data.length<xn.exactLength.value;(Gi||Fi)&&((0,m.addIssueToContext)(Ht,{code:Gi?s.ZodIssueCode.too_big:s.ZodIssueCode.too_small,minimum:Fi?xn.exactLength.value:void 0,maximum:Gi?xn.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:xn.exactLength.message}),on.dirty())}if(xn.minLength!==null&&Ht.data.length<xn.minLength.value&&((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.too_small,minimum:xn.minLength.value,type:"array",inclusive:!0,exact:!1,message:xn.minLength.message}),on.dirty()),xn.maxLength!==null&&Ht.data.length>xn.maxLength.value&&((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.too_big,maximum:xn.maxLength.value,type:"array",inclusive:!0,exact:!1,message:xn.maxLength.message}),on.dirty()),Ht.common.async)return Promise.all([...Ht.data].map((Gi,Fi)=>xn.type._parseAsync(new f(Ht,Gi,Ht.path,Fi)))).then(Gi=>m.ParseStatus.mergeArray(on,Gi));const Zn=[...Ht.data].map((Gi,Fi)=>xn.type._parseSync(new f(Ht,Gi,Ht.path,Fi)));return m.ParseStatus.mergeArray(on,Zn)}get element(){return this._def.type}min(at,Ht){return new Re({...this._def,minLength:{value:at,message:v.errorUtil.toString(Ht)}})}max(at,Ht){return new Re({...this._def,maxLength:{value:at,message:v.errorUtil.toString(Ht)}})}length(at,Ht){return new Re({...this._def,exactLength:{value:at,message:v.errorUtil.toString(Ht)}})}nonempty(at){return this.min(1,at)}}t.ZodArray=Re,Re.create=(ln,at)=>new Re({type:ln,minLength:null,maxLength:null,exactLength:null,typeName:bt.ZodArray,...h(at)});function ve(ln){if(ln instanceof ie){const at={};for(const Ht in ln.shape){const on=ln.shape[Ht];at[Ht]=Ve.create(ve(on))}return new ie({...ln._def,shape:()=>at})}else return ln instanceof Re?new Re({...ln._def,type:ve(ln.element)}):ln instanceof Ve?Ve.create(ve(ln.unwrap())):ln instanceof lt?lt.create(ve(ln.unwrap())):ln instanceof Ee?Ee.create(ln.items.map(at=>ve(at))):ln}class ie extends u{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const at=this._def.shape(),Ht=_.util.objectKeys(at);return this._cached={shape:at,keys:Ht}}_parse(at){if(this._getType(at)!==_.ZodParsedType.object){const Mi=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Mi,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Mi.parsedType}),m.INVALID}const{status:on,ctx:xn}=this._processInputParams(at),{shape:Zn,keys:Gi}=this._getCached(),Fi=[];if(!(this._def.catchall instanceof _e&&this._def.unknownKeys==="strip"))for(const Mi in xn.data)Gi.includes(Mi)||Fi.push(Mi);const oo=[];for(const Mi of Gi){const no=Zn[Mi],uo=xn.data[Mi];oo.push({key:{status:"valid",value:Mi},value:no._parse(new f(xn,uo,xn.path,Mi)),alwaysSet:Mi in xn.data})}if(this._def.catchall instanceof _e){const Mi=this._def.unknownKeys;if(Mi==="passthrough")for(const no of Fi)oo.push({key:{status:"valid",value:no},value:{status:"valid",value:xn.data[no]}});else if(Mi==="strict")Fi.length>0&&((0,m.addIssueToContext)(xn,{code:s.ZodIssueCode.unrecognized_keys,keys:Fi}),on.dirty());else if(Mi!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const Mi=this._def.catchall;for(const no of Fi){const uo=xn.data[no];oo.push({key:{status:"valid",value:no},value:Mi._parse(new f(xn,uo,xn.path,no)),alwaysSet:no in xn.data})}}return xn.common.async?Promise.resolve().then(async()=>{const Mi=[];for(const no of oo){const uo=await no.key,Do=await no.value;Mi.push({key:uo,value:Do,alwaysSet:no.alwaysSet})}return Mi}).then(Mi=>m.ParseStatus.mergeObjectSync(on,Mi)):m.ParseStatus.mergeObjectSync(on,oo)}get shape(){return this._def.shape()}strict(at){return v.errorUtil.errToObj,new ie({...this._def,unknownKeys:"strict",...at!==void 0?{errorMap:(Ht,on)=>{var xn,Zn,Gi,Fi;const oo=(Gi=(Zn=(xn=this._def).errorMap)===null||Zn===void 0?void 0:Zn.call(xn,Ht,on).message)!==null&&Gi!==void 0?Gi:on.defaultError;return Ht.code==="unrecognized_keys"?{message:(Fi=v.errorUtil.errToObj(at).message)!==null&&Fi!==void 0?Fi:oo}:{message:oo}}}:{}})}strip(){return new ie({...this._def,unknownKeys:"strip"})}passthrough(){return new ie({...this._def,unknownKeys:"passthrough"})}extend(at){return new ie({...this._def,shape:()=>({...this._def.shape(),...at})})}merge(at){return new ie({unknownKeys:at._def.unknownKeys,catchall:at._def.catchall,shape:()=>({...this._def.shape(),...at._def.shape()}),typeName:bt.ZodObject})}setKey(at,Ht){return this.augment({[at]:Ht})}catchall(at){return new ie({...this._def,catchall:at})}pick(at){const Ht={};return _.util.objectKeys(at).forEach(on=>{at[on]&&this.shape[on]&&(Ht[on]=this.shape[on])}),new ie({...this._def,shape:()=>Ht})}omit(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{at[on]||(Ht[on]=this.shape[on])}),new ie({...this._def,shape:()=>Ht})}deepPartial(){return ve(this)}partial(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{const xn=this.shape[on];at&&!at[on]?Ht[on]=xn:Ht[on]=xn.optional()}),new ie({...this._def,shape:()=>Ht})}required(at){const Ht={};return _.util.objectKeys(this.shape).forEach(on=>{if(at&&!at[on])Ht[on]=this.shape[on];else{let Zn=this.shape[on];for(;Zn instanceof Ve;)Zn=Zn._def.innerType;Ht[on]=Zn}}),new ie({...this._def,shape:()=>Ht})}keyof(){return ue(_.util.objectKeys(this.shape))}}t.ZodObject=ie,ie.create=(ln,at)=>new ie({shape:()=>ln,unknownKeys:"strip",catchall:_e.create(),typeName:bt.ZodObject,...h(at)}),ie.strictCreate=(ln,at)=>new ie({shape:()=>ln,unknownKeys:"strict",catchall:_e.create(),typeName:bt.ZodObject,...h(at)}),ie.lazycreate=(ln,at)=>new ie({shape:ln,unknownKeys:"strip",catchall:_e.create(),typeName:bt.ZodObject,...h(at)});class fe extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on=this._def.options;function xn(Zn){for(const Fi of Zn)if(Fi.result.status==="valid")return Fi.result;for(const Fi of Zn)if(Fi.result.status==="dirty")return Ht.common.issues.push(...Fi.ctx.common.issues),Fi.result;const Gi=Zn.map(Fi=>new s.ZodError(Fi.ctx.common.issues));return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union,unionErrors:Gi}),m.INVALID}if(Ht.common.async)return Promise.all(on.map(async Zn=>{const Gi={...Ht,common:{...Ht.common,issues:[]},parent:null};return{result:await Zn._parseAsync({data:Ht.data,path:Ht.path,parent:Gi}),ctx:Gi}})).then(xn);{let Zn;const Gi=[];for(const oo of on){const Mi={...Ht,common:{...Ht.common,issues:[]},parent:null},no=oo._parseSync({data:Ht.data,path:Ht.path,parent:Mi});if(no.status==="valid")return no;no.status==="dirty"&&!Zn&&(Zn={result:no,ctx:Mi}),Mi.common.issues.length&&Gi.push(Mi.common.issues)}if(Zn)return Ht.common.issues.push(...Zn.ctx.common.issues),Zn.result;const Fi=Gi.map(oo=>new s.ZodError(oo));return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union,unionErrors:Fi}),m.INVALID}}get options(){return this._def.options}}t.ZodUnion=fe,fe.create=(ln,at)=>new fe({options:ln,typeName:bt.ZodUnion,...h(at)});const Me=ln=>ln instanceof pe?Me(ln.schema):ln instanceof $e?Me(ln.innerType()):ln instanceof re?[ln.value]:ln instanceof Oe?ln.options:ln instanceof Ae?_.util.objectValues(ln.enum):ln instanceof qe?Me(ln._def.innerType):ln instanceof Q?[void 0]:ln instanceof oe?[null]:ln instanceof Ve?[void 0,...Me(ln.unwrap())]:ln instanceof lt?[null,...Me(ln.unwrap())]:ln instanceof St||ln instanceof st?Me(ln.unwrap()):ln instanceof Rt?Me(ln._def.innerType):[];class Le extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:Ht.parsedType}),m.INVALID;const on=this.discriminator,xn=Ht.data[on],Zn=this.optionsMap.get(xn);return Zn?Ht.common.async?Zn._parseAsync({data:Ht.data,path:Ht.path,parent:Ht}):Zn._parseSync({data:Ht.data,path:Ht.path,parent:Ht}):((0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[on]}),m.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(at,Ht,on){const xn=new Map;for(const Zn of Ht){const Gi=Me(Zn.shape[at]);if(!Gi.length)throw new Error(`A discriminator value for key \`${at}\` could not be extracted from all schema options`);for(const Fi of Gi){if(xn.has(Fi))throw new Error(`Discriminator property ${String(at)} has duplicate value ${String(Fi)}`);xn.set(Fi,Zn)}}return new Le({typeName:bt.ZodDiscriminatedUnion,discriminator:at,options:Ht,optionsMap:xn,...h(on)})}}t.ZodDiscriminatedUnion=Le;function Ce(ln,at){const Ht=(0,_.getParsedType)(ln),on=(0,_.getParsedType)(at);if(ln===at)return{valid:!0,data:ln};if(Ht===_.ZodParsedType.object&&on===_.ZodParsedType.object){const xn=_.util.objectKeys(at),Zn=_.util.objectKeys(ln).filter(Fi=>xn.indexOf(Fi)!==-1),Gi={...ln,...at};for(const Fi of Zn){const oo=Ce(ln[Fi],at[Fi]);if(!oo.valid)return{valid:!1};Gi[Fi]=oo.data}return{valid:!0,data:Gi}}else if(Ht===_.ZodParsedType.array&&on===_.ZodParsedType.array){if(ln.length!==at.length)return{valid:!1};const xn=[];for(let Zn=0;Zn<ln.length;Zn++){const Gi=ln[Zn],Fi=at[Zn],oo=Ce(Gi,Fi);if(!oo.valid)return{valid:!1};xn.push(oo.data)}return{valid:!0,data:xn}}else return Ht===_.ZodParsedType.date&&on===_.ZodParsedType.date&&+ln==+at?{valid:!0,data:ln}:{valid:!1}}class Se extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at),xn=(Zn,Gi)=>{if((0,m.isAborted)(Zn)||(0,m.isAborted)(Gi))return m.INVALID;const Fi=Ce(Zn.value,Gi.value);return Fi.valid?(((0,m.isDirty)(Zn)||(0,m.isDirty)(Gi))&&Ht.dirty(),{status:Ht.value,value:Fi.data}):((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_intersection_types}),m.INVALID)};return on.common.async?Promise.all([this._def.left._parseAsync({data:on.data,path:on.path,parent:on}),this._def.right._parseAsync({data:on.data,path:on.path,parent:on})]).then(([Zn,Gi])=>xn(Zn,Gi)):xn(this._def.left._parseSync({data:on.data,path:on.path,parent:on}),this._def.right._parseSync({data:on.data,path:on.path,parent:on}))}}t.ZodIntersection=Se,Se.create=(ln,at,Ht)=>new Se({left:ln,right:at,typeName:bt.ZodIntersection,...h(Ht)});class Ee extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.array)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.array,received:on.parsedType}),m.INVALID;if(on.data.length<this._def.items.length)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m.INVALID;!this._def.rest&&on.data.length>this._def.items.length&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Ht.dirty());const Zn=[...on.data].map((Gi,Fi)=>{const oo=this._def.items[Fi]||this._def.rest;return oo?oo._parse(new f(on,Gi,on.path,Fi)):null}).filter(Gi=>!!Gi);return on.common.async?Promise.all(Zn).then(Gi=>m.ParseStatus.mergeArray(Ht,Gi)):m.ParseStatus.mergeArray(Ht,Zn)}get items(){return this._def.items}rest(at){return new Ee({...this._def,rest:at})}}t.ZodTuple=Ee,Ee.create=(ln,at)=>{if(!Array.isArray(ln))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee({items:ln,typeName:bt.ZodTuple,rest:null,...h(at)})};class ge extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.object)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.object,received:on.parsedType}),m.INVALID;const xn=[],Zn=this._def.keyType,Gi=this._def.valueType;for(const Fi in on.data)xn.push({key:Zn._parse(new f(on,Fi,on.path,Fi)),value:Gi._parse(new f(on,on.data[Fi],on.path,Fi)),alwaysSet:Fi in on.data});return on.common.async?m.ParseStatus.mergeObjectAsync(Ht,xn):m.ParseStatus.mergeObjectSync(Ht,xn)}get element(){return this._def.valueType}static create(at,Ht,on){return Ht instanceof u?new ge({keyType:at,valueType:Ht,typeName:bt.ZodRecord,...h(on)}):new ge({keyType:V.create(),valueType:at,typeName:bt.ZodRecord,...h(Ht)})}}t.ZodRecord=ge;class xe extends u{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.map)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.map,received:on.parsedType}),m.INVALID;const xn=this._def.keyType,Zn=this._def.valueType,Gi=[...on.data.entries()].map(([Fi,oo],Mi)=>({key:xn._parse(new f(on,Fi,on.path,[Mi,"key"])),value:Zn._parse(new f(on,oo,on.path,[Mi,"value"]))}));if(on.common.async){const Fi=new Map;return Promise.resolve().then(async()=>{for(const oo of Gi){const Mi=await oo.key,no=await oo.value;if(Mi.status==="aborted"||no.status==="aborted")return m.INVALID;(Mi.status==="dirty"||no.status==="dirty")&&Ht.dirty(),Fi.set(Mi.value,no.value)}return{status:Ht.value,value:Fi}})}else{const Fi=new Map;for(const oo of Gi){const Mi=oo.key,no=oo.value;if(Mi.status==="aborted"||no.status==="aborted")return m.INVALID;(Mi.status==="dirty"||no.status==="dirty")&&Ht.dirty(),Fi.set(Mi.value,no.value)}return{status:Ht.value,value:Fi}}}}t.ZodMap=xe,xe.create=(ln,at,Ht)=>new xe({valueType:at,keyType:ln,typeName:bt.ZodMap,...h(Ht)});class Te extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.parsedType!==_.ZodParsedType.set)return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.set,received:on.parsedType}),m.INVALID;const xn=this._def;xn.minSize!==null&&on.data.size<xn.minSize.value&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_small,minimum:xn.minSize.value,type:"set",inclusive:!0,exact:!1,message:xn.minSize.message}),Ht.dirty()),xn.maxSize!==null&&on.data.size>xn.maxSize.value&&((0,m.addIssueToContext)(on,{code:s.ZodIssueCode.too_big,maximum:xn.maxSize.value,type:"set",inclusive:!0,exact:!1,message:xn.maxSize.message}),Ht.dirty());const Zn=this._def.valueType;function Gi(oo){const Mi=new Set;for(const no of oo){if(no.status==="aborted")return m.INVALID;no.status==="dirty"&&Ht.dirty(),Mi.add(no.value)}return{status:Ht.value,value:Mi}}const Fi=[...on.data.values()].map((oo,Mi)=>Zn._parse(new f(on,oo,on.path,Mi)));return on.common.async?Promise.all(Fi).then(oo=>Gi(oo)):Gi(Fi)}min(at,Ht){return new Te({...this._def,minSize:{value:at,message:v.errorUtil.toString(Ht)}})}max(at,Ht){return new Te({...this._def,maxSize:{value:at,message:v.errorUtil.toString(Ht)}})}size(at,Ht){return this.min(at,Ht).max(at,Ht)}nonempty(at){return this.min(1,at)}}t.ZodSet=Te,Te.create=(ln,at)=>new Te({valueType:ln,minSize:null,maxSize:null,typeName:bt.ZodSet,...h(at)});class Fe extends u{constructor(){super(...arguments),this.validate=this.implement}_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.function)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.function,received:Ht.parsedType}),m.INVALID;function on(Fi,oo){return(0,m.makeIssue)({data:Fi,path:Ht.path,errorMaps:[Ht.common.contextualErrorMap,Ht.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(Mi=>!!Mi),issueData:{code:s.ZodIssueCode.invalid_arguments,argumentsError:oo}})}function xn(Fi,oo){return(0,m.makeIssue)({data:Fi,path:Ht.path,errorMaps:[Ht.common.contextualErrorMap,Ht.schemaErrorMap,(0,p.getErrorMap)(),p.defaultErrorMap].filter(Mi=>!!Mi),issueData:{code:s.ZodIssueCode.invalid_return_type,returnTypeError:oo}})}const Zn={errorMap:Ht.common.contextualErrorMap},Gi=Ht.data;if(this._def.returns instanceof Ue){const Fi=this;return(0,m.OK)(async function(...oo){const Mi=new s.ZodError([]),no=await Fi._def.args.parseAsync(oo,Zn).catch(jo=>{throw Mi.addIssue(on(oo,jo)),Mi}),uo=await Reflect.apply(Gi,this,no);return await Fi._def.returns._def.type.parseAsync(uo,Zn).catch(jo=>{throw Mi.addIssue(xn(uo,jo)),Mi})})}else{const Fi=this;return(0,m.OK)(function(...oo){const Mi=Fi._def.args.safeParse(oo,Zn);if(!Mi.success)throw new s.ZodError([on(oo,Mi.error)]);const no=Reflect.apply(Gi,this,Mi.data),uo=Fi._def.returns.safeParse(no,Zn);if(!uo.success)throw new s.ZodError([xn(no,uo.error)]);return uo.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...at){return new Fe({...this._def,args:Ee.create(at).rest(he.create())})}returns(at){return new Fe({...this._def,returns:at})}implement(at){return this.parse(at)}strictImplement(at){return this.parse(at)}static create(at,Ht,on){return new Fe({args:at||Ee.create([]).rest(he.create()),returns:Ht||he.create(),typeName:bt.ZodFunction,...h(on)})}}t.ZodFunction=Fe;class pe extends u{get schema(){return this._def.getter()}_parse(at){const{ctx:Ht}=this._processInputParams(at);return this._def.getter()._parse({data:Ht.data,path:Ht.path,parent:Ht})}}t.ZodLazy=pe,pe.create=(ln,at)=>new pe({getter:ln,typeName:bt.ZodLazy,...h(at)});class re extends u{_parse(at){if(at.data!==this._def.value){const Ht=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(Ht,{received:Ht.data,code:s.ZodIssueCode.invalid_literal,expected:this._def.value}),m.INVALID}return{status:"valid",value:at.data}}get value(){return this._def.value}}t.ZodLiteral=re,re.create=(ln,at)=>new re({value:ln,typeName:bt.ZodLiteral,...h(at)});function ue(ln,at){return new Oe({values:ln,typeName:bt.ZodEnum,...h(at)})}class Oe extends u{constructor(){super(...arguments),o.set(this,void 0)}_parse(at){if(typeof at.data!="string"){const Ht=this._getOrReturnCtx(at),on=this._def.values;return(0,m.addIssueToContext)(Ht,{expected:_.util.joinValues(on),received:Ht.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,o,"f")||r(this,o,new Set(this._def.values),"f"),!n(this,o,"f").has(at.data)){const Ht=this._getOrReturnCtx(at),on=this._def.values;return(0,m.addIssueToContext)(Ht,{received:Ht.data,code:s.ZodIssueCode.invalid_enum_value,options:on}),m.INVALID}return(0,m.OK)(at.data)}get options(){return this._def.values}get enum(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}get Values(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}get Enum(){const at={};for(const Ht of this._def.values)at[Ht]=Ht;return at}extract(at,Ht=this._def){return Oe.create(at,{...this._def,...Ht})}exclude(at,Ht=this._def){return Oe.create(this.options.filter(on=>!at.includes(on)),{...this._def,...Ht})}}t.ZodEnum=Oe,o=new WeakMap,Oe.create=ue;class Ae extends u{constructor(){super(...arguments),c.set(this,void 0)}_parse(at){const Ht=_.util.getValidEnumValues(this._def.values),on=this._getOrReturnCtx(at);if(on.parsedType!==_.ZodParsedType.string&&on.parsedType!==_.ZodParsedType.number){const xn=_.util.objectValues(Ht);return(0,m.addIssueToContext)(on,{expected:_.util.joinValues(xn),received:on.parsedType,code:s.ZodIssueCode.invalid_type}),m.INVALID}if(n(this,c,"f")||r(this,c,new Set(_.util.getValidEnumValues(this._def.values)),"f"),!n(this,c,"f").has(at.data)){const xn=_.util.objectValues(Ht);return(0,m.addIssueToContext)(on,{received:on.data,code:s.ZodIssueCode.invalid_enum_value,options:xn}),m.INVALID}return(0,m.OK)(at.data)}get enum(){return this._def.values}}t.ZodNativeEnum=Ae,c=new WeakMap,Ae.create=(ln,at)=>new Ae({values:ln,typeName:bt.ZodNativeEnum,...h(at)});class Ue extends u{unwrap(){return this._def.type}_parse(at){const{ctx:Ht}=this._processInputParams(at);if(Ht.parsedType!==_.ZodParsedType.promise&&Ht.common.async===!1)return(0,m.addIssueToContext)(Ht,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.promise,received:Ht.parsedType}),m.INVALID;const on=Ht.parsedType===_.ZodParsedType.promise?Ht.data:Promise.resolve(Ht.data);return(0,m.OK)(on.then(xn=>this._def.type.parseAsync(xn,{path:Ht.path,errorMap:Ht.common.contextualErrorMap})))}}t.ZodPromise=Ue,Ue.create=(ln,at)=>new Ue({type:ln,typeName:bt.ZodPromise,...h(at)});class $e extends u{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===bt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at),xn=this._def.effect||null,Zn={addIssue:Gi=>{(0,m.addIssueToContext)(on,Gi),Gi.fatal?Ht.abort():Ht.dirty()},get path(){return on.path}};if(Zn.addIssue=Zn.addIssue.bind(Zn),xn.type==="preprocess"){const Gi=xn.transform(on.data,Zn);if(on.common.async)return Promise.resolve(Gi).then(async Fi=>{if(Ht.value==="aborted")return m.INVALID;const oo=await this._def.schema._parseAsync({data:Fi,path:on.path,parent:on});return oo.status==="aborted"?m.INVALID:oo.status==="dirty"||Ht.value==="dirty"?(0,m.DIRTY)(oo.value):oo});{if(Ht.value==="aborted")return m.INVALID;const Fi=this._def.schema._parseSync({data:Gi,path:on.path,parent:on});return Fi.status==="aborted"?m.INVALID:Fi.status==="dirty"||Ht.value==="dirty"?(0,m.DIRTY)(Fi.value):Fi}}if(xn.type==="refinement"){const Gi=Fi=>{const oo=xn.refinement(Fi,Zn);if(on.common.async)return Promise.resolve(oo);if(oo instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Fi};if(on.common.async===!1){const Fi=this._def.schema._parseSync({data:on.data,path:on.path,parent:on});return Fi.status==="aborted"?m.INVALID:(Fi.status==="dirty"&&Ht.dirty(),Gi(Fi.value),{status:Ht.value,value:Fi.value})}else return this._def.schema._parseAsync({data:on.data,path:on.path,parent:on}).then(Fi=>Fi.status==="aborted"?m.INVALID:(Fi.status==="dirty"&&Ht.dirty(),Gi(Fi.value).then(()=>({status:Ht.value,value:Fi.value}))))}if(xn.type==="transform")if(on.common.async===!1){const Gi=this._def.schema._parseSync({data:on.data,path:on.path,parent:on});if(!(0,m.isValid)(Gi))return Gi;const Fi=xn.transform(Gi.value,Zn);if(Fi instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Ht.value,value:Fi}}else return this._def.schema._parseAsync({data:on.data,path:on.path,parent:on}).then(Gi=>(0,m.isValid)(Gi)?Promise.resolve(xn.transform(Gi.value,Zn)).then(Fi=>({status:Ht.value,value:Fi})):Gi);_.util.assertNever(xn)}}t.ZodEffects=$e,t.ZodTransformer=$e,$e.create=(ln,at,Ht)=>new $e({schema:ln,typeName:bt.ZodEffects,effect:at,...h(Ht)}),$e.createWithPreprocess=(ln,at,Ht)=>new $e({schema:at,effect:{type:"preprocess",transform:ln},typeName:bt.ZodEffects,...h(Ht)});class Ve extends u{_parse(at){return this._getType(at)===_.ZodParsedType.undefined?(0,m.OK)(void 0):this._def.innerType._parse(at)}unwrap(){return this._def.innerType}}t.ZodOptional=Ve,Ve.create=(ln,at)=>new Ve({innerType:ln,typeName:bt.ZodOptional,...h(at)});class lt extends u{_parse(at){return this._getType(at)===_.ZodParsedType.null?(0,m.OK)(null):this._def.innerType._parse(at)}unwrap(){return this._def.innerType}}t.ZodNullable=lt,lt.create=(ln,at)=>new lt({innerType:ln,typeName:bt.ZodNullable,...h(at)});class qe extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at);let on=Ht.data;return Ht.parsedType===_.ZodParsedType.undefined&&(on=this._def.defaultValue()),this._def.innerType._parse({data:on,path:Ht.path,parent:Ht})}removeDefault(){return this._def.innerType}}t.ZodDefault=qe,qe.create=(ln,at)=>new qe({innerType:ln,typeName:bt.ZodDefault,defaultValue:typeof at.default=="function"?at.default:()=>at.default,...h(at)});class Rt extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on={...Ht,common:{...Ht.common,issues:[]}},xn=this._def.innerType._parse({data:on.data,path:on.path,parent:{...on}});return(0,m.isAsync)(xn)?xn.then(Zn=>({status:"valid",value:Zn.status==="valid"?Zn.value:this._def.catchValue({get error(){return new s.ZodError(on.common.issues)},input:on.data})})):{status:"valid",value:xn.status==="valid"?xn.value:this._def.catchValue({get error(){return new s.ZodError(on.common.issues)},input:on.data})}}removeCatch(){return this._def.innerType}}t.ZodCatch=Rt,Rt.create=(ln,at)=>new Rt({innerType:ln,typeName:bt.ZodCatch,catchValue:typeof at.catch=="function"?at.catch:()=>at.catch,...h(at)});class nt extends u{_parse(at){if(this._getType(at)!==_.ZodParsedType.nan){const on=this._getOrReturnCtx(at);return(0,m.addIssueToContext)(on,{code:s.ZodIssueCode.invalid_type,expected:_.ZodParsedType.nan,received:on.parsedType}),m.INVALID}return{status:"valid",value:at.data}}}t.ZodNaN=nt,nt.create=ln=>new nt({typeName:bt.ZodNaN,...h(ln)}),t.BRAND=Symbol("zod_brand");class St extends u{_parse(at){const{ctx:Ht}=this._processInputParams(at),on=Ht.data;return this._def.type._parse({data:on,path:Ht.path,parent:Ht})}unwrap(){return this._def.type}}t.ZodBranded=St;class it extends u{_parse(at){const{status:Ht,ctx:on}=this._processInputParams(at);if(on.common.async)return(async()=>{const Zn=await this._def.in._parseAsync({data:on.data,path:on.path,parent:on});return Zn.status==="aborted"?m.INVALID:Zn.status==="dirty"?(Ht.dirty(),(0,m.DIRTY)(Zn.value)):this._def.out._parseAsync({data:Zn.value,path:on.path,parent:on})})();{const xn=this._def.in._parseSync({data:on.data,path:on.path,parent:on});return xn.status==="aborted"?m.INVALID:xn.status==="dirty"?(Ht.dirty(),{status:"dirty",value:xn.value}):this._def.out._parseSync({data:xn.value,path:on.path,parent:on})}}static create(at,Ht){return new it({in:at,out:Ht,typeName:bt.ZodPipeline})}}t.ZodPipeline=it;class st extends u{_parse(at){const Ht=this._def.innerType._parse(at),on=xn=>((0,m.isValid)(xn)&&(xn.value=Object.freeze(xn.value)),xn);return(0,m.isAsync)(Ht)?Ht.then(xn=>on(xn)):on(Ht)}unwrap(){return this._def.innerType}}t.ZodReadonly=st,st.create=(ln,at)=>new st({innerType:ln,typeName:bt.ZodReadonly,...h(at)});function ct(ln,at={},Ht){return ln?ne.create().superRefine((on,xn)=>{var Zn,Gi;if(!ln(on)){const Fi=typeof at=="function"?at(on):typeof at=="string"?{message:at}:at,oo=(Gi=(Zn=Fi.fatal)!==null&&Zn!==void 0?Zn:Ht)!==null&&Gi!==void 0?Gi:!0,Mi=typeof Fi=="string"?{message:Fi}:Fi;xn.addIssue({code:"custom",...Mi,fatal:oo})}}):ne.create()}t.custom=ct,t.late={object:ie.lazycreate};var bt;(function(ln){ln.ZodString="ZodString",ln.ZodNumber="ZodNumber",ln.ZodNaN="ZodNaN",ln.ZodBigInt="ZodBigInt",ln.ZodBoolean="ZodBoolean",ln.ZodDate="ZodDate",ln.ZodSymbol="ZodSymbol",ln.ZodUndefined="ZodUndefined",ln.ZodNull="ZodNull",ln.ZodAny="ZodAny",ln.ZodUnknown="ZodUnknown",ln.ZodNever="ZodNever",ln.ZodVoid="ZodVoid",ln.ZodArray="ZodArray",ln.ZodObject="ZodObject",ln.ZodUnion="ZodUnion",ln.ZodDiscriminatedUnion="ZodDiscriminatedUnion",ln.ZodIntersection="ZodIntersection",ln.ZodTuple="ZodTuple",ln.ZodRecord="ZodRecord",ln.ZodMap="ZodMap",ln.ZodSet="ZodSet",ln.ZodFunction="ZodFunction",ln.ZodLazy="ZodLazy",ln.ZodLiteral="ZodLiteral",ln.ZodEnum="ZodEnum",ln.ZodEffects="ZodEffects",ln.ZodNativeEnum="ZodNativeEnum",ln.ZodOptional="ZodOptional",ln.ZodNullable="ZodNullable",ln.ZodDefault="ZodDefault",ln.ZodCatch="ZodCatch",ln.ZodPromise="ZodPromise",ln.ZodBranded="ZodBranded",ln.ZodPipeline="ZodPipeline",ln.ZodReadonly="ZodReadonly"})(bt||(t.ZodFirstPartyTypeKind=bt={}));class Vt{constructor(...at){}}const _n=(ln,at={message:`Input not instance of ${ln.name}`})=>ct(Ht=>Ht instanceof ln,at);t.instanceof=_n;const Kn=V.create;t.string=Kn;const bi=Y.create;t.number=bi;const Un=nt.create;t.nan=Un;const hn=G.create;t.bigint=hn;const Xn=H.create;t.boolean=Xn;const vn=K.create;t.date=vn;const $t=Z.create;t.symbol=$t;const vt=Q.create;t.undefined=vt;const ze=oe.create;t.null=ze;const Je=ne.create;t.any=Je;const Dt=he.create;t.unknown=Dt;const Rn=_e.create;t.never=Rn;const ni=q.create;t.void=ni;const Li=Re.create;t.array=Li;const Wi=ie.create;t.object=Wi;const ao=ie.strictCreate;t.strictObject=ao;const qi=fe.create;t.union=qi;const fo=Le.create;t.discriminatedUnion=fo;const ci=Se.create;t.intersection=ci;const Gn=Ee.create;t.tuple=Gn;const Di=ge.create;t.record=Di;const zi=xe.create;t.map=zi;const to=Te.create;t.set=to;const Ki=Fe.create;t.function=Ki;const yn=pe.create;t.lazy=yn;const si=re.create;t.literal=si;const Ln=Oe.create;t.enum=Ln;const dt=Ae.create;t.nativeEnum=dt;const xt=Ue.create;t.promise=xt;const Tt=$e.create;t.effect=Tt,t.transformer=Tt;const At=Ve.create;t.optional=At;const Sn=lt.create;t.nullable=Sn;const fn=$e.createWithPreprocess;t.preprocess=fn;const an=it.create;t.pipeline=an;const Hn=()=>Kn().optional();t.ostring=Hn;const hi=()=>bi().optional();t.onumber=hi;const Ei=()=>Xn().optional();t.oboolean=Ei,t.coerce={string:ln=>V.create({...ln,coerce:!0}),number:ln=>Y.create({...ln,coerce:!0}),boolean:ln=>H.create({...ln,coerce:!0}),bigint:ln=>G.create({...ln,coerce:!0}),date:ln=>K.create({...ln,coerce:!0})},t.NEVER=m.INVALID},79682:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChromeDevtoolsContribution=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(65265),v=e(98295),m=e(27654);let _=n=class extends c.Disposable{constructor(){super(...arguments),this.lantencyHandler=f=>{const{command:a}=f.detail;a===p.DevtoolsLantencyCommand.Start?this.interval||this.startRTTInterval():a===p.DevtoolsLantencyCommand.Stop&&this.interval&&(clearInterval(this.interval),this.interval=void 0)}}initialize(){var f;this.appConfig.devtools&&(window.addEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.addDispose(c.Disposable.create(()=>{window.removeEventListener(p.EDevtoolsEvent.Latency,this.lantencyHandler),this.interval&&(clearInterval(this.interval),this.interval=void 0)})),!((f=window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__)===null||f===void 0)&&f.captureRPC&&(this.interval||this.startRTTInterval()))}startRTTInterval(){this.interval=setInterval(async()=>{const f=Date.now();await this.rttService.measure();const a=Date.now()-f;window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.captureRPC&&(window.__OPENSUMI_DEVTOOLS_GLOBAL_HOOK__.latency=a)},n.INTERVAL)}};t.ChromeDevtoolsContribution=_,_.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(c.AppConfig),r.__metadata("design:type",Object)],_.prototype,"appConfig",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],_.prototype,"rttService",void 0),t.ChromeDevtoolsContribution=_=n=r.__decorate([(0,v.Domain)(c.ClientAppContribution)],_)},72915:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTContribution=void 0;const r=e(85608),o=e(76003),c=e(26542),p=e(92323),v=e(98295),m=e(27654),_={id:"connection.start.rtt",label:"%connection.start.rtt%",category:"%command.category.developerTools%"},s={id:"connection.stop.rtt",label:"%connection.stop.rtt%",category:"%command.category.developerTools%"},f={alignment:c.StatusBarAlignment.LEFT,priority:1/0-1};let a=n=class{registerCommands(u){u.registerCommand(_,{execute:()=>{this.interval||this.startRTTInterval()}}),u.registerCommand(s,{execute:()=>{this.interval&&(clearInterval(this.interval),this.statusBar&&(this.statusBar.dispose(),this.statusBar=void 0))}})}startRTTInterval(){this.interval=setInterval(async()=>{const u=Date.now();await this.rttService.measure();const E={text:`${Date.now()-u}ms`};if(this.statusBar)this.statusBar.update({...E,...f});else{const g=this.statusBarService.addElement("connection-rtt",{...E,...f});this.statusBar=g}},n.INTERVAL)}};t.ConnectionRTTContribution=a,a.INTERVAL=1e3,r.__decorate([(0,o.Autowired)(c.IStatusBarService),r.__metadata("design:type",Object)],a.prototype,"statusBarService",void 0),r.__decorate([(0,o.Autowired)(m.ConnectionRTTBrowserServiceToken),r.__metadata("design:type",m.ConnectionRTTBrowserService)],a.prototype,"rttService",void 0),t.ConnectionRTTContribution=a=n=r.__decorate([(0,v.Domain)(p.CommandContribution)],a)},27654:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConnectionRTTBrowserService=t.ConnectionRTTBrowserServiceToken=void 0;const n=e(85608),r=e(76003),o=e(69452);t.ConnectionRTTBrowserServiceToken=Symbol("ConnectionRTTBrowserService");let c=class{async measure(){await this.connectionBackService.$measure()}};t.ConnectionRTTBrowserService=c,n.__decorate([(0,r.Autowired)(o.ConnectionBackServicePath),n.__metadata("design:type",Object)],c.prototype,"connectionBackService",void 0),t.ConnectionRTTBrowserService=c=n.__decorate([(0,r.Injectable)()],c)},17631:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(69452);let v=class extends c.WithEventBus{onDidDropFile(_){this.dropService.onDidDropFile(_)}};t.FileDropContribution=v,n.__decorate([(0,r.Autowired)(p.IFileDropFrontendServiceToken),n.__metadata("design:type",Object)],v.prototype,"dropService",void 0),n.__decorate([(0,c.OnEvent)(c.FileTreeDropEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[c.FileTreeDropEvent]),n.__metadata("design:returntype",void 0)],v.prototype,"onDidDropFile",null),t.FileDropContribution=v=n.__decorate([(0,r.Injectable)(),(0,o.Domain)(o.ClientAppContribution)],v)},22874:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileDropService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(26542),p=e(43718),v=e(42933),{Path:m}=p.path,_=e(69452);let s=class extends p.WithEventBus{constructor(){super(...arguments),this.pending=new Set}onDidUploadFileStart(a){this.pending.add(a),this.createOrUpdateStatusBar()}onDidUploadFileEnd(a){this.pending.delete(a),this.createOrUpdateStatusBar()}createOrUpdateStatusBar(a){if(this.pending.size===0){this.uploadStatus&&(this.uploadStatus.dispose(),this.uploadStatus=void 0);return}const h="sumi-upload-file-status",u=(0,o.formatLocalize)("workbench.uploadingFiles",this.pending.size,a||"0 MB"),d={text:u,alignment:c.StatusBarAlignment.RIGHT,tooltip:u,iconClass:"kaitian-icon kticon-cloud-server"};this.uploadStatus?this.uploadStatus.update({id:h,...d}):this.uploadStatus=this.statusBarService.addElement(h,d)}onDidDropFile(a){var h;const{payload:{event:u,targetDir:d}}=a;if(!d||!(!((h=u.dataTransfer)===null||h===void 0)&&h.files)||u.dataTransfer.files.length===0)return;const E=u.dataTransfer.items;let g=0;const l=Date.now(),y=b=>{g+=b;const S=Date.now(),w=`${(g/((S-l)/1e3)/1024/1024).toFixed(2)} MB`;this.createOrUpdateStatusBar(w)};for(const b of E){const S=b.webkitGetAsEntry();this.processFilesEntry(d,S,y)}}async processFilesEntry(a,h,u){if(h.isFile)this.processFileEntry(h,a,u);else{const d=p.Uri.file(new m(a).join(h.fullPath).toString()).toString();await this.fs.createFolder(d),this.processDirEntry(h,a,u)}}toBinaryString(a){let h;const u=a.length;let d="";for(h=0;h<u;h+=1)d+=String.fromCharCode(a[h]);return d}async doUploadFile(a,h,u){var d;const E=new m(h).join(a.name).toString();this.onDidUploadFileStart(E.toString()),await this.fs.createFile(p.Uri.file(E.toString()).toString()),await this.dropService.$ensureFileExist(a.name,h);const g=a.stream().getReader();let l=await g.read();for(;!l.done;)await this.dropService.$writeStream(this.toBinaryString(l.value),a.name,h,l.done),u((d=l.value)===null||d===void 0?void 0:d.byteLength),l=await g.read();l.done&&this.onDidUploadFileEnd(E.toString())}processFileEntry(a,h,u){a.file(d=>{const E=new File([d],a.fullPath,{type:a.type});this.doUploadFile(E,h,u)},()=>{})}processDirEntry(a,h,u){a.createReader().readEntries(E=>{E.forEach(async g=>{this.processFilesEntry(h,g,u)})},()=>{})}};t.FileDropService=s,n.__decorate([(0,r.Autowired)(v.IFileServiceClient),n.__metadata("design:type",Object)],s.prototype,"fs",void 0),n.__decorate([(0,r.Autowired)(_.FileDropServicePath),n.__metadata("design:type",Object)],s.prototype,"dropService",void 0),n.__decorate([(0,r.Autowired)(c.IStatusBarService),n.__metadata("design:type",Object)],s.prototype,"statusBarService",void 0),t.FileDropService=s=n.__decorate([(0,r.Injectable)()],s)},79240:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FileSearchContribution=t.FileSearchQuickCommandHandler=t.matchLineReg=t.quickGoToSymbol=t.quickFileOpen=void 0,t.getValidateInput=y;const n=e(85608),r=n.__importDefault(e(39050)),o=e(76003),c=e(41869),p=e(26542),v=e(43718),m=e(98295),_=e(54414),s=e(17459),f=e(84660),a=n.__importStar(e(20868)),h=e(97821),u=e(80490),d=e(51500),E=e(30981),g=200;t.quickFileOpen={id:"workbench.action.quickOpen",category:"File",label:"Open File..."},t.quickGoToSymbol={id:"workbench.action.gotoSymbol",category:"File",label:"Open File Symbol..."},t.matchLineReg=/^([^:#(]*)[:#(]?L?(\d+)?[:,]?(\d+)?\)?/;function l(T=""){const D=T.match(t.matchLineReg)||[];if(D.length<2)return;const I={line:Number(D[2]||0),start:Number(D[3]||0)};return new a.Range(I.line,I.start,I.line,I.start)}function y(T){return T.replace(t.matchLineReg,"$1")}let b=class extends h.QuickOpenBaseAction{constructor(){super({id:"file-search:splitToRight",tooltip:(0,c.localize)("quickOpen.openOnTheRightSide"),class:(0,c.getIcon)("embed")})}async run(D){await this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.getUri(),{preview:!1,split:_.EditorGroupSplitAction.Right,range:l(this.injector.get(A).currentLookFor),focus:!0})}};n.__decorate([(0,o.Autowired)(c.CommandService),n.__metadata("design:type",Object)],b.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(o.INJECTOR_TOKEN),n.__metadata("design:type",o.Injector)],b.prototype,"injector",void 0),b=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],b);let S=class{hasActions(){return!0}getActions(){return[this.fileSearchActionLeftRight]}getValidateInput(D){return y(D)}};n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",b)],S.prototype,"fileSearchActionLeftRight",void 0),S=n.__decorate([(0,o.Injectable)()],S);let A=class{constructor(){this.cancelIndicator=new v.CancellationTokenSource,this.default=!0,this.prefix="...",this.description=(0,c.localize)("file-search.command.fileOpen.description"),this.prevEditorState={},this.currentLookFor=""}getModel(){return{onType:async(D,I)=>{this.cancelIndicator.cancel(),this.cancelIndicator=new v.CancellationTokenSource;const O=this.cancelIndicator.token,M=new Set;let R=[];D=D.trim().replace(/\s/g,""),this.currentLookFor=D;const P=y(D),k=this.reporterService.time(v.REPORT_NAME.QUICK_OPEN_MEASURE),F=await this.getRecentlyItems(M,P,O);if(D&&(this.logger.debug("lookFor",D,P),R=await this.getFindOutItems(M,P,O)),O.isCancellationRequested)return;const L=F.concat(R);I(L,L.length?this.fileSearchActionProvider:void 0),k.timeEnd(D.indexOf("@")>-1?"file-symbol":"file",{lookFor:D,stat:{recently:F.length,find:R.length}})}}}getOptions(){return{placeholder:(0,c.localize)("file-search.command.fileOpen.placeholder"),fuzzyMatchLabel:{enableSeparateSubstringMatching:!0},showItemsWithoutHighlight:!0,fuzzyMatchDescription:{enableSeparateSubstringMatching:!0},getPlaceholderItem:D=>new c.QuickOpenItem({label:(0,c.localize)(D.indexOf("@")>-1?"search.fileSymbolResults.notfound":"search.fileResults.notfound"),run:()=>!1})}}onClose(D){D&&this.prevEditorState.uri&&(this.workbenchEditorService.open(this.prevEditorState.uri,{range:this.prevEditorState.range}),this.prevEditorState={}),this.prevSelected=void 0,this.cancelIndicator.cancel()}onToggle(){this.cancelIndicator.cancel()}trySaveEditorState(){var D;if(this.workbenchEditorService.currentResource){let I={startColumn:1,startLineNumber:1,endColumn:1,endLineNumber:1};const O=(D=this.workbenchEditorService.currentEditor)===null||D===void 0?void 0:D.getSelections();if(O){const{selectionStartLineNumber:M,selectionStartColumn:R,positionLineNumber:P,positionColumn:k}=O[0];I=new a.Range(M,R,P,k)}this.prevEditorState={uri:this.workbenchEditorService.currentResource.uri,range:I}}}async getFindOutItems(D,I,O){var M;let R;if(I.indexOf("@")>-1){this.trySaveEditorState(),R=[];const[P,k]=I.split("@");let F;if(this.prevSelected)F=this.prevSelected.withoutFragment();else if(P){const L=await this.getQueryFiles(P,D,O);L.length&&(F=L[0].getUri())}else F=(M=this.workbenchEditorService.currentResource)===null||M===void 0?void 0:M.uri;if(F){const L=await this.documentSymbolStore.getDocumentSymbolAsync(F)||[],N=[];this.flattenSymbols({children:L},N),R=N.filter(W=>{const U=(0,E.matchesFuzzy)(k,W.name,!0)||[];return U&&(W.labelHighlights=U),U&&U.length}).map((W,U)=>{var X;return new c.QuickOpenItem({uri:F,label:W.name,iconClass:(0,c.getSymbolIcon)(W.kind),description:(X=W.parent)===null||X===void 0?void 0:X.name,labelHighlights:W.labelHighlights,groupLabel:U===0?(0,c.formatLocalize)("search.fileSymbolResults",N.length):"",showBorder:!1,run:V=>V===c.Mode.PREVIEW?(this.locateSymbol(F,W),!0):V===c.Mode.OPEN?(this.locateSymbol(F,W),!0):!1})})}else return[]}else if(R=await this.getQueryFiles(I,D,O),R[0]){const P=await this.getItems([R[0].getUri().codeUri.fsPath],{groupLabel:(0,c.localize)("search.fileResults"),showBorder:!0});R[0]=P[0]}return R}async getQueryFiles(D,I,O){const R=(await this.workspaceService.roots).map(F=>new c.URI(F.uri).codeUri.fsPath),P=await this.fileSearchService.find(D,{rootUris:R,fuzzyMatch:!0,limit:g,useGitIgnore:!0,noIgnoreParent:!0,excludePatterns:this.getPreferenceSearchExcludes()},O),k=await this.getItems(P.filter(F=>I.has(F)||O.isCancellationRequested?!1:(I.add(F),!0)),{});return k.sort(this.compareItems.bind(this)),k}async flattenSymbols(D,I){D.children.forEach(O=>{I.push(O),O.children&&this.flattenSymbols(O,I)})}async getRecentlyItems(D,I,O){const M=await this.recentFilesManager.getMostRecentlyOpenedFiles(!0)||[];return await this.getItems(M.filter(R=>{const P=new c.URI(R);return D.has(R)||!r.default.test(I,P.displayName)||O.isCancellationRequested?!1:(D.add(R),!0)}),{groupLabel:(0,c.localize)("search.historyMatches")})}async getItems(D,I){const O=[];for(const[M,R]of D.entries()){const P=c.URI.isUriString(R)?new c.URI(R):c.URI.file(R),k=`file-icon ${this.labelService.getIcon(P.withoutFragment())}`;let F="";const L=await this.workspaceService.asRelativePath(P.parent);L&&(this.workspaceService.isMultiRootWorkspaceOpened?F=`${new c.URI(L.root).displayName}${L.path?` \u30FB ${L.path}`:""}`:F=L.path||"");const N=new c.QuickOpenItem({uri:P,label:P.displayName,tooltip:R,iconClass:k,description:F,groupLabel:M===0?I.groupLabel:"",showBorder:D.length>0&&M===0?I.showBorder:!1,run:j=>(j===c.Mode.PREVIEW&&(this.prevSelected=P),j===c.Mode.OPEN?(this.openFile(P),!0):!1)});O.push(N)}return O}openFile(D){const I=D.codeUri.fsPath;let O=l(this.currentLookFor);(!O||!O.startLineNumber&&!O.startColumn)&&(O=l(D.fragment?"#"+D.fragment:I)),this.currentLookFor="",this.commandService.executeCommand(c.EDITOR_COMMANDS.OPEN_RESOURCE.id,D.withoutFragment(),{preview:!1,range:O,focus:!0})}locateSymbol(D,I){this.workbenchEditorService.open(D,{range:I.range,preview:!0})}compareItems(D,I,O="getLabel"){function M(j){return j.trim().toLowerCase()}const R=M(y(this.currentLookFor));function P(j){const W=r.default.match(R,j);return W===null?0:W.score}let k=D[O](),F=I[O]();typeof k!="string"&&(k=k.path.toString()),typeof F!="string"&&(F=F.path.toString()),k=M(k),F=M(F);const L=P(k),N=P(F);if(L===N){const j=k.indexOf(R),W=F.indexOf(R);return j===W?k.length!==F.length?k.length<F.length?-1:1:F.localeCompare(k)===0?O==="getUri"?0:this.compareItems(D,I,"getUri"):F.localeCompare(k):j-W}return N-L}getPreferenceSearchExcludes(){const D=[],I=this.preferenceService.get("files.exclude"),O=this.preferenceService.get("search.exclude"),M=Object.assign({},I,O);for(const R of Object.keys(M))M[R]&&D.push(R);return D}};t.FileSearchQuickCommandHandler=A,n.__decorate([(0,o.Autowired)(c.CommandService),n.__metadata("design:type",Object)],A.prototype,"commandService",void 0),n.__decorate([(0,o.Autowired)(f.FileSearchServicePath),n.__metadata("design:type",Object)],A.prototype,"fileSearchService",void 0),n.__decorate([(0,o.Autowired)(_.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorService)],A.prototype,"workbenchEditorService",void 0),n.__decorate([(0,o.Autowired)(s.DocumentSymbolStore),n.__metadata("design:type",s.DocumentSymbolStore)],A.prototype,"documentSymbolStore",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",p.LabelService)],A.prototype,"labelService",void 0),n.__decorate([(0,o.Autowired)(d.IWorkspaceService),n.__metadata("design:type",Object)],A.prototype,"workspaceService",void 0),n.__decorate([(0,o.Autowired)(c.RecentFilesManager),n.__metadata("design:type",c.RecentFilesManager)],A.prototype,"recentFilesManager",void 0),n.__decorate([(0,o.Autowired)(c.ILogger),n.__metadata("design:type",Object)],A.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(),n.__metadata("design:type",S)],A.prototype,"fileSearchActionProvider",void 0),n.__decorate([(0,o.Autowired)(c.PreferenceService),n.__metadata("design:type",Object)],A.prototype,"preferenceService",void 0),n.__decorate([(0,o.Autowired)(v.IReporterService),n.__metadata("design:type",Object)],A.prototype,"reporterService",void 0),t.FileSearchQuickCommandHandler=A=n.__decorate([(0,o.Injectable)()],A);let w=class{registerQuickOpenHandlers(D){D.registerHandler(this.fileSearchQuickCommandHandler,{title:(0,c.localize)("quickopen.tab.file"),commandId:t.quickFileOpen.id,order:1})}registerCommands(D){D.registerCommand(t.quickFileOpen,{execute:()=>this.quickOpenService.open("...")}),D.registerCommand(t.quickGoToSymbol,{execute:()=>this.quickOpenService.open("...@")})}registerKeybindings(D){D.registerKeybinding({command:t.quickFileOpen.id,keybinding:"ctrlcmd+p"})}};t.FileSearchContribution=w,n.__decorate([(0,o.Autowired)(A),n.__metadata("design:type",A)],w.prototype,"fileSearchQuickCommandHandler",void 0),n.__decorate([(0,o.Autowired)(h.PrefixQuickOpenService),n.__metadata("design:type",Object)],w.prototype,"quickOpenService",void 0),t.FileSearchContribution=w=n.__decorate([(0,m.Domain)(v.CommandContribution,c.KeybindingContribution,u.QuickOpenContribution)],w)},73827:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ClientAddonModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(69452),p=e(79682),v=e(72915),m=e(27654),_=e(17631),s=e(22874),f=e(79240),a=e(18256),h=e(7756),u=e(16426);let d=class extends o.BrowserModule{constructor(){super(...arguments),this.providers=[p.ChromeDevtoolsContribution,a.LanguageChangeHintContribution,f.FileSearchContribution,h.StatusBarContribution,u.ToolbarCustomizeContribution,_.FileDropContribution,v.ConnectionRTTContribution,{token:c.IFileDropFrontendServiceToken,useClass:s.FileDropService},{token:m.ConnectionRTTBrowserServiceToken,useClass:m.ConnectionRTTBrowserService}],this.backServices=[{servicePath:c.FileDropServicePath},{servicePath:c.ConnectionBackServicePath}]}};t.ClientAddonModule=d,t.ClientAddonModule=d=n.__decorate([(0,r.Injectable)()],d)},18256:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageChangeHintContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(72665);let p=class{onStart(){this.preferenceService.onSpecificPreferenceChange(o.GeneralSettingsId.Language,async m=>{(0,o.setLanguageId)(m.newValue),this.preferenceService.get("general.askReloadOnLanguageChange")&&await this.dialogService.info((0,o.localize)("preference.general.language.change.refresh.info","After changing the language, it should be restarted to take effect. Will it be refreshed immediately?"),[(0,o.localize)("preference.general.language.change.refresh.later","Later"),(0,o.localize)("preference.general.language.change.refresh.now","Now")])===(0,o.localize)("preference.general.language.change.refresh.now","Now")&&this.clientApp.fireOnReload()})}};t.LanguageChangeHintContribution=p,n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],p.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.IClientApp),n.__metadata("design:type",Object)],p.prototype,"clientApp",void 0),n.__decorate([(0,r.Autowired)(c.IDialogService),n.__metadata("design:type",Object)],p.prototype,"dialogService",void 0),t.LanguageChangeHintContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},7756:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StatusBarContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718);let p=class extends c.WithEventBus{onStart(){}handleBrowserConnectionOpen(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--statusBar-background)"),this.logger.log("Browser connection open, change status bar background color")}handleBrowserConnectionClose(){this.commandService.executeCommand("statusbar.changeBackgroundColor","var(--kt-statusbar-offline-background)"),this.logger.log("Browser connection close, change status bar background color")}};t.StatusBarContribution=p,n.__decorate([(0,r.Autowired)(c.CommandService),n.__metadata("design:type",Object)],p.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(c.ILogger),n.__metadata("design:type",Object)],p.prototype,"logger",void 0),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionOpenEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionOpen",null),n.__decorate([(0,c.OnEvent)(c.BrowserConnectionCloseEvent),n.__metadata("design:type",Function),n.__metadata("design:paramtypes",[]),n.__metadata("design:returntype",void 0)],p.prototype,"handleBrowserConnectionClose",null),t.StatusBarContribution=p=n.__decorate([(0,c.Domain)(o.ClientAppContribution)],p)},16426:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(93899),p=e(62132);let v=class{registerCommands(_){_.registerCommand({id:"toolbar.showCustomizePanel",label:"Show Toolbar Customization"},{execute:()=>{this.viewService.setVisible(!0)}})}registerComponent(_){_.register("addon/toolbar-customize",{id:"addon/toolbar-customize",component:p.ToolbarCustomizeComponent}),this.config.layoutConfig[o.SlotLocation.extra]||(this.config.layoutConfig[o.SlotLocation.extra]={modules:[]}),this.config.layoutConfig[o.SlotLocation.extra].modules.push("addon/toolbar-customize")}registerMenus(_){_.registerMenuItem(c.MenuId.KTToolbarLocationContext,{command:{id:"toolbar.showCustomizePanel",label:(0,o.localize)("toolbar.customize.menu")}})}};t.ToolbarCustomizeContribution=v,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],v.prototype,"config",void 0),n.__decorate([(0,r.Autowired)(p.ToolbarCustomizeViewService),n.__metadata("design:type",p.ToolbarCustomizeViewService)],v.prototype,"viewService",void 0),t.ToolbarCustomizeContribution=v=n.__decorate([(0,o.Domain)(o.CommandContribution,o.ComponentContribution,c.MenuContribution)],v)},62132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ToolbarCustomizeComponent=t.ToolbarCustomizeViewService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(76003),c=e(97267),p=e(41869),v=n.__importDefault(e(18541));let m=class{bindSetVisibleHandle(f){this._setVisible=f}setVisible(f){this._setVisible(f)}async toggleActionVisibility(f,a,h){const u=this.preferenceService.getValid("toolbar.ignoreActions",{});if(u[f]||(u[f]=[]),!h)u[f].indexOf(a)===-1&&u[f].push(a);else{const E=u[f].indexOf(a);E!==-1&&u[f].splice(E,1)}const d=this.preferenceService.inspect("toolbar.ignoreActions").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;await this.preferenceService.set("toolbar.ignoreActions",u,d)}};t.ToolbarCustomizeViewService=m,n.__decorate([(0,o.Autowired)(p.PreferenceService),n.__metadata("design:type",Object)],m.prototype,"preferenceService",void 0),t.ToolbarCustomizeViewService=m=n.__decorate([(0,o.Injectable)()],m);const _=()=>{const[s,f]=r.default.useState(!1),a=(0,p.useInjectable)(m),h=(0,p.useInjectable)(p.IToolbarRegistry),u=(0,p.useInjectable)(p.PreferenceService);if(a.bindSetVisibleHandle(f),!s)return null;const d=h.getAllLocations(),E=u.get("toolbar.ignoreActions")||{};let g=u.get("toolbar.buttonDisplay","iconAndText");function l(y){const b=[{id:"_head"},...h.getActionGroups(y)||[],{id:"_tail"}],S=[],A=E[y]||[];return b.forEach((w,T)=>{const D=h.getToolbarActions({location:y,group:w.id});D&&D.actions.length>0&&(S.length>0&&S.push(r.default.createElement("div",{className:v.default["group-split"],key:"split-"+T})),D.actions.forEach((I,O)=>{var M;let R=A.indexOf(I.id)===-1;const P="action-toggle-"+I.id;S.push(r.default.createElement("div",{className:v.default["action-item"],key:O+"_"+I.id},r.default.createElement(c.CheckBox,{onChange:()=>{a.toggleActionVisibility(y,I.id,!R),R=!R},defaultChecked:R,id:P,label:(M=I.description)!==null&&M!==void 0?M:I.id})))}))}),S.length===0?null:r.default.createElement("div",{key:y,className:v.default["toolbar-customize-location"]},S)}return r.default.createElement("div",{className:v.default["toolbar-customize-overlay"]},r.default.createElement("div",{className:v.default["toolbar-customize"]},d.map(y=>l(y)),r.default.createElement("div",{className:v.default["button-display"]},r.default.createElement("div",null,(0,p.localize)("toolbar-customize.buttonDisplay.description")),r.default.createElement(c.Select,{options:[{label:(0,p.localize)("toolbar-customize.buttonDisplay.icon"),value:"icon"},{label:(0,p.localize)("toolbar-customize.buttonDisplay.iconAndText"),value:"iconAndText"}],value:g,onChange:y=>{const b=u.inspect("toolbar.buttonDisplay").workspaceValue?p.PreferenceScope.Workspace:p.PreferenceScope.User;u.set("toolbar.buttonDisplay",y,b),g=y},className:v.default["button-display-select"]})),r.default.createElement("div",{className:v.default["customize-complete"]},r.default.createElement(c.Button,{type:"primary",onClick:()=>f(!1)},(0,p.localize)("toolbar-customize.complete")))))};t.ToolbarCustomizeComponent=_},69452:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IConnectionBackService=t.ConnectionBackServicePath=t.IFileDropFrontendServiceToken=t.IFileDropServiceToken=t.FileDropServicePath=void 0,t.FileDropServicePath="FileDropServicePath",t.IFileDropServiceToken=Symbol("IFileDropService"),t.IFileDropFrontendServiceToken=Symbol("IFileDropFrontendService"),t.ConnectionBackServicePath="ConnectionBackServicePath",t.IConnectionBackService=Symbol("IConnectionBackService")},77659:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeContextKey=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(50394);let p=class{get contextKeyService(){return this._contextKeyService}constructor(m){this._contextKeyService=this.globalContextKeyService.createScoped(m),this.inlineChatIsVisible=c.InlineChatIsVisible.bind(this._contextKeyService),this.inlineCompletionIsTrigger=c.InlineCompletionIsTrigger.bind(this._contextKeyService),this.inlineHintWidgetIsVisible=c.InlineHintWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsVisible=c.InlineInputWidgetIsVisible.bind(this._contextKeyService),this.inlineInputWidgetIsStreaming=c.InlineInputWidgetIsStreaming.bind(this._contextKeyService),this.inlineDiffPartialEditsIsVisible=c.InlineDiffPartialEditsIsVisible.bind(this._contextKeyService),this.codeEditsIsVisible=c.CodeEditsIsVisible.bind(this._contextKeyService)}};t.AINativeContextKey=p,n.__decorate([(0,r.Autowired)(o.IContextKeyService),n.__metadata("design:type",Object)],p.prototype,"globalContextKeyService",void 0),t.AINativeContextKey=p=n.__decorate([(0,r.Injectable)(),n.__param(0,(0,r.Optional)()),n.__metadata("design:paramtypes",[Object])],p)},32016:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeBrowserContribution=t.INLINE_DIFF_MANAGER_WIDGET_ID=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(50394),v=e(1149),m=e(97222),_=e(43718),s=e(82353),f=e(54414),a=e(57517),h=e(51553),u=e(63067),d=e(46507),E=e(97682),g=e(68415),l=e(96640),y=e(19413),b=e(61282),S=e(51081),A=e(59347),w=e(76154),T=e(79559),D=e(57232),I=e(72991),O=e(71863),M=e(7511),R=e(42911),P=e(72801),k=e(87817),F=e(4972),L=e(82983),N=e(73974),j=e(77633),W=e(51221),U=e(2281),X=e(31031),V=e(95608),$=e(38890),Y=e(77886),G=e(89060),H=e(74353),K=e(22169),Z=e(90058);t.INLINE_DIFF_MANAGER_WIDGET_ID="inline-diff-manager-widget";let Q=class{constructor(){this.registerFeature()}async initialize(){const{supportsChatAssistant:ne}=this.aiNativeConfigService.capabilities;ne&&(o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,y.AI_CHAT_VIEW_ID,y.AI_CHAT_CONTAINER_ID),o.ComponentRegistryImpl.addLayoutModule(this.appConfig.layoutConfig,s.DESIGN_MENU_BAR_RIGHT,y.AI_CHAT_LOGO_AVATAR_ID),this.chatProxyService.registerDefaultAgent(),this.chatInternalService.init(),await this.chatManagerService.init())}registerEditorExtensionContribution(ne){const{supportsInlineChat:he,supportsInlineCompletion:_e,supportsProblemFix:q,supportsCodeAction:Re}=this.aiNativeConfigService.capabilities;ne($.InlineDiffController.ID,new l.SyncDescriptor($.InlineDiffController,[this.injector]),E.EditorContributionInstantiation.Lazy),Re&&ne(Z.SumiLightBulbWidget.ID,Z.SumiLightBulbWidget,E.EditorContributionInstantiation.Lazy),he&&(ne(W.InlineChatEditorController.ID,new l.SyncDescriptor(W.InlineChatEditorController,[this.injector]),E.EditorContributionInstantiation.BeforeFirstInteraction),this.inlineInputService.getInteractiveInputHandler()&&(ne(Y.InlineHintController.ID,new l.SyncDescriptor(Y.InlineHintController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender),ne(G.InlineInputController.ID,new l.SyncDescriptor(G.InlineInputController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender))),_e&&(ne(M.IntelligentCompletionsController.ID,new l.SyncDescriptor(M.IntelligentCompletionsController,[this.injector]),E.EditorContributionInstantiation.Eager),ne(I.InlineCompletionsController.ID,new l.SyncDescriptor(I.InlineCompletionsController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)),q&&ne(R.ProblemFixController.ID,new l.SyncDescriptor(R.ProblemFixController,[this.injector]),E.EditorContributionInstantiation.AfterFirstRender)}onReconnect(){const{supportsMCP:ne}=this.aiNativeConfigService.capabilities;ne&&this.initMCPServers()}onDidStart(){(0,_.runWhenIdle)(()=>{const{supportsRenameSuggestions:ne,supportsInlineChat:he,supportsMCP:_e,supportsCustomLLMSettings:q}=this.aiNativeConfigService.capabilities,Re=this.preferenceService.getValid(o.AINativeSettingSectionsId.ChatVisibleType);Re==="always"?this.commandService.executeCommand(c.AI_CHAT_VISIBLE.id,!0):Re==="never"&&this.commandService.executeCommand(c.AI_CHAT_VISIBLE.id,!1),ne&&this.renameSingleHandler.load(),he&&this.codeActionSingleHandler.load(),q&&this.preferenceService.onSpecificPreferenceChange(o.AINativeSettingSectionsId.LLMModelSelection,ve=>{const ie=this.getModelByName(ve.newValue),fe=ie?Object.keys(ie):[],Me=fe.length?fe[0]:"",Le=this.preferenceSchemaProvider.getPreferenceProperty(o.AINativeSettingSectionsId.ModelID);this.preferenceSchemaProvider.setSchema({properties:{[o.AINativeSettingSectionsId.ModelID]:{...Le,default:Me,defaultValue:Me,enum:fe.length?fe:void 0}}},!0),this.preferenceService.set(o.AINativeSettingSectionsId.ModelID,Me,ve.scope),this.preferenceSettings.setEnumLabels(o.AINativeSettingSectionsId.ModelID,fe.reduce((Ce,Se)=>({...Ce,[Se]:Se}),{}))}),_e&&this.initMCPServers()})}initMCPServers(){var ne;const he=this.preferenceService.getValid(o.AINativeSettingSectionsId.MCPServers),_e=he?.find(q=>q.name===y.BUILTIN_MCP_SERVER_NAME);if(this.sumiMCPServerBackendProxy.initBuiltinMCPServer((ne=_e?.enabled)!==null&&ne!==void 0?ne:!0),he&&he.length>0){const q=he.filter(Re=>Re.name!==y.BUILTIN_MCP_SERVER_NAME);q.length>0&&this.sumiMCPServerBackendProxy.initExternalMCPServers(q)}}getModelByName(ne){switch(ne){case"deepseek":return y.deepSeekModels;case"anthropic":return y.anthropicModels;case"openai":return y.openAiNativeModels;default:return}}registerFeature(){this.contributions.getContributions().forEach(ne=>{var he,_e,q,Re,ve,ie,fe,Me,Le;(he=ne.registerInlineChatFeature)===null||he===void 0||he.call(ne,this.inlineChatFeatureRegistry),(_e=ne.registerChatFeature)===null||_e===void 0||_e.call(ne,this.chatFeatureRegistry),(q=ne.registerResolveConflictFeature)===null||q===void 0||q.call(ne,this.resolveConflictRegistry),(Re=ne.registerRenameProvider)===null||Re===void 0||Re.call(ne,this.renameCandidatesProviderRegistry),(ve=ne.registerChatRender)===null||ve===void 0||ve.call(ne,this.chatRenderRegistry),(ie=ne.registerTerminalProvider)===null||ie===void 0||ie.call(ne,this.terminalProviderRegistry),(fe=ne.registerIntelligentCompletionFeature)===null||fe===void 0||fe.call(ne,this.intelligentCompletionsRegistry),(Me=ne.registerProblemFixFeature)===null||Me===void 0||Me.call(ne,this.problemFixProviderRegistry),(Le=ne.registerChatAgentPromptProvider)===null||Le===void 0||Le.call(ne)}),this.mcpServerContributions.getContributions().forEach(ne=>{ne.registerMCPServer(this.mcpServerRegistry)})}registerSetting(ne){ne.registerSettingGroup({id:o.AI_NATIVE_SETTING_GROUP_ID,title:_.AI_NATIVE_SETTING_GROUP_TITLE,iconClass:(0,o.getIcon)("magic-wand")}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.chat.title"),preferences:[{id:o.AINativeSettingSectionsId.ChatVisibleType,localized:"preference.ai.native.chat.visible.type"}]}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.interface.quick.title"),preferences:[{id:o.AINativeSettingSectionsId.InterfaceQuickNavigationEnabled,localized:"preference.ai.native.interface.quick.navigation"}]}),this.aiNativeConfigService.capabilities.supportsInlineCompletion&&(ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.intelligentCompletions.title"),preferences:[{id:o.AINativeSettingSectionsId.IntelligentCompletionsCacheEnabled,localized:"preference.ai.native.intelligentCompletions.cache.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,localized:"preference.ai.native.intelligentCompletions.debounceTime"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,localized:"preference.ai.native.intelligentCompletions.promptEngineering.enabled"},{id:o.AINativeSettingSectionsId.IntelligentCompletionsAlwaysVisible,localized:"preference.ai.native.intelligentCompletions.alwaysVisible"}]}),ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.codeEdits.title"),preferences:[{id:o.AINativeSettingSectionsId.CodeEditsLintErrors,localized:"preference.ai.native.codeEdits.lintErrors"},{id:o.AINativeSettingSectionsId.CodeEditsLineChange,localized:"preference.ai.native.codeEdits.lineChange"},{id:o.AINativeSettingSectionsId.CodeEditsTyping,localized:"preference.ai.native.codeEdits.typing"},{id:o.AINativeSettingSectionsId.CodeEditsRenderType,localized:"preference.ai.native.codeEdits.renderType"},{id:o.AINativeSettingSectionsId.SystemPrompt,localized:"preference.ai.native.chat.system.prompt"}]})),this.aiNativeConfigService.capabilities.supportsCustomLLMSettings&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.llm.apiSettings.title"),preferences:[{id:o.AINativeSettingSectionsId.LLMModelSelection,localized:"preference.ai.native.llm.model.selection"},{id:o.AINativeSettingSectionsId.ModelID,localized:"preference.ai.native.llm.model.id"},{id:o.AINativeSettingSectionsId.DeepseekApiKey,localized:"preference.ai.native.deepseek.apiKey"},{id:o.AINativeSettingSectionsId.AnthropicApiKey,localized:"preference.ai.native.anthropic.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiApiKey,localized:"preference.ai.native.openai.apiKey"},{id:o.AINativeSettingSectionsId.OpenaiBaseURL,localized:"preference.ai.native.openai.baseURL"}]}),this.aiNativeConfigService.capabilities.supportsMCP&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.mcp.settings.title"),preferences:[{id:o.AINativeSettingSectionsId.MCPServers,localized:"preference.ai.native.mcp.servers"}]}),this.aiNativeConfigService.capabilities.supportsInlineChat&&ne.registerSettingSection(o.AI_NATIVE_SETTING_GROUP_ID,{title:(0,o.localize)("preference.ai.native.inlineChat.title"),preferences:[{id:o.AINativeSettingSectionsId.InlineChatAutoVisible,localized:"preference.ai.native.inlineChat.auto.visible"},{id:o.AINativeSettingSectionsId.InlineChatCodeActionEnabled,localized:"preference.ai.native.inlineChat.codeAction.enabled"},{id:o.AINativeSettingSectionsId.InlineDiffPreviewMode,localized:"preference.ai.native.inlineDiff.preview.mode"}]})}registerEditorFeature(ne){ne.registerEditorFeatureContribution({contribute:he=>{const{monacoEditor:_e}=he;return this.codeActionSingleHandler.mountEditor(he.monacoEditor),_e.onDidScrollChange(()=>{this.ctxMenuRenderer.visible&&this.ctxMenuRenderer.hide(!0)})}})}registerEditorComponent(ne){ne.registerEditorSideWidget({id:t.INLINE_DIFF_MANAGER_WIDGET_ID,component:V.InlineDiffManager,displaysOnResource:he=>{var _e;return!!(this.aiNativeConfigService.capabilities.supportsMCP&&(!((_e=this.applyService.getUriCodeBlocks(he.uri))===null||_e===void 0)&&_e.filter(q=>q.status==="pending").length))}})}registerCommands(ne){ne.registerCommand(c.AI_INLINE_CHAT_VISIBLE,{execute:he=>{this.aiInlineChatService._onInlineChatVisible.fire(he)}}),ne.registerCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE,{execute:async he=>{var _e;if(!he){this.inlineInputService.hide();return}this.commandService.executeCommand(c.AI_INLINE_CHAT_VISIBLE.id,!1);const q=this.workbenchEditorService.currentCodeEditor;if(!q)return;const Re=q.monacoEditor.getPosition();if(!Re)return;const ve=q.monacoEditor.getSelection();if(Re?((_e=q.monacoEditor.getModel())===null||_e===void 0?void 0:_e.getLineLength(Re.lineNumber))===0:!1){this.inlineInputService.visibleByPosition(Re);return}if(ve&&!ve.isEmpty()){this.inlineInputService.visibleBySelection(ve);return}this.inlineInputService.visibleByNearestCodeBlock(Re,q.monacoEditor)}}),ne.registerCommand(c.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL,{execute:()=>{var he;const _e=this.workbenchEditorService.currentCodeEditor;_e&&((he=G.InlineInputController.get(_e.monacoEditor))===null||he===void 0||he.cancelToken())}}),ne.registerCommand(c.AI_INLINE_COMPLETION_REPORTER,{execute:(he,_e,q,Re)=>{this.aiCompletionsService.report({sessionId:_e,accept:q,relationId:he,code:Re})}}),ne.registerCommand(c.AI_CHAT_VISIBLE,{execute:he=>{this.layoutService.toggleSlot(y.AI_CHAT_VIEW_ID,(0,_.isUndefined)(he)?!0:he)}}),ne.registerCommand(c.AI_INLINE_COMPLETION_VISIBLE,{execute:async he=>{he||(this.aiCompletionsService.hideStatusBarItem(),this.aiInlineCompletionsProvider.setVisibleCompletion(!1),this.aiInlineCompletionsProvider.cancelRequest())}}),ne.registerCommand(c.AI_INLINE_DIFF_PARTIAL_EDIT,{execute:he=>{this.inlineStreamDiffService.launchAcceptDiscardPartialEdit(he)}}),ne.afterExecuteCommand(g.HideInlineCompletion.ID,()=>{this.commandService.executeCommand(c.AI_INLINE_COMPLETION_VISIBLE.id,!1)})}registerRenderer(ne){this.designLayoutConfig.supportExternalChatPanel?ne.registerSlotRenderer(y.AI_CHAT_VIEW_ID,F.AIChatTabRendererWithTab):ne.registerSlotRenderer(y.AI_CHAT_VIEW_ID,F.AIChatTabRenderer),this.designLayoutConfig.useMergeRightWithLeftPanel&&(ne.registerSlotRenderer(o.SlotLocation.left,F.AILeftTabRenderer),ne.registerSlotRenderer(o.SlotLocation.right,F.AIRightTabRenderer))}registerComponent(ne){ne.register(y.AI_CHAT_CONTAINER_ID,[],{component:w.AIChatView,title:(0,o.localize)("aiNative.chat.ai.assistant.name"),iconClass:(0,o.getIcon)("magic-wand"),containerId:y.AI_CHAT_CONTAINER_ID}),ne.register(y.AI_MENU_BAR_DEBUG_TOOLBAR,{id:y.AI_MENU_BAR_DEBUG_TOOLBAR,component:k.AIRunToolbar}),ne.register(y.AI_CHAT_LOGO_AVATAR_ID,{id:y.AI_CHAT_LOGO_AVATAR_ID,component:L.AIChatLogoAvatar})}registerKeybindings(ne){this.aiNativeConfigService.capabilities.supportsInlineChat&&(ne.registerKeybinding({command:c.AI_INLINE_CHAT_VISIBLE.id,keybinding:"ctrlcmd+i",when:"editorTextFocus",args:!0,priority:0},o.KeybindingScope.USER),ne.registerKeybinding({command:c.AI_INLINE_CHAT_VISIBLE.id,keybinding:"esc",args:!1,when:`editorFocus && ${p.InlineChatIsVisible.raw}`}),this.inlineInputService.getInteractiveInputHandler()&&(ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && (${p.InlineChatIsVisible.raw} || inlineSuggestionVisible)`},o.KeybindingScope.USER),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:"esc",args:!1,priority:0,when:`editorFocus && ${p.InlineInputWidgetIsVisible.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_CANCEL.id,keybinding:"esc",priority:1,when:`editorFocus && ${p.InlineInputWidgetIsStreaming.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_CHAT_INTERACTIVE_INPUT_VISIBLE.id,keybinding:this.aiNativeConfigService.inlineChat.inputKeybinding,args:!0,priority:0,when:`editorFocus && ${p.InlineHintWidgetIsVisible.raw} && ${p.InlineChatIsVisible.not}`},o.KeybindingScope.USER))),ne.registerKeybinding({command:c.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+y",args:!0,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`}),ne.registerKeybinding({command:c.AI_INLINE_DIFF_PARTIAL_EDIT.id,keybinding:"ctrl+n",args:!1,priority:100,when:`editorTextFocus && ${p.InlineDiffPartialEditsIsVisible.raw}`})}};t.AINativeBrowserContribution=Q,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],Q.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],Q.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(m.IBrowserCtxMenu),n.__metadata("design:type",m.IBrowserCtxMenu)],Q.prototype,"ctxMenuRenderer",void 0),n.__decorate([(0,r.Autowired)(j.AINativeCoreContribution),n.__metadata("design:type",Object)],Q.prototype,"contributions",void 0),n.__decorate([(0,r.Autowired)(j.MCPServerContribution),n.__metadata("design:type",Object)],Q.prototype,"mcpServerContributions",void 0),n.__decorate([(0,r.Autowired)(j.TokenMCPServerRegistry),n.__metadata("design:type",Object)],Q.prototype,"mcpServerRegistry",void 0),n.__decorate([(0,r.Autowired)(_.InlineChatFeatureRegistryToken),n.__metadata("design:type",U.InlineChatFeatureRegistry)],Q.prototype,"inlineChatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"chatFeatureRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ChatRenderRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"chatRenderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ResolveConflictRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"resolveConflictRegistry",void 0),n.__decorate([(0,r.Autowired)(_.RenameCandidatesProviderRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"renameCandidatesProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.TerminalRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"terminalProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(_.IntelligentCompletionsRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(_.ProblemFixRegistryToken),n.__metadata("design:type",Object)],Q.prototype,"problemFixProviderRegistry",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],Q.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(v.DesignLayoutConfig),n.__metadata("design:type",v.DesignLayoutConfig)],Q.prototype,"designLayoutConfig",void 0),n.__decorate([(0,r.Autowired)(O.AICompletionsService),n.__metadata("design:type",O.AICompletionsService)],Q.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(D.AIInlineCompletionsProvider),n.__metadata("design:type",D.AIInlineCompletionsProvider)],Q.prototype,"aiInlineCompletionsProvider",void 0),n.__decorate([(0,r.Autowired)(_.CommandService),n.__metadata("design:type",Object)],Q.prototype,"commandService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceSchemaProvider),n.__metadata("design:type",o.PreferenceSchemaProvider)],Q.prototype,"preferenceSchemaProvider",void 0),n.__decorate([(0,r.Autowired)(o.IPreferenceSettingsService),n.__metadata("design:type",Object)],Q.prototype,"preferenceSettings",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],Q.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(u.IMainLayoutService),n.__metadata("design:type",Object)],Q.prototype,"layoutService",void 0),n.__decorate([(0,r.Autowired)(y.ChatProxyServiceToken),n.__metadata("design:type",S.ChatProxyService)],Q.prototype,"chatProxyService",void 0),n.__decorate([(0,r.Autowired)(o.IAIInlineChatService),n.__metadata("design:type",X.InlineChatService)],Q.prototype,"aiInlineChatService",void 0),n.__decorate([(0,r.Autowired)(H.InlineInputService),n.__metadata("design:type",H.InlineInputService)],Q.prototype,"inlineInputService",void 0),n.__decorate([(0,r.Autowired)(K.InlineStreamDiffService),n.__metadata("design:type",K.InlineStreamDiffService)],Q.prototype,"inlineStreamDiffService",void 0),n.__decorate([(0,r.Autowired)(P.RenameSingleHandler),n.__metadata("design:type",P.RenameSingleHandler)],Q.prototype,"renameSingleHandler",void 0),n.__decorate([(0,r.Autowired)(T.CodeActionSingleHandler),n.__metadata("design:type",T.CodeActionSingleHandler)],Q.prototype,"codeActionSingleHandler",void 0),n.__decorate([(0,r.Autowired)(y.SumiMCPServerProxyServicePath),n.__metadata("design:type",Object)],Q.prototype,"sumiMCPServerBackendProxy",void 0),n.__decorate([(0,r.Autowired)(f.WorkbenchEditorService),n.__metadata("design:type",h.WorkbenchEditorServiceImpl)],Q.prototype,"workbenchEditorService",void 0),n.__decorate([(0,r.Autowired)(y.IChatManagerService),n.__metadata("design:type",b.ChatManagerService)],Q.prototype,"chatManagerService",void 0),n.__decorate([(0,r.Autowired)(y.IChatInternalService),n.__metadata("design:type",A.ChatInternalService)],Q.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(N.BaseApplyService),n.__metadata("design:type",N.BaseApplyService)],Q.prototype,"applyService",void 0),t.AINativeBrowserContribution=Q=n.__decorate([(0,o.Domain)(o.ClientAppContribution,a.BrowserEditorContribution,o.CommandContribution,d.SettingContribution,o.KeybindingContribution,o.ComponentContribution,o.SlotRendererContribution,o.MonacoContribution),n.__metadata("design:paramtypes",[])],Q)},96366:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ApplyService=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57517),p=e(19413),v=e(73974),m=e(51081);let _=class extends v.BaseApplyService{async doApply(f){const a=new o.URI(o.path.join(this.appConfig.workspaceDir,f.relativePath)),u=(await this.modelService.createModelReference(a)).instance.getMonacoModel().getValue();return{stream:await this.aiBackService.requestStream(`Merge all changes from the <update> snippet into the <code> below.
30161
+ - Preserve the code's structure, order, comments, and indentation exactly.
30162
+ - Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
30163
+ - Do not include any additional text, explanations, placeholders, ellipses, or code fences.
30164
+
30165
+ <code>${u}</code>
30166
+
30167
+ <update>${f.codeEdit}</update>
30168
+
30169
+ Provide the complete updated code.
30170
+ `,{...this.chatProxyService.getRequestOptions(),trimTexts:["<updated-code>","</updated-code>"],system:"You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated."})}}};t.ApplyService=_,n.__decorate([(0,r.Autowired)(c.IEditorDocumentModelService),n.__metadata("design:type",Object)],_.prototype,"modelService",void 0),n.__decorate([(0,r.Autowired)(o.AIBackSerivcePath),n.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),n.__decorate([(0,r.Autowired)(p.ChatProxyServiceToken),n.__metadata("design:type",m.ChatProxyService)],_.prototype,"chatProxyService",void 0),t.ApplyService=_=n.__decorate([(0,r.Injectable)()],_)},74055:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentService=void 0;const n=e(85608),r=n.__importDefault(e(66652)),o=e(76003),c=e(43718),p=e(46044),v=e(73307),m=e(29770);let _=class extends c.Disposable{constructor(){super(),this.agents=new Map,this.initialUserMessageMap=new Map,this.shouldUpdateContext=!1,this._onDidChangeAgents=new c.Emitter,this.onDidChangeAgents=this._onDidChangeAgents.event,this._onDidSendMessage=new c.Emitter,this.onDidSendMessage=this._onDidSendMessage.event,this.addDispose(this._onDidChangeAgents),this.addDispose(this.contextService.onDidContextFilesChangeEvent(f=>{f.version!==this.contextVersion&&(this.contextVersion=f.version,this.shouldUpdateContext=!0)}))}registerAgent(f){if(this.agents.has(f.id))throw new Error(`Already registered an agent with id ${f.id}`);return this.agents.set(f.id,{agent:f,commands:[]}),this._onDidChangeAgents.fire(),(0,c.toDisposable)(()=>{this.agents.delete(f.id)&&this._onDidChangeAgents.fire()})}async updateAgent(f,a){const h=this.agents.get(f);if(!h)throw new Error(`No agent with id ${f} registered`);h.agent.metadata={...h.agent.metadata,...a},h.commands=await h.agent.provideSlashCommands(c.CancellationToken.None),a.isDefault&&(this.defaultAgentId=f);const u=await h.agent.provideChatWelcomeMessage(c.CancellationToken.None);if(u){const{content:d,sampleQuestions:E}=u;this.chatFeatureRegistry.registerWelcome(d,E)}this._onDidChangeAgents.fire()}getAgents(){return Array.from(this.agents.values(),f=>f.agent)}hasAgent(f){return this.agents.has(f)}getDefaultAgentId(){return this.defaultAgentId}getAgent(f){const a=this.agents.get(f);return a?.agent}async invokeAgent(f,a,h,u,d){const E=this.agents.get(f);if(!E)throw new Error(`No agent with id ${f}`);if(this.initialUserMessageMap.has(a.sessionId))(this.shouldUpdateContext||a.regenerate||u.length===0)&&(a.message=this.provideContextMessage(a.message,a.sessionId),this.shouldUpdateContext=!1);else{this.initialUserMessageMap.set(a.sessionId,a.message);const l=a.message;a.message=this.provideContextMessage(l,a.sessionId)}return await E.agent.invoke(a,h,u,d)}provideContextMessage(f,a){const h=this.contextService.serialize(),u=this.promptProvider.provideContextPrompt(h,f);return this.aiReporter.send({msgType:c.AIServiceType.Chat,actionType:c.ActionTypeEnum.ContextEnhance,actionSource:c.ActionSourceEnum.Chat,sessionId:a,message:u}),u}populateChatInput(f,a){this.aiChatService.sendMessage({...a,agentId:f,immediate:!1})}getCommands(){return(0,r.default)(Array.from(this.agents.values(),({agent:f,commands:a})=>a.map(h=>({...h,agentId:f.id}))))}async getFollowups(f,a,h){const u=this.agents.get(f);if(!u)throw new Error(`No agent with id ${f}`);return u.agent.provideFollowups?u.agent.provideFollowups(a,h):[]}async getSampleQuestions(f,a){const h=this.agents.get(f);if(!h)throw new Error(`No agent with id ${f}`);return h.agent.provideSampleQuestions?h.agent.provideSampleQuestions(a):[]}async getAllSampleQuestions(){const f=await Promise.all(Array.from(this.agents.values()).map(async({agent:a})=>{try{return await this.getSampleQuestions(a.id,c.CancellationToken.None)}catch(h){return this.logger.error(h),[]}}));return(0,r.default)(f)}sendMessage(f){this._onDidSendMessage.fire(f)}parseMessage(f,a){var h;const u={agentId:"",command:"",message:f};let d=a;const E=this.getAgents(),g=new RegExp(`^@(${E.map(y=>y.id).join("|")})(?:\\s+|$)`,"i"),l=u.message.match(g);if(l){const y=E.find(b=>b.id.toLowerCase()===l[1].toLowerCase());if(!y)return u;d=y.id,u.agentId=d,u.message=u.message.replace(l[0],"")}if(d){const y=(h=this.agents.get(d))===null||h===void 0?void 0:h.commands;if(y?.length){const b=new RegExp(`^/\\s?(${y.map(A=>A.name).join("|")})(?:\\s+|$)`,"i"),S=u.message.match(b);if(S){const A=y.find(w=>w.name.toLowerCase()===S[1].toLowerCase());if(!A)return u;u.command=A.name,u.message=u.message.replace(S[0],"")}}}return u}};t.ChatAgentService=_,n.__decorate([(0,o.Autowired)(c.ILogger),n.__metadata("design:type",Object)],_.prototype,"logger",void 0),n.__decorate([(0,o.Autowired)(c.IAIReporter),n.__metadata("design:type",Object)],_.prototype,"aiReporter",void 0),n.__decorate([(0,o.Autowired)(p.LLMContextServiceToken),n.__metadata("design:type",Object)],_.prototype,"contextService",void 0),n.__decorate([(0,o.Autowired)(v.ChatAgentPromptProvider),n.__metadata("design:type",Object)],_.prototype,"promptProvider",void 0),n.__decorate([(0,o.Autowired)(c.ChatServiceToken),n.__metadata("design:type",m.ChatService)],_.prototype,"aiChatService",void 0),n.__decorate([(0,o.Autowired)(c.ChatFeatureRegistryToken),n.__metadata("design:type",Object)],_.prototype,"chatFeatureRegistry",void 0),t.ChatAgentService=_=n.__decorate([(0,o.Injectable)(),n.__metadata("design:paramtypes",[])],_)},84543:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatAgentViewService=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(19413),p=e(51081);let v=class{constructor(){this.componentsMap=new Map,this.componentsDeferredMap=new Map}registerChatComponent(_){return this.componentsMap.set(_.id,_),this.componentsDeferredMap.has(_.id)&&(this.componentsDeferredMap.get(_.id).resolve(_),this.componentsDeferredMap.delete(_.id)),{dispose:()=>{this.componentsMap.get(_.id)===_&&(this.componentsMap.delete(_.id),this.componentsDeferredMap.delete(_.id))}}}getChatComponent(_){return this.componentsMap.has(_)?this.componentsMap.get(_):(this.componentsDeferredMap.has(_)||this.componentsDeferredMap.set(_,new o.Deferred),null)}getChatComponentDeferred(_){return this.componentsDeferredMap.get(_)||null}getRenderAgents(){return this.chatAgentService.getAgents().filter(_=>_.id!==p.ChatProxyService.AGENT_ID)}};t.ChatAgentViewService=v,n.__decorate([(0,r.Autowired)(c.IChatAgentService),n.__metadata("design:type",Object)],v.prototype,"chatAgentService",void 0),t.ChatAgentViewService=v=n.__decorate([(0,r.Injectable)()],v)},61282:(x,t,e)=>{"use strict";var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatManagerService=void 0;const o=e(85608),c=e(76003),p=e(43718),v=e(19413),m=e(44260),_=e(42033),s=20;let f=class extends p.Disposable{fromJSON(h){return h.map(u=>{const d=new _.ChatModel({sessionId:u.sessionId,history:new m.MsgHistoryManager(u.history)}),E=u.requests.map(g=>new _.ChatRequestModel(g.requestId,d,g.message,new _.ChatResponseModel(g.requestId,d,g.message.agentId,{responseContents:g.response.responseContents,isComplete:!0,responseText:g.response.responseText,responseParts:g.response.responseParts,errorDetails:g.response.errorDetails,followups:g.response.followups,isCanceled:g.response.isCanceled})));return d.restoreRequests(E),d})}constructor(){super(),n.set(this,this.registerDispose(new p.DisposableMap)),r.set(this,this.registerDispose(new p.DisposableMap)),this.storageInitEmitter=new p.Emitter,this.onStorageInit=this.storageInitEmitter.event}async init(){this._chatStorage=await this.storageProvider(p.STORAGE_NAMESPACE.CHAT);const h=this._chatStorage.get("sessionModels",[]);this.fromJSON(h).forEach(d=>{o.__classPrivateFieldGet(this,n,"f").set(d.sessionId,d),this.listenSession(d)}),await this.storageInitEmitter.fireAndAwait()}getSessions(){return Array.from(o.__classPrivateFieldGet(this,n,"f").values())}startSession(){if(o.__classPrivateFieldGet(this,n,"f").size>=s)throw new Error((0,p.formatLocalize)("aiNative.chat.session.max",s.toString()));const h=new _.ChatModel;return o.__classPrivateFieldGet(this,n,"f").set(h.sessionId,h),this.listenSession(h),h}getSession(h){return o.__classPrivateFieldGet(this,n,"f").get(h)}clearSession(h){var u;if(!o.__classPrivateFieldGet(this,n,"f").get(h))throw new Error(`Unknown session: ${h}`);o.__classPrivateFieldGet(this,n,"f").disposeKey(h),(u=o.__classPrivateFieldGet(this,r,"f").get(h))===null||u===void 0||u.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(h),this.saveSessions()}createRequest(h,u,d,E){const g=this.getSession(h);if(!g)throw new Error(`Unknown session: ${h}`);if(!o.__classPrivateFieldGet(this,r,"f").has(h))return g.addRequest({prompt:u,agentId:d,command:E})}async sendRequest(h,u,d){const E=this.getSession(h);if(!E)throw new Error(`Unknown session: ${h}`);const g=new p.CancellationTokenSource,l=g.token;o.__classPrivateFieldGet(this,r,"f").set(E.sessionId,g);const y=l.onCancellationRequested(()=>{u.response.cancel()}),b=E.messageHistory;try{const S=T=>{l.isCancellationRequested||E.acceptResponseProgress(u,T)},A={sessionId:h,requestId:u.requestId,message:u.message.prompt,command:u.message.command,regenerate:d},w=await this.chatAgentService.invokeAgent(u.message.agentId,A,S,b,l);l.isCancellationRequested||(w.errorDetails&&u.response.setErrorDetails(w.errorDetails),this.chatAgentService.getFollowups(u.message.agentId,h,p.CancellationToken.None).then(D=>{u.response.setFollowups(D),u.response.complete()}))}finally{y.dispose(),o.__classPrivateFieldGet(this,r,"f").disposeKey(E.sessionId),this.saveSessions()}}listenSession(h){this.addDispose(h.history.onMessageAdditionalChange(()=>{this.saveSessions()}))}saveSessions(){this._chatStorage.set("sessionModels",this.getSessions())}cancelRequest(h){var u;(u=o.__classPrivateFieldGet(this,r,"f").get(h))===null||u===void 0||u.cancel(),o.__classPrivateFieldGet(this,r,"f").disposeKey(h),this.saveSessions()}};t.ChatManagerService=f,n=new WeakMap,r=new WeakMap,o.__decorate([(0,c.Autowired)(c.INJECTOR_TOKEN),o.__metadata("design:type",c.Injector)],f.prototype,"injector",void 0),o.__decorate([(0,c.Autowired)(v.IChatAgentService),o.__metadata("design:type",Object)],f.prototype,"chatAgentService",void 0),o.__decorate([(0,c.Autowired)(p.StorageProvider),o.__metadata("design:type",Function)],f.prototype,"storageProvider",void 0),o.__decorate([(0,p.debounce)(1e3),o.__metadata("design:type",Function),o.__metadata("design:paramtypes",[]),o.__metadata("design:returntype",void 0)],f.prototype,"saveSessions",null),t.ChatManagerService=f=o.__decorate([(0,c.Injectable)(),o.__metadata("design:paramtypes",[])],f)},42033:(x,t,e)=>{"use strict";var n,r,o,c,p,v,m,_,s,f,a,h,u,d,E;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatSlashCommandItemModel=t.ChatWelcomeMessageModel=t.ChatModel=t.ChatRequestModel=t.ChatResponseModel=void 0;const g=e(85608),l=e(76003),y=e(43718),b=e(90684),S=e(19413),A=e(44260);class w extends y.Disposable{get responseParts(){return g.__classPrivateFieldGet(this,r,"f")}get responseContents(){return g.__classPrivateFieldGet(this,o,"f")}get isComplete(){return g.__classPrivateFieldGet(this,c,"f")}get isCanceled(){return g.__classPrivateFieldGet(this,p,"f")}get requestId(){return g.__classPrivateFieldGet(this,v,"f")}get responseText(){return g.__classPrivateFieldGet(this,m,"f")}get errorDetails(){return g.__classPrivateFieldGet(this,_,"f")}get followups(){return g.__classPrivateFieldGet(this,s,"f")}get onDidChange(){return g.__classPrivateFieldGet(this,f,"f").event}constructor(R,P,k,F){super(),n.add(this),this.session=P,this.agentId=k,r.set(this,[]),o.set(this,[]),c.set(this,!1),p.set(this,!1),v.set(this,void 0),m.set(this,""),_.set(this,void 0),s.set(this,void 0),f.set(this,this.registerDispose(new y.Emitter)),g.__classPrivateFieldSet(this,v,R,"f"),F&&(g.__classPrivateFieldSet(this,o,F.responseContents,"f"),g.__classPrivateFieldSet(this,r,F.responseParts||[],"f"),g.__classPrivateFieldSet(this,m,F.responseText,"f"),g.__classPrivateFieldSet(this,c,F.isComplete,"f"),g.__classPrivateFieldSet(this,p,F.isCanceled,"f"),g.__classPrivateFieldSet(this,_,F.errorDetails,"f"),g.__classPrivateFieldSet(this,s,F.followups,"f"))}updateContent(R,P){var k;const F=g.__classPrivateFieldGet(this,r,"f").length-1;if(R.kind==="content"||R.kind==="markdownContent"){const L=g.__classPrivateFieldGet(this,r,"f")[F];!L||L.kind!=="markdownContent"?R.kind==="content"?g.__classPrivateFieldGet(this,r,"f").push({content:new b.MarkdownString(R.content),kind:"markdownContent"}):g.__classPrivateFieldGet(this,r,"f").push(R):R.kind==="markdownContent"?g.__classPrivateFieldGet(this,r,"f")[F]={content:new b.MarkdownString(L.content.value+R.content.value),kind:"markdownContent"}:g.__classPrivateFieldGet(this,r,"f")[F]={content:new b.MarkdownString(L.content.value+R.content,L.content),kind:"markdownContent"},g.__classPrivateFieldGet(this,n,"m",a).call(this)}else if(R.kind==="asyncContent"){const L=g.__classPrivateFieldGet(this,r,"f").push(R)-1;g.__classPrivateFieldGet(this,n,"m",a).call(this),(k=R.resolvedContent)===null||k===void 0||k.then(N=>{typeof N=="string"?g.__classPrivateFieldGet(this,r,"f")[L]={content:new b.MarkdownString(N),kind:"markdownContent"}:(0,b.isMarkdownString)(N)?g.__classPrivateFieldGet(this,r,"f")[L]={content:N,kind:"markdownContent"}:g.__classPrivateFieldGet(this,r,"f")[L]=N,g.__classPrivateFieldGet(this,n,"m",a).call(this,P)})}else if(R.kind==="treeData"||R.kind==="component")g.__classPrivateFieldGet(this,r,"f").push(R),g.__classPrivateFieldGet(this,n,"m",a).call(this,P);else if(R.kind==="toolCall"){const L=g.__classPrivateFieldGet(this,r,"f").find(N=>N.kind==="toolCall"&&N.content.id===R.content.id);L?L.content=R.content:g.__classPrivateFieldGet(this,r,"f").push(R),g.__classPrivateFieldGet(this,n,"m",a).call(this,P)}}complete(){g.__classPrivateFieldSet(this,c,!0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}cancel(){g.__classPrivateFieldSet(this,c,!0,"f"),g.__classPrivateFieldSet(this,p,!0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}reset(){g.__classPrivateFieldSet(this,o,[],"f"),g.__classPrivateFieldSet(this,r,[],"f"),g.__classPrivateFieldSet(this,m,"","f"),g.__classPrivateFieldSet(this,p,!1,"f"),g.__classPrivateFieldSet(this,c,!1,"f"),g.__classPrivateFieldSet(this,_,void 0,"f"),g.__classPrivateFieldSet(this,s,void 0,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}setErrorDetails(R){g.__classPrivateFieldSet(this,_,R,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}setFollowups(R){g.__classPrivateFieldSet(this,s,R,"f"),g.__classPrivateFieldGet(this,f,"f").fire()}toJSON(){return{isCanceled:this.isCanceled,responseContents:this.responseContents,responseText:this.responseText,responseParts:this.responseParts,errorDetails:this.errorDetails,followups:this.followups}}}t.ChatResponseModel=w,r=new WeakMap,o=new WeakMap,c=new WeakMap,p=new WeakMap,v=new WeakMap,m=new WeakMap,_=new WeakMap,s=new WeakMap,f=new WeakMap,n=new WeakSet,a=function(R){g.__classPrivateFieldSet(this,m,g.__classPrivateFieldGet(this,r,"f").map(k=>k.kind==="asyncContent"?k.content:k.kind==="treeData"||k.kind==="component"?"":k.kind==="toolCall"?k.content.function.name:k.content.value).join(`
30161
30171
 
30162
- `),"f");const P=[];for(const k of g.__classPrivateFieldGet(this,r,"f")){const F=P[P.length-1];k.kind==="markdownContent"&&F?.kind==="markdownContent"?P[P.length-1]={content:new b.MarkdownString(F.content.value+k.content.value,{isTrusted:F.content.isTrusted}),kind:"markdownContent"}:P.push(k)}g.__classPrivateFieldSet(this,o,P,"f"),R||g.__classPrivateFieldGet(this,f,"f").fire()};class T{get requestId(){return g.__classPrivateFieldGet(this,h,"f")}constructor(R,P,k,F){this.session=P,this.message=k,this.response=F,h.set(this,void 0),g.__classPrivateFieldSet(this,h,R,"f")}toJSON(){return{requestId:this.requestId,message:this.message,response:this.response}}}t.ChatRequestModel=T,h=new WeakMap;class D extends y.Disposable{constructor(R){var P,k;super(),u.set(this,void 0),d.set(this,new Map),g.__classPrivateFieldSet(this,u,(P=R?.sessionId)!==null&&P!==void 0?P:(0,y.uuid)(),"f"),this.history=(k=R?.history)!==null&&k!==void 0?k:new A.MsgHistoryManager,R?.requests&&g.__classPrivateFieldSet(this,d,new Map(R.requests.map(F=>[F.requestId,F])),"f")}get sessionId(){return g.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(g.__classPrivateFieldGet(this,d,"f").values())}restoreRequests(R){g.__classPrivateFieldSet(this,d,new Map(R.map(P=>[P.requestId,P])),"f")}get messageHistory(){const R=[];for(const P of this.requests)if(P.response.isComplete){R.push({role:"user",content:P.message.prompt});for(const k of P.response.responseParts)k.kind==="treeData"||k.kind==="component"||(k.kind!=="toolCall"?R.push({role:"assistant",content:[{type:"text",text:k.kind==="markdownContent"?k.content.value:k.content}]}):(R[R.length-1].role!=="assistant"&&R.push({role:"assistant",content:[]}),R[R.length-1].content.push({type:"tool-call",toolCallId:k.content.id,toolName:k.content.function.name,args:JSON.parse(k.content.function.arguments||"{}")}),R.push({role:"tool",content:[{type:"tool-result",toolCallId:k.content.id,toolName:k.content.function.name,result:JSON.parse(k.content.result||"{}")}]})))}return R}addRequest(R){const P=R,k=`${this.sessionId}_request_${D.requestIdPool++}`,F=new w(k,this,P.agentId),L=new T(k,this,P,F);return g.__classPrivateFieldGet(this,d,"f").set(k,L),L}acceptResponseProgress(R,P,k){if(R.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");const{kind:F}=P;["content","markdownContent","asyncContent","treeData","component","toolCall"].includes(F)?R.response.updateContent(P,k):console.error(`Couldn't handle progress: ${JSON.stringify(P)}`)}getRequest(R){return g.__classPrivateFieldGet(this,d,"f").get(R)}dispose(){super.dispose(),g.__classPrivateFieldGet(this,d,"f").forEach(R=>R.response.dispose())}toJSON(){return{sessionId:this.sessionId,history:this.history,requests:this.requests}}}t.ChatModel=D,u=new WeakMap,d=new WeakMap,D.requestIdPool=0;let I=E=class extends y.Disposable{get id(){return this._id}constructor(R,P){super(),this.content=R,this.sampleQuestions=P,this._id="welcome_"+E.nextId++}};t.ChatWelcomeMessageModel=I,I.nextId=0,t.ChatWelcomeMessageModel=I=E=g.__decorate([(0,l.Injectable)({multiple:!0}),g.__metadata("design:paramtypes",[Object,Array])],I);let O=class extends y.Disposable{constructor(R,P,k){super(),this.chatCommand=R,this.command=P,this.agentId=k}get name(){return this.chatCommand.name}get isShortcut(){return!!this.chatCommand.isShortcut}get icon(){return this.chatCommand.icon}get description(){return this.chatCommand.description}get tooltip(){return this.chatCommand.tooltip}get nameWithSlash(){return this.name.startsWith(S.SLASH_SYMBOL)?this.name:`${S.SLASH_SYMBOL} ${this.name}`}};t.ChatSlashCommandItemModel=O,t.ChatSlashCommandItemModel=O=g.__decorate([(0,l.Injectable)({multiple:!0}),g.__metadata("design:paramtypes",[Object,String,String])],O)},51081:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatProxyService=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(27284),m=e(9447),_=e(72665),s=e(93062),f=e(19413),a=e(34817),h=e(29770),u=e(11735);let d=n=class extends p.Disposable{constructor(){super(...arguments),this.chatDeferred=new p.Deferred}registerDefaultAgent(){this.chatAgentViewService.registerChatComponent({id:"toolCall",component:a.ChatToolRender,initialProps:{}}),this.addDispose(this.chatAgentService.registerAgent({id:n.AGENT_ID,metadata:{systemPrompt:this.preferenceService.get(v.AINativeSettingSectionsId.SystemPrompt,`You are a powerful AI coding assistant working in OpenSumi, a top IDE framework. You collaborate with a USER to solve coding tasks, which may involve creating, modifying, or debugging code, or answering questions. When the USER sends a message, relevant context (e.g., open files, cursor position, edit history, linter errors) may be attached. Use this information as needed.
30172
+ `),"f");const P=[];for(const k of g.__classPrivateFieldGet(this,r,"f")){const F=P[P.length-1];k.kind==="markdownContent"&&F?.kind==="markdownContent"?P[P.length-1]={content:new b.MarkdownString(F.content.value+k.content.value,{isTrusted:F.content.isTrusted}),kind:"markdownContent"}:P.push(k)}g.__classPrivateFieldSet(this,o,P,"f"),R||g.__classPrivateFieldGet(this,f,"f").fire()};class T{get requestId(){return g.__classPrivateFieldGet(this,h,"f")}constructor(R,P,k,F){this.session=P,this.message=k,this.response=F,h.set(this,void 0),g.__classPrivateFieldSet(this,h,R,"f")}toJSON(){return{requestId:this.requestId,message:this.message,response:this.response}}}t.ChatRequestModel=T,h=new WeakMap;class D extends y.Disposable{constructor(R){var P,k;super(),u.set(this,void 0),d.set(this,new Map),g.__classPrivateFieldSet(this,u,(P=R?.sessionId)!==null&&P!==void 0?P:(0,y.uuid)(),"f"),this.history=(k=R?.history)!==null&&k!==void 0?k:new A.MsgHistoryManager,R?.requests&&g.__classPrivateFieldSet(this,d,new Map(R.requests.map(F=>[F.requestId,F])),"f")}get sessionId(){return g.__classPrivateFieldGet(this,u,"f")}get requests(){return Array.from(g.__classPrivateFieldGet(this,d,"f").values())}restoreRequests(R){g.__classPrivateFieldSet(this,d,new Map(R.map(P=>[P.requestId,P])),"f")}get messageHistory(){const R=[];for(const P of this.requests)if(P.response.isComplete){R.push({role:"user",content:P.message.prompt});for(const k of P.response.responseParts)k.kind==="treeData"||k.kind==="component"||(k.kind!=="toolCall"?R.push({role:"assistant",content:[{type:"text",text:k.kind==="markdownContent"?k.content.value:k.content}]}):(R[R.length-1].role!=="assistant"&&R.push({role:"assistant",content:[]}),R[R.length-1].content.push({type:"tool-call",toolCallId:k.content.id,toolName:k.content.function.name,args:JSON.parse(k.content.function.arguments||"{}")}),R.push({role:"tool",content:[{type:"tool-result",toolCallId:k.content.id,toolName:k.content.function.name,result:JSON.parse(k.content.result||"{}")}]})))}return R}addRequest(R){const P=R,k=`${this.sessionId}_request_${D.requestIdPool++}`,F=new w(k,this,P.agentId),L=new T(k,this,P,F);return g.__classPrivateFieldGet(this,d,"f").set(k,L),L}acceptResponseProgress(R,P,k){if(R.response.isComplete)throw new Error("acceptResponseProgress: Adding progress to a completed response");const{kind:F}=P;["content","markdownContent","asyncContent","treeData","component","toolCall"].includes(F)?R.response.updateContent(P,k):console.error(`Couldn't handle progress: ${JSON.stringify(P)}`)}getRequest(R){return g.__classPrivateFieldGet(this,d,"f").get(R)}dispose(){super.dispose(),g.__classPrivateFieldGet(this,d,"f").forEach(R=>R.response.dispose())}toJSON(){return{sessionId:this.sessionId,history:this.history,requests:this.requests}}}t.ChatModel=D,u=new WeakMap,d=new WeakMap,D.requestIdPool=0;let I=E=class extends y.Disposable{get id(){return this._id}constructor(R,P){super(),this.content=R,this.sampleQuestions=P,this._id="welcome_"+E.nextId++}};t.ChatWelcomeMessageModel=I,I.nextId=0,t.ChatWelcomeMessageModel=I=E=g.__decorate([(0,l.Injectable)({multiple:!0}),g.__metadata("design:paramtypes",[Object,Array])],I);let O=class extends y.Disposable{constructor(R,P,k){super(),this.chatCommand=R,this.command=P,this.agentId=k}get name(){return this.chatCommand.name}get isShortcut(){return!!this.chatCommand.isShortcut}get icon(){return this.chatCommand.icon}get description(){return this.chatCommand.description}get tooltip(){return this.chatCommand.tooltip}get nameWithSlash(){return this.name.startsWith(S.SLASH_SYMBOL)?this.name:`${S.SLASH_SYMBOL} ${this.name}`}};t.ChatSlashCommandItemModel=O,t.ChatSlashCommandItemModel=O=g.__decorate([(0,l.Injectable)({multiple:!0}),g.__metadata("design:paramtypes",[Object,String,String])],O)},51081:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatProxyService=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(27284),m=e(9447),_=e(72665),s=e(93062),f=e(19413),a=e(34817),h=e(29770),u=e(11735);let d=n=class extends p.Disposable{constructor(){super(...arguments),this.chatDeferred=new p.Deferred}getRequestOptions(){const g=this.preferenceService.get(v.AINativeSettingSectionsId.LLMModelSelection),l=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);let y="",b="";g==="deepseek"?y=this.preferenceService.get(v.AINativeSettingSectionsId.DeepseekApiKey,""):g==="openai"?y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""):g==="anthropic"?y=this.preferenceService.get(v.AINativeSettingSectionsId.AnthropicApiKey,""):(y=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""),b=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiBaseURL,""));const S=this.chatAgentService.getAgent(n.AGENT_ID);return{clientId:this.applicationService.clientId,model:g,modelId:l,apiKey:y,baseURL:b,system:S?.metadata.systemPrompt}}registerDefaultAgent(){this.chatAgentViewService.registerChatComponent({id:"toolCall",component:a.ChatToolRender,initialProps:{}}),this.addDispose(this.chatAgentService.registerAgent({id:n.AGENT_ID,metadata:{systemPrompt:this.preferenceService.get(v.AINativeSettingSectionsId.SystemPrompt,`You are a powerful AI coding assistant working in OpenSumi, a top IDE framework. You collaborate with a USER to solve coding tasks, which may involve creating, modifying, or debugging code, or answering questions. When the USER sends a message, relevant context (e.g., open files, cursor position, edit history, linter errors) may be attached. Use this information as needed.
30163
30173
 
30164
30174
  <tool_calling>
30165
30175
  You have access to tools to assist with tasks. Follow these rules:
@@ -30187,12 +30197,12 @@ Use the appropriate tools to fulfill the USER\u2019s request, ensuring all requi
30187
30197
 
30188
30198
  <user_info>
30189
30199
  The user's OS is ${(0,p.getOperatingSystemName)()}. The absolute path of the user's workspace is ${this.appConfig.workspaceDir}.
30190
- </user_info>`},invoke:async(g,l,y,b)=>{this.chatDeferred=new p.Deferred;const{message:S,command:A}=g;let w=S;if(A){const P=this.chatFeatureRegistry.getSlashCommandHandler(A);if(P&&P.providerPrompt){const k=this.monacoCommandRegistry.getActiveCodeEditor();w=await P.providerPrompt(S,k)}}const T=this.preferenceService.get(v.AINativeSettingSectionsId.LLMModelSelection),D=this.preferenceService.get(v.AINativeSettingSectionsId.ModelID);let I="",O="";T==="deepseek"?I=this.preferenceService.get(v.AINativeSettingSectionsId.DeepseekApiKey,""):T==="openai"?I=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""):T==="anthropic"?I=this.preferenceService.get(v.AINativeSettingSectionsId.AnthropicApiKey,""):(I=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiApiKey,""),O=this.preferenceService.get(v.AINativeSettingSectionsId.OpenaiBaseURL,""));const M=this.chatAgentService.getAgent(n.AGENT_ID),R=await this.aiBackService.requestStream(w,{requestId:g.requestId,sessionId:g.sessionId,history:y,clientId:this.applicationService.clientId,apiKey:I,model:T,modelId:D,baseURL:O,system:M?.metadata.systemPrompt},b);return(0,s.listenReadable)(R,{onData:P=>{l(P)},onEnd:()=>{this.chatDeferred.resolve()},onError:P=>{this.messageService.error(P.message),this.aiReporter.end(g.sessionId+"_"+g.requestId,{message:P.message,success:!1,command:A})}}),await this.chatDeferred.promise,{}},provideSlashCommands:async g=>this.chatFeatureRegistry.getAllSlashCommand().map(l=>({...l,name:l.name,description:l.description||""})),provideChatWelcomeMessage:async g=>{}})),queueMicrotask(()=>{this.chatAgentService.updateAgent(n.AGENT_ID,{})})}};t.ChatProxyService=d,d.AGENT_ID="Default_Chat_Agent",r.__decorate([(0,o.Autowired)(f.IChatAgentService),r.__metadata("design:type",Object)],d.prototype,"chatAgentService",void 0),r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],d.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(p.ChatFeatureRegistryToken),r.__metadata("design:type",u.ChatFeatureRegistry)],d.prototype,"chatFeatureRegistry",void 0),r.__decorate([(0,o.Autowired)(m.MonacoCommandRegistry),r.__metadata("design:type",m.MonacoCommandRegistry)],d.prototype,"monacoCommandRegistry",void 0),r.__decorate([(0,o.Autowired)(p.ChatServiceToken),r.__metadata("design:type",h.ChatService)],d.prototype,"aiChatService",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],d.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(p.ChatAgentViewServiceToken),r.__metadata("design:type",Object)],d.prototype,"chatAgentViewService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],d.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(p.IApplicationService),r.__metadata("design:type",Object)],d.prototype,"applicationService",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],d.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(c.AppConfig),r.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),t.ChatProxyService=d=n=r.__decorate([(0,o.Injectable)()],d)},29770:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatService=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(63067),p=e(19413),v=e(59347);let m=class extends o.Disposable{constructor(){super(),this._onChatMessageLaunch=new o.Emitter,this.onChatMessageLaunch=this._onChatMessageLaunch.event,this._onChatReplyMessageLaunch=new o.Emitter,this.onChatReplyMessageLaunch=this._onChatReplyMessageLaunch.event,this._onChatMessageListLaunch=new o.Emitter,this.onChatMessageListLaunch=this._onChatMessageListLaunch.event,this._onScrollToBottom=new o.Emitter,this.onScrollToBottom=this._onScrollToBottom.event}showChatView(){this.mainLayoutService.toggleSlot(p.AI_CHAT_VIEW_ID,!0)}sendMessage(s){this.showChatView(),this._onChatMessageLaunch.fire(s)}clearHistoryMessages(){var s;(s=this.chatInternalService.sessionModel)===null||s===void 0||s.history.clearMessages()}sendReplyMessage(s){typeof s=="string"?this._onChatReplyMessageLaunch.fire({kind:"content",content:s}):this._onChatReplyMessageLaunch.fire(s)}sendMessageList(s){this._onChatMessageListLaunch.fire(s)}scrollToBottom(){this._onScrollToBottom.fire()}};t.ChatService=m,n.__decorate([(0,r.Autowired)(p.IChatInternalService),n.__metadata("design:type",v.ChatInternalService)],m.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(c.IMainLayoutService),n.__metadata("design:type",Object)],m.prototype,"mainLayoutService",void 0),t.ChatService=m=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],m)},11735:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(19413),p=e(42033),v=e(51081);let m=class extends o.Disposable{constructor(){super(...arguments),this.logger=(0,o.getDebugLogger)(),this.slashCommandsMap=new Map,this.slashCommandsHandlerMap=new Map,this._onDidWelcomeMessageChange=new o.Emitter,this.onDidWelcomeMessageChange=this._onDidWelcomeMessageChange.event}dispose(){super.dispose(),this.slashCommandsMap.clear(),this.slashCommandsHandlerMap.clear()}registerWelcome(s,f){this.chatWelcomeMessageModel=new p.ChatWelcomeMessageModel(s,f),this._onDidWelcomeMessageChange.fire()}registerSlashCommand(s,f){const{name:a}=s;if(this.slashCommandsMap.has(a)){this.logger.warn(`ChatFeatureRegistry: commands name ${a} already exists`);return}this.slashCommandsMap.set(a,new p.ChatSlashCommandItemModel(s,a,v.ChatProxyService.AGENT_ID)),this.slashCommandsHandlerMap.set(a,f)}getSlashCommandHandler(s){return this.slashCommandsHandlerMap.get(s)}getSlashCommand(s){return this.slashCommandsMap.get(s)}getSlashCommandHandlerBySlashName(s){const f=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(f)return this.getSlashCommandHandler(f.name)}getSlashCommandBySlashName(s){const f=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(f)return this.getSlashCommand(f.name)}getAllSlashCommand(){return Array.from(this.slashCommandsMap.values())}getAllShortcutSlashCommand(){return this.getAllSlashCommand().filter(s=>s.isShortcut===!0)}parseSlashCommand(s){if(s.startsWith(c.SLASH_SYMBOL)){const f=this.getAllSlashCommand();for(const a of f){const{nameWithSlash:h}=a;if(s.startsWith(h))return{value:s.slice(h.length),nameWithSlash:h}}}return{value:s,nameWithSlash:""}}};t.ChatFeatureRegistry=m,t.ChatFeatureRegistry=m=n.__decorate([(0,r.Injectable)()],m)},59347:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInternalService=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(19413),m=e(61282);let _=class extends p.Disposable{constructor(){super(...arguments),this._onChangeRequestId=new p.Emitter,this.onChangeRequestId=this._onChangeRequestId.event,this._onChangeSession=new p.Emitter,this.onChangeSession=this._onChangeSession.event,this._onCancelRequest=new p.Emitter,this.onCancelRequest=this._onCancelRequest.event,this._onWillClearSession=new p.Emitter,this.onWillClearSession=this._onWillClearSession.event,this._onRegenerateRequest=new p.Emitter,this.onRegenerateRequest=this._onRegenerateRequest.event,n.set(this,void 0)}get latestRequestId(){return this._latestRequestId}get sessionModel(){return r.__classPrivateFieldGet(this,n,"f")}init(){this.chatManagerService.onStorageInit(()=>{const f=this.chatManagerService.getSessions();f.length>0?this.activateSession(f[f.length-1].sessionId):this.createSessionModel()})}setLatestRequestId(f){this._latestRequestId=f,this._onChangeRequestId.fire(f)}createRequest(f,a,h){return this.chatManagerService.createRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,f,a,h)}sendRequest(f,a=!1){const h=this.chatManagerService.sendRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,f,a);return a&&this._onRegenerateRequest.fire(),h}cancelRequest(){this.chatManagerService.cancelRequest(r.__classPrivateFieldGet(this,n,"f").sessionId),this._onCancelRequest.fire()}createSessionModel(){r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}clearSessionModel(f){f=f||r.__classPrivateFieldGet(this,n,"f").sessionId,this._onWillClearSession.fire(f),this.chatManagerService.clearSession(f),f===r.__classPrivateFieldGet(this,n,"f").sessionId&&r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}getSessions(){return this.chatManagerService.getSessions()}getSession(f){return this.chatManagerService.getSession(f)}activateSession(f){const a=this.chatManagerService.getSession(f);if(!a)throw new Error(`There is no session with session id ${f}`);r.__classPrivateFieldSet(this,n,a,"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}dispose(){var f;(f=r.__classPrivateFieldGet(this,n,"f"))===null||f===void 0||f.dispose(),super.dispose()}};t.ChatInternalService=_,n=new WeakMap,r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(v.IChatManagerService),r.__metadata("design:type",m.ChatManagerService)],_.prototype,"chatManagerService",void 0),t.ChatInternalService=_=r.__decorate([(0,o.Injectable)()],_)},70394:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatRenderRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718);let c=class extends o.Disposable{registerWelcomeRender(v){this.chatWelcomeRender=v}registerAIRoleRender(v){this.chatAIRoleRender=v}registerUserRoleRender(v){this.chatUserRoleRender=v}registerThinkingRender(v){this.chatThinkingRender=v}registerInputRender(v){this.chatInputRender=v}registerThinkingResultRender(v){this.chatThinkingResultRender=v}registerChatViewHeaderRender(v){this.chatViewHeaderRender=v}};t.ChatRenderRegistry=c,t.ChatRenderRegistry=c=n.__decorate([(0,r.Injectable)()],c)},76154:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatView=void 0,t.DefaultChatViewHeader=M;const n=e(85608),r=n.__importStar(e(14041)),o=e(68392),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(63067),s=e(72665);e(41937);const f=e(19413),a=e(27399),h=e(25834),u=n.__importDefault(e(90103)),d=e(57987),E=e(56474),g=e(92635),l=e(29039),y=e(78048),b=e(86556),S=e(77633),A=e(42033),w=e(51081),T=n.__importDefault(e(77256)),D="chat_scroll",I=100,O=()=>{const R=(0,c.useInjectable)(f.IChatInternalService),P=(0,c.useInjectable)(m.ChatServiceToken),k=(0,c.useInjectable)(m.IAIReporter),F=(0,c.useInjectable)(f.IChatAgentService),L=(0,c.useInjectable)(m.ChatFeatureRegistryToken),N=(0,c.useInjectable)(m.ChatRenderRegistryToken),j=(0,c.useInjectable)(S.TokenMCPServerRegistry),W=(0,c.useInjectable)(_.IMainLayoutService),U=R.sessionModel.history,X=r.useRef(null),V=r.useRef(!0),$=r.useRef(null),[Y,G]=r.useState([]),[H,K]=r.useReducer((lt,qe)=>{switch(qe.type){case"add":return[...lt,...qe.payload||[]];case"clear":return[];case"init":return Array.isArray(qe.payload)?qe.payload:[];default:return lt}},[]),[Z,Q]=r.useState(!1),[oe,ne]=r.useState(""),[he,_e]=r.useState(""),[q,Re]=r.useState(""),[ve,ie]=r.useState(null);r.useEffect(()=>{const lt=L.getAllShortcutSlashCommand(),qe=F.onDidChangeAgents(()=>{const Rt=F.getCommands().filter(nt=>nt.isShortcut).map(nt=>new A.ChatSlashCommandItemModel({icon:"",name:`${nt.name} `,description:nt.description,isShortcut:nt.isShortcut},nt.name,nt.agentId));G(lt.concat(Rt))});return G(lt),()=>qe.dispose()},[L,F]),(0,c.useUpdateOnEvent)(R.onChangeSession);const fe=r.useMemo(()=>N.chatInputRender?N.chatInputRender:d.ChatInput,[N.chatInputRender]),Me=r.useMemo(()=>(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:"",text:r.createElement(b.WelcomeMessage,null)}),[]),Le=r.useCallback(lt=>{lt.deltaY<0?V.current=!1:V.current=!0},[V]);r.useEffect(()=>{if(X.current)return X.current.addEventListener("wheel",Le),()=>{var lt;(lt=X.current)===null||lt===void 0||lt.removeEventListener("wheel",Le)}},[V]);const Ce=r.useCallback(()=>{if(X&&X.current&&V.current){const lt=X.current.lastElementChild;lt&&lt.scrollIntoView({behavior:"smooth",block:"end"}),X.current.scrollHeight>X.current.clientHeight&&X.current.classList.add(D)}},[X,V]),Se=r.useCallback(lt=>{K(lt),requestAnimationFrame(()=>{Ce()})},[K,Ce]);r.useEffect(()=>{Se({type:"init",payload:[Me]})},[]),r.useEffect(()=>{const lt=new m.Disposable;return lt.addDispose(P.onScrollToBottom(()=>{requestAnimationFrame(()=>{})})),lt.addDispose(P.onChatMessageLaunch(async qe=>{var Rt;if(qe.immediate!==!1){if(Z)return;await re(qe)}else qe.agentId&&ne(qe.agentId),qe.command&&Re(qe.command),(Rt=$?.current)===null||Rt===void 0||Rt.setInputValue(qe.message)})),lt.addDispose(P.onChatReplyMessageLaunch(qe=>{if(qe.kind==="content"){const Rt=k.start(m.AIServiceType.CustomReply,{message:qe.content,sessionId:R.sessionModel.sessionId});U.addAssistantMessage({content:qe.content,relationId:Rt}),Te({chunk:qe.content,relationId:Rt})}else{const Rt=k.start(m.AIServiceType.CustomReply,{message:"component#"+qe.component,sessionId:R.sessionModel.sessionId});U.addAssistantMessage({componentId:qe.component,componentValue:qe.value,content:"",relationId:Rt}),Fe({chunk:qe,relationId:Rt})}})),lt.addDispose(P.onChatMessageListLaunch(qe=>{const Rt=[];qe.forEach(nt=>{const{role:St}=nt,it=k.start(m.AIServiceType.Chat,{message:"",sessionId:R.sessionModel.sessionId});if(St==="assistant"){const st=nt;Rt.push((0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:it,text:r.createElement(g.ChatNotify,{requestId:it,chunk:st})},T.default.chat_notify))}if(St==="user"){const{message:st}=nt,ct=w.ChatProxyService.AGENT_ID,bt=N.chatUserRoleRender,Vt=ct===w.ChatProxyService.AGENT_ID?"":ct;Rt.push((0,y.createMessageByUser)({id:(0,m.uuid)(6),relationId:it,text:bt?r.createElement(bt,{content:st,agentId:Vt}):r.createElement(h.CodeBlockWrapperInput,{relationId:it,text:st,agentId:Vt,command:q})},T.default.chat_message_code))}}),Se({type:"add",payload:Rt}),setTimeout(Ce,0)})),()=>lt.dispose()},[P,N.chatAIRoleRender,U]),r.useEffect(()=>{const lt=new m.Disposable;return lt.addDispose(F.onDidSendMessage(qe=>{const Rt=qe,nt=k.start(m.AIServiceType.Agent,{message:""}),St=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:nt,text:r.createElement(g.ChatNotify,{requestId:R.latestRequestId,chunk:Rt})},T.default.chat_notify);Se({type:"add",payload:[St]})})),lt.addDispose(F.onDidChangeAgents(async()=>{const qe=F.getDefaultAgentId();_e(qe??"")})),()=>lt.dispose()},[F,U,R]);const Ee=r.useCallback(async lt=>{const{userMessage:qe,relationId:Rt,requestId:nt,render:St,startTime:it,command:st,agentId:ct}=lt;U.addAssistantMessage({type:"component",content:""});const bt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,className:T.default.chat_with_more_actions,text:r.createElement(l.SlashCustomRender,{userMessage:qe,startTime:it,relationId:Rt,requestId:nt,renderContent:St,command:st,agentId:ct})});Se({type:"add",payload:[bt]})},[X,U]),ge=r.useCallback(async lt=>{const qe=N.chatUserRoleRender,{message:Rt,agentId:nt,relationId:St,command:it}=lt,st=nt===w.ChatProxyService.AGENT_ID?"":nt,ct=(0,y.createMessageByUser)({id:(0,m.uuid)(6),relationId:St,text:qe?r.createElement(qe,{content:Rt,agentId:st,command:it}):r.createElement(h.CodeBlockWrapperInput,{relationId:St,text:Rt,agentId:st,command:it})},T.default.chat_message_code);Se({type:"add",payload:[ct]})},[N,N.chatUserRoleRender,U,Ce]),xe=r.useCallback(async lt=>{const{message:qe,agentId:Rt,request:nt,relationId:St,command:it,startTime:st,msgId:ct}=lt,bt=Rt===w.ChatProxyService.AGENT_ID?"":Rt;if(Rt===w.ChatProxyService.AGENT_ID&&it){const _n=L.getSlashCommandHandler(it);if(_n&&_n.providerRender)return Q(!1),Ee({userMessage:qe,render:_n.providerRender,relationId:St,requestId:nt.requestId,startTime:st,agentId:Rt,command:it})}const Vt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:St,className:T.default.chat_with_more_actions,text:r.createElement(g.ChatReply,{relationId:St,request:nt,startTime:st,agentId:bt,command:it,onDidChange:()=>{Ce()},history:U,onDone:()=>{Q(!1)},onRegenerate:()=>{nt&&R.sendRequest(nt,!0)},msgId:ct})});Se({type:"add",payload:[Vt]})},[N,U,Ce]),Te=r.useCallback(lt=>{const{chunk:qe,relationId:Rt}=lt;let nt=r.createElement(E.ChatMarkdown,{markdown:qe,fillInIncompleteTokens:!0,agentId:oe,command:q});if(N.chatAIRoleRender){const it=N.chatAIRoleRender;nt=r.createElement(it,{content:qe})}const St=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,text:nt,className:T.default.chat_with_more_actions});Se({type:"add",payload:[St]})},[N,U,Ce]),Fe=r.useCallback(lt=>{const{chunk:qe,relationId:Rt}=lt,nt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,text:r.createElement(g.ChatNotify,{requestId:Rt,chunk:qe})},T.default.chat_notify);Se({type:"add",payload:[nt]})},[N,U,Ce]),pe=r.useCallback(async lt=>{const{message:qe,agentId:Rt,command:nt,reportExtra:St}=lt,{actionType:it,actionSource:st}=St||{},ct=R.createRequest(qe,Rt,nt);if(!ct)return;Q(!0),R.setLatestRequestId(ct.requestId);const bt=Date.now(),Vt=w.ChatProxyService.AGENT_ID===Rt?m.AIServiceType.Chat:m.AIServiceType.Agent,_n=k.start(nt||Vt,{agentId:Rt,userMessage:qe,actionType:it,actionSource:st,sessionId:R.sessionModel.sessionId},600*1e3);U.addUserMessage({content:qe,agentId:Rt,agentCommand:nt,relationId:_n}),await ge({relationId:_n,message:qe,command:nt,agentId:Rt}),R.sendRequest(ct);const Kn=U.addAssistantMessage({content:"",relationId:_n,requestId:ct.requestId,replyStartTime:bt});j.activeMessageInfo={messageId:Kn,sessionId:R.sessionModel.sessionId},await xe({startTime:bt,relationId:_n,message:qe,agentId:Rt,command:nt,request:ct,msgId:Kn})},[N,N.chatUserRoleRender,U,Ce]),re=r.useCallback(async lt=>{const{message:qe,command:Rt,reportExtra:nt}=lt,St=lt.agentId?lt.agentId:w.ChatProxyService.AGENT_ID;return pe({message:qe,agentId:St,command:Rt,reportExtra:nt})},[pe]),ue=r.useCallback(()=>{R.clearSessionModel(),P.clearHistoryMessages(),Oe()},[H]),Oe=r.useCallback(()=>{var lt;(lt=X?.current)===null||lt===void 0||lt.classList.remove(D),Se({type:"init",payload:[Me]})},[H]),Ae=lt=>{Z||(ie(lt.nameWithSlash),ne(lt.agentId),Re(lt.command))},Ue=r.useCallback(()=>{W.toggleSlot(f.AI_CHAT_VIEW_ID)},[W]),$e=N.chatViewHeaderRender||M,Ve=r.useCallback(async lt=>{for(const qe of U.getMessages()){if(lt.isCancellationRequested)return;if(qe.role===1)await ge({relationId:qe.relationId,message:qe.content,agentId:qe.agentId,command:qe.agentCommand});else if(qe.role===2&&qe.requestId){const Rt=R.sessionModel.getRequest(qe.requestId);Rt&&!Rt.response.isComplete&&Q(!0),await xe({msgId:qe.id,relationId:qe.relationId,message:qe.content,agentId:qe.agentId,command:qe.agentCommand,startTime:qe.replyStartTime,request:Rt})}else qe.role===2&&qe.content?await Te({relationId:qe.relationId,chunk:qe.content}):qe.role===2&&qe.componentId&&await Fe({relationId:qe.relationId,chunk:{kind:"component",component:qe.componentId,value:qe.componentValue}})}},[xe]);return r.useEffect(()=>{Oe();const lt=new m.CancellationTokenSource;return Q(!1),Ve(lt.token),()=>{lt.cancel()}},[R.sessionModel]),r.createElement("div",{id:T.default.ai_chat_view},r.createElement("div",{className:T.default.header_container},r.createElement($e,{handleClear:ue,handleCloseChatView:Ue})),r.createElement("div",{className:T.default.body_container},r.createElement("div",{className:T.default.left_bar,id:"ai_chat_left_container"},r.createElement("div",{className:T.default.chat_container,ref:X},r.createElement(o.MessageList,{className:T.default.message_list,lockable:!0,toBottomHeight:"100%",dataSource:H})),U.slicedMessageCount?r.createElement("div",{className:T.default.chat_tips_text},r.createElement("div",{className:T.default.chat_tips_container},(0,m.formatLocalize)("aiNative.chat.ai.assistant.limit.message",U.slicedMessageCount))):null,r.createElement("div",{className:T.default.chat_input_wrap},r.createElement(a.ChatContext,null),r.createElement("div",{className:T.default.header_operate},r.createElement("div",{className:T.default.header_operate_left},Y.map(lt=>r.createElement(p.Popover,{id:`ai-chat-shortcut-${lt.name}`,key:`ai-chat-shortcut-${lt.name}`,title:lt.tooltip||lt.name},r.createElement("div",{className:T.default.tag,onClick:()=>Ae(lt)},lt.name))))),r.createElement(fe,{onSend:(lt,qe,Rt)=>re({message:lt,agentId:qe,command:Rt,reportExtra:{actionSource:m.ActionSourceEnum.Chat,actionType:m.ActionTypeEnum.Send}}),disabled:Z,enableOptions:!0,theme:ve,setTheme:ie,agentId:oe,setAgentId:ne,defaultAgentId:he,command:q,setCommand:Re,ref:$})))))};t.AIChatView=O;function M({handleClear:R,handleCloseChatView:P}){const k=(0,c.useInjectable)(f.IChatInternalService),F=(0,c.useInjectable)(s.IMessageService),[L,N]=r.useState([]),[j,W]=r.useState(""),U=r.useCallback(()=>{if(k.sessionModel.history.getMessages().length>0)try{k.createSessionModel()}catch($){F.error($.message)}},[k]),X=r.useCallback($=>{k.activateSession($.id)},[k]),V=r.useCallback($=>{k.clearSessionModel($.id)},[k]);return r.useEffect(()=>{const $=()=>{const H=k.sessionModel.history.getMessages();W(H.length>0?H[H.length-1].content.slice(0,I):""),N(k.getSessions().map(K=>{const Q=K.history.getMessages(),oe=Q.length>0?Q[0].content.slice(0,I):"",ne=Q.length>0&&Q[Q.length-1].replyStartTime||0;return{id:K.sessionId,title:oe,updatedAt:ne,loading:!1}}))};$();const Y=new m.DisposableCollection,G=new Set;return Y.push(k.onChangeSession(H=>{$(),!G.has(H)&&(G.add(H),Y.push(k.sessionModel.history.onMessageChange(()=>{$()})))})),Y.push(k.sessionModel.history.onMessageChange(()=>{$()})),()=>{Y.dispose()}},[k]),r.createElement("div",{className:T.default.header},r.createElement(u.default,{className:T.default.chat_history,currentId:k.sessionModel.sessionId,title:j||(0,m.localize)("aiNative.chat.ai.assistant.name"),historyList:L,onNewChat:U,onHistoryItemSelect:X,onHistoryItemDelete:V,onHistoryItemChange:()=>{}}),r.createElement(p.Popover,{overlayClassName:T.default.popover_icon,id:"ai-chat-header-clear",title:(0,m.localize)("aiNative.operate.clear.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:T.default.action_btn,className:(0,c.getIcon)("clear"),onClick:R,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.clear.title")})),r.createElement(p.Popover,{overlayClassName:T.default.popover_icon,id:"ai-chat-header-close",position:p.PopoverPosition.left,title:(0,m.localize)("aiNative.operate.close.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:T.default.action_btn,className:(0,c.getIcon)("window-close"),onClick:P,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.close.title")})))}},55369:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextSelector=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=e(45250),c=n.__importStar(e(14041)),p=e(58998),v=e(41869),m=e(81878),_=e(95263),s=e(95422),f=e(15625),a=e(70392),h=n.__importDefault(e(97431)),u=(0,c.memo)(({uri:d,active:E,selected:g,onDidSelect:l,onDidDeselect:y})=>{var b;const S=(0,s.useInjectable)(v.LabelService),A=(0,s.useInjectable)(v.AppConfig),w=(0,c.useRef)(null);return(0,c.useEffect)(()=>{if(E&&w.current){const T={behavior:"instant",block:"end"};w.current.scrollIntoView(T)}},[E,w.current]),c.default.createElement("div",{className:(0,r.default)(h.default.candidate_file,E&&h.default.active),ref:T=>w.current=T,onClick:()=>g?y(d):l(d)},c.default.createElement(m.Icon,{iconClass:S.getIcon(d)}),c.default.createElement("span",{className:h.default.basename},d.path.base),c.default.createElement("span",{className:h.default.dir},(b=a.URI.file(A.workspaceDir).relative(d.parent))===null||b===void 0?void 0:b.toString()),g&&c.default.createElement(m.Icon,{icon:"check",style:{marginLeft:"auto",color:"var(--editorGutter-addedBackground)"}}))});t.ContextSelector=(0,c.memo)(({addedFiles:d,onDidDeselect:E,onDidSelect:g,onDidClose:l})=>{const[y,b]=(0,c.useState)([]),[S,A]=(0,c.useState)(null),[w,T]=(0,c.useState)(!1),[D,I]=(0,c.useState)([]),O=(0,s.useInjectable)(_.RecentFilesManager),M=(0,s.useInjectable)(v.AppConfig),R=(0,s.useInjectable)(f.FileSearchServicePath),P=(0,c.useRef)();(0,c.useEffect)(()=>{y.length===0&&O.getMostRecentlyOpenedFiles().then(L=>{const N=d.map(W=>W.uri),j=L.filter(W=>!N.includes(new a.URI(W))).map(W=>new a.URI(W));b(j),A(j[0]||null)})},[d]);const k=(0,c.useCallback)((0,o.debounce)(L=>{if(L.target.value.trim()===""){I([]),A(y[0]);return}T(!0),R.find(L.target.value,{rootUris:[M.workspaceDir],limit:200,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0}).then(N=>{const j=N.map(W=>new a.URI(W));I(j),A(j[0])}).finally(()=>{T(!1)})},500),[]),F=(0,c.useCallback)(L=>{const{key:N}=L;if(N==="Escape"){l();return}if(N==="Enter"&&S){g(S);return}if(!["ArrowUp","ArrowDown"].includes(N))return;const W=D.length>0?D:y;if(W.length===0)return;const U=W.indexOf(S),X=U===-1?0:U,V=W.length-1,$=N==="ArrowUp"?X>0?X-1:V:X<V?X+1:0;A(W[$])},[S,D,y]);return c.default.createElement(p.ClickOutside,{mouseEvents:["click","contextmenu"],onOutsideClick:()=>l()},c.default.createElement("div",{className:h.default.context_selector,onKeyDown:F,tabIndex:-1},c.default.createElement("div",{style:{padding:"4px"}},c.default.createElement(m.Input,{placeholder:"Search files by name",autoFocus:!0,onInput:k})),c.default.createElement(m.Scrollbars,{forwardedRef:L=>L?P.current=L.ref:null},c.default.createElement("div",{className:h.default.context_list},w&&c.default.createElement("div",{className:h.default.context_search_layer}),c.default.createElement("span",{className:h.default.list_desc},D.length>0?"Search Results":"Recent Opened Files"),(D.length>0?D:y).map(L=>c.default.createElement(u,{key:L.toString(),uri:L,active:S===L,onDidSelect:g,onDidDeselect:E,selected:!!d.find(N=>N.uri.isEqual(L))}))))))})},27399:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatContext=void 0;const n=e(85608),r=n.__importStar(e(1171)),o=n.__importStar(e(14041));e(628);const c=e(80564),p=e(81878),v=e(89195),m=e(95422),_=e(11050),s=e(63214),f=e(33783),a=e(86560),h=e(82196),u=e(46044),d=e(55369),E=n.__importDefault(e(97431)),g=()=>({height:0,opacity:0}),l=S=>({height:S.scrollHeight,opacity:1}),y=S=>({height:S.offsetHeight}),b=(S,A)=>A.propertyName==="height";t.ChatContext=(0,o.memo)(()=>{const[S,A]=(0,o.useState)([]),[w,T]=(0,o.useState)(!1),D=(0,m.useInjectable)(s.LabelService),I=(0,m.useInjectable)(_.AppConfig),O=(0,m.useInjectable)(h.WorkbenchEditorService),M=(0,m.useInjectable)(u.LLMContextServiceToken);(0,o.useEffect)(()=>{const j=a.Event.debounce(M.onDidContextFilesChangeEvent,(W,U)=>U,50)(W=>{W&&A([...W.attached])},M);return()=>{j.dispose()}},[]);const R=(0,o.useCallback)(()=>{T(!0)},[S]),P=(0,o.useCallback)(j=>{M.addFileToContext(j,void 0,!0)},[]),k=(0,o.useCallback)(j=>{M.removeFileFromContext(j,!0)},[]),F=(0,o.useCallback)(j=>{O.open(j)},[]),L=(0,o.useCallback)(j=>{j.stopPropagation(),j.preventDefault(),M.cleanFileContext()},[]),N=(0,o.useCallback)((j,W)=>{j.stopPropagation(),j.preventDefault(),k(W)},[]);return o.default.createElement("div",{className:E.default.chat_context},o.default.createElement(r.default,{expandIcon:({isActive:j})=>j?o.default.createElement(c.Icon,{icon:"down"}):o.default.createElement(c.Icon,{icon:"right"}),openMotion:{motionName:"rc-collapse-motion",onEnterStart:g,onEnterActive:l,onLeaveStart:y,onLeaveActive:g,onEnterEnd:b,onLeaveEnd:b,motionDeadline:100,leavedClassName:E.default.collapse_hide}},o.default.createElement(r.Panel,{header:o.default.createElement("div",{className:E.default.context_header},o.default.createElement("h3",{className:E.default.chat_context_title},"Context ",S.length>0?` (${S.length} files)`:""),o.default.createElement(p.Popover,{overlayClassName:E.default.popover_icon,id:"ai-context-header-clear",title:(0,f.localize)("aiNative.operate.clear.title")},o.default.createElement(v.EnhanceIcon,{wrapperClassName:E.default.action_btn,className:(0,p.getIcon)("clear"),onClick:L,tabIndex:0,role:"button",ariaLabel:(0,f.localize)("aiNative.operate.clear.title")}))),key:"context-panel"},o.default.createElement("div",{className:E.default.file_list},S.map(j=>{var W;return o.default.createElement("div",{className:E.default.selected_item,key:j.uri.toString(),onClick:()=>F(j.uri)},o.default.createElement(c.Icon,{iconClass:D.getIcon(j.uri)}),o.default.createElement("span",{className:E.default.basename},j.uri.path.base,j.selection?` (${j.selection[0]}-${j.selection[1]})`:""),o.default.createElement("span",{className:E.default.dir},(W=a.URI.file(I.workspaceDir).relative(j.uri.parent))===null||W===void 0?void 0:W.toString()),o.default.createElement(c.Icon,{icon:"close",className:E.default.close_icon,onClick:U=>N(U,j.uri)}))})),o.default.createElement("div",{className:E.default.add_context,onClick:R},o.default.createElement(c.Icon,{icon:"add"}),"Add Files"))),w&&o.default.createElement(d.ContextSelector,{onDidClose:()=>T(!1),onDidDeselect:k,onDidSelect:P,addedFiles:S}))})},25834:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeBlockWrapperInput=t.CodeBlockWrapper=t.CodeEditorWithHighlight=void 0;const n=e(85608),r=n.__importDefault(e(56005)),o=n.__importStar(e(14041)),c=n.__importDefault(e(10580)),p=e(41869),v=e(81878),m=e(89195),_=e(43718),s=e(71624),f=e(9447),a=e(52416),h=n.__importDefault(e(6960)),u=e(83933);e(38191);const d=y=>{const{input:b,language:S,relationId:A,agentId:w,command:T,hideInsert:D}=y,I=o.default.useRef(null),O=(0,p.useInjectable)(f.MonacoCommandRegistry),M=(0,p.useInjectable)(p.IClipboardService),R=(0,p.useInjectable)(a.IThemeService),P=(0,p.useInjectable)(_.IAIReporter),[k,F]=(0,o.useState)(!1),L=(0,o.useMemo)(()=>(0,p.uuid)(12),[I,I.current]);(0,o.useEffect)(()=>{const W=V=>{V.type==="dark"||V.type==="hcDark"?e.e(622).then(e.bind(e,51622)):(V.type==="light"||V.type==="hcLight")&&e.e(412).then(e.bind(e,50412))},U=R.onThemeChange(V=>{W(V)}),X=R.getCurrentThemeSync();return W(X),()=>U.dispose()},[]);const N=(0,o.useCallback)(async()=>{F(!0),await M.writeText(b),P.end(A,{copy:!0,code:b,language:S,agentId:w,command:T,actionSource:_.ActionSourceEnum.Chat,actionType:_.ActionTypeEnum.ChatCopyCode}),(0,_.runWhenIdle)(()=>{F(!1)},1e3)},[M,b,A]),j=(0,o.useCallback)(()=>{const W=O.getActiveCodeEditor();if(W){const U=W.getSelection();U&&((0,s.insertSnippetWithMonacoEditor)(W,b,[U],{undoStopBefore:!1,undoStopAfter:!1}),P.end(A,{insert:!0,code:b,language:S,agentId:w,command:T,actionSource:_.ActionSourceEnum.Chat,actionType:_.ActionTypeEnum.ChatInsertCode}))}},[O]);return o.default.createElement("div",{className:h.default.monaco_wrapper},o.default.createElement("div",{className:h.default.action_toolbar},!D&&o.default.createElement(v.Popover,{id:`ai-chat-inser-${L}`,title:(0,_.localize)("aiNative.chat.code.insert")},o.default.createElement(m.EnhanceIcon,{className:(0,p.getIcon)("insert"),onClick:()=>j(),tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.chat.code.insert")})),o.default.createElement(v.Popover,{id:`ai-chat-copy-${L}`,title:(0,_.localize)(k?"aiNative.chat.code.copy.success":"aiNative.chat.code.copy")},o.default.createElement(m.EnhanceIcon,{className:(0,p.getIcon)("copy"),onClick:()=>N(),tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.chat.code.copy")}))),o.default.createElement(c.default,{language:S,ref:I,className:h.default.editor},b))};t.CodeEditorWithHighlight=d;const E=({content:y="",relationId:b,renderText:S,agentId:A="",command:w=""})=>{const T=/`([^`]+)`/g,D=/```([^]+?)```/g,I=/```([^]+)?/g,O=R=>{const P=R.split(`
30200
+ </user_info>`},invoke:async(g,l,y,b)=>{this.chatDeferred=new p.Deferred;const{message:S,command:A}=g;let w=S;if(A){const D=this.chatFeatureRegistry.getSlashCommandHandler(A);if(D&&D.providerPrompt){const I=this.monacoCommandRegistry.getActiveCodeEditor();w=await D.providerPrompt(S,I)}}const T=await this.aiBackService.requestStream(w,{requestId:g.requestId,sessionId:g.sessionId,history:y,...this.getRequestOptions()},b);return(0,s.listenReadable)(T,{onData:D=>{l(D)},onEnd:()=>{this.chatDeferred.resolve()},onError:D=>{this.messageService.error(D.message),this.aiReporter.end(g.sessionId+"_"+g.requestId,{message:D.message,success:!1,command:A})}}),await this.chatDeferred.promise,{}},provideSlashCommands:async g=>this.chatFeatureRegistry.getAllSlashCommand().map(l=>({...l,name:l.name,description:l.description||""})),provideChatWelcomeMessage:async g=>{}})),queueMicrotask(()=>{this.chatAgentService.updateAgent(n.AGENT_ID,{})})}};t.ChatProxyService=d,d.AGENT_ID="Default_Chat_Agent",r.__decorate([(0,o.Autowired)(f.IChatAgentService),r.__metadata("design:type",Object)],d.prototype,"chatAgentService",void 0),r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],d.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(p.ChatFeatureRegistryToken),r.__metadata("design:type",u.ChatFeatureRegistry)],d.prototype,"chatFeatureRegistry",void 0),r.__decorate([(0,o.Autowired)(m.MonacoCommandRegistry),r.__metadata("design:type",m.MonacoCommandRegistry)],d.prototype,"monacoCommandRegistry",void 0),r.__decorate([(0,o.Autowired)(p.ChatServiceToken),r.__metadata("design:type",h.ChatService)],d.prototype,"aiChatService",void 0),r.__decorate([(0,o.Autowired)(p.IAIReporter),r.__metadata("design:type",Object)],d.prototype,"aiReporter",void 0),r.__decorate([(0,o.Autowired)(p.ChatAgentViewServiceToken),r.__metadata("design:type",Object)],d.prototype,"chatAgentViewService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],d.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(p.IApplicationService),r.__metadata("design:type",Object)],d.prototype,"applicationService",void 0),r.__decorate([(0,o.Autowired)(_.IMessageService),r.__metadata("design:type",Object)],d.prototype,"messageService",void 0),r.__decorate([(0,o.Autowired)(c.AppConfig),r.__metadata("design:type",Object)],d.prototype,"appConfig",void 0),t.ChatProxyService=d=n=r.__decorate([(0,o.Injectable)()],d)},29770:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatService=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(63067),p=e(19413),v=e(59347);let m=class extends o.Disposable{constructor(){super(),this._onChatMessageLaunch=new o.Emitter,this.onChatMessageLaunch=this._onChatMessageLaunch.event,this._onChatReplyMessageLaunch=new o.Emitter,this.onChatReplyMessageLaunch=this._onChatReplyMessageLaunch.event,this._onChatMessageListLaunch=new o.Emitter,this.onChatMessageListLaunch=this._onChatMessageListLaunch.event,this._onScrollToBottom=new o.Emitter,this.onScrollToBottom=this._onScrollToBottom.event}showChatView(){this.mainLayoutService.toggleSlot(p.AI_CHAT_VIEW_ID,!0)}sendMessage(s){this.showChatView(),this._onChatMessageLaunch.fire(s)}clearHistoryMessages(){var s;(s=this.chatInternalService.sessionModel)===null||s===void 0||s.history.clearMessages()}sendReplyMessage(s){typeof s=="string"?this._onChatReplyMessageLaunch.fire({kind:"content",content:s}):this._onChatReplyMessageLaunch.fire(s)}sendMessageList(s){this._onChatMessageListLaunch.fire(s)}scrollToBottom(){this._onScrollToBottom.fire()}};t.ChatService=m,n.__decorate([(0,r.Autowired)(p.IChatInternalService),n.__metadata("design:type",v.ChatInternalService)],m.prototype,"chatInternalService",void 0),n.__decorate([(0,r.Autowired)(c.IMainLayoutService),n.__metadata("design:type",Object)],m.prototype,"mainLayoutService",void 0),t.ChatService=m=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],m)},11735:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(19413),p=e(42033),v=e(51081);let m=class extends o.Disposable{constructor(){super(...arguments),this.logger=(0,o.getDebugLogger)(),this.slashCommandsMap=new Map,this.slashCommandsHandlerMap=new Map,this._onDidWelcomeMessageChange=new o.Emitter,this.onDidWelcomeMessageChange=this._onDidWelcomeMessageChange.event}dispose(){super.dispose(),this.slashCommandsMap.clear(),this.slashCommandsHandlerMap.clear()}registerWelcome(s,f){this.chatWelcomeMessageModel=new p.ChatWelcomeMessageModel(s,f),this._onDidWelcomeMessageChange.fire()}registerSlashCommand(s,f){const{name:a}=s;if(this.slashCommandsMap.has(a)){this.logger.warn(`ChatFeatureRegistry: commands name ${a} already exists`);return}this.slashCommandsMap.set(a,new p.ChatSlashCommandItemModel(s,a,v.ChatProxyService.AGENT_ID)),this.slashCommandsHandlerMap.set(a,f)}getSlashCommandHandler(s){return this.slashCommandsHandlerMap.get(s)}getSlashCommand(s){return this.slashCommandsMap.get(s)}getSlashCommandHandlerBySlashName(s){const f=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(f)return this.getSlashCommandHandler(f.name)}getSlashCommandBySlashName(s){const f=this.getAllSlashCommand().find(a=>a.nameWithSlash===s);if(f)return this.getSlashCommand(f.name)}getAllSlashCommand(){return Array.from(this.slashCommandsMap.values())}getAllShortcutSlashCommand(){return this.getAllSlashCommand().filter(s=>s.isShortcut===!0)}parseSlashCommand(s){if(s.startsWith(c.SLASH_SYMBOL)){const f=this.getAllSlashCommand();for(const a of f){const{nameWithSlash:h}=a;if(s.startsWith(h))return{value:s.slice(h.length),nameWithSlash:h}}}return{value:s,nameWithSlash:""}}};t.ChatFeatureRegistry=m,t.ChatFeatureRegistry=m=n.__decorate([(0,r.Injectable)()],m)},59347:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInternalService=void 0;const r=e(85608),o=e(76003),c=e(41869),p=e(43718),v=e(19413),m=e(61282);let _=class extends p.Disposable{constructor(){super(...arguments),this._onChangeRequestId=new p.Emitter,this.onChangeRequestId=this._onChangeRequestId.event,this._onChangeSession=new p.Emitter,this.onChangeSession=this._onChangeSession.event,this._onCancelRequest=new p.Emitter,this.onCancelRequest=this._onCancelRequest.event,this._onWillClearSession=new p.Emitter,this.onWillClearSession=this._onWillClearSession.event,this._onRegenerateRequest=new p.Emitter,this.onRegenerateRequest=this._onRegenerateRequest.event,n.set(this,void 0)}get latestRequestId(){return this._latestRequestId}get sessionModel(){return r.__classPrivateFieldGet(this,n,"f")}init(){this.chatManagerService.onStorageInit(()=>{const f=this.chatManagerService.getSessions();f.length>0?this.activateSession(f[f.length-1].sessionId):this.createSessionModel()})}setLatestRequestId(f){this._latestRequestId=f,this._onChangeRequestId.fire(f)}createRequest(f,a,h){return this.chatManagerService.createRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,f,a,h)}sendRequest(f,a=!1){const h=this.chatManagerService.sendRequest(r.__classPrivateFieldGet(this,n,"f").sessionId,f,a);return a&&this._onRegenerateRequest.fire(),h}cancelRequest(){this.chatManagerService.cancelRequest(r.__classPrivateFieldGet(this,n,"f").sessionId),this._onCancelRequest.fire()}createSessionModel(){r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}clearSessionModel(f){f=f||r.__classPrivateFieldGet(this,n,"f").sessionId,this._onWillClearSession.fire(f),this.chatManagerService.clearSession(f),f===r.__classPrivateFieldGet(this,n,"f").sessionId&&r.__classPrivateFieldSet(this,n,this.chatManagerService.startSession(),"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}getSessions(){return this.chatManagerService.getSessions()}getSession(f){return this.chatManagerService.getSession(f)}activateSession(f){const a=this.chatManagerService.getSession(f);if(!a)throw new Error(`There is no session with session id ${f}`);r.__classPrivateFieldSet(this,n,a,"f"),this._onChangeSession.fire(r.__classPrivateFieldGet(this,n,"f").sessionId)}dispose(){var f;(f=r.__classPrivateFieldGet(this,n,"f"))===null||f===void 0||f.dispose(),super.dispose()}};t.ChatInternalService=_,n=new WeakMap,r.__decorate([(0,o.Autowired)(p.AIBackSerivcePath),r.__metadata("design:type",Object)],_.prototype,"aiBackService",void 0),r.__decorate([(0,o.Autowired)(c.PreferenceService),r.__metadata("design:type",Object)],_.prototype,"preferenceService",void 0),r.__decorate([(0,o.Autowired)(v.IChatManagerService),r.__metadata("design:type",m.ChatManagerService)],_.prototype,"chatManagerService",void 0),t.ChatInternalService=_=r.__decorate([(0,o.Injectable)()],_)},70394:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatRenderRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718);let c=class extends o.Disposable{registerWelcomeRender(v){this.chatWelcomeRender=v}registerAIRoleRender(v){this.chatAIRoleRender=v}registerUserRoleRender(v){this.chatUserRoleRender=v}registerThinkingRender(v){this.chatThinkingRender=v}registerInputRender(v){this.chatInputRender=v}registerThinkingResultRender(v){this.chatThinkingResultRender=v}registerChatViewHeaderRender(v){this.chatViewHeaderRender=v}};t.ChatRenderRegistry=c,t.ChatRenderRegistry=c=n.__decorate([(0,r.Injectable)()],c)},76154:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIChatView=void 0,t.DefaultChatViewHeader=M;const n=e(85608),r=n.__importStar(e(14041)),o=e(68392),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(63067),s=e(72665);e(41937);const f=e(19413),a=e(27399),h=e(25834),u=n.__importDefault(e(90103)),d=e(57987),E=e(56474),g=e(92635),l=e(29039),y=e(78048),b=e(86556),S=e(77633),A=e(42033),w=e(51081),T=n.__importDefault(e(77256)),D="chat_scroll",I=100,O=()=>{const R=(0,c.useInjectable)(f.IChatInternalService),P=(0,c.useInjectable)(m.ChatServiceToken),k=(0,c.useInjectable)(m.IAIReporter),F=(0,c.useInjectable)(f.IChatAgentService),L=(0,c.useInjectable)(m.ChatFeatureRegistryToken),N=(0,c.useInjectable)(m.ChatRenderRegistryToken),j=(0,c.useInjectable)(S.TokenMCPServerRegistry),W=(0,c.useInjectable)(_.IMainLayoutService),U=R.sessionModel.history,X=r.useRef(null),V=r.useRef(!0),$=r.useRef(null),[Y,G]=r.useState([]),[H,K]=r.useReducer((lt,qe)=>{switch(qe.type){case"add":return[...lt,...qe.payload||[]];case"clear":return[];case"init":return Array.isArray(qe.payload)?qe.payload:[];default:return lt}},[]),[Z,Q]=r.useState(!1),[oe,ne]=r.useState(""),[he,_e]=r.useState(""),[q,Re]=r.useState(""),[ve,ie]=r.useState(null);r.useEffect(()=>{const lt=L.getAllShortcutSlashCommand(),qe=F.onDidChangeAgents(()=>{const Rt=F.getCommands().filter(nt=>nt.isShortcut).map(nt=>new A.ChatSlashCommandItemModel({icon:"",name:`${nt.name} `,description:nt.description,isShortcut:nt.isShortcut},nt.name,nt.agentId));G(lt.concat(Rt))});return G(lt),()=>qe.dispose()},[L,F]),(0,c.useUpdateOnEvent)(R.onChangeSession);const fe=r.useMemo(()=>N.chatInputRender?N.chatInputRender:d.ChatInput,[N.chatInputRender]),Me=r.useMemo(()=>(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:"",text:r.createElement(b.WelcomeMessage,null)}),[]),Le=r.useCallback(lt=>{lt.deltaY<0?V.current=!1:V.current=!0},[V]);r.useEffect(()=>{if(X.current)return X.current.addEventListener("wheel",Le),()=>{var lt;(lt=X.current)===null||lt===void 0||lt.removeEventListener("wheel",Le)}},[V]);const Ce=r.useCallback(()=>{if(X&&X.current&&V.current){const lt=X.current.lastElementChild;lt&&lt.scrollIntoView({behavior:"smooth",block:"end"}),X.current.scrollHeight>X.current.clientHeight&&X.current.classList.add(D)}},[X,V]),Se=r.useCallback(lt=>{K(lt),requestAnimationFrame(()=>{Ce()})},[K,Ce]);r.useEffect(()=>{Se({type:"init",payload:[Me]})},[]),r.useEffect(()=>{const lt=new m.Disposable;return lt.addDispose(P.onScrollToBottom(()=>{requestAnimationFrame(()=>{})})),lt.addDispose(P.onChatMessageLaunch(async qe=>{var Rt;if(qe.immediate!==!1){if(Z)return;await re(qe)}else qe.agentId&&ne(qe.agentId),qe.command&&Re(qe.command),(Rt=$?.current)===null||Rt===void 0||Rt.setInputValue(qe.message)})),lt.addDispose(P.onChatReplyMessageLaunch(qe=>{if(qe.kind==="content"){const Rt=k.start(m.AIServiceType.CustomReply,{message:qe.content,sessionId:R.sessionModel.sessionId});U.addAssistantMessage({content:qe.content,relationId:Rt}),Te({chunk:qe.content,relationId:Rt})}else{const Rt=k.start(m.AIServiceType.CustomReply,{message:"component#"+qe.component,sessionId:R.sessionModel.sessionId});U.addAssistantMessage({componentId:qe.component,componentValue:qe.value,content:"",relationId:Rt}),Fe({chunk:qe,relationId:Rt})}})),lt.addDispose(P.onChatMessageListLaunch(qe=>{const Rt=[];qe.forEach(nt=>{const{role:St}=nt,it=k.start(m.AIServiceType.Chat,{message:"",sessionId:R.sessionModel.sessionId});if(St==="assistant"){const st=nt;Rt.push((0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:it,text:r.createElement(g.ChatNotify,{requestId:it,chunk:st})},T.default.chat_notify))}if(St==="user"){const{message:st}=nt,ct=w.ChatProxyService.AGENT_ID,bt=N.chatUserRoleRender,Vt=ct===w.ChatProxyService.AGENT_ID?"":ct;Rt.push((0,y.createMessageByUser)({id:(0,m.uuid)(6),relationId:it,text:bt?r.createElement(bt,{content:st,agentId:Vt}):r.createElement(h.CodeBlockWrapperInput,{relationId:it,text:st,agentId:Vt,command:q})},T.default.chat_message_code))}}),Se({type:"add",payload:Rt}),setTimeout(Ce,0)})),()=>lt.dispose()},[P,N.chatAIRoleRender,U]),r.useEffect(()=>{const lt=new m.Disposable;return lt.addDispose(F.onDidSendMessage(qe=>{const Rt=qe,nt=k.start(m.AIServiceType.Agent,{message:""}),St=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:nt,text:r.createElement(g.ChatNotify,{requestId:R.latestRequestId,chunk:Rt})},T.default.chat_notify);Se({type:"add",payload:[St]})})),lt.addDispose(F.onDidChangeAgents(async()=>{const qe=F.getDefaultAgentId();_e(qe??"")})),()=>lt.dispose()},[F,U,R]);const Ee=r.useCallback(async lt=>{const{userMessage:qe,relationId:Rt,requestId:nt,render:St,startTime:it,command:st,agentId:ct}=lt;U.addAssistantMessage({type:"component",content:""});const bt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,className:T.default.chat_with_more_actions,text:r.createElement(l.SlashCustomRender,{userMessage:qe,startTime:it,relationId:Rt,requestId:nt,renderContent:St,command:st,agentId:ct})});Se({type:"add",payload:[bt]})},[X,U]),ge=r.useCallback(async lt=>{const qe=N.chatUserRoleRender,{message:Rt,agentId:nt,relationId:St,command:it}=lt,st=nt===w.ChatProxyService.AGENT_ID?"":nt,ct=(0,y.createMessageByUser)({id:(0,m.uuid)(6),relationId:St,text:qe?r.createElement(qe,{content:Rt,agentId:st,command:it}):r.createElement(h.CodeBlockWrapperInput,{relationId:St,text:Rt,agentId:st,command:it})},T.default.chat_message_code);Se({type:"add",payload:[ct]})},[N,N.chatUserRoleRender,U,Ce]),xe=r.useCallback(async lt=>{const{message:qe,agentId:Rt,request:nt,relationId:St,command:it,startTime:st,msgId:ct}=lt,bt=Rt===w.ChatProxyService.AGENT_ID?"":Rt;if(Rt===w.ChatProxyService.AGENT_ID&&it){const _n=L.getSlashCommandHandler(it);if(_n&&_n.providerRender)return Q(!1),Ee({userMessage:qe,render:_n.providerRender,relationId:St,requestId:nt.requestId,startTime:st,agentId:Rt,command:it})}const Vt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:St,className:T.default.chat_with_more_actions,text:r.createElement(g.ChatReply,{relationId:St,request:nt,startTime:st,agentId:bt,command:it,onDidChange:()=>{Ce()},history:U,onDone:()=>{Q(!1)},onRegenerate:()=>{nt&&R.sendRequest(nt,!0)},msgId:ct})});Se({type:"add",payload:[Vt]})},[N,U,Ce]),Te=r.useCallback(lt=>{const{chunk:qe,relationId:Rt}=lt;let nt=r.createElement(E.ChatMarkdown,{markdown:qe,fillInIncompleteTokens:!0,agentId:oe,command:q});if(N.chatAIRoleRender){const it=N.chatAIRoleRender;nt=r.createElement(it,{content:qe})}const St=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,text:nt,className:T.default.chat_with_more_actions});Se({type:"add",payload:[St]})},[N,U,Ce]),Fe=r.useCallback(lt=>{const{chunk:qe,relationId:Rt}=lt,nt=(0,y.createMessageByAI)({id:(0,m.uuid)(6),relationId:Rt,text:r.createElement(g.ChatNotify,{requestId:Rt,chunk:qe})},T.default.chat_notify);Se({type:"add",payload:[nt]})},[N,U,Ce]),pe=r.useCallback(async lt=>{const{message:qe,agentId:Rt,command:nt,reportExtra:St}=lt,{actionType:it,actionSource:st}=St||{},ct=R.createRequest(qe,Rt,nt);if(!ct)return;Q(!0),R.setLatestRequestId(ct.requestId);const bt=Date.now(),Vt=w.ChatProxyService.AGENT_ID===Rt?m.AIServiceType.Chat:m.AIServiceType.Agent,_n=k.start(nt||Vt,{agentId:Rt,userMessage:qe,actionType:it,actionSource:st,sessionId:R.sessionModel.sessionId},600*1e3);U.addUserMessage({content:qe,agentId:Rt,agentCommand:nt,relationId:_n}),await ge({relationId:_n,message:qe,command:nt,agentId:Rt}),R.sendRequest(ct);const Kn=U.addAssistantMessage({content:"",relationId:_n,requestId:ct.requestId,replyStartTime:bt});j.activeMessageInfo={messageId:Kn,sessionId:R.sessionModel.sessionId},await xe({startTime:bt,relationId:_n,message:qe,agentId:Rt,command:nt,request:ct,msgId:Kn})},[N,N.chatUserRoleRender,U,Ce]),re=r.useCallback(async lt=>{const{message:qe,command:Rt,reportExtra:nt}=lt,St=lt.agentId?lt.agentId:w.ChatProxyService.AGENT_ID;return pe({message:qe,agentId:St,command:Rt,reportExtra:nt})},[pe]),ue=r.useCallback(()=>{R.clearSessionModel(),P.clearHistoryMessages(),Oe()},[H]),Oe=r.useCallback(()=>{var lt;(lt=X?.current)===null||lt===void 0||lt.classList.remove(D),Se({type:"init",payload:[Me]})},[H]),Ae=lt=>{Z||(ie(lt.nameWithSlash),ne(lt.agentId),Re(lt.command))},Ue=r.useCallback(()=>{W.toggleSlot(f.AI_CHAT_VIEW_ID)},[W]),$e=N.chatViewHeaderRender||M,Ve=r.useCallback(async lt=>{for(const qe of U.getMessages()){if(lt.isCancellationRequested)return;if(qe.role===1)await ge({relationId:qe.relationId,message:qe.content,agentId:qe.agentId,command:qe.agentCommand});else if(qe.role===2&&qe.requestId){const Rt=R.sessionModel.getRequest(qe.requestId);Rt&&!Rt.response.isComplete&&Q(!0),await xe({msgId:qe.id,relationId:qe.relationId,message:qe.content,agentId:qe.agentId,command:qe.agentCommand,startTime:qe.replyStartTime,request:Rt})}else qe.role===2&&qe.content?await Te({relationId:qe.relationId,chunk:qe.content}):qe.role===2&&qe.componentId&&await Fe({relationId:qe.relationId,chunk:{kind:"component",component:qe.componentId,value:qe.componentValue}})}},[xe]);return r.useEffect(()=>{Oe();const lt=new m.CancellationTokenSource;return Q(!1),Ve(lt.token),()=>{lt.cancel()}},[R.sessionModel]),r.createElement("div",{id:T.default.ai_chat_view},r.createElement("div",{className:T.default.header_container},r.createElement($e,{handleClear:ue,handleCloseChatView:Ue})),r.createElement("div",{className:T.default.body_container},r.createElement("div",{className:T.default.left_bar,id:"ai_chat_left_container"},r.createElement("div",{className:T.default.chat_container,ref:X},r.createElement(o.MessageList,{className:T.default.message_list,lockable:!0,toBottomHeight:"100%",dataSource:H})),U.slicedMessageCount?r.createElement("div",{className:T.default.chat_tips_text},r.createElement("div",{className:T.default.chat_tips_container},(0,m.formatLocalize)("aiNative.chat.ai.assistant.limit.message",U.slicedMessageCount))):null,r.createElement("div",{className:T.default.chat_input_wrap},r.createElement(a.ChatContext,null),r.createElement("div",{className:T.default.header_operate},r.createElement("div",{className:T.default.header_operate_left},Y.map(lt=>r.createElement(p.Popover,{id:`ai-chat-shortcut-${lt.name}`,key:`ai-chat-shortcut-${lt.name}`,title:lt.tooltip||lt.name},r.createElement("div",{className:T.default.tag,onClick:()=>Ae(lt)},lt.name))))),r.createElement(fe,{onSend:(lt,qe,Rt)=>re({message:lt,agentId:qe,command:Rt,reportExtra:{actionSource:m.ActionSourceEnum.Chat,actionType:m.ActionTypeEnum.Send}}),disabled:Z,enableOptions:!0,theme:ve,setTheme:ie,agentId:oe,setAgentId:ne,defaultAgentId:he,command:q,setCommand:Re,ref:$})))))};t.AIChatView=O;function M({handleClear:R,handleCloseChatView:P}){const k=(0,c.useInjectable)(f.IChatInternalService),F=(0,c.useInjectable)(s.IMessageService),[L,N]=r.useState([]),[j,W]=r.useState(""),U=r.useCallback(()=>{if(k.sessionModel.history.getMessages().length>0)try{k.createSessionModel()}catch($){F.error($.message)}},[k]),X=r.useCallback($=>{k.activateSession($.id)},[k]),V=r.useCallback($=>{k.clearSessionModel($.id)},[k]);return r.useEffect(()=>{const $=()=>{const H=k.sessionModel.history.getMessages();W(H.length>0?H[H.length-1].content.slice(0,I):""),N(k.getSessions().map(K=>{const Q=K.history.getMessages(),oe=Q.length>0?Q[0].content.slice(0,I):"",ne=Q.length>0&&Q[Q.length-1].replyStartTime||0;return{id:K.sessionId,title:oe,updatedAt:ne,loading:!1}}))};$();const Y=new m.DisposableCollection,G=new Set;return Y.push(k.onChangeSession(H=>{$(),!G.has(H)&&(G.add(H),Y.push(k.sessionModel.history.onMessageChange(()=>{$()})))})),Y.push(k.sessionModel.history.onMessageChange(()=>{$()})),()=>{Y.dispose()}},[k]),r.createElement("div",{className:T.default.header},r.createElement(u.default,{className:T.default.chat_history,currentId:k.sessionModel.sessionId,title:j||(0,m.localize)("aiNative.chat.ai.assistant.name"),historyList:L,onNewChat:U,onHistoryItemSelect:X,onHistoryItemDelete:V,onHistoryItemChange:()=>{}}),r.createElement(p.Popover,{overlayClassName:T.default.popover_icon,id:"ai-chat-header-clear",title:(0,m.localize)("aiNative.operate.clear.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:T.default.action_btn,className:(0,c.getIcon)("clear"),onClick:R,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.clear.title")})),r.createElement(p.Popover,{overlayClassName:T.default.popover_icon,id:"ai-chat-header-close",position:p.PopoverPosition.left,title:(0,m.localize)("aiNative.operate.close.title")},r.createElement(v.EnhanceIcon,{wrapperClassName:T.default.action_btn,className:(0,c.getIcon)("window-close"),onClick:P,tabIndex:0,role:"button",ariaLabel:(0,m.localize)("aiNative.operate.close.title")})))}},55369:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContextSelector=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=e(45250),c=n.__importStar(e(14041)),p=e(58998),v=e(41869),m=e(81878),_=e(95263),s=e(95422),f=e(15625),a=e(70392),h=n.__importDefault(e(97431)),u=(0,c.memo)(({uri:d,active:E,selected:g,onDidSelect:l,onDidDeselect:y})=>{var b;const S=(0,s.useInjectable)(v.LabelService),A=(0,s.useInjectable)(v.AppConfig),w=(0,c.useRef)(null);return(0,c.useEffect)(()=>{if(E&&w.current){const T={behavior:"instant",block:"end"};w.current.scrollIntoView(T)}},[E,w.current]),c.default.createElement("div",{className:(0,r.default)(h.default.candidate_file,E&&h.default.active),ref:T=>w.current=T,onClick:()=>g?y(d):l(d)},c.default.createElement(m.Icon,{iconClass:S.getIcon(d)}),c.default.createElement("span",{className:h.default.basename},d.path.base),c.default.createElement("span",{className:h.default.dir},(b=a.URI.file(A.workspaceDir).relative(d.parent))===null||b===void 0?void 0:b.toString()),g&&c.default.createElement(m.Icon,{icon:"check",style:{marginLeft:"auto",color:"var(--editorGutter-addedBackground)"}}))});t.ContextSelector=(0,c.memo)(({addedFiles:d,onDidDeselect:E,onDidSelect:g,onDidClose:l})=>{const[y,b]=(0,c.useState)([]),[S,A]=(0,c.useState)(null),[w,T]=(0,c.useState)(!1),[D,I]=(0,c.useState)([]),O=(0,s.useInjectable)(_.RecentFilesManager),M=(0,s.useInjectable)(v.AppConfig),R=(0,s.useInjectable)(f.FileSearchServicePath),P=(0,c.useRef)();(0,c.useEffect)(()=>{y.length===0&&O.getMostRecentlyOpenedFiles().then(L=>{const N=d.map(W=>W.uri),j=L.filter(W=>!N.includes(new a.URI(W))).map(W=>new a.URI(W));b(j),A(j[0]||null)})},[d]);const k=(0,c.useCallback)((0,o.debounce)(L=>{if(L.target.value.trim()===""){I([]),A(y[0]);return}T(!0),R.find(L.target.value,{rootUris:[M.workspaceDir],limit:200,useGitIgnore:!0,noIgnoreParent:!0,fuzzyMatch:!0}).then(N=>{const j=N.map(W=>new a.URI(W));I(j),A(j[0])}).finally(()=>{T(!1)})},500),[]),F=(0,c.useCallback)(L=>{const{key:N}=L;if(N==="Escape"){l();return}if(N==="Enter"&&S){g(S);return}if(!["ArrowUp","ArrowDown"].includes(N))return;const W=D.length>0?D:y;if(W.length===0)return;const U=W.indexOf(S),X=U===-1?0:U,V=W.length-1,$=N==="ArrowUp"?X>0?X-1:V:X<V?X+1:0;A(W[$])},[S,D,y]);return c.default.createElement(p.ClickOutside,{mouseEvents:["click","contextmenu"],onOutsideClick:()=>l()},c.default.createElement("div",{className:h.default.context_selector,onKeyDown:F,tabIndex:-1},c.default.createElement("div",{style:{padding:"4px"}},c.default.createElement(m.Input,{placeholder:"Search files by name",autoFocus:!0,onInput:k})),c.default.createElement(m.Scrollbars,{forwardedRef:L=>L?P.current=L.ref:null},c.default.createElement("div",{className:h.default.context_list},w&&c.default.createElement("div",{className:h.default.context_search_layer}),c.default.createElement("span",{className:h.default.list_desc},D.length>0?"Search Results":"Recent Opened Files"),(D.length>0?D:y).map(L=>c.default.createElement(u,{key:L.toString(),uri:L,active:S===L,onDidSelect:g,onDidDeselect:E,selected:!!d.find(N=>N.uri.isEqual(L))}))))))})},27399:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatContext=void 0;const n=e(85608),r=n.__importStar(e(1171)),o=n.__importStar(e(14041));e(628);const c=e(80564),p=e(81878),v=e(89195),m=e(95422),_=e(11050),s=e(63214),f=e(33783),a=e(86560),h=e(82196),u=e(46044),d=e(55369),E=n.__importDefault(e(97431)),g=()=>({height:0,opacity:0}),l=S=>({height:S.scrollHeight,opacity:1}),y=S=>({height:S.offsetHeight}),b=(S,A)=>A.propertyName==="height";t.ChatContext=(0,o.memo)(()=>{const[S,A]=(0,o.useState)([]),[w,T]=(0,o.useState)(!1),D=(0,m.useInjectable)(s.LabelService),I=(0,m.useInjectable)(_.AppConfig),O=(0,m.useInjectable)(h.WorkbenchEditorService),M=(0,m.useInjectable)(u.LLMContextServiceToken);(0,o.useEffect)(()=>{const j=a.Event.debounce(M.onDidContextFilesChangeEvent,(W,U)=>U,50)(W=>{W&&A([...W.attached])},M);return()=>{j.dispose()}},[]);const R=(0,o.useCallback)(()=>{T(!0)},[S]),P=(0,o.useCallback)(j=>{M.addFileToContext(j,void 0,!0)},[]),k=(0,o.useCallback)(j=>{M.removeFileFromContext(j,!0)},[]),F=(0,o.useCallback)(j=>{O.open(j)},[]),L=(0,o.useCallback)(j=>{j.stopPropagation(),j.preventDefault(),M.cleanFileContext()},[]),N=(0,o.useCallback)((j,W)=>{j.stopPropagation(),j.preventDefault(),k(W)},[]);return o.default.createElement("div",{className:E.default.chat_context},o.default.createElement(r.default,{expandIcon:({isActive:j})=>j?o.default.createElement(c.Icon,{icon:"down"}):o.default.createElement(c.Icon,{icon:"right"}),openMotion:{motionName:"rc-collapse-motion",onEnterStart:g,onEnterActive:l,onLeaveStart:y,onLeaveActive:g,onEnterEnd:b,onLeaveEnd:b,motionDeadline:100,leavedClassName:E.default.collapse_hide}},o.default.createElement(r.Panel,{header:o.default.createElement("div",{className:E.default.context_header},o.default.createElement("h3",{className:E.default.chat_context_title},"Context ",S.length>0?` (${S.length} files)`:""),o.default.createElement(p.Popover,{overlayClassName:E.default.popover_icon,id:"ai-context-header-clear",title:(0,f.localize)("aiNative.operate.clear.title")},o.default.createElement(v.EnhanceIcon,{wrapperClassName:E.default.action_btn,className:(0,p.getIcon)("clear"),onClick:L,tabIndex:0,role:"button",ariaLabel:(0,f.localize)("aiNative.operate.clear.title")}))),key:"context-panel"},o.default.createElement("div",{className:E.default.file_list},S.map(j=>{var W;return o.default.createElement("div",{className:E.default.selected_item,key:j.uri.toString(),onClick:()=>F(j.uri)},o.default.createElement(c.Icon,{iconClass:D.getIcon(j.uri)}),o.default.createElement("span",{className:E.default.basename},j.uri.path.base,j.selection?` (${j.selection[0]}-${j.selection[1]})`:""),o.default.createElement("span",{className:E.default.dir},(W=a.URI.file(I.workspaceDir).relative(j.uri.parent))===null||W===void 0?void 0:W.toString()),o.default.createElement(c.Icon,{icon:"close",className:E.default.close_icon,onClick:U=>N(U,j.uri)}))})),o.default.createElement("div",{className:E.default.add_context,onClick:R},o.default.createElement(c.Icon,{icon:"add"}),"Add Files"))),w&&o.default.createElement(d.ContextSelector,{onDidClose:()=>T(!1),onDidDeselect:k,onDidSelect:P,addedFiles:S}))})},25834:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeBlockWrapperInput=t.CodeBlockWrapper=t.CodeEditorWithHighlight=void 0;const n=e(85608),r=n.__importDefault(e(56005)),o=n.__importStar(e(14041)),c=n.__importDefault(e(10580)),p=e(41869),v=e(81878),m=e(89195),_=e(43718),s=e(71624),f=e(9447),a=e(52416),h=n.__importDefault(e(6960)),u=e(83933);e(38191);const d=y=>{const{input:b,language:S,relationId:A,agentId:w,command:T,hideInsert:D}=y,I=o.default.useRef(null),O=(0,p.useInjectable)(f.MonacoCommandRegistry),M=(0,p.useInjectable)(p.IClipboardService),R=(0,p.useInjectable)(a.IThemeService),P=(0,p.useInjectable)(_.IAIReporter),[k,F]=(0,o.useState)(!1),L=(0,o.useMemo)(()=>(0,p.uuid)(12),[I,I.current]);(0,o.useEffect)(()=>{const W=V=>{V.type==="dark"||V.type==="hcDark"?e.e(622).then(e.bind(e,51622)):(V.type==="light"||V.type==="hcLight")&&e.e(412).then(e.bind(e,50412))},U=R.onThemeChange(V=>{W(V)}),X=R.getCurrentThemeSync();return W(X),()=>U.dispose()},[]);const N=(0,o.useCallback)(async()=>{F(!0),await M.writeText(b),P.end(A,{copy:!0,code:b,language:S,agentId:w,command:T,actionSource:_.ActionSourceEnum.Chat,actionType:_.ActionTypeEnum.ChatCopyCode}),(0,_.runWhenIdle)(()=>{F(!1)},1e3)},[M,b,A]),j=(0,o.useCallback)(()=>{const W=O.getActiveCodeEditor();if(W){const U=W.getSelection();U&&((0,s.insertSnippetWithMonacoEditor)(W,b,[U],{undoStopBefore:!1,undoStopAfter:!1}),P.end(A,{insert:!0,code:b,language:S,agentId:w,command:T,actionSource:_.ActionSourceEnum.Chat,actionType:_.ActionTypeEnum.ChatInsertCode}))}},[O]);return o.default.createElement("div",{className:h.default.monaco_wrapper},o.default.createElement("div",{className:h.default.action_toolbar},!D&&o.default.createElement(v.Popover,{id:`ai-chat-inser-${L}`,title:(0,_.localize)("aiNative.chat.code.insert")},o.default.createElement(m.EnhanceIcon,{className:(0,p.getIcon)("insert"),onClick:()=>j(),tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.chat.code.insert")})),o.default.createElement(v.Popover,{id:`ai-chat-copy-${L}`,title:(0,_.localize)(k?"aiNative.chat.code.copy.success":"aiNative.chat.code.copy")},o.default.createElement(m.EnhanceIcon,{className:(0,p.getIcon)("copy"),onClick:()=>N(),tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.chat.code.copy")}))),o.default.createElement(c.default,{language:S,ref:I,className:h.default.editor},b))};t.CodeEditorWithHighlight=d;const E=({content:y="",relationId:b,renderText:S,agentId:A="",command:w=""})=>{const T=/`([^`]+)`/g,D=/```([^]+?)```/g,I=/```([^]+)?/g,O=R=>{const P=R.split(`
30191
30201
  `)[0].trim().toLowerCase(),k=u.highLightLanguageSupport.find(F=>F===P)||"plaintext";return R=R.replace(/.*?\n/,""),R=R.trim(),o.default.createElement("div",{className:h.default.code_block},o.default.createElement("div",{className:h.default.code_language},(0,r.default)(k)),o.default.createElement(t.CodeEditorWithHighlight,{input:R,language:P,relationId:b,agentId:A,command:w}))},M=(0,o.useMemo)(()=>{const R=y.split(D),P=[];return R.map((k,F)=>{F%2===0?k.split(T).map((L,N)=>{if(N%2===0){if(L.includes("```")){const j=L.split(I).filter(Boolean);if(j.length===2){P.push(j[0]),P.push(O(j[1]));return}}S?P.push(S(L)):P.push(L)}else P.push(o.default.createElement("span",{className:h.default.code_inline,key:N},L))}):P.push(O(k))}),P},[y,S]);return o.default.createElement(o.default.Fragment,null,M)},g=({text:y,renderText:b,relationId:S,agentId:A})=>o.default.createElement("div",{className:h.default.ai_chat_code_wrapper},o.default.createElement("div",{className:h.default.render_text},o.default.createElement(E,{content:y,renderText:b,relationId:S,agentId:A})));t.CodeBlockWrapper=g;const l=({text:y,relationId:b,agentId:S,command:A})=>{const w=(0,p.useInjectable)(_.ChatFeatureRegistryToken),[T,D]=(0,o.useState)(""),[I,O]=(0,o.useState)(y);return o.default.useEffect(()=>{const{value:M,nameWithSlash:R}=w.parseSlashCommand(y);if(R){D(R),O(M);return}else O(y)},[y,w]),o.default.createElement("div",{className:h.default.ai_chat_code_wrapper},o.default.createElement("div",{className:h.default.render_text},T&&o.default.createElement("div",{className:h.default.tag_wrapper},o.default.createElement("span",{className:h.default.tag},T)),S&&o.default.createElement("div",{className:h.default.tag,style:{marginRight:4}},"@",S),A&&o.default.createElement("div",{className:h.default.tag},"/ ",A),o.default.createElement(E,{content:I,relationId:b,agentId:S,command:A})))};t.CodeBlockWrapperInput=l},90103:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(97267),p=e(41869),v=e(89195),m=n.__importDefault(e(35553)),_=100,s=(0,o.memo)(({title:f,historyList:a,currentId:h,onNewChat:u,onHistoryItemSelect:d,onHistoryItemChange:E,onHistoryItemDelete:g,className:l})=>{const[y,b]=(0,o.useState)(null),[S,A]=(0,o.useState)(""),w=(0,o.useRef)(null),T=(0,o.useCallback)(W=>{A(W.target.value)},[S]),D=(0,o.useCallback)(W=>{d(W),A("")},[d,S]),I=(0,o.useCallback)(W=>{b({[W.id]:!0})},[y]),O=(0,o.useCallback)((W,U)=>{b({[W.id]:!1}),E(W,U)},[E,y]),M=(0,o.useCallback)(W=>{b({[W.id]:!1})},[y]),R=(0,o.useCallback)(()=>{u()},[u]);(0,o.useEffect)(()=>{var W;y&&((W=w.current)===null||W===void 0||W.focus({cursor:"end"}))},[y]);const P=(0,o.useCallback)(W=>{g(W)},[g]),k=(0,o.useCallback)(W=>{if(W<60*60*1e3){const X=Math.floor(W/6e4);return X===0?"Just now":`${X}m ago`}else{if(W<24*60*60*1e3)return`${Math.floor(W/36e5)}h ago`;if(W<7*24*60*60*1e3)return`${Math.floor(W/864e5)}d ago`;if(W<30*24*60*60*1e3)return`${Math.floor(W/6048e5)}w ago`;if(W<365*24*60*60*1e3)return`${Math.floor(W/2592e6)}mo ago`}return`${Math.floor(W/(365*24*60*60*1e3))}y ago`},[]),F=(0,o.useCallback)(W=>{const U=new Date,X=[];return W.forEach(V=>{const $=new Date(V.updatedAt),Y=U.getTime()-$.getTime(),G=k(Y),H=X.find(K=>K.key===G);H?H.items.push(V):X.push({key:G,items:[V]})}),X},[k]),L=(0,o.useCallback)(W=>o.default.createElement("div",{key:W.id,className:(0,r.default)(m.default["dm-chat-history-item"],W.id===h?m.default["dm-chat-history-item-selected"]:""),onClick:()=>D(W)},o.default.createElement("div",{className:m.default["dm-chat-history-item-content"]},W.loading?o.default.createElement(c.Loading,null):o.default.createElement(c.Icon,{icon:"message",style:{width:"16px",height:"16px",marginRight:4}}),y?.[W.id]?o.default.createElement(c.Input,{className:m.default["dm-chat-history-item-title"],defaultValue:W.title,ref:w,onPressEnter:U=>{O(W,U.target.value)},onBlur:()=>M(W)}):o.default.createElement("span",{id:`dm-chat-history-item-title-${W.id}`,className:m.default["dm-chat-history-item-title"]},W.title)),o.default.createElement("div",{className:m.default["dm-chat-history-item-actions"]},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default["dm-chat-history-item-actions-delete"],(0,c.getIcon)("delete")),onClick:U=>{U.preventDefault(),U.stopPropagation(),P(W)},ariaLabel:(0,p.localize)("aiNative.operate.chatHistory.delete")}))),[y,D,O,M,I,P,h,w]),N=(0,o.useCallback)(()=>{const W=a.slice(0,_).filter(X=>X.title&&X.title.includes(S)),U=F(W);return o.default.createElement("div",null,o.default.createElement(c.Input,{placeholder:(0,p.localize)("aiNative.operate.chatHistory.searchPlaceholder"),style:{width:"100%",maxWidth:"100%"},value:S,onChange:T}),o.default.createElement("div",{className:m.default["dm-chat-history-list"]},U.map(X=>o.default.createElement("div",{key:X.key,style:{padding:"4px"}},o.default.createElement("div",{className:m.default["dm-chat-history-time"]},X.key),X.items.map(L)))))},[a,S,F,T,L]),j=(0,o.useCallback)(W=>W.parentElement,[]);return o.default.createElement("div",{className:(0,r.default)(m.default["dm-chat-history-header"],l)},o.default.createElement("div",{className:m.default["dm-chat-history-header-title"]},o.default.createElement("span",null,f)),o.default.createElement("div",{className:m.default["dm-chat-history-header-actions"]},o.default.createElement(c.Popover,{id:"dm-chat-history-header-actions-history",content:N(),trigger:c.PopoverTriggerType.click,position:c.PopoverPosition.bottomRight,title:(0,p.localize)("aiNative.operate.chatHistory.title"),getPopupContainer:j},o.default.createElement("div",{className:m.default["dm-chat-history-header-actions-history"],title:(0,p.localize)("aiNative.operate.chatHistory.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default["dm-chat-history-header-actions-history"],"codicon codicon-history")}))),o.default.createElement(c.Popover,{id:"ai-chat-header-close",position:c.PopoverPosition.top,title:(0,p.localize)("aiNative.operate.newChat.title")},o.default.createElement(v.EnhanceIcon,{className:(0,r.default)(m.default["dm-chat-history-header-actions-new"],(0,c.getIcon)("plus")),onClick:R}))))});t.default=s},57987:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatInput=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(83913),_=e(43718),s=e(92323),f=e(9447),a=e(72665),h=e(19413),u=e(42033),d=e(51081),E=e(27397),g=e(30703),l=n.__importDefault(e(6960)),y=8,b=68,S=({icon:D,name:I,description:O,agentId:M,command:R,selectedAgentId:P})=>{const k=(0,o.useMemo)(()=>!P&&M&&M!==d.ChatProxyService.AGENT_ID&&R?o.default.createElement("span",{className:l.default.agent_label},"@",M):null,[]);return o.default.createElement("div",{className:l.default.block},D&&o.default.createElement(v.EnhanceIcon,{className:D}),I&&o.default.createElement("span",{className:l.default.name},I),O&&o.default.createElement("span",{className:l.default.text},O),k)},A=({onClick:D,bottom:I,trigger:O,agentId:M})=>{const R=(0,c.useInjectable)(h.IChatAgentService),P=(0,c.useInjectable)(_.ChatAgentViewServiceToken),k=(0,o.useMemo)(()=>O===h.AT_SIGN_SYMBOL?P.getRenderAgents().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.AT_SIGN_SYMBOL}${L.id} `,description:L.metadata.description},"",L.id)):R.getCommands().map(L=>new u.ChatSlashCommandItemModel({icon:"",name:`${h.SLASH_SYMBOL} ${L.name} `,description:L.description},L.name,L.agentId)).filter(L=>!M||L.agentId===M),[O,R]),F=(0,o.useCallback)((L,N,j)=>{D&&D(L||"",N,j)},[D]);return k.length===0?null:o.default.createElement("div",{className:l.default.instruction_options_container,style:{bottom:I+"px"}},o.default.createElement("div",{className:l.default.options},o.default.createElement("ul",null,k.map(({icon:L,name:N,nameWithSlash:j,description:W,agentId:U,command:X})=>o.default.createElement("li",{key:`${U||""}-${N}`,onMouseDown:()=>F(j,U,X)},o.default.createElement(S,{icon:L,name:N,description:W,agentId:U,command:X,selectedAgentId:M}))))))},w=({themeBlock:D})=>o.default.createElement("div",{className:l.default.theme_container},o.default.createElement("div",{className:l.default.theme_block},D)),T=({agentId:D,command:I})=>o.default.createElement("div",{className:l.default.theme_container},D!==d.ChatProxyService.AGENT_ID&&o.default.createElement("div",{className:l.default.theme_block,style:{marginRight:4}},"@",D),I&&o.default.createElement("div",{className:l.default.theme_block},h.SLASH_SYMBOL," ",I));t.ChatInput=o.default.forwardRef((D,I)=>{const{onSend:O,onValueChange:M,enableOptions:R=!1,disabled:P=!1,defaultHeight:k=32,autoFocus:F,setTheme:L,theme:N,setAgentId:j,agentId:W,defaultAgentId:U,setCommand:X,command:V,sendBtnClassName:$}=D,Y=W||U,G=(0,o.useRef)(null),H=(0,o.useRef)(null),[K,Z]=(0,o.useState)(D.value||""),[Q,oe]=(0,o.useState)(!1),[ne,he]=(0,o.useState)(k),[_e,q]=(0,o.useState)(!1),[Re,ve]=(0,o.useState)(!1),[ie,fe]=(0,o.useState)(!1),[Me,Le]=(0,o.useState)((0,_.localize)("aiNative.chat.input.placeholder.default")),Ce=(0,c.useInjectable)(h.IChatInternalService),Se=(0,c.useInjectable)(a.IDialogService),Ee=(0,c.useInjectable)(c.AINativeConfigService),ge=(0,c.useInjectable)(h.TokenMCPServerProxyService),xe=(0,c.useInjectable)(f.MonacoCommandRegistry),Te=(0,c.useInjectable)(h.IChatAgentService),Fe=(0,c.useInjectable)(_.ChatFeatureRegistryToken),pe=(0,c.useInjectable)(s.CommandService),re=(0,c.useLatest)(Y),ue=o.default.useCallback(()=>{pe.executeCommand(E.OPEN_MCP_CONFIG_COMMAND.id)},[pe]),Oe=o.default.useCallback(async()=>{const st=await ge.getAllMCPTools();Se.open({message:o.default.createElement(g.MCPToolsDialog,{tools:st}),type:_.MessageType.Empty,buttons:[(0,_.localize)("dialog.file.close")]})},[ge,Se]);(0,o.useImperativeHandle)(I,()=>({setInputValue:st=>{Z(st),(0,_.runWhenIdle)(()=>{var ct;(ct=G.current)===null||ct===void 0||ct.focus()},120)}})),(0,o.useEffect)(()=>{D.value!==K&&Z(D.value||"")},[D.value]),(0,o.useEffect)(()=>{var st;(st=G.current)===null||st===void 0||st.focus();const ct=(0,_.localize)("aiNative.chat.input.placeholder.default"),bt=Fe.getSlashCommandHandler(V);if(bt&&bt.providerInputPlaceholder){const Vt=xe.getActiveCodeEditor(),_n=bt.providerInputPlaceholder(K,Vt);Le(_n||ct)}else Le(ct)},[Fe,V]),(0,o.useEffect)(()=>{Ve(N||"",Y,V)},[N,Y,V]),(0,o.useEffect)(()=>{var st;G&&F&&((st=G.current)===null||st===void 0||st.focus())},[G,F,D.value]),(0,o.useEffect)(()=>{if(R&&((K===h.SLASH_SYMBOL||K===h.AT_SIGN_SYMBOL&&Te.getAgents().length>0)&&!ie?oe(!0):oe(!1)),K.startsWith(h.SLASH_SYMBOL)){const{value:st,nameWithSlash:ct}=Fe.parseSlashCommand(K);if(ct){const bt=Fe.getSlashCommandBySlashName(ct);Z(st),L(ct),bt&&(j(bt.agentId),X(bt.command));return}}if(Te.getAgents().length){const st=Te.parseMessage(K,re.current);(st.agentId||st.command)&&(L(""),Z(st.message),st.agentId&&j(st.agentId),st.command&&X(st.command))}},[G,K,R,Fe]),(0,o.useEffect)(()=>{K||(he(k),ve(!1),fe(!1))},[K]);const Ae=(0,o.useCallback)(st=>{Z(st),M&&M(st)},[]),Ue=(0,o.useCallback)(()=>{Ce.cancelRequest()},[]),$e=(0,o.useCallback)(async()=>{if(P)return;const st=(ct=K)=>{O(ct,Y,V),Z(""),L(""),j(""),X("")};if(V){const ct=Fe.getSlashCommandHandler(V);if(ct&&ct.execute){const bt=xe.getActiveCodeEditor();await ct.execute(K,Vt=>st(Vt),bt);return}}st()},[O,K,Y,V,Fe]),Ve=(0,o.useCallback)((st,ct,bt)=>{if(ct){if(oe(!1),L(""),j(ct),X(bt||""),G?.current){const Vt=G.current.value;(Vt===h.AT_SIGN_SYMBOL||bt&&Vt===h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>G.current.focus())}}else if(st){oe(!1),j(""),X("");const Vt=Fe.getSlashCommandBySlashName(st);if(L(Vt?Vt.nameWithSlash:""),G&&G.current){const _n=G.current.value;_n.length===1&&_n.startsWith(h.SLASH_SYMBOL)&&Z(""),(0,_.runWhenIdle)(()=>G.current.focus())}}},[G,Fe]),lt=(0,o.useMemo)(()=>{const st=y+ne;return ie&&oe(!1),st},[ne]),qe=st=>{var ct,bt;if(st.key==="Backspace"&&((ct=G.current)===null||ct===void 0?void 0:ct.selectionEnd)===0&&((bt=G.current)===null||bt===void 0?void 0:bt.selectionStart)===0){if(L(""),Y===d.ChatProxyService.AGENT_ID){X(""),j("");return}Y&&(V?X(""):j(""))}},Rt=(0,o.useCallback)(st=>{he(st),st>b?ve(!0):ve(!1)},[]),nt=(0,o.useCallback)(()=>{q(!1),oe(!1)},[G]),St=(0,o.useCallback)(()=>{q(!0)},[G]),it=(0,o.useCallback)(()=>{const st=ie;if(fe(!st),st)he(k),ve(!1);else{const bt=document.querySelector("#ai_chat_left_container").clientHeight-68-(N?32:0)-16;he(bt)}},[ie]);return o.default.createElement("div",{className:(0,r.default)(l.default.chat_input_container,_e?l.default.active:null)},Q&&o.default.createElement("div",{ref:H},o.default.createElement(A,{onClick:Ve,bottom:lt,trigger:K,agentId:Y})),N&&o.default.createElement(w,{themeBlock:N}),Y&&o.default.createElement(T,{agentId:Y,command:V}),Re&&o.default.createElement("div",{className:l.default.expand_icon,onClick:()=>it()},o.default.createElement(p.Popover,{id:"ai_chat_input_expand",title:(0,_.localize)(ie?"aiNative.chat.expand.unfullscreen":"aiNative.chat.expand.fullescreen")},o.default.createElement(p.Icon,{className:(0,r.default)(ie?(0,p.getIcon)("unfullscreen"):(0,p.getIcon)("fullescreen"))}))),o.default.createElement(m.InteractiveInput,{ref:G,placeholder:Me,value:K,onKeyDown:qe,onBlur:nt,onFocus:St,onValueChange:Ae,disabled:P,className:l.default.input_wrapper,onSend:$e,onStop:Ue,sendBtnClassName:$,onHeightChange:Rt,height:ne,popoverPosition:p.PopoverPosition.left}),o.default.createElement("div",{className:l.default.chat_input_footer},Ee.capabilities.supportsMCP&&o.default.createElement("div",{className:l.default.mcp_desc},o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-mcp-server",position:p.PopoverPosition.left,title:"MCP Server"},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:"codicon codicon-radio-tower",onClick:ue,tabIndex:0,role:"button",ariaLabel:"MCP Server"})),o.default.createElement(p.Popover,{overlayClassName:l.default.popover_icon,id:"ai-chat-header-tools",position:p.PopoverPosition.left,title:(0,_.localize)("aiNative.operate.tools.title")},o.default.createElement(v.EnhanceIcon,{wrapperClassName:l.default.action_btn,className:(0,p.getIcon)("menubar-tool"),onClick:Oe,tabIndex:0,role:"button",ariaLabel:(0,_.localize)("aiNative.operate.tools.title")})))))})},56474:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatMarkdown=void 0,t.postProcessCodeBlockLanguageId=a,t.fillInIncompleteTokens=h;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(13719),p=e(84605),v=e(41869),m=e(90684),_=e(25834),s=n.__importDefault(e(6960)),f=I=>{const O=(0,o.useRef)(null),M=(0,v.useInjectable)(v.AppConfig),[R,P]=(0,o.useState)(),[k,F]=(0,o.useState)();return(0,o.useEffect)(()=>{var L,N;if(!O.current)return;const W=typeof I.markdown=="string"?new m.MarkdownString(I.markdown):I.markdown,U=new c.MarkdownReactRenderer;U.code=(H,K)=>{const Z=a(K);return o.default.createElement("div",{className:s.default.code},o.default.createElement(v.ConfigProvider,{value:M},o.default.createElement("div",{className:s.default.code_block},o.default.createElement("div",{className:(0,r.default)(s.default.code_language,"language-badge")},Z),o.default.createElement(_.CodeEditorWithHighlight,{input:H,language:Z,relationId:I.relationId||"",agentId:I.agentId,command:I.command,hideInsert:I.hideInsert}))))},U.codespan=H=>o.default.createElement("code",{className:s.default.code_inline},H);const X=new c.MarkdownReactParser({renderer:U}),V=(L=I.markedOptions)!==null&&L!==void 0?L:{};V.renderer=X;let $=(N=W.value)!==null&&N!==void 0?N:"";$.length>1e5&&($=`${$.slice(0,1e5)}\u2026`);let Y,G;if(I.fillInIncompleteTokens){const H={...p.marked.defaults,...V},K=p.marked.lexer($,H),Z=h(K);Y=p.marked.parser(Z,H),G=Z}else{const H=p.marked.lexer($,p.marked.defaults);Y=p.marked.parser(H,V),G=H}F(G),P(X)},[I.markdown]),o.default.createElement("div",{className:(0,r.default)(s.default.markdown_container,I.className),ref:O,tabIndex:0},k&&R&&R.parse(k))};t.ChatMarkdown=f;function a(I){if(!I)return"";const O=I.split(/[\s+|:|,|\{|\?]/,1);return O.length?O[0]:I}function h(I){let O,M;for(O=0;O<I.length;O++){const R=I[O];if(R.type==="paragraph"&&R.raw.match(/(\n|^)```/)){M=u(I.slice(O));break}if(R.type==="paragraph"&&R.raw.match(/(\n|^)\|/)){M=w(I.slice(O));break}if(R.type==="paragraph"&&O===I.length-1){const P=D(R);if(P){M=[P];break}}}if(M){const R=[...I.slice(0,O),...M];return R.links=I.links,R}return I}function u(I){const O=T(I);return p.marked.lexer(O+"\n```")}function d(I){return A(I,"`")}function E(I){return A(I,"*")}function g(I){return A(I,"_")}function l(I){return A(I,")")}function y(I){return A(I,"](about:blank)")}function b(I){return A(I,"**")}function S(I){return A(I,"__")}function A(I,O){const M=T(Array.isArray(I)?I:[I]);return p.marked.lexer(M+O)[0]}function w(I){const O=T(I),M=O.split(`
30192
30202
  `);let R=0,P=!1;for(let k=0;k<M.length;k++){const F=M[k].trim();if(typeof R>"u"&&F.match(/^\s*\|/)){const L=F.match(/(\|[^\|]+)(?=\||$)/g);L&&(R=L.length)}else if(typeof R=="number")if(F.match(/^\s*\|/)&&k===M.length-1)P=!0;else return}if(R>0){const k=P?M.slice(0,-1).join(`
30193
30203
  `):O,F=!!k.match(/\|\s*$/),L=k+(F?"":"|")+`
30194
30204
  |${" --- |".repeat(R)}`;return p.marked.lexer(L)}}function T(I){return I.reduce((O,M)=>O+M.raw,"")}function D(I){for(const{type:O,raw:M}of I.tokens){if(O!=="text")continue;const R=M.split(`
30195
- `),P=R[R.length-1],k=[{condition:P.includes("`"),action:d},{condition:P.includes("**"),action:b},{condition:P.match(/\*\w/),action:E},{condition:P.match(/(^|\s)__\w/),action:S},{condition:P.match(/(^|\s)_\w/),action:g},{condition:P.match(/(^|\s)\[.*\]\(\w*/),action:l},{condition:P.match(/(^|\s)\[\w/),action:y}];for(const F of k)if(F.condition)return F.action(I)}}},92635:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(48412),c=e(91416),p=e(78569),v=e(72871),m=e(41869),_=e(81878),s=e(89195),f=e(43718),a=e(52416),h=e(90684),u=e(19413),d=e(56474),E=e(17319),g=n.__importDefault(e(6960)),l=w=>{const T=(0,m.useInjectable)(m.LabelService),D=(0,m.useInjectable)(m.CommandService),I=(F,L,N)=>{let j=T.getIcon(F,{isDirectory:L});return L&&N&&(j+=" expanded"),j},O=(0,r.useMemo)(()=>{const F=L=>{const N=typeof L.type=="number"?L.type===f.FileType.Directory:!!L.children,j=new f.URI(L.uri);return{label:L.label,iconClassName:I(j,N,N),expandable:!0,expanded:!0,children:N?(L.children||[]).map(F):null,uri:j}};return(w.treeData.children||[]).map(F)},[w.treeData]),[M,R]=(0,r.useState)(22),P=(0,r.useRef)(null),k=F=>{P.current=F;const L=()=>{let N=F.getModel().root.branchSize;N<1?N=1:N>20&&(N=20),R(N*22)};L(),F.onDidUpdate(L)};return O.length?r.default.createElement("div",{className:g.default.tree_container},r.default.createElement(c.BasicRecycleTree,{height:M,treeData:O,onContextMenu:F=>F.preventDefault(),onClick:(F,L)=>{!P.current||!L||(p.BasicCompositeTreeNode.is(L)?L.raw.iconClassName=I(L.raw.uri,!0,L.expanded):D.executeCommand(m.EDITOR_COMMANDS.OPEN_RESOURCE.id,L.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:k,treeName:w.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},y=w=>{const{toolCall:T,messageId:D}=w,I=(0,m.useInjectable)(f.ChatAgentViewServiceToken),[O,M]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const R=I.getChatComponent("toolCall");if(R){const{component:k,initialProps:F}=R;M(r.default.createElement(k,{...F,value:T,messageId:D}));return}M(r.default.createElement("div",null,r.default.createElement(s.Loading,null),r.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),I.getChatComponentDeferred("toolCall").promise.then(({component:k,initialProps:F})=>{M(r.default.createElement(k,{...F,value:T,messageId:D}))})},[T.state]),O},b=w=>{const T=(0,m.useInjectable)(f.ChatAgentViewServiceToken),[D,I]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const O=T.getChatComponent(w.component);if(O){const{component:R,initialProps:P}=O;I(r.default.createElement(R,{...P,value:w.value,messageId:w.messageId}));return}I(r.default.createElement("div",null,r.default.createElement(s.Loading,null),r.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),T.getChatComponentDeferred(w.component).promise.then(({component:R,initialProps:P})=>{I(r.default.createElement(R,{...P,value:w.value}))})},[w.component,w.value]),D},S=w=>{var T,D;const{relationId:I,request:O,startTime:M=0,onRegenerate:R,onDidChange:P,onDone:k,agentId:F,command:L,history:N,msgId:j}=w,[,W]=(0,r.useReducer)(q=>(q+1)%1e6,0),U=(0,m.useInjectable)(f.IAIReporter),X=(0,m.useInjectable)(a.IIconService),V=(0,m.useInjectable)(m.IContextKeyService),$=(0,m.useInjectable)(u.IChatInternalService),Y=(0,m.useInjectable)(f.ChatServiceToken),G=(0,m.useInjectable)(u.IChatAgentService),H=(0,m.useInjectable)(f.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const q=new m.DisposableCollection;return q.push(O.response.onDidChange(()=>{N.updateAssistantMessage(j,{content:O.response.responseText}),O.response.isComplete&&(k&&k(),U.end(I,{assistantMessage:O.response.responseText,replytime:Date.now()-M,success:!0,isStop:!1,command:L,agentId:F,messageId:j,sessionId:$.sessionModel.sessionId})),(0,r.startTransition)(()=>{P?.(),W()})})),()=>q.dispose()},[I,P,k]);const K=(0,r.useCallback)(()=>{O.response.reset(),R?.()},[R]),Z=()=>{k&&k(),U.end(I,{assistantMessage:O.response.responseText,replytime:Date.now()-M,success:!1,isStop:!0,command:L,agentId:F,messageId:j,sessionId:$.sessionModel.sessionId}),$.cancelRequest()},Q=(0,r.useCallback)(q=>{if(H.chatAIRoleRender){const Re=H.chatAIRoleRender;return r.default.createElement(Re,{content:q.value})}return r.default.createElement(d.ChatMarkdown,{markdown:q,fillInIncompleteTokens:!0})},[H,H.chatAIRoleRender]),oe=q=>r.default.createElement(l,{treeData:q}),ne=q=>r.default.createElement("div",{className:g.default.placeholder},r.default.createElement(_.Icon,{iconClass:X.fromString("$(codicon/sync~spin)")}),r.default.createElement("div",{className:g.default.placeholder_content},Q(q))),he=r.default.useMemo(()=>O.response.responseContents.map((q,Re)=>{let ve;return q.kind==="asyncContent"?ve=ne(new h.MarkdownString(q.content)):q.kind==="treeData"?ve=oe(q.treeData):q.kind==="component"?ve=r.default.createElement(b,{component:q.component,value:q.value,messageId:j}):q.kind==="toolCall"?ve=r.default.createElement(y,{toolCall:q.content,messageId:j}):ve=Q(q.content),r.default.createElement(r.Fragment,{key:`${q.kind}-${Re}`},ve)}),[O.response.responseContents]),_e=r.default.useMemo(()=>O.response.followups?O.response.followups.map((q,Re)=>{let ve=null;if(q.kind==="reply"){const ie=r.default.createElement("a",{onClick:()=>{Y.sendMessage({...G.parseMessage(q.message),reportExtra:{actionSource:f.ActionSourceEnum.Chat,actionType:f.ActionTypeEnum.Followup}})}},q.title||q.message);ve=q.tooltip?r.default.createElement(v.Tooltip,{title:q.tooltip},ie):ie}else q.when&&!V.match(q.when)&&(ve=null),ve=r.default.createElement(o.Button,{type:"default"},q.title);return ve&&r.default.createElement(r.Fragment,{key:Re},ve)}):null,[O.response.followups]);return O.response.isComplete?r.default.createElement(E.ChatThinkingResult,{hasMessage:O.response.responseParts.length>0||O.response.responseContents.length>0||!!(!((T=O.response.errorDetails)===null||T===void 0)&&T.message),onRegenerate:K,requestId:O.requestId},r.default.createElement("div",{className:g.default.ai_chat_response_container},!((D=O.response.errorDetails)===null||D===void 0)&&D.message?r.default.createElement("div",{className:g.default.error},r.default.createElement(_.Icon,{className:(0,_.getIcon)("close-circle")}),r.default.createElement("span",null,O.response.errorDetails.message)):r.default.createElement(r.default.Fragment,null,he,_e?.length!==0&&r.default.createElement("div",{className:g.default.followups},_e)))):r.default.createElement(E.ChatThinking,{message:O.response.responseText},he)};t.ChatReply=S;const A=w=>{const{chunk:T}=w,D=(0,m.useInjectable)(f.ChatRenderRegistryToken),I=r.default.useMemo(()=>{let O;if(T.kind==="component")O=r.default.createElement(b,{component:T.component,value:T.value});else{let M=r.default.createElement(d.ChatMarkdown,{markdown:T.content,fillInIncompleteTokens:!0});if(D.chatAIRoleRender){const R=D.chatAIRoleRender;M=r.default.createElement(R,{content:T.content})}O=M}return O},[T]);return r.default.createElement(E.ChatThinkingResult,{hasMessage:!0,requestId:w.requestId,showRegenerate:!1},r.default.createElement("div",{className:g.default.ai_chat_response_container},I))};t.ChatNotify=A},17319:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(89195),p=e(68974),v=e(43718),m=e(19413),_=n.__importDefault(e(6960)),s=a=>{const{children:h,message:u,thinkingText:d}=a,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),g=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),l=(0,r.useCallback)(()=>!h||!u?.trim()?g?r.default.createElement(g,{thinkingText:d}):r.default.createElement("span",{className:_.default.thinking_text},d||"Thinking..."):h,[u,h,d,g]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},l()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.stop},!g&&r.default.createElement("span",{className:_.default.progress_bar},!h&&r.default.createElement(p.Progress,{loading:!0,wrapperClassName:_.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const f=({children:a,message:h,onRegenerate:u,requestId:d,hasMessage:E=!0,showRegenerate:g})=>{const l=(0,o.useInjectable)(m.IChatInternalService),[y,b]=(0,r.useState)(l.latestRequestId),S=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const I=l.onChangeRequestId(O=>{b(O)});return()=>I.dispose()},[l]);const A=(0,r.useMemo)(()=>S.chatThinkingResultRender,[S,S.chatThinkingResultRender]),w=(0,r.useCallback)(()=>{u&&u()},[u]),T=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const I=(0,v.localize)("aiNative.chat.stop.immediately");return A?r.default.createElement(A,{thinkingResult:I}):r.default.createElement("span",null,I)}return a},[h,E,a]),D=(0,r.useMemo)(()=>(0,v.isUndefined)(g)?y===d&&!!d:!!g,[y,d,g]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},T()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.bottom_container},r.default.createElement("div",{className:_.default.reset},D?r.default.createElement(c.EnhanceIcon,{icon:"refresh",wrapperClassName:_.default.text_btn,className:_.default.transform,onClick:w,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:_.default.thumbs},r.default.createElement(c.Thumbs,{relationId:d,wrapperClassName:_.default.icon_btn})))))};t.ChatThinkingResult=f},34817:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(77633),s=e(25834),f=n.__importDefault(e(16796)),a=h=>{var u,d,E;const{value:g,messageId:l}=h,[y,b]=(0,o.useState)(!1),S=(0,c.useInjectable)(_.TokenMCPServerRegistry);if(!g||!g.function||!g.id)return null;const A=((u=S.getMCPTool(g.function.name))===null||u===void 0?void 0:u.label)||g.function.name,w=S.getToolComponent(g.function.name),T=M=>{switch(M){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:M||"Unknown",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-question"})}}},D=()=>{var M;try{return g.state!=="complete"&&g.state!=="result"?{}:JSON.parse(((M=g.function)===null||M===void 0?void 0:M.arguments)||"{}")}catch{return{}}},I=()=>{b(!y)},O=T(g.state);return w&&(g.state==="complete"||g.state==="result")?o.default.createElement(w,{state:g.state,args:D(),result:g.result,index:g.index,messageId:l,toolCallId:g.id}):o.default.createElement("div",{className:f.default["chat-tool-render"]},o.default.createElement("div",{className:f.default["tool-header"],onClick:I},o.default.createElement("div",{className:f.default["tool-name"]},o.default.createElement(p.Icon,{iconClass:`codicon codicon-triangle-${y?"down":"right"}`}),A),g.state&&o.default.createElement("div",{className:f.default["tool-state"]},o.default.createElement("span",{className:f.default["state-icon"]},O.icon))),o.default.createElement("div",{className:(0,r.default)(f.default["tool-content"],{[f.default.expanded]:y})},((d=g?.function)===null||d===void 0?void 0:d.arguments)&&o.default.createElement("div",{className:f.default["tool-arguments"]},o.default.createElement("div",{className:f.default["section-label"]},"Arguments"),o.default.createElement(s.CodeEditorWithHighlight,{input:(E=g?.function)===null||E===void 0?void 0:E.arguments,language:"json",relationId:(0,m.uuid)(4)})),g?.result&&o.default.createElement("div",{className:f.default["tool-result"]},o.default.createElement("div",{className:f.default["section-label"]},"Result"),o.default.createElement(s.CodeEditorWithHighlight,{input:g.result,language:"json",relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=a},29039:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),c=e(43718),p=e(19413),v=m=>{const{userMessage:_,relationId:s,requestId:f,renderContent:a,startTime:h,agentId:u,command:d}=m,E=(0,o.useInjectable)(p.IChatInternalService),g=(0,o.useInjectable)(c.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(f),g.end(s,{message:_,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:d})},[a,f,s]),r.createElement("div",null,a({userMessage:_}))};t.SlashCustomRender=v},86556:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(4246),v=e(43718),m=e(90684);e(41937);const _=e(19413),s=e(56474),f=e(17319),a=e(78048),h=n.__importDefault(e(6960)),u=()=>{var d,E;const g=(0,o.useInjectable)(v.ChatServiceToken),l=(0,o.useInjectable)(_.IChatAgentService),y=(0,o.useInjectable)(v.ChatFeatureRegistryToken),b=(0,o.useInjectable)(v.ChatRenderRegistryToken),[S,A]=r.useState([]);(0,o.useUpdateOnEvent)(y.onDidWelcomeMessageChange);const w=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return[];const{sampleQuestions:O=[]}=y.chatWelcomeMessageModel;return O.map(a.extractIcon)},[(d=y.chatWelcomeMessageModel)===null||d===void 0?void 0:d.sampleQuestions]),T=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return"";const{content:O}=y.chatWelcomeMessageModel;return O},[(E=y.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const O=l.onDidChangeAgents(async()=>{const R=(await l.getAllSampleQuestions()).map(a.extractIcon);A(R)});return()=>O.dispose()},[]),!T)return r.createElement(f.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const D=r.useMemo(()=>w.concat(S),[w,S]);return r.useMemo(()=>{if(b.chatWelcomeRender){const O=b.chatWelcomeRender;return r.createElement(O,{message:T,sampleQuestions:D})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(T)?r.createElement(s.ChatMarkdown,{markdown:T}):T),r.createElement("div",{className:h.default.chat_container_content},D.map((O,M)=>{const R=r.createElement("a",{className:h.default.link_item,onClick:(0,p.withPrevented)(()=>{g.sendMessage({...l.parseMessage(O.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},O.icon?r.createElement(c.Icon,{className:O.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,O.title));return O.tooltip?r.createElement(c.Tooltip,{title:O.tooltip,key:M},R):r.createElement(r.Fragment,{key:M},R)})))},[b.chatWelcomeRender,T,D])};t.WelcomeMessage=u},83933:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,_)=>o({...m,position:"right",title:r,className:_,role:1});t.createMessageByUser=c;const p=(m,_)=>o({...m,position:"left",title:"",className:_,role:2});t.createMessageByAI=p;const v=m=>{let{title:_}=m;const{message:s,tooltip:f}=m;let a=m.icon||"";if(!_)return{icon:a,title:s,message:s,tooltip:f};const h=_.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,g]=h,l=d?d.slice(0,-1):n.CODICON_OWNER;a=(0,n.getExternalIcon)(E,l),g&&(a+=` ${g.slice(1)}`),_=_.slice(u.length)}return{icon:a,title:_,message:s,tooltip:f}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let p=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=p,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),t.LlmContextContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),p=e(19083),v=e(86560),m=e(96689),_=e(82196),s=e(6287);let f=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(h,u,d){const E=u.findIndex(g=>g.uri.toString()===h.uri.toString());E>-1&&u.splice(E,1),u.push(h),u.length>d&&u.shift()}addFileToContext(h,u,d=!1){if(!h)return;const E={uri:h,selection:u},g=d?this.attachedFiles:this.recentlyViewFiles,l=d?this.maxAttachFilesLimit:this.maxViewFilesLimit;d&&this.docModelManager.createModelReference(h),this.addFileToList(E,g,l),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles.length=0,this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,version:this.contextVersion++}}removeFileFromContext(h,u=!1){const d=u?this.attachedFiles:this.recentlyViewFiles,E=d.findIndex(g=>g.uri.toString()===h.toString());E>-1&&d.splice(E,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,h=>{h.payload.uri.scheme==="file"&&this.addFileToContext(h.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,h=>{h.payload.scheme==="file"&&this.removeFileFromContext(h.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,h=>{h.payload.scheme})),this.disposables.push(this.eventBus.on(_.EditorSelectionChangeEvent,h=>{if(h.payload.selections.length>0){const u=[h.payload.selections[0].selectionStartLineNumber,h.payload.selections[0].positionLineNumber].sort();u[0]===u[1]?this.addFileToContext(h.payload.editorUri,void 0,!1):this.addFileToContext(h.payload.editorUri,u.sort((d,E)=>d-E),!1)}}))}stopAutoCollection(){this.dispose()}serialize(){const h=this.getAllContextFiles(),u=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(h.viewed,u),attachedFiles:this.serializeAttachedFiles(h.attached,u)}}serializeRecentlyViewFiles(h,u){return h.map(d=>{var E;return((E=u.relative(d.uri))===null||E===void 0?void 0:E.toString())||d.uri.parent.toString()}).filter(Boolean)}serializeAttachedFiles(h,u){return h.map(d=>this.serializeAttachedFile(d,u)).filter(Boolean)}serializeAttachedFile(h,u){try{const d=this.docModelManager.getModelReference(h.uri);return d?{content:d.instance.getText(),lineErrors:this.getFileErrors(h.uri),path:u.relative(h.uri).toString(),language:d.instance.languageId}:null}catch{return null}}getFileErrors(h){return this.markerService.getManager().getMarkers({resource:h.toString(),severities:p.MarkerSeverity.Error}).map(u=>u.message)}};t.LLMContextServiceImpl=f,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],f.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(m.IEditorDocumentModelService),n.__metadata("design:type",Object)],f.prototype,"docModelManager",void 0),n.__decorate([(0,r.Autowired)(s.IMarkerService),n.__metadata("design:type",Object)],f.prototype,"markerService",void 0),t.LLMContextServiceImpl=f=n.__decorate([(0,r.Injectable)()],f)},99906:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.BaseAIMonacoEditorController=t.BaseAIMonacoContribHandler=void 0;const r=e(85608),o=e(76003),c=e(43718);class p extends c.Disposable{constructor(){super(),this.allowAnyScheme=!1,this.allowedSchemes=[c.Schemes.file],this.sessionDisposable=new c.Disposable}shouldHandle(_){return!!(this.allowAnyScheme||this.allowedSchemes.includes(_.scheme))}unload(){this.sessionDisposable.dispose(),this.sessionDisposable=new c.Disposable}load(){this.unload(),this.sessionDisposable.addDispose(this.doContribute())}mountEditor(_){return this.monacoEditor=_,{dispose:()=>{this.monacoEditor=void 0}}}}t.BaseAIMonacoContribHandler=p;let v=n=class extends c.Disposable{static get(_){return _.getContribution(n.ID)}get token(){return this.cancellationTokenSource.token}cancelToken(){this.cancellationTokenSource.cancel(),this.cancellationTokenSource=new c.CancellationTokenSource}constructor(_,s){super(),this.injector=_,this.monacoEditor=s,this.cancellationTokenSource=new c.CancellationTokenSource,this.featureDisposable=new c.Disposable,this.allowedSchemes=[c.Schemes.file,c.Schemes.notebookCell];const f=new c.Disposable;let a=!1;this.addDispose(this.monacoEditor.onDidChangeModel(({newModelUrl:u})=>{if(!u)return;const d=this.allowedSchemes.includes(u.scheme);d!==a&&(a=!!d,a?f.addDispose(this.mount()):f.dispose())}));const h=s.getModel();h&&this.allowedSchemes.includes(h.uri.scheme)&&(a=!0,f.addDispose(this.mount())),this.addDispose(f)}};t.BaseAIMonacoEditorController=v,t.BaseAIMonacoEditorController=v=n=r.__decorate([r.__param(0,(0,o.Optional)()),r.__param(1,(0,o.Optional)()),r.__metadata("design:paramtypes",[o.Injector,Object])],v)},72713:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AICodeActionContribution=void 0;const n=e(85608),r=e(76003),o=e(57925),c=e(43718),p=e(89132);let v=class extends c.Disposable{registerCommands(_){_.registerCommand(o.AI_CODE_ACTION,{execute:(s,f)=>{this.codeActionService.fireCodeActionRun(f,s)}})}};t.AICodeActionContribution=v,n.__decorate([(0,r.Autowired)(p.CodeActionService),n.__metadata("design:type",p.CodeActionService)],v.prototype,"codeActionService",void 0),t.AICodeActionContribution=v=n.__decorate([(0,c.Domain)(c.CommandContribution)],v)},79559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionSingleHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=n.__importStar(e(20868)),v=e(52902),m=e(77714),_=e(85679),s=e(99906),f=e(89132);let a=class extends s.BaseAIMonacoContribHandler{constructor(){super(),this.inlineChatActionEnabled=this.preferenceService.getValid(c.AINativeSettingSectionsId.InlineChatCodeActionEnabled,!0),this.addDispose(this.preferenceService.onSpecificPreferenceChange(c.AINativeSettingSectionsId.InlineChatCodeActionEnabled,({newValue:u})=>{this.inlineChatActionEnabled=u,u?this.load():this.unload()}))}doContribute(){return v.monacoApi.languages.registerCodeActionProvider("*",{provideCodeActions:async(u,d)=>{if(!this.inlineChatActionEnabled)return;const E=u.getLineContent(d.startLineNumber);if(E?.trim()===m.empty||!this.shouldHandle(u.uri))return;const{languageParserService:g,codeActionService:l}=this,y=u.getLanguageId(),b=g.createParser(y);if(!b)return;const S=l.getCodeActions();if(!S||S.length===0)return;const A=d.getStartPosition();if(!A)return;function w(I){return{actions:S.map(O=>{const M={};O.command&&(M.id=O.command.id,M.arguments=[I.range,...O.command.arguments]);let R=O.title;switch(I.infoCategory){case"function":R=R+` for Function: ${I.name}`}return{...O,title:R,ranges:[I.range],command:M}}),dispose(){}}}const T=await b.provideCodeBlockInfo(u,A);if(T)return w(T);if(u.getLineLength(A.lineNumber)===0&&this.monacoEditor){const I=this.monacoEditor.getVisibleRanges();if(I.length===0)return;const O=new p.Range(A.lineNumber,0,I[0].endLineNumber+1,0),M=await b.provideCodeBlockInfoInRange(u,O);if(M)return w(M)}}})}};t.CodeActionSingleHandler=a,n.__decorate([(0,r.Autowired)(f.CodeActionService),n.__metadata("design:type",f.CodeActionService)],a.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],a.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(_.LanguageParserService),n.__metadata("design:type",_.LanguageParserService)],a.prototype,"languageParserService",void 0),t.CodeActionSingleHandler=a=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],a)},89132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionService=void 0;const n=e(85608),r=e(76003),o=e(57925),c=e(43718);let p=class extends c.Disposable{constructor(){super(...arguments),this.codeActionsMap=new Map,this._onCodeActionRun=new c.Emitter,this.onCodeActionRun=this._onCodeActionRun.event}dispose(){super.dispose(),this.codeActionsMap.clear()}fireCodeActionRun(m,_){this._onCodeActionRun.fire({id:m,range:_})}getCodeActions(){return Array.from(this.codeActionsMap.values())}deleteCodeActionById(m){this.codeActionsMap.delete(m)}registerCodeAction(m){var _;const{codeAction:s,id:f}=m;if(!s)return;const a={title:s.title||m.name,isAI:!0,isPreferred:(_=s.isPreferred)!==null&&_!==void 0?_:!0,kind:s.kind||"InlineChat",disabled:s.disabled,command:{id:o.AI_CODE_ACTION.id,title:s.title||m.name,arguments:[m.id]}};this.codeActionsMap.set(f,a)}};t.CodeActionService=p,t.CodeActionService=p=n.__decorate([(0,r.Injectable)()],p)},57232:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineCompletionsProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=n.__importStar(e(20868)),v=e(687),m=e(71863),_={line:-1,column:-1,last:null};class s{constructor(){this.queue=[]}addReq(h){this.queue.push(h)}runReq(){return this.queue.length===0?void 0:this.queue.pop().run()}cancelReq(){this.queue.length!==0&&(this.queue.forEach(h=>{h.cancelRequest()}),this.queue=[])}}let f=class extends c.WithEventBus{constructor(){super(),this.inlineComletionsDebounceTime=this.preferenceService.getValid(c.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,150),this.addDispose(this.preferenceService.onSpecificPreferenceChange(c.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,({newValue:h})=>{this.inlineComletionsDebounceTime=h})),this.mount()}mount(){this.isManual=!1,this.isDelEvent=!1,this.reqStack=new s}setVisibleCompletion(h){this.aiCompletionsService.setVisibleCompletion(h)}hideStatusBarItem(){this.aiCompletionsService.hideStatusBarItem()}cancelRequest(){this.aiCompletionsService.cancelRequest(),this.reqStack&&this.reqStack.cancelReq()}async provideInlineCompletionItems(h,u,d,E){if(d.triggerKind===p.InlineCompletionTriggerKind.Automatic&&_.column===u.column&&_.line===u.lineNumber&&_.last!==void 0)return _.column=-1,_.line=-1,_.last;this.cancelRequest(),this.hideStatusBarItem();const g=this.isManual;if(this.isDelEvent&&!g)return;this.updateIsManual(!1);const l=this.injector.get(v.InlineCompletionRequestTask,[h,u,E]);if(this.reqStack.addReq(l),g||await(0,c.raceCancellation)((0,c.sleep)(this.inlineComletionsDebounceTime),E),E?.isCancellationRequested)return;const y=await this.reqStack.runReq();if(y)return _.column=u.column,_.line=u.lineNumber,_.last={items:y},_.last}updateIsManual(h){this.isManual=h}};t.AIInlineCompletionsProvider=f,n.__decorate([(0,r.Autowired)(m.AICompletionsService),n.__metadata("design:type",m.AICompletionsService)],f.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],f.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],f.prototype,"preferenceService",void 0),t.AIInlineCompletionsProvider=f=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],f)},2409:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lineBasedCompletionModelConfigs=t.DEFAULT_COMPLECTION_MODEL=void 0;const n=e(71585);t.DEFAULT_COMPLECTION_MODEL={maxPromptTokenSize:3e3,maxExecuteTimeMillSecond:1e3,tokenizerName:n.TokenizerName.cl100k_base,wishList:{afterCursor:{enable:!0,attributeName:n.WishListAttributeName.afterCursor,extOption:{suffixPercent:.25,minBlockSize:25},priority:1,strategy:n.StrategyType.InterceptBasedOnLine},beforeCursor:{enable:!0,attributeName:n.WishListAttributeName.beforeCursor,extOption:{prefixPercent:.75,minBlockSize:75},priority:0,strategy:n.StrategyType.InterceptBasedOnLine},importedFile:{attributeName:n.WishListAttributeName.importedFile,enable:!0,extOption:{maxTime:200,importedFilesMaxNum:10,language:["typescript"],maxPercent:.8,patternPrefix:"Import Files from ",patternSuffix:`
30205
+ `),P=R[R.length-1],k=[{condition:P.includes("`"),action:d},{condition:P.includes("**"),action:b},{condition:P.match(/\*\w/),action:E},{condition:P.match(/(^|\s)__\w/),action:S},{condition:P.match(/(^|\s)_\w/),action:g},{condition:P.match(/(^|\s)\[.*\]\(\w*/),action:l},{condition:P.match(/(^|\s)\[\w/),action:y}];for(const F of k)if(F.condition)return F.action(I)}}},92635:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatNotify=t.ChatReply=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(48412),c=e(91416),p=e(78569),v=e(72871),m=e(41869),_=e(81878),s=e(89195),f=e(43718),a=e(52416),h=e(90684),u=e(19413),d=e(56474),E=e(17319),g=n.__importDefault(e(6960)),l=w=>{const T=(0,m.useInjectable)(m.LabelService),D=(0,m.useInjectable)(m.CommandService),I=(F,L,N)=>{let j=T.getIcon(F,{isDirectory:L});return L&&N&&(j+=" expanded"),j},O=(0,r.useMemo)(()=>{const F=L=>{const N=typeof L.type=="number"?L.type===f.FileType.Directory:!!L.children,j=new f.URI(L.uri);return{label:L.label,iconClassName:I(j,N,N),expandable:!0,expanded:!0,children:N?(L.children||[]).map(F):null,uri:j}};return(w.treeData.children||[]).map(F)},[w.treeData]),[M,R]=(0,r.useState)(22),P=(0,r.useRef)(null),k=F=>{P.current=F;const L=()=>{let N=F.getModel().root.branchSize;N<1?N=1:N>20&&(N=20),R(N*22)};L(),F.onDidUpdate(L)};return O.length?r.default.createElement("div",{className:g.default.tree_container},r.default.createElement(c.BasicRecycleTree,{height:M,treeData:O,onContextMenu:F=>F.preventDefault(),onClick:(F,L)=>{!P.current||!L||(p.BasicCompositeTreeNode.is(L)?L.raw.iconClassName=I(L.raw.uri,!0,L.expanded):D.executeCommand(m.EDITOR_COMMANDS.OPEN_RESOURCE.id,L.raw.uri,{disableNavigate:!0,preview:!0}))},onReady:k,treeName:w.treeData.label,leaveBottomBlank:!1,baseIndent:0})):null},y=w=>{const{toolCall:T,messageId:D}=w,I=(0,m.useInjectable)(f.ChatAgentViewServiceToken),[O,M]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const R=I.getChatComponent("toolCall");if(R){const{component:k,initialProps:F}=R;M(r.default.createElement(k,{...F,value:T,messageId:D}));return}M(r.default.createElement("div",null,r.default.createElement(s.Loading,null),r.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),I.getChatComponentDeferred("toolCall").promise.then(({component:k,initialProps:F})=>{M(r.default.createElement(k,{...F,value:T,messageId:D}))})},[T.state]),O},b=w=>{const T=(0,m.useInjectable)(f.ChatAgentViewServiceToken),[D,I]=(0,r.useState)(null);return(0,r.useEffect)(()=>{const O=T.getChatComponent(w.component);if(O){const{component:R,initialProps:P}=O;I(r.default.createElement(R,{...P,value:w.value,messageId:w.messageId}));return}I(r.default.createElement("div",null,r.default.createElement(s.Loading,null),r.default.createElement("span",{style:{marginLeft:4}},"\u6B63\u5728\u52A0\u8F7D\u7EC4\u4EF6"))),T.getChatComponentDeferred(w.component).promise.then(({component:R,initialProps:P})=>{I(r.default.createElement(R,{...P,value:w.value}))})},[w.component,w.value]),D},S=w=>{var T,D;const{relationId:I,request:O,startTime:M=0,onRegenerate:R,onDidChange:P,onDone:k,agentId:F,command:L,history:N,msgId:j}=w,[,W]=(0,r.useReducer)(q=>(q+1)%1e6,0),U=(0,m.useInjectable)(f.IAIReporter),X=(0,m.useInjectable)(a.IIconService),V=(0,m.useInjectable)(m.IContextKeyService),$=(0,m.useInjectable)(u.IChatInternalService),Y=(0,m.useInjectable)(f.ChatServiceToken),G=(0,m.useInjectable)(u.IChatAgentService),H=(0,m.useInjectable)(f.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const q=new m.DisposableCollection;return q.push(O.response.onDidChange(()=>{N.updateAssistantMessage(j,{content:O.response.responseText}),O.response.isComplete&&(k&&k(),U.end(I,{assistantMessage:O.response.responseText,replytime:Date.now()-M,success:!0,isStop:!1,command:L,agentId:F,messageId:j,sessionId:$.sessionModel.sessionId})),(0,r.startTransition)(()=>{P?.(),W()})})),()=>q.dispose()},[I,P,k]);const K=(0,r.useCallback)(()=>{O.response.reset(),R?.()},[R]),Z=()=>{k&&k(),U.end(I,{assistantMessage:O.response.responseText,replytime:Date.now()-M,success:!1,isStop:!0,command:L,agentId:F,messageId:j,sessionId:$.sessionModel.sessionId}),$.cancelRequest()},Q=(0,r.useCallback)(q=>{if(H.chatAIRoleRender){const Re=H.chatAIRoleRender;return r.default.createElement(Re,{content:q.value})}return r.default.createElement(d.ChatMarkdown,{markdown:q,fillInIncompleteTokens:!0})},[H,H.chatAIRoleRender]),oe=q=>r.default.createElement(l,{treeData:q}),ne=q=>r.default.createElement("div",{className:g.default.placeholder},r.default.createElement(_.Icon,{iconClass:X.fromString("$(codicon/sync~spin)")}),r.default.createElement("div",{className:g.default.placeholder_content},Q(q))),he=r.default.useMemo(()=>O.response.responseContents.map((q,Re)=>{let ve;return q.kind==="asyncContent"?ve=ne(new h.MarkdownString(q.content)):q.kind==="treeData"?ve=oe(q.treeData):q.kind==="component"?ve=r.default.createElement(b,{component:q.component,value:q.value,messageId:j}):q.kind==="toolCall"?ve=r.default.createElement(y,{toolCall:q.content,messageId:j}):ve=Q(q.content),r.default.createElement(r.Fragment,{key:`${q.kind}-${Re}`},ve)}),[O.response.responseContents]),_e=r.default.useMemo(()=>O.response.followups?O.response.followups.map((q,Re)=>{let ve=null;if(q.kind==="reply"){const ie=r.default.createElement("a",{onClick:()=>{Y.sendMessage({...G.parseMessage(q.message),reportExtra:{actionSource:f.ActionSourceEnum.Chat,actionType:f.ActionTypeEnum.Followup}})}},q.title||q.message);ve=q.tooltip?r.default.createElement(v.Tooltip,{title:q.tooltip},ie):ie}else q.when&&!V.match(q.when)&&(ve=null),ve=r.default.createElement(o.Button,{type:"default"},q.title);return ve&&r.default.createElement(r.Fragment,{key:Re},ve)}):null,[O.response.followups]);return O.response.isComplete?r.default.createElement(E.ChatThinkingResult,{hasMessage:O.response.responseParts.length>0||O.response.responseContents.length>0||!!(!((T=O.response.errorDetails)===null||T===void 0)&&T.message),onRegenerate:K,requestId:O.requestId},r.default.createElement("div",{className:g.default.ai_chat_response_container},!((D=O.response.errorDetails)===null||D===void 0)&&D.message?r.default.createElement("div",{className:g.default.error},r.default.createElement(_.Icon,{className:(0,_.getIcon)("close-circle")}),r.default.createElement("span",null,O.response.errorDetails.message)):r.default.createElement(r.default.Fragment,null,he,_e?.length!==0&&r.default.createElement("div",{className:g.default.followups},_e)))):r.default.createElement(E.ChatThinking,{message:O.response.responseText},he)};t.ChatReply=S;const A=w=>{const{chunk:T}=w,D=(0,m.useInjectable)(f.ChatRenderRegistryToken),I=r.default.useMemo(()=>{let O;if(T.kind==="component")O=r.default.createElement(b,{component:T.component,value:T.value});else{let M=r.default.createElement(d.ChatMarkdown,{markdown:T.content,fillInIncompleteTokens:!0});if(D.chatAIRoleRender){const R=D.chatAIRoleRender;M=r.default.createElement(R,{content:T.content})}O=M}return O},[T]);return r.default.createElement(E.ChatThinkingResult,{hasMessage:!0,requestId:w.requestId,showRegenerate:!1},r.default.createElement("div",{className:g.default.ai_chat_response_container},I))};t.ChatNotify=A},17319:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatThinkingResult=t.ChatThinking=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(89195),p=e(68974),v=e(43718),m=e(19413),_=n.__importDefault(e(6960)),s=a=>{const{children:h,message:u,thinkingText:d}=a,E=(0,o.useInjectable)(v.ChatRenderRegistryToken),g=(0,r.useMemo)(()=>E.chatThinkingRender,[E,E.chatThinkingRender]),l=(0,r.useCallback)(()=>!h||!u?.trim()?g?r.default.createElement(g,{thinkingText:d}):r.default.createElement("span",{className:_.default.thinking_text},d||"Thinking..."):h,[u,h,d,g]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},l()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.stop},!g&&r.default.createElement("span",{className:_.default.progress_bar},!h&&r.default.createElement(p.Progress,{loading:!0,wrapperClassName:_.default.ai_native_progress_wrapper})))))};t.ChatThinking=s;const f=({children:a,message:h,onRegenerate:u,requestId:d,hasMessage:E=!0,showRegenerate:g})=>{const l=(0,o.useInjectable)(m.IChatInternalService),[y,b]=(0,r.useState)(l.latestRequestId),S=(0,o.useInjectable)(v.ChatRenderRegistryToken);(0,r.useEffect)(()=>{const I=l.onChangeRequestId(O=>{b(O)});return()=>I.dispose()},[l]);const A=(0,r.useMemo)(()=>S.chatThinkingResultRender,[S,S.chatThinkingResultRender]),w=(0,r.useCallback)(()=>{u&&u()},[u]),T=(0,r.useCallback)(()=>{if(typeof E=="boolean"?!E:!h?.trim()){const I=(0,v.localize)("aiNative.chat.stop.immediately");return A?r.default.createElement(A,{thinkingResult:I}):r.default.createElement("span",null,I)}return a},[h,E,a]),D=(0,r.useMemo)(()=>(0,v.isUndefined)(g)?y===d&&!!d:!!g,[y,d,g]);return r.default.createElement(r.default.Fragment,null,r.default.createElement("div",{className:_.default.content},T()),r.default.createElement("div",{className:_.default.thinking_container},r.default.createElement("div",{className:_.default.bottom_container},r.default.createElement("div",{className:_.default.reset},D?r.default.createElement(c.EnhanceIcon,{icon:"refresh",wrapperClassName:_.default.text_btn,className:_.default.transform,onClick:w,tabIndex:0,role:"button"},r.default.createElement("span",null,(0,v.localize)("aiNative.operate.afresh.title"))):null),r.default.createElement("div",{className:_.default.thumbs},r.default.createElement(c.Thumbs,{relationId:d,wrapperClassName:_.default.icon_btn})))))};t.ChatThinkingResult=f},34817:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChatToolRender=void 0;const n=e(85608),r=n.__importDefault(e(53373)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=e(43718),_=e(77633),s=e(25834),f=n.__importDefault(e(16796)),a=h=>{var u,d,E;const{value:g,messageId:l}=h,[y,b]=(0,o.useState)(!1),S=(0,c.useInjectable)(_.TokenMCPServerRegistry);if(!g||!g.function||!g.id)return null;const A=((u=S.getMCPTool(g.function.name))===null||u===void 0?void 0:u.label)||g.function.name,w=S.getToolComponent(g.function.name),T=M=>{switch(M){case"streaming-start":case"streaming":return{label:"Generating",icon:o.default.createElement(v.Loading,null)};case"complete":return{label:"Complete",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check"})};case"result":return{label:"Result Ready",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-check-all"})};default:return{label:M||"Unknown",icon:o.default.createElement(p.Icon,{iconClass:"codicon codicon-question"})}}},D=()=>{var M;try{return g.state!=="complete"&&g.state!=="result"?{}:JSON.parse(((M=g.function)===null||M===void 0?void 0:M.arguments)||"{}")}catch{return{}}},I=()=>{b(!y)},O=T(g.state);return w&&(g.state==="complete"||g.state==="result")?o.default.createElement(w,{state:g.state,args:D(),result:g.result,index:g.index,messageId:l,toolCallId:g.id}):o.default.createElement("div",{className:f.default["chat-tool-render"]},o.default.createElement("div",{className:f.default["tool-header"],onClick:I},o.default.createElement("div",{className:f.default["tool-name"]},o.default.createElement(p.Icon,{iconClass:`codicon codicon-triangle-${y?"down":"right"}`}),A),g.state&&o.default.createElement("div",{className:f.default["tool-state"]},o.default.createElement("span",{className:f.default["state-icon"]},O.icon))),o.default.createElement("div",{className:(0,r.default)(f.default["tool-content"],{[f.default.expanded]:y})},((d=g?.function)===null||d===void 0?void 0:d.arguments)&&o.default.createElement("div",{className:f.default["tool-arguments"]},o.default.createElement("div",{className:f.default["section-label"]},"Arguments"),o.default.createElement(s.CodeEditorWithHighlight,{input:(E=g?.function)===null||E===void 0?void 0:E.arguments,language:"json",relationId:(0,m.uuid)(4)})),g?.result&&o.default.createElement("div",{className:f.default["tool-result"]},o.default.createElement("div",{className:f.default["section-label"]},"Result"),o.default.createElement(s.CodeEditorWithHighlight,{input:g.result,language:"json",relationId:(0,m.uuid)(4)}))))};t.ChatToolRender=a},29039:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SlashCustomRender=void 0;const r=e(85608).__importStar(e(14041)),o=e(41869),c=e(43718),p=e(19413),v=m=>{const{userMessage:_,relationId:s,requestId:f,renderContent:a,startTime:h,agentId:u,command:d}=m,E=(0,o.useInjectable)(p.IChatInternalService),g=(0,o.useInjectable)(c.IAIReporter);return r.useEffect(()=>{E.setLatestRequestId(f),g.end(s,{message:_,replytime:Date.now()-h,success:!0,isStop:!1,agentId:u,command:d})},[a,f,s]),r.createElement("div",null,a({userMessage:_}))};t.SlashCustomRender=v},86556:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.WelcomeMessage=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(41869),c=e(81878),p=e(4246),v=e(43718),m=e(90684);e(41937);const _=e(19413),s=e(56474),f=e(17319),a=e(78048),h=n.__importDefault(e(6960)),u=()=>{var d,E;const g=(0,o.useInjectable)(v.ChatServiceToken),l=(0,o.useInjectable)(_.IChatAgentService),y=(0,o.useInjectable)(v.ChatFeatureRegistryToken),b=(0,o.useInjectable)(v.ChatRenderRegistryToken),[S,A]=r.useState([]);(0,o.useUpdateOnEvent)(y.onDidWelcomeMessageChange);const w=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return[];const{sampleQuestions:O=[]}=y.chatWelcomeMessageModel;return O.map(a.extractIcon)},[(d=y.chatWelcomeMessageModel)===null||d===void 0?void 0:d.sampleQuestions]),T=r.useMemo(()=>{if(!y.chatWelcomeMessageModel)return"";const{content:O}=y.chatWelcomeMessageModel;return O},[(E=y.chatWelcomeMessageModel)===null||E===void 0?void 0:E.content]);if(r.useEffect(()=>{const O=l.onDidChangeAgents(async()=>{const R=(await l.getAllSampleQuestions()).map(a.extractIcon);A(R)});return()=>O.dispose()},[]),!T)return r.createElement(f.ChatThinking,{thinkingText:(0,v.localize)("aiNative.chat.welcome.loading.text")});const D=r.useMemo(()=>w.concat(S),[w,S]);return r.useMemo(()=>{if(b.chatWelcomeRender){const O=b.chatWelcomeRender;return r.createElement(O,{message:T,sampleQuestions:D})}return r.createElement("div",{className:h.default.chat_welcome_head},r.createElement("div",{className:h.default.chat_container_des},(0,m.isMarkdownString)(T)?r.createElement(s.ChatMarkdown,{markdown:T}):T),r.createElement("div",{className:h.default.chat_container_content},D.map((O,M)=>{const R=r.createElement("a",{className:h.default.link_item,onClick:(0,p.withPrevented)(()=>{g.sendMessage({...l.parseMessage(O.message),reportExtra:{actionType:v.ActionTypeEnum.Welcome,actionSource:v.ActionSourceEnum.Chat}})})},O.icon?r.createElement(c.Icon,{className:O.icon,style:{color:"inherit",marginRight:"4px"}}):"",r.createElement("span",null,O.title));return O.tooltip?r.createElement(c.Tooltip,{title:O.tooltip,key:M},R):r.createElement(r.Fragment,{key:M},R)})))},[b.chatWelcomeRender,T,D])};t.WelcomeMessage=u},83933:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highLightLanguageSupport=void 0,t.highLightLanguageSupport=["1c","abnf","accesslog","actionscript","ada","angelscript","apache","applescript","arcade","arduino","armasm","xml","asciidoc","aspectj","autohotkey","autoit","avrasm","awk","axapta","bash","basic","bnf","brainfuck","c-like","c","cal","capnproto","ceylon","clean","clojure","clojure-repl","cmake","coffeescript","coq","cos","cpp","crmsh","crystal","csharp","csp","css","d","markdown","dart","delphi","diff","django","dns","dockerfile","dos","dsconfig","dts","dust","ebnf","elixir","elm","ruby","erb","erlang-repl","erlang","excel","fix","flix","fortran","fsharp","gams","gauss","gcode","gherkin","glsl","gml","go","golo","gradle","groovy","haml","handlebars","haskell","haxe","hsp","htmlbars","http","hy","inform7","ini","irpf90","isbl","java","javascript","jboss-cli","json","julia","julia-repl","kotlin","lasso","latex","ldif","leaf","less","lisp","livecodeserver","livescript","llvm","lsl","lua","makefile","mathematica","matlab","maxima","mel","mercury","mipsasm","mizar","perl","mojolicious","monkey","moonscript","n1ql","nginx","nim","nix","node-repl","nsis","objectivec","ocaml","openscad","oxygene","parser3","pf","pgsql","php","php-template","plaintext","pony","powershell","processing","profile","prolog","properties","protobuf","puppet","purebasic","python","python-repl","q","qml","r","reasonml","rib","roboconf","routeros","rsl","ruleslanguage","rust","sas","scala","scheme","scilab","scss","shell","smali","smalltalk","sml","sqf","sql_more","sql","stan","stata","step21","stylus","subunit","swift","taggerscript","yaml","tap","tcl","thrift","tp","twig","typescript","vala","vbnet","vbscript","vbscript-html","verilog","vhdl","vim","x86asm","xl","xquery","zephir"]},78048:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractIcon=t.createMessageByAI=t.createMessageByUser=void 0;const n=e(41869),r="",o=m=>({...m,type:"text",className:`${m.position==="left"?"rce-ai-msg":"rce-user-msg"} ${m.className?m.className:""}`}),c=(m,_)=>o({...m,position:"right",title:r,className:_,role:1});t.createMessageByUser=c;const p=(m,_)=>o({...m,position:"left",title:"",className:_,role:2});t.createMessageByAI=p;const v=m=>{let{title:_}=m;const{message:s,tooltip:f}=m;let a=m.icon||"";if(!_)return{icon:a,title:s,message:s,tooltip:f};const h=_.match(/^\$\(([a-z.]+\/)?([a-z0-9-]+)(~[a-z]+)?\)/i);if(h){const[u,d,E,g]=h,l=d?d.slice(0,-1):n.CODICON_OWNER;a=(0,n.getExternalIcon)(E,l),g&&(a+=` ${g.slice(1)}`),_=_.slice(u.length)}return{icon:a,title:_,message:s,tooltip:f}};t.extractIcon=v},19957:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LlmContextContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(46044);let p=class{initialize(){this.llmContextService.startAutoCollection()}};t.LlmContextContribution=p,n.__decorate([(0,r.Autowired)(c.LLMContextServiceToken),n.__metadata("design:type",Object)],p.prototype,"llmContextService",void 0),t.LlmContextContribution=p=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],p)},63536:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LLMContextServiceImpl=void 0;const n=e(85608),r=e(76003),o=e(11050),c=e(25234),p=e(19083),v=e(86560),m=e(96689),_=e(82196),s=e(6287),f=e(20868);let a=class extends c.WithEventBus{constructor(){super(...arguments),this.isAutoCollecting=!1,this.contextVersion=0,this.maxAttachFilesLimit=10,this.maxViewFilesLimit=20,this.attachedFiles=[],this.recentlyViewFiles=[],this.onDidContextFilesChangeEmitter=new v.Emitter,this.onDidContextFilesChangeEvent=this.onDidContextFilesChangeEmitter.event}addFileToList(u,d,E){const g=d.findIndex(l=>l.uri.toString()===u.uri.toString());g>-1&&d.splice(g,1),d.push(u),d.length>E&&d.shift()}addFileToContext(u,d,E=!1){if(!u)return;const g={uri:u,selection:d},l=E?this.attachedFiles:this.recentlyViewFiles,y=E?this.maxAttachFilesLimit:this.maxViewFilesLimit;E&&this.docModelManager.createModelReference(u),this.addFileToList(g,l,y),this.notifyContextChange()}notifyContextChange(){this.onDidContextFilesChangeEmitter.fire(this.getAllContextFiles())}cleanFileContext(){this.attachedFiles.length=0,this.notifyContextChange()}getAllContextFiles(){return{viewed:this.recentlyViewFiles,attached:this.attachedFiles,version:this.contextVersion++}}removeFileFromContext(u,d=!1){const E=d?this.attachedFiles:this.recentlyViewFiles,g=E.findIndex(l=>l.uri.toString()===u.toString());g>-1&&E.splice(g,1),this.notifyContextChange()}startAutoCollection(){this.isAutoCollecting||(this.isAutoCollecting=!0,this.startAutoCollectionInternal())}startAutoCollectionInternal(){this.disposables.push(this.eventBus.on(m.EditorDocumentModelCreationEvent,u=>{u.payload.uri.scheme==="file"&&this.addFileToContext(u.payload.uri,void 0,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelRemovalEvent,u=>{u.payload.scheme==="file"&&this.removeFileFromContext(u.payload,!1)})),this.disposables.push(this.eventBus.on(m.EditorDocumentModelSavedEvent,u=>{u.payload.scheme})),this.disposables.push(this.eventBus.on(_.EditorSelectionChangeEvent,u=>{if(u.payload.selections.length>0){const d=[u.payload.selections[0].selectionStartLineNumber,u.payload.selections[0].positionLineNumber].sort();d[0]===d[1]?this.addFileToContext(u.payload.editorUri,void 0,!1):this.addFileToContext(u.payload.editorUri,d.sort((E,g)=>E-g),!1)}}))}stopAutoCollection(){this.dispose()}serialize(){const u=this.getAllContextFiles(),d=v.URI.file(this.appConfig.workspaceDir);return{recentlyViewFiles:this.serializeRecentlyViewFiles(u.viewed,d),attachedFiles:this.serializeAttachedFiles(u.attached,d)}}serializeRecentlyViewFiles(u,d){return u.map(E=>{var g;return((g=d.relative(E.uri))===null||g===void 0?void 0:g.toString())||E.uri.parent.toString()}).filter(Boolean)}serializeAttachedFiles(u,d){return u.map(E=>this.serializeAttachedFile(E,d)).filter(Boolean)}serializeAttachedFile(u,d){try{const E=this.docModelManager.getModelReference(u.uri);return E?{content:E.instance.getText(u.selection&&new f.Range(u.selection[0],1/0,u.selection[1],1/0)),lineErrors:this.getFileErrors(u.uri),path:d.relative(u.uri).toString(),language:E.instance.languageId}:null}catch{return null}}getFileErrors(u){return this.markerService.getManager().getMarkers({resource:u.toString(),severities:p.MarkerSeverity.Error}).map(d=>d.message)}};t.LLMContextServiceImpl=a,n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],a.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(m.IEditorDocumentModelService),n.__metadata("design:type",Object)],a.prototype,"docModelManager",void 0),n.__decorate([(0,r.Autowired)(s.IMarkerService),n.__metadata("design:type",Object)],a.prototype,"markerService",void 0),t.LLMContextServiceImpl=a=n.__decorate([(0,r.Injectable)()],a)},99906:(x,t,e)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.BaseAIMonacoEditorController=t.BaseAIMonacoContribHandler=void 0;const r=e(85608),o=e(76003),c=e(43718);class p extends c.Disposable{constructor(){super(),this.allowAnyScheme=!1,this.allowedSchemes=[c.Schemes.file],this.sessionDisposable=new c.Disposable}shouldHandle(_){return!!(this.allowAnyScheme||this.allowedSchemes.includes(_.scheme))}unload(){this.sessionDisposable.dispose(),this.sessionDisposable=new c.Disposable}load(){this.unload(),this.sessionDisposable.addDispose(this.doContribute())}mountEditor(_){return this.monacoEditor=_,{dispose:()=>{this.monacoEditor=void 0}}}}t.BaseAIMonacoContribHandler=p;let v=n=class extends c.Disposable{static get(_){return _.getContribution(n.ID)}get token(){return this.cancellationTokenSource.token}cancelToken(){this.cancellationTokenSource.cancel(),this.cancellationTokenSource=new c.CancellationTokenSource}constructor(_,s){super(),this.injector=_,this.monacoEditor=s,this.cancellationTokenSource=new c.CancellationTokenSource,this.featureDisposable=new c.Disposable,this.allowedSchemes=[c.Schemes.file,c.Schemes.notebookCell];const f=new c.Disposable;let a=!1;this.addDispose(this.monacoEditor.onDidChangeModel(({newModelUrl:u})=>{if(!u)return;const d=this.allowedSchemes.includes(u.scheme);d!==a&&(a=!!d,a?f.addDispose(this.mount()):f.dispose())}));const h=s.getModel();h&&this.allowedSchemes.includes(h.uri.scheme)&&(a=!0,f.addDispose(this.mount())),this.addDispose(f)}};t.BaseAIMonacoEditorController=v,t.BaseAIMonacoEditorController=v=n=r.__decorate([r.__param(0,(0,o.Optional)()),r.__param(1,(0,o.Optional)()),r.__metadata("design:paramtypes",[o.Injector,Object])],v)},72713:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AICodeActionContribution=void 0;const n=e(85608),r=e(76003),o=e(57925),c=e(43718),p=e(89132);let v=class extends c.Disposable{registerCommands(_){_.registerCommand(o.AI_CODE_ACTION,{execute:(s,f)=>{this.codeActionService.fireCodeActionRun(f,s)}})}};t.AICodeActionContribution=v,n.__decorate([(0,r.Autowired)(p.CodeActionService),n.__metadata("design:type",p.CodeActionService)],v.prototype,"codeActionService",void 0),t.AICodeActionContribution=v=n.__decorate([(0,c.Domain)(c.CommandContribution)],v)},79559:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionSingleHandler=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=n.__importStar(e(20868)),v=e(52902),m=e(77714),_=e(85679),s=e(99906),f=e(89132);let a=class extends s.BaseAIMonacoContribHandler{constructor(){super(),this.inlineChatActionEnabled=this.preferenceService.getValid(c.AINativeSettingSectionsId.InlineChatCodeActionEnabled,!0),this.addDispose(this.preferenceService.onSpecificPreferenceChange(c.AINativeSettingSectionsId.InlineChatCodeActionEnabled,({newValue:u})=>{this.inlineChatActionEnabled=u,u?this.load():this.unload()}))}doContribute(){return v.monacoApi.languages.registerCodeActionProvider("*",{provideCodeActions:async(u,d)=>{if(!this.inlineChatActionEnabled)return;const E=u.getLineContent(d.startLineNumber);if(E?.trim()===m.empty||!this.shouldHandle(u.uri))return;const{languageParserService:g,codeActionService:l}=this,y=u.getLanguageId(),b=g.createParser(y);if(!b)return;const S=l.getCodeActions();if(!S||S.length===0)return;const A=d.getStartPosition();if(!A)return;function w(I){return{actions:S.map(O=>{const M={};O.command&&(M.id=O.command.id,M.arguments=[I.range,...O.command.arguments]);let R=O.title;switch(I.infoCategory){case"function":R=R+` for Function: ${I.name}`}return{...O,title:R,ranges:[I.range],command:M}}),dispose(){}}}const T=await b.provideCodeBlockInfo(u,A);if(T)return w(T);if(u.getLineLength(A.lineNumber)===0&&this.monacoEditor){const I=this.monacoEditor.getVisibleRanges();if(I.length===0)return;const O=new p.Range(A.lineNumber,0,I[0].endLineNumber+1,0),M=await b.provideCodeBlockInfoInRange(u,O);if(M)return w(M)}}})}};t.CodeActionSingleHandler=a,n.__decorate([(0,r.Autowired)(f.CodeActionService),n.__metadata("design:type",f.CodeActionService)],a.prototype,"codeActionService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],a.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(_.LanguageParserService),n.__metadata("design:type",_.LanguageParserService)],a.prototype,"languageParserService",void 0),t.CodeActionSingleHandler=a=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],a)},89132:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionService=void 0;const n=e(85608),r=e(76003),o=e(57925),c=e(43718);let p=class extends c.Disposable{constructor(){super(...arguments),this.codeActionsMap=new Map,this._onCodeActionRun=new c.Emitter,this.onCodeActionRun=this._onCodeActionRun.event}dispose(){super.dispose(),this.codeActionsMap.clear()}fireCodeActionRun(m,_){this._onCodeActionRun.fire({id:m,range:_})}getCodeActions(){return Array.from(this.codeActionsMap.values())}deleteCodeActionById(m){this.codeActionsMap.delete(m)}registerCodeAction(m){var _;const{codeAction:s,id:f}=m;if(!s)return;const a={title:s.title||m.name,isAI:!0,isPreferred:(_=s.isPreferred)!==null&&_!==void 0?_:!0,kind:s.kind||"InlineChat",disabled:s.disabled,command:{id:o.AI_CODE_ACTION.id,title:s.title||m.name,arguments:[m.id]}};this.codeActionsMap.set(f,a)}};t.CodeActionService=p,t.CodeActionService=p=n.__decorate([(0,r.Injectable)()],p)},57232:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIInlineCompletionsProvider=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=n.__importStar(e(20868)),v=e(687),m=e(71863),_={line:-1,column:-1,last:null};class s{constructor(){this.queue=[]}addReq(h){this.queue.push(h)}runReq(){return this.queue.length===0?void 0:this.queue.pop().run()}cancelReq(){this.queue.length!==0&&(this.queue.forEach(h=>{h.cancelRequest()}),this.queue=[])}}let f=class extends c.WithEventBus{constructor(){super(),this.inlineComletionsDebounceTime=this.preferenceService.getValid(c.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,150),this.addDispose(this.preferenceService.onSpecificPreferenceChange(c.AINativeSettingSectionsId.IntelligentCompletionsDebounceTime,({newValue:h})=>{this.inlineComletionsDebounceTime=h})),this.mount()}mount(){this.isManual=!1,this.isDelEvent=!1,this.reqStack=new s}setVisibleCompletion(h){this.aiCompletionsService.setVisibleCompletion(h)}hideStatusBarItem(){this.aiCompletionsService.hideStatusBarItem()}cancelRequest(){this.aiCompletionsService.cancelRequest(),this.reqStack&&this.reqStack.cancelReq()}async provideInlineCompletionItems(h,u,d,E){if(d.triggerKind===p.InlineCompletionTriggerKind.Automatic&&_.column===u.column&&_.line===u.lineNumber&&_.last!==void 0)return _.column=-1,_.line=-1,_.last;this.cancelRequest(),this.hideStatusBarItem();const g=this.isManual;if(this.isDelEvent&&!g)return;this.updateIsManual(!1);const l=this.injector.get(v.InlineCompletionRequestTask,[h,u,E]);if(this.reqStack.addReq(l),g||await(0,c.raceCancellation)((0,c.sleep)(this.inlineComletionsDebounceTime),E),E?.isCancellationRequested)return;const y=await this.reqStack.runReq();if(y)return _.column=u.column,_.line=u.lineNumber,_.last={items:y},_.last}updateIsManual(h){this.isManual=h}};t.AIInlineCompletionsProvider=f,n.__decorate([(0,r.Autowired)(m.AICompletionsService),n.__metadata("design:type",m.AICompletionsService)],f.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(r.INJECTOR_TOKEN),n.__metadata("design:type",r.Injector)],f.prototype,"injector",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],f.prototype,"preferenceService",void 0),t.AIInlineCompletionsProvider=f=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],f)},2409:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lineBasedCompletionModelConfigs=t.DEFAULT_COMPLECTION_MODEL=void 0;const n=e(71585);t.DEFAULT_COMPLECTION_MODEL={maxPromptTokenSize:3e3,maxExecuteTimeMillSecond:1e3,tokenizerName:n.TokenizerName.cl100k_base,wishList:{afterCursor:{enable:!0,attributeName:n.WishListAttributeName.afterCursor,extOption:{suffixPercent:.25,minBlockSize:25},priority:1,strategy:n.StrategyType.InterceptBasedOnLine},beforeCursor:{enable:!0,attributeName:n.WishListAttributeName.beforeCursor,extOption:{prefixPercent:.75,minBlockSize:75},priority:0,strategy:n.StrategyType.InterceptBasedOnLine},importedFile:{attributeName:n.WishListAttributeName.importedFile,enable:!0,extOption:{maxTime:200,importedFilesMaxNum:10,language:["typescript"],maxPercent:.8,patternPrefix:"Import Files from ",patternSuffix:`
30196
30206
  `},priority:3,strategy:n.StrategyType.InterceptBasedOnLine},languageMarker:{attributeName:n.WishListAttributeName.languageMarker,enable:!0,extOption:{language:["python","html"],maxPercent:0},priority:4,strategy:n.StrategyType.InterceptBasedOnLine},pathMarker:{attributeName:n.WishListAttributeName.pathMarker,enable:!0,priority:1,strategy:n.StrategyType.InterceptBasedOnLine},similarFile:{attributeName:n.WishListAttributeName.similarFile,enable:!0,extOption:{maxTime:200,fileMaxLength:5e3,maxPercent:.3,neighboringTabsMaxNum:20,neighboringTabsOption:[n.NeighboringTabsOption.openFileHistory,n.NeighboringTabsOption.editFileRecent,n.NeighboringTabsOption.editFileHistory],patternPrefix:"Compare this snippet from ",patternSuffix:`
30197
30207
  `,similarityThreshold:.6,snippetMaxNum:4,windowSize:60,snippetSelectionMode:n.SnippetSelectionOption.BestMatch},priority:2,strategy:n.StrategyType.InterceptBasedOnLine}}},t.lineBasedCompletionModelConfigs={completionPromptMaxLineSize:1024,completionSuffixMaxLineSize:500}},72991:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineCompletionsController=void 0;const r=e(85608).__importDefault(e(12784)),o=e(57925),c=e(43718),p=e(57517),v=e(20868),m=e(52902),_=e(77714),s=e(37355),f=e(19413),a=e(77659),h=e(99906);class u extends h.BaseAIMonacoEditorController{constructor(){super(...arguments),this.sequencer=new c.Sequencer}static get(E){return E.getContribution(u.ID)}get eventBus(){return this.injector.get(c.IEventBus)}get commandService(){return this.injector.get(c.CommandService)}get aiInlineCompletionsProvider(){return this.injector.get(f.IAIInlineCompletionsProvider)}get intelligentCompletionsRegistry(){return this.injector.get(c.IntelligentCompletionsRegistryToken)}mount(){this.aiNativeContextKey=this.injector.get(a.AINativeContextKey,[this.monacoEditor.contextKeyService]);const E=()=>{this.aiInlineCompletionsProvider.hideStatusBarItem();const b=this.monacoEditor.getSelection();b&&(b.startLineNumber!==b.endLineNumber||b.startColumn!==b.endColumn)&&this.aiInlineCompletionsProvider.cancelRequest()},g=(0,r.default)(E,50,{maxWait:200,leading:!0,trailing:!0}),l=new Set([s.InlineCompletionContextKeys.inlineSuggestionVisible.key]);this.featureDisposable.addDispose(this.monacoEditor.contextKeyService.onDidChangeContext(b=>{b.affectsSome(l)&&!s.InlineCompletionContextKeys.inlineSuggestionVisible.getValue(this.monacoEditor.contextKeyService)&&this.preDidShowItems&&(0,c.runWhenIdle)(()=>{this.preDidShowItems=void 0,this.commandService.executeCommand(o.AI_INLINE_COMPLETION_VISIBLE.id,!1)})})),this.featureDisposable.addDispose(this.eventBus.on(p.EditorSelectionChangeEvent,b=>{b.payload.source==="mouse"?g():(g.cancel(),E())})),this.featureDisposable.addDispose(this.monacoEditor.onDidChangeModelContent(b=>{const S=b.changes;for(const A of S)A.text===_.empty?(this.aiInlineCompletionsProvider.isDelEvent=!0,this.aiInlineCompletionsProvider.cancelRequest()):this.aiInlineCompletionsProvider.isDelEvent=!1})),this.featureDisposable.addDispose(this.monacoEditor.onDidBlurEditorText(()=>{this.commandService.executeCommand(o.AI_INLINE_COMPLETION_VISIBLE.id,!1)}));let y;return this.featureDisposable.addDispose(m.monacoApi.languages.registerInlineCompletionsProvider("*",{groupId:"ai-native-intelligent-completions",provideInlineCompletions:async(b,S,A,w)=>{if(this.preDidShowItems){y||(y=S.delta(0,-1));const D=b.getValueInRange(v.Range.fromPositions(y,S));if(this.preDidShowItems.items[0].insertText.toString().startsWith(D))return this.preDidShowItems;y=void 0}return await this.sequencer.queue(()=>this.aiInlineCompletionsProvider.provideInlineCompletionItems(b,S,A,w))},freeInlineCompletions(){},handleItemDidShow:b=>{b.items.length>0&&(this.preDidShowItems=b,this.aiInlineCompletionsProvider.setVisibleCompletion(!0))}})),this.featureDisposable}async fetchProvider(E){const g=this.intelligentCompletionsRegistry.getInlineCompletionsProvider();if(!g||this.aiNativeContextKey.codeEditsIsVisible.get())return;const y=this.monacoEditor.getPosition();return await g(this.monacoEditor,y,E,this.token)}}t.InlineCompletionsController=u,u.ID="editor.contrib.ai.inline.completions"},687:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InlineCompletionRequestTask=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(57925),p=e(43718),v=e(52664),m=e(54414),_=e(51553),s=n.__importStar(e(20868)),f=e(74292),a=e(72991),h=e(64016),u=e(74151),d=e(71863),E=y=>{const b=new Set;for(const S of y)b.add(S);return b},g=(y,b)=>{let S="";const A=E(y);for(const w of b)(w===" "||!A.has(w))&&(S+=w);return S};let l=class extends p.Disposable{constructor(b,S,A){super(),this.model=b,this.position=S,this.token=A,this._disposables=new p.DisposableStore,this.isEnablePromptEngineering=!0,this.isCancelFlag=!1,this.isEnablePromptEngineering=this.preferenceService.getValid(p.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,this.isEnablePromptEngineering),this._disposables.add(this.preferenceService.onSpecificPreferenceChange(p.AINativeSettingSectionsId.IntelligentCompletionsPromptEngineeringEnabled,({newValue:w})=>{this.isEnablePromptEngineering=w}))}async constructRequestBean(b,S){const A=u.lineBasedPromptProcessor.processPrefix(b.prefix),w=u.lineBasedPromptProcessor.processSuffix(b.suffix);return{prompt:A,suffix:w,sessionId:(0,p.uuid)(),language:b.language,fileUrl:b.fileUrl,workspaceDir:b.workspaceDir}}async run(){const{model:b,position:S,token:A}=this;if(!b)return[];if(A.isCancellationRequested)return[];if(this.isCancelFlag)return[];const w=new s.Range(0,0,S.lineNumber,S.column);let T=b.getValueInRange(w);T===""&&(T+=`
30198
30208
  `);const D=new s.Range(S.lineNumber,S.column,b.getLineCount(),Number.MAX_SAFE_INTEGER),I=b.getValueInRange(D),O=b.getLanguageId(),M={fileUrl:b.uri.fsPath,filename:b.uri.toString().split("/").pop(),language:O,prefix:T,suffix:I,uri:p.URI.from(b.uri),workspaceDir:this.appConfig.workspaceDir},R=await this.constructRequestBean(M,A);if(this.isCancelFlag)return[];const P=Date.now();let k;const F=this.promptCache.getCache(R),L=F?.relationId||this.aiReporter.start(v.AIServiceType.Completion,{message:v.AIServiceType.Completion});if(this.aiCompletionsService.setLastRelationId(L),F)k=F;else try{if(this.aiCompletionsService.updateStatusBarItem("running",!0),this.intelligentCompletionsRegistry.getInlineCompletionsProvider()){const j=this.workbenchEditorService.currentCodeEditor;if(!j)return[];const W=a.InlineCompletionsController.get(j.monacoEditor);k=await W?.fetchProvider(R)}else k=await this.aiCompletionsService.complete(R)}catch(N){return this.aiCompletionsService.reporterEnd(L,{success:!1,replytime:Date.now()-P,message:N.toString()}),this.aiCompletionsService.hideStatusBarItem(),[]}finally{this.aiCompletionsService.hideStatusBarItem()}return k?this.pushLineCompletions(k,R,P,L):[]}pushLineCompletions(b,S,A,w){var T;const{position:D}=this;if(this.aiCompletionsService.setLastSessionId(S.sessionId),!((T=b?.extra)===null||T===void 0)&&T.isCancel||this.token.isCancellationRequested||this.isCancelFlag)return this.aiCompletionsService.reporterEnd(w,{success:!0,replytime:Date.now()-A,isStop:!0,completionNum:0}),this.aiCompletionsService.updateStatusBarItem("canceled",!1),[];if(!b||!b.items||b.items.length===0)return this.aiCompletionsService.reporterEnd(w,{success:!0,replytime:Date.now()-A,completionNum:0}),this.aiCompletionsService.updateStatusBarItem("no result",!1),[];b.items.length>0&&this.promptCache.setCache(S,{...b,relationId:w}),this.aiCompletionsService.updateStatusBarItem("completion result: "+b.items.length,!1),this.dispose();const I=new Array;for(const O of b.items){const R=O.insertText.toString().trimEnd(),P=this.model,k=P.getValueInRange({startLineNumber:D.lineNumber,startColumn:D.column,endLineNumber:D.lineNumber,endColumn:P.getLineMaxColumn(D.lineNumber)}),F=g(R,k),L=R+F;this.aiCompletionsService.setLastCompletionContent(L),I.push({...O,insertText:L,range:new s.Range(D.lineNumber,D.column,D.lineNumber,D.column+R.length+k.length),sessionId:S.sessionId,relationId:w,command:{id:c.AI_INLINE_COMPLETION_REPORTER.id,title:"",arguments:[w,S.sessionId,!0,L]}})}return I}dispose(){this._disposables.dispose()}cancelRequest(){this.isCancelFlag=!0,this.dispose()}};t.InlineCompletionRequestTask=l,n.__decorate([(0,r.Autowired)(v.IAIReporter),n.__metadata("design:type",Object)],l.prototype,"aiReporter",void 0),n.__decorate([(0,r.Autowired)(h.PromptCache),n.__metadata("design:type",h.PromptCache)],l.prototype,"promptCache",void 0),n.__decorate([(0,r.Autowired)(d.AICompletionsService),n.__metadata("design:type",d.AICompletionsService)],l.prototype,"aiCompletionsService",void 0),n.__decorate([(0,r.Autowired)(o.PreferenceService),n.__metadata("design:type",Object)],l.prototype,"preferenceService",void 0),n.__decorate([(0,r.Autowired)(o.AppConfig),n.__metadata("design:type",Object)],l.prototype,"appConfig",void 0),n.__decorate([(0,r.Autowired)(p.IntelligentCompletionsRegistryToken),n.__metadata("design:type",f.IntelligentCompletionsRegistry)],l.prototype,"intelligentCompletionsRegistry",void 0),n.__decorate([(0,r.Autowired)(m.WorkbenchEditorService),n.__metadata("design:type",_.WorkbenchEditorServiceImpl)],l.prototype,"workbenchEditorService",void 0),t.InlineCompletionRequestTask=l=n.__decorate([(0,r.Injectable)({multiple:!0}),n.__metadata("design:paramtypes",[Object,s.Position,Object])],l)},64208:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MAX_NEIGHBOR_AGGREGATE_LENGTH=t.EXCLUDED_NEIGHBORS=t.LANGUAGE_COMMENT_MARKERS=void 0,t.LANGUAGE_COMMENT_MARKERS={abap:{start:'"',end:""},bat:{start:"REM",end:""},bibtex:{start:"%",end:""},blade:{start:"#",end:""},c:{start:"//",end:""},clojure:{start:";",end:""},coffeescript:{start:"//",end:""},cpp:{start:"//",end:""},csharp:{start:"//",end:""},css:{start:"/*",end:"*/"},dart:{start:"//",end:""},dockerfile:{start:"#",end:""},elixir:{start:"#",end:""},erb:{start:"<%#",end:"%>"},erlang:{start:"%",end:""},fsharp:{start:"//",end:""},go:{start:"//",end:""},groovy:{start:"//",end:""},haml:{start:"-#",end:""},handlebars:{start:"{{!",end:"}}"},haskell:{start:"--",end:""},html:{start:"<!--",end:"-->"},ini:{start:";",end:""},java:{start:"//",end:""},javascript:{start:"//",end:""},javascriptreact:{start:"//",end:""},jsonc:{start:"//",end:""},jsx:{start:"//",end:""},julia:{start:"#",end:""},kotlin:{start:"//",end:""},latex:{start:"%",end:""},less:{start:"//",end:""},lua:{start:"--",end:""},makefile:{start:"#",end:""},markdown:{start:"[]: #",end:""},"objective-c":{start:"//",end:""},"objective-cpp":{start:"//",end:""},perl:{start:"#",end:""},php:{start:"//",end:""},powershell:{start:"#",end:""},pug:{start:"//",end:""},python:{start:"#",end:""},ql:{start:"//",end:""},r:{start:"#",end:""},razor:{start:"<!--",end:"-->"},ruby:{start:"#",end:""},rust:{start:"//",end:""},sass:{start:"//",end:""},scala:{start:"//",end:""},scss:{start:"//",end:""},shellscript:{start:"#",end:""},slim:{start:"/",end:""},solidity:{start:"//",end:""},sql:{start:"--",end:""},stylus:{start:"//",end:""},svelte:{start:"<!--",end:"-->"},swift:{start:"//",end:""},terraform:{start:"#",end:""},tex:{start:"%",end:""},typescript:{start:"//",end:""},typescriptreact:{start:"//",end:""},vb:{start:"'",end:""},verilog:{start:"//",end:""},"vue-html":{start:"<!--",end:"-->"},vue:{start:"//",end:""},xml:{start:"<!--",end:"-->"},xsl:{start:"<!--",end:"-->"},yaml:{start:"#",end:""},diff:{start:"#",end:""}},t.EXCLUDED_NEIGHBORS=["node_modules","dist","site-packages"],t.MAX_NEIGHBOR_AGGREGATE_LENGTH=2e5},68728:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getImportedFile=t.extractLocalImportContext=t.getImportedFilesInterface=void 0;const n=e(43718),r=e(14951),o=e(55121),c=e(51500),p=e(85679),v=e(69056),m=async(f,a,h,u)=>{var d;const E=u.get(p.LanguageParserService);let g=[];const l=[],y=E.createParser(a.languageId);y&&(g=await y.extractImportPaths(f));const b=(d=h.maxTime)!==null&&d!==void 0?d:200,S=Date.now();for(const A of g){let w="";const T=a.uri.parent.codeUri.fsPath;if(!(A.startsWith("@/")||A.startsWith("~")||!A.startsWith("."))){A==="."?w=new o.Path(T).join("index.ts").toString():w=new o.Path(T).join(`${A}${v.LANGUAGE_TO_SUFFIX[a.languageId]}`).toString();try{const D=u.get(r.IFileServiceClient),I=u.get(c.IWorkspaceService),O=n.URI.file(w),M=await D.readFile(O.codeUri.fsPath),R=await y?.extractInterfaceOrTypeCode(M.content.toString());if(R&&R.length>0){const P=await I.asRelativePath(O);P?.path&&l.push([P.path,R])}}catch{}if(Date.now()-S>b)break}}return l};t.getImportedFilesInterface=m;const _=async(f,a,h)=>{const{source:u}=f;return f.languageId==="typescript"?(0,t.getImportedFilesInterface)(u,f,a,h):[]};t.extractLocalImportContext=_;const s=async(f,a,h)=>{if(f.language&&!a.language.includes(f.language))return[];const u=f.prefix;return(0,t.extractLocalImportContext)({source:u,uri:f.uri,languageId:f.language,offset:u.length},a,h)};t.getImportedFile=s},277:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FixedWindowSizeJaccardMatcher=t.getCursorContext=void 0;const n=e(71585),r=e(79253),o=e(64806),c=(m,_={})=>{const s={tokenizerName:n.TokenizerName.cl100k_base,..._},f=(0,o.getTokenizer)(s.tokenizerName);if(s.maxLineCount&&s.maxLineCount<0)throw new Error("maxLineCount must be non-negative if defined");if(s.maxTokenLength&&s.maxTokenLength<0)throw new Error("maxTokenLength must be non-negative if defined");if(s.maxLineCount===0||s.maxTokenLength===0)return{context:"",lineCount:0,tokenLength:0,tokenizerName:s.tokenizerName};let a=m.source.slice(0,m.offset);return s.maxLineCount&&(a=a.split(`
@@ -30257,7 +30267,7 @@ The user's OS is ${(0,p.getOperatingSystemName)()}. The absolute path of the use
30257
30267
  `);let g=0;E.forEach((l,y)=>{const{parts:b,currentStyle:S}=(0,_.ansiParser)(l,this.lastStyle);this.lastStyle=S,this.matchOutput(a,b,g||y);const A=b.map(T=>T.content).join(""),w=Math.ceil(A.length/d);g+=Math.max(1,w)})}}getMatcherRules(){const a=this.inlineChatFeatureRegistry.getTerminalActions(),h=[];return a.forEach(u=>{const d=this.inlineChatFeatureRegistry.getTerminalHandler(u.id);Array.isArray(d?.triggerRules)&&d.triggerRules.forEach(E=>{E instanceof m.BaseTerminalDetectionLineMatcher?h.push({matcher:E,action:u}):typeof E=="function"&&Object.getPrototypeOf(E)===m.BaseTerminalDetectionLineMatcher&&h.push({matcher:new E,action:u})})}),h}matchOutput(a,h,u){var d,E;if(this.currentActions)this.currentActions.matcher.match(h)?(d=this.outputRecordMap.get(a))===null||d===void 0||d.push({type:this.currentActions.matcher.type,text:h.map(g=>g.content).join("")}):this.matchedEnd(a,this.currentActions);else{const l=this.getMatcherRules().find(y=>y.matcher.match(h));l&&(this.registerMarker(a,u),(E=this.outputRecordMap.get(a))===null||E===void 0||E.push({type:l.matcher.type,text:h.map(y=>y.content).join("")}),l.matcher.isMultiLine?this.currentActions={action:l.action,matcher:l.matcher}:this.matchedEnd(a,l))}}matchedEnd(a,h){var u,d;const E=this.resolveDelControl((u=this.inputRecordMap.get(a))===null||u===void 0?void 0:u.map(l=>l.text).join(`
30258
30268
  `)),g=(d=this.outputRecordMap.get(a))===null||d===void 0?void 0:d.map(l=>l.text).join(`
30259
30269
  `);this.addDecoration(a,h,E,g),this.report(h.matcher.type,E,g),this.resetState(a)}addDecoration(a,h,u,d){const E=this.terminalController.clients.get(a),g=E?.term,l=this.clientCurrentMarker.get(a);if(g&&d&&l){const y=d?.split(`
30260
- `).length;this.terminalDecorations.addZoneDecoration(g,l,y,{operationList:[h.action],onClickItem:()=>{const b=this.inlineChatFeatureRegistry.getTerminalHandler(h.action.id);b&&b.execute(d,u||"",h.matcher)}})}}resolveDelControl(a=""){const h=a.split("");let u=0;for(;u<h.length;)if(h[u].charCodeAt(0)===127){const d=Math.max(u-1,0);h.splice(d,1),u=d}else u++;return h.join("")}report(a,h,u){}registerMarker(a,h){const u=this.terminalController.clients.get(a);if(u){const d=u.term.registerMarker(h);this.clientCurrentMarker.set(a,d),this.disposables.push(d)}}handleClientInput(a,h){const u=h.toString(),d=this.inputRecordMap.get(a);/[\r\n]/.test(u)?(this.isTyping=!1,d?.push({text:this.inputCache})):(this.inputCache+=u,this.isTyping=!0)}};t.AITerminalService=s,n.__decorate([(0,r.Autowired)(c.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(v.AITerminalDecorationService),n.__metadata("design:type",v.AITerminalDecorationService)],s.prototype,"terminalDecorations",void 0),n.__decorate([(0,r.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",p.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalService=s=n.__decorate([(0,r.Injectable)()],s)},32113:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalPrompt=t.KeyboardSelectableList=void 0;const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=n.__importDefault(e(58274)),_=f=>{const{items:a,handleSuggestionClick:h,noListen:u=!1,controller:d}=f,[E,g]=(0,o.useState)(-1),l=y=>{switch(y.key){case"ArrowUp":g(b=>Math.max(b-1,0));break;case"ArrowDown":g(b=>Math.min(b+1,a.length-1));break;case"Enter":a[E]&&h(a[E].command);break;default:break}};return(0,o.useEffect)(()=>{if(!u)return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[a,E]),(0,o.useEffect)(()=>{if(!d)return;const y=d.event(b=>{b==="ArrowUp"&&g(S=>Math.max(S-1,0)),(b==="ArrowDown"||b==="Tab")&&g(S=>Math.min(S+1,a.length-1)),b==="Enter"&&a[E]&&h(a[E].command)});return()=>{y.dispose()}},[d,E,a]),(0,o.useEffect)(()=>{g(0)},[a]),o.default.createElement("div",{className:m.default.suggestions},a.map((y,b)=>o.default.createElement("div",{key:b,className:m.default.suggestionItem,style:{backgroundColor:b===E?"var(--selection-background)":""},onClick:()=>h(y.command)},o.default.createElement("div",{className:m.default.suggestionItemContainer},o.default.createElement("div",{className:m.default.suggestionDesc},y.description),o.default.createElement("div",{className:m.default.suggestionCmd},y.command)))))};t.KeyboardSelectableList=_;const s=f=>{const{onEscTriggered:a,onSuggestionClick:h,getAICommandSuggestions:u,cancelAIRequst:d}=f,[E,g]=(0,o.useState)(""),[l,y]=(0,o.useState)([]),[b,S]=(0,o.useState)(!1),[A,w]=(0,o.useState)((0,c.localize)("terminal.ai.escClose")),T=(0,o.useRef)(null),D=(0,o.useCallback)(async P=>{S(!0),w((0,c.localize)("terminal.ai.requesting")),u(P,()=>{S(!1),w((0,c.localize)("terminal.ai.selectHint"))},()=>{S(!0),w((0,c.localize)("terminal.ai.thinking"))},k=>{y([...k].reverse())})},[l]),I=(0,o.useCallback)((0,r.default)(P=>{D(P)},1e3),[]);(0,o.useEffect)(()=>{const P=k=>{(k.key==="Escape"||k.keyCode===27)&&a()};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[]),(0,o.useEffect)(()=>{const P=k=>{T.current&&!T.current.contains(k.target)&&a()};return document.addEventListener("mousedown",P),()=>{document.removeEventListener("mousedown",P)}},[a]);const O=P=>{const k=P.target.value;g(k),k.length>0&&!k.includes("'")&&I(k),k.length===0&&(y([]),w((0,c.localize)("terminal.ai.escClose")),d&&d())},M=(0,o.useCallback)(()=>{D(E)},[E]),R=P=>{h(P)};return o.default.createElement("div",{className:m.default.container,ref:T},o.default.createElement("div",{className:m.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,c.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(v.EnhanceIcon,{className:(0,p.getIcon)("close1"),onClick:()=>{a()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},l.length>0&&o.default.createElement(t.KeyboardSelectableList,{items:l,handleSuggestionClick:R})),o.default.createElement("div",{className:m.default.inputContainer},o.default.createElement(p.Input,{type:"text",value:E,onKeyDown:P=>{(P.key==="ArrowUp"||P.key==="ArrowDown")&&P.preventDefault()},onChange:O,onPressEnter:()=>M(),placeholder:(0,c.localize)("terminal.ai.inputHint"),className:m.default.input,autoFocus:!0}),b?o.default.createElement("div",{className:m.default.ai_loading},o.default.createElement("div",{className:m.default.loader}),o.default.createElement("div",{className:m.default.loader}),o.default.createElement("div",{className:m.default.loader})):o.default.createElement(v.EnhanceIcon,{wrapperClassName:m.default.send_icon,className:(0,p.getIcon)("send-solid"),onClick:()=>{I(E)}})),o.default.createElement("div",{className:m.default.statusContainer},A))};t.AITerminalPrompt=s},39273:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalInlineWidgetForDetection=t.TerminalInlineWidgetForSelection=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(89195),c=n.__importDefault(e(57410)),p=({actions:m,onClickItem:_})=>r.default.createElement("div",{className:c.default.terminal_inline_chat},r.default.createElement(o.AIAction,{operationList:m,onClickItem:_}));t.TerminalInlineWidgetForSelection=p;const v=({actions:m,onClickItem:_})=>{const[s,f]=(0,r.useState)(!1);return r.default.createElement("div",{onMouseOver:a=>{f(!0),a.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:a=>{f(!1),a.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},r.default.createElement("div",{className:c.default.terminal_inline_chat,style:{display:s?"block":"none"}},r.default.createElement(o.AIAction,{operationList:m,onClickItem:_})))};t.TerminalInlineWidgetForDetection=v},96415:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalDecorationService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(25873),c=e(76003),p=e(43718),v=e(6487),m=e(2281),_=e(39273);let s=class extends p.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:a})=>this.doSelectionDecoration(a)))}addZoneDecoration(a,h,u,d){const E=a.registerDecoration({marker:h,width:a.cols,height:u});if(!E){console.error("Failed to create decoration for line",h);return}let g;E.onRender(l=>{g||(g=(0,o.createRoot)(l)),g.render(r.default.createElement(_.TerminalInlineWidgetForDetection,{actions:d.operationList,onClickItem:()=>{d.onClickItem()}}))}),E.onDispose(()=>{g&&g.unmount()})}doSelectionDecoration(a){const h=this.terminalController.clients.get(a),u=h?.term;u&&this.addDispose(u.onSelectionChange(()=>{const d=this.decorationList.pop();d&&(0,p.runWhenIdle)(()=>{d?.dispose()});const E=u.getSelectionPosition(),g=u.getSelection().trim();if(E&&g.length>0){const l=E.end.y,y=E.start.y,b=u.buffer.active.cursorY+u.buffer.active.baseY,S=y-b,A=l-y+1,w=u.registerMarker(S);if(w){const T=u.registerDecoration({marker:w,width:u.cols,height:A});if(T){let D;T.onRender(I=>{D||(D=(0,o.createRoot)(I));const M=this.inlineChatFeatureRegistry.getTerminalActions().filter(R=>{var P;return((P=this.inlineChatFeatureRegistry.getTerminalHandler(R.id))===null||P===void 0?void 0:P.triggerRules)==="selection"});D.render(r.default.createElement(_.TerminalInlineWidgetForSelection,{actions:M,onClickItem:R=>{const P=this.inlineChatFeatureRegistry.getTerminalHandler(R);P&&P.execute(g,"")}}))}),T.onDispose(()=>{D&&D.unmount()}),this.decorationList.push(T)}}}}))}};t.AITerminalDecorationService=s,n.__decorate([(0,c.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,c.Autowired)(p.InlineChatFeatureRegistryToken),n.__metadata("design:type",m.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalDecorationService=s=n.__decorate([(0,c.Injectable)()],s)},4397:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTerminalDetectionLineMatcher=t.MatcherType=void 0;var e;(function(r){r[r.base=0]="base",r[r.npm=1]="npm",r[r.typescript=2]="typescript",r[r.node=3]="node",r[r.shell=4]="shell",r[r.java=5]="java"})(e||(t.MatcherType=e={}));class n{constructor(){this.type=e.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}t.BaseTerminalDetectionLineMatcher=n},28358:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=t.ShellMatcher=t.NPMMatcher=t.TSCMatcher=t.NodeMatcher=void 0,e(85608).__exportStar(e(4397),t);var r=e(12636);Object.defineProperty(t,"NodeMatcher",{enumerable:!0,get:function(){return r.NodeMatcher}});var o=e(41084);Object.defineProperty(t,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var c=e(97323);Object.defineProperty(t,"NPMMatcher",{enumerable:!0,get:function(){return c.NPMMatcher}});var p=e(29640);Object.defineProperty(t,"ShellMatcher",{enumerable:!0,get:function(){return p.ShellMatcher}});var v=e(82036);Object.defineProperty(t,"JavaMatcher",{enumerable:!0,get:function(){return v.JavaMatcher}})},82036:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(c){return this.isErrorStack(c)||this.isCasuseByError(c)||this.isExceptionError(c)}isErrorStack(c){return this.isMatched&&!!c.find(p=>/^\s+at\s/i.test(p.content))}isCasuseByError(c){return!!c.find(p=>/caused\sby:/i.test(p.content))}isExceptionError(c){return!!c.find(p=>/\w+Exception:/i.test(p.content))}}t.JavaMatcher=r},12636:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(p){return this.isSingleLineError(p)||this.isMultiPartError(p)}isSingleLineError(p){return p.length===1&&(0,n.isRedColor)(p[0])&&(this.isMatched||!this.isExcludeContent(p[0].content))}isMultiPartError(p){return p.length>1&&!p.some(v=>!(0,n.isRedColor)(v))}isExcludeContent(p){return p.length<20||/mfsu/i.test(p)||/\s-\s/.test(p)}}t.NodeMatcher=o},97323:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NPMMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(p){return!!p.find(v=>/ERR/.test(v.content)&&(0,n.isRedColor)(v))}}t.NPMMatcher=o},29640:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(c){return!!c.find(p=>/command\snot\sfound/.test(p.content))}}t.ShellMatcher=r},41084:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TSCMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.typescript,this.isMultiLine=!0}doMatch(p){let v=!1,m=!1,_=!1;return p.forEach(s=>{/error/i.test(s.content)&&(0,n.isRedColor)(s)&&(v=!0),/TS\d+/.test(s.content)&&(m=!0),/Error:/i.test(s.content)&&(_=!0)}),v||m||_||this.isErrorStack(p)}isErrorStack(p){return this.isMatched&&!!p.find(v=>/^\s+at\s/i.test(v.content))}}t.TSCMatcher=o},14717:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PS1TerminalService=void 0;const n=e(85608),r=n.__importDefault(e(124)),o=n.__importDefault(e(14041)),c=e(25873),p=e(76003),v=e(41869),m=e(43718),_=e(6487),s=e(93062),f=e(32113),a=e(95121);var h;(function(d){d.PromptStarted="PS",d.PromptEnded="PE",d.CurrentWorkingDirectory="CWD"})(h||(h={}));let u=class extends m.Disposable{constructor(){super(...arguments),this.cancelToken=new m.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:E})=>this.listenTerminalEvent(E)))}listenTerminalEvent(E){const g=this.terminalController.clients.get(E);g&&setTimeout(()=>{this.listenPromptState(g.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(E){E.parser.registerOscHandler(6973,g=>{const l=g.indexOf(";");switch(l===-1?g:g.substring(0,l)){case h.PromptEnded:this.handlePromptEnd(E);break;default:return!1}return!1})}handlePromptEnd(E){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=E.registerMarker(0);const g=E.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const l=E.registerDecoration({marker:this.promptEndMarker,width:E.cols,height:1,x:g+2,layer:"top"});l?.onRender(y=>{y.innerText=(0,v.localize)("terminal.ai.inputSharpToGetHint"),y.style.opacity="0.3"}),this.onDataDisposable=E.onData(y=>{var b;const S=E.buffer.active,A=S.cursorX,w=S.cursorY;l?.dispose(),y==="#"&&w+S.baseY===((b=this.promptEndMarker)===null||b===void 0?void 0:b.line)&&(A===g||A===g+1)&&this.showAICommandPopup(E,g)})}showAICommandPopup(E,g){var l,y,b;if(!this.promptEndMarker)return;this.promptEndDecoration=E.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:g,layer:"top"});const S=E._addonManager._addons.find(w=>{var T;return!!(!((T=w?.instance)===null||T===void 0)&&T.connection)}),A=(l=S?.instance)===null||l===void 0?void 0:l.connection;if(!A){console.error((0,v.localize)("terminal.ai.cannotGetTerminalConnection"));return}(y=this.promptEndDecoration)===null||y===void 0||y.onRender(w=>{const T=w.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,c.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(f.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var D;A.sendData("\b"),(D=this.promptEndDecoration)===null||D===void 0||D.dispose()},0)},onSuggestionClick:D=>{setTimeout(()=>{var I;A.sendData("\b"),A.sendData(D),(I=this.promptEndDecoration)===null||I===void 0||I.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,r.default)(this.popupContainer,w,{points:["bl","bl"],offset:[-T-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(b=this.promptEndDecoration)===null||b===void 0||b.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),E.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new m.CancellationTokenSource}async getAICommandSuggestions(E,g,l,y){await this.stopAIStreamRequest();const b=this.aiReporter.start(m.AIServiceType.TerminalAICommand,{message:E}),S=await this.terminalFeatureRegistry.readableCommandSuggestions(E,this.cancelToken.token),A=[];(0,s.listenReadable)(S,{onData:w=>{A.push(w),y(A)},onEnd:()=>{g(),this.aiReporter.end(b,{message:E,success:!0,actionSource:m.ActionSourceEnum.Terminal})}})}};t.PS1TerminalService=u,n.__decorate([(0,p.Autowired)(_.ITerminalController),n.__metadata("design:type",Object)],u.prototype,"terminalController",void 0),n.__decorate([(0,p.Autowired)(m.TerminalRegistryToken),n.__metadata("design:type",a.TerminalFeatureRegistry)],u.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,p.Autowired)(m.IAIReporter),n.__metadata("design:type",Object)],u.prototype,"aiReporter",void 0),t.PS1TerminalService=u=n.__decorate([(0,p.Injectable)()],u)},28505:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalAIContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(63439),v=e(96415),m=e(14717),_=e(95121);let s=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};t.TerminalAIContribution=s,n.__decorate([(0,r.Autowired)(p.AITerminalService),n.__metadata("design:type",p.AITerminalService)],s.prototype,"aiTerminalService",void 0),n.__decorate([(0,r.Autowired)(v.AITerminalDecorationService),n.__metadata("design:type",v.AITerminalDecorationService)],s.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,r.Autowired)(m.PS1TerminalService),n.__metadata("design:type",m.PS1TerminalService)],s.prototype,"ps1TerminalService",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],s.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(c.TerminalRegistryToken),n.__metadata("design:type",_.TerminalFeatureRegistry)],s.prototype,"terminalFeatureRegistry",void 0),t.TerminalAIContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],s)},95121:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(93062),p=e(77633);let v=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(_){this.providerMap.add(_)}async readableCommandSuggestions(_,s){const f=Array.from(this.providerMap),a=[],h=[];for await(const d of f){const E=await d(_,s);if((0,c.isReadableStream)(E)){a.push(E);continue}h.push(...E)}const u=p.TerminalSuggestionReadableStream.create();return h.forEach(u.emitData.bind(u)),a.length===0?queueMicrotask(()=>{u.end()}):(0,c.listenGroupReadable)(a,{onData:u.emitData.bind(u),onEnd:u.end.bind(u)}),u}};t.TerminalFeatureRegistry=v,t.TerminalFeatureRegistry=v=n.__decorate([(0,r.Injectable)()],v)},60772:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorCode=t.StyleCode=void 0,t.ansiParser=m,t.isRedColor=_;const r=e(85608).__importDefault(e(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var c;(function(s){s[s.RESET=0]="RESET",s[s.BOLD=1]="BOLD",s[s.UNDERLINE=4]="UNDERLINE",s[s.RESET_BOLD=22]="RESET_BOLD",s[s.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(c||(t.StyleCode=c={}));var p;(function(s){s[s.MODE_RGB=2]="MODE_RGB",s[s.MODE_256=5]="MODE_256",s[s.BLACK=30]="BLACK",s[s.RED=31]="RED",s[s.GREEN=32]="GREEN",s[s.YELLOW=33]="YELLOW",s[s.BLUE=34]="BLUE",s[s.MAGENTA=35]="MAGENTA",s[s.CYAN=36]="CYAN",s[s.WHITE=37]="WHITE",s[s.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",s[s.RESET_COLOR=39]="RESET_COLOR",s[s.BLACK_BG=40]="BLACK_BG",s[s.RED_BG=41]="RED_BG",s[s.GREEN_BG=42]="GREEN_BG",s[s.YELLOW_BG=43]="YELLOW_BG",s[s.BLUE_BG=44]="BLUE_BG",s[s.MAGENTA_BG=45]="MAGENTA_BG",s[s.CYAN_BG=46]="CYAN_BG",s[s.WHITE_BG=47]="WHITE_BG",s[s.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",s[s.RESET_BG=49]="RESET_BG",s[s.BLACK_BRIGHT=90]="BLACK_BRIGHT",s[s.RED_BRIGHT=91]="RED_BRIGHT",s[s.GREEN_BRIGHT=92]="GREEN_BRIGHT",s[s.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",s[s.BLUE_BRIGHT=94]="BLUE_BRIGHT",s[s.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",s[s.CYAN_BRIGHT=96]="CYAN_BRIGHT",s[s.WHITE_BRIGHT=97]="WHITE_BRIGHT",s[s.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",s[s.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",s[s.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",s[s.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",s[s.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",s[s.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",s[s.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(p||(t.ColorCode=p={}));function v(s,f,a){f.isSpecialColor||f.isSpecialBg?a===p.SPECIAL_COLOR_MODE?f.color=s:f.bgColor=s:s>=30&&s<=37||s>=90&&s<=97?f.color=s:(s>=40&&s<=47||s>=100&&s<=107)&&(f.bgColor=s)}function m(s,f){const a=(0,r.default)(),h=[];let u,d=0;const E={...f||o};for(;u=a.exec(s);){const l=s.slice(d,u.index);l&&h.push({content:l,...E});const y=u[0].slice(2,-1).split(";").map(Number);if(y.length)for(let b=0;b<y.length;b++){const S=y[b],A=y[b-1];switch(S){case c.RESET:Object.assign(E,o);break;case c.BOLD:E.bold=!0;break;case c.UNDERLINE:E.underline=!0;break;case c.RESET_BOLD:E.bold=!1;break;case c.RESET_UNDERLINE:E.underline=!1;break;case p.RESET_COLOR:E.color=0;break;case p.RESET_BG:E.bgColor=0;break;case p.SPECIAL_COLOR_MODE:E.isSpecialColor=!0;break;case p.SPECIAL_BG_MODE:E.isSpecialBg=!0;break;case p.MODE_RGB:A===p.SPECIAL_COLOR_MODE?E.isRgbColor=!0:E.isRgbBg=!0;break;case p.MODE_256:A===p.SPECIAL_COLOR_MODE?E.is256Color=!0:E.is256Bg=!0;break;default:v(S,E,y[b-2])}}d=u.index+u[0].length}const g=s.slice(d);return g&&h.push({content:g,...E}),{parts:h,currentStyle:E}}function _(s){const{color:f,isSpecialColor:a,is256Color:h}=s;return a?h?f===1||f===9||f>=160&&f<=196:f===255:f===p.RED||f===p.RED_BRIGHT}},32004:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(19413),v=e(46044),m=e(64811),_=e(73307),s=e(32016),f=e(74055),a=e(84543),h=e(61282),u=e(51081),d=e(29770),E=e(11735),g=e(59347),l=e(70394),y=e(19957),b=e(63536),S=e(72713),A=e(57232),w=e(99301),T=e(74292),D=e(35363),I=e(44298),O=e(33588),M=e(2204),R=e(2994),P=e(28505),k=e(95121),F=e(85679),L=e(27397),N=e(5297),j=e(45331),W=e(79502),U=e(7228),X=e(90977),V=e(80173),$=e(30645),Y=e(82078),G=e(39855),H=e(82248),K=e(36977),Z=e(42232),Q=e(3841),oe=e(77633),ne=e(2281),he=e(31031),_e=e(15989);let q=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=[oe.AINativeCoreContribution,oe.MCPServerContribution],this.providers=[s.AINativeBrowserContribution,D.InterfaceNavigationContribution,P.TerminalAIContribution,I.MergeConflictContribution,S.AICodeActionContribution,Q.AINativePreferencesContribution,w.IntelligentCompletionsContribution,N.MCPConfigContribution,L.MCPConfigCommandContribution,H.ListDirTool,K.ReadFileTool,X.EditFileTool,U.CreateNewFileWithTextTool,Y.GetOpenEditorFileDiagnosticsTool,V.FileSearchTool,G.GrepSearchTool,$.GetDiagnosticsByPathTool,Z.RunTerminalCommandTool,y.LlmContextContribution,{token:v.LLMContextServiceToken,useClass:b.LLMContextServiceImpl},{token:oe.TokenMCPServerRegistry,useClass:W.MCPServerRegistry},{token:p.TokenMCPServerProxyService,useClass:j.MCPServerProxyService},{token:o.InlineChatFeatureRegistryToken,useClass:ne.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:E.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:l.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:O.ResolveConflictRegistry},{token:c.IntelligentCompletionsRegistryToken,useClass:T.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:he.InlineChatService},{token:p.IChatManagerService,useClass:h.ChatManagerService},{token:p.IChatAgentService,useClass:f.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:a.ChatAgentViewService},{token:p.IChatInternalService,useClass:g.ChatInternalService},{token:p.ChatProxyServiceToken,useClass:u.ChatProxyService},{token:o.ChatServiceToken,useClass:d.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:R.RenameCandidatesProviderRegistry},{token:c.ProblemFixRegistryToken,useClass:M.ProblemFixProviderRegistry},{token:c.TerminalRegistryToken,useClass:k.TerminalFeatureRegistry},{token:F.LanguageParserService,useClass:F.LanguageParserService},{token:p.IAIInlineCompletionsProvider,useClass:A.AIInlineCompletionsProvider},{token:_e.InlineDiffService,useClass:_e.InlineDiffService},{token:_.ChatAgentPromptProvider,useClass:_.DefaultChatAgentPromptProvider}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:p.ChatProxyServiceToken},{servicePath:m.MCPServerManagerPath,token:m.MCPServerManager},{clientToken:p.TokenMCPServerProxyService,servicePath:p.SumiMCPServerProxyServicePath}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};t.AINativeModule=q,n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],q.prototype,"aiNativeConfig",void 0),t.AINativeModule=q=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],q)},3073:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParser=t.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),c=e(70392),p=e(69820),v=e(53374),m=e(22486),_=e(67045);t.DEFAULT_MIN_BLOCK_COUNT=20;let s=class{constructor(a){this.language=a,this.parserLoaded=new c.Deferred,this.lruCache=new c.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const a=await this.wasmModuleManager.loadLanguage(this.language),h=await r.default.Language.load(new Uint8Array(a));this.parser.setLanguage(h),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(a,h){return a.startIndex<=h&&a.endIndex>=h&&this.languageFacts.isCodeBlock(this.language,a.type)?a:a.parent?this.findContainingCodeBlockWithPosition(a.parent,h):null}findFunctionCodeBlock(a,h){return a.startIndex<=h&&a.endIndex>=h&&this.languageFacts.isFunctionCodeBlock(this.language,a.type)?a:a.parent?this.findFunctionCodeBlock(a.parent,h):null}async parseAST(a){const h=`${a.id}@${a.getVersionId()}`,u=this.lruCache.get(h);if(u)return u;await this.parserLoaded.promise;const d=a.getValue(),E=this.parser.parse(d);if(E){const g=E.rootNode;return this.lruCache.set(h,g),g}}async getSyntaxNodeAsPosition(a,h){const u=await this.parseAST(a);return u?u.namedDescendantForIndex(h):null}async findCodeBlockWithoutSyntaxError(a,h){await this.parserLoaded.promise;const u=this.parser.parse(a);if(u){const d=u.rootNode,E={row:h.startLineNumber-1,column:h.startColumn},g=d.namedDescendantForPosition(E);let l=g.parent;if(!l)return{range:(0,v.toMonacoRange)(g),type:g.type,infoCategory:"other"};for(;l&&!l.hasError;)l=l.parent;return l?{range:(0,v.toMonacoRange)(l),type:l.type,infoCategory:"other"}:{range:h,type:g.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(a,h){const u=a.getOffsetAt(h),d=await this.getSyntaxNodeAsPosition(a,u);if(!d)return null;const E=this.findFunctionCodeBlock(d,u);if(E)return this.languageFacts.provideFunctionInfo(this.language,E);const g=this.findContainingCodeBlockWithPosition(d,u);return g?{infoCategory:"other",range:{startLineNumber:g.startPosition.row+1,startColumn:0,endLineNumber:g.endPosition.row+1,endColumn:1/0},type:g.type}:null}async provideCodeBlockInfoInRange(a,h){const u=await this.parseAST(a);if(u){const d={row:h.startLineNumber-1,column:h.startColumn-1},E={row:h.endLineNumber,column:h.endColumn},g=this.languageFacts.getCodeBlockTypes(this.language);if(!g||g.size===0)return null;const l=u.descendantsOfType(Array.from(g),d,E);if(l&&l.length>0){const y=l[0];return{infoCategory:"other",range:(0,v.toMonacoRange)(y),type:y.type}}}return null}async trimSuffixSyntaxErrors(a,h=t.DEFAULT_MIN_BLOCK_COUNT){var u;await this.parserLoaded.promise;const d=(u=this.parser)===null||u===void 0?void 0:u.parse(a),E=d?.rootNode;if(!E)return a;const{namedChildren:g}=E;if(!E.hasError||g.length<=h)return this.trimToLastCompleteBlock(E,!0);let l=null,y=null;for(let T=g.length-1;T>=h;T--){const D=g[T];if(D.hasError&&T!==0)l=D;else if(l){y=D;break}}y||(y=g[h-1]);const S=a.split(`
30270
+ `).length;this.terminalDecorations.addZoneDecoration(g,l,y,{operationList:[h.action],onClickItem:()=>{const b=this.inlineChatFeatureRegistry.getTerminalHandler(h.action.id);b&&b.execute(d,u||"",h.matcher)}})}}resolveDelControl(a=""){const h=a.split("");let u=0;for(;u<h.length;)if(h[u].charCodeAt(0)===127){const d=Math.max(u-1,0);h.splice(d,1),u=d}else u++;return h.join("")}report(a,h,u){}registerMarker(a,h){const u=this.terminalController.clients.get(a);if(u){const d=u.term.registerMarker(h);this.clientCurrentMarker.set(a,d),this.disposables.push(d)}}handleClientInput(a,h){const u=h.toString(),d=this.inputRecordMap.get(a);/[\r\n]/.test(u)?(this.isTyping=!1,d?.push({text:this.inputCache})):(this.inputCache+=u,this.isTyping=!0)}};t.AITerminalService=s,n.__decorate([(0,r.Autowired)(c.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,r.Autowired)(v.AITerminalDecorationService),n.__metadata("design:type",v.AITerminalDecorationService)],s.prototype,"terminalDecorations",void 0),n.__decorate([(0,r.Autowired)(o.InlineChatFeatureRegistryToken),n.__metadata("design:type",p.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalService=s=n.__decorate([(0,r.Injectable)()],s)},32113:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalPrompt=t.KeyboardSelectableList=void 0;const n=e(85608),r=n.__importDefault(e(12784)),o=n.__importStar(e(14041)),c=e(41869),p=e(81878),v=e(89195),m=n.__importDefault(e(58274)),_=f=>{const{items:a,handleSuggestionClick:h,noListen:u=!1,controller:d}=f,[E,g]=(0,o.useState)(-1),l=y=>{switch(y.key){case"ArrowUp":g(b=>Math.max(b-1,0));break;case"ArrowDown":g(b=>Math.min(b+1,a.length-1));break;case"Enter":a[E]&&h(a[E].command);break;default:break}};return(0,o.useEffect)(()=>{if(!u)return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[a,E]),(0,o.useEffect)(()=>{if(!d)return;const y=d.event(b=>{b==="ArrowUp"&&g(S=>Math.max(S-1,0)),(b==="ArrowDown"||b==="Tab")&&g(S=>Math.min(S+1,a.length-1)),b==="Enter"&&a[E]&&h(a[E].command)});return()=>{y.dispose()}},[d,E,a]),(0,o.useEffect)(()=>{g(0)},[a]),o.default.createElement("div",{className:m.default.suggestions},a.map((y,b)=>o.default.createElement("div",{key:b,className:m.default.suggestionItem,style:{backgroundColor:b===E?"var(--selection-background)":""},onClick:()=>h(y.command)},o.default.createElement("div",{className:m.default.suggestionItemContainer},o.default.createElement("div",{className:m.default.suggestionDesc},y.description),o.default.createElement("div",{className:m.default.suggestionCmd},y.command)))))};t.KeyboardSelectableList=_;const s=f=>{const{onEscTriggered:a,onSuggestionClick:h,getAICommandSuggestions:u,cancelAIRequst:d}=f,[E,g]=(0,o.useState)(""),[l,y]=(0,o.useState)([]),[b,S]=(0,o.useState)(!1),[A,w]=(0,o.useState)((0,c.localize)("terminal.ai.escClose")),T=(0,o.useRef)(null),D=(0,o.useCallback)(async P=>{S(!0),w((0,c.localize)("terminal.ai.requesting")),u(P,()=>{S(!1),w((0,c.localize)("terminal.ai.selectHint"))},()=>{S(!0),w((0,c.localize)("terminal.ai.thinking"))},k=>{y([...k].reverse())})},[l]),I=(0,o.useCallback)((0,r.default)(P=>{D(P)},1e3),[]);(0,o.useEffect)(()=>{const P=k=>{(k.key==="Escape"||k.keyCode===27)&&a()};return document.addEventListener("keydown",P),()=>{document.removeEventListener("keydown",P)}},[]),(0,o.useEffect)(()=>{const P=k=>{T.current&&!T.current.contains(k.target)&&a()};return document.addEventListener("mousedown",P),()=>{document.removeEventListener("mousedown",P)}},[a]);const O=P=>{const k=P.target.value;g(k),k.length>0&&!k.includes("'")&&I(k),k.length===0&&(y([]),w((0,c.localize)("terminal.ai.escClose")),d&&d())},M=(0,o.useCallback)(()=>{D(E)},[E]),R=P=>{h(P)};return o.default.createElement("div",{className:m.default.container,ref:T},o.default.createElement("div",{className:m.default.header},o.default.createElement("div",{style:{flex:"1"}},(0,c.localize)("terminal.ai.headerHint")),o.default.createElement("div",null,o.default.createElement(v.EnhanceIcon,{className:(0,p.getIcon)("close1"),onClick:()=>{a()}}))),o.default.createElement("div",{style:{position:"relative",marginLeft:"-14px"}},l.length>0&&o.default.createElement(t.KeyboardSelectableList,{items:l,handleSuggestionClick:R})),o.default.createElement("div",{className:m.default.inputContainer},o.default.createElement(p.Input,{type:"text",value:E,onKeyDown:P=>{(P.key==="ArrowUp"||P.key==="ArrowDown")&&P.preventDefault()},onChange:O,onPressEnter:()=>M(),placeholder:(0,c.localize)("terminal.ai.inputHint"),className:m.default.input,autoFocus:!0}),b?o.default.createElement("div",{className:m.default.ai_loading},o.default.createElement("div",{className:m.default.loader}),o.default.createElement("div",{className:m.default.loader}),o.default.createElement("div",{className:m.default.loader})):o.default.createElement(v.EnhanceIcon,{wrapperClassName:m.default.send_icon,className:(0,p.getIcon)("send-solid"),onClick:()=>{I(E)}})),o.default.createElement("div",{className:m.default.statusContainer},A))};t.AITerminalPrompt=s},39273:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalInlineWidgetForDetection=t.TerminalInlineWidgetForSelection=void 0;const n=e(85608),r=n.__importStar(e(14041)),o=e(89195),c=n.__importDefault(e(57410)),p=({actions:m,onClickItem:_})=>r.default.createElement("div",{className:c.default.terminal_inline_chat},r.default.createElement(o.AIAction,{operationList:m,onClickItem:_}));t.TerminalInlineWidgetForSelection=p;const v=({actions:m,onClickItem:_})=>{const[s,f]=(0,r.useState)(!1);return r.default.createElement("div",{onMouseOver:a=>{f(!0),a.currentTarget.style.backgroundColor="rgba(255, 0, 0, 0.1)"},onMouseOut:a=>{f(!1),a.currentTarget.style.backgroundColor=""},style:{width:"100%",height:"100%"}},r.default.createElement("div",{className:c.default.terminal_inline_chat,style:{display:s?"block":"none"}},r.default.createElement(o.AIAction,{operationList:m,onClickItem:_})))};t.TerminalInlineWidgetForDetection=v},96415:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AITerminalDecorationService=void 0;const n=e(85608),r=n.__importDefault(e(14041)),o=e(25873),c=e(76003),p=e(43718),v=e(6487),m=e(2281),_=e(39273);let s=class extends p.Disposable{constructor(){super(...arguments),this.decorationList=[],this.decorationRootMap=new Map}active(){this.disposables.push(this.terminalController.onDidOpenTerminal(({id:a})=>this.doSelectionDecoration(a)))}addZoneDecoration(a,h,u,d){const E=a.registerDecoration({marker:h,width:a.cols,height:u});if(!E){console.error("Failed to create decoration for line",h);return}let g;E.onRender(l=>{g||(g=(0,o.createRoot)(l)),g.render(r.default.createElement(_.TerminalInlineWidgetForDetection,{actions:d.operationList,onClickItem:()=>{d.onClickItem()}}))}),E.onDispose(()=>{g&&g.unmount()})}doSelectionDecoration(a){const h=this.terminalController.clients.get(a),u=h?.term;u&&this.addDispose(u.onSelectionChange(()=>{const d=this.decorationList.pop();d&&(0,p.runWhenIdle)(()=>{d?.dispose()});const E=u.getSelectionPosition(),g=u.getSelection().trim();if(E&&g.length>0){const l=E.end.y,y=E.start.y,b=u.buffer.active.cursorY+u.buffer.active.baseY,S=y-b,A=l-y+1,w=u.registerMarker(S);if(w){const T=u.registerDecoration({marker:w,width:u.cols,height:A});if(T){let D;T.onRender(I=>{D||(D=(0,o.createRoot)(I));const M=this.inlineChatFeatureRegistry.getTerminalActions().filter(R=>{var P;return((P=this.inlineChatFeatureRegistry.getTerminalHandler(R.id))===null||P===void 0?void 0:P.triggerRules)==="selection"});D.render(r.default.createElement(_.TerminalInlineWidgetForSelection,{actions:M,onClickItem:R=>{const P=this.inlineChatFeatureRegistry.getTerminalHandler(R);P&&P.execute(g,"")}}))}),T.onDispose(()=>{D&&D.unmount()}),this.decorationList.push(T)}}}}))}};t.AITerminalDecorationService=s,n.__decorate([(0,c.Autowired)(v.ITerminalController),n.__metadata("design:type",Object)],s.prototype,"terminalController",void 0),n.__decorate([(0,c.Autowired)(p.InlineChatFeatureRegistryToken),n.__metadata("design:type",m.InlineChatFeatureRegistry)],s.prototype,"inlineChatFeatureRegistry",void 0),t.AITerminalDecorationService=s=n.__decorate([(0,c.Injectable)()],s)},4397:(x,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseTerminalDetectionLineMatcher=t.MatcherType=void 0;var e;(function(r){r[r.base=0]="base",r[r.npm=1]="npm",r[r.typescript=2]="typescript",r[r.node=3]="node",r[r.shell=4]="shell",r[r.java=5]="java"})(e||(t.MatcherType=e={}));class n{constructor(){this.type=e.base,this.isMultiLine=!1,this.isMatched=!1,this.maxSpaceLine=0,this.currentSpaceLine=0}match(o){return this.doMatch(o)?(this.isMatched=!0,this.currentSpaceLine=0,!0):this.isMultiLine&&this.isMatched&&this.currentSpaceLine<this.maxSpaceLine?(this.currentSpaceLine++,!0):(this.isMatched=!1,!1)}}t.BaseTerminalDetectionLineMatcher=n},28358:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=t.ShellMatcher=t.NPMMatcher=t.TSCMatcher=t.NodeMatcher=void 0,e(85608).__exportStar(e(4397),t);var r=e(12636);Object.defineProperty(t,"NodeMatcher",{enumerable:!0,get:function(){return r.NodeMatcher}});var o=e(41084);Object.defineProperty(t,"TSCMatcher",{enumerable:!0,get:function(){return o.TSCMatcher}});var c=e(97323);Object.defineProperty(t,"NPMMatcher",{enumerable:!0,get:function(){return c.NPMMatcher}});var p=e(29640);Object.defineProperty(t,"ShellMatcher",{enumerable:!0,get:function(){return p.ShellMatcher}});var v=e(82036);Object.defineProperty(t,"JavaMatcher",{enumerable:!0,get:function(){return v.JavaMatcher}})},82036:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.JavaMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.java,this.isMultiLine=!0}doMatch(c){return this.isErrorStack(c)||this.isCasuseByError(c)||this.isExceptionError(c)}isErrorStack(c){return this.isMatched&&!!c.find(p=>/^\s+at\s/i.test(p.content))}isCasuseByError(c){return!!c.find(p=>/caused\sby:/i.test(p.content))}isExceptionError(c){return!!c.find(p=>/\w+Exception:/i.test(p.content))}}t.JavaMatcher=r},12636:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NodeMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.node,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(p){return this.isSingleLineError(p)||this.isMultiPartError(p)}isSingleLineError(p){return p.length===1&&(0,n.isRedColor)(p[0])&&(this.isMatched||!this.isExcludeContent(p[0].content))}isMultiPartError(p){return p.length>1&&!p.some(v=>!(0,n.isRedColor)(v))}isExcludeContent(p){return p.length<20||/mfsu/i.test(p)||/\s-\s/.test(p)}}t.NodeMatcher=o},97323:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NPMMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.npm,this.isMultiLine=!0,this.maxSpaceLine=1}doMatch(p){return!!p.find(v=>/ERR/.test(v.content)&&(0,n.isRedColor)(v))}}t.NPMMatcher=o},29640:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ShellMatcher=void 0;const n=e(4397);class r extends n.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=n.MatcherType.shell,this.isMultiLine=!1}doMatch(c){return!!c.find(p=>/command\snot\sfound/.test(p.content))}}t.ShellMatcher=r},41084:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TSCMatcher=void 0;const n=e(60772),r=e(4397);class o extends r.BaseTerminalDetectionLineMatcher{constructor(){super(...arguments),this.type=r.MatcherType.typescript,this.isMultiLine=!0}doMatch(p){let v=!1,m=!1,_=!1;return p.forEach(s=>{/error/i.test(s.content)&&(0,n.isRedColor)(s)&&(v=!0),/TS\d+/.test(s.content)&&(m=!0),/Error:/i.test(s.content)&&(_=!0)}),v||m||_||this.isErrorStack(p)}isErrorStack(p){return this.isMatched&&!!p.find(v=>/^\s+at\s/i.test(v.content))}}t.TSCMatcher=o},14717:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PS1TerminalService=void 0;const n=e(85608),r=n.__importDefault(e(124)),o=n.__importDefault(e(14041)),c=e(25873),p=e(76003),v=e(41869),m=e(43718),_=e(6487),s=e(93062),f=e(32113),a=e(95121);var h;(function(d){d.PromptStarted="PS",d.PromptEnded="PE",d.CurrentWorkingDirectory="CWD"})(h||(h={}));let u=class extends m.Disposable{constructor(){super(...arguments),this.cancelToken=new m.CancellationTokenSource}active(){this.initContainer(),this.disposables.push(this.terminalController.onDidOpenTerminal(({id:E})=>this.listenTerminalEvent(E)))}listenTerminalEvent(E){const g=this.terminalController.clients.get(E);g&&setTimeout(()=>{this.listenPromptState(g.term)},0)}initContainer(){this.popupContainer=document.createElement("div"),document.body.appendChild(this.popupContainer)}listenPromptState(E){E.parser.registerOscHandler(6973,g=>{const l=g.indexOf(";");switch(l===-1?g:g.substring(0,l)){case h.PromptEnded:this.handlePromptEnd(E);break;default:return!1}return!1})}handlePromptEnd(E){this.promptEndMarker&&this.promptEndMarker.dispose(),this.promptEndDecoration&&this.promptEndDecoration.dispose(),this.promptEndMarker=E.registerMarker(0);const g=E.buffer.active.cursorX;this.onDataDisposable&&this.onDataDisposable.dispose();const l=E.registerDecoration({marker:this.promptEndMarker,width:E.cols,height:1,x:g+2,layer:"top"});l?.onRender(y=>{y.innerText=(0,v.localize)("terminal.ai.inputSharpToGetHint"),y.style.opacity="0.3"}),this.onDataDisposable=E.onData(y=>{var b;const S=E.buffer.active,A=S.cursorX,w=S.cursorY;l?.dispose(),y==="#"&&w+S.baseY===((b=this.promptEndMarker)===null||b===void 0?void 0:b.line)&&(A===g||A===g+1)&&this.showAICommandPopup(E,g)})}showAICommandPopup(E,g){var l,y,b;if(!this.promptEndMarker)return;this.promptEndDecoration=E.registerDecoration({marker:this.promptEndMarker,width:1,height:1,backgroundColor:"#2472C8",x:g,layer:"top"});const S=E._addonManager._addons.find(w=>{var T;return!!(!((T=w?.instance)===null||T===void 0)&&T.connection)}),A=(l=S?.instance)===null||l===void 0?void 0:l.connection;if(!A){console.error((0,v.localize)("terminal.ai.cannotGetTerminalConnection"));return}(y=this.promptEndDecoration)===null||y===void 0||y.onRender(w=>{const T=w.clientWidth;this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),this.promptEndReactRoot=(0,c.createRoot)(this.popupContainer),this.promptEndReactRoot.render(o.default.createElement(f.AITerminalPrompt,{onEscTriggered:()=>{setTimeout(()=>{var D;A.sendData("\b"),(D=this.promptEndDecoration)===null||D===void 0||D.dispose()},0)},onSuggestionClick:D=>{setTimeout(()=>{var I;A.sendData("\b"),A.sendData(D),(I=this.promptEndDecoration)===null||I===void 0||I.dispose()},0)},getAICommandSuggestions:this.getAICommandSuggestions.bind(this),cancelAIRequst:this.stopAIStreamRequest.bind(this)})),(0,r.default)(this.popupContainer,w,{points:["bl","bl"],offset:[-T-6,0],targetOffset:[0,0],overflow:{adjustX:!1,adjustY:!1}})}),(b=this.promptEndDecoration)===null||b===void 0||b.onDispose(()=>{this.stopAIStreamRequest(),this.promptEndReactRoot&&this.promptEndReactRoot.unmount(),E.focus()})}async stopAIStreamRequest(){this.cancelToken.cancel(),this.cancelToken=new m.CancellationTokenSource}async getAICommandSuggestions(E,g,l,y){await this.stopAIStreamRequest();const b=this.aiReporter.start(m.AIServiceType.TerminalAICommand,{message:E}),S=await this.terminalFeatureRegistry.readableCommandSuggestions(E,this.cancelToken.token),A=[];(0,s.listenReadable)(S,{onData:w=>{A.push(w),y(A)},onEnd:()=>{g(),this.aiReporter.end(b,{message:E,success:!0,actionSource:m.ActionSourceEnum.Terminal})}})}};t.PS1TerminalService=u,n.__decorate([(0,p.Autowired)(_.ITerminalController),n.__metadata("design:type",Object)],u.prototype,"terminalController",void 0),n.__decorate([(0,p.Autowired)(m.TerminalRegistryToken),n.__metadata("design:type",a.TerminalFeatureRegistry)],u.prototype,"terminalFeatureRegistry",void 0),n.__decorate([(0,p.Autowired)(m.IAIReporter),n.__metadata("design:type",Object)],u.prototype,"aiReporter",void 0),t.PS1TerminalService=u=n.__decorate([(0,p.Injectable)()],u)},28505:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalAIContribution=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(63439),v=e(96415),m=e(14717),_=e(95121);let s=class{onDidStart(){this.aiNativeConfigService.capabilities.supportsTerminalDetection&&(this.aiTerminalService.active(),this.aiTerminalDecorationService.active()),this.aiNativeConfigService.capabilities.supportsTerminalCommandSuggest&&this.terminalFeatureRegistry.hasProvider()&&this.ps1TerminalService.active()}};t.TerminalAIContribution=s,n.__decorate([(0,r.Autowired)(p.AITerminalService),n.__metadata("design:type",p.AITerminalService)],s.prototype,"aiTerminalService",void 0),n.__decorate([(0,r.Autowired)(v.AITerminalDecorationService),n.__metadata("design:type",v.AITerminalDecorationService)],s.prototype,"aiTerminalDecorationService",void 0),n.__decorate([(0,r.Autowired)(m.PS1TerminalService),n.__metadata("design:type",m.PS1TerminalService)],s.prototype,"ps1TerminalService",void 0),n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],s.prototype,"aiNativeConfigService",void 0),n.__decorate([(0,r.Autowired)(c.TerminalRegistryToken),n.__metadata("design:type",_.TerminalFeatureRegistry)],s.prototype,"terminalFeatureRegistry",void 0),t.TerminalAIContribution=s=n.__decorate([(0,o.Domain)(o.ClientAppContribution)],s)},95121:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TerminalFeatureRegistry=void 0;const n=e(85608),r=e(76003),o=e(43718),c=e(93062),p=e(77633);let v=class extends o.Disposable{constructor(){super(...arguments),this.providerMap=new Set}hasProvider(){return this.providerMap.size>0}registerCommandSuggestionsProvider(_){this.providerMap.add(_)}async readableCommandSuggestions(_,s){const f=Array.from(this.providerMap),a=[],h=[];for await(const d of f){const E=await d(_,s);if((0,c.isReadableStream)(E)){a.push(E);continue}h.push(...E)}const u=p.TerminalSuggestionReadableStream.create();return h.forEach(u.emitData.bind(u)),a.length===0?queueMicrotask(()=>{u.end()}):(0,c.listenGroupReadable)(a,{onData:u.emitData.bind(u),onEnd:u.end.bind(u)}),u}};t.TerminalFeatureRegistry=v,t.TerminalFeatureRegistry=v=n.__decorate([(0,r.Injectable)()],v)},60772:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ColorCode=t.StyleCode=void 0,t.ansiParser=m,t.isRedColor=_;const r=e(85608).__importDefault(e(91371)),o={color:0,isSpecialColor:!1,isRgbColor:!1,is256Color:!1,bgColor:0,isSpecialBg:!1,isRgbBg:!1,is256Bg:!1,bold:!1,underline:!1};var c;(function(s){s[s.RESET=0]="RESET",s[s.BOLD=1]="BOLD",s[s.UNDERLINE=4]="UNDERLINE",s[s.RESET_BOLD=22]="RESET_BOLD",s[s.RESET_UNDERLINE=24]="RESET_UNDERLINE"})(c||(t.StyleCode=c={}));var p;(function(s){s[s.MODE_RGB=2]="MODE_RGB",s[s.MODE_256=5]="MODE_256",s[s.BLACK=30]="BLACK",s[s.RED=31]="RED",s[s.GREEN=32]="GREEN",s[s.YELLOW=33]="YELLOW",s[s.BLUE=34]="BLUE",s[s.MAGENTA=35]="MAGENTA",s[s.CYAN=36]="CYAN",s[s.WHITE=37]="WHITE",s[s.SPECIAL_COLOR_MODE=38]="SPECIAL_COLOR_MODE",s[s.RESET_COLOR=39]="RESET_COLOR",s[s.BLACK_BG=40]="BLACK_BG",s[s.RED_BG=41]="RED_BG",s[s.GREEN_BG=42]="GREEN_BG",s[s.YELLOW_BG=43]="YELLOW_BG",s[s.BLUE_BG=44]="BLUE_BG",s[s.MAGENTA_BG=45]="MAGENTA_BG",s[s.CYAN_BG=46]="CYAN_BG",s[s.WHITE_BG=47]="WHITE_BG",s[s.SPECIAL_BG_MODE=48]="SPECIAL_BG_MODE",s[s.RESET_BG=49]="RESET_BG",s[s.BLACK_BRIGHT=90]="BLACK_BRIGHT",s[s.RED_BRIGHT=91]="RED_BRIGHT",s[s.GREEN_BRIGHT=92]="GREEN_BRIGHT",s[s.YELLOW_BRIGHT=93]="YELLOW_BRIGHT",s[s.BLUE_BRIGHT=94]="BLUE_BRIGHT",s[s.MAGENTA_BRIGHT=95]="MAGENTA_BRIGHT",s[s.CYAN_BRIGHT=96]="CYAN_BRIGHT",s[s.WHITE_BRIGHT=97]="WHITE_BRIGHT",s[s.BLACK_HIGH_INTENSITY=100]="BLACK_HIGH_INTENSITY",s[s.RED_HIGH_INTENSITY=101]="RED_HIGH_INTENSITY",s[s.GREEN_HIGH_INTENSITY=102]="GREEN_HIGH_INTENSITY",s[s.BLUE_HIGH_INTENSITY=104]="BLUE_HIGH_INTENSITY",s[s.MAGENTA_HIGH_INTENSITY=105]="MAGENTA_HIGH_INTENSITY",s[s.CYAN_HIGH_INTENSITY=106]="CYAN_HIGH_INTENSITY",s[s.WHITE_HIGH_INTENSITY=107]="WHITE_HIGH_INTENSITY"})(p||(t.ColorCode=p={}));function v(s,f,a){f.isSpecialColor||f.isSpecialBg?a===p.SPECIAL_COLOR_MODE?f.color=s:f.bgColor=s:s>=30&&s<=37||s>=90&&s<=97?f.color=s:(s>=40&&s<=47||s>=100&&s<=107)&&(f.bgColor=s)}function m(s,f){const a=(0,r.default)(),h=[];let u,d=0;const E={...f||o};for(;u=a.exec(s);){const l=s.slice(d,u.index);l&&h.push({content:l,...E});const y=u[0].slice(2,-1).split(";").map(Number);if(y.length)for(let b=0;b<y.length;b++){const S=y[b],A=y[b-1];switch(S){case c.RESET:Object.assign(E,o);break;case c.BOLD:E.bold=!0;break;case c.UNDERLINE:E.underline=!0;break;case c.RESET_BOLD:E.bold=!1;break;case c.RESET_UNDERLINE:E.underline=!1;break;case p.RESET_COLOR:E.color=0;break;case p.RESET_BG:E.bgColor=0;break;case p.SPECIAL_COLOR_MODE:E.isSpecialColor=!0;break;case p.SPECIAL_BG_MODE:E.isSpecialBg=!0;break;case p.MODE_RGB:A===p.SPECIAL_COLOR_MODE?E.isRgbColor=!0:E.isRgbBg=!0;break;case p.MODE_256:A===p.SPECIAL_COLOR_MODE?E.is256Color=!0:E.is256Bg=!0;break;default:v(S,E,y[b-2])}}d=u.index+u[0].length}const g=s.slice(d);return g&&h.push({content:g,...E}),{parts:h,currentStyle:E}}function _(s){const{color:f,isSpecialColor:a,is256Color:h}=s;return a?h?f===1||f===9||f>=160&&f<=196:f===255:f===p.RED||f===p.RED_BRIGHT}},32004:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AINativeModule=void 0;const n=e(85608),r=e(76003),o=e(41869),c=e(43718),p=e(19413),v=e(46044),m=e(64811),_=e(73307),s=e(32016),f=e(96366),a=e(74055),h=e(84543),u=e(61282),d=e(51081),E=e(29770),g=e(11735),l=e(59347),y=e(70394),b=e(19957),S=e(63536),A=e(72713),w=e(57232),T=e(99301),D=e(74292),I=e(35363),O=e(44298),M=e(33588),R=e(2204),P=e(2994),k=e(28505),F=e(95121),L=e(85679),N=e(73974),j=e(27397),W=e(5297),U=e(45331),X=e(79502),V=e(7228),$=e(90977),Y=e(80173),G=e(30645),H=e(82078),K=e(39855),Z=e(82248),Q=e(36977),oe=e(42232),ne=e(3841),he=e(77633),_e=e(2281),q=e(31031),Re=e(15989);let ve=class extends o.BrowserModule{constructor(){super(),this.contributionProvider=[he.AINativeCoreContribution,he.MCPServerContribution],this.providers=[s.AINativeBrowserContribution,I.InterfaceNavigationContribution,k.TerminalAIContribution,O.MergeConflictContribution,A.AICodeActionContribution,ne.AINativePreferencesContribution,T.IntelligentCompletionsContribution,W.MCPConfigContribution,j.MCPConfigCommandContribution,Z.ListDirTool,Q.ReadFileTool,$.EditFileTool,V.CreateNewFileWithTextTool,H.GetOpenEditorFileDiagnosticsTool,Y.FileSearchTool,K.GrepSearchTool,G.GetDiagnosticsByPathTool,oe.RunTerminalCommandTool,b.LlmContextContribution,{token:v.LLMContextServiceToken,useClass:S.LLMContextServiceImpl},{token:he.TokenMCPServerRegistry,useClass:X.MCPServerRegistry},{token:p.TokenMCPServerProxyService,useClass:U.MCPServerProxyService},{token:o.InlineChatFeatureRegistryToken,useClass:_e.InlineChatFeatureRegistry},{token:o.ChatFeatureRegistryToken,useClass:g.ChatFeatureRegistry},{token:o.ChatRenderRegistryToken,useClass:y.ChatRenderRegistry},{token:o.ResolveConflictRegistryToken,useClass:M.ResolveConflictRegistry},{token:c.IntelligentCompletionsRegistryToken,useClass:D.IntelligentCompletionsRegistry},{token:o.IAIInlineChatService,useClass:q.InlineChatService},{token:p.IChatManagerService,useClass:u.ChatManagerService},{token:p.IChatAgentService,useClass:a.ChatAgentService},{token:o.ChatAgentViewServiceToken,useClass:h.ChatAgentViewService},{token:p.IChatInternalService,useClass:l.ChatInternalService},{token:p.ChatProxyServiceToken,useClass:d.ChatProxyService},{token:o.ChatServiceToken,useClass:E.ChatService},{token:o.RenameCandidatesProviderRegistryToken,useClass:P.RenameCandidatesProviderRegistry},{token:c.ProblemFixRegistryToken,useClass:R.ProblemFixProviderRegistry},{token:c.TerminalRegistryToken,useClass:F.TerminalFeatureRegistry},{token:L.LanguageParserService,useClass:L.LanguageParserService},{token:p.IAIInlineCompletionsProvider,useClass:w.AIInlineCompletionsProvider},{token:Re.InlineDiffService,useClass:Re.InlineDiffService},{token:_.ChatAgentPromptProvider,useClass:_.DefaultChatAgentPromptProvider},{token:N.BaseApplyService,useClass:f.ApplyService}],this.backServices=[{servicePath:o.AIBackSerivcePath,token:o.AIBackSerivceToken,clientToken:p.ChatProxyServiceToken},{servicePath:m.MCPServerManagerPath,token:m.MCPServerManager},{clientToken:p.TokenMCPServerProxyService,servicePath:p.SumiMCPServerProxyServicePath}],this.aiNativeConfig.setAINativeModuleLoaded(!0)}};t.AINativeModule=ve,n.__decorate([(0,r.Autowired)(o.AINativeConfigService),n.__metadata("design:type",o.AINativeConfigService)],ve.prototype,"aiNativeConfig",void 0),t.AINativeModule=ve=n.__decorate([(0,r.Injectable)(),n.__metadata("design:paramtypes",[])],ve)},3073:(x,t,e)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageParser=t.DEFAULT_MIN_BLOCK_COUNT=void 0;const n=e(85608),r=n.__importDefault(e(13833)),o=e(76003),c=e(70392),p=e(69820),v=e(53374),m=e(22486),_=e(67045);t.DEFAULT_MIN_BLOCK_COUNT=20;let s=class{constructor(a){this.language=a,this.parserLoaded=new c.Deferred,this.lruCache=new c.LRUCache(500),this.initializeParser()}ready(){return this.parserLoaded.promise}getParser(){return this.parser}async initializeParser(){this.parser=await this.wasmModuleManager.initParser();const a=await this.wasmModuleManager.loadLanguage(this.language),h=await r.default.Language.load(new Uint8Array(a));this.parser.setLanguage(h),this.parserLoaded.resolve()}findContainingCodeBlockWithPosition(a,h){return a.startIndex<=h&&a.endIndex>=h&&this.languageFacts.isCodeBlock(this.language,a.type)?a:a.parent?this.findContainingCodeBlockWithPosition(a.parent,h):null}findFunctionCodeBlock(a,h){return a.startIndex<=h&&a.endIndex>=h&&this.languageFacts.isFunctionCodeBlock(this.language,a.type)?a:a.parent?this.findFunctionCodeBlock(a.parent,h):null}async parseAST(a){const h=`${a.id}@${a.getVersionId()}`,u=this.lruCache.get(h);if(u)return u;await this.parserLoaded.promise;const d=a.getValue(),E=this.parser.parse(d);if(E){const g=E.rootNode;return this.lruCache.set(h,g),g}}async getSyntaxNodeAsPosition(a,h){const u=await this.parseAST(a);return u?u.namedDescendantForIndex(h):null}async findCodeBlockWithoutSyntaxError(a,h){await this.parserLoaded.promise;const u=this.parser.parse(a);if(u){const d=u.rootNode,E={row:h.startLineNumber-1,column:h.startColumn},g=d.namedDescendantForPosition(E);let l=g.parent;if(!l)return{range:(0,v.toMonacoRange)(g),type:g.type,infoCategory:"other"};for(;l&&!l.hasError;)l=l.parent;return l?{range:(0,v.toMonacoRange)(l),type:l.type,infoCategory:"other"}:{range:h,type:g.type,infoCategory:"other"}}return null}async provideCodeBlockInfo(a,h){const u=a.getOffsetAt(h),d=await this.getSyntaxNodeAsPosition(a,u);if(!d)return null;const E=this.findFunctionCodeBlock(d,u);if(E)return this.languageFacts.provideFunctionInfo(this.language,E);const g=this.findContainingCodeBlockWithPosition(d,u);return g?{infoCategory:"other",range:{startLineNumber:g.startPosition.row+1,startColumn:0,endLineNumber:g.endPosition.row+1,endColumn:1/0},type:g.type}:null}async provideCodeBlockInfoInRange(a,h){const u=await this.parseAST(a);if(u){const d={row:h.startLineNumber-1,column:h.startColumn-1},E={row:h.endLineNumber,column:h.endColumn},g=this.languageFacts.getCodeBlockTypes(this.language);if(!g||g.size===0)return null;const l=u.descendantsOfType(Array.from(g),d,E);if(l&&l.length>0){const y=l[0];return{infoCategory:"other",range:(0,v.toMonacoRange)(y),type:y.type}}}return null}async trimSuffixSyntaxErrors(a,h=t.DEFAULT_MIN_BLOCK_COUNT){var u;await this.parserLoaded.promise;const d=(u=this.parser)===null||u===void 0?void 0:u.parse(a),E=d?.rootNode;if(!E)return a;const{namedChildren:g}=E;if(!E.hasError||g.length<=h)return this.trimToLastCompleteBlock(E,!0);let l=null,y=null;for(let T=g.length-1;T>=h;T--){const D=g[T];if(D.hasError&&T!==0)l=D;else if(l){y=D;break}}y||(y=g[h-1]);const S=a.split(`
30261
30271
  `).slice(0,y.endPosition.row+1),A=S[S.length-1].slice(0,y.endPosition.column);return`${S.length>1?`${S.slice(0,-1).join(`
30262
30272
  `)}
30263
30273
  `:""}${A}`}async trimPrefixSyntaxErrors(a,h=t.DEFAULT_MIN_BLOCK_COUNT){var u;await this.parserLoaded.promise;const d=(u=this.parser)===null||u===void 0?void 0:u.parse(a),E=d?.rootNode;if(!E)return a;const{namedChildren:g}=E;if(!E.hasError||g.length<=h)return this.trimToLastCompleteBlock(E);let l=null,y=null;for(let T=0;T<g.length-h;T++){const D=g[T];if(D.hasError&&T!==g.length-1)l=D;else if(l){y=D;break}}y||(y=g[g.length-h]);const S=a.split(`