499 lines
1.6 MiB
499 lines
1.6 MiB
"use strict";var ZY=Object.create;var _S=Object.defineProperty;var Mj=Object.getOwnPropertyDescriptor;var eX=Object.getOwnPropertyNames;var tX=Object.getPrototypeOf,rX=Object.prototype.hasOwnProperty;var nX=(r,e)=>()=>(r&&(e=r(r=0)),e);var N=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Oj=(r,e)=>{for(var t in e)_S(r,t,{get:e[t],enumerable:!0})},Kj=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of eX(e))!rX.call(r,i)&&i!==t&&_S(r,i,{get:()=>e[i],enumerable:!(n=Mj(e,i))||n.enumerable});return r};var P=(r,e,t)=>(t=r!=null?ZY(tX(r)):{},Kj(e||!r||!r.__esModule?_S(t,"default",{value:r,enumerable:!0}):t,r)),Fj=r=>Kj(_S({},"__esModule",{value:!0}),r),y=(r,e,t,n)=>{for(var i=n>1?void 0:n?Mj(e,t):e,o=r.length-1,s;o>=0;o--)(s=r[o])&&(i=(n?s(e,t,i):s(i))||i);return n&&i&&_S(e,t,i),i},m=(r,e)=>(t,n)=>e(t,n,r);var Uj=N(()=>{var Lj;(function(r){(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),n=i(r);typeof t.Reflect>"u"?t.Reflect=r:n=i(t.Reflect,n),e(n);function i(o,s){return function(a,l){typeof o[a]!="function"&&Object.defineProperty(o,a,{configurable:!0,writable:!0,value:l}),s&&s(a,l)}}})(function(e){var t=Object.prototype.hasOwnProperty,n=typeof Symbol=="function",i=n&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",o=n&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",s=typeof Object.create=="function",a={__proto__:[]}instanceof Array,l=!s&&!a,c={create:s?function(){return on(Object.create(null))}:a?function(){return on({__proto__:null})}:function(){return on({})},has:l?function(J,ee){return t.call(J,ee)}:function(J,ee){return ee in J},get:l?function(J,ee){return t.call(J,ee)?J[ee]:void 0}:function(J,ee){return J[ee]}},u=Object.getPrototypeOf(Function),p=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",f=!p&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Cr(),g=!p&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:qr(),v=!p&&typeof WeakMap=="function"?WeakMap:Dr(),b=new v;function C(J,ee,de,Ie){if(xt(de)){if(!_c(J))throw new TypeError;if(!j(ee))throw new TypeError;return be(J,ee)}else{if(!_c(J))throw new TypeError;if(!Ut(ee))throw new TypeError;if(!Ut(Ie)&&!xt(Ie)&&!Br(Ie))throw new TypeError;return Br(Ie)&&(Ie=void 0),de=ii(de),Me(J,ee,de,Ie)}}e("decorate",C);function E(J,ee){function de(Ie,Je){if(!Ut(Ie))throw new TypeError;if(!xt(Je)&&!he(Je))throw new TypeError;Q(J,ee,Ie,Je)}return de}e("metadata",E);function R(J,ee,de,Ie){if(!Ut(de))throw new TypeError;return xt(Ie)||(Ie=ii(Ie)),Q(J,ee,de,Ie)}e("defineMetadata",R);function _(J,ee,de){if(!Ut(ee))throw new TypeError;return xt(de)||(de=ii(de)),ut(J,ee,de)}e("hasMetadata",_);function L(J,ee,de){if(!Ut(ee))throw new TypeError;return xt(de)||(de=ii(de)),Xe(J,ee,de)}e("hasOwnMetadata",L);function te(J,ee,de){if(!Ut(ee))throw new TypeError;return xt(de)||(de=ii(de)),ne(J,ee,de)}e("getMetadata",te);function $(J,ee,de){if(!Ut(ee))throw new TypeError;return xt(de)||(de=ii(de)),Ce(J,ee,de)}e("getOwnMetadata",$);function se(J,ee){if(!Ut(J))throw new TypeError;return xt(ee)||(ee=ii(ee)),fe(J,ee)}e("getMetadataKeys",se);function ae(J,ee){if(!Ut(J))throw new TypeError;return xt(ee)||(ee=ii(ee)),Le(J,ee)}e("getOwnMetadataKeys",ae);function X(J,ee,de){if(!Ut(ee))throw new TypeError;xt(de)||(de=ii(de));var Ie=it(ee,de,!1);if(xt(Ie)||!Ie.delete(J))return!1;if(Ie.size>0)return!0;var Je=b.get(ee);return Je.delete(de),Je.size>0||b.delete(ee),!0}e("deleteMetadata",X);function be(J,ee){for(var de=J.length-1;de>=0;--de){var Ie=J[de],Je=Ie(ee);if(!xt(Je)&&!Br(Je)){if(!j(Je))throw new TypeError;ee=Je}}return ee}function Me(J,ee,de,Ie){for(var Je=J.length-1;Je>=0;--Je){var sn=J[Je],Ct=sn(ee,de,Ie);if(!xt(Ct)&&!Br(Ct)){if(!Ut(Ct))throw new TypeError;Ie=Ct}}return Ie}function it(J,ee,de){var Ie=b.get(J);if(xt(Ie)){if(!de)return;Ie=new f,b.set(J,Ie)}var Je=Ie.get(ee);if(xt(Je)){if(!de)return;Je=new f,Ie.set(ee,Je)}return Je}function ut(J,ee,de){var Ie=Xe(J,ee,de);if(Ie)return!0;var Je=Rt(ee);return Br(Je)?!1:ut(J,Je,de)}function Xe(J,ee,de){var Ie=it(ee,de,!1);return xt(Ie)?!1:Tt(Ie.has(J))}function ne(J,ee,de){var Ie=Xe(J,ee,de);if(Ie)return Ce(J,ee,de);var Je=Rt(ee);if(!Br(Je))return ne(J,Je,de)}function Ce(J,ee,de){var Ie=it(ee,de,!1);if(!xt(Ie))return Ie.get(J)}function Q(J,ee,de,Ie){var Je=it(de,Ie,!0);Je.set(J,ee)}function fe(J,ee){var de=Le(J,ee),Ie=Rt(J);if(Ie===null)return de;var Je=fe(Ie,ee);if(Je.length<=0)return de;if(de.length<=0)return Je;for(var sn=new g,Ct=[],Pt=0,et=de;Pt<et.length;Pt++){var Kt=et[Pt],re=sn.has(Kt);re||(sn.add(Kt),Ct.push(Kt))}for(var ue=0,W=Je;ue<W.length;ue++){var Kt=W[ue],re=sn.has(Kt);re||(sn.add(Kt),Ct.push(Kt))}return Ct}function Le(J,ee){var de=[],Ie=it(J,ee,!1);if(xt(Ie))return de;for(var Je=Ie.keys(),sn=Ze(Je),Ct=0;;){var Pt=qt(sn);if(!Pt)return de.length=Ct,de;var et=nn(Pt);try{de[Ct]=et}catch(Kt){try{Ft(sn)}finally{throw Kt}}Ct++}}function fn(J){if(J===null)return 1;switch(typeof J){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return J===null?1:6;default:return 6}}function xt(J){return J===void 0}function Br(J){return J===null}function gs(J){return typeof J=="symbol"}function Ut(J){return typeof J=="object"?J!==null:typeof J=="function"}function rn(J,ee){switch(fn(J)){case 0:return J;case 1:return J;case 2:return J;case 3:return J;case 4:return J;case 5:return J}var de=ee===3?"string":ee===5?"number":"default",Ie=Ae(J,i);if(Ie!==void 0){var Je=Ie.call(J,de);if(Ut(Je))throw new TypeError;return Je}return $i(J,de==="default"?"number":de)}function $i(J,ee){if(ee==="string"){var de=J.toString;if(F(de)){var Ie=de.call(J);if(!Ut(Ie))return Ie}var Je=J.valueOf;if(F(Je)){var Ie=Je.call(J);if(!Ut(Ie))return Ie}}else{var Je=J.valueOf;if(F(Je)){var Ie=Je.call(J);if(!Ut(Ie))return Ie}var sn=J.toString;if(F(sn)){var Ie=sn.call(J);if(!Ut(Ie))return Ie}}throw new TypeError}function Tt(J){return!!J}function ar(J){return""+J}function ii(J){var ee=rn(J,3);return gs(ee)?ee:ar(ee)}function _c(J){return Array.isArray?Array.isArray(J):J instanceof Object?J instanceof Array:Object.prototype.toString.call(J)==="[object Array]"}function F(J){return typeof J=="function"}function j(J){return typeof J=="function"}function he(J){switch(fn(J)){case 3:return!0;case 4:return!0;default:return!1}}function Ae(J,ee){var de=J[ee];if(de!=null){if(!F(de))throw new TypeError;return de}}function Ze(J){var ee=Ae(J,o);if(!F(ee))throw new TypeError;var de=ee.call(J);if(!Ut(de))throw new TypeError;return de}function nn(J){return J.value}function qt(J){var ee=J.next();return ee.done?!1:ee}function Ft(J){var ee=J.return;ee&&ee.call(J)}function Rt(J){var ee=Object.getPrototypeOf(J);if(typeof J!="function"||J===u||ee!==u)return ee;var de=J.prototype,Ie=de&&Object.getPrototypeOf(de);if(Ie==null||Ie===Object.prototype)return ee;var Je=Ie.constructor;return typeof Je!="function"||Je===J?ee:Je}function Cr(){var J={},ee=[],de=function(){function Ct(Pt,et,Kt){this._index=0,this._keys=Pt,this._values=et,this._selector=Kt}return Ct.prototype["@@iterator"]=function(){return this},Ct.prototype[o]=function(){return this},Ct.prototype.next=function(){var Pt=this._index;if(Pt>=0&&Pt<this._keys.length){var et=this._selector(this._keys[Pt],this._values[Pt]);return Pt+1>=this._keys.length?(this._index=-1,this._keys=ee,this._values=ee):this._index++,{value:et,done:!1}}return{value:void 0,done:!0}},Ct.prototype.throw=function(Pt){throw this._index>=0&&(this._index=-1,this._keys=ee,this._values=ee),Pt},Ct.prototype.return=function(Pt){return this._index>=0&&(this._index=-1,this._keys=ee,this._values=ee),{value:Pt,done:!0}},Ct}();return function(){function Ct(){this._keys=[],this._values=[],this._cacheKey=J,this._cacheIndex=-2}return Object.defineProperty(Ct.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),Ct.prototype.has=function(Pt){return this._find(Pt,!1)>=0},Ct.prototype.get=function(Pt){var et=this._find(Pt,!1);return et>=0?this._values[et]:void 0},Ct.prototype.set=function(Pt,et){var Kt=this._find(Pt,!0);return this._values[Kt]=et,this},Ct.prototype.delete=function(Pt){var et=this._find(Pt,!1);if(et>=0){for(var Kt=this._keys.length,re=et+1;re<Kt;re++)this._keys[re-1]=this._keys[re],this._values[re-1]=this._values[re];return this._keys.length--,this._values.length--,Pt===this._cacheKey&&(this._cacheKey=J,this._cacheIndex=-2),!0}return!1},Ct.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=J,this._cacheIndex=-2},Ct.prototype.keys=function(){return new de(this._keys,this._values,Ie)},Ct.prototype.values=function(){return new de(this._keys,this._values,Je)},Ct.prototype.entries=function(){return new de(this._keys,this._values,sn)},Ct.prototype["@@iterator"]=function(){return this.entries()},Ct.prototype[o]=function(){return this.entries()},Ct.prototype._find=function(Pt,et){return this._cacheKey!==Pt&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=Pt)),this._cacheIndex<0&&et&&(this._cacheIndex=this._keys.length,this._keys.push(Pt),this._values.push(void 0)),this._cacheIndex},Ct}();function Ie(Ct,Pt){return Ct}function Je(Ct,Pt){return Pt}function sn(Ct,Pt){return[Ct,Pt]}}function qr(){return function(){function J(){this._map=new f}return Object.defineProperty(J.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),J.prototype.has=function(ee){return this._map.has(ee)},J.prototype.add=function(ee){return this._map.set(ee,ee),this},J.prototype.delete=function(ee){return this._map.delete(ee)},J.prototype.clear=function(){this._map.clear()},J.prototype.keys=function(){return this._map.keys()},J.prototype.values=function(){return this._map.values()},J.prototype.entries=function(){return this._map.entries()},J.prototype["@@iterator"]=function(){return this.keys()},J.prototype[o]=function(){return this.keys()},J}()}function Dr(){var J=16,ee=c.create(),de=Ie();return function(){function et(){this._key=Ie()}return et.prototype.has=function(Kt){var re=Je(Kt,!1);return re!==void 0?c.has(re,this._key):!1},et.prototype.get=function(Kt){var re=Je(Kt,!1);return re!==void 0?c.get(re,this._key):void 0},et.prototype.set=function(Kt,re){var ue=Je(Kt,!0);return ue[this._key]=re,this},et.prototype.delete=function(Kt){var re=Je(Kt,!1);return re!==void 0?delete re[this._key]:!1},et.prototype.clear=function(){this._key=Ie()},et}();function Ie(){var et;do et="@@WeakMap@@"+Pt();while(c.has(ee,et));return ee[et]=!0,et}function Je(et,Kt){if(!t.call(et,de)){if(!Kt)return;Object.defineProperty(et,de,{value:c.create()})}return et[de]}function sn(et,Kt){for(var re=0;re<Kt;++re)et[re]=Math.random()*255|0;return et}function Ct(et){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(et)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(et)):sn(new Uint8Array(et),et):sn(new Array(et),et)}function Pt(){var et=Ct(J);et[6]=et[6]&79|64,et[8]=et[8]&191|128;for(var Kt="",re=0;re<J;++re){var ue=et[re];(re===4||re===6||re===8)&&(Kt+="-"),ue<16&&(Kt+="0"),Kt+=ue.toString(16).toLowerCase()}return Kt}}function on(J){return J.__=void 0,delete J.__,J}})})(Lj||(Lj={}))});var jj={};Oj(jj,{isPreRelesVersionOfJupyterExtension:()=>iX});var iX,Wj=nX(()=>{"use strict";iX=!1});var E2=N(tl=>{"use strict";Object.defineProperty(tl,"__esModule",{value:!0});tl.EventEmitter=tl.once=tl.toPromise=void 0;function NX(r,e){return e?e.aborted?Promise.resolve(void 0):new Promise(t=>{let n=(0,tl.once)(r,o=>{e.removeEventListener("abort",i),t(o)}),i=()=>{n.dispose(),e.removeEventListener("abort",i),t(void 0)};e.addEventListener("abort",i)}):new Promise(t=>(0,tl.once)(r,t))}tl.toPromise=NX;var MX=(r,e)=>{let t=r(n=>{e(n),t.dispose()});return t};tl.once=MX;var kA=class{constructor(){this.event=(e,t,n)=>{let i=this.add(t?e.bind(t):e);return n?.push(i),i}}get size(){return this.listeners?typeof this.listeners=="function"?1:this.listeners.length:0}fire(e){if(this.listeners)if(typeof this.listeners=="function")this.listeners(e);else for(let t of this.listeners)t(e)}dispose(){this.listeners=void 0}add(e){return this.listeners?typeof this.listeners=="function"?this.listeners=[this.listeners,e]:this.listeners.push(e):this.listeners=e,{dispose:()=>this.rm(e)}}rm(e){if(!this.listeners)return;if(typeof this.listeners=="function"){this.listeners===e&&(this.listeners=void 0);return}let t=this.listeners.indexOf(e);t!==-1&&(this.listeners.length===2?this.listeners=t===0?this.listeners[1]:this.listeners[0]:this.listeners=this.listeners.slice(0,t).concat(this.listeners.slice(t+1)))}};tl.EventEmitter=kA});var _n=N(Gt=>{"use strict";Object.defineProperty(Gt,"__esModule",{value:!0});Gt.NON_CUSTOM_TAG_KEYS=Gt.PRE_DESTROY=Gt.POST_CONSTRUCT=Gt.DESIGN_PARAM_TYPES=Gt.PARAM_TYPES=Gt.TAGGED_PROP=Gt.TAGGED=Gt.MULTI_INJECT_TAG=Gt.INJECT_TAG=Gt.OPTIONAL_TAG=Gt.UNMANAGED_TAG=Gt.NAME_TAG=Gt.NAMED_TAG=void 0;Gt.NAMED_TAG="named";Gt.NAME_TAG="name";Gt.UNMANAGED_TAG="unmanaged";Gt.OPTIONAL_TAG="optional";Gt.INJECT_TAG="inject";Gt.MULTI_INJECT_TAG="multi_inject";Gt.TAGGED="inversify:tagged";Gt.TAGGED_PROP="inversify:tagged_props";Gt.PARAM_TYPES="inversify:paramtypes";Gt.DESIGN_PARAM_TYPES="design:paramtypes";Gt.POST_CONSTRUCT="post_construct";Gt.PRE_DESTROY="pre_destroy";function OX(){return[Gt.INJECT_TAG,Gt.MULTI_INJECT_TAG,Gt.NAME_TAG,Gt.UNMANAGED_TAG,Gt.NAMED_TAG,Gt.OPTIONAL_TAG]}Gt.NON_CUSTOM_TAG_KEYS=OX()});var fa=N(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});np.TargetTypeEnum=np.BindingTypeEnum=np.BindingScopeEnum=void 0;var KX={Request:"Request",Singleton:"Singleton",Transient:"Transient"};np.BindingScopeEnum=KX;var FX={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};np.BindingTypeEnum=FX;var LX={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"};np.TargetTypeEnum=LX});var ip=N(dE=>{"use strict";Object.defineProperty(dE,"__esModule",{value:!0});dE.id=void 0;var UX=0;function jX(){return UX++}dE.id=jX});var M2=N(mE=>{"use strict";Object.defineProperty(mE,"__esModule",{value:!0});mE.Binding=void 0;var N2=fa(),WX=ip(),VX=function(){function r(e,t){this.id=(0,WX.id)(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=N2.BindingTypeEnum.Invalid,this.constraint=function(n){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.onDeactivation=null,this.dynamicValue=null}return r.prototype.clone=function(){var e=new r(this.serviceIdentifier,this.scope);return e.activated=e.scope===N2.BindingScopeEnum.Singleton?this.activated:!1,e.implementationType=this.implementationType,e.dynamicValue=this.dynamicValue,e.scope=this.scope,e.type=this.type,e.factory=this.factory,e.provider=this.provider,e.constraint=this.constraint,e.onActivation=this.onActivation,e.onDeactivation=this.onDeactivation,e.cache=this.cache,e},r}();mE.Binding=VX});var Di=N(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.STACK_OVERFLOW=Oe.CIRCULAR_DEPENDENCY_IN_FACTORY=Oe.ON_DEACTIVATION_ERROR=Oe.PRE_DESTROY_ERROR=Oe.POST_CONSTRUCT_ERROR=Oe.ASYNC_UNBIND_REQUIRED=Oe.MULTIPLE_POST_CONSTRUCT_METHODS=Oe.MULTIPLE_PRE_DESTROY_METHODS=Oe.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=Oe.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=Oe.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=Oe.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=Oe.ARGUMENTS_LENGTH_MISMATCH=Oe.INVALID_DECORATOR_OPERATION=Oe.INVALID_TO_SELF_VALUE=Oe.LAZY_IN_SYNC=Oe.INVALID_FUNCTION_BINDING=Oe.INVALID_MIDDLEWARE_RETURN=Oe.NO_MORE_SNAPSHOTS_AVAILABLE=Oe.INVALID_BINDING_TYPE=Oe.NOT_IMPLEMENTED=Oe.CIRCULAR_DEPENDENCY=Oe.UNDEFINED_INJECT_ANNOTATION=Oe.MISSING_INJECT_ANNOTATION=Oe.MISSING_INJECTABLE_ANNOTATION=Oe.NOT_REGISTERED=Oe.CANNOT_UNBIND=Oe.AMBIGUOUS_MATCH=Oe.KEY_NOT_FOUND=Oe.NULL_ARGUMENT=Oe.DUPLICATED_METADATA=Oe.DUPLICATED_INJECTABLE_DECORATOR=void 0;Oe.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.";Oe.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:";Oe.NULL_ARGUMENT="NULL argument";Oe.KEY_NOT_FOUND="Key Not Found";Oe.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:";Oe.CANNOT_UNBIND="Could not unbind serviceIdentifier:";Oe.NOT_REGISTERED="No matching bindings found for serviceIdentifier:";Oe.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:";Oe.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";var BX=function(r){return"@inject called with undefined this could mean that the class "+r+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."};Oe.UNDEFINED_INJECT_ANNOTATION=BX;Oe.CIRCULAR_DEPENDENCY="Circular dependency found:";Oe.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.";Oe.INVALID_BINDING_TYPE="Invalid binding type:";Oe.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.";Oe.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!";Oe.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!";var qX=function(r){return"You are attempting to construct '"+r+`' in a synchronous way
|
||
but it has asynchronous dependencies.`};Oe.LAZY_IN_SYNC=qX;Oe.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier";Oe.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";var JX=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return"The number of constructor arguments in the derived class "+(r[0]+" must be >= than the number of constructor arguments of its base class.")};Oe.ARGUMENTS_LENGTH_MISMATCH=JX;Oe.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.";Oe.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').";Oe.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean";Oe.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean";Oe.MULTIPLE_PRE_DESTROY_METHODS="Cannot apply @preDestroy decorator multiple times in the same class";Oe.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";Oe.ASYNC_UNBIND_REQUIRED="Attempting to unbind dependency with asynchronous destruction (@preDestroy or onDeactivation)";var $X=function(r,e){return"@postConstruct error in class "+r+": "+e};Oe.POST_CONSTRUCT_ERROR=$X;var HX=function(r,e){return"@preDestroy error in class "+r+": "+e};Oe.PRE_DESTROY_ERROR=HX;var GX=function(r,e){return"onDeactivation() error in class "+r+": "+e};Oe.ON_DEACTIVATION_ERROR=GX;var zX=function(r,e){return"It looks like there is a circular dependency in one of the '"+r+"' bindings. Please investigate bindings with"+("service identifier '"+e+"'.")};Oe.CIRCULAR_DEPENDENCY_IN_FACTORY=zX;Oe.STACK_OVERFLOW="Maximum call stack size exceeded"});var RA=N(rl=>{"use strict";var QX=rl&&rl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),YX=rl&&rl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),XX=rl&&rl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&QX(e,r,t);return YX(e,r),e};Object.defineProperty(rl,"__esModule",{value:!0});rl.MetadataReader=void 0;var TA=XX(_n()),ZX=function(){function r(){}return r.prototype.getConstructorMetadata=function(e){var t=Reflect.getMetadata(TA.PARAM_TYPES,e),n=Reflect.getMetadata(TA.TAGGED,e);return{compilerGeneratedMetadata:t,userGeneratedMetadata:n||{}}},r.prototype.getPropertiesMetadata=function(e){var t=Reflect.getMetadata(TA.TAGGED_PROP,e)||[];return t},r}();rl.MetadataReader=ZX});var O2=N(fE=>{"use strict";Object.defineProperty(fE,"__esModule",{value:!0});fE.BindingCount=void 0;var eZ={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1};fE.BindingCount=eZ});var AA=N(Cs=>{"use strict";var tZ=Cs&&Cs.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),rZ=Cs&&Cs.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),nZ=Cs&&Cs.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&tZ(e,r,t);return rZ(e,r),e};Object.defineProperty(Cs,"__esModule",{value:!0});Cs.tryAndThrowErrorIfStackOverflow=Cs.isStackOverflowExeption=void 0;var iZ=nZ(Di());function K2(r){return r instanceof RangeError||r.message===iZ.STACK_OVERFLOW}Cs.isStackOverflowExeption=K2;var oZ=function(r,e){try{return r()}catch(t){throw K2(t)&&(t=e()),t}};Cs.tryAndThrowErrorIfStackOverflow=oZ});var Rh=N(Tn=>{"use strict";var sZ=Tn&&Tn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),aZ=Tn&&Tn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),lZ=Tn&&Tn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&sZ(e,r,t);return aZ(e,r),e};Object.defineProperty(Tn,"__esModule",{value:!0});Tn.getSymbolDescription=Tn.circularDependencyToException=Tn.listMetadataForTarget=Tn.listRegisteredBindingsForServiceIdentifier=Tn.getServiceIdentifierAsString=Tn.getFunctionName=void 0;var cZ=lZ(Di());function F2(r){if(typeof r=="function"){var e=r;return e.name}else{if(typeof r=="symbol")return r.toString();var e=r;return e}}Tn.getServiceIdentifierAsString=F2;function uZ(r,e,t){var n="",i=t(r,e);return i.length!==0&&(n=`
|
||
Registered bindings:`,i.forEach(function(o){var s="Object";o.implementationType!==null&&(s=j2(o.implementationType)),n=n+`
|
||
`+s,o.constraint.metaData&&(n=n+" - "+o.constraint.metaData)})),n}Tn.listRegisteredBindingsForServiceIdentifier=uZ;function L2(r,e){return r.parentRequest===null?!1:r.parentRequest.serviceIdentifier===e?!0:L2(r.parentRequest,e)}function pZ(r){function e(n,i){i===void 0&&(i=[]);var o=F2(n.serviceIdentifier);return i.push(o),n.parentRequest!==null?e(n.parentRequest,i):i}var t=e(r);return t.reverse().join(" --> ")}function U2(r){r.childRequests.forEach(function(e){if(L2(e,e.serviceIdentifier)){var t=pZ(e);throw new Error(cZ.CIRCULAR_DEPENDENCY+" "+t)}else U2(e)})}Tn.circularDependencyToException=U2;function dZ(r,e){if(e.isTagged()||e.isNamed()){var t="",n=e.getNamedTag(),i=e.getCustomTags();return n!==null&&(t+=n.toString()+`
|
||
`),i!==null&&i.forEach(function(o){t+=o.toString()+`
|
||
`})," "+r+`
|
||
`+r+" - "+t}else return" "+r}Tn.listMetadataForTarget=dZ;function j2(r){if(r.name)return r.name;var e=r.toString(),t=e.match(/^function\s*([^\s(]+)/);return t?t[1]:"Anonymous function: "+e}Tn.getFunctionName=j2;function mZ(r){return r.toString().slice(7,-1)}Tn.getSymbolDescription=mZ});var W2=N(hE=>{"use strict";Object.defineProperty(hE,"__esModule",{value:!0});hE.Context=void 0;var fZ=ip(),hZ=function(){function r(e){this.id=(0,fZ.id)(),this.container=e}return r.prototype.addPlan=function(e){this.plan=e},r.prototype.setCurrentRequest=function(e){this.currentRequest=e},r}();hE.Context=hZ});var ha=N(nl=>{"use strict";var gZ=nl&&nl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),vZ=nl&&nl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),yZ=nl&&nl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&gZ(e,r,t);return vZ(e,r),e};Object.defineProperty(nl,"__esModule",{value:!0});nl.Metadata=void 0;var bZ=yZ(_n()),IZ=function(){function r(e,t){this.key=e,this.value=t}return r.prototype.toString=function(){return this.key===bZ.NAMED_TAG?"named: "+String(this.value).toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+String(this.value)+" }"},r}();nl.Metadata=IZ});var V2=N(gE=>{"use strict";Object.defineProperty(gE,"__esModule",{value:!0});gE.Plan=void 0;var SZ=function(){function r(e,t){this.parentContext=e,this.rootRequest=t}return r}();gE.Plan=SZ});var NA=N(vE=>{"use strict";Object.defineProperty(vE,"__esModule",{value:!0});vE.LazyServiceIdentifer=void 0;var xZ=function(){function r(e){this._cb=e}return r.prototype.unwrap=function(){return this._cb()},r}();vE.LazyServiceIdentifer=xZ});var B2=N(yE=>{"use strict";Object.defineProperty(yE,"__esModule",{value:!0});yE.QueryableString=void 0;var CZ=function(){function r(e){this.str=e}return r.prototype.startsWith=function(e){return this.str.indexOf(e)===0},r.prototype.endsWith=function(e){var t="",n=e.split("").reverse().join("");return t=this.str.split("").reverse().join(""),this.startsWith.call({str:t},n)},r.prototype.contains=function(e){return this.str.indexOf(e)!==-1},r.prototype.equals=function(e){return this.str===e},r.prototype.value=function(){return this.str},r}();yE.QueryableString=CZ});var MA=N(il=>{"use strict";var wZ=il&&il.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),EZ=il&&il.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),kZ=il&&il.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wZ(e,r,t);return EZ(e,r),e};Object.defineProperty(il,"__esModule",{value:!0});il.Target=void 0;var Oc=kZ(_n()),PZ=ip(),DZ=Rh(),q2=ha(),_Z=B2(),TZ=function(){function r(e,t,n,i){this.id=(0,PZ.id)(),this.type=e,this.serviceIdentifier=n;var o=typeof t=="symbol"?(0,DZ.getSymbolDescription)(t):t;this.name=new _Z.QueryableString(o||""),this.identifier=t,this.metadata=new Array;var s=null;typeof i=="string"?s=new q2.Metadata(Oc.NAMED_TAG,i):i instanceof q2.Metadata&&(s=i),s!==null&&this.metadata.push(s)}return r.prototype.hasTag=function(e){for(var t=0,n=this.metadata;t<n.length;t++){var i=n[t];if(i.key===e)return!0}return!1},r.prototype.isArray=function(){return this.hasTag(Oc.MULTI_INJECT_TAG)},r.prototype.matchesArray=function(e){return this.matchesTag(Oc.MULTI_INJECT_TAG)(e)},r.prototype.isNamed=function(){return this.hasTag(Oc.NAMED_TAG)},r.prototype.isTagged=function(){return this.metadata.some(function(e){return Oc.NON_CUSTOM_TAG_KEYS.every(function(t){return e.key!==t})})},r.prototype.isOptional=function(){return this.matchesTag(Oc.OPTIONAL_TAG)(!0)},r.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter(function(e){return e.key===Oc.NAMED_TAG})[0]:null},r.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter(function(e){return Oc.NON_CUSTOM_TAG_KEYS.every(function(t){return e.key!==t})}):null},r.prototype.matchesNamedTag=function(e){return this.matchesTag(Oc.NAMED_TAG)(e)},r.prototype.matchesTag=function(e){var t=this;return function(n){for(var i=0,o=t.metadata;i<o.length;i++){var s=o[i];if(s.key===e&&s.value===n)return!0}return!1}},r}();il.Target=TZ});var X2=N(_i=>{"use strict";var RZ=_i&&_i.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),AZ=_i&&_i.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),J2=_i&&_i.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&RZ(e,r,t);return AZ(e,r),e},bE=_i&&_i.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(_i,"__esModule",{value:!0});_i.getFunctionName=_i.getBaseClassDependencyCount=_i.getDependencies=void 0;var NZ=NA(),OA=J2(Di()),$2=fa(),HS=J2(_n()),KA=Rh();Object.defineProperty(_i,"getFunctionName",{enumerable:!0,get:function(){return KA.getFunctionName}});var H2=MA();function MZ(r,e){var t=(0,KA.getFunctionName)(e);return G2(r,t,e,!1)}_i.getDependencies=MZ;function G2(r,e,t,n){var i=r.getConstructorMetadata(t),o=i.compilerGeneratedMetadata;if(o===void 0){var s=OA.MISSING_INJECTABLE_ANNOTATION+" "+e+".";throw new Error(s)}var a=i.userGeneratedMetadata,l=Object.keys(a),c=t.length===0&&l.length>0,u=l.length>t.length,p=c||u?l.length:t.length,f=KZ(n,e,o,a,p),g=z2(r,t,e),v=bE(bE([],f,!0),g,!0);return v}function OZ(r,e,t,n,i){var o=i[r.toString()]||[],s=Y2(o),a=s.unmanaged!==!0,l=n[r],c=s.inject||s.multiInject;if(l=c||l,l instanceof NZ.LazyServiceIdentifer&&(l=l.unwrap()),a){var u=l===Object,p=l===Function,f=l===void 0,g=u||p||f;if(!e&&g){var v=OA.MISSING_INJECT_ANNOTATION+" argument "+r+" in class "+t+".";throw new Error(v)}var b=new H2.Target($2.TargetTypeEnum.ConstructorArgument,s.targetName,l);return b.metadata=o,b}return null}function KZ(r,e,t,n,i){for(var o=[],s=0;s<i;s++){var a=s,l=OZ(a,r,e,t,n);l!==null&&o.push(l)}return o}function FZ(r,e,t,n){var i=r||e;if(i===void 0){var o=OA.MISSING_INJECTABLE_ANNOTATION+" for property "+String(t)+" in class "+n+".";throw new Error(o)}return i}function z2(r,e,t){for(var n=r.getPropertiesMetadata(e),i=[],o=Object.getOwnPropertySymbols(n),s=Object.keys(n),a=s.concat(o),l=0,c=a;l<c.length;l++){var u=c[l],p=n[u],f=Y2(p),g=f.targetName||u,v=FZ(f.inject,f.multiInject,u,t),b=new H2.Target($2.TargetTypeEnum.ClassProperty,g,v);b.metadata=p,i.push(b)}var C=Object.getPrototypeOf(e.prototype).constructor;if(C!==Object){var E=z2(r,C,t);i=bE(bE([],i,!0),E,!0)}return i}function Q2(r,e){var t=Object.getPrototypeOf(e.prototype).constructor;if(t!==Object){var n=(0,KA.getFunctionName)(t),i=G2(r,n,t,!0),o=i.map(function(l){return l.metadata.filter(function(c){return c.key===HS.UNMANAGED_TAG})}),s=[].concat.apply([],o).length,a=i.length-s;return a>0?a:Q2(r,t)}else return 0}_i.getBaseClassDependencyCount=Q2;function Y2(r){var e={};return r.forEach(function(t){e[t.key.toString()]=t.value}),{inject:e[HS.INJECT_TAG],multiInject:e[HS.MULTI_INJECT_TAG],targetName:e[HS.NAME_TAG],unmanaged:e[HS.UNMANAGED_TAG]}}});var Z2=N(IE=>{"use strict";Object.defineProperty(IE,"__esModule",{value:!0});IE.Request=void 0;var LZ=ip(),UZ=function(){function r(e,t,n,i,o){this.id=(0,LZ.id)(),this.serviceIdentifier=e,this.parentContext=t,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(i)?i:[i],this.requestScope=n===null?new Map:null}return r.prototype.addChildRequest=function(e,t,n){var i=new r(e,this.parentContext,this,t,n);return this.childRequests.push(i),i},r}();IE.Request=UZ});var WA=N(uo=>{"use strict";var jZ=uo&&uo.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),WZ=uo&&uo.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),rW=uo&&uo.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&jZ(e,r,t);return WZ(e,r),e};Object.defineProperty(uo,"__esModule",{value:!0});uo.getBindingDictionary=uo.createMockRequest=uo.plan=void 0;var SE=O2(),LA=rW(Di()),nW=fa(),eW=rW(_n()),VZ=AA(),Ah=Rh(),iW=W2(),UA=ha(),BZ=V2(),FA=X2(),jA=Z2(),oW=MA();function sW(r){return r._bindingDictionary}uo.getBindingDictionary=sW;function qZ(r,e,t,n,i,o){var s=r?eW.MULTI_INJECT_TAG:eW.INJECT_TAG,a=new UA.Metadata(s,t),l=new oW.Target(e,n,t,a);if(i!==void 0){var c=new UA.Metadata(i,o);l.metadata.push(c)}return l}function tW(r,e,t,n,i){var o=GS(t.container,i.serviceIdentifier),s=[];return o.length===SE.BindingCount.NoBindingsAvailable&&t.container.options.autoBindInjectable&&typeof i.serviceIdentifier=="function"&&r.getConstructorMetadata(i.serviceIdentifier).compilerGeneratedMetadata&&(t.container.bind(i.serviceIdentifier).toSelf(),o=GS(t.container,i.serviceIdentifier)),e?s=o:s=o.filter(function(a){var l=new jA.Request(a.serviceIdentifier,t,n,a,i);return a.constraint(l)}),JZ(i.serviceIdentifier,s,i,t.container),s}function JZ(r,e,t,n){switch(e.length){case SE.BindingCount.NoBindingsAvailable:if(t.isOptional())return e;var i=(0,Ah.getServiceIdentifierAsString)(r),o=LA.NOT_REGISTERED;throw o+=(0,Ah.listMetadataForTarget)(i,t),o+=(0,Ah.listRegisteredBindingsForServiceIdentifier)(n,i,GS),new Error(o);case SE.BindingCount.OnlyOneBindingAvailable:return e;case SE.BindingCount.MultipleBindingsAvailable:default:if(t.isArray())return e;var i=(0,Ah.getServiceIdentifierAsString)(r),o=LA.AMBIGUOUS_MATCH+" "+i;throw o+=(0,Ah.listRegisteredBindingsForServiceIdentifier)(n,i,GS),new Error(o)}}function aW(r,e,t,n,i,o){var s,a;if(i===null){s=tW(r,e,n,null,o),a=new jA.Request(t,n,null,s,o);var l=new BZ.Plan(n,a);n.addPlan(l)}else s=tW(r,e,n,i,o),a=i.addChildRequest(o.serviceIdentifier,s,o);s.forEach(function(c){var u=null;if(o.isArray())u=a.addChildRequest(c.serviceIdentifier,c,o);else{if(c.cache)return;u=a}if(c.type===nW.BindingTypeEnum.Instance&&c.implementationType!==null){var p=(0,FA.getDependencies)(r,c.implementationType);if(!n.container.options.skipBaseClassChecks){var f=(0,FA.getBaseClassDependencyCount)(r,c.implementationType);if(p.length<f){var g=LA.ARGUMENTS_LENGTH_MISMATCH((0,FA.getFunctionName)(c.implementationType));throw new Error(g)}}p.forEach(function(v){aW(r,!1,v.serviceIdentifier,n,u,v)})}})}function GS(r,e){var t=[],n=sW(r);return n.hasKey(e)?t=n.get(e):r.parent!==null&&(t=GS(r.parent,e)),t}function $Z(r,e,t,n,i,o,s,a){a===void 0&&(a=!1);var l=new iW.Context(e),c=qZ(t,n,i,"",o,s);try{return aW(r,a,i,l,null,c),l}catch(u){throw(0,VZ.isStackOverflowExeption)(u)&&(0,Ah.circularDependencyToException)(l.plan.rootRequest),u}}uo.plan=$Z;function HZ(r,e,t,n){var i=new oW.Target(nW.TargetTypeEnum.Variable,"",e,new UA.Metadata(t,n)),o=new iW.Context(r),s=new jA.Request(e,o,null,[],i);return s}uo.createMockRequest=HZ});var zS=N(Nh=>{"use strict";Object.defineProperty(Nh,"__esModule",{value:!0});Nh.isPromiseOrContainsPromise=Nh.isPromise=void 0;function VA(r){var e=typeof r=="object"&&r!==null||typeof r=="function";return e&&typeof r.then=="function"}Nh.isPromise=VA;function GZ(r){return VA(r)?!0:Array.isArray(r)&&r.some(VA)}Nh.isPromiseOrContainsPromise=GZ});var lW=N(ol=>{"use strict";var zZ=ol&&ol.__awaiter||function(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})},QZ=ol&&ol.__generator||function(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(ol,"__esModule",{value:!0});ol.saveToScope=ol.tryGetFromScope=void 0;var xE=M(),YZ=zS(),XZ=function(r,e){return e.scope===xE.BindingScopeEnum.Singleton&&e.activated?e.cache:e.scope===xE.BindingScopeEnum.Request&&r.has(e.id)?r.get(e.id):null};ol.tryGetFromScope=XZ;var ZZ=function(r,e,t){e.scope===xE.BindingScopeEnum.Singleton&&tee(e,t),e.scope===xE.BindingScopeEnum.Request&&eee(r,e,t)};ol.saveToScope=ZZ;var eee=function(r,e,t){r.has(e.id)||r.set(e.id,t)},tee=function(r,e){r.cache=e,r.activated=!0,(0,YZ.isPromise)(e)&&ree(r,e)},ree=function(r,e){return zZ(void 0,void 0,void 0,function(){var t,n;return QZ(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return t=i.sent(),r.cache=t,[3,3];case 2:throw n=i.sent(),r.cache=null,r.activated=!1,n;case 3:return[2]}})})}});var cW=N(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});QS.FactoryType=void 0;var nee;(function(r){r.DynamicValue="toDynamicValue",r.Factory="toFactory",r.Provider="toProvider"})(nee=QS.FactoryType||(QS.FactoryType={}))});var qA=N(po=>{"use strict";var iee=po&&po.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),oee=po&&po.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),see=po&&po.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&iee(e,r,t);return oee(e,r),e};Object.defineProperty(po,"__esModule",{value:!0});po.getFactoryDetails=po.ensureFullyBound=po.multiBindToService=void 0;var aee=M(),lee=see(Di()),sl=fa(),BA=cW(),cee=function(r){return function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.forEach(function(i){return r.bind(i).toService(e)})}}};po.multiBindToService=cee;var uee=function(r){var e=null;switch(r.type){case sl.BindingTypeEnum.ConstantValue:case sl.BindingTypeEnum.Function:e=r.cache;break;case sl.BindingTypeEnum.Constructor:case sl.BindingTypeEnum.Instance:e=r.implementationType;break;case sl.BindingTypeEnum.DynamicValue:e=r.dynamicValue;break;case sl.BindingTypeEnum.Provider:e=r.provider;break;case sl.BindingTypeEnum.Factory:e=r.factory;break}if(e===null){var t=(0,aee.getServiceIdentifierAsString)(r.serviceIdentifier);throw new Error(lee.INVALID_BINDING_TYPE+" "+t)}};po.ensureFullyBound=uee;var pee=function(r){switch(r.type){case sl.BindingTypeEnum.Factory:return{factory:r.factory,factoryType:BA.FactoryType.Factory};case sl.BindingTypeEnum.Provider:return{factory:r.provider,factoryType:BA.FactoryType.Provider};case sl.BindingTypeEnum.DynamicValue:return{factory:r.dynamicValue,factoryType:BA.FactoryType.DynamicValue};default:throw new Error("Unexpected factory type "+r.type)}};po.getFactoryDetails=pee});var hW=N(Xn=>{"use strict";var Mh=Xn&&Xn.__assign||function(){return Mh=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},Mh.apply(this,arguments)},dee=Xn&&Xn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),mee=Xn&&Xn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),fee=Xn&&Xn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&dee(e,r,t);return mee(e,r),e},dW=Xn&&Xn.__awaiter||function(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})},mW=Xn&&Xn.__generator||function(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},hee=Xn&&Xn.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(Xn,"__esModule",{value:!0});Xn.resolveInstance=void 0;var JA=Di(),HA=fa(),$A=fee(_n()),GA=zS();function gee(r,e){return r.reduce(function(t,n){var i=e(n),o=n.target.type;return o===HA.TargetTypeEnum.ConstructorArgument?t.constructorInjections.push(i):(t.propertyRequests.push(n),t.propertyInjections.push(i)),t.isAsync||(t.isAsync=(0,GA.isPromiseOrContainsPromise)(i)),t},{constructorInjections:[],propertyInjections:[],propertyRequests:[],isAsync:!1})}function vee(r,e,t){var n;if(e.length>0){var i=gee(e,t),o=Mh(Mh({},i),{constr:r});i.isAsync?n=yee(o):n=fW(o)}else n=new r;return n}function fW(r){var e,t=new((e=r.constr).bind.apply(e,hee([void 0],r.constructorInjections,!1)));return r.propertyRequests.forEach(function(n,i){var o=n.target.identifier,s=r.propertyInjections[i];t[o]=s}),t}function yee(r){return dW(this,void 0,void 0,function(){var e,t;return mW(this,function(n){switch(n.label){case 0:return[4,uW(r.constructorInjections)];case 1:return e=n.sent(),[4,uW(r.propertyInjections)];case 2:return t=n.sent(),[2,fW(Mh(Mh({},r),{constructorInjections:e,propertyInjections:t}))]}})})}function uW(r){return dW(this,void 0,void 0,function(){var e,t,n,i;return mW(this,function(o){for(e=[],t=0,n=r;t<n.length;t++)i=n[t],Array.isArray(i)?e.push(Promise.all(i)):e.push(i);return[2,Promise.all(e)]})})}function pW(r,e){var t=bee(r,e);return(0,GA.isPromise)(t)?t.then(function(){return e}):e}function bee(r,e){var t,n;if(Reflect.hasMetadata($A.POST_CONSTRUCT,r)){var i=Reflect.getMetadata($A.POST_CONSTRUCT,r);try{return(n=(t=e)[i.value])===null||n===void 0?void 0:n.call(t)}catch(o){throw new Error((0,JA.POST_CONSTRUCT_ERROR)(r.name,o.message))}}}function Iee(r,e){r.scope!==HA.BindingScopeEnum.Singleton&&See(r,e)}function See(r,e){var t="Class cannot be instantiated in "+(r.scope===HA.BindingScopeEnum.Request?"request":"transient")+" scope.";if(typeof r.onDeactivation=="function")throw new Error((0,JA.ON_DEACTIVATION_ERROR)(e.name,t));if(Reflect.hasMetadata($A.PRE_DESTROY,e))throw new Error((0,JA.PRE_DESTROY_ERROR)(e.name,t))}function xee(r,e,t,n){Iee(r,e);var i=vee(e,t,n);return(0,GA.isPromise)(i)?i.then(function(o){return pW(e,o)}):pW(e,i)}Xn.resolveInstance=xee});var IW=N(mo=>{"use strict";var Cee=mo&&mo.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),wee=mo&&mo.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Eee=mo&&mo.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Cee(e,r,t);return wee(e,r),e},kee=mo&&mo.__awaiter||function(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})},Pee=mo&&mo.__generator||function(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}};Object.defineProperty(mo,"__esModule",{value:!0});mo.resolve=void 0;var Dee=Eee(Di()),CE=fa(),_ee=WA(),gW=lW(),zA=zS(),yW=qA(),Tee=AA(),Ree=hW(),QA=function(r){return function(e){e.parentContext.setCurrentRequest(e);var t=e.bindings,n=e.childRequests,i=e.target&&e.target.isArray(),o=!e.parentRequest||!e.parentRequest.target||!e.target||!e.parentRequest.target.matchesArray(e.target.serviceIdentifier);if(i&&o)return n.map(function(a){var l=QA(r);return l(a)});if(e.target.isOptional()&&t.length===0)return;var s=t[0];return Oee(r,e,s)}},Aee=function(r,e){var t=(0,yW.getFactoryDetails)(r);return(0,Tee.tryAndThrowErrorIfStackOverflow)(function(){return t.factory.bind(r)(e)},function(){return new Error(Dee.CIRCULAR_DEPENDENCY_IN_FACTORY(t.factoryType,e.currentRequest.serviceIdentifier.toString()))})},Nee=function(r,e,t){var n,i=e.childRequests;switch((0,yW.ensureFullyBound)(t),t.type){case CE.BindingTypeEnum.ConstantValue:case CE.BindingTypeEnum.Function:n=t.cache;break;case CE.BindingTypeEnum.Constructor:n=t.implementationType;break;case CE.BindingTypeEnum.Instance:n=(0,Ree.resolveInstance)(t,t.implementationType,i,QA(r));break;default:n=Aee(t,e.parentContext)}return n},Mee=function(r,e,t){var n=(0,gW.tryGetFromScope)(r,e);return n!==null||(n=t(),(0,gW.saveToScope)(r,e,n)),n},Oee=function(r,e,t){return Mee(r,t,function(){var n=Nee(r,e,t);return(0,zA.isPromise)(n)?n=n.then(function(i){return vW(e,t,i)}):n=vW(e,t,n),n})};function vW(r,e,t){var n=Kee(r.parentContext,e,t),i=Uee(r.parentContext.container),o,s=i.next();do{o=s.value;var a=r.parentContext,l=r.serviceIdentifier,c=Lee(o,l);(0,zA.isPromise)(n)?n=bW(c,a,n):n=Fee(c,a,n),s=i.next()}while(s.done!==!0&&!(0,_ee.getBindingDictionary)(o).hasKey(r.serviceIdentifier));return n}var Kee=function(r,e,t){var n;return typeof e.onActivation=="function"?n=e.onActivation(r,t):n=t,n},Fee=function(r,e,t){for(var n=r.next();!n.done;){if(t=n.value(e,t),(0,zA.isPromise)(t))return bW(r,e,t);n=r.next()}return t},bW=function(r,e,t){return kee(void 0,void 0,void 0,function(){var n,i;return Pee(this,function(o){switch(o.label){case 0:return[4,t];case 1:n=o.sent(),i=r.next(),o.label=2;case 2:return i.done?[3,4]:[4,i.value(e,n)];case 3:return n=o.sent(),i=r.next(),[3,2];case 4:return[2,n]}})})},Lee=function(r,e){var t=r._activations;return t.hasKey(e)?t.get(e).values():[].values()},Uee=function(r){for(var e=[r],t=r.parent;t!==null;)e.push(t),t=t.parent;var n=function(){var o=e.pop();return o!==void 0?{done:!1,value:o}:{done:!0,value:void 0}},i={next:n};return i};function jee(r){var e=QA(r.plan.rootRequest.requestScope);return e(r.plan.rootRequest)}mo.resolve=jee});var YA=N(Ti=>{"use strict";var Wee=Ti&&Ti.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Vee=Ti&&Ti.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Bee=Ti&&Ti.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Wee(e,r,t);return Vee(e,r),e};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.typeConstraint=Ti.namedConstraint=Ti.taggedConstraint=Ti.traverseAncerstors=void 0;var qee=Bee(_n()),Jee=ha(),SW=function(r,e){var t=r.parentRequest;return t!==null?e(t)?!0:SW(t,e):!1};Ti.traverseAncerstors=SW;var xW=function(r){return function(e){var t=function(n){return n!==null&&n.target!==null&&n.target.matchesTag(r)(e)};return t.metaData=new Jee.Metadata(r,e),t}};Ti.taggedConstraint=xW;var $ee=xW(qee.NAMED_TAG);Ti.namedConstraint=$ee;var Hee=function(r){return function(e){var t=null;if(e!==null)if(t=e.bindings[0],typeof r=="string"){var n=t.serviceIdentifier;return n===r}else{var i=e.bindings[0].implementationType;return r===i}return!1}};Ti.typeConstraint=Hee});var EE=N(wE=>{"use strict";Object.defineProperty(wE,"__esModule",{value:!0});wE.BindingWhenSyntax=void 0;var zi=kE(),jn=YA(),Gee=function(){function r(e){this._binding=e}return r.prototype.when=function(e){return this._binding.constraint=e,new zi.BindingOnSyntax(this._binding)},r.prototype.whenTargetNamed=function(e){return this._binding.constraint=(0,jn.namedConstraint)(e),new zi.BindingOnSyntax(this._binding)},r.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){if(e===null)return!1;var t=e.target!==null&&!e.target.isNamed()&&!e.target.isTagged();return t},new zi.BindingOnSyntax(this._binding)},r.prototype.whenTargetTagged=function(e,t){return this._binding.constraint=(0,jn.taggedConstraint)(e)(t),new zi.BindingOnSyntax(this._binding)},r.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(t){return t!==null&&(0,jn.typeConstraint)(e)(t.parentRequest)},new zi.BindingOnSyntax(this._binding)},r.prototype.whenParentNamed=function(e){return this._binding.constraint=function(t){return t!==null&&(0,jn.namedConstraint)(e)(t.parentRequest)},new zi.BindingOnSyntax(this._binding)},r.prototype.whenParentTagged=function(e,t){return this._binding.constraint=function(n){return n!==null&&(0,jn.taggedConstraint)(e)(t)(n.parentRequest)},new zi.BindingOnSyntax(this._binding)},r.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(t){return t!==null&&(0,jn.traverseAncerstors)(t,(0,jn.typeConstraint)(e))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(t){return t!==null&&!(0,jn.traverseAncerstors)(t,(0,jn.typeConstraint)(e))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(t){return t!==null&&(0,jn.traverseAncerstors)(t,(0,jn.namedConstraint)(e))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(t){return t!==null&&!(0,jn.traverseAncerstors)(t,(0,jn.namedConstraint)(e))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._binding.constraint=function(n){return n!==null&&(0,jn.traverseAncerstors)(n,(0,jn.taggedConstraint)(e)(t))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenNoAncestorTagged=function(e,t){return this._binding.constraint=function(n){return n!==null&&!(0,jn.traverseAncerstors)(n,(0,jn.taggedConstraint)(e)(t))},new zi.BindingOnSyntax(this._binding)},r.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(t){return t!==null&&(0,jn.traverseAncerstors)(t,e)},new zi.BindingOnSyntax(this._binding)},r.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(t){return t!==null&&!(0,jn.traverseAncerstors)(t,e)},new zi.BindingOnSyntax(this._binding)},r}();wE.BindingWhenSyntax=Gee});var kE=N(PE=>{"use strict";Object.defineProperty(PE,"__esModule",{value:!0});PE.BindingOnSyntax=void 0;var CW=EE(),zee=function(){function r(e){this._binding=e}return r.prototype.onActivation=function(e){return this._binding.onActivation=e,new CW.BindingWhenSyntax(this._binding)},r.prototype.onDeactivation=function(e){return this._binding.onDeactivation=e,new CW.BindingWhenSyntax(this._binding)},r}();PE.BindingOnSyntax=zee});var XA=N(DE=>{"use strict";Object.defineProperty(DE,"__esModule",{value:!0});DE.BindingWhenOnSyntax=void 0;var Qee=kE(),Yee=EE(),Xee=function(){function r(e){this._binding=e,this._bindingWhenSyntax=new Yee.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new Qee.BindingOnSyntax(this._binding)}return r.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},r.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},r.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},r.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},r.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},r.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},r.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},r.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},r.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},r.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},r.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},r.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},r.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},r.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},r.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},r.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},r}();DE.BindingWhenOnSyntax=Xee});var wW=N(_E=>{"use strict";Object.defineProperty(_E,"__esModule",{value:!0});_E.BindingInSyntax=void 0;var ZA=fa(),eN=XA(),Zee=function(){function r(e){this._binding=e}return r.prototype.inRequestScope=function(){return this._binding.scope=ZA.BindingScopeEnum.Request,new eN.BindingWhenOnSyntax(this._binding)},r.prototype.inSingletonScope=function(){return this._binding.scope=ZA.BindingScopeEnum.Singleton,new eN.BindingWhenOnSyntax(this._binding)},r.prototype.inTransientScope=function(){return this._binding.scope=ZA.BindingScopeEnum.Transient,new eN.BindingWhenOnSyntax(this._binding)},r}();_E.BindingInSyntax=Zee});var EW=N(TE=>{"use strict";Object.defineProperty(TE,"__esModule",{value:!0});TE.BindingInWhenOnSyntax=void 0;var ete=wW(),tte=kE(),rte=EE(),nte=function(){function r(e){this._binding=e,this._bindingWhenSyntax=new rte.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new tte.BindingOnSyntax(this._binding),this._bindingInSyntax=new ete.BindingInSyntax(e)}return r.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},r.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},r.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},r.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},r.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},r.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},r.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},r.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},r.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},r.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},r.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},r.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},r.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},r.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},r.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},r.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},r.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},r.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},r.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},r.prototype.onDeactivation=function(e){return this._bindingOnSyntax.onDeactivation(e)},r}();TE.BindingInWhenOnSyntax=nte});var DW=N(al=>{"use strict";var ite=al&&al.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ote=al&&al.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),ste=al&&al.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ite(e,r,t);return ote(e,r),e};Object.defineProperty(al,"__esModule",{value:!0});al.BindingToSyntax=void 0;var kW=ste(Di()),Qi=fa(),PW=EW(),Oh=XA(),ate=function(){function r(e){this._binding=e}return r.prototype.to=function(e){return this._binding.type=Qi.BindingTypeEnum.Instance,this._binding.implementationType=e,new PW.BindingInWhenOnSyntax(this._binding)},r.prototype.toSelf=function(){if(typeof this._binding.serviceIdentifier!="function")throw new Error(""+kW.INVALID_TO_SELF_VALUE);var e=this._binding.serviceIdentifier;return this.to(e)},r.prototype.toConstantValue=function(e){return this._binding.type=Qi.BindingTypeEnum.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=Qi.BindingScopeEnum.Singleton,new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toDynamicValue=function(e){return this._binding.type=Qi.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new PW.BindingInWhenOnSyntax(this._binding)},r.prototype.toConstructor=function(e){return this._binding.type=Qi.BindingTypeEnum.Constructor,this._binding.implementationType=e,this._binding.scope=Qi.BindingScopeEnum.Singleton,new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toFactory=function(e){return this._binding.type=Qi.BindingTypeEnum.Factory,this._binding.factory=e,this._binding.scope=Qi.BindingScopeEnum.Singleton,new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toFunction=function(e){if(typeof e!="function")throw new Error(kW.INVALID_FUNCTION_BINDING);var t=this.toConstantValue(e);return this._binding.type=Qi.BindingTypeEnum.Function,this._binding.scope=Qi.BindingScopeEnum.Singleton,t},r.prototype.toAutoFactory=function(e){return this._binding.type=Qi.BindingTypeEnum.Factory,this._binding.factory=function(t){var n=function(){return t.container.get(e)};return n},this._binding.scope=Qi.BindingScopeEnum.Singleton,new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toAutoNamedFactory=function(e){return this._binding.type=Qi.BindingTypeEnum.Factory,this._binding.factory=function(t){return function(n){return t.container.getNamed(e,n)}},new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toProvider=function(e){return this._binding.type=Qi.BindingTypeEnum.Provider,this._binding.provider=e,this._binding.scope=Qi.BindingScopeEnum.Singleton,new Oh.BindingWhenOnSyntax(this._binding)},r.prototype.toService=function(e){this.toDynamicValue(function(t){return t.container.get(e)})},r}();al.BindingToSyntax=ate});var _W=N(RE=>{"use strict";Object.defineProperty(RE,"__esModule",{value:!0});RE.ContainerSnapshot=void 0;var lte=function(){function r(){}return r.of=function(e,t,n,i,o){var s=new r;return s.bindings=e,s.middleware=t,s.deactivations=i,s.activations=n,s.moduleActivationStore=o,s},r}();RE.ContainerSnapshot=lte});var TW=N(AE=>{"use strict";Object.defineProperty(AE,"__esModule",{value:!0});AE.isClonable=void 0;function cte(r){return typeof r=="object"&&r!==null&&"clone"in r&&typeof r.clone=="function"}AE.isClonable=cte});var tN=N(ll=>{"use strict";var ute=ll&&ll.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),pte=ll&&ll.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dte=ll&&ll.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ute(e,r,t);return pte(e,r),e};Object.defineProperty(ll,"__esModule",{value:!0});ll.Lookup=void 0;var pm=dte(Di()),mte=TW(),fte=function(){function r(){this._map=new Map}return r.prototype.getMap=function(){return this._map},r.prototype.add=function(e,t){if(e==null)throw new Error(pm.NULL_ARGUMENT);if(t==null)throw new Error(pm.NULL_ARGUMENT);var n=this._map.get(e);n!==void 0?n.push(t):this._map.set(e,[t])},r.prototype.get=function(e){if(e==null)throw new Error(pm.NULL_ARGUMENT);var t=this._map.get(e);if(t!==void 0)return t;throw new Error(pm.KEY_NOT_FOUND)},r.prototype.remove=function(e){if(e==null)throw new Error(pm.NULL_ARGUMENT);if(!this._map.delete(e))throw new Error(pm.KEY_NOT_FOUND)},r.prototype.removeIntersection=function(e){var t=this;this.traverse(function(n,i){var o=e.hasKey(n)?e.get(n):void 0;if(o!==void 0){var s=i.filter(function(a){return!o.some(function(l){return a===l})});t._setValue(n,s)}})},r.prototype.removeByCondition=function(e){var t=this,n=[];return this._map.forEach(function(i,o){for(var s=[],a=0,l=i;a<l.length;a++){var c=l[a],u=e(c);u?n.push(c):s.push(c)}t._setValue(o,s)}),n},r.prototype.hasKey=function(e){if(e==null)throw new Error(pm.NULL_ARGUMENT);return this._map.has(e)},r.prototype.clone=function(){var e=new r;return this._map.forEach(function(t,n){t.forEach(function(i){return e.add(n,(0,mte.isClonable)(i)?i.clone():i)})}),e},r.prototype.traverse=function(e){this._map.forEach(function(t,n){e(n,t)})},r.prototype._setValue=function(e,t){t.length>0?this._map.set(e,t):this._map.delete(e)},r}();ll.Lookup=fte});var AW=N(NE=>{"use strict";Object.defineProperty(NE,"__esModule",{value:!0});NE.ModuleActivationStore=void 0;var RW=tN(),hte=function(){function r(){this._map=new Map}return r.prototype.remove=function(e){if(this._map.has(e)){var t=this._map.get(e);return this._map.delete(e),t}return this._getEmptyHandlersStore()},r.prototype.addDeactivation=function(e,t,n){this._getModuleActivationHandlers(e).onDeactivations.add(t,n)},r.prototype.addActivation=function(e,t,n){this._getModuleActivationHandlers(e).onActivations.add(t,n)},r.prototype.clone=function(){var e=new r;return this._map.forEach(function(t,n){e._map.set(n,{onActivations:t.onActivations.clone(),onDeactivations:t.onDeactivations.clone()})}),e},r.prototype._getModuleActivationHandlers=function(e){var t=this._map.get(e);return t===void 0&&(t=this._getEmptyHandlersStore(),this._map.set(e,t)),t},r.prototype._getEmptyHandlersStore=function(){var e={onActivations:new RW.Lookup,onDeactivations:new RW.Lookup};return e},r}();NE.ModuleActivationStore=hte});var rN=N(Zn=>{"use strict";var OE=Zn&&Zn.__assign||function(){return OE=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i])}return r},OE.apply(this,arguments)},gte=Zn&&Zn.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),vte=Zn&&Zn.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),NW=Zn&&Zn.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&>e(e,r,t);return vte(e,r),e},ws=Zn&&Zn.__awaiter||function(r,e,t,n){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?o(u.value):i(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})},Es=Zn&&Zn.__generator||function(r,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;t;)try{if(n=1,i&&(o=c[0]&2?i.return:c[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,c[1])).done)return o;switch(i=0,o&&(c=[c[0]&2,o.value]),c[0]){case 0:case 1:o=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!o||c[1]>o[0]&&c[1]<o[3])){t.label=c[1];break}if(c[0]===6&&t.label<o[1]){t.label=o[1],o=c;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(c);break}o[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],i=0}finally{n=o=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},yte=Zn&&Zn.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,o;n<i;n++)(o||!(n in e))&&(o||(o=Array.prototype.slice.call(e,0,n)),o[n]=e[n]);return r.concat(o||Array.prototype.slice.call(e))};Object.defineProperty(Zn,"__esModule",{value:!0});Zn.Container=void 0;var bte=M2(),ga=NW(Di()),Kh=fa(),dm=NW(_n()),Ite=RA(),ME=WA(),Ste=IW(),xte=DW(),mm=zS(),Cte=ip(),wte=Rh(),Ete=_W(),YS=tN(),kte=AW(),Pte=function(){function r(e){var t=e||{};if(typeof t!="object")throw new Error(""+ga.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(t.defaultScope===void 0)t.defaultScope=Kh.BindingScopeEnum.Transient;else if(t.defaultScope!==Kh.BindingScopeEnum.Singleton&&t.defaultScope!==Kh.BindingScopeEnum.Transient&&t.defaultScope!==Kh.BindingScopeEnum.Request)throw new Error(""+ga.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(t.autoBindInjectable===void 0)t.autoBindInjectable=!1;else if(typeof t.autoBindInjectable!="boolean")throw new Error(""+ga.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(t.skipBaseClassChecks===void 0)t.skipBaseClassChecks=!1;else if(typeof t.skipBaseClassChecks!="boolean")throw new Error(""+ga.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:t.autoBindInjectable,defaultScope:t.defaultScope,skipBaseClassChecks:t.skipBaseClassChecks},this.id=(0,Cte.id)(),this._bindingDictionary=new YS.Lookup,this._snapshots=[],this._middleware=null,this._activations=new YS.Lookup,this._deactivations=new YS.Lookup,this.parent=null,this._metadataReader=new Ite.MetadataReader,this._moduleActivationStore=new kte.ModuleActivationStore}return r.merge=function(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];var o=new r,s=yte([e,t],n,!0).map(function(c){return(0,ME.getBindingDictionary)(c)}),a=(0,ME.getBindingDictionary)(o);function l(c,u){c.traverse(function(p,f){f.forEach(function(g){u.add(g.serviceIdentifier,g.clone())})})}return s.forEach(function(c){l(c,a)}),o},r.prototype.load=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=this._getContainerModuleHelpersFactory(),i=0,o=e;i<o.length;i++){var s=o[i],a=n(s.id);s.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction,a.unbindAsyncFunction,a.onActivationFunction,a.onDeactivationFunction)}},r.prototype.loadAsync=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ws(this,void 0,void 0,function(){var n,i,o,s,a;return Es(this,function(l){switch(l.label){case 0:n=this._getContainerModuleHelpersFactory(),i=0,o=e,l.label=1;case 1:return i<o.length?(s=o[i],a=n(s.id),[4,s.registry(a.bindFunction,a.unbindFunction,a.isboundFunction,a.rebindFunction,a.unbindAsyncFunction,a.onActivationFunction,a.onDeactivationFunction)]):[3,4];case 2:l.sent(),l.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},r.prototype.unload=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.forEach(function(i){var o=e._removeModuleBindings(i.id);e._deactivateSingletons(o),e._removeModuleHandlers(i.id)})},r.prototype.unloadAsync=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ws(this,void 0,void 0,function(){var n,i,o,s;return Es(this,function(a){switch(a.label){case 0:n=0,i=e,a.label=1;case 1:return n<i.length?(o=i[n],s=this._removeModuleBindings(o.id),[4,this._deactivateSingletonsAsync(s)]):[3,4];case 2:a.sent(),this._removeModuleHandlers(o.id),a.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},r.prototype.bind=function(e){var t=this.options.defaultScope||Kh.BindingScopeEnum.Transient,n=new bte.Binding(e,t);return this._bindingDictionary.add(e,n),new xte.BindingToSyntax(n)},r.prototype.rebind=function(e){return this.unbind(e),this.bind(e)},r.prototype.rebindAsync=function(e){return ws(this,void 0,void 0,function(){return Es(this,function(t){switch(t.label){case 0:return[4,this.unbindAsync(e)];case 1:return t.sent(),[2,this.bind(e)]}})})},r.prototype.unbind=function(e){if(this._bindingDictionary.hasKey(e)){var t=this._bindingDictionary.get(e);this._deactivateSingletons(t)}this._removeServiceFromDictionary(e)},r.prototype.unbindAsync=function(e){return ws(this,void 0,void 0,function(){var t;return Es(this,function(n){switch(n.label){case 0:return this._bindingDictionary.hasKey(e)?(t=this._bindingDictionary.get(e),[4,this._deactivateSingletonsAsync(t)]):[3,2];case 1:n.sent(),n.label=2;case 2:return this._removeServiceFromDictionary(e),[2]}})})},r.prototype.unbindAll=function(){var e=this;this._bindingDictionary.traverse(function(t,n){e._deactivateSingletons(n)}),this._bindingDictionary=new YS.Lookup},r.prototype.unbindAllAsync=function(){return ws(this,void 0,void 0,function(){var e,t=this;return Es(this,function(n){switch(n.label){case 0:return e=[],this._bindingDictionary.traverse(function(i,o){e.push(t._deactivateSingletonsAsync(o))}),[4,Promise.all(e)];case 1:return n.sent(),this._bindingDictionary=new YS.Lookup,[2]}})})},r.prototype.onActivation=function(e,t){this._activations.add(e,t)},r.prototype.onDeactivation=function(e,t){this._deactivations.add(e,t)},r.prototype.isBound=function(e){var t=this._bindingDictionary.hasKey(e);return!t&&this.parent&&(t=this.parent.isBound(e)),t},r.prototype.isCurrentBound=function(e){return this._bindingDictionary.hasKey(e)},r.prototype.isBoundNamed=function(e,t){return this.isBoundTagged(e,dm.NAMED_TAG,t)},r.prototype.isBoundTagged=function(e,t,n){var i=!1;if(this._bindingDictionary.hasKey(e)){var o=this._bindingDictionary.get(e),s=(0,ME.createMockRequest)(this,e,t,n);i=o.some(function(a){return a.constraint(s)})}return!i&&this.parent&&(i=this.parent.isBoundTagged(e,t,n)),i},r.prototype.snapshot=function(){this._snapshots.push(Ete.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware,this._activations.clone(),this._deactivations.clone(),this._moduleActivationStore.clone()))},r.prototype.restore=function(){var e=this._snapshots.pop();if(e===void 0)throw new Error(ga.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=e.bindings,this._activations=e.activations,this._deactivations=e.deactivations,this._middleware=e.middleware,this._moduleActivationStore=e.moduleActivationStore},r.prototype.createChild=function(e){var t=new r(e||this.options);return t.parent=this,t},r.prototype.applyMiddleware=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=e.reduce(function(i,o){return o(i)},n)},r.prototype.applyCustomMetadataReader=function(e){this._metadataReader=e},r.prototype.get=function(e){var t=this._getNotAllArgs(e,!1);return this._getButThrowIfAsync(t)},r.prototype.getAsync=function(e){return ws(this,void 0,void 0,function(){var t;return Es(this,function(n){return t=this._getNotAllArgs(e,!1),[2,this._get(t)]})})},r.prototype.getTagged=function(e,t,n){var i=this._getNotAllArgs(e,!1,t,n);return this._getButThrowIfAsync(i)},r.prototype.getTaggedAsync=function(e,t,n){return ws(this,void 0,void 0,function(){var i;return Es(this,function(o){return i=this._getNotAllArgs(e,!1,t,n),[2,this._get(i)]})})},r.prototype.getNamed=function(e,t){return this.getTagged(e,dm.NAMED_TAG,t)},r.prototype.getNamedAsync=function(e,t){return this.getTaggedAsync(e,dm.NAMED_TAG,t)},r.prototype.getAll=function(e){var t=this._getAllArgs(e);return this._getButThrowIfAsync(t)},r.prototype.getAllAsync=function(e){var t=this._getAllArgs(e);return this._getAll(t)},r.prototype.getAllTagged=function(e,t,n){var i=this._getNotAllArgs(e,!0,t,n);return this._getButThrowIfAsync(i)},r.prototype.getAllTaggedAsync=function(e,t,n){var i=this._getNotAllArgs(e,!0,t,n);return this._getAll(i)},r.prototype.getAllNamed=function(e,t){return this.getAllTagged(e,dm.NAMED_TAG,t)},r.prototype.getAllNamedAsync=function(e,t){return this.getAllTaggedAsync(e,dm.NAMED_TAG,t)},r.prototype.resolve=function(e){var t=this.isBound(e);t||this.bind(e).toSelf();var n=this.get(e);return t||this.unbind(e),n},r.prototype._preDestroy=function(e,t){if(Reflect.hasMetadata(dm.PRE_DESTROY,e)){var n=Reflect.getMetadata(dm.PRE_DESTROY,e);return t[n.value]()}},r.prototype._removeModuleHandlers=function(e){var t=this._moduleActivationStore.remove(e);this._activations.removeIntersection(t.onActivations),this._deactivations.removeIntersection(t.onDeactivations)},r.prototype._removeModuleBindings=function(e){return this._bindingDictionary.removeByCondition(function(t){return t.moduleId===e})},r.prototype._deactivate=function(e,t){var n=this,i=Object.getPrototypeOf(t).constructor;try{if(this._deactivations.hasKey(e.serviceIdentifier)){var o=this._deactivateContainer(t,this._deactivations.get(e.serviceIdentifier).values());if((0,mm.isPromise)(o))return this._handleDeactivationError(o.then(function(){return n._propagateContainerDeactivationThenBindingAndPreDestroyAsync(e,t,i)}),i)}var s=this._propagateContainerDeactivationThenBindingAndPreDestroy(e,t,i);if((0,mm.isPromise)(s))return this._handleDeactivationError(s,i)}catch(a){throw new Error(ga.ON_DEACTIVATION_ERROR(i.name,a.message))}},r.prototype._handleDeactivationError=function(e,t){return ws(this,void 0,void 0,function(){var n;return Es(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,e];case 1:return i.sent(),[3,3];case 2:throw n=i.sent(),new Error(ga.ON_DEACTIVATION_ERROR(t.name,n.message));case 3:return[2]}})})},r.prototype._deactivateContainer=function(e,t){for(var n=this,i=t.next();i.value;){var o=i.value(e);if((0,mm.isPromise)(o))return o.then(function(){return n._deactivateContainerAsync(e,t)});i=t.next()}},r.prototype._deactivateContainerAsync=function(e,t){return ws(this,void 0,void 0,function(){var n;return Es(this,function(i){switch(i.label){case 0:n=t.next(),i.label=1;case 1:return n.value?[4,n.value(e)]:[3,3];case 2:return i.sent(),n=t.next(),[3,1];case 3:return[2]}})})},r.prototype._getContainerModuleHelpersFactory=function(){var e=this,t=function(u,p){u._binding.moduleId=p},n=function(u){return function(p){var f=e.bind(p);return t(f,u),f}},i=function(){return function(u){return e.unbind(u)}},o=function(){return function(u){return e.unbindAsync(u)}},s=function(){return function(u){return e.isBound(u)}},a=function(u){return function(p){var f=e.rebind(p);return t(f,u),f}},l=function(u){return function(p,f){e._moduleActivationStore.addActivation(u,p,f),e.onActivation(p,f)}},c=function(u){return function(p,f){e._moduleActivationStore.addDeactivation(u,p,f),e.onDeactivation(p,f)}};return function(u){return{bindFunction:n(u),isboundFunction:s(),onActivationFunction:l(u),onDeactivationFunction:c(u),rebindFunction:a(u),unbindFunction:i(),unbindAsyncFunction:o()}}},r.prototype._getAll=function(e){return Promise.all(this._get(e))},r.prototype._get=function(e){var t=OE(OE({},e),{contextInterceptor:function(i){return i},targetType:Kh.TargetTypeEnum.Variable});if(this._middleware){var n=this._middleware(t);if(n==null)throw new Error(ga.INVALID_MIDDLEWARE_RETURN);return n}return this._planAndResolve()(t)},r.prototype._getButThrowIfAsync=function(e){var t=this._get(e);if((0,mm.isPromiseOrContainsPromise)(t))throw new Error(ga.LAZY_IN_SYNC(e.serviceIdentifier));return t},r.prototype._getAllArgs=function(e){var t={avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:e};return t},r.prototype._getNotAllArgs=function(e,t,n,i){var o={avoidConstraints:!1,isMultiInject:t,serviceIdentifier:e,key:n,value:i};return o},r.prototype._planAndResolve=function(){var e=this;return function(t){var n=(0,ME.plan)(e._metadataReader,e,t.isMultiInject,t.targetType,t.serviceIdentifier,t.key,t.value,t.avoidConstraints);n=t.contextInterceptor(n);var i=(0,Ste.resolve)(n);return i}},r.prototype._deactivateIfSingleton=function(e){var t=this;if(e.activated)return(0,mm.isPromise)(e.cache)?e.cache.then(function(n){return t._deactivate(e,n)}):this._deactivate(e,e.cache)},r.prototype._deactivateSingletons=function(e){for(var t=0,n=e;t<n.length;t++){var i=n[t],o=this._deactivateIfSingleton(i);if((0,mm.isPromise)(o))throw new Error(ga.ASYNC_UNBIND_REQUIRED)}},r.prototype._deactivateSingletonsAsync=function(e){return ws(this,void 0,void 0,function(){var t=this;return Es(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(i){return t._deactivateIfSingleton(i)}))];case 1:return n.sent(),[2]}})})},r.prototype._propagateContainerDeactivationThenBindingAndPreDestroy=function(e,t,n){return this.parent?this._deactivate.bind(this.parent)(e,t):this._bindingDeactivationAndPreDestroy(e,t,n)},r.prototype._propagateContainerDeactivationThenBindingAndPreDestroyAsync=function(e,t,n){return ws(this,void 0,void 0,function(){return Es(this,function(i){switch(i.label){case 0:return this.parent?[4,this._deactivate.bind(this.parent)(e,t)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,this._bindingDeactivationAndPreDestroyAsync(e,t,n)];case 3:i.sent(),i.label=4;case 4:return[2]}})})},r.prototype._removeServiceFromDictionary=function(e){try{this._bindingDictionary.remove(e)}catch{throw new Error(ga.CANNOT_UNBIND+" "+(0,wte.getServiceIdentifierAsString)(e))}},r.prototype._bindingDeactivationAndPreDestroy=function(e,t,n){var i=this;if(typeof e.onDeactivation=="function"){var o=e.onDeactivation(t);if((0,mm.isPromise)(o))return o.then(function(){return i._preDestroy(n,t)})}return this._preDestroy(n,t)},r.prototype._bindingDeactivationAndPreDestroyAsync=function(e,t,n){return ws(this,void 0,void 0,function(){return Es(this,function(i){switch(i.label){case 0:return typeof e.onDeactivation!="function"?[3,2]:[4,e.onDeactivation(t)];case 1:i.sent(),i.label=2;case 2:return[4,this._preDestroy(n,t)];case 3:return i.sent(),[2]}})})},r}();Zn.Container=Pte});var OW=N(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.AsyncContainerModule=Fh.ContainerModule=void 0;var MW=ip(),Dte=function(){function r(e){this.id=(0,MW.id)(),this.registry=e}return r}();Fh.ContainerModule=Dte;var _te=function(){function r(e){this.id=(0,MW.id)(),this.registry=e}return r}();Fh.AsyncContainerModule=_te});var KW=N(KE=>{"use strict";Object.defineProperty(KE,"__esModule",{value:!0});KE.getFirstArrayDuplicate=void 0;function Tte(r){for(var e=new Set,t=0,n=r;t<n.length;t++){var i=n[t];if(e.has(i))return i;e.add(i)}}KE.getFirstArrayDuplicate=Tte});var Kc=N(Ri=>{"use strict";var Rte=Ri&&Ri.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Ate=Ri&&Ri.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),LW=Ri&&Ri.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Rte(e,r,t);return Ate(e,r),e};Object.defineProperty(Ri,"__esModule",{value:!0});Ri.createTaggedDecorator=Ri.tagProperty=Ri.tagParameter=Ri.decorate=void 0;var FE=LW(Di()),UW=LW(_n()),Nte=KW();function Mte(r){return r.prototype!==void 0}function Ote(r){if(r!==void 0)throw new Error(FE.INVALID_DECORATOR_OPERATION)}function jW(r,e,t,n){Ote(e),VW(UW.TAGGED,r,t.toString(),n)}Ri.tagParameter=jW;function WW(r,e,t){if(Mte(r))throw new Error(FE.INVALID_DECORATOR_OPERATION);VW(UW.TAGGED_PROP,r.constructor,e,t)}Ri.tagProperty=WW;function Kte(r){var e=[];if(Array.isArray(r)){e=r;var t=(0,Nte.getFirstArrayDuplicate)(e.map(function(n){return n.key}));if(t!==void 0)throw new Error(FE.DUPLICATED_METADATA+" "+t.toString())}else e=[r];return e}function VW(r,e,t,n){var i=Kte(n),o={};Reflect.hasOwnMetadata(r,e)&&(o=Reflect.getMetadata(r,e));var s=o[t];if(s===void 0)s=[];else for(var a=function(p){if(i.some(function(f){return f.key===p.key}))throw new Error(FE.DUPLICATED_METADATA+" "+p.key.toString())},l=0,c=s;l<c.length;l++){var u=c[l];a(u)}s.push.apply(s,i),o[t]=s,Reflect.defineMetadata(r,o,e)}function Fte(r){return function(e,t,n){typeof n=="number"?jW(e,t,n,r):WW(e,t,r)}}Ri.createTaggedDecorator=Fte;function FW(r,e){Reflect.decorate(r,e)}function Lte(r,e){return function(t,n){e(t,n,r)}}function Ute(r,e,t){typeof t=="number"?FW([Lte(t,r)],e):typeof t=="string"?Reflect.decorate([r],e,t):FW([r],e)}Ri.decorate=Ute});var qW=N(cl=>{"use strict";var jte=cl&&cl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Wte=cl&&cl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),BW=cl&&cl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&jte(e,r,t);return Wte(e,r),e};Object.defineProperty(cl,"__esModule",{value:!0});cl.injectable=void 0;var Vte=BW(Di()),nN=BW(_n());function Bte(){return function(r){if(Reflect.hasOwnMetadata(nN.PARAM_TYPES,r))throw new Error(Vte.DUPLICATED_INJECTABLE_DECORATOR);var e=Reflect.getMetadata(nN.DESIGN_PARAM_TYPES,r)||[];return Reflect.defineMetadata(nN.PARAM_TYPES,e,r),r}}cl.injectable=Bte});var JW=N(LE=>{"use strict";Object.defineProperty(LE,"__esModule",{value:!0});LE.tagged=void 0;var qte=ha(),Jte=Kc();function $te(r,e){return(0,Jte.createTaggedDecorator)(new qte.Metadata(r,e))}LE.tagged=$te});var $W=N(ul=>{"use strict";var Hte=ul&&ul.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Gte=ul&&ul.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),zte=ul&&ul.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Hte(e,r,t);return Gte(e,r),e};Object.defineProperty(ul,"__esModule",{value:!0});ul.named=void 0;var Qte=zte(_n()),Yte=ha(),Xte=Kc();function Zte(r){return(0,Xte.createTaggedDecorator)(new Yte.Metadata(Qte.NAMED_TAG,r))}ul.named=Zte});var iN=N(UE=>{"use strict";Object.defineProperty(UE,"__esModule",{value:!0});UE.injectBase=void 0;var ere=Di(),tre=ha(),rre=Kc();function nre(r){return function(e){return function(t,n,i){if(e===void 0){var o=typeof t=="function"?t.name:t.constructor.name;throw new Error((0,ere.UNDEFINED_INJECT_ANNOTATION)(o))}return(0,rre.createTaggedDecorator)(new tre.Metadata(r,e))(t,n,i)}}}UE.injectBase=nre});var HW=N(pl=>{"use strict";var ire=pl&&pl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),ore=pl&&pl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),sre=pl&&pl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ire(e,r,t);return ore(e,r),e};Object.defineProperty(pl,"__esModule",{value:!0});pl.inject=void 0;var are=sre(_n()),lre=iN(),cre=(0,lre.injectBase)(are.INJECT_TAG);pl.inject=cre});var GW=N(dl=>{"use strict";var ure=dl&&dl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),pre=dl&&dl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),dre=dl&&dl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&ure(e,r,t);return pre(e,r),e};Object.defineProperty(dl,"__esModule",{value:!0});dl.optional=void 0;var mre=dre(_n()),fre=ha(),hre=Kc();function gre(){return(0,hre.createTaggedDecorator)(new fre.Metadata(mre.OPTIONAL_TAG,!0))}dl.optional=gre});var zW=N(ml=>{"use strict";var vre=ml&&ml.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),yre=ml&&ml.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),bre=ml&&ml.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&vre(e,r,t);return yre(e,r),e};Object.defineProperty(ml,"__esModule",{value:!0});ml.unmanaged=void 0;var Ire=bre(_n()),Sre=ha(),xre=Kc();function Cre(){return function(r,e,t){var n=new Sre.Metadata(Ire.UNMANAGED_TAG,!0);(0,xre.tagParameter)(r,e,t,n)}}ml.unmanaged=Cre});var QW=N(fl=>{"use strict";var wre=fl&&fl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Ere=fl&&fl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),kre=fl&&fl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&wre(e,r,t);return Ere(e,r),e};Object.defineProperty(fl,"__esModule",{value:!0});fl.multiInject=void 0;var Pre=kre(_n()),Dre=iN(),_re=(0,Dre.injectBase)(Pre.MULTI_INJECT_TAG);fl.multiInject=_re});var YW=N(hl=>{"use strict";var Tre=hl&&hl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Rre=hl&&hl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Are=hl&&hl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Tre(e,r,t);return Rre(e,r),e};Object.defineProperty(hl,"__esModule",{value:!0});hl.targetName=void 0;var Nre=Are(_n()),Mre=ha(),Ore=Kc();function Kre(r){return function(e,t,n){var i=new Mre.Metadata(Nre.NAME_TAG,r);(0,Ore.tagParameter)(e,t,n,i)}}hl.targetName=Kre});var oN=N(jE=>{"use strict";Object.defineProperty(jE,"__esModule",{value:!0});jE.propertyEventDecorator=void 0;var Fre=ha();function Lre(r,e){return function(){return function(t,n){var i=new Fre.Metadata(r,n);if(Reflect.hasOwnMetadata(r,t.constructor))throw new Error(e);Reflect.defineMetadata(r,i,t.constructor)}}}jE.propertyEventDecorator=Lre});var ZW=N(gl=>{"use strict";var Ure=gl&&gl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),jre=gl&&gl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),XW=gl&&gl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Ure(e,r,t);return jre(e,r),e};Object.defineProperty(gl,"__esModule",{value:!0});gl.postConstruct=void 0;var Wre=XW(Di()),Vre=XW(_n()),Bre=oN(),qre=(0,Bre.propertyEventDecorator)(Vre.POST_CONSTRUCT,Wre.MULTIPLE_POST_CONSTRUCT_METHODS);gl.postConstruct=qre});var tV=N(vl=>{"use strict";var Jre=vl&&vl.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),$re=vl&&vl.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),eV=vl&&vl.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Jre(e,r,t);return $re(e,r),e};Object.defineProperty(vl,"__esModule",{value:!0});vl.preDestroy=void 0;var Hre=eV(Di()),Gre=eV(_n()),zre=oN(),Qre=(0,zre.propertyEventDecorator)(Gre.PRE_DESTROY,Hre.MULTIPLE_PRE_DESTROY_METHODS);vl.preDestroy=Qre});var rV=N(WE=>{"use strict";Object.defineProperty(WE,"__esModule",{value:!0});WE.interfaces=void 0;var sN;sN||(sN={});WE.interfaces=sN});var M=N(Ke=>{"use strict";var Yre=Ke&&Ke.__createBinding||(Object.create?function(r,e,t,n){n===void 0&&(n=t),Object.defineProperty(r,n,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]}),Xre=Ke&&Ke.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),Zre=Ke&&Ke.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&Yre(e,r,t);return Xre(e,r),e};Object.defineProperty(Ke,"__esModule",{value:!0});Ke.multiBindToService=Ke.getServiceIdentifierAsString=Ke.typeConstraint=Ke.namedConstraint=Ke.taggedConstraint=Ke.traverseAncerstors=Ke.decorate=Ke.interfaces=Ke.id=Ke.MetadataReader=Ke.preDestroy=Ke.postConstruct=Ke.targetName=Ke.multiInject=Ke.unmanaged=Ke.optional=Ke.LazyServiceIdentifer=Ke.inject=Ke.named=Ke.tagged=Ke.injectable=Ke.createTaggedDecorator=Ke.ContainerModule=Ke.AsyncContainerModule=Ke.TargetTypeEnum=Ke.BindingTypeEnum=Ke.BindingScopeEnum=Ke.Container=Ke.METADATA_KEY=void 0;var ene=Zre(_n());Ke.METADATA_KEY=ene;var tne=rN();Object.defineProperty(Ke,"Container",{enumerable:!0,get:function(){return tne.Container}});var aN=fa();Object.defineProperty(Ke,"BindingScopeEnum",{enumerable:!0,get:function(){return aN.BindingScopeEnum}});Object.defineProperty(Ke,"BindingTypeEnum",{enumerable:!0,get:function(){return aN.BindingTypeEnum}});Object.defineProperty(Ke,"TargetTypeEnum",{enumerable:!0,get:function(){return aN.TargetTypeEnum}});var nV=OW();Object.defineProperty(Ke,"AsyncContainerModule",{enumerable:!0,get:function(){return nV.AsyncContainerModule}});Object.defineProperty(Ke,"ContainerModule",{enumerable:!0,get:function(){return nV.ContainerModule}});var rne=Kc();Object.defineProperty(Ke,"createTaggedDecorator",{enumerable:!0,get:function(){return rne.createTaggedDecorator}});var nne=qW();Object.defineProperty(Ke,"injectable",{enumerable:!0,get:function(){return nne.injectable}});var ine=JW();Object.defineProperty(Ke,"tagged",{enumerable:!0,get:function(){return ine.tagged}});var one=$W();Object.defineProperty(Ke,"named",{enumerable:!0,get:function(){return one.named}});var sne=HW();Object.defineProperty(Ke,"inject",{enumerable:!0,get:function(){return sne.inject}});var ane=NA();Object.defineProperty(Ke,"LazyServiceIdentifer",{enumerable:!0,get:function(){return ane.LazyServiceIdentifer}});var lne=GW();Object.defineProperty(Ke,"optional",{enumerable:!0,get:function(){return lne.optional}});var cne=zW();Object.defineProperty(Ke,"unmanaged",{enumerable:!0,get:function(){return cne.unmanaged}});var une=QW();Object.defineProperty(Ke,"multiInject",{enumerable:!0,get:function(){return une.multiInject}});var pne=YW();Object.defineProperty(Ke,"targetName",{enumerable:!0,get:function(){return pne.targetName}});var dne=ZW();Object.defineProperty(Ke,"postConstruct",{enumerable:!0,get:function(){return dne.postConstruct}});var mne=tV();Object.defineProperty(Ke,"preDestroy",{enumerable:!0,get:function(){return mne.preDestroy}});var fne=RA();Object.defineProperty(Ke,"MetadataReader",{enumerable:!0,get:function(){return fne.MetadataReader}});var hne=ip();Object.defineProperty(Ke,"id",{enumerable:!0,get:function(){return hne.id}});var gne=rV();Object.defineProperty(Ke,"interfaces",{enumerable:!0,get:function(){return gne.interfaces}});var vne=Kc();Object.defineProperty(Ke,"decorate",{enumerable:!0,get:function(){return vne.decorate}});var VE=YA();Object.defineProperty(Ke,"traverseAncerstors",{enumerable:!0,get:function(){return VE.traverseAncerstors}});Object.defineProperty(Ke,"taggedConstraint",{enumerable:!0,get:function(){return VE.taggedConstraint}});Object.defineProperty(Ke,"namedConstraint",{enumerable:!0,get:function(){return VE.namedConstraint}});Object.defineProperty(Ke,"typeConstraint",{enumerable:!0,get:function(){return VE.typeConstraint}});var yne=Rh();Object.defineProperty(Ke,"getServiceIdentifierAsString",{enumerable:!0,get:function(){return yne.getServiceIdentifierAsString}});var bne=qA();Object.defineProperty(Ke,"multiBindToService",{enumerable:!0,get:function(){return bne.multiBindToService}})});var sV=N(sp=>{"use strict";Object.defineProperty(sp,"__esModule",{value:!0});sp.PythonExtension=sp.PVSC_EXTENSION_ID=void 0;var Sne=require("vscode");sp.PVSC_EXTENSION_ID="ms-python.python";var xne;(function(r){async function e(){let t=Sne.extensions.getExtension(sp.PVSC_EXTENSION_ID);if(t===void 0)throw new Error("Python extension is not installed or is disabled");return t.isActive||await t.activate(),t.exports}r.api=e})(xne=sp.PythonExtension||(sp.PythonExtension={}))});var fN=N((cwe,lV)=>{lV.exports=require("util").format});var wV=N(ox=>{ox.get=function(r){var e=Error.stackTraceLimit;Error.stackTraceLimit=1/0;var t={},n=Error.prepareStackTrace;Error.prepareStackTrace=function(o,s){return s},Error.captureStackTrace(t,r||ox.get);var i=t.stack;return Error.prepareStackTrace=n,Error.stackTraceLimit=e,i};ox.parse=function(r){if(!r.stack)return[];var e=this,t=r.stack.split(`
|
||
`).slice(1);return t.map(function(n){if(n.match(/^\s*[-]{4,}$/))return e._createParsedCallSite({fileName:n,lineNumber:null,functionName:null,typeName:null,methodName:null,columnNumber:null,native:null});var i=n.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/);if(i){var o=null,s=null,a=null,l=null,c=null,u=i[5]==="native";if(i[1]){a=i[1];var p=a.lastIndexOf(".");if(a[p-1]=="."&&p--,p>0){o=a.substr(0,p),s=a.substr(p+1);var f=o.indexOf(".Module");f>0&&(a=a.substr(f+1),o=o.substr(0,f))}l=null}s&&(l=o,c=s),s==="<anonymous>"&&(c=null,a=null);var g={fileName:i[2]||null,lineNumber:parseInt(i[3],10)||null,functionName:a,typeName:l,methodName:c,columnNumber:parseInt(i[4],10)||null,native:u};return e._createParsedCallSite(g)}}).filter(function(n){return!!n})};function ix(r){for(var e in r)this[e]=r[e]}var One=["this","typeName","functionName","methodName","fileName","lineNumber","columnNumber","function","evalOrigin"],Kne=["topLevel","eval","native","constructor"];One.forEach(function(r){ix.prototype[r]=null,ix.prototype["get"+r[0].toUpperCase()+r.substr(1)]=function(){return this[r]}});Kne.forEach(function(r){ix.prototype[r]=!1,ix.prototype["is"+r[0].toUpperCase()+r.substr(1)]=function(){return this[r]}});ox._createParsedCallSite=function(r){return new ix(r)}});var ig=N((kt,XV)=>{kt=XV.exports=Jt;var Sr;typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?Sr=function(){var r=Array.prototype.slice.call(arguments,0);r.unshift("SEMVER"),console.log.apply(console,r)}:Sr=function(){};kt.SEMVER_SPEC_VERSION="2.0.0";var lx=256,sk=Number.MAX_SAFE_INTEGER||9007199254740991,IN=16,Hse=lx-6,cx=kt.re=[],Lr=kt.safeRe=[],pe=kt.src=[],Vt=0,EN="[a-zA-Z0-9-]",SN=[["\\s",1],["\\d",lx],[EN,Hse]];function dk(r){for(var e=0;e<SN.length;e++){var t=SN[e][0],n=SN[e][1];r=r.split(t+"*").join(t+"{0,"+n+"}").split(t+"+").join(t+"{1,"+n+"}")}return r}var Yh=Vt++;pe[Yh]="0|[1-9]\\d*";var Xh=Vt++;pe[Xh]="\\d+";var kN=Vt++;pe[kN]="\\d*[a-zA-Z-]"+EN+"*";var LV=Vt++;pe[LV]="("+pe[Yh]+")\\.("+pe[Yh]+")\\.("+pe[Yh]+")";var UV=Vt++;pe[UV]="("+pe[Xh]+")\\.("+pe[Xh]+")\\.("+pe[Xh]+")";var xN=Vt++;pe[xN]="(?:"+pe[Yh]+"|"+pe[kN]+")";var CN=Vt++;pe[CN]="(?:"+pe[Xh]+"|"+pe[kN]+")";var PN=Vt++;pe[PN]="(?:-("+pe[xN]+"(?:\\."+pe[xN]+")*))";var DN=Vt++;pe[DN]="(?:-?("+pe[CN]+"(?:\\."+pe[CN]+")*))";var wN=Vt++;pe[wN]=EN+"+";var px=Vt++;pe[px]="(?:\\+("+pe[wN]+"(?:\\."+pe[wN]+")*))";var _N=Vt++,jV="v?"+pe[LV]+pe[PN]+"?"+pe[px]+"?";pe[_N]="^"+jV+"$";var TN="[v=\\s]*"+pe[UV]+pe[DN]+"?"+pe[px]+"?",RN=Vt++;pe[RN]="^"+TN+"$";var ng=Vt++;pe[ng]="((?:<|>)?=?)";var ak=Vt++;pe[ak]=pe[Xh]+"|x|X|\\*";var lk=Vt++;pe[lk]=pe[Yh]+"|x|X|\\*";var vm=Vt++;pe[vm]="[v=\\s]*("+pe[lk]+")(?:\\.("+pe[lk]+")(?:\\.("+pe[lk]+")(?:"+pe[PN]+")?"+pe[px]+"?)?)?";var eg=Vt++;pe[eg]="[v=\\s]*("+pe[ak]+")(?:\\.("+pe[ak]+")(?:\\.("+pe[ak]+")(?:"+pe[DN]+")?"+pe[px]+"?)?)?";var WV=Vt++;pe[WV]="^"+pe[ng]+"\\s*"+pe[vm]+"$";var VV=Vt++;pe[VV]="^"+pe[ng]+"\\s*"+pe[eg]+"$";var BV=Vt++;pe[BV]="(?:^|[^\\d])(\\d{1,"+IN+"})(?:\\.(\\d{1,"+IN+"}))?(?:\\.(\\d{1,"+IN+"}))?(?:$|[^\\d])";var mk=Vt++;pe[mk]="(?:~>?)";var tg=Vt++;pe[tg]="(\\s*)"+pe[mk]+"\\s+";cx[tg]=new RegExp(pe[tg],"g");Lr[tg]=new RegExp(dk(pe[tg]),"g");var Gse="$1~",qV=Vt++;pe[qV]="^"+pe[mk]+pe[vm]+"$";var JV=Vt++;pe[JV]="^"+pe[mk]+pe[eg]+"$";var fk=Vt++;pe[fk]="(?:\\^)";var rg=Vt++;pe[rg]="(\\s*)"+pe[fk]+"\\s+";cx[rg]=new RegExp(pe[rg],"g");Lr[rg]=new RegExp(dk(pe[rg]),"g");var zse="$1^",$V=Vt++;pe[$V]="^"+pe[fk]+pe[vm]+"$";var HV=Vt++;pe[HV]="^"+pe[fk]+pe[eg]+"$";var AN=Vt++;pe[AN]="^"+pe[ng]+"\\s*("+TN+")$|^$";var NN=Vt++;pe[NN]="^"+pe[ng]+"\\s*("+jV+")$|^$";var ym=Vt++;pe[ym]="(\\s*)"+pe[ng]+"\\s*("+TN+"|"+pe[vm]+")";cx[ym]=new RegExp(pe[ym],"g");Lr[ym]=new RegExp(dk(pe[ym]),"g");var Qse="$1$2$3",GV=Vt++;pe[GV]="^\\s*("+pe[vm]+")\\s+-\\s+("+pe[vm]+")\\s*$";var zV=Vt++;pe[zV]="^\\s*("+pe[eg]+")\\s+-\\s+("+pe[eg]+")\\s*$";var QV=Vt++;pe[QV]="(<|>)?=?\\s*\\*";for(Sl=0;Sl<Vt;Sl++)Sr(Sl,pe[Sl]),cx[Sl]||(cx[Sl]=new RegExp(pe[Sl]),Lr[Sl]=new RegExp(dk(pe[Sl])));var Sl;kt.parse=bm;function bm(r,e){if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),r instanceof Jt)return r;if(typeof r!="string"||r.length>lx)return null;var t=e.loose?Lr[RN]:Lr[_N];if(!t.test(r))return null;try{return new Jt(r,e)}catch{return null}}kt.valid=Yse;function Yse(r,e){var t=bm(r,e);return t?t.version:null}kt.clean=Xse;function Xse(r,e){var t=bm(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null}kt.SemVer=Jt;function Jt(r,e){if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),r instanceof Jt){if(r.loose===e.loose)return r;r=r.version}else if(typeof r!="string")throw new TypeError("Invalid Version: "+r);if(r.length>lx)throw new TypeError("version is longer than "+lx+" characters");if(!(this instanceof Jt))return new Jt(r,e);Sr("SemVer",r,e),this.options=e,this.loose=!!e.loose;var t=r.trim().match(e.loose?Lr[RN]:Lr[_N]);if(!t)throw new TypeError("Invalid Version: "+r);if(this.raw=r,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>sk||this.major<0)throw new TypeError("Invalid major version");if(this.minor>sk||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>sk||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map(function(n){if(/^[0-9]+$/.test(n)){var i=+n;if(i>=0&&i<sk)return i}return n}):this.prerelease=[],this.build=t[5]?t[5].split("."):[],this.format()}Jt.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version};Jt.prototype.toString=function(){return this.version};Jt.prototype.compare=function(r){return Sr("SemVer.compare",this.version,this.options,r),r instanceof Jt||(r=new Jt(r,this.options)),this.compareMain(r)||this.comparePre(r)};Jt.prototype.compareMain=function(r){return r instanceof Jt||(r=new Jt(r,this.options)),Zh(this.major,r.major)||Zh(this.minor,r.minor)||Zh(this.patch,r.patch)};Jt.prototype.comparePre=function(r){if(r instanceof Jt||(r=new Jt(r,this.options)),this.prerelease.length&&!r.prerelease.length)return-1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;var e=0;do{var t=this.prerelease[e],n=r.prerelease[e];if(Sr("prerelease compare",e,t,n),t===void 0&&n===void 0)return 0;if(n===void 0)return 1;if(t===void 0)return-1;if(t===n)continue;return Zh(t,n)}while(++e)};Jt.prototype.inc=function(r,e){switch(r){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",e),this.inc("pre",e);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":if(this.prerelease.length===0)this.prerelease=[0];else{for(var t=this.prerelease.length;--t>=0;)typeof this.prerelease[t]=="number"&&(this.prerelease[t]++,t=-2);t===-1&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+r)}return this.format(),this.raw=this.version,this};kt.inc=Zse;function Zse(r,e,t,n){typeof t=="string"&&(n=t,t=void 0);try{return new Jt(r,t).inc(e,n).version}catch{return null}}kt.diff=eae;function eae(r,e){if(MN(r,e))return null;var t=bm(r),n=bm(e),i="";if(t.prerelease.length||n.prerelease.length){i="pre";var o="prerelease"}for(var s in t)if((s==="major"||s==="minor"||s==="patch")&&t[s]!==n[s])return i+s;return o}kt.compareIdentifiers=Zh;var FV=/^[0-9]+$/;function Zh(r,e){var t=FV.test(r),n=FV.test(e);return t&&n&&(r=+r,e=+e),r===e?0:t&&!n?-1:n&&!t?1:r<e?-1:1}kt.rcompareIdentifiers=tae;function tae(r,e){return Zh(e,r)}kt.major=rae;function rae(r,e){return new Jt(r,e).major}kt.minor=nae;function nae(r,e){return new Jt(r,e).minor}kt.patch=iae;function iae(r,e){return new Jt(r,e).patch}kt.compare=jc;function jc(r,e,t){return new Jt(r,t).compare(new Jt(e,t))}kt.compareLoose=oae;function oae(r,e){return jc(r,e,!0)}kt.rcompare=sae;function sae(r,e,t){return jc(e,r,t)}kt.sort=aae;function aae(r,e){return r.sort(function(t,n){return kt.compare(t,n,e)})}kt.rsort=lae;function lae(r,e){return r.sort(function(t,n){return kt.rcompare(t,n,e)})}kt.gt=ux;function ux(r,e,t){return jc(r,e,t)>0}kt.lt=ck;function ck(r,e,t){return jc(r,e,t)<0}kt.eq=MN;function MN(r,e,t){return jc(r,e,t)===0}kt.neq=YV;function YV(r,e,t){return jc(r,e,t)!==0}kt.gte=ON;function ON(r,e,t){return jc(r,e,t)>=0}kt.lte=KN;function KN(r,e,t){return jc(r,e,t)<=0}kt.cmp=uk;function uk(r,e,t,n){switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return MN(r,t,n);case"!=":return YV(r,t,n);case">":return ux(r,t,n);case">=":return ON(r,t,n);case"<":return ck(r,t,n);case"<=":return KN(r,t,n);default:throw new TypeError("Invalid operator: "+e)}}kt.Comparator=Ds;function Ds(r,e){if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),r instanceof Ds){if(r.loose===!!e.loose)return r;r=r.value}if(!(this instanceof Ds))return new Ds(r,e);r=r.trim().split(/\s+/).join(" "),Sr("comparator",r,e),this.options=e,this.loose=!!e.loose,this.parse(r),this.semver===dx?this.value="":this.value=this.operator+this.semver.version,Sr("comp",this)}var dx={};Ds.prototype.parse=function(r){var e=this.options.loose?Lr[AN]:Lr[NN],t=r.match(e);if(!t)throw new TypeError("Invalid comparator: "+r);this.operator=t[1],this.operator==="="&&(this.operator=""),t[2]?this.semver=new Jt(t[2],this.options.loose):this.semver=dx};Ds.prototype.toString=function(){return this.value};Ds.prototype.test=function(r){return Sr("Comparator.test",r,this.options.loose),this.semver===dx?!0:(typeof r=="string"&&(r=new Jt(r,this.options)),uk(r,this.operator,this.semver,this.options))};Ds.prototype.intersects=function(r,e){if(!(r instanceof Ds))throw new TypeError("a Comparator is required");(!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1});var t;if(this.operator==="")return t=new un(r.value,e),pk(this.value,t,e);if(r.operator==="")return t=new un(this.value,e),pk(r.semver,t,e);var n=(this.operator===">="||this.operator===">")&&(r.operator===">="||r.operator===">"),i=(this.operator==="<="||this.operator==="<")&&(r.operator==="<="||r.operator==="<"),o=this.semver.version===r.semver.version,s=(this.operator===">="||this.operator==="<=")&&(r.operator===">="||r.operator==="<="),a=uk(this.semver,"<",r.semver,e)&&(this.operator===">="||this.operator===">")&&(r.operator==="<="||r.operator==="<"),l=uk(this.semver,">",r.semver,e)&&(this.operator==="<="||this.operator==="<")&&(r.operator===">="||r.operator===">");return n||i||o&&s||a||l};kt.Range=un;function un(r,e){if((!e||typeof e!="object")&&(e={loose:!!e,includePrerelease:!1}),r instanceof un)return r.loose===!!e.loose&&r.includePrerelease===!!e.includePrerelease?r:new un(r.raw,e);if(r instanceof Ds)return new un(r.value,e);if(!(this instanceof un))return new un(r,e);if(this.options=e,this.loose=!!e.loose,this.includePrerelease=!!e.includePrerelease,this.raw=r.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(function(t){return this.parseRange(t.trim())},this).filter(function(t){return t.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+this.raw);this.format()}un.prototype.format=function(){return this.range=this.set.map(function(r){return r.join(" ").trim()}).join("||").trim(),this.range};un.prototype.toString=function(){return this.range};un.prototype.parseRange=function(r){var e=this.options.loose,t=e?Lr[zV]:Lr[GV];r=r.replace(t,yae),Sr("hyphen replace",r),r=r.replace(Lr[ym],Qse),Sr("comparator trim",r,Lr[ym]),r=r.replace(Lr[tg],Gse),r=r.replace(Lr[rg],zse);var n=e?Lr[AN]:Lr[NN],i=r.split(" ").map(function(o){return uae(o,this.options)},this).join(" ").split(/\s+/);return this.options.loose&&(i=i.filter(function(o){return!!o.match(n)})),i=i.map(function(o){return new Ds(o,this.options)},this),i};un.prototype.intersects=function(r,e){if(!(r instanceof un))throw new TypeError("a Range is required");return this.set.some(function(t){return t.every(function(n){return r.set.some(function(i){return i.every(function(o){return n.intersects(o,e)})})})})};kt.toComparators=cae;function cae(r,e){return new un(r,e).set.map(function(t){return t.map(function(n){return n.value}).join(" ").trim().split(" ")})}function uae(r,e){return Sr("comp",r,e),r=mae(r,e),Sr("caret",r),r=pae(r,e),Sr("tildes",r),r=hae(r,e),Sr("xrange",r),r=vae(r,e),Sr("stars",r),r}function Xi(r){return!r||r.toLowerCase()==="x"||r==="*"}function pae(r,e){return r.trim().split(/\s+/).map(function(t){return dae(t,e)}).join(" ")}function dae(r,e){var t=e.loose?Lr[JV]:Lr[qV];return r.replace(t,function(n,i,o,s,a){Sr("tilde",r,n,i,o,s,a);var l;return Xi(i)?l="":Xi(o)?l=">="+i+".0.0 <"+(+i+1)+".0.0":Xi(s)?l=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0":a?(Sr("replaceTilde pr",a),l=">="+i+"."+o+"."+s+"-"+a+" <"+i+"."+(+o+1)+".0"):l=">="+i+"."+o+"."+s+" <"+i+"."+(+o+1)+".0",Sr("tilde return",l),l})}function mae(r,e){return r.trim().split(/\s+/).map(function(t){return fae(t,e)}).join(" ")}function fae(r,e){Sr("caret",r,e);var t=e.loose?Lr[HV]:Lr[$V];return r.replace(t,function(n,i,o,s,a){Sr("caret",r,n,i,o,s,a);var l;return Xi(i)?l="":Xi(o)?l=">="+i+".0.0 <"+(+i+1)+".0.0":Xi(s)?i==="0"?l=">="+i+"."+o+".0 <"+i+"."+(+o+1)+".0":l=">="+i+"."+o+".0 <"+(+i+1)+".0.0":a?(Sr("replaceCaret pr",a),i==="0"?o==="0"?l=">="+i+"."+o+"."+s+"-"+a+" <"+i+"."+o+"."+(+s+1):l=">="+i+"."+o+"."+s+"-"+a+" <"+i+"."+(+o+1)+".0":l=">="+i+"."+o+"."+s+"-"+a+" <"+(+i+1)+".0.0"):(Sr("no pr"),i==="0"?o==="0"?l=">="+i+"."+o+"."+s+" <"+i+"."+o+"."+(+s+1):l=">="+i+"."+o+"."+s+" <"+i+"."+(+o+1)+".0":l=">="+i+"."+o+"."+s+" <"+(+i+1)+".0.0"),Sr("caret return",l),l})}function hae(r,e){return Sr("replaceXRanges",r,e),r.split(/\s+/).map(function(t){return gae(t,e)}).join(" ")}function gae(r,e){r=r.trim();var t=e.loose?Lr[VV]:Lr[WV];return r.replace(t,function(n,i,o,s,a,l){Sr("xRange",r,n,i,o,s,a,l);var c=Xi(o),u=c||Xi(s),p=u||Xi(a),f=p;return i==="="&&f&&(i=""),c?i===">"||i==="<"?n="<0.0.0":n="*":i&&f?(u&&(s=0),a=0,i===">"?(i=">=",u?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",u?o=+o+1:s=+s+1),n=i+o+"."+s+"."+a):u?n=">="+o+".0.0 <"+(+o+1)+".0.0":p&&(n=">="+o+"."+s+".0 <"+o+"."+(+s+1)+".0"),Sr("xRange return",n),n})}function vae(r,e){return Sr("replaceStars",r,e),r.trim().replace(Lr[QV],"")}function yae(r,e,t,n,i,o,s,a,l,c,u,p,f){return Xi(t)?e="":Xi(n)?e=">="+t+".0.0":Xi(i)?e=">="+t+"."+n+".0":e=">="+e,Xi(l)?a="":Xi(c)?a="<"+(+l+1)+".0.0":Xi(u)?a="<"+l+"."+(+c+1)+".0":p?a="<="+l+"."+c+"."+u+"-"+p:a="<="+a,(e+" "+a).trim()}un.prototype.test=function(r){if(!r)return!1;typeof r=="string"&&(r=new Jt(r,this.options));for(var e=0;e<this.set.length;e++)if(bae(this.set[e],r,this.options))return!0;return!1};function bae(r,e,t){for(var n=0;n<r.length;n++)if(!r[n].test(e))return!1;if(e.prerelease.length&&!t.includePrerelease){for(n=0;n<r.length;n++)if(Sr(r[n].semver),r[n].semver!==dx&&r[n].semver.prerelease.length>0){var i=r[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}kt.satisfies=pk;function pk(r,e,t){try{e=new un(e,t)}catch{return!1}return e.test(r)}kt.maxSatisfying=Iae;function Iae(r,e,t){var n=null,i=null;try{var o=new un(e,t)}catch{return null}return r.forEach(function(s){o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new Jt(n,t))}),n}kt.minSatisfying=Sae;function Sae(r,e,t){var n=null,i=null;try{var o=new un(e,t)}catch{return null}return r.forEach(function(s){o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new Jt(n,t))}),n}kt.minVersion=xae;function xae(r,e){r=new un(r,e);var t=new Jt("0.0.0");if(r.test(t)||(t=new Jt("0.0.0-0"),r.test(t)))return t;t=null;for(var n=0;n<r.set.length;++n){var i=r.set[n];i.forEach(function(o){var s=new Jt(o.semver.version);switch(o.operator){case">":s.prerelease.length===0?s.patch++:s.prerelease.push(0),s.raw=s.format();case"":case">=":(!t||ux(t,s))&&(t=s);break;case"<":case"<=":break;default:throw new Error("Unexpected operation: "+o.operator)}})}return t&&r.test(t)?t:null}kt.validRange=Cae;function Cae(r,e){try{return new un(r,e).range||"*"}catch{return null}}kt.ltr=wae;function wae(r,e,t){return FN(r,e,"<",t)}kt.gtr=Eae;function Eae(r,e,t){return FN(r,e,">",t)}kt.outside=FN;function FN(r,e,t,n){r=new Jt(r,n),e=new un(e,n);var i,o,s,a,l;switch(t){case">":i=ux,o=KN,s=ck,a=">",l=">=";break;case"<":i=ck,o=ON,s=ux,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(pk(r,e,n))return!1;for(var c=0;c<e.set.length;++c){var u=e.set[c],p=null,f=null;if(u.forEach(function(g){g.semver===dx&&(g=new Ds(">=0.0.0")),p=p||g,f=f||g,i(g.semver,p.semver,n)?p=g:s(g.semver,f.semver,n)&&(f=g)}),p.operator===a||p.operator===l||(!f.operator||f.operator===a)&&o(r,f.semver))return!1;if(f.operator===l&&s(r,f.semver))return!1}return!0}kt.prerelease=kae;function kae(r,e){var t=bm(r,e);return t&&t.prerelease.length?t.prerelease:null}kt.intersects=Pae;function Pae(r,e,t){return r=new un(r,t),e=new un(e,t),r.intersects(e)}kt.coerce=Dae;function Dae(r){if(r instanceof Jt)return r;if(typeof r!="string")return null;var e=r.match(Lr[BV]);return e==null?null:bm(e[1]+"."+(e[2]||"0")+"."+(e[3]||"0"))}});var b9=N((yPe,y9)=>{"use strict";y9.exports=function(e,t){if(t=t.split(":")[0],e=+e,!e)return!1;switch(t){case"http":case"ws":return e!==80;case"https":case"wss":return e!==443;case"ftp":return e!==21;case"gopher":return e!==70;case"file":return!1}return e!==0}});var x9=N(BN=>{"use strict";var Bae=Object.prototype.hasOwnProperty,qae;function I9(r){try{return decodeURIComponent(r.replace(/\+/g," "))}catch{return null}}function S9(r){try{return encodeURIComponent(r)}catch{return null}}function Jae(r){for(var e=/([^=?#&]+)=?([^&]*)/g,t={},n;n=e.exec(r);){var i=I9(n[1]),o=I9(n[2]);i===null||o===null||i in t||(t[i]=o)}return t}function $ae(r,e){e=e||"";var t=[],n,i;typeof e!="string"&&(e="?");for(i in r)if(Bae.call(r,i)){if(n=r[i],!n&&(n===null||n===qae||isNaN(n))&&(n=""),i=S9(i),n=S9(n),i===null||n===null)continue;t.push(i+"="+n)}return t.length?e+t.join("&"):""}BN.stringify=$ae;BN.parse=Jae});var T9=N((IPe,_9)=>{"use strict";var w9=b9(),Tk=x9(),Hae=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,E9=/[\n\r\t]/g,Gae=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,k9=/:\d+$/,zae=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,Qae=/^[a-zA-Z]:/;function JN(r){return(r||"").toString().replace(Hae,"")}var qN=[["#","hash"],["?","query"],function(e,t){return wl(t.protocol)?e.replace(/\\/g,"/"):e},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],C9={hash:1,query:1};function P9(r){var e;typeof window<"u"?e=window:typeof global<"u"?e=global:typeof self<"u"?e=self:e={};var t=e.location||{};r=r||t;var n={},i=typeof r,o;if(r.protocol==="blob:")n=new El(unescape(r.pathname),{});else if(i==="string"){n=new El(r,{});for(o in C9)delete n[o]}else if(i==="object"){for(o in r)o in C9||(n[o]=r[o]);n.slashes===void 0&&(n.slashes=Gae.test(r.href))}return n}function wl(r){return r==="file:"||r==="ftp:"||r==="http:"||r==="https:"||r==="ws:"||r==="wss:"}function D9(r,e){r=JN(r),r=r.replace(E9,""),e=e||{};var t=zae.exec(r),n=t[1]?t[1].toLowerCase():"",i=!!t[2],o=!!t[3],s=0,a;return i?o?(a=t[2]+t[3]+t[4],s=t[2].length+t[3].length):(a=t[2]+t[4],s=t[2].length):o?(a=t[3]+t[4],s=t[3].length):a=t[4],n==="file:"?s>=2&&(a=a.slice(2)):wl(n)?a=t[4]:n?i&&(a=a.slice(2)):s>=2&&wl(e.protocol)&&(a=t[4]),{protocol:n,slashes:i||wl(n),slashesCount:s,rest:a}}function Yae(r,e){if(r==="")return e;for(var t=(e||"/").split("/").slice(0,-1).concat(r.split("/")),n=t.length,i=t[n-1],o=!1,s=0;n--;)t[n]==="."?t.splice(n,1):t[n]===".."?(t.splice(n,1),s++):s&&(n===0&&(o=!0),t.splice(n,1),s--);return o&&t.unshift(""),(i==="."||i==="..")&&t.push(""),t.join("/")}function El(r,e,t){if(r=JN(r),r=r.replace(E9,""),!(this instanceof El))return new El(r,e,t);var n,i,o,s,a,l,c=qN.slice(),u=typeof e,p=this,f=0;for(u!=="object"&&u!=="string"&&(t=e,e=null),t&&typeof t!="function"&&(t=Tk.parse),e=P9(e),i=D9(r||"",e),n=!i.protocol&&!i.slashes,p.slashes=i.slashes||n&&e.slashes,p.protocol=i.protocol||e.protocol||"",r=i.rest,(i.protocol==="file:"&&(i.slashesCount!==2||Qae.test(r))||!i.slashes&&(i.protocol||i.slashesCount<2||!wl(p.protocol)))&&(c[3]=[/(.*)/,"pathname"]);f<c.length;f++){if(s=c[f],typeof s=="function"){r=s(r,p);continue}o=s[0],l=s[1],o!==o?p[l]=r:typeof o=="string"?(a=o==="@"?r.lastIndexOf(o):r.indexOf(o),~a&&(typeof s[2]=="number"?(p[l]=r.slice(0,a),r=r.slice(a+s[2])):(p[l]=r.slice(a),r=r.slice(0,a)))):(a=o.exec(r))&&(p[l]=a[1],r=r.slice(0,a.index)),p[l]=p[l]||n&&s[3]&&e[l]||"",s[4]&&(p[l]=p[l].toLowerCase())}t&&(p.query=t(p.query)),n&&e.slashes&&p.pathname.charAt(0)!=="/"&&(p.pathname!==""||e.pathname!=="")&&(p.pathname=Yae(p.pathname,e.pathname)),p.pathname.charAt(0)!=="/"&&wl(p.protocol)&&(p.pathname="/"+p.pathname),w9(p.port,p.protocol)||(p.host=p.hostname,p.port=""),p.username=p.password="",p.auth&&(a=p.auth.indexOf(":"),~a?(p.username=p.auth.slice(0,a),p.username=encodeURIComponent(decodeURIComponent(p.username)),p.password=p.auth.slice(a+1),p.password=encodeURIComponent(decodeURIComponent(p.password))):p.username=encodeURIComponent(decodeURIComponent(p.auth)),p.auth=p.password?p.username+":"+p.password:p.username),p.origin=p.protocol!=="file:"&&wl(p.protocol)&&p.host?p.protocol+"//"+p.host:"null",p.href=p.toString()}function Xae(r,e,t){var n=this;switch(r){case"query":typeof e=="string"&&e.length&&(e=(t||Tk.parse)(e)),n[r]=e;break;case"port":n[r]=e,w9(e,n.protocol)?e&&(n.host=n.hostname+":"+e):(n.host=n.hostname,n[r]="");break;case"hostname":n[r]=e,n.port&&(e+=":"+n.port),n.host=e;break;case"host":n[r]=e,k9.test(e)?(e=e.split(":"),n.port=e.pop(),n.hostname=e.join(":")):(n.hostname=e,n.port="");break;case"protocol":n.protocol=e.toLowerCase(),n.slashes=!t;break;case"pathname":case"hash":if(e){var i=r==="pathname"?"/":"#";n[r]=e.charAt(0)!==i?i+e:e}else n[r]=e;break;case"username":case"password":n[r]=encodeURIComponent(e);break;case"auth":var o=e.indexOf(":");~o?(n.username=e.slice(0,o),n.username=encodeURIComponent(decodeURIComponent(n.username)),n.password=e.slice(o+1),n.password=encodeURIComponent(decodeURIComponent(n.password))):n.username=encodeURIComponent(decodeURIComponent(e))}for(var s=0;s<qN.length;s++){var a=qN[s];a[4]&&(n[a[1]]=n[a[1]].toLowerCase())}return n.auth=n.password?n.username+":"+n.password:n.username,n.origin=n.protocol!=="file:"&&wl(n.protocol)&&n.host?n.protocol+"//"+n.host:"null",n.href=n.toString(),n}function Zae(r){(!r||typeof r!="function")&&(r=Tk.stringify);var e,t=this,n=t.host,i=t.protocol;i&&i.charAt(i.length-1)!==":"&&(i+=":");var o=i+(t.protocol&&t.slashes||wl(t.protocol)?"//":"");return t.username?(o+=t.username,t.password&&(o+=":"+t.password),o+="@"):t.password?(o+=":"+t.password,o+="@"):t.protocol!=="file:"&&wl(t.protocol)&&!n&&t.pathname!=="/"&&(o+="@"),(n[n.length-1]===":"||k9.test(t.hostname)&&!t.port)&&(n+=":"),o+=n+t.pathname,e=typeof t.query=="object"?r(t.query):t.query,e&&(o+=e.charAt(0)!=="?"?"?"+e:e),t.hash&&(o+=t.hash),o}El.prototype={set:Xae,toString:Zae};El.extractProtocol=D9;El.location=P9;El.trimLeft=JN;El.qs=Tk;_9.exports=El});var $N=N((xPe,N9)=>{"use strict";var R9=Array.isArray,A9=Object.keys,ele=Object.prototype.hasOwnProperty;N9.exports=function r(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=R9(e),i=R9(t),o,s,a;if(n&&i){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!r(e[o],t[o]))return!1;return!0}if(n!=i)return!1;var l=e instanceof Date,c=t instanceof Date;if(l!=c)return!1;if(l&&c)return e.getTime()==t.getTime();var u=e instanceof RegExp,p=t instanceof RegExp;if(u!=p)return!1;if(u&&p)return e.toString()==t.toString();var f=A9(e);if(s=f.length,s!==A9(t).length)return!1;for(o=s;o--!==0;)if(!ele.call(t,f[o]))return!1;for(o=s;o--!==0;)if(a=f[o],!r(e[a],t[a]))return!1;return!0}return e!==e&&t!==t}});var pM=N(_p=>{"use strict";Object.defineProperty(_p,"__esModule",{value:!0});_p.TargetPopulation=_p.Filters=_p.VSCodeFilterProvider=void 0;var aP=require("vscode"),uM=class r{constructor(e,t,n){this.extensionName=e,this.extensionVersion=t,this.targetPopulation=n}static trimVersionSuffix(e){let t=/\-[a-zA-Z0-9]+$/;return e.split(t)[0]}getFilterValue(e){switch(e){case Kl.ApplicationVersion:return r.trimVersionSuffix(aP.version);case Kl.Build:return aP.env.appName;case Kl.ClientId:return aP.env.machineId;case Kl.ExtensionName:return this.extensionName;case Kl.ExtensionVersion:return r.trimVersionSuffix(this.extensionVersion);case Kl.Language:return aP.env.language;case Kl.TargetPopulation:return this.targetPopulation;default:return""}}getFilters(){let e=new Map,t=Object.values(Kl);for(let n of t)e.set(n,this.getFilterValue(n));return e}};_p.VSCodeFilterProvider=uM;var Kl;(function(r){r.Market="X-MSEdge-Market",r.CorpNet="X-FD-Corpnet",r.ApplicationVersion="X-VSCode-AppVersion",r.Build="X-VSCode-Build",r.ClientId="X-MSEdge-ClientId",r.ExtensionName="X-VSCode-ExtensionName",r.ExtensionVersion="X-VSCode-ExtensionVersion",r.Language="X-VSCode-Language",r.TargetPopulation="X-VSCode-TargetPopulation"})(Kl||(_p.Filters=Kl={}));var A3;(function(r){r.Team="team",r.Internal="internal",r.Insiders="insider",r.Public="public"})(A3||(_p.TargetPopulation=A3={}))});var N3=N(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});lP.BaseFeatureProvider=void 0;var dM=class{constructor(e){this.telemetry=e,this.isFetching=!1}async getFeatures(){if(this.isFetching&&this.fetchPromise)return this.fetchPromise;this.fetchPromise=this.fetch();let e=await this.fetchPromise;return this.isFetching=!1,this.fetchPromise=void 0,e}};lP.BaseFeatureProvider=dM});var M3=N(cP=>{"use strict";Object.defineProperty(cP,"__esModule",{value:!0});cP.FilteredFeatureProvider=void 0;var wle=N3(),mM=class extends wle.BaseFeatureProvider{constructor(e,t){super(e),this.telemetry=e,this.filterProviders=t,this.cachedTelemetryEvents=[]}getFilters(){let e=new Map;for(let t of this.filterProviders){let n=t.getFilters();for(let i of n.keys()){let o=n.get(i);e.set(i,o)}}return e}PostEventToTelemetry(e){if(this.cachedTelemetryEvents.includes(e))return;let t=JSON.stringify(e);this.telemetry.postEvent("report-headers",new Map([["ABExp.headers",t]])),this.cachedTelemetryEvents.push(e)}};cP.FilteredFeatureProvider=mM});var O3=N(Tp=>{"use strict";Object.defineProperty(Tp,"__esModule",{value:!0});Tp.TasApiFeatureProvider=Tp.TASAPI_FETCHERROR_EVENTNAME=void 0;var Ele=M3();Tp.TASAPI_FETCHERROR_EVENTNAME="call-tas-error";var fM="ErrorType",hM=class extends Ele.FilteredFeatureProvider{constructor(e,t,n){super(t,n),this.httpClient=e,this.telemetry=t,this.filterProviders=n}async fetch(){let e=this.getFilters(),t={};for(let a of e.keys()){let l=e.get(a);t[a]=l}let n;try{n=await this.httpClient.get({headers:t})}catch(a){let l=a,c=new Map;l.response?c.set(fM,"ServerError"):l.request?c.set(fM,"NoResponse"):c.set(fM,"GenericError"),this.telemetry.postEvent(Tp.TASAPI_FETCHERROR_EVENTNAME,c)}if(!n)throw Error(Tp.TASAPI_FETCHERROR_EVENTNAME);e.keys.length>0&&this.PostEventToTelemetry(t);let i=n.data,o=i.Configs,s=[];for(let a of o)if(a.Parameters)for(let l of Object.keys(a.Parameters)){let c=l+(a.Parameters[l]?"":"cf");s.includes(c)||s.push(c)}return{features:s,assignmentContext:i.AssignmentContext,configs:o}}};Tp.TasApiFeatureProvider=hM});var L3=N((H1e,F3)=>{var K3=require("stream").Stream,kle=require("util");F3.exports=xa;function xa(){this.source=null,this.dataSize=0,this.maxDataSize=1024*1024,this.pauseStream=!0,this._maxDataSizeExceeded=!1,this._released=!1,this._bufferedEvents=[]}kle.inherits(xa,K3);xa.create=function(r,e){var t=new this;e=e||{};for(var n in e)t[n]=e[n];t.source=r;var i=r.emit;return r.emit=function(){return t._handleEmit(arguments),i.apply(r,arguments)},r.on("error",function(){}),t.pauseStream&&r.pause(),t};Object.defineProperty(xa.prototype,"readable",{configurable:!0,enumerable:!0,get:function(){return this.source.readable}});xa.prototype.setEncoding=function(){return this.source.setEncoding.apply(this.source,arguments)};xa.prototype.resume=function(){this._released||this.release(),this.source.resume()};xa.prototype.pause=function(){this.source.pause()};xa.prototype.release=function(){this._released=!0,this._bufferedEvents.forEach(function(r){this.emit.apply(this,r)}.bind(this)),this._bufferedEvents=[]};xa.prototype.pipe=function(){var r=K3.prototype.pipe.apply(this,arguments);return this.resume(),r};xa.prototype._handleEmit=function(r){if(this._released){this.emit.apply(this,r);return}r[0]==="data"&&(this.dataSize+=r[1].length,this._checkIfMaxDataSizeExceeded()),this._bufferedEvents.push(r)};xa.prototype._checkIfMaxDataSizeExceeded=function(){if(!this._maxDataSizeExceeded&&!(this.dataSize<=this.maxDataSize)){this._maxDataSizeExceeded=!0;var r="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this.emit("error",new Error(r))}}});var V3=N((G1e,W3)=>{var Ple=require("util"),j3=require("stream").Stream,U3=L3();W3.exports=In;function In(){this.writable=!1,this.readable=!0,this.dataSize=0,this.maxDataSize=2*1024*1024,this.pauseStreams=!0,this._released=!1,this._streams=[],this._currentStream=null,this._insideLoop=!1,this._pendingNext=!1}Ple.inherits(In,j3);In.create=function(r){var e=new this;r=r||{};for(var t in r)e[t]=r[t];return e};In.isStreamLike=function(r){return typeof r!="function"&&typeof r!="string"&&typeof r!="boolean"&&typeof r!="number"&&!Buffer.isBuffer(r)};In.prototype.append=function(r){var e=In.isStreamLike(r);if(e){if(!(r instanceof U3)){var t=U3.create(r,{maxDataSize:1/0,pauseStream:this.pauseStreams});r.on("data",this._checkDataSize.bind(this)),r=t}this._handleErrors(r),this.pauseStreams&&r.pause()}return this._streams.push(r),this};In.prototype.pipe=function(r,e){return j3.prototype.pipe.call(this,r,e),this.resume(),r};In.prototype._getNext=function(){if(this._currentStream=null,this._insideLoop){this._pendingNext=!0;return}this._insideLoop=!0;try{do this._pendingNext=!1,this._realGetNext();while(this._pendingNext)}finally{this._insideLoop=!1}};In.prototype._realGetNext=function(){var r=this._streams.shift();if(typeof r>"u"){this.end();return}if(typeof r!="function"){this._pipeNext(r);return}var e=r;e(function(t){var n=In.isStreamLike(t);n&&(t.on("data",this._checkDataSize.bind(this)),this._handleErrors(t)),this._pipeNext(t)}.bind(this))};In.prototype._pipeNext=function(r){this._currentStream=r;var e=In.isStreamLike(r);if(e){r.on("end",this._getNext.bind(this)),r.pipe(this,{end:!1});return}var t=r;this.write(t),this._getNext()};In.prototype._handleErrors=function(r){var e=this;r.on("error",function(t){e._emitError(t)})};In.prototype.write=function(r){this.emit("data",r)};In.prototype.pause=function(){this.pauseStreams&&(this.pauseStreams&&this._currentStream&&typeof this._currentStream.pause=="function"&&this._currentStream.pause(),this.emit("pause"))};In.prototype.resume=function(){this._released||(this._released=!0,this.writable=!0,this._getNext()),this.pauseStreams&&this._currentStream&&typeof this._currentStream.resume=="function"&&this._currentStream.resume(),this.emit("resume")};In.prototype.end=function(){this._reset(),this.emit("end")};In.prototype.destroy=function(){this._reset(),this.emit("close")};In.prototype._reset=function(){this.writable=!1,this._streams=[],this._currentStream=null};In.prototype._checkDataSize=function(){if(this._updateDataSize(),!(this.dataSize<=this.maxDataSize)){var r="DelayedStream#maxDataSize of "+this.maxDataSize+" bytes exceeded.";this._emitError(new Error(r))}};In.prototype._updateDataSize=function(){this.dataSize=0;var r=this;this._streams.forEach(function(e){e.dataSize&&(r.dataSize+=e.dataSize)}),this._currentStream&&this._currentStream.dataSize&&(this.dataSize+=this._currentStream.dataSize)};In.prototype._emitError=function(r){this._reset(),this.emit("error",r)}});var B3=N((z1e,Dle)=>{Dle.exports={"application/1d-interleaved-parityfec":{source:"iana"},"application/3gpdash-qoe-report+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/3gpp-ims+xml":{source:"iana",compressible:!0},"application/3gpphal+json":{source:"iana",compressible:!0},"application/3gpphalforms+json":{source:"iana",compressible:!0},"application/a2l":{source:"iana"},"application/ace+cbor":{source:"iana"},"application/activemessage":{source:"iana"},"application/activity+json":{source:"iana",compressible:!0},"application/alto-costmap+json":{source:"iana",compressible:!0},"application/alto-costmapfilter+json":{source:"iana",compressible:!0},"application/alto-directory+json":{source:"iana",compressible:!0},"application/alto-endpointcost+json":{source:"iana",compressible:!0},"application/alto-endpointcostparams+json":{source:"iana",compressible:!0},"application/alto-endpointprop+json":{source:"iana",compressible:!0},"application/alto-endpointpropparams+json":{source:"iana",compressible:!0},"application/alto-error+json":{source:"iana",compressible:!0},"application/alto-networkmap+json":{source:"iana",compressible:!0},"application/alto-networkmapfilter+json":{source:"iana",compressible:!0},"application/alto-updatestreamcontrol+json":{source:"iana",compressible:!0},"application/alto-updatestreamparams+json":{source:"iana",compressible:!0},"application/aml":{source:"iana"},"application/andrew-inset":{source:"iana",extensions:["ez"]},"application/applefile":{source:"iana"},"application/applixware":{source:"apache",extensions:["aw"]},"application/at+jwt":{source:"iana"},"application/atf":{source:"iana"},"application/atfx":{source:"iana"},"application/atom+xml":{source:"iana",compressible:!0,extensions:["atom"]},"application/atomcat+xml":{source:"iana",compressible:!0,extensions:["atomcat"]},"application/atomdeleted+xml":{source:"iana",compressible:!0,extensions:["atomdeleted"]},"application/atomicmail":{source:"iana"},"application/atomsvc+xml":{source:"iana",compressible:!0,extensions:["atomsvc"]},"application/atsc-dwd+xml":{source:"iana",compressible:!0,extensions:["dwd"]},"application/atsc-dynamic-event-message":{source:"iana"},"application/atsc-held+xml":{source:"iana",compressible:!0,extensions:["held"]},"application/atsc-rdt+json":{source:"iana",compressible:!0},"application/atsc-rsat+xml":{source:"iana",compressible:!0,extensions:["rsat"]},"application/atxml":{source:"iana"},"application/auth-policy+xml":{source:"iana",compressible:!0},"application/bacnet-xdd+zip":{source:"iana",compressible:!1},"application/batch-smtp":{source:"iana"},"application/bdoc":{compressible:!1,extensions:["bdoc"]},"application/beep+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/calendar+json":{source:"iana",compressible:!0},"application/calendar+xml":{source:"iana",compressible:!0,extensions:["xcs"]},"application/call-completion":{source:"iana"},"application/cals-1840":{source:"iana"},"application/captive+json":{source:"iana",compressible:!0},"application/cbor":{source:"iana"},"application/cbor-seq":{source:"iana"},"application/cccex":{source:"iana"},"application/ccmp+xml":{source:"iana",compressible:!0},"application/ccxml+xml":{source:"iana",compressible:!0,extensions:["ccxml"]},"application/cdfx+xml":{source:"iana",compressible:!0,extensions:["cdfx"]},"application/cdmi-capability":{source:"iana",extensions:["cdmia"]},"application/cdmi-container":{source:"iana",extensions:["cdmic"]},"application/cdmi-domain":{source:"iana",extensions:["cdmid"]},"application/cdmi-object":{source:"iana",extensions:["cdmio"]},"application/cdmi-queue":{source:"iana",extensions:["cdmiq"]},"application/cdni":{source:"iana"},"application/cea":{source:"iana"},"application/cea-2018+xml":{source:"iana",compressible:!0},"application/cellml+xml":{source:"iana",compressible:!0},"application/cfw":{source:"iana"},"application/city+json":{source:"iana",compressible:!0},"application/clr":{source:"iana"},"application/clue+xml":{source:"iana",compressible:!0},"application/clue_info+xml":{source:"iana",compressible:!0},"application/cms":{source:"iana"},"application/cnrp+xml":{source:"iana",compressible:!0},"application/coap-group+json":{source:"iana",compressible:!0},"application/coap-payload":{source:"iana"},"application/commonground":{source:"iana"},"application/conference-info+xml":{source:"iana",compressible:!0},"application/cose":{source:"iana"},"application/cose-key":{source:"iana"},"application/cose-key-set":{source:"iana"},"application/cpl+xml":{source:"iana",compressible:!0,extensions:["cpl"]},"application/csrattrs":{source:"iana"},"application/csta+xml":{source:"iana",compressible:!0},"application/cstadata+xml":{source:"iana",compressible:!0},"application/csvm+json":{source:"iana",compressible:!0},"application/cu-seeme":{source:"apache",extensions:["cu"]},"application/cwt":{source:"iana"},"application/cybercash":{source:"iana"},"application/dart":{compressible:!0},"application/dash+xml":{source:"iana",compressible:!0,extensions:["mpd"]},"application/dash-patch+xml":{source:"iana",compressible:!0,extensions:["mpp"]},"application/dashdelta":{source:"iana"},"application/davmount+xml":{source:"iana",compressible:!0,extensions:["davmount"]},"application/dca-rft":{source:"iana"},"application/dcd":{source:"iana"},"application/dec-dx":{source:"iana"},"application/dialog-info+xml":{source:"iana",compressible:!0},"application/dicom":{source:"iana"},"application/dicom+json":{source:"iana",compressible:!0},"application/dicom+xml":{source:"iana",compressible:!0},"application/dii":{source:"iana"},"application/dit":{source:"iana"},"application/dns":{source:"iana"},"application/dns+json":{source:"iana",compressible:!0},"application/dns-message":{source:"iana"},"application/docbook+xml":{source:"apache",compressible:!0,extensions:["dbk"]},"application/dots+cbor":{source:"iana"},"application/dskpp+xml":{source:"iana",compressible:!0},"application/dssc+der":{source:"iana",extensions:["dssc"]},"application/dssc+xml":{source:"iana",compressible:!0,extensions:["xdssc"]},"application/dvcs":{source:"iana"},"application/ecmascript":{source:"iana",compressible:!0,extensions:["es","ecma"]},"application/edi-consent":{source:"iana"},"application/edi-x12":{source:"iana",compressible:!1},"application/edifact":{source:"iana",compressible:!1},"application/efi":{source:"iana"},"application/elm+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/elm+xml":{source:"iana",compressible:!0},"application/emergencycalldata.cap+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/emergencycalldata.comment+xml":{source:"iana",compressible:!0},"application/emergencycalldata.control+xml":{source:"iana",compressible:!0},"application/emergencycalldata.deviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.ecall.msd":{source:"iana"},"application/emergencycalldata.providerinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.serviceinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.subscriberinfo+xml":{source:"iana",compressible:!0},"application/emergencycalldata.veds+xml":{source:"iana",compressible:!0},"application/emma+xml":{source:"iana",compressible:!0,extensions:["emma"]},"application/emotionml+xml":{source:"iana",compressible:!0,extensions:["emotionml"]},"application/encaprtp":{source:"iana"},"application/epp+xml":{source:"iana",compressible:!0},"application/epub+zip":{source:"iana",compressible:!1,extensions:["epub"]},"application/eshop":{source:"iana"},"application/exi":{source:"iana",extensions:["exi"]},"application/expect-ct-report+json":{source:"iana",compressible:!0},"application/express":{source:"iana",extensions:["exp"]},"application/fastinfoset":{source:"iana"},"application/fastsoap":{source:"iana"},"application/fdt+xml":{source:"iana",compressible:!0,extensions:["fdt"]},"application/fhir+json":{source:"iana",charset:"UTF-8",compressible:!0},"application/fhir+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/fido.trusted-apps+json":{compressible:!0},"application/fits":{source:"iana"},"application/flexfec":{source:"iana"},"application/font-sfnt":{source:"iana"},"application/font-tdpfr":{source:"iana",extensions:["pfr"]},"application/font-woff":{source:"iana",compressible:!1},"application/framework-attributes+xml":{source:"iana",compressible:!0},"application/geo+json":{source:"iana",compressible:!0,extensions:["geojson"]},"application/geo+json-seq":{source:"iana"},"application/geopackage+sqlite3":{source:"iana"},"application/geoxacml+xml":{source:"iana",compressible:!0},"application/gltf-buffer":{source:"iana"},"application/gml+xml":{source:"iana",compressible:!0,extensions:["gml"]},"application/gpx+xml":{source:"apache",compressible:!0,extensions:["gpx"]},"application/gxf":{source:"apache",extensions:["gxf"]},"application/gzip":{source:"iana",compressible:!1,extensions:["gz"]},"application/h224":{source:"iana"},"application/held+xml":{source:"iana",compressible:!0},"application/hjson":{extensions:["hjson"]},"application/http":{source:"iana"},"application/hyperstudio":{source:"iana",extensions:["stk"]},"application/ibe-key-request+xml":{source:"iana",compressible:!0},"application/ibe-pkg-reply+xml":{source:"iana",compressible:!0},"application/ibe-pp-data":{source:"iana"},"application/iges":{source:"iana"},"application/im-iscomposing+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/index":{source:"iana"},"application/index.cmd":{source:"iana"},"application/index.obj":{source:"iana"},"application/index.response":{source:"iana"},"application/index.vnd":{source:"iana"},"application/inkml+xml":{source:"iana",compressible:!0,extensions:["ink","inkml"]},"application/iotp":{source:"iana"},"application/ipfix":{source:"iana",extensions:["ipfix"]},"application/ipp":{source:"iana"},"application/isup":{source:"iana"},"application/its+xml":{source:"iana",compressible:!0,extensions:["its"]},"application/java-archive":{source:"apache",compressible:!1,extensions:["jar","war","ear"]},"application/java-serialized-object":{source:"apache",compressible:!1,extensions:["ser"]},"application/java-vm":{source:"apache",compressible:!1,extensions:["class"]},"application/javascript":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["js","mjs"]},"application/jf2feed+json":{source:"iana",compressible:!0},"application/jose":{source:"iana"},"application/jose+json":{source:"iana",compressible:!0},"application/jrd+json":{source:"iana",compressible:!0},"application/jscalendar+json":{source:"iana",compressible:!0},"application/json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["json","map"]},"application/json-patch+json":{source:"iana",compressible:!0},"application/json-seq":{source:"iana"},"application/json5":{extensions:["json5"]},"application/jsonml+json":{source:"apache",compressible:!0,extensions:["jsonml"]},"application/jwk+json":{source:"iana",compressible:!0},"application/jwk-set+json":{source:"iana",compressible:!0},"application/jwt":{source:"iana"},"application/kpml-request+xml":{source:"iana",compressible:!0},"application/kpml-response+xml":{source:"iana",compressible:!0},"application/ld+json":{source:"iana",compressible:!0,extensions:["jsonld"]},"application/lgr+xml":{source:"iana",compressible:!0,extensions:["lgr"]},"application/link-format":{source:"iana"},"application/load-control+xml":{source:"iana",compressible:!0},"application/lost+xml":{source:"iana",compressible:!0,extensions:["lostxml"]},"application/lostsync+xml":{source:"iana",compressible:!0},"application/lpf+zip":{source:"iana",compressible:!1},"application/lxf":{source:"iana"},"application/mac-binhex40":{source:"iana",extensions:["hqx"]},"application/mac-compactpro":{source:"apache",extensions:["cpt"]},"application/macwriteii":{source:"iana"},"application/mads+xml":{source:"iana",compressible:!0,extensions:["mads"]},"application/manifest+json":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["webmanifest"]},"application/marc":{source:"iana",extensions:["mrc"]},"application/marcxml+xml":{source:"iana",compressible:!0,extensions:["mrcx"]},"application/mathematica":{source:"iana",extensions:["ma","nb","mb"]},"application/mathml+xml":{source:"iana",compressible:!0,extensions:["mathml"]},"application/mathml-content+xml":{source:"iana",compressible:!0},"application/mathml-presentation+xml":{source:"iana",compressible:!0},"application/mbms-associated-procedure-description+xml":{source:"iana",compressible:!0},"application/mbms-deregister+xml":{source:"iana",compressible:!0},"application/mbms-envelope+xml":{source:"iana",compressible:!0},"application/mbms-msk+xml":{source:"iana",compressible:!0},"application/mbms-msk-response+xml":{source:"iana",compressible:!0},"application/mbms-protection-description+xml":{source:"iana",compressible:!0},"application/mbms-reception-report+xml":{source:"iana",compressible:!0},"application/mbms-register+xml":{source:"iana",compressible:!0},"application/mbms-register-response+xml":{source:"iana",compressible:!0},"application/mbms-schedule+xml":{source:"iana",compressible:!0},"application/mbms-user-service-description+xml":{source:"iana",compressible:!0},"application/mbox":{source:"iana",extensions:["mbox"]},"application/media-policy-dataset+xml":{source:"iana",compressible:!0,extensions:["mpf"]},"application/media_control+xml":{source:"iana",compressible:!0},"application/mediaservercontrol+xml":{source:"iana",compressible:!0,extensions:["mscml"]},"application/merge-patch+json":{source:"iana",compressible:!0},"application/metalink+xml":{source:"apache",compressible:!0,extensions:["metalink"]},"application/metalink4+xml":{source:"iana",compressible:!0,extensions:["meta4"]},"application/mets+xml":{source:"iana",compressible:!0,extensions:["mets"]},"application/mf4":{source:"iana"},"application/mikey":{source:"iana"},"application/mipc":{source:"iana"},"application/missing-blocks+cbor-seq":{source:"iana"},"application/mmt-aei+xml":{source:"iana",compressible:!0,extensions:["maei"]},"application/mmt-usd+xml":{source:"iana",compressible:!0,extensions:["musd"]},"application/mods+xml":{source:"iana",compressible:!0,extensions:["mods"]},"application/moss-keys":{source:"iana"},"application/moss-signature":{source:"iana"},"application/mosskey-data":{source:"iana"},"application/mosskey-request":{source:"iana"},"application/mp21":{source:"iana",extensions:["m21","mp21"]},"application/mp4":{source:"iana",extensions:["mp4s","m4p"]},"application/mpeg4-generic":{source:"iana"},"application/mpeg4-iod":{source:"iana"},"application/mpeg4-iod-xmt":{source:"iana"},"application/mrb-consumer+xml":{source:"iana",compressible:!0},"application/mrb-publish+xml":{source:"iana",compressible:!0},"application/msc-ivr+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msc-mixer+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/msword":{source:"iana",compressible:!1,extensions:["doc","dot"]},"application/mud+json":{source:"iana",compressible:!0},"application/multipart-core":{source:"iana"},"application/mxf":{source:"iana",extensions:["mxf"]},"application/n-quads":{source:"iana",extensions:["nq"]},"application/n-triples":{source:"iana",extensions:["nt"]},"application/nasdata":{source:"iana"},"application/news-checkgroups":{source:"iana",charset:"US-ASCII"},"application/news-groupinfo":{source:"iana",charset:"US-ASCII"},"application/news-transmission":{source:"iana"},"application/nlsml+xml":{source:"iana",compressible:!0},"application/node":{source:"iana",extensions:["cjs"]},"application/nss":{source:"iana"},"application/oauth-authz-req+jwt":{source:"iana"},"application/oblivious-dns-message":{source:"iana"},"application/ocsp-request":{source:"iana"},"application/ocsp-response":{source:"iana"},"application/octet-stream":{source:"iana",compressible:!1,extensions:["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"]},"application/oda":{source:"iana",extensions:["oda"]},"application/odm+xml":{source:"iana",compressible:!0},"application/odx":{source:"iana"},"application/oebps-package+xml":{source:"iana",compressible:!0,extensions:["opf"]},"application/ogg":{source:"iana",compressible:!1,extensions:["ogx"]},"application/omdoc+xml":{source:"apache",compressible:!0,extensions:["omdoc"]},"application/onenote":{source:"apache",extensions:["onetoc","onetoc2","onetmp","onepkg"]},"application/opc-nodeset+xml":{source:"iana",compressible:!0},"application/oscore":{source:"iana"},"application/oxps":{source:"iana",extensions:["oxps"]},"application/p21":{source:"iana"},"application/p21+zip":{source:"iana",compressible:!1},"application/p2p-overlay+xml":{source:"iana",compressible:!0,extensions:["relo"]},"application/parityfec":{source:"iana"},"application/passport":{source:"iana"},"application/patch-ops-error+xml":{source:"iana",compressible:!0,extensions:["xer"]},"application/pdf":{source:"iana",compressible:!1,extensions:["pdf"]},"application/pdx":{source:"iana"},"application/pem-certificate-chain":{source:"iana"},"application/pgp-encrypted":{source:"iana",compressible:!1,extensions:["pgp"]},"application/pgp-keys":{source:"iana",extensions:["asc"]},"application/pgp-signature":{source:"iana",extensions:["asc","sig"]},"application/pics-rules":{source:"apache",extensions:["prf"]},"application/pidf+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pidf-diff+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/pkcs10":{source:"iana",extensions:["p10"]},"application/pkcs12":{source:"iana"},"application/pkcs7-mime":{source:"iana",extensions:["p7m","p7c"]},"application/pkcs7-signature":{source:"iana",extensions:["p7s"]},"application/pkcs8":{source:"iana",extensions:["p8"]},"application/pkcs8-encrypted":{source:"iana"},"application/pkix-attr-cert":{source:"iana",extensions:["ac"]},"application/pkix-cert":{source:"iana",extensions:["cer"]},"application/pkix-crl":{source:"iana",extensions:["crl"]},"application/pkix-pkipath":{source:"iana",extensions:["pkipath"]},"application/pkixcmp":{source:"iana",extensions:["pki"]},"application/pls+xml":{source:"iana",compressible:!0,extensions:["pls"]},"application/poc-settings+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/postscript":{source:"iana",compressible:!0,extensions:["ai","eps","ps"]},"application/ppsp-tracker+json":{source:"iana",compressible:!0},"application/problem+json":{source:"iana",compressible:!0},"application/problem+xml":{source:"iana",compressible:!0},"application/provenance+xml":{source:"iana",compressible:!0,extensions:["provx"]},"application/prs.alvestrand.titrax-sheet":{source:"iana"},"application/prs.cww":{source:"iana",extensions:["cww"]},"application/prs.cyn":{source:"iana",charset:"7-BIT"},"application/prs.hpub+zip":{source:"iana",compressible:!1},"application/prs.nprend":{source:"iana"},"application/prs.plucker":{source:"iana"},"application/prs.rdf-xml-crypt":{source:"iana"},"application/prs.xsf+xml":{source:"iana",compressible:!0},"application/pskc+xml":{source:"iana",compressible:!0,extensions:["pskcxml"]},"application/pvd+json":{source:"iana",compressible:!0},"application/qsig":{source:"iana"},"application/raml+yaml":{compressible:!0,extensions:["raml"]},"application/raptorfec":{source:"iana"},"application/rdap+json":{source:"iana",compressible:!0},"application/rdf+xml":{source:"iana",compressible:!0,extensions:["rdf","owl"]},"application/reginfo+xml":{source:"iana",compressible:!0,extensions:["rif"]},"application/relax-ng-compact-syntax":{source:"iana",extensions:["rnc"]},"application/remote-printing":{source:"iana"},"application/reputon+json":{source:"iana",compressible:!0},"application/resource-lists+xml":{source:"iana",compressible:!0,extensions:["rl"]},"application/resource-lists-diff+xml":{source:"iana",compressible:!0,extensions:["rld"]},"application/rfc+xml":{source:"iana",compressible:!0},"application/riscos":{source:"iana"},"application/rlmi+xml":{source:"iana",compressible:!0},"application/rls-services+xml":{source:"iana",compressible:!0,extensions:["rs"]},"application/route-apd+xml":{source:"iana",compressible:!0,extensions:["rapd"]},"application/route-s-tsid+xml":{source:"iana",compressible:!0,extensions:["sls"]},"application/route-usd+xml":{source:"iana",compressible:!0,extensions:["rusd"]},"application/rpki-ghostbusters":{source:"iana",extensions:["gbr"]},"application/rpki-manifest":{source:"iana",extensions:["mft"]},"application/rpki-publication":{source:"iana"},"application/rpki-roa":{source:"iana",extensions:["roa"]},"application/rpki-updown":{source:"iana"},"application/rsd+xml":{source:"apache",compressible:!0,extensions:["rsd"]},"application/rss+xml":{source:"apache",compressible:!0,extensions:["rss"]},"application/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"application/rtploopback":{source:"iana"},"application/rtx":{source:"iana"},"application/samlassertion+xml":{source:"iana",compressible:!0},"application/samlmetadata+xml":{source:"iana",compressible:!0},"application/sarif+json":{source:"iana",compressible:!0},"application/sarif-external-properties+json":{source:"iana",compressible:!0},"application/sbe":{source:"iana"},"application/sbml+xml":{source:"iana",compressible:!0,extensions:["sbml"]},"application/scaip+xml":{source:"iana",compressible:!0},"application/scim+json":{source:"iana",compressible:!0},"application/scvp-cv-request":{source:"iana",extensions:["scq"]},"application/scvp-cv-response":{source:"iana",extensions:["scs"]},"application/scvp-vp-request":{source:"iana",extensions:["spq"]},"application/scvp-vp-response":{source:"iana",extensions:["spp"]},"application/sdp":{source:"iana",extensions:["sdp"]},"application/secevent+jwt":{source:"iana"},"application/senml+cbor":{source:"iana"},"application/senml+json":{source:"iana",compressible:!0},"application/senml+xml":{source:"iana",compressible:!0,extensions:["senmlx"]},"application/senml-etch+cbor":{source:"iana"},"application/senml-etch+json":{source:"iana",compressible:!0},"application/senml-exi":{source:"iana"},"application/sensml+cbor":{source:"iana"},"application/sensml+json":{source:"iana",compressible:!0},"application/sensml+xml":{source:"iana",compressible:!0,extensions:["sensmlx"]},"application/sensml-exi":{source:"iana"},"application/sep+xml":{source:"iana",compressible:!0},"application/sep-exi":{source:"iana"},"application/session-info":{source:"iana"},"application/set-payment":{source:"iana"},"application/set-payment-initiation":{source:"iana",extensions:["setpay"]},"application/set-registration":{source:"iana"},"application/set-registration-initiation":{source:"iana",extensions:["setreg"]},"application/sgml":{source:"iana"},"application/sgml-open-catalog":{source:"iana"},"application/shf+xml":{source:"iana",compressible:!0,extensions:["shf"]},"application/sieve":{source:"iana",extensions:["siv","sieve"]},"application/simple-filter+xml":{source:"iana",compressible:!0},"application/simple-message-summary":{source:"iana"},"application/simplesymbolcontainer":{source:"iana"},"application/sipc":{source:"iana"},"application/slate":{source:"iana"},"application/smil":{source:"iana"},"application/smil+xml":{source:"iana",compressible:!0,extensions:["smi","smil"]},"application/smpte336m":{source:"iana"},"application/soap+fastinfoset":{source:"iana"},"application/soap+xml":{source:"iana",compressible:!0},"application/sparql-query":{source:"iana",extensions:["rq"]},"application/sparql-results+xml":{source:"iana",compressible:!0,extensions:["srx"]},"application/spdx+json":{source:"iana",compressible:!0},"application/spirits-event+xml":{source:"iana",compressible:!0},"application/sql":{source:"iana"},"application/srgs":{source:"iana",extensions:["gram"]},"application/srgs+xml":{source:"iana",compressible:!0,extensions:["grxml"]},"application/sru+xml":{source:"iana",compressible:!0,extensions:["sru"]},"application/ssdl+xml":{source:"apache",compressible:!0,extensions:["ssdl"]},"application/ssml+xml":{source:"iana",compressible:!0,extensions:["ssml"]},"application/stix+json":{source:"iana",compressible:!0},"application/swid+xml":{source:"iana",compressible:!0,extensions:["swidtag"]},"application/tamp-apex-update":{source:"iana"},"application/tamp-apex-update-confirm":{source:"iana"},"application/tamp-community-update":{source:"iana"},"application/tamp-community-update-confirm":{source:"iana"},"application/tamp-error":{source:"iana"},"application/tamp-sequence-adjust":{source:"iana"},"application/tamp-sequence-adjust-confirm":{source:"iana"},"application/tamp-status-query":{source:"iana"},"application/tamp-status-response":{source:"iana"},"application/tamp-update":{source:"iana"},"application/tamp-update-confirm":{source:"iana"},"application/tar":{compressible:!0},"application/taxii+json":{source:"iana",compressible:!0},"application/td+json":{source:"iana",compressible:!0},"application/tei+xml":{source:"iana",compressible:!0,extensions:["tei","teicorpus"]},"application/tetra_isi":{source:"iana"},"application/thraud+xml":{source:"iana",compressible:!0,extensions:["tfi"]},"application/timestamp-query":{source:"iana"},"application/timestamp-reply":{source:"iana"},"application/timestamped-data":{source:"iana",extensions:["tsd"]},"application/tlsrpt+gzip":{source:"iana"},"application/tlsrpt+json":{source:"iana",compressible:!0},"application/tnauthlist":{source:"iana"},"application/token-introspection+jwt":{source:"iana"},"application/toml":{compressible:!0,extensions:["toml"]},"application/trickle-ice-sdpfrag":{source:"iana"},"application/trig":{source:"iana",extensions:["trig"]},"application/ttml+xml":{source:"iana",compressible:!0,extensions:["ttml"]},"application/tve-trigger":{source:"iana"},"application/tzif":{source:"iana"},"application/tzif-leap":{source:"iana"},"application/ubjson":{compressible:!1,extensions:["ubj"]},"application/ulpfec":{source:"iana"},"application/urc-grpsheet+xml":{source:"iana",compressible:!0},"application/urc-ressheet+xml":{source:"iana",compressible:!0,extensions:["rsheet"]},"application/urc-targetdesc+xml":{source:"iana",compressible:!0,extensions:["td"]},"application/urc-uisocketdesc+xml":{source:"iana",compressible:!0},"application/vcard+json":{source:"iana",compressible:!0},"application/vcard+xml":{source:"iana",compressible:!0},"application/vemmi":{source:"iana"},"application/vividence.scriptfile":{source:"apache"},"application/vnd.1000minds.decision-model+xml":{source:"iana",compressible:!0,extensions:["1km"]},"application/vnd.3gpp-prose+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-prose-pc3ch+xml":{source:"iana",compressible:!0},"application/vnd.3gpp-v2x-local-service-information":{source:"iana"},"application/vnd.3gpp.5gnas":{source:"iana"},"application/vnd.3gpp.access-transfer-events+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.bsf+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gmop+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.gtpc":{source:"iana"},"application/vnd.3gpp.interworking-data":{source:"iana"},"application/vnd.3gpp.lpp":{source:"iana"},"application/vnd.3gpp.mc-signalling-ear":{source:"iana"},"application/vnd.3gpp.mcdata-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-payload":{source:"iana"},"application/vnd.3gpp.mcdata-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-signalling":{source:"iana"},"application/vnd.3gpp.mcdata-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcdata-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-floor-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-signed+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-ue-init-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcptt-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-command+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-affiliation-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-location-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-mbms-usage-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-service-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-transmission-request+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-ue-config+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mcvideo-user-profile+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.mid-call+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ngap":{source:"iana"},"application/vnd.3gpp.pfcp":{source:"iana"},"application/vnd.3gpp.pic-bw-large":{source:"iana",extensions:["plb"]},"application/vnd.3gpp.pic-bw-small":{source:"iana",extensions:["psb"]},"application/vnd.3gpp.pic-bw-var":{source:"iana",extensions:["pvb"]},"application/vnd.3gpp.s1ap":{source:"iana"},"application/vnd.3gpp.sms":{source:"iana"},"application/vnd.3gpp.sms+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-ext+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.srvcc-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.state-and-event-info+xml":{source:"iana",compressible:!0},"application/vnd.3gpp.ussd+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.bcmcsinfo+xml":{source:"iana",compressible:!0},"application/vnd.3gpp2.sms":{source:"iana"},"application/vnd.3gpp2.tcap":{source:"iana",extensions:["tcap"]},"application/vnd.3lightssoftware.imagescal":{source:"iana"},"application/vnd.3m.post-it-notes":{source:"iana",extensions:["pwn"]},"application/vnd.accpac.simply.aso":{source:"iana",extensions:["aso"]},"application/vnd.accpac.simply.imp":{source:"iana",extensions:["imp"]},"application/vnd.acucobol":{source:"iana",extensions:["acu"]},"application/vnd.acucorp":{source:"iana",extensions:["atc","acutc"]},"application/vnd.adobe.air-application-installer-package+zip":{source:"apache",compressible:!1,extensions:["air"]},"application/vnd.adobe.flash.movie":{source:"iana"},"application/vnd.adobe.formscentral.fcdt":{source:"iana",extensions:["fcdt"]},"application/vnd.adobe.fxp":{source:"iana",extensions:["fxp","fxpl"]},"application/vnd.adobe.partial-upload":{source:"iana"},"application/vnd.adobe.xdp+xml":{source:"iana",compressible:!0,extensions:["xdp"]},"application/vnd.adobe.xfdf":{source:"iana",extensions:["xfdf"]},"application/vnd.aether.imp":{source:"iana"},"application/vnd.afpc.afplinedata":{source:"iana"},"application/vnd.afpc.afplinedata-pagedef":{source:"iana"},"application/vnd.afpc.cmoca-cmresource":{source:"iana"},"application/vnd.afpc.foca-charset":{source:"iana"},"application/vnd.afpc.foca-codedfont":{source:"iana"},"application/vnd.afpc.foca-codepage":{source:"iana"},"application/vnd.afpc.modca":{source:"iana"},"application/vnd.afpc.modca-cmtable":{source:"iana"},"application/vnd.afpc.modca-formdef":{source:"iana"},"application/vnd.afpc.modca-mediummap":{source:"iana"},"application/vnd.afpc.modca-objectcontainer":{source:"iana"},"application/vnd.afpc.modca-overlay":{source:"iana"},"application/vnd.afpc.modca-pagesegment":{source:"iana"},"application/vnd.age":{source:"iana",extensions:["age"]},"application/vnd.ah-barcode":{source:"iana"},"application/vnd.ahead.space":{source:"iana",extensions:["ahead"]},"application/vnd.airzip.filesecure.azf":{source:"iana",extensions:["azf"]},"application/vnd.airzip.filesecure.azs":{source:"iana",extensions:["azs"]},"application/vnd.amadeus+json":{source:"iana",compressible:!0},"application/vnd.amazon.ebook":{source:"apache",extensions:["azw"]},"application/vnd.amazon.mobi8-ebook":{source:"iana"},"application/vnd.americandynamics.acc":{source:"iana",extensions:["acc"]},"application/vnd.amiga.ami":{source:"iana",extensions:["ami"]},"application/vnd.amundsen.maze+xml":{source:"iana",compressible:!0},"application/vnd.android.ota":{source:"iana"},"application/vnd.android.package-archive":{source:"apache",compressible:!1,extensions:["apk"]},"application/vnd.anki":{source:"iana"},"application/vnd.anser-web-certificate-issue-initiation":{source:"iana",extensions:["cii"]},"application/vnd.anser-web-funds-transfer-initiation":{source:"apache",extensions:["fti"]},"application/vnd.antix.game-component":{source:"iana",extensions:["atx"]},"application/vnd.apache.arrow.file":{source:"iana"},"application/vnd.apache.arrow.stream":{source:"iana"},"application/vnd.apache.thrift.binary":{source:"iana"},"application/vnd.apache.thrift.compact":{source:"iana"},"application/vnd.apache.thrift.json":{source:"iana"},"application/vnd.api+json":{source:"iana",compressible:!0},"application/vnd.aplextor.warrp+json":{source:"iana",compressible:!0},"application/vnd.apothekende.reservation+json":{source:"iana",compressible:!0},"application/vnd.apple.installer+xml":{source:"iana",compressible:!0,extensions:["mpkg"]},"application/vnd.apple.keynote":{source:"iana",extensions:["key"]},"application/vnd.apple.mpegurl":{source:"iana",extensions:["m3u8"]},"application/vnd.apple.numbers":{source:"iana",extensions:["numbers"]},"application/vnd.apple.pages":{source:"iana",extensions:["pages"]},"application/vnd.apple.pkpass":{compressible:!1,extensions:["pkpass"]},"application/vnd.arastra.swi":{source:"iana"},"application/vnd.aristanetworks.swi":{source:"iana",extensions:["swi"]},"application/vnd.artisan+json":{source:"iana",compressible:!0},"application/vnd.artsquare":{source:"iana"},"application/vnd.astraea-software.iota":{source:"iana",extensions:["iota"]},"application/vnd.audiograph":{source:"iana",extensions:["aep"]},"application/vnd.autopackage":{source:"iana"},"application/vnd.avalon+json":{source:"iana",compressible:!0},"application/vnd.avistar+xml":{source:"iana",compressible:!0},"application/vnd.balsamiq.bmml+xml":{source:"iana",compressible:!0,extensions:["bmml"]},"application/vnd.balsamiq.bmpr":{source:"iana"},"application/vnd.banana-accounting":{source:"iana"},"application/vnd.bbf.usp.error":{source:"iana"},"application/vnd.bbf.usp.msg":{source:"iana"},"application/vnd.bbf.usp.msg+json":{source:"iana",compressible:!0},"application/vnd.bekitzur-stech+json":{source:"iana",compressible:!0},"application/vnd.bint.med-content":{source:"iana"},"application/vnd.biopax.rdf+xml":{source:"iana",compressible:!0},"application/vnd.blink-idb-value-wrapper":{source:"iana"},"application/vnd.blueice.multipass":{source:"iana",extensions:["mpm"]},"application/vnd.bluetooth.ep.oob":{source:"iana"},"application/vnd.bluetooth.le.oob":{source:"iana"},"application/vnd.bmi":{source:"iana",extensions:["bmi"]},"application/vnd.bpf":{source:"iana"},"application/vnd.bpf3":{source:"iana"},"application/vnd.businessobjects":{source:"iana",extensions:["rep"]},"application/vnd.byu.uapi+json":{source:"iana",compressible:!0},"application/vnd.cab-jscript":{source:"iana"},"application/vnd.canon-cpdl":{source:"iana"},"application/vnd.canon-lips":{source:"iana"},"application/vnd.capasystems-pg+json":{source:"iana",compressible:!0},"application/vnd.cendio.thinlinc.clientconf":{source:"iana"},"application/vnd.century-systems.tcp_stream":{source:"iana"},"application/vnd.chemdraw+xml":{source:"iana",compressible:!0,extensions:["cdxml"]},"application/vnd.chess-pgn":{source:"iana"},"application/vnd.chipnuts.karaoke-mmd":{source:"iana",extensions:["mmd"]},"application/vnd.ciedi":{source:"iana"},"application/vnd.cinderella":{source:"iana",extensions:["cdy"]},"application/vnd.cirpack.isdn-ext":{source:"iana"},"application/vnd.citationstyles.style+xml":{source:"iana",compressible:!0,extensions:["csl"]},"application/vnd.claymore":{source:"iana",extensions:["cla"]},"application/vnd.cloanto.rp9":{source:"iana",extensions:["rp9"]},"application/vnd.clonk.c4group":{source:"iana",extensions:["c4g","c4d","c4f","c4p","c4u"]},"application/vnd.cluetrust.cartomobile-config":{source:"iana",extensions:["c11amc"]},"application/vnd.cluetrust.cartomobile-config-pkg":{source:"iana",extensions:["c11amz"]},"application/vnd.coffeescript":{source:"iana"},"application/vnd.collabio.xodocuments.document":{source:"iana"},"application/vnd.collabio.xodocuments.document-template":{source:"iana"},"application/vnd.collabio.xodocuments.presentation":{source:"iana"},"application/vnd.collabio.xodocuments.presentation-template":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet":{source:"iana"},"application/vnd.collabio.xodocuments.spreadsheet-template":{source:"iana"},"application/vnd.collection+json":{source:"iana",compressible:!0},"application/vnd.collection.doc+json":{source:"iana",compressible:!0},"application/vnd.collection.next+json":{source:"iana",compressible:!0},"application/vnd.comicbook+zip":{source:"iana",compressible:!1},"application/vnd.comicbook-rar":{source:"iana"},"application/vnd.commerce-battelle":{source:"iana"},"application/vnd.commonspace":{source:"iana",extensions:["csp"]},"application/vnd.contact.cmsg":{source:"iana",extensions:["cdbcmsg"]},"application/vnd.coreos.ignition+json":{source:"iana",compressible:!0},"application/vnd.cosmocaller":{source:"iana",extensions:["cmc"]},"application/vnd.crick.clicker":{source:"iana",extensions:["clkx"]},"application/vnd.crick.clicker.keyboard":{source:"iana",extensions:["clkk"]},"application/vnd.crick.clicker.palette":{source:"iana",extensions:["clkp"]},"application/vnd.crick.clicker.template":{source:"iana",extensions:["clkt"]},"application/vnd.crick.clicker.wordbank":{source:"iana",extensions:["clkw"]},"application/vnd.criticaltools.wbs+xml":{source:"iana",compressible:!0,extensions:["wbs"]},"application/vnd.cryptii.pipe+json":{source:"iana",compressible:!0},"application/vnd.crypto-shade-file":{source:"iana"},"application/vnd.cryptomator.encrypted":{source:"iana"},"application/vnd.cryptomator.vault":{source:"iana"},"application/vnd.ctc-posml":{source:"iana",extensions:["pml"]},"application/vnd.ctct.ws+xml":{source:"iana",compressible:!0},"application/vnd.cups-pdf":{source:"iana"},"application/vnd.cups-postscript":{source:"iana"},"application/vnd.cups-ppd":{source:"iana",extensions:["ppd"]},"application/vnd.cups-raster":{source:"iana"},"application/vnd.cups-raw":{source:"iana"},"application/vnd.curl":{source:"iana"},"application/vnd.curl.car":{source:"apache",extensions:["car"]},"application/vnd.curl.pcurl":{source:"apache",extensions:["pcurl"]},"application/vnd.cyan.dean.root+xml":{source:"iana",compressible:!0},"application/vnd.cybank":{source:"iana"},"application/vnd.cyclonedx+json":{source:"iana",compressible:!0},"application/vnd.cyclonedx+xml":{source:"iana",compressible:!0},"application/vnd.d2l.coursepackage1p0+zip":{source:"iana",compressible:!1},"application/vnd.d3m-dataset":{source:"iana"},"application/vnd.d3m-problem":{source:"iana"},"application/vnd.dart":{source:"iana",compressible:!0,extensions:["dart"]},"application/vnd.data-vision.rdz":{source:"iana",extensions:["rdz"]},"application/vnd.datapackage+json":{source:"iana",compressible:!0},"application/vnd.dataresource+json":{source:"iana",compressible:!0},"application/vnd.dbf":{source:"iana",extensions:["dbf"]},"application/vnd.debian.binary-package":{source:"iana"},"application/vnd.dece.data":{source:"iana",extensions:["uvf","uvvf","uvd","uvvd"]},"application/vnd.dece.ttml+xml":{source:"iana",compressible:!0,extensions:["uvt","uvvt"]},"application/vnd.dece.unspecified":{source:"iana",extensions:["uvx","uvvx"]},"application/vnd.dece.zip":{source:"iana",extensions:["uvz","uvvz"]},"application/vnd.denovo.fcselayout-link":{source:"iana",extensions:["fe_launch"]},"application/vnd.desmume.movie":{source:"iana"},"application/vnd.dir-bi.plate-dl-nosuffix":{source:"iana"},"application/vnd.dm.delegation+xml":{source:"iana",compressible:!0},"application/vnd.dna":{source:"iana",extensions:["dna"]},"application/vnd.document+json":{source:"iana",compressible:!0},"application/vnd.dolby.mlp":{source:"apache",extensions:["mlp"]},"application/vnd.dolby.mobile.1":{source:"iana"},"application/vnd.dolby.mobile.2":{source:"iana"},"application/vnd.doremir.scorecloud-binary-document":{source:"iana"},"application/vnd.dpgraph":{source:"iana",extensions:["dpg"]},"application/vnd.dreamfactory":{source:"iana",extensions:["dfac"]},"application/vnd.drive+json":{source:"iana",compressible:!0},"application/vnd.ds-keypoint":{source:"apache",extensions:["kpxx"]},"application/vnd.dtg.local":{source:"iana"},"application/vnd.dtg.local.flash":{source:"iana"},"application/vnd.dtg.local.html":{source:"iana"},"application/vnd.dvb.ait":{source:"iana",extensions:["ait"]},"application/vnd.dvb.dvbisl+xml":{source:"iana",compressible:!0},"application/vnd.dvb.dvbj":{source:"iana"},"application/vnd.dvb.esgcontainer":{source:"iana"},"application/vnd.dvb.ipdcdftnotifaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess":{source:"iana"},"application/vnd.dvb.ipdcesgaccess2":{source:"iana"},"application/vnd.dvb.ipdcesgpdd":{source:"iana"},"application/vnd.dvb.ipdcroaming":{source:"iana"},"application/vnd.dvb.iptv.alfec-base":{source:"iana"},"application/vnd.dvb.iptv.alfec-enhancement":{source:"iana"},"application/vnd.dvb.notif-aggregate-root+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-container+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-generic+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-msglist+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-request+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-ia-registration-response+xml":{source:"iana",compressible:!0},"application/vnd.dvb.notif-init+xml":{source:"iana",compressible:!0},"application/vnd.dvb.pfr":{source:"iana"},"application/vnd.dvb.service":{source:"iana",extensions:["svc"]},"application/vnd.dxr":{source:"iana"},"application/vnd.dynageo":{source:"iana",extensions:["geo"]},"application/vnd.dzr":{source:"iana"},"application/vnd.easykaraoke.cdgdownload":{source:"iana"},"application/vnd.ecdis-update":{source:"iana"},"application/vnd.ecip.rlp":{source:"iana"},"application/vnd.eclipse.ditto+json":{source:"iana",compressible:!0},"application/vnd.ecowin.chart":{source:"iana",extensions:["mag"]},"application/vnd.ecowin.filerequest":{source:"iana"},"application/vnd.ecowin.fileupdate":{source:"iana"},"application/vnd.ecowin.series":{source:"iana"},"application/vnd.ecowin.seriesrequest":{source:"iana"},"application/vnd.ecowin.seriesupdate":{source:"iana"},"application/vnd.efi.img":{source:"iana"},"application/vnd.efi.iso":{source:"iana"},"application/vnd.emclient.accessrequest+xml":{source:"iana",compressible:!0},"application/vnd.enliven":{source:"iana",extensions:["nml"]},"application/vnd.enphase.envoy":{source:"iana"},"application/vnd.eprints.data+xml":{source:"iana",compressible:!0},"application/vnd.epson.esf":{source:"iana",extensions:["esf"]},"application/vnd.epson.msf":{source:"iana",extensions:["msf"]},"application/vnd.epson.quickanime":{source:"iana",extensions:["qam"]},"application/vnd.epson.salt":{source:"iana",extensions:["slt"]},"application/vnd.epson.ssf":{source:"iana",extensions:["ssf"]},"application/vnd.ericsson.quickcall":{source:"iana"},"application/vnd.espass-espass+zip":{source:"iana",compressible:!1},"application/vnd.eszigno3+xml":{source:"iana",compressible:!0,extensions:["es3","et3"]},"application/vnd.etsi.aoc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.asic-e+zip":{source:"iana",compressible:!1},"application/vnd.etsi.asic-s+zip":{source:"iana",compressible:!1},"application/vnd.etsi.cug+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvcommand+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-bc+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-cod+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsad-npvr+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvservice+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvsync+xml":{source:"iana",compressible:!0},"application/vnd.etsi.iptvueprofile+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mcid+xml":{source:"iana",compressible:!0},"application/vnd.etsi.mheg5":{source:"iana"},"application/vnd.etsi.overload-control-policy-dataset+xml":{source:"iana",compressible:!0},"application/vnd.etsi.pstn+xml":{source:"iana",compressible:!0},"application/vnd.etsi.sci+xml":{source:"iana",compressible:!0},"application/vnd.etsi.simservs+xml":{source:"iana",compressible:!0},"application/vnd.etsi.timestamp-token":{source:"iana"},"application/vnd.etsi.tsl+xml":{source:"iana",compressible:!0},"application/vnd.etsi.tsl.der":{source:"iana"},"application/vnd.eu.kasparian.car+json":{source:"iana",compressible:!0},"application/vnd.eudora.data":{source:"iana"},"application/vnd.evolv.ecig.profile":{source:"iana"},"application/vnd.evolv.ecig.settings":{source:"iana"},"application/vnd.evolv.ecig.theme":{source:"iana"},"application/vnd.exstream-empower+zip":{source:"iana",compressible:!1},"application/vnd.exstream-package":{source:"iana"},"application/vnd.ezpix-album":{source:"iana",extensions:["ez2"]},"application/vnd.ezpix-package":{source:"iana",extensions:["ez3"]},"application/vnd.f-secure.mobile":{source:"iana"},"application/vnd.familysearch.gedcom+zip":{source:"iana",compressible:!1},"application/vnd.fastcopy-disk-image":{source:"iana"},"application/vnd.fdf":{source:"iana",extensions:["fdf"]},"application/vnd.fdsn.mseed":{source:"iana",extensions:["mseed"]},"application/vnd.fdsn.seed":{source:"iana",extensions:["seed","dataless"]},"application/vnd.ffsns":{source:"iana"},"application/vnd.ficlab.flb+zip":{source:"iana",compressible:!1},"application/vnd.filmit.zfc":{source:"iana"},"application/vnd.fints":{source:"iana"},"application/vnd.firemonkeys.cloudcell":{source:"iana"},"application/vnd.flographit":{source:"iana",extensions:["gph"]},"application/vnd.fluxtime.clip":{source:"iana",extensions:["ftc"]},"application/vnd.font-fontforge-sfd":{source:"iana"},"application/vnd.framemaker":{source:"iana",extensions:["fm","frame","maker","book"]},"application/vnd.frogans.fnc":{source:"iana",extensions:["fnc"]},"application/vnd.frogans.ltf":{source:"iana",extensions:["ltf"]},"application/vnd.fsc.weblaunch":{source:"iana",extensions:["fsc"]},"application/vnd.fujifilm.fb.docuworks":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.binder":{source:"iana"},"application/vnd.fujifilm.fb.docuworks.container":{source:"iana"},"application/vnd.fujifilm.fb.jfi+xml":{source:"iana",compressible:!0},"application/vnd.fujitsu.oasys":{source:"iana",extensions:["oas"]},"application/vnd.fujitsu.oasys2":{source:"iana",extensions:["oa2"]},"application/vnd.fujitsu.oasys3":{source:"iana",extensions:["oa3"]},"application/vnd.fujitsu.oasysgp":{source:"iana",extensions:["fg5"]},"application/vnd.fujitsu.oasysprs":{source:"iana",extensions:["bh2"]},"application/vnd.fujixerox.art-ex":{source:"iana"},"application/vnd.fujixerox.art4":{source:"iana"},"application/vnd.fujixerox.ddd":{source:"iana",extensions:["ddd"]},"application/vnd.fujixerox.docuworks":{source:"iana",extensions:["xdw"]},"application/vnd.fujixerox.docuworks.binder":{source:"iana",extensions:["xbd"]},"application/vnd.fujixerox.docuworks.container":{source:"iana"},"application/vnd.fujixerox.hbpl":{source:"iana"},"application/vnd.fut-misnet":{source:"iana"},"application/vnd.futoin+cbor":{source:"iana"},"application/vnd.futoin+json":{source:"iana",compressible:!0},"application/vnd.fuzzysheet":{source:"iana",extensions:["fzs"]},"application/vnd.genomatix.tuxedo":{source:"iana",extensions:["txd"]},"application/vnd.gentics.grd+json":{source:"iana",compressible:!0},"application/vnd.geo+json":{source:"iana",compressible:!0},"application/vnd.geocube+xml":{source:"iana",compressible:!0},"application/vnd.geogebra.file":{source:"iana",extensions:["ggb"]},"application/vnd.geogebra.slides":{source:"iana"},"application/vnd.geogebra.tool":{source:"iana",extensions:["ggt"]},"application/vnd.geometry-explorer":{source:"iana",extensions:["gex","gre"]},"application/vnd.geonext":{source:"iana",extensions:["gxt"]},"application/vnd.geoplan":{source:"iana",extensions:["g2w"]},"application/vnd.geospace":{source:"iana",extensions:["g3w"]},"application/vnd.gerber":{source:"iana"},"application/vnd.globalplatform.card-content-mgt":{source:"iana"},"application/vnd.globalplatform.card-content-mgt-response":{source:"iana"},"application/vnd.gmx":{source:"iana",extensions:["gmx"]},"application/vnd.google-apps.document":{compressible:!1,extensions:["gdoc"]},"application/vnd.google-apps.presentation":{compressible:!1,extensions:["gslides"]},"application/vnd.google-apps.spreadsheet":{compressible:!1,extensions:["gsheet"]},"application/vnd.google-earth.kml+xml":{source:"iana",compressible:!0,extensions:["kml"]},"application/vnd.google-earth.kmz":{source:"iana",compressible:!1,extensions:["kmz"]},"application/vnd.gov.sk.e-form+xml":{source:"iana",compressible:!0},"application/vnd.gov.sk.e-form+zip":{source:"iana",compressible:!1},"application/vnd.gov.sk.xmldatacontainer+xml":{source:"iana",compressible:!0},"application/vnd.grafeq":{source:"iana",extensions:["gqf","gqs"]},"application/vnd.gridmp":{source:"iana"},"application/vnd.groove-account":{source:"iana",extensions:["gac"]},"application/vnd.groove-help":{source:"iana",extensions:["ghf"]},"application/vnd.groove-identity-message":{source:"iana",extensions:["gim"]},"application/vnd.groove-injector":{source:"iana",extensions:["grv"]},"application/vnd.groove-tool-message":{source:"iana",extensions:["gtm"]},"application/vnd.groove-tool-template":{source:"iana",extensions:["tpl"]},"application/vnd.groove-vcard":{source:"iana",extensions:["vcg"]},"application/vnd.hal+json":{source:"iana",compressible:!0},"application/vnd.hal+xml":{source:"iana",compressible:!0,extensions:["hal"]},"application/vnd.handheld-entertainment+xml":{source:"iana",compressible:!0,extensions:["zmm"]},"application/vnd.hbci":{source:"iana",extensions:["hbci"]},"application/vnd.hc+json":{source:"iana",compressible:!0},"application/vnd.hcl-bireports":{source:"iana"},"application/vnd.hdt":{source:"iana"},"application/vnd.heroku+json":{source:"iana",compressible:!0},"application/vnd.hhe.lesson-player":{source:"iana",extensions:["les"]},"application/vnd.hl7cda+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hl7v2+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.hp-hpgl":{source:"iana",extensions:["hpgl"]},"application/vnd.hp-hpid":{source:"iana",extensions:["hpid"]},"application/vnd.hp-hps":{source:"iana",extensions:["hps"]},"application/vnd.hp-jlyt":{source:"iana",extensions:["jlt"]},"application/vnd.hp-pcl":{source:"iana",extensions:["pcl"]},"application/vnd.hp-pclxl":{source:"iana",extensions:["pclxl"]},"application/vnd.httphone":{source:"iana"},"application/vnd.hydrostatix.sof-data":{source:"iana",extensions:["sfd-hdstx"]},"application/vnd.hyper+json":{source:"iana",compressible:!0},"application/vnd.hyper-item+json":{source:"iana",compressible:!0},"application/vnd.hyperdrive+json":{source:"iana",compressible:!0},"application/vnd.hzn-3d-crossword":{source:"iana"},"application/vnd.ibm.afplinedata":{source:"iana"},"application/vnd.ibm.electronic-media":{source:"iana"},"application/vnd.ibm.minipay":{source:"iana",extensions:["mpy"]},"application/vnd.ibm.modcap":{source:"iana",extensions:["afp","listafp","list3820"]},"application/vnd.ibm.rights-management":{source:"iana",extensions:["irm"]},"application/vnd.ibm.secure-container":{source:"iana",extensions:["sc"]},"application/vnd.iccprofile":{source:"iana",extensions:["icc","icm"]},"application/vnd.ieee.1905":{source:"iana"},"application/vnd.igloader":{source:"iana",extensions:["igl"]},"application/vnd.imagemeter.folder+zip":{source:"iana",compressible:!1},"application/vnd.imagemeter.image+zip":{source:"iana",compressible:!1},"application/vnd.immervision-ivp":{source:"iana",extensions:["ivp"]},"application/vnd.immervision-ivu":{source:"iana",extensions:["ivu"]},"application/vnd.ims.imsccv1p1":{source:"iana"},"application/vnd.ims.imsccv1p2":{source:"iana"},"application/vnd.ims.imsccv1p3":{source:"iana"},"application/vnd.ims.lis.v2.result+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolconsumerprofile+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolproxy.id+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings+json":{source:"iana",compressible:!0},"application/vnd.ims.lti.v2.toolsettings.simple+json":{source:"iana",compressible:!0},"application/vnd.informedcontrol.rms+xml":{source:"iana",compressible:!0},"application/vnd.informix-visionary":{source:"iana"},"application/vnd.infotech.project":{source:"iana"},"application/vnd.infotech.project+xml":{source:"iana",compressible:!0},"application/vnd.innopath.wamp.notification":{source:"iana"},"application/vnd.insors.igm":{source:"iana",extensions:["igm"]},"application/vnd.intercon.formnet":{source:"iana",extensions:["xpw","xpx"]},"application/vnd.intergeo":{source:"iana",extensions:["i2g"]},"application/vnd.intertrust.digibox":{source:"iana"},"application/vnd.intertrust.nncp":{source:"iana"},"application/vnd.intu.qbo":{source:"iana",extensions:["qbo"]},"application/vnd.intu.qfx":{source:"iana",extensions:["qfx"]},"application/vnd.iptc.g2.catalogitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.conceptitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.knowledgeitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.newsmessage+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.packageitem+xml":{source:"iana",compressible:!0},"application/vnd.iptc.g2.planningitem+xml":{source:"iana",compressible:!0},"application/vnd.ipunplugged.rcprofile":{source:"iana",extensions:["rcprofile"]},"application/vnd.irepository.package+xml":{source:"iana",compressible:!0,extensions:["irp"]},"application/vnd.is-xpr":{source:"iana",extensions:["xpr"]},"application/vnd.isac.fcs":{source:"iana",extensions:["fcs"]},"application/vnd.iso11783-10+zip":{source:"iana",compressible:!1},"application/vnd.jam":{source:"iana",extensions:["jam"]},"application/vnd.japannet-directory-service":{source:"iana"},"application/vnd.japannet-jpnstore-wakeup":{source:"iana"},"application/vnd.japannet-payment-wakeup":{source:"iana"},"application/vnd.japannet-registration":{source:"iana"},"application/vnd.japannet-registration-wakeup":{source:"iana"},"application/vnd.japannet-setstore-wakeup":{source:"iana"},"application/vnd.japannet-verification":{source:"iana"},"application/vnd.japannet-verification-wakeup":{source:"iana"},"application/vnd.jcp.javame.midlet-rms":{source:"iana",extensions:["rms"]},"application/vnd.jisp":{source:"iana",extensions:["jisp"]},"application/vnd.joost.joda-archive":{source:"iana",extensions:["joda"]},"application/vnd.jsk.isdn-ngn":{source:"iana"},"application/vnd.kahootz":{source:"iana",extensions:["ktz","ktr"]},"application/vnd.kde.karbon":{source:"iana",extensions:["karbon"]},"application/vnd.kde.kchart":{source:"iana",extensions:["chrt"]},"application/vnd.kde.kformula":{source:"iana",extensions:["kfo"]},"application/vnd.kde.kivio":{source:"iana",extensions:["flw"]},"application/vnd.kde.kontour":{source:"iana",extensions:["kon"]},"application/vnd.kde.kpresenter":{source:"iana",extensions:["kpr","kpt"]},"application/vnd.kde.kspread":{source:"iana",extensions:["ksp"]},"application/vnd.kde.kword":{source:"iana",extensions:["kwd","kwt"]},"application/vnd.kenameaapp":{source:"iana",extensions:["htke"]},"application/vnd.kidspiration":{source:"iana",extensions:["kia"]},"application/vnd.kinar":{source:"iana",extensions:["kne","knp"]},"application/vnd.koan":{source:"iana",extensions:["skp","skd","skt","skm"]},"application/vnd.kodak-descriptor":{source:"iana",extensions:["sse"]},"application/vnd.las":{source:"iana"},"application/vnd.las.las+json":{source:"iana",compressible:!0},"application/vnd.las.las+xml":{source:"iana",compressible:!0,extensions:["lasxml"]},"application/vnd.laszip":{source:"iana"},"application/vnd.leap+json":{source:"iana",compressible:!0},"application/vnd.liberty-request+xml":{source:"iana",compressible:!0},"application/vnd.llamagraphics.life-balance.desktop":{source:"iana",extensions:["lbd"]},"application/vnd.llamagraphics.life-balance.exchange+xml":{source:"iana",compressible:!0,extensions:["lbe"]},"application/vnd.logipipe.circuit+zip":{source:"iana",compressible:!1},"application/vnd.loom":{source:"iana"},"application/vnd.lotus-1-2-3":{source:"iana",extensions:["123"]},"application/vnd.lotus-approach":{source:"iana",extensions:["apr"]},"application/vnd.lotus-freelance":{source:"iana",extensions:["pre"]},"application/vnd.lotus-notes":{source:"iana",extensions:["nsf"]},"application/vnd.lotus-organizer":{source:"iana",extensions:["org"]},"application/vnd.lotus-screencam":{source:"iana",extensions:["scm"]},"application/vnd.lotus-wordpro":{source:"iana",extensions:["lwp"]},"application/vnd.macports.portpkg":{source:"iana",extensions:["portpkg"]},"application/vnd.mapbox-vector-tile":{source:"iana",extensions:["mvt"]},"application/vnd.marlin.drm.actiontoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.conftoken+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.license+xml":{source:"iana",compressible:!0},"application/vnd.marlin.drm.mdcf":{source:"iana"},"application/vnd.mason+json":{source:"iana",compressible:!0},"application/vnd.maxar.archive.3tz+zip":{source:"iana",compressible:!1},"application/vnd.maxmind.maxmind-db":{source:"iana"},"application/vnd.mcd":{source:"iana",extensions:["mcd"]},"application/vnd.medcalcdata":{source:"iana",extensions:["mc1"]},"application/vnd.mediastation.cdkey":{source:"iana",extensions:["cdkey"]},"application/vnd.meridian-slingshot":{source:"iana"},"application/vnd.mfer":{source:"iana",extensions:["mwf"]},"application/vnd.mfmp":{source:"iana",extensions:["mfm"]},"application/vnd.micro+json":{source:"iana",compressible:!0},"application/vnd.micrografx.flo":{source:"iana",extensions:["flo"]},"application/vnd.micrografx.igx":{source:"iana",extensions:["igx"]},"application/vnd.microsoft.portable-executable":{source:"iana"},"application/vnd.microsoft.windows.thumbnail-cache":{source:"iana"},"application/vnd.miele+json":{source:"iana",compressible:!0},"application/vnd.mif":{source:"iana",extensions:["mif"]},"application/vnd.minisoft-hp3000-save":{source:"iana"},"application/vnd.mitsubishi.misty-guard.trustweb":{source:"iana"},"application/vnd.mobius.daf":{source:"iana",extensions:["daf"]},"application/vnd.mobius.dis":{source:"iana",extensions:["dis"]},"application/vnd.mobius.mbk":{source:"iana",extensions:["mbk"]},"application/vnd.mobius.mqy":{source:"iana",extensions:["mqy"]},"application/vnd.mobius.msl":{source:"iana",extensions:["msl"]},"application/vnd.mobius.plc":{source:"iana",extensions:["plc"]},"application/vnd.mobius.txf":{source:"iana",extensions:["txf"]},"application/vnd.mophun.application":{source:"iana",extensions:["mpn"]},"application/vnd.mophun.certificate":{source:"iana",extensions:["mpc"]},"application/vnd.motorola.flexsuite":{source:"iana"},"application/vnd.motorola.flexsuite.adsi":{source:"iana"},"application/vnd.motorola.flexsuite.fis":{source:"iana"},"application/vnd.motorola.flexsuite.gotap":{source:"iana"},"application/vnd.motorola.flexsuite.kmr":{source:"iana"},"application/vnd.motorola.flexsuite.ttc":{source:"iana"},"application/vnd.motorola.flexsuite.wem":{source:"iana"},"application/vnd.motorola.iprm":{source:"iana"},"application/vnd.mozilla.xul+xml":{source:"iana",compressible:!0,extensions:["xul"]},"application/vnd.ms-3mfdocument":{source:"iana"},"application/vnd.ms-artgalry":{source:"iana",extensions:["cil"]},"application/vnd.ms-asf":{source:"iana"},"application/vnd.ms-cab-compressed":{source:"iana",extensions:["cab"]},"application/vnd.ms-color.iccprofile":{source:"apache"},"application/vnd.ms-excel":{source:"iana",compressible:!1,extensions:["xls","xlm","xla","xlc","xlt","xlw"]},"application/vnd.ms-excel.addin.macroenabled.12":{source:"iana",extensions:["xlam"]},"application/vnd.ms-excel.sheet.binary.macroenabled.12":{source:"iana",extensions:["xlsb"]},"application/vnd.ms-excel.sheet.macroenabled.12":{source:"iana",extensions:["xlsm"]},"application/vnd.ms-excel.template.macroenabled.12":{source:"iana",extensions:["xltm"]},"application/vnd.ms-fontobject":{source:"iana",compressible:!0,extensions:["eot"]},"application/vnd.ms-htmlhelp":{source:"iana",extensions:["chm"]},"application/vnd.ms-ims":{source:"iana",extensions:["ims"]},"application/vnd.ms-lrm":{source:"iana",extensions:["lrm"]},"application/vnd.ms-office.activex+xml":{source:"iana",compressible:!0},"application/vnd.ms-officetheme":{source:"iana",extensions:["thmx"]},"application/vnd.ms-opentype":{source:"apache",compressible:!0},"application/vnd.ms-outlook":{compressible:!1,extensions:["msg"]},"application/vnd.ms-package.obfuscated-opentype":{source:"apache"},"application/vnd.ms-pki.seccat":{source:"apache",extensions:["cat"]},"application/vnd.ms-pki.stl":{source:"apache",extensions:["stl"]},"application/vnd.ms-playready.initiator+xml":{source:"iana",compressible:!0},"application/vnd.ms-powerpoint":{source:"iana",compressible:!1,extensions:["ppt","pps","pot"]},"application/vnd.ms-powerpoint.addin.macroenabled.12":{source:"iana",extensions:["ppam"]},"application/vnd.ms-powerpoint.presentation.macroenabled.12":{source:"iana",extensions:["pptm"]},"application/vnd.ms-powerpoint.slide.macroenabled.12":{source:"iana",extensions:["sldm"]},"application/vnd.ms-powerpoint.slideshow.macroenabled.12":{source:"iana",extensions:["ppsm"]},"application/vnd.ms-powerpoint.template.macroenabled.12":{source:"iana",extensions:["potm"]},"application/vnd.ms-printdevicecapabilities+xml":{source:"iana",compressible:!0},"application/vnd.ms-printing.printticket+xml":{source:"apache",compressible:!0},"application/vnd.ms-printschematicket+xml":{source:"iana",compressible:!0},"application/vnd.ms-project":{source:"iana",extensions:["mpp","mpt"]},"application/vnd.ms-tnef":{source:"iana"},"application/vnd.ms-windows.devicepairing":{source:"iana"},"application/vnd.ms-windows.nwprinting.oob":{source:"iana"},"application/vnd.ms-windows.printerpairing":{source:"iana"},"application/vnd.ms-windows.wsd.oob":{source:"iana"},"application/vnd.ms-wmdrm.lic-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.lic-resp":{source:"iana"},"application/vnd.ms-wmdrm.meter-chlg-req":{source:"iana"},"application/vnd.ms-wmdrm.meter-resp":{source:"iana"},"application/vnd.ms-word.document.macroenabled.12":{source:"iana",extensions:["docm"]},"application/vnd.ms-word.template.macroenabled.12":{source:"iana",extensions:["dotm"]},"application/vnd.ms-works":{source:"iana",extensions:["wps","wks","wcm","wdb"]},"application/vnd.ms-wpl":{source:"iana",extensions:["wpl"]},"application/vnd.ms-xpsdocument":{source:"iana",compressible:!1,extensions:["xps"]},"application/vnd.msa-disk-image":{source:"iana"},"application/vnd.mseq":{source:"iana",extensions:["mseq"]},"application/vnd.msign":{source:"iana"},"application/vnd.multiad.creator":{source:"iana"},"application/vnd.multiad.creator.cif":{source:"iana"},"application/vnd.music-niff":{source:"iana"},"application/vnd.musician":{source:"iana",extensions:["mus"]},"application/vnd.muvee.style":{source:"iana",extensions:["msty"]},"application/vnd.mynfc":{source:"iana",extensions:["taglet"]},"application/vnd.nacamar.ybrid+json":{source:"iana",compressible:!0},"application/vnd.ncd.control":{source:"iana"},"application/vnd.ncd.reference":{source:"iana"},"application/vnd.nearst.inv+json":{source:"iana",compressible:!0},"application/vnd.nebumind.line":{source:"iana"},"application/vnd.nervana":{source:"iana"},"application/vnd.netfpx":{source:"iana"},"application/vnd.neurolanguage.nlu":{source:"iana",extensions:["nlu"]},"application/vnd.nimn":{source:"iana"},"application/vnd.nintendo.nitro.rom":{source:"iana"},"application/vnd.nintendo.snes.rom":{source:"iana"},"application/vnd.nitf":{source:"iana",extensions:["ntf","nitf"]},"application/vnd.noblenet-directory":{source:"iana",extensions:["nnd"]},"application/vnd.noblenet-sealer":{source:"iana",extensions:["nns"]},"application/vnd.noblenet-web":{source:"iana",extensions:["nnw"]},"application/vnd.nokia.catalogs":{source:"iana"},"application/vnd.nokia.conml+wbxml":{source:"iana"},"application/vnd.nokia.conml+xml":{source:"iana",compressible:!0},"application/vnd.nokia.iptv.config+xml":{source:"iana",compressible:!0},"application/vnd.nokia.isds-radio-presets":{source:"iana"},"application/vnd.nokia.landmark+wbxml":{source:"iana"},"application/vnd.nokia.landmark+xml":{source:"iana",compressible:!0},"application/vnd.nokia.landmarkcollection+xml":{source:"iana",compressible:!0},"application/vnd.nokia.n-gage.ac+xml":{source:"iana",compressible:!0,extensions:["ac"]},"application/vnd.nokia.n-gage.data":{source:"iana",extensions:["ngdat"]},"application/vnd.nokia.n-gage.symbian.install":{source:"iana",extensions:["n-gage"]},"application/vnd.nokia.ncd":{source:"iana"},"application/vnd.nokia.pcd+wbxml":{source:"iana"},"application/vnd.nokia.pcd+xml":{source:"iana",compressible:!0},"application/vnd.nokia.radio-preset":{source:"iana",extensions:["rpst"]},"application/vnd.nokia.radio-presets":{source:"iana",extensions:["rpss"]},"application/vnd.novadigm.edm":{source:"iana",extensions:["edm"]},"application/vnd.novadigm.edx":{source:"iana",extensions:["edx"]},"application/vnd.novadigm.ext":{source:"iana",extensions:["ext"]},"application/vnd.ntt-local.content-share":{source:"iana"},"application/vnd.ntt-local.file-transfer":{source:"iana"},"application/vnd.ntt-local.ogw_remote-access":{source:"iana"},"application/vnd.ntt-local.sip-ta_remote":{source:"iana"},"application/vnd.ntt-local.sip-ta_tcp_stream":{source:"iana"},"application/vnd.oasis.opendocument.chart":{source:"iana",extensions:["odc"]},"application/vnd.oasis.opendocument.chart-template":{source:"iana",extensions:["otc"]},"application/vnd.oasis.opendocument.database":{source:"iana",extensions:["odb"]},"application/vnd.oasis.opendocument.formula":{source:"iana",extensions:["odf"]},"application/vnd.oasis.opendocument.formula-template":{source:"iana",extensions:["odft"]},"application/vnd.oasis.opendocument.graphics":{source:"iana",compressible:!1,extensions:["odg"]},"application/vnd.oasis.opendocument.graphics-template":{source:"iana",extensions:["otg"]},"application/vnd.oasis.opendocument.image":{source:"iana",extensions:["odi"]},"application/vnd.oasis.opendocument.image-template":{source:"iana",extensions:["oti"]},"application/vnd.oasis.opendocument.presentation":{source:"iana",compressible:!1,extensions:["odp"]},"application/vnd.oasis.opendocument.presentation-template":{source:"iana",extensions:["otp"]},"application/vnd.oasis.opendocument.spreadsheet":{source:"iana",compressible:!1,extensions:["ods"]},"application/vnd.oasis.opendocument.spreadsheet-template":{source:"iana",extensions:["ots"]},"application/vnd.oasis.opendocument.text":{source:"iana",compressible:!1,extensions:["odt"]},"application/vnd.oasis.opendocument.text-master":{source:"iana",extensions:["odm"]},"application/vnd.oasis.opendocument.text-template":{source:"iana",extensions:["ott"]},"application/vnd.oasis.opendocument.text-web":{source:"iana",extensions:["oth"]},"application/vnd.obn":{source:"iana"},"application/vnd.ocf+cbor":{source:"iana"},"application/vnd.oci.image.manifest.v1+json":{source:"iana",compressible:!0},"application/vnd.oftn.l10n+json":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessdownload+xml":{source:"iana",compressible:!0},"application/vnd.oipf.contentaccessstreaming+xml":{source:"iana",compressible:!0},"application/vnd.oipf.cspg-hexbinary":{source:"iana"},"application/vnd.oipf.dae.svg+xml":{source:"iana",compressible:!0},"application/vnd.oipf.dae.xhtml+xml":{source:"iana",compressible:!0},"application/vnd.oipf.mippvcontrolmessage+xml":{source:"iana",compressible:!0},"application/vnd.oipf.pae.gem":{source:"iana"},"application/vnd.oipf.spdiscovery+xml":{source:"iana",compressible:!0},"application/vnd.oipf.spdlist+xml":{source:"iana",compressible:!0},"application/vnd.oipf.ueprofile+xml":{source:"iana",compressible:!0},"application/vnd.oipf.userprofile+xml":{source:"iana",compressible:!0},"application/vnd.olpc-sugar":{source:"iana",extensions:["xo"]},"application/vnd.oma-scws-config":{source:"iana"},"application/vnd.oma-scws-http-request":{source:"iana"},"application/vnd.oma-scws-http-response":{source:"iana"},"application/vnd.oma.bcast.associated-procedure-parameter+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.drm-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.imd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.ltkm":{source:"iana"},"application/vnd.oma.bcast.notification+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.provisioningtrigger":{source:"iana"},"application/vnd.oma.bcast.sgboot":{source:"iana"},"application/vnd.oma.bcast.sgdd+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sgdu":{source:"iana"},"application/vnd.oma.bcast.simple-symbol-container":{source:"iana"},"application/vnd.oma.bcast.smartcard-trigger+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.sprov+xml":{source:"iana",compressible:!0},"application/vnd.oma.bcast.stkm":{source:"iana"},"application/vnd.oma.cab-address-book+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-feature-handler+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-pcc+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-subs-invite+xml":{source:"iana",compressible:!0},"application/vnd.oma.cab-user-prefs+xml":{source:"iana",compressible:!0},"application/vnd.oma.dcd":{source:"iana"},"application/vnd.oma.dcdc":{source:"iana"},"application/vnd.oma.dd2+xml":{source:"iana",compressible:!0,extensions:["dd2"]},"application/vnd.oma.drm.risd+xml":{source:"iana",compressible:!0},"application/vnd.oma.group-usage-list+xml":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+cbor":{source:"iana"},"application/vnd.oma.lwm2m+json":{source:"iana",compressible:!0},"application/vnd.oma.lwm2m+tlv":{source:"iana"},"application/vnd.oma.pal+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.detailed-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.final-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.groups+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.invocation-descriptor+xml":{source:"iana",compressible:!0},"application/vnd.oma.poc.optimized-progress-report+xml":{source:"iana",compressible:!0},"application/vnd.oma.push":{source:"iana"},"application/vnd.oma.scidm.messages+xml":{source:"iana",compressible:!0},"application/vnd.oma.xcap-directory+xml":{source:"iana",compressible:!0},"application/vnd.omads-email+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-file+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omads-folder+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.omaloc-supl-init":{source:"iana"},"application/vnd.onepager":{source:"iana"},"application/vnd.onepagertamp":{source:"iana"},"application/vnd.onepagertamx":{source:"iana"},"application/vnd.onepagertat":{source:"iana"},"application/vnd.onepagertatp":{source:"iana"},"application/vnd.onepagertatx":{source:"iana"},"application/vnd.openblox.game+xml":{source:"iana",compressible:!0,extensions:["obgx"]},"application/vnd.openblox.game-binary":{source:"iana"},"application/vnd.openeye.oeb":{source:"iana"},"application/vnd.openofficeorg.extension":{source:"apache",extensions:["oxt"]},"application/vnd.openstreetmap.data+xml":{source:"iana",compressible:!0,extensions:["osm"]},"application/vnd.opentimestamps.ots":{source:"iana"},"application/vnd.openxmlformats-officedocument.custom-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.customxmlproperties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawing+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chart+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.extended-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{source:"iana",compressible:!1,extensions:["pptx"]},"application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.presprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slide":{source:"iana",extensions:["sldx"]},"application/vnd.openxmlformats-officedocument.presentationml.slide+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideshow":{source:"iana",extensions:["ppsx"]},"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.tags+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.template":{source:"iana",extensions:["potx"]},"application/vnd.openxmlformats-officedocument.presentationml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{source:"iana",compressible:!1,extensions:["xlsx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.template":{source:"iana",extensions:["xltx"]},"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.theme+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.themeoverride+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.vmldrawing":{source:"iana"},"application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{source:"iana",compressible:!1,extensions:["docx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.template":{source:"iana",extensions:["dotx"]},"application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.core-properties+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml":{source:"iana",compressible:!0},"application/vnd.openxmlformats-package.relationships+xml":{source:"iana",compressible:!0},"application/vnd.oracle.resource+json":{source:"iana",compressible:!0},"application/vnd.orange.indata":{source:"iana"},"application/vnd.osa.netdeploy":{source:"iana"},"application/vnd.osgeo.mapguide.package":{source:"iana",extensions:["mgp"]},"application/vnd.osgi.bundle":{source:"iana"},"application/vnd.osgi.dp":{source:"iana",extensions:["dp"]},"application/vnd.osgi.subsystem":{source:"iana",extensions:["esa"]},"application/vnd.otps.ct-kip+xml":{source:"iana",compressible:!0},"application/vnd.oxli.countgraph":{source:"iana"},"application/vnd.pagerduty+json":{source:"iana",compressible:!0},"application/vnd.palm":{source:"iana",extensions:["pdb","pqa","oprc"]},"application/vnd.panoply":{source:"iana"},"application/vnd.paos.xml":{source:"iana"},"application/vnd.patentdive":{source:"iana"},"application/vnd.patientecommsdoc":{source:"iana"},"application/vnd.pawaafile":{source:"iana",extensions:["paw"]},"application/vnd.pcos":{source:"iana"},"application/vnd.pg.format":{source:"iana",extensions:["str"]},"application/vnd.pg.osasli":{source:"iana",extensions:["ei6"]},"application/vnd.piaccess.application-licence":{source:"iana"},"application/vnd.picsel":{source:"iana",extensions:["efif"]},"application/vnd.pmi.widget":{source:"iana",extensions:["wg"]},"application/vnd.poc.group-advertisement+xml":{source:"iana",compressible:!0},"application/vnd.pocketlearn":{source:"iana",extensions:["plf"]},"application/vnd.powerbuilder6":{source:"iana",extensions:["pbd"]},"application/vnd.powerbuilder6-s":{source:"iana"},"application/vnd.powerbuilder7":{source:"iana"},"application/vnd.powerbuilder7-s":{source:"iana"},"application/vnd.powerbuilder75":{source:"iana"},"application/vnd.powerbuilder75-s":{source:"iana"},"application/vnd.preminet":{source:"iana"},"application/vnd.previewsystems.box":{source:"iana",extensions:["box"]},"application/vnd.proteus.magazine":{source:"iana",extensions:["mgz"]},"application/vnd.psfs":{source:"iana"},"application/vnd.publishare-delta-tree":{source:"iana",extensions:["qps"]},"application/vnd.pvi.ptid1":{source:"iana",extensions:["ptid"]},"application/vnd.pwg-multiplexed":{source:"iana"},"application/vnd.pwg-xhtml-print+xml":{source:"iana",compressible:!0},"application/vnd.qualcomm.brew-app-res":{source:"iana"},"application/vnd.quarantainenet":{source:"iana"},"application/vnd.quark.quarkxpress":{source:"iana",extensions:["qxd","qxt","qwd","qwt","qxl","qxb"]},"application/vnd.quobject-quoxdocument":{source:"iana"},"application/vnd.radisys.moml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-conn+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-audit-stream+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-conf+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-base+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-detect+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-fax-sendrecv+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-group+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-speech+xml":{source:"iana",compressible:!0},"application/vnd.radisys.msml-dialog-transform+xml":{source:"iana",compressible:!0},"application/vnd.rainstor.data":{source:"iana"},"application/vnd.rapid":{source:"iana"},"application/vnd.rar":{source:"iana",extensions:["rar"]},"application/vnd.realvnc.bed":{source:"iana",extensions:["bed"]},"application/vnd.recordare.musicxml":{source:"iana",extensions:["mxl"]},"application/vnd.recordare.musicxml+xml":{source:"iana",compressible:!0,extensions:["musicxml"]},"application/vnd.renlearn.rlprint":{source:"iana"},"application/vnd.resilient.logic":{source:"iana"},"application/vnd.restful+json":{source:"iana",compressible:!0},"application/vnd.rig.cryptonote":{source:"iana",extensions:["cryptonote"]},"application/vnd.rim.cod":{source:"apache",extensions:["cod"]},"application/vnd.rn-realmedia":{source:"apache",extensions:["rm"]},"application/vnd.rn-realmedia-vbr":{source:"apache",extensions:["rmvb"]},"application/vnd.route66.link66+xml":{source:"iana",compressible:!0,extensions:["link66"]},"application/vnd.rs-274x":{source:"iana"},"application/vnd.ruckus.download":{source:"iana"},"application/vnd.s3sms":{source:"iana"},"application/vnd.sailingtracker.track":{source:"iana",extensions:["st"]},"application/vnd.sar":{source:"iana"},"application/vnd.sbm.cid":{source:"iana"},"application/vnd.sbm.mid2":{source:"iana"},"application/vnd.scribus":{source:"iana"},"application/vnd.sealed.3df":{source:"iana"},"application/vnd.sealed.csf":{source:"iana"},"application/vnd.sealed.doc":{source:"iana"},"application/vnd.sealed.eml":{source:"iana"},"application/vnd.sealed.mht":{source:"iana"},"application/vnd.sealed.net":{source:"iana"},"application/vnd.sealed.ppt":{source:"iana"},"application/vnd.sealed.tiff":{source:"iana"},"application/vnd.sealed.xls":{source:"iana"},"application/vnd.sealedmedia.softseal.html":{source:"iana"},"application/vnd.sealedmedia.softseal.pdf":{source:"iana"},"application/vnd.seemail":{source:"iana",extensions:["see"]},"application/vnd.seis+json":{source:"iana",compressible:!0},"application/vnd.sema":{source:"iana",extensions:["sema"]},"application/vnd.semd":{source:"iana",extensions:["semd"]},"application/vnd.semf":{source:"iana",extensions:["semf"]},"application/vnd.shade-save-file":{source:"iana"},"application/vnd.shana.informed.formdata":{source:"iana",extensions:["ifm"]},"application/vnd.shana.informed.formtemplate":{source:"iana",extensions:["itp"]},"application/vnd.shana.informed.interchange":{source:"iana",extensions:["iif"]},"application/vnd.shana.informed.package":{source:"iana",extensions:["ipk"]},"application/vnd.shootproof+json":{source:"iana",compressible:!0},"application/vnd.shopkick+json":{source:"iana",compressible:!0},"application/vnd.shp":{source:"iana"},"application/vnd.shx":{source:"iana"},"application/vnd.sigrok.session":{source:"iana"},"application/vnd.simtech-mindmapper":{source:"iana",extensions:["twd","twds"]},"application/vnd.siren+json":{source:"iana",compressible:!0},"application/vnd.smaf":{source:"iana",extensions:["mmf"]},"application/vnd.smart.notebook":{source:"iana"},"application/vnd.smart.teacher":{source:"iana",extensions:["teacher"]},"application/vnd.snesdev-page-table":{source:"iana"},"application/vnd.software602.filler.form+xml":{source:"iana",compressible:!0,extensions:["fo"]},"application/vnd.software602.filler.form-xml-zip":{source:"iana"},"application/vnd.solent.sdkm+xml":{source:"iana",compressible:!0,extensions:["sdkm","sdkd"]},"application/vnd.spotfire.dxp":{source:"iana",extensions:["dxp"]},"application/vnd.spotfire.sfs":{source:"iana",extensions:["sfs"]},"application/vnd.sqlite3":{source:"iana"},"application/vnd.sss-cod":{source:"iana"},"application/vnd.sss-dtf":{source:"iana"},"application/vnd.sss-ntf":{source:"iana"},"application/vnd.stardivision.calc":{source:"apache",extensions:["sdc"]},"application/vnd.stardivision.draw":{source:"apache",extensions:["sda"]},"application/vnd.stardivision.impress":{source:"apache",extensions:["sdd"]},"application/vnd.stardivision.math":{source:"apache",extensions:["smf"]},"application/vnd.stardivision.writer":{source:"apache",extensions:["sdw","vor"]},"application/vnd.stardivision.writer-global":{source:"apache",extensions:["sgl"]},"application/vnd.stepmania.package":{source:"iana",extensions:["smzip"]},"application/vnd.stepmania.stepchart":{source:"iana",extensions:["sm"]},"application/vnd.street-stream":{source:"iana"},"application/vnd.sun.wadl+xml":{source:"iana",compressible:!0,extensions:["wadl"]},"application/vnd.sun.xml.calc":{source:"apache",extensions:["sxc"]},"application/vnd.sun.xml.calc.template":{source:"apache",extensions:["stc"]},"application/vnd.sun.xml.draw":{source:"apache",extensions:["sxd"]},"application/vnd.sun.xml.draw.template":{source:"apache",extensions:["std"]},"application/vnd.sun.xml.impress":{source:"apache",extensions:["sxi"]},"application/vnd.sun.xml.impress.template":{source:"apache",extensions:["sti"]},"application/vnd.sun.xml.math":{source:"apache",extensions:["sxm"]},"application/vnd.sun.xml.writer":{source:"apache",extensions:["sxw"]},"application/vnd.sun.xml.writer.global":{source:"apache",extensions:["sxg"]},"application/vnd.sun.xml.writer.template":{source:"apache",extensions:["stw"]},"application/vnd.sus-calendar":{source:"iana",extensions:["sus","susp"]},"application/vnd.svd":{source:"iana",extensions:["svd"]},"application/vnd.swiftview-ics":{source:"iana"},"application/vnd.sycle+xml":{source:"iana",compressible:!0},"application/vnd.syft+json":{source:"iana",compressible:!0},"application/vnd.symbian.install":{source:"apache",extensions:["sis","sisx"]},"application/vnd.syncml+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xsm"]},"application/vnd.syncml.dm+wbxml":{source:"iana",charset:"UTF-8",extensions:["bdm"]},"application/vnd.syncml.dm+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["xdm"]},"application/vnd.syncml.dm.notification":{source:"iana"},"application/vnd.syncml.dmddf+wbxml":{source:"iana"},"application/vnd.syncml.dmddf+xml":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["ddf"]},"application/vnd.syncml.dmtnds+wbxml":{source:"iana"},"application/vnd.syncml.dmtnds+xml":{source:"iana",charset:"UTF-8",compressible:!0},"application/vnd.syncml.ds.notification":{source:"iana"},"application/vnd.tableschema+json":{source:"iana",compressible:!0},"application/vnd.tao.intent-module-archive":{source:"iana",extensions:["tao"]},"application/vnd.tcpdump.pcap":{source:"iana",extensions:["pcap","cap","dmp"]},"application/vnd.think-cell.ppttc+json":{source:"iana",compressible:!0},"application/vnd.tmd.mediaflex.api+xml":{source:"iana",compressible:!0},"application/vnd.tml":{source:"iana"},"application/vnd.tmobile-livetv":{source:"iana",extensions:["tmo"]},"application/vnd.tri.onesource":{source:"iana"},"application/vnd.trid.tpt":{source:"iana",extensions:["tpt"]},"application/vnd.triscape.mxs":{source:"iana",extensions:["mxs"]},"application/vnd.trueapp":{source:"iana",extensions:["tra"]},"application/vnd.truedoc":{source:"iana"},"application/vnd.ubisoft.webplayer":{source:"iana"},"application/vnd.ufdl":{source:"iana",extensions:["ufd","ufdl"]},"application/vnd.uiq.theme":{source:"iana",extensions:["utz"]},"application/vnd.umajin":{source:"iana",extensions:["umj"]},"application/vnd.unity":{source:"iana",extensions:["unityweb"]},"application/vnd.uoml+xml":{source:"iana",compressible:!0,extensions:["uoml"]},"application/vnd.uplanet.alert":{source:"iana"},"application/vnd.uplanet.alert-wbxml":{source:"iana"},"application/vnd.uplanet.bearer-choice":{source:"iana"},"application/vnd.uplanet.bearer-choice-wbxml":{source:"iana"},"application/vnd.uplanet.cacheop":{source:"iana"},"application/vnd.uplanet.cacheop-wbxml":{source:"iana"},"application/vnd.uplanet.channel":{source:"iana"},"application/vnd.uplanet.channel-wbxml":{source:"iana"},"application/vnd.uplanet.list":{source:"iana"},"application/vnd.uplanet.list-wbxml":{source:"iana"},"application/vnd.uplanet.listcmd":{source:"iana"},"application/vnd.uplanet.listcmd-wbxml":{source:"iana"},"application/vnd.uplanet.signal":{source:"iana"},"application/vnd.uri-map":{source:"iana"},"application/vnd.valve.source.material":{source:"iana"},"application/vnd.vcx":{source:"iana",extensions:["vcx"]},"application/vnd.vd-study":{source:"iana"},"application/vnd.vectorworks":{source:"iana"},"application/vnd.vel+json":{source:"iana",compressible:!0},"application/vnd.verimatrix.vcas":{source:"iana"},"application/vnd.veritone.aion+json":{source:"iana",compressible:!0},"application/vnd.veryant.thin":{source:"iana"},"application/vnd.ves.encrypted":{source:"iana"},"application/vnd.vidsoft.vidconference":{source:"iana"},"application/vnd.visio":{source:"iana",extensions:["vsd","vst","vss","vsw"]},"application/vnd.visionary":{source:"iana",extensions:["vis"]},"application/vnd.vividence.scriptfile":{source:"iana"},"application/vnd.vsf":{source:"iana",extensions:["vsf"]},"application/vnd.wap.sic":{source:"iana"},"application/vnd.wap.slc":{source:"iana"},"application/vnd.wap.wbxml":{source:"iana",charset:"UTF-8",extensions:["wbxml"]},"application/vnd.wap.wmlc":{source:"iana",extensions:["wmlc"]},"application/vnd.wap.wmlscriptc":{source:"iana",extensions:["wmlsc"]},"application/vnd.webturbo":{source:"iana",extensions:["wtb"]},"application/vnd.wfa.dpp":{source:"iana"},"application/vnd.wfa.p2p":{source:"iana"},"application/vnd.wfa.wsc":{source:"iana"},"application/vnd.windows.devicepairing":{source:"iana"},"application/vnd.wmc":{source:"iana"},"application/vnd.wmf.bootstrap":{source:"iana"},"application/vnd.wolfram.mathematica":{source:"iana"},"application/vnd.wolfram.mathematica.package":{source:"iana"},"application/vnd.wolfram.player":{source:"iana",extensions:["nbp"]},"application/vnd.wordperfect":{source:"iana",extensions:["wpd"]},"application/vnd.wqd":{source:"iana",extensions:["wqd"]},"application/vnd.wrq-hp3000-labelled":{source:"iana"},"application/vnd.wt.stf":{source:"iana",extensions:["stf"]},"application/vnd.wv.csp+wbxml":{source:"iana"},"application/vnd.wv.csp+xml":{source:"iana",compressible:!0},"application/vnd.wv.ssp+xml":{source:"iana",compressible:!0},"application/vnd.xacml+json":{source:"iana",compressible:!0},"application/vnd.xara":{source:"iana",extensions:["xar"]},"application/vnd.xfdl":{source:"iana",extensions:["xfdl"]},"application/vnd.xfdl.webform":{source:"iana"},"application/vnd.xmi+xml":{source:"iana",compressible:!0},"application/vnd.xmpie.cpkg":{source:"iana"},"application/vnd.xmpie.dpkg":{source:"iana"},"application/vnd.xmpie.plan":{source:"iana"},"application/vnd.xmpie.ppkg":{source:"iana"},"application/vnd.xmpie.xlim":{source:"iana"},"application/vnd.yamaha.hv-dic":{source:"iana",extensions:["hvd"]},"application/vnd.yamaha.hv-script":{source:"iana",extensions:["hvs"]},"application/vnd.yamaha.hv-voice":{source:"iana",extensions:["hvp"]},"application/vnd.yamaha.openscoreformat":{source:"iana",extensions:["osf"]},"application/vnd.yamaha.openscoreformat.osfpvg+xml":{source:"iana",compressible:!0,extensions:["osfpvg"]},"application/vnd.yamaha.remote-setup":{source:"iana"},"application/vnd.yamaha.smaf-audio":{source:"iana",extensions:["saf"]},"application/vnd.yamaha.smaf-phrase":{source:"iana",extensions:["spf"]},"application/vnd.yamaha.through-ngn":{source:"iana"},"application/vnd.yamaha.tunnel-udpencap":{source:"iana"},"application/vnd.yaoweme":{source:"iana"},"application/vnd.yellowriver-custom-menu":{source:"iana",extensions:["cmp"]},"application/vnd.youtube.yt":{source:"iana"},"application/vnd.zul":{source:"iana",extensions:["zir","zirz"]},"application/vnd.zzazz.deck+xml":{source:"iana",compressible:!0,extensions:["zaz"]},"application/voicexml+xml":{source:"iana",compressible:!0,extensions:["vxml"]},"application/voucher-cms+json":{source:"iana",compressible:!0},"application/vq-rtcpxr":{source:"iana"},"application/wasm":{source:"iana",compressible:!0,extensions:["wasm"]},"application/watcherinfo+xml":{source:"iana",compressible:!0,extensions:["wif"]},"application/webpush-options+json":{source:"iana",compressible:!0},"application/whoispp-query":{source:"iana"},"application/whoispp-response":{source:"iana"},"application/widget":{source:"iana",extensions:["wgt"]},"application/winhlp":{source:"apache",extensions:["hlp"]},"application/wita":{source:"iana"},"application/wordperfect5.1":{source:"iana"},"application/wsdl+xml":{source:"iana",compressible:!0,extensions:["wsdl"]},"application/wspolicy+xml":{source:"iana",compressible:!0,extensions:["wspolicy"]},"application/x-7z-compressed":{source:"apache",compressible:!1,extensions:["7z"]},"application/x-abiword":{source:"apache",extensions:["abw"]},"application/x-ace-compressed":{source:"apache",extensions:["ace"]},"application/x-amf":{source:"apache"},"application/x-apple-diskimage":{source:"apache",extensions:["dmg"]},"application/x-arj":{compressible:!1,extensions:["arj"]},"application/x-authorware-bin":{source:"apache",extensions:["aab","x32","u32","vox"]},"application/x-authorware-map":{source:"apache",extensions:["aam"]},"application/x-authorware-seg":{source:"apache",extensions:["aas"]},"application/x-bcpio":{source:"apache",extensions:["bcpio"]},"application/x-bdoc":{compressible:!1,extensions:["bdoc"]},"application/x-bittorrent":{source:"apache",extensions:["torrent"]},"application/x-blorb":{source:"apache",extensions:["blb","blorb"]},"application/x-bzip":{source:"apache",compressible:!1,extensions:["bz"]},"application/x-bzip2":{source:"apache",compressible:!1,extensions:["bz2","boz"]},"application/x-cbr":{source:"apache",extensions:["cbr","cba","cbt","cbz","cb7"]},"application/x-cdlink":{source:"apache",extensions:["vcd"]},"application/x-cfs-compressed":{source:"apache",extensions:["cfs"]},"application/x-chat":{source:"apache",extensions:["chat"]},"application/x-chess-pgn":{source:"apache",extensions:["pgn"]},"application/x-chrome-extension":{extensions:["crx"]},"application/x-cocoa":{source:"nginx",extensions:["cco"]},"application/x-compress":{source:"apache"},"application/x-conference":{source:"apache",extensions:["nsc"]},"application/x-cpio":{source:"apache",extensions:["cpio"]},"application/x-csh":{source:"apache",extensions:["csh"]},"application/x-deb":{compressible:!1},"application/x-debian-package":{source:"apache",extensions:["deb","udeb"]},"application/x-dgc-compressed":{source:"apache",extensions:["dgc"]},"application/x-director":{source:"apache",extensions:["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"]},"application/x-doom":{source:"apache",extensions:["wad"]},"application/x-dtbncx+xml":{source:"apache",compressible:!0,extensions:["ncx"]},"application/x-dtbook+xml":{source:"apache",compressible:!0,extensions:["dtb"]},"application/x-dtbresource+xml":{source:"apache",compressible:!0,extensions:["res"]},"application/x-dvi":{source:"apache",compressible:!1,extensions:["dvi"]},"application/x-envoy":{source:"apache",extensions:["evy"]},"application/x-eva":{source:"apache",extensions:["eva"]},"application/x-font-bdf":{source:"apache",extensions:["bdf"]},"application/x-font-dos":{source:"apache"},"application/x-font-framemaker":{source:"apache"},"application/x-font-ghostscript":{source:"apache",extensions:["gsf"]},"application/x-font-libgrx":{source:"apache"},"application/x-font-linux-psf":{source:"apache",extensions:["psf"]},"application/x-font-pcf":{source:"apache",extensions:["pcf"]},"application/x-font-snf":{source:"apache",extensions:["snf"]},"application/x-font-speedo":{source:"apache"},"application/x-font-sunos-news":{source:"apache"},"application/x-font-type1":{source:"apache",extensions:["pfa","pfb","pfm","afm"]},"application/x-font-vfont":{source:"apache"},"application/x-freearc":{source:"apache",extensions:["arc"]},"application/x-futuresplash":{source:"apache",extensions:["spl"]},"application/x-gca-compressed":{source:"apache",extensions:["gca"]},"application/x-glulx":{source:"apache",extensions:["ulx"]},"application/x-gnumeric":{source:"apache",extensions:["gnumeric"]},"application/x-gramps-xml":{source:"apache",extensions:["gramps"]},"application/x-gtar":{source:"apache",extensions:["gtar"]},"application/x-gzip":{source:"apache"},"application/x-hdf":{source:"apache",extensions:["hdf"]},"application/x-httpd-php":{compressible:!0,extensions:["php"]},"application/x-install-instructions":{source:"apache",extensions:["install"]},"application/x-iso9660-image":{source:"apache",extensions:["iso"]},"application/x-iwork-keynote-sffkey":{extensions:["key"]},"application/x-iwork-numbers-sffnumbers":{extensions:["numbers"]},"application/x-iwork-pages-sffpages":{extensions:["pages"]},"application/x-java-archive-diff":{source:"nginx",extensions:["jardiff"]},"application/x-java-jnlp-file":{source:"apache",compressible:!1,extensions:["jnlp"]},"application/x-javascript":{compressible:!0},"application/x-keepass2":{extensions:["kdbx"]},"application/x-latex":{source:"apache",compressible:!1,extensions:["latex"]},"application/x-lua-bytecode":{extensions:["luac"]},"application/x-lzh-compressed":{source:"apache",extensions:["lzh","lha"]},"application/x-makeself":{source:"nginx",extensions:["run"]},"application/x-mie":{source:"apache",extensions:["mie"]},"application/x-mobipocket-ebook":{source:"apache",extensions:["prc","mobi"]},"application/x-mpegurl":{compressible:!1},"application/x-ms-application":{source:"apache",extensions:["application"]},"application/x-ms-shortcut":{source:"apache",extensions:["lnk"]},"application/x-ms-wmd":{source:"apache",extensions:["wmd"]},"application/x-ms-wmz":{source:"apache",extensions:["wmz"]},"application/x-ms-xbap":{source:"apache",extensions:["xbap"]},"application/x-msaccess":{source:"apache",extensions:["mdb"]},"application/x-msbinder":{source:"apache",extensions:["obd"]},"application/x-mscardfile":{source:"apache",extensions:["crd"]},"application/x-msclip":{source:"apache",extensions:["clp"]},"application/x-msdos-program":{extensions:["exe"]},"application/x-msdownload":{source:"apache",extensions:["exe","dll","com","bat","msi"]},"application/x-msmediaview":{source:"apache",extensions:["mvb","m13","m14"]},"application/x-msmetafile":{source:"apache",extensions:["wmf","wmz","emf","emz"]},"application/x-msmoney":{source:"apache",extensions:["mny"]},"application/x-mspublisher":{source:"apache",extensions:["pub"]},"application/x-msschedule":{source:"apache",extensions:["scd"]},"application/x-msterminal":{source:"apache",extensions:["trm"]},"application/x-mswrite":{source:"apache",extensions:["wri"]},"application/x-netcdf":{source:"apache",extensions:["nc","cdf"]},"application/x-ns-proxy-autoconfig":{compressible:!0,extensions:["pac"]},"application/x-nzb":{source:"apache",extensions:["nzb"]},"application/x-perl":{source:"nginx",extensions:["pl","pm"]},"application/x-pilot":{source:"nginx",extensions:["prc","pdb"]},"application/x-pkcs12":{source:"apache",compressible:!1,extensions:["p12","pfx"]},"application/x-pkcs7-certificates":{source:"apache",extensions:["p7b","spc"]},"application/x-pkcs7-certreqresp":{source:"apache",extensions:["p7r"]},"application/x-pki-message":{source:"iana"},"application/x-rar-compressed":{source:"apache",compressible:!1,extensions:["rar"]},"application/x-redhat-package-manager":{source:"nginx",extensions:["rpm"]},"application/x-research-info-systems":{source:"apache",extensions:["ris"]},"application/x-sea":{source:"nginx",extensions:["sea"]},"application/x-sh":{source:"apache",compressible:!0,extensions:["sh"]},"application/x-shar":{source:"apache",extensions:["shar"]},"application/x-shockwave-flash":{source:"apache",compressible:!1,extensions:["swf"]},"application/x-silverlight-app":{source:"apache",extensions:["xap"]},"application/x-sql":{source:"apache",extensions:["sql"]},"application/x-stuffit":{source:"apache",compressible:!1,extensions:["sit"]},"application/x-stuffitx":{source:"apache",extensions:["sitx"]},"application/x-subrip":{source:"apache",extensions:["srt"]},"application/x-sv4cpio":{source:"apache",extensions:["sv4cpio"]},"application/x-sv4crc":{source:"apache",extensions:["sv4crc"]},"application/x-t3vm-image":{source:"apache",extensions:["t3"]},"application/x-tads":{source:"apache",extensions:["gam"]},"application/x-tar":{source:"apache",compressible:!0,extensions:["tar"]},"application/x-tcl":{source:"apache",extensions:["tcl","tk"]},"application/x-tex":{source:"apache",extensions:["tex"]},"application/x-tex-tfm":{source:"apache",extensions:["tfm"]},"application/x-texinfo":{source:"apache",extensions:["texinfo","texi"]},"application/x-tgif":{source:"apache",extensions:["obj"]},"application/x-ustar":{source:"apache",extensions:["ustar"]},"application/x-virtualbox-hdd":{compressible:!0,extensions:["hdd"]},"application/x-virtualbox-ova":{compressible:!0,extensions:["ova"]},"application/x-virtualbox-ovf":{compressible:!0,extensions:["ovf"]},"application/x-virtualbox-vbox":{compressible:!0,extensions:["vbox"]},"application/x-virtualbox-vbox-extpack":{compressible:!1,extensions:["vbox-extpack"]},"application/x-virtualbox-vdi":{compressible:!0,extensions:["vdi"]},"application/x-virtualbox-vhd":{compressible:!0,extensions:["vhd"]},"application/x-virtualbox-vmdk":{compressible:!0,extensions:["vmdk"]},"application/x-wais-source":{source:"apache",extensions:["src"]},"application/x-web-app-manifest+json":{compressible:!0,extensions:["webapp"]},"application/x-www-form-urlencoded":{source:"iana",compressible:!0},"application/x-x509-ca-cert":{source:"iana",extensions:["der","crt","pem"]},"application/x-x509-ca-ra-cert":{source:"iana"},"application/x-x509-next-ca-cert":{source:"iana"},"application/x-xfig":{source:"apache",extensions:["fig"]},"application/x-xliff+xml":{source:"apache",compressible:!0,extensions:["xlf"]},"application/x-xpinstall":{source:"apache",compressible:!1,extensions:["xpi"]},"application/x-xz":{source:"apache",extensions:["xz"]},"application/x-zmachine":{source:"apache",extensions:["z1","z2","z3","z4","z5","z6","z7","z8"]},"application/x400-bp":{source:"iana"},"application/xacml+xml":{source:"iana",compressible:!0},"application/xaml+xml":{source:"apache",compressible:!0,extensions:["xaml"]},"application/xcap-att+xml":{source:"iana",compressible:!0,extensions:["xav"]},"application/xcap-caps+xml":{source:"iana",compressible:!0,extensions:["xca"]},"application/xcap-diff+xml":{source:"iana",compressible:!0,extensions:["xdf"]},"application/xcap-el+xml":{source:"iana",compressible:!0,extensions:["xel"]},"application/xcap-error+xml":{source:"iana",compressible:!0},"application/xcap-ns+xml":{source:"iana",compressible:!0,extensions:["xns"]},"application/xcon-conference-info+xml":{source:"iana",compressible:!0},"application/xcon-conference-info-diff+xml":{source:"iana",compressible:!0},"application/xenc+xml":{source:"iana",compressible:!0,extensions:["xenc"]},"application/xhtml+xml":{source:"iana",compressible:!0,extensions:["xhtml","xht"]},"application/xhtml-voice+xml":{source:"apache",compressible:!0},"application/xliff+xml":{source:"iana",compressible:!0,extensions:["xlf"]},"application/xml":{source:"iana",compressible:!0,extensions:["xml","xsl","xsd","rng"]},"application/xml-dtd":{source:"iana",compressible:!0,extensions:["dtd"]},"application/xml-external-parsed-entity":{source:"iana"},"application/xml-patch+xml":{source:"iana",compressible:!0},"application/xmpp+xml":{source:"iana",compressible:!0},"application/xop+xml":{source:"iana",compressible:!0,extensions:["xop"]},"application/xproc+xml":{source:"apache",compressible:!0,extensions:["xpl"]},"application/xslt+xml":{source:"iana",compressible:!0,extensions:["xsl","xslt"]},"application/xspf+xml":{source:"apache",compressible:!0,extensions:["xspf"]},"application/xv+xml":{source:"iana",compressible:!0,extensions:["mxml","xhvml","xvml","xvm"]},"application/yang":{source:"iana",extensions:["yang"]},"application/yang-data+json":{source:"iana",compressible:!0},"application/yang-data+xml":{source:"iana",compressible:!0},"application/yang-patch+json":{source:"iana",compressible:!0},"application/yang-patch+xml":{source:"iana",compressible:!0},"application/yin+xml":{source:"iana",compressible:!0,extensions:["yin"]},"application/zip":{source:"iana",compressible:!1,extensions:["zip"]},"application/zlib":{source:"iana"},"application/zstd":{source:"iana"},"audio/1d-interleaved-parityfec":{source:"iana"},"audio/32kadpcm":{source:"iana"},"audio/3gpp":{source:"iana",compressible:!1,extensions:["3gpp"]},"audio/3gpp2":{source:"iana"},"audio/aac":{source:"iana"},"audio/ac3":{source:"iana"},"audio/adpcm":{source:"apache",extensions:["adp"]},"audio/amr":{source:"iana",extensions:["amr"]},"audio/amr-wb":{source:"iana"},"audio/amr-wb+":{source:"iana"},"audio/aptx":{source:"iana"},"audio/asc":{source:"iana"},"audio/atrac-advanced-lossless":{source:"iana"},"audio/atrac-x":{source:"iana"},"audio/atrac3":{source:"iana"},"audio/basic":{source:"iana",compressible:!1,extensions:["au","snd"]},"audio/bv16":{source:"iana"},"audio/bv32":{source:"iana"},"audio/clearmode":{source:"iana"},"audio/cn":{source:"iana"},"audio/dat12":{source:"iana"},"audio/dls":{source:"iana"},"audio/dsr-es201108":{source:"iana"},"audio/dsr-es202050":{source:"iana"},"audio/dsr-es202211":{source:"iana"},"audio/dsr-es202212":{source:"iana"},"audio/dv":{source:"iana"},"audio/dvi4":{source:"iana"},"audio/eac3":{source:"iana"},"audio/encaprtp":{source:"iana"},"audio/evrc":{source:"iana"},"audio/evrc-qcp":{source:"iana"},"audio/evrc0":{source:"iana"},"audio/evrc1":{source:"iana"},"audio/evrcb":{source:"iana"},"audio/evrcb0":{source:"iana"},"audio/evrcb1":{source:"iana"},"audio/evrcnw":{source:"iana"},"audio/evrcnw0":{source:"iana"},"audio/evrcnw1":{source:"iana"},"audio/evrcwb":{source:"iana"},"audio/evrcwb0":{source:"iana"},"audio/evrcwb1":{source:"iana"},"audio/evs":{source:"iana"},"audio/flexfec":{source:"iana"},"audio/fwdred":{source:"iana"},"audio/g711-0":{source:"iana"},"audio/g719":{source:"iana"},"audio/g722":{source:"iana"},"audio/g7221":{source:"iana"},"audio/g723":{source:"iana"},"audio/g726-16":{source:"iana"},"audio/g726-24":{source:"iana"},"audio/g726-32":{source:"iana"},"audio/g726-40":{source:"iana"},"audio/g728":{source:"iana"},"audio/g729":{source:"iana"},"audio/g7291":{source:"iana"},"audio/g729d":{source:"iana"},"audio/g729e":{source:"iana"},"audio/gsm":{source:"iana"},"audio/gsm-efr":{source:"iana"},"audio/gsm-hr-08":{source:"iana"},"audio/ilbc":{source:"iana"},"audio/ip-mr_v2.5":{source:"iana"},"audio/isac":{source:"apache"},"audio/l16":{source:"iana"},"audio/l20":{source:"iana"},"audio/l24":{source:"iana",compressible:!1},"audio/l8":{source:"iana"},"audio/lpc":{source:"iana"},"audio/melp":{source:"iana"},"audio/melp1200":{source:"iana"},"audio/melp2400":{source:"iana"},"audio/melp600":{source:"iana"},"audio/mhas":{source:"iana"},"audio/midi":{source:"apache",extensions:["mid","midi","kar","rmi"]},"audio/mobile-xmf":{source:"iana",extensions:["mxmf"]},"audio/mp3":{compressible:!1,extensions:["mp3"]},"audio/mp4":{source:"iana",compressible:!1,extensions:["m4a","mp4a"]},"audio/mp4a-latm":{source:"iana"},"audio/mpa":{source:"iana"},"audio/mpa-robust":{source:"iana"},"audio/mpeg":{source:"iana",compressible:!1,extensions:["mpga","mp2","mp2a","mp3","m2a","m3a"]},"audio/mpeg4-generic":{source:"iana"},"audio/musepack":{source:"apache"},"audio/ogg":{source:"iana",compressible:!1,extensions:["oga","ogg","spx","opus"]},"audio/opus":{source:"iana"},"audio/parityfec":{source:"iana"},"audio/pcma":{source:"iana"},"audio/pcma-wb":{source:"iana"},"audio/pcmu":{source:"iana"},"audio/pcmu-wb":{source:"iana"},"audio/prs.sid":{source:"iana"},"audio/qcelp":{source:"iana"},"audio/raptorfec":{source:"iana"},"audio/red":{source:"iana"},"audio/rtp-enc-aescm128":{source:"iana"},"audio/rtp-midi":{source:"iana"},"audio/rtploopback":{source:"iana"},"audio/rtx":{source:"iana"},"audio/s3m":{source:"apache",extensions:["s3m"]},"audio/scip":{source:"iana"},"audio/silk":{source:"apache",extensions:["sil"]},"audio/smv":{source:"iana"},"audio/smv-qcp":{source:"iana"},"audio/smv0":{source:"iana"},"audio/sofa":{source:"iana"},"audio/sp-midi":{source:"iana"},"audio/speex":{source:"iana"},"audio/t140c":{source:"iana"},"audio/t38":{source:"iana"},"audio/telephone-event":{source:"iana"},"audio/tetra_acelp":{source:"iana"},"audio/tetra_acelp_bb":{source:"iana"},"audio/tone":{source:"iana"},"audio/tsvcis":{source:"iana"},"audio/uemclip":{source:"iana"},"audio/ulpfec":{source:"iana"},"audio/usac":{source:"iana"},"audio/vdvi":{source:"iana"},"audio/vmr-wb":{source:"iana"},"audio/vnd.3gpp.iufp":{source:"iana"},"audio/vnd.4sb":{source:"iana"},"audio/vnd.audiokoz":{source:"iana"},"audio/vnd.celp":{source:"iana"},"audio/vnd.cisco.nse":{source:"iana"},"audio/vnd.cmles.radio-events":{source:"iana"},"audio/vnd.cns.anp1":{source:"iana"},"audio/vnd.cns.inf1":{source:"iana"},"audio/vnd.dece.audio":{source:"iana",extensions:["uva","uvva"]},"audio/vnd.digital-winds":{source:"iana",extensions:["eol"]},"audio/vnd.dlna.adts":{source:"iana"},"audio/vnd.dolby.heaac.1":{source:"iana"},"audio/vnd.dolby.heaac.2":{source:"iana"},"audio/vnd.dolby.mlp":{source:"iana"},"audio/vnd.dolby.mps":{source:"iana"},"audio/vnd.dolby.pl2":{source:"iana"},"audio/vnd.dolby.pl2x":{source:"iana"},"audio/vnd.dolby.pl2z":{source:"iana"},"audio/vnd.dolby.pulse.1":{source:"iana"},"audio/vnd.dra":{source:"iana",extensions:["dra"]},"audio/vnd.dts":{source:"iana",extensions:["dts"]},"audio/vnd.dts.hd":{source:"iana",extensions:["dtshd"]},"audio/vnd.dts.uhd":{source:"iana"},"audio/vnd.dvb.file":{source:"iana"},"audio/vnd.everad.plj":{source:"iana"},"audio/vnd.hns.audio":{source:"iana"},"audio/vnd.lucent.voice":{source:"iana",extensions:["lvp"]},"audio/vnd.ms-playready.media.pya":{source:"iana",extensions:["pya"]},"audio/vnd.nokia.mobile-xmf":{source:"iana"},"audio/vnd.nortel.vbk":{source:"iana"},"audio/vnd.nuera.ecelp4800":{source:"iana",extensions:["ecelp4800"]},"audio/vnd.nuera.ecelp7470":{source:"iana",extensions:["ecelp7470"]},"audio/vnd.nuera.ecelp9600":{source:"iana",extensions:["ecelp9600"]},"audio/vnd.octel.sbc":{source:"iana"},"audio/vnd.presonus.multitrack":{source:"iana"},"audio/vnd.qcelp":{source:"iana"},"audio/vnd.rhetorex.32kadpcm":{source:"iana"},"audio/vnd.rip":{source:"iana",extensions:["rip"]},"audio/vnd.rn-realaudio":{compressible:!1},"audio/vnd.sealedmedia.softseal.mpeg":{source:"iana"},"audio/vnd.vmx.cvsd":{source:"iana"},"audio/vnd.wave":{compressible:!1},"audio/vorbis":{source:"iana",compressible:!1},"audio/vorbis-config":{source:"iana"},"audio/wav":{compressible:!1,extensions:["wav"]},"audio/wave":{compressible:!1,extensions:["wav"]},"audio/webm":{source:"apache",compressible:!1,extensions:["weba"]},"audio/x-aac":{source:"apache",compressible:!1,extensions:["aac"]},"audio/x-aiff":{source:"apache",extensions:["aif","aiff","aifc"]},"audio/x-caf":{source:"apache",compressible:!1,extensions:["caf"]},"audio/x-flac":{source:"apache",extensions:["flac"]},"audio/x-m4a":{source:"nginx",extensions:["m4a"]},"audio/x-matroska":{source:"apache",extensions:["mka"]},"audio/x-mpegurl":{source:"apache",extensions:["m3u"]},"audio/x-ms-wax":{source:"apache",extensions:["wax"]},"audio/x-ms-wma":{source:"apache",extensions:["wma"]},"audio/x-pn-realaudio":{source:"apache",extensions:["ram","ra"]},"audio/x-pn-realaudio-plugin":{source:"apache",extensions:["rmp"]},"audio/x-realaudio":{source:"nginx",extensions:["ra"]},"audio/x-tta":{source:"apache"},"audio/x-wav":{source:"apache",extensions:["wav"]},"audio/xm":{source:"apache",extensions:["xm"]},"chemical/x-cdx":{source:"apache",extensions:["cdx"]},"chemical/x-cif":{source:"apache",extensions:["cif"]},"chemical/x-cmdf":{source:"apache",extensions:["cmdf"]},"chemical/x-cml":{source:"apache",extensions:["cml"]},"chemical/x-csml":{source:"apache",extensions:["csml"]},"chemical/x-pdb":{source:"apache"},"chemical/x-xyz":{source:"apache",extensions:["xyz"]},"font/collection":{source:"iana",extensions:["ttc"]},"font/otf":{source:"iana",compressible:!0,extensions:["otf"]},"font/sfnt":{source:"iana"},"font/ttf":{source:"iana",compressible:!0,extensions:["ttf"]},"font/woff":{source:"iana",extensions:["woff"]},"font/woff2":{source:"iana",extensions:["woff2"]},"image/aces":{source:"iana",extensions:["exr"]},"image/apng":{compressible:!1,extensions:["apng"]},"image/avci":{source:"iana",extensions:["avci"]},"image/avcs":{source:"iana",extensions:["avcs"]},"image/avif":{source:"iana",compressible:!1,extensions:["avif"]},"image/bmp":{source:"iana",compressible:!0,extensions:["bmp"]},"image/cgm":{source:"iana",extensions:["cgm"]},"image/dicom-rle":{source:"iana",extensions:["drle"]},"image/emf":{source:"iana",extensions:["emf"]},"image/fits":{source:"iana",extensions:["fits"]},"image/g3fax":{source:"iana",extensions:["g3"]},"image/gif":{source:"iana",compressible:!1,extensions:["gif"]},"image/heic":{source:"iana",extensions:["heic"]},"image/heic-sequence":{source:"iana",extensions:["heics"]},"image/heif":{source:"iana",extensions:["heif"]},"image/heif-sequence":{source:"iana",extensions:["heifs"]},"image/hej2k":{source:"iana",extensions:["hej2"]},"image/hsj2":{source:"iana",extensions:["hsj2"]},"image/ief":{source:"iana",extensions:["ief"]},"image/jls":{source:"iana",extensions:["jls"]},"image/jp2":{source:"iana",compressible:!1,extensions:["jp2","jpg2"]},"image/jpeg":{source:"iana",compressible:!1,extensions:["jpeg","jpg","jpe"]},"image/jph":{source:"iana",extensions:["jph"]},"image/jphc":{source:"iana",extensions:["jhc"]},"image/jpm":{source:"iana",compressible:!1,extensions:["jpm"]},"image/jpx":{source:"iana",compressible:!1,extensions:["jpx","jpf"]},"image/jxr":{source:"iana",extensions:["jxr"]},"image/jxra":{source:"iana",extensions:["jxra"]},"image/jxrs":{source:"iana",extensions:["jxrs"]},"image/jxs":{source:"iana",extensions:["jxs"]},"image/jxsc":{source:"iana",extensions:["jxsc"]},"image/jxsi":{source:"iana",extensions:["jxsi"]},"image/jxss":{source:"iana",extensions:["jxss"]},"image/ktx":{source:"iana",extensions:["ktx"]},"image/ktx2":{source:"iana",extensions:["ktx2"]},"image/naplps":{source:"iana"},"image/pjpeg":{compressible:!1},"image/png":{source:"iana",compressible:!1,extensions:["png"]},"image/prs.btif":{source:"iana",extensions:["btif"]},"image/prs.pti":{source:"iana",extensions:["pti"]},"image/pwg-raster":{source:"iana"},"image/sgi":{source:"apache",extensions:["sgi"]},"image/svg+xml":{source:"iana",compressible:!0,extensions:["svg","svgz"]},"image/t38":{source:"iana",extensions:["t38"]},"image/tiff":{source:"iana",compressible:!1,extensions:["tif","tiff"]},"image/tiff-fx":{source:"iana",extensions:["tfx"]},"image/vnd.adobe.photoshop":{source:"iana",compressible:!0,extensions:["psd"]},"image/vnd.airzip.accelerator.azv":{source:"iana",extensions:["azv"]},"image/vnd.cns.inf2":{source:"iana"},"image/vnd.dece.graphic":{source:"iana",extensions:["uvi","uvvi","uvg","uvvg"]},"image/vnd.djvu":{source:"iana",extensions:["djvu","djv"]},"image/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"image/vnd.dwg":{source:"iana",extensions:["dwg"]},"image/vnd.dxf":{source:"iana",extensions:["dxf"]},"image/vnd.fastbidsheet":{source:"iana",extensions:["fbs"]},"image/vnd.fpx":{source:"iana",extensions:["fpx"]},"image/vnd.fst":{source:"iana",extensions:["fst"]},"image/vnd.fujixerox.edmics-mmr":{source:"iana",extensions:["mmr"]},"image/vnd.fujixerox.edmics-rlc":{source:"iana",extensions:["rlc"]},"image/vnd.globalgraphics.pgb":{source:"iana"},"image/vnd.microsoft.icon":{source:"iana",compressible:!0,extensions:["ico"]},"image/vnd.mix":{source:"iana"},"image/vnd.mozilla.apng":{source:"iana"},"image/vnd.ms-dds":{compressible:!0,extensions:["dds"]},"image/vnd.ms-modi":{source:"iana",extensions:["mdi"]},"image/vnd.ms-photo":{source:"apache",extensions:["wdp"]},"image/vnd.net-fpx":{source:"iana",extensions:["npx"]},"image/vnd.pco.b16":{source:"iana",extensions:["b16"]},"image/vnd.radiance":{source:"iana"},"image/vnd.sealed.png":{source:"iana"},"image/vnd.sealedmedia.softseal.gif":{source:"iana"},"image/vnd.sealedmedia.softseal.jpg":{source:"iana"},"image/vnd.svf":{source:"iana"},"image/vnd.tencent.tap":{source:"iana",extensions:["tap"]},"image/vnd.valve.source.texture":{source:"iana",extensions:["vtf"]},"image/vnd.wap.wbmp":{source:"iana",extensions:["wbmp"]},"image/vnd.xiff":{source:"iana",extensions:["xif"]},"image/vnd.zbrush.pcx":{source:"iana",extensions:["pcx"]},"image/webp":{source:"apache",extensions:["webp"]},"image/wmf":{source:"iana",extensions:["wmf"]},"image/x-3ds":{source:"apache",extensions:["3ds"]},"image/x-cmu-raster":{source:"apache",extensions:["ras"]},"image/x-cmx":{source:"apache",extensions:["cmx"]},"image/x-freehand":{source:"apache",extensions:["fh","fhc","fh4","fh5","fh7"]},"image/x-icon":{source:"apache",compressible:!0,extensions:["ico"]},"image/x-jng":{source:"nginx",extensions:["jng"]},"image/x-mrsid-image":{source:"apache",extensions:["sid"]},"image/x-ms-bmp":{source:"nginx",compressible:!0,extensions:["bmp"]},"image/x-pcx":{source:"apache",extensions:["pcx"]},"image/x-pict":{source:"apache",extensions:["pic","pct"]},"image/x-portable-anymap":{source:"apache",extensions:["pnm"]},"image/x-portable-bitmap":{source:"apache",extensions:["pbm"]},"image/x-portable-graymap":{source:"apache",extensions:["pgm"]},"image/x-portable-pixmap":{source:"apache",extensions:["ppm"]},"image/x-rgb":{source:"apache",extensions:["rgb"]},"image/x-tga":{source:"apache",extensions:["tga"]},"image/x-xbitmap":{source:"apache",extensions:["xbm"]},"image/x-xcf":{compressible:!1},"image/x-xpixmap":{source:"apache",extensions:["xpm"]},"image/x-xwindowdump":{source:"apache",extensions:["xwd"]},"message/cpim":{source:"iana"},"message/delivery-status":{source:"iana"},"message/disposition-notification":{source:"iana",extensions:["disposition-notification"]},"message/external-body":{source:"iana"},"message/feedback-report":{source:"iana"},"message/global":{source:"iana",extensions:["u8msg"]},"message/global-delivery-status":{source:"iana",extensions:["u8dsn"]},"message/global-disposition-notification":{source:"iana",extensions:["u8mdn"]},"message/global-headers":{source:"iana",extensions:["u8hdr"]},"message/http":{source:"iana",compressible:!1},"message/imdn+xml":{source:"iana",compressible:!0},"message/news":{source:"iana"},"message/partial":{source:"iana",compressible:!1},"message/rfc822":{source:"iana",compressible:!0,extensions:["eml","mime"]},"message/s-http":{source:"iana"},"message/sip":{source:"iana"},"message/sipfrag":{source:"iana"},"message/tracking-status":{source:"iana"},"message/vnd.si.simp":{source:"iana"},"message/vnd.wfa.wsc":{source:"iana",extensions:["wsc"]},"model/3mf":{source:"iana",extensions:["3mf"]},"model/e57":{source:"iana"},"model/gltf+json":{source:"iana",compressible:!0,extensions:["gltf"]},"model/gltf-binary":{source:"iana",compressible:!0,extensions:["glb"]},"model/iges":{source:"iana",compressible:!1,extensions:["igs","iges"]},"model/mesh":{source:"iana",compressible:!1,extensions:["msh","mesh","silo"]},"model/mtl":{source:"iana",extensions:["mtl"]},"model/obj":{source:"iana",extensions:["obj"]},"model/step":{source:"iana"},"model/step+xml":{source:"iana",compressible:!0,extensions:["stpx"]},"model/step+zip":{source:"iana",compressible:!1,extensions:["stpz"]},"model/step-xml+zip":{source:"iana",compressible:!1,extensions:["stpxz"]},"model/stl":{source:"iana",extensions:["stl"]},"model/vnd.collada+xml":{source:"iana",compressible:!0,extensions:["dae"]},"model/vnd.dwf":{source:"iana",extensions:["dwf"]},"model/vnd.flatland.3dml":{source:"iana"},"model/vnd.gdl":{source:"iana",extensions:["gdl"]},"model/vnd.gs-gdl":{source:"apache"},"model/vnd.gs.gdl":{source:"iana"},"model/vnd.gtw":{source:"iana",extensions:["gtw"]},"model/vnd.moml+xml":{source:"iana",compressible:!0},"model/vnd.mts":{source:"iana",extensions:["mts"]},"model/vnd.opengex":{source:"iana",extensions:["ogex"]},"model/vnd.parasolid.transmit.binary":{source:"iana",extensions:["x_b"]},"model/vnd.parasolid.transmit.text":{source:"iana",extensions:["x_t"]},"model/vnd.pytha.pyox":{source:"iana"},"model/vnd.rosette.annotated-data-model":{source:"iana"},"model/vnd.sap.vds":{source:"iana",extensions:["vds"]},"model/vnd.usdz+zip":{source:"iana",compressible:!1,extensions:["usdz"]},"model/vnd.valve.source.compiled-map":{source:"iana",extensions:["bsp"]},"model/vnd.vtu":{source:"iana",extensions:["vtu"]},"model/vrml":{source:"iana",compressible:!1,extensions:["wrl","vrml"]},"model/x3d+binary":{source:"apache",compressible:!1,extensions:["x3db","x3dbz"]},"model/x3d+fastinfoset":{source:"iana",extensions:["x3db"]},"model/x3d+vrml":{source:"apache",compressible:!1,extensions:["x3dv","x3dvz"]},"model/x3d+xml":{source:"iana",compressible:!0,extensions:["x3d","x3dz"]},"model/x3d-vrml":{source:"iana",extensions:["x3dv"]},"multipart/alternative":{source:"iana",compressible:!1},"multipart/appledouble":{source:"iana"},"multipart/byteranges":{source:"iana"},"multipart/digest":{source:"iana"},"multipart/encrypted":{source:"iana",compressible:!1},"multipart/form-data":{source:"iana",compressible:!1},"multipart/header-set":{source:"iana"},"multipart/mixed":{source:"iana"},"multipart/multilingual":{source:"iana"},"multipart/parallel":{source:"iana"},"multipart/related":{source:"iana",compressible:!1},"multipart/report":{source:"iana"},"multipart/signed":{source:"iana",compressible:!1},"multipart/vnd.bint.med-plus":{source:"iana"},"multipart/voice-message":{source:"iana"},"multipart/x-mixed-replace":{source:"iana"},"text/1d-interleaved-parityfec":{source:"iana"},"text/cache-manifest":{source:"iana",compressible:!0,extensions:["appcache","manifest"]},"text/calendar":{source:"iana",extensions:["ics","ifb"]},"text/calender":{compressible:!0},"text/cmd":{compressible:!0},"text/coffeescript":{extensions:["coffee","litcoffee"]},"text/cql":{source:"iana"},"text/cql-expression":{source:"iana"},"text/cql-identifier":{source:"iana"},"text/css":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["css"]},"text/csv":{source:"iana",compressible:!0,extensions:["csv"]},"text/csv-schema":{source:"iana"},"text/directory":{source:"iana"},"text/dns":{source:"iana"},"text/ecmascript":{source:"iana"},"text/encaprtp":{source:"iana"},"text/enriched":{source:"iana"},"text/fhirpath":{source:"iana"},"text/flexfec":{source:"iana"},"text/fwdred":{source:"iana"},"text/gff3":{source:"iana"},"text/grammar-ref-list":{source:"iana"},"text/html":{source:"iana",compressible:!0,extensions:["html","htm","shtml"]},"text/jade":{extensions:["jade"]},"text/javascript":{source:"iana",compressible:!0},"text/jcr-cnd":{source:"iana"},"text/jsx":{compressible:!0,extensions:["jsx"]},"text/less":{compressible:!0,extensions:["less"]},"text/markdown":{source:"iana",compressible:!0,extensions:["markdown","md"]},"text/mathml":{source:"nginx",extensions:["mml"]},"text/mdx":{compressible:!0,extensions:["mdx"]},"text/mizar":{source:"iana"},"text/n3":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["n3"]},"text/parameters":{source:"iana",charset:"UTF-8"},"text/parityfec":{source:"iana"},"text/plain":{source:"iana",compressible:!0,extensions:["txt","text","conf","def","list","log","in","ini"]},"text/provenance-notation":{source:"iana",charset:"UTF-8"},"text/prs.fallenstein.rst":{source:"iana"},"text/prs.lines.tag":{source:"iana",extensions:["dsc"]},"text/prs.prop.logic":{source:"iana"},"text/raptorfec":{source:"iana"},"text/red":{source:"iana"},"text/rfc822-headers":{source:"iana"},"text/richtext":{source:"iana",compressible:!0,extensions:["rtx"]},"text/rtf":{source:"iana",compressible:!0,extensions:["rtf"]},"text/rtp-enc-aescm128":{source:"iana"},"text/rtploopback":{source:"iana"},"text/rtx":{source:"iana"},"text/sgml":{source:"iana",extensions:["sgml","sgm"]},"text/shaclc":{source:"iana"},"text/shex":{source:"iana",extensions:["shex"]},"text/slim":{extensions:["slim","slm"]},"text/spdx":{source:"iana",extensions:["spdx"]},"text/strings":{source:"iana"},"text/stylus":{extensions:["stylus","styl"]},"text/t140":{source:"iana"},"text/tab-separated-values":{source:"iana",compressible:!0,extensions:["tsv"]},"text/troff":{source:"iana",extensions:["t","tr","roff","man","me","ms"]},"text/turtle":{source:"iana",charset:"UTF-8",extensions:["ttl"]},"text/ulpfec":{source:"iana"},"text/uri-list":{source:"iana",compressible:!0,extensions:["uri","uris","urls"]},"text/vcard":{source:"iana",compressible:!0,extensions:["vcard"]},"text/vnd.a":{source:"iana"},"text/vnd.abc":{source:"iana"},"text/vnd.ascii-art":{source:"iana"},"text/vnd.curl":{source:"iana",extensions:["curl"]},"text/vnd.curl.dcurl":{source:"apache",extensions:["dcurl"]},"text/vnd.curl.mcurl":{source:"apache",extensions:["mcurl"]},"text/vnd.curl.scurl":{source:"apache",extensions:["scurl"]},"text/vnd.debian.copyright":{source:"iana",charset:"UTF-8"},"text/vnd.dmclientscript":{source:"iana"},"text/vnd.dvb.subtitle":{source:"iana",extensions:["sub"]},"text/vnd.esmertec.theme-descriptor":{source:"iana",charset:"UTF-8"},"text/vnd.familysearch.gedcom":{source:"iana",extensions:["ged"]},"text/vnd.ficlab.flt":{source:"iana"},"text/vnd.fly":{source:"iana",extensions:["fly"]},"text/vnd.fmi.flexstor":{source:"iana",extensions:["flx"]},"text/vnd.gml":{source:"iana"},"text/vnd.graphviz":{source:"iana",extensions:["gv"]},"text/vnd.hans":{source:"iana"},"text/vnd.hgl":{source:"iana"},"text/vnd.in3d.3dml":{source:"iana",extensions:["3dml"]},"text/vnd.in3d.spot":{source:"iana",extensions:["spot"]},"text/vnd.iptc.newsml":{source:"iana"},"text/vnd.iptc.nitf":{source:"iana"},"text/vnd.latex-z":{source:"iana"},"text/vnd.motorola.reflex":{source:"iana"},"text/vnd.ms-mediapackage":{source:"iana"},"text/vnd.net2phone.commcenter.command":{source:"iana"},"text/vnd.radisys.msml-basic-layout":{source:"iana"},"text/vnd.senx.warpscript":{source:"iana"},"text/vnd.si.uricatalogue":{source:"iana"},"text/vnd.sosi":{source:"iana"},"text/vnd.sun.j2me.app-descriptor":{source:"iana",charset:"UTF-8",extensions:["jad"]},"text/vnd.trolltech.linguist":{source:"iana",charset:"UTF-8"},"text/vnd.wap.si":{source:"iana"},"text/vnd.wap.sl":{source:"iana"},"text/vnd.wap.wml":{source:"iana",extensions:["wml"]},"text/vnd.wap.wmlscript":{source:"iana",extensions:["wmls"]},"text/vtt":{source:"iana",charset:"UTF-8",compressible:!0,extensions:["vtt"]},"text/x-asm":{source:"apache",extensions:["s","asm"]},"text/x-c":{source:"apache",extensions:["c","cc","cxx","cpp","h","hh","dic"]},"text/x-component":{source:"nginx",extensions:["htc"]},"text/x-fortran":{source:"apache",extensions:["f","for","f77","f90"]},"text/x-gwt-rpc":{compressible:!0},"text/x-handlebars-template":{extensions:["hbs"]},"text/x-java-source":{source:"apache",extensions:["java"]},"text/x-jquery-tmpl":{compressible:!0},"text/x-lua":{extensions:["lua"]},"text/x-markdown":{compressible:!0,extensions:["mkd"]},"text/x-nfo":{source:"apache",extensions:["nfo"]},"text/x-opml":{source:"apache",extensions:["opml"]},"text/x-org":{compressible:!0,extensions:["org"]},"text/x-pascal":{source:"apache",extensions:["p","pas"]},"text/x-processing":{compressible:!0,extensions:["pde"]},"text/x-sass":{extensions:["sass"]},"text/x-scss":{extensions:["scss"]},"text/x-setext":{source:"apache",extensions:["etx"]},"text/x-sfv":{source:"apache",extensions:["sfv"]},"text/x-suse-ymp":{compressible:!0,extensions:["ymp"]},"text/x-uuencode":{source:"apache",extensions:["uu"]},"text/x-vcalendar":{source:"apache",extensions:["vcs"]},"text/x-vcard":{source:"apache",extensions:["vcf"]},"text/xml":{source:"iana",compressible:!0,extensions:["xml"]},"text/xml-external-parsed-entity":{source:"iana"},"text/yaml":{compressible:!0,extensions:["yaml","yml"]},"video/1d-interleaved-parityfec":{source:"iana"},"video/3gpp":{source:"iana",extensions:["3gp","3gpp"]},"video/3gpp-tt":{source:"iana"},"video/3gpp2":{source:"iana",extensions:["3g2"]},"video/av1":{source:"iana"},"video/bmpeg":{source:"iana"},"video/bt656":{source:"iana"},"video/celb":{source:"iana"},"video/dv":{source:"iana"},"video/encaprtp":{source:"iana"},"video/ffv1":{source:"iana"},"video/flexfec":{source:"iana"},"video/h261":{source:"iana",extensions:["h261"]},"video/h263":{source:"iana",extensions:["h263"]},"video/h263-1998":{source:"iana"},"video/h263-2000":{source:"iana"},"video/h264":{source:"iana",extensions:["h264"]},"video/h264-rcdo":{source:"iana"},"video/h264-svc":{source:"iana"},"video/h265":{source:"iana"},"video/iso.segment":{source:"iana",extensions:["m4s"]},"video/jpeg":{source:"iana",extensions:["jpgv"]},"video/jpeg2000":{source:"iana"},"video/jpm":{source:"apache",extensions:["jpm","jpgm"]},"video/jxsv":{source:"iana"},"video/mj2":{source:"iana",extensions:["mj2","mjp2"]},"video/mp1s":{source:"iana"},"video/mp2p":{source:"iana"},"video/mp2t":{source:"iana",extensions:["ts"]},"video/mp4":{source:"iana",compressible:!1,extensions:["mp4","mp4v","mpg4"]},"video/mp4v-es":{source:"iana"},"video/mpeg":{source:"iana",compressible:!1,extensions:["mpeg","mpg","mpe","m1v","m2v"]},"video/mpeg4-generic":{source:"iana"},"video/mpv":{source:"iana"},"video/nv":{source:"iana"},"video/ogg":{source:"iana",compressible:!1,extensions:["ogv"]},"video/parityfec":{source:"iana"},"video/pointer":{source:"iana"},"video/quicktime":{source:"iana",compressible:!1,extensions:["qt","mov"]},"video/raptorfec":{source:"iana"},"video/raw":{source:"iana"},"video/rtp-enc-aescm128":{source:"iana"},"video/rtploopback":{source:"iana"},"video/rtx":{source:"iana"},"video/scip":{source:"iana"},"video/smpte291":{source:"iana"},"video/smpte292m":{source:"iana"},"video/ulpfec":{source:"iana"},"video/vc1":{source:"iana"},"video/vc2":{source:"iana"},"video/vnd.cctv":{source:"iana"},"video/vnd.dece.hd":{source:"iana",extensions:["uvh","uvvh"]},"video/vnd.dece.mobile":{source:"iana",extensions:["uvm","uvvm"]},"video/vnd.dece.mp4":{source:"iana"},"video/vnd.dece.pd":{source:"iana",extensions:["uvp","uvvp"]},"video/vnd.dece.sd":{source:"iana",extensions:["uvs","uvvs"]},"video/vnd.dece.video":{source:"iana",extensions:["uvv","uvvv"]},"video/vnd.directv.mpeg":{source:"iana"},"video/vnd.directv.mpeg-tts":{source:"iana"},"video/vnd.dlna.mpeg-tts":{source:"iana"},"video/vnd.dvb.file":{source:"iana",extensions:["dvb"]},"video/vnd.fvt":{source:"iana",extensions:["fvt"]},"video/vnd.hns.video":{source:"iana"},"video/vnd.iptvforum.1dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.1dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.2dparityfec-1010":{source:"iana"},"video/vnd.iptvforum.2dparityfec-2005":{source:"iana"},"video/vnd.iptvforum.ttsavc":{source:"iana"},"video/vnd.iptvforum.ttsmpeg2":{source:"iana"},"video/vnd.motorola.video":{source:"iana"},"video/vnd.motorola.videop":{source:"iana"},"video/vnd.mpegurl":{source:"iana",extensions:["mxu","m4u"]},"video/vnd.ms-playready.media.pyv":{source:"iana",extensions:["pyv"]},"video/vnd.nokia.interleaved-multimedia":{source:"iana"},"video/vnd.nokia.mp4vr":{source:"iana"},"video/vnd.nokia.videovoip":{source:"iana"},"video/vnd.objectvideo":{source:"iana"},"video/vnd.radgamettools.bink":{source:"iana"},"video/vnd.radgamettools.smacker":{source:"iana"},"video/vnd.sealed.mpeg1":{source:"iana"},"video/vnd.sealed.mpeg4":{source:"iana"},"video/vnd.sealed.swf":{source:"iana"},"video/vnd.sealedmedia.softseal.mov":{source:"iana"},"video/vnd.uvvu.mp4":{source:"iana",extensions:["uvu","uvvu"]},"video/vnd.vivo":{source:"iana",extensions:["viv"]},"video/vnd.youtube.yt":{source:"iana"},"video/vp8":{source:"iana"},"video/vp9":{source:"iana"},"video/webm":{source:"apache",compressible:!1,extensions:["webm"]},"video/x-f4v":{source:"apache",extensions:["f4v"]},"video/x-fli":{source:"apache",extensions:["fli"]},"video/x-flv":{source:"apache",compressible:!1,extensions:["flv"]},"video/x-m4v":{source:"apache",extensions:["m4v"]},"video/x-matroska":{source:"apache",compressible:!1,extensions:["mkv","mk3d","mks"]},"video/x-mng":{source:"apache",extensions:["mng"]},"video/x-ms-asf":{source:"apache",extensions:["asf","asx"]},"video/x-ms-vob":{source:"apache",extensions:["vob"]},"video/x-ms-wm":{source:"apache",extensions:["wm"]},"video/x-ms-wmv":{source:"apache",compressible:!1,extensions:["wmv"]},"video/x-ms-wmx":{source:"apache",extensions:["wmx"]},"video/x-ms-wvx":{source:"apache",extensions:["wvx"]},"video/x-msvideo":{source:"apache",extensions:["avi"]},"video/x-sgi-movie":{source:"apache",extensions:["movie"]},"video/x-smv":{source:"apache",extensions:["smv"]},"x-conference/x-cooltalk":{source:"apache",extensions:["ice"]},"x-shader/x-fragment":{compressible:!0},"x-shader/x-vertex":{compressible:!0}}});var J3=N((Q1e,q3)=>{q3.exports=B3()});var G3=N(xo=>{"use strict";var uP=J3(),_le=require("path").extname,$3=/^\s*([^;\s]*)(?:;|\s|$)/,Tle=/^text\//i;xo.charset=H3;xo.charsets={lookup:H3};xo.contentType=Rle;xo.extension=Ale;xo.extensions=Object.create(null);xo.lookup=Nle;xo.types=Object.create(null);Mle(xo.extensions,xo.types);function H3(r){if(!r||typeof r!="string")return!1;var e=$3.exec(r),t=e&&uP[e[1].toLowerCase()];return t&&t.charset?t.charset:e&&Tle.test(e[1])?"UTF-8":!1}function Rle(r){if(!r||typeof r!="string")return!1;var e=r.indexOf("/")===-1?xo.lookup(r):r;if(!e)return!1;if(e.indexOf("charset")===-1){var t=xo.charset(e);t&&(e+="; charset="+t.toLowerCase())}return e}function Ale(r){if(!r||typeof r!="string")return!1;var e=$3.exec(r),t=e&&xo.extensions[e[1].toLowerCase()];return!t||!t.length?!1:t[0]}function Nle(r){if(!r||typeof r!="string")return!1;var e=_le("x."+r).toLowerCase().substr(1);return e&&xo.types[e]||!1}function Mle(r,e){var t=["nginx","apache",void 0,"iana"];Object.keys(uP).forEach(function(i){var o=uP[i],s=o.extensions;if(!(!s||!s.length)){r[i]=s;for(var a=0;a<s.length;a++){var l=s[a];if(e[l]){var c=t.indexOf(uP[e[l]].source),u=t.indexOf(o.source);if(e[l]!=="application/octet-stream"&&(c>u||c===u&&e[l].substr(0,12)==="application/"))continue}e[l]=i}}})}});var Q3=N((X1e,z3)=>{z3.exports=Ole;function Ole(r){var e=typeof setImmediate=="function"?setImmediate:typeof process=="object"&&typeof process.nextTick=="function"?process.nextTick:null;e?e(r):setTimeout(r,0)}});var gM=N((Z1e,X3)=>{var Y3=Q3();X3.exports=Kle;function Kle(r){var e=!1;return Y3(function(){e=!0}),function(n,i){e?r(n,i):Y3(function(){r(n,i)})}}});var vM=N((eRe,Z3)=>{Z3.exports=Fle;function Fle(r){Object.keys(r.jobs).forEach(Lle.bind(r)),r.jobs={}}function Lle(r){typeof this.jobs[r]=="function"&&this.jobs[r]()}});var yM=N((tRe,tB)=>{var eB=gM(),Ule=vM();tB.exports=jle;function jle(r,e,t,n){var i=t.keyedList?t.keyedList[t.index]:t.index;t.jobs[i]=Wle(e,i,r[i],function(o,s){i in t.jobs&&(delete t.jobs[i],o?Ule(t):t.results[i]=s,n(o,t.results))})}function Wle(r,e,t,n){var i;return r.length==2?i=r(t,eB(n)):i=r(t,e,eB(n)),i}});var bM=N((rRe,rB)=>{rB.exports=Vle;function Vle(r,e){var t=!Array.isArray(r),n={index:0,keyedList:t||e?Object.keys(r):null,jobs:{},results:t?{}:[],size:t?Object.keys(r).length:r.length};return e&&n.keyedList.sort(t?e:function(i,o){return e(r[i],r[o])}),n}});var IM=N((nRe,nB)=>{var Ble=vM(),qle=gM();nB.exports=Jle;function Jle(r){Object.keys(this.jobs).length&&(this.index=this.size,Ble(this),qle(r)(null,this.results))}});var oB=N((iRe,iB)=>{var $le=yM(),Hle=bM(),Gle=IM();iB.exports=zle;function zle(r,e,t){for(var n=Hle(r);n.index<(n.keyedList||r).length;)$le(r,e,n,function(i,o){if(i){t(i,o);return}if(Object.keys(n.jobs).length===0){t(null,n.results);return}}),n.index++;return Gle.bind(n,t)}});var SM=N((oRe,pP)=>{var sB=yM(),Qle=bM(),Yle=IM();pP.exports=Xle;pP.exports.ascending=aB;pP.exports.descending=Zle;function Xle(r,e,t,n){var i=Qle(r,t);return sB(r,e,i,function o(s,a){if(s){n(s,a);return}if(i.index++,i.index<(i.keyedList||r).length){sB(r,e,i,o);return}n(null,i.results)}),Yle.bind(i,n)}function aB(r,e){return r<e?-1:r>e?1:0}function Zle(r,e){return-1*aB(r,e)}});var cB=N((sRe,lB)=>{var ece=SM();lB.exports=tce;function tce(r,e,t){return ece(r,e,null,t)}});var pB=N((aRe,uB)=>{uB.exports={parallel:oB(),serial:cB(),serialOrdered:SM()}});var mB=N((lRe,dB)=>{dB.exports=function(r,e){return Object.keys(e).forEach(function(t){r[t]=r[t]||e[t]}),r}});var gB=N((cRe,hB)=>{var EM=V3(),fB=require("util"),xM=require("path"),rce=require("http"),nce=require("https"),ice=require("url").parse,oce=require("fs"),sce=require("stream").Stream,CM=G3(),ace=pB(),wM=mB();hB.exports=Xt;fB.inherits(Xt,EM);function Xt(r){if(!(this instanceof Xt))return new Xt(r);this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],EM.call(this),r=r||{};for(var e in r)this[e]=r[e]}Xt.LINE_BREAK=`\r
|
||
`;Xt.DEFAULT_CONTENT_TYPE="application/octet-stream";Xt.prototype.append=function(r,e,t){t=t||{},typeof t=="string"&&(t={filename:t});var n=EM.prototype.append.bind(this);if(typeof e=="number"&&(e=""+e),fB.isArray(e)){this._error(new Error("Arrays are not supported."));return}var i=this._multiPartHeader(r,e,t),o=this._multiPartFooter();n(i),n(e),n(o),this._trackLength(i,e,t)};Xt.prototype._trackLength=function(r,e,t){var n=0;t.knownLength!=null?n+=+t.knownLength:Buffer.isBuffer(e)?n=e.length:typeof e=="string"&&(n=Buffer.byteLength(e)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(r)+Xt.LINE_BREAK.length,!(!e||!e.path&&!(e.readable&&e.hasOwnProperty("httpVersion"))&&!(e instanceof sce))&&(t.knownLength||this._valuesToMeasure.push(e))};Xt.prototype._lengthRetriever=function(r,e){r.hasOwnProperty("fd")?r.end!=null&&r.end!=1/0&&r.start!=null?e(null,r.end+1-(r.start?r.start:0)):oce.stat(r.path,function(t,n){var i;if(t){e(t);return}i=n.size-(r.start?r.start:0),e(null,i)}):r.hasOwnProperty("httpVersion")?e(null,+r.headers["content-length"]):r.hasOwnProperty("httpModule")?(r.on("response",function(t){r.pause(),e(null,+t.headers["content-length"])}),r.resume()):e("Unknown stream")};Xt.prototype._multiPartHeader=function(r,e,t){if(typeof t.header=="string")return t.header;var n=this._getContentDisposition(e,t),i=this._getContentType(e,t),o="",s={"Content-Disposition":["form-data",'name="'+r+'"'].concat(n||[]),"Content-Type":[].concat(i||[])};typeof t.header=="object"&&wM(s,t.header);var a;for(var l in s)s.hasOwnProperty(l)&&(a=s[l],a!=null&&(Array.isArray(a)||(a=[a]),a.length&&(o+=l+": "+a.join("; ")+Xt.LINE_BREAK)));return"--"+this.getBoundary()+Xt.LINE_BREAK+o+Xt.LINE_BREAK};Xt.prototype._getContentDisposition=function(r,e){var t,n;return typeof e.filepath=="string"?t=xM.normalize(e.filepath).replace(/\\/g,"/"):e.filename||r.name||r.path?t=xM.basename(e.filename||r.name||r.path):r.readable&&r.hasOwnProperty("httpVersion")&&(t=xM.basename(r.client._httpMessage.path||"")),t&&(n='filename="'+t+'"'),n};Xt.prototype._getContentType=function(r,e){var t=e.contentType;return!t&&r.name&&(t=CM.lookup(r.name)),!t&&r.path&&(t=CM.lookup(r.path)),!t&&r.readable&&r.hasOwnProperty("httpVersion")&&(t=r.headers["content-type"]),!t&&(e.filepath||e.filename)&&(t=CM.lookup(e.filepath||e.filename)),!t&&typeof r=="object"&&(t=Xt.DEFAULT_CONTENT_TYPE),t};Xt.prototype._multiPartFooter=function(){return function(r){var e=Xt.LINE_BREAK,t=this._streams.length===0;t&&(e+=this._lastBoundary()),r(e)}.bind(this)};Xt.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+Xt.LINE_BREAK};Xt.prototype.getHeaders=function(r){var e,t={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(e in r)r.hasOwnProperty(e)&&(t[e.toLowerCase()]=r[e]);return t};Xt.prototype.setBoundary=function(r){this._boundary=r};Xt.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary};Xt.prototype.getBuffer=function(){for(var r=new Buffer.alloc(0),e=this.getBoundary(),t=0,n=this._streams.length;t<n;t++)typeof this._streams[t]!="function"&&(Buffer.isBuffer(this._streams[t])?r=Buffer.concat([r,this._streams[t]]):r=Buffer.concat([r,Buffer.from(this._streams[t])]),(typeof this._streams[t]!="string"||this._streams[t].substring(2,e.length+2)!==e)&&(r=Buffer.concat([r,Buffer.from(Xt.LINE_BREAK)])));return Buffer.concat([r,Buffer.from(this._lastBoundary())])};Xt.prototype._generateBoundary=function(){for(var r="--------------------------",e=0;e<24;e++)r+=Math.floor(Math.random()*10).toString(16);this._boundary=r};Xt.prototype.getLengthSync=function(){var r=this._overheadLength+this._valueLength;return this._streams.length&&(r+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),r};Xt.prototype.hasKnownLength=function(){var r=!0;return this._valuesToMeasure.length&&(r=!1),r};Xt.prototype.getLength=function(r){var e=this._overheadLength+this._valueLength;if(this._streams.length&&(e+=this._lastBoundary().length),!this._valuesToMeasure.length){process.nextTick(r.bind(this,null,e));return}ace.parallel(this._valuesToMeasure,this._lengthRetriever,function(t,n){if(t){r(t);return}n.forEach(function(i){e+=i}),r(null,e)})};Xt.prototype.submit=function(r,e){var t,n,i={method:"post"};return typeof r=="string"?(r=ice(r),n=wM({port:r.port,path:r.pathname,host:r.hostname,protocol:r.protocol},i)):(n=wM(r,i),n.port||(n.port=n.protocol=="https:"?443:80)),n.headers=this.getHeaders(r.headers),n.protocol=="https:"?t=nce.request(n):t=rce.request(n),this.getLength(function(o,s){if(o&&o!=="Unknown stream"){this._error(o);return}if(s&&t.setHeader("Content-Length",s),this.pipe(t),e){var a,l=function(c,u){return t.removeListener("error",l),t.removeListener("response",a),e.call(this,c,u)};a=l.bind(this,null),t.on("error",l),t.on("response",a)}}.bind(this)),t};Xt.prototype._error=function(r){this.error||(this.error=r,this.pause(),this.emit("error",r))};Xt.prototype.toString=function(){return"[object FormData]"}});var yB=N(vB=>{"use strict";var lce=require("url").parse,cce={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},uce=String.prototype.endsWith||function(r){return r.length<=this.length&&this.indexOf(r,this.length-r.length)!==-1};function pce(r){var e=typeof r=="string"?lce(r):r||{},t=e.protocol,n=e.host,i=e.port;if(typeof n!="string"||!n||typeof t!="string"||(t=t.split(":",1)[0],n=n.replace(/:\d*$/,""),i=parseInt(i)||cce[t]||0,!dce(n,i)))return"";var o=Kg("npm_config_"+t+"_proxy")||Kg(t+"_proxy")||Kg("npm_config_proxy")||Kg("all_proxy");return o&&o.indexOf("://")===-1&&(o=t+"://"+o),o}function dce(r,e){var t=(Kg("npm_config_no_proxy")||Kg("no_proxy")).toLowerCase();return t?t==="*"?!1:t.split(/[,\s]/).every(function(n){if(!n)return!0;var i=n.match(/^(.+):(\d+)$/),o=i?i[1]:n,s=i?parseInt(i[2]):0;return s&&s!==e?!0:/^[.*]/.test(o)?(o.charAt(0)==="*"&&(o=o.slice(1)),!uce.call(r,o)):r!==o}):!0}function Kg(r){return process.env[r.toLowerCase()]||process.env[r.toUpperCase()]||""}vB.getProxyForUrl=pce});var mP=N((pRe,bB)=>{var Fg=1e3,Lg=Fg*60,Ug=Lg*60,Tm=Ug*24,mce=Tm*7,fce=Tm*365.25;bB.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return hce(r);if(t==="number"&&isFinite(r))return e.long?vce(r):gce(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function hce(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return t*fce;case"weeks":case"week":case"w":return t*mce;case"days":case"day":case"d":return t*Tm;case"hours":case"hour":case"hrs":case"hr":case"h":return t*Ug;case"minutes":case"minute":case"mins":case"min":case"m":return t*Lg;case"seconds":case"second":case"secs":case"sec":case"s":return t*Fg;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function gce(r){var e=Math.abs(r);return e>=Tm?Math.round(r/Tm)+"d":e>=Ug?Math.round(r/Ug)+"h":e>=Lg?Math.round(r/Lg)+"m":e>=Fg?Math.round(r/Fg)+"s":r+"ms"}function vce(r){var e=Math.abs(r);return e>=Tm?dP(r,e,Tm,"day"):e>=Ug?dP(r,e,Ug,"hour"):e>=Lg?dP(r,e,Lg,"minute"):e>=Fg?dP(r,e,Fg,"second"):r+" ms"}function dP(r,e,t,n){var i=e>=t*1.5;return Math.round(r/t)+" "+n+(i?"s":"")}});var kM=N((dRe,IB)=>{function yce(r){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=i,t.enabled=s,t.humanize=mP(),t.destroy=c,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let p=0;for(let f=0;f<u.length;f++)p=(p<<5)-p+u.charCodeAt(f),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(u){let p,f=null,g,v;function b(...C){if(!b.enabled)return;let E=b,R=Number(new Date),_=R-(p||R);E.diff=_,E.prev=p,E.curr=R,p=R,C[0]=t.coerce(C[0]),typeof C[0]!="string"&&C.unshift("%O");let L=0;C[0]=C[0].replace(/%([a-zA-Z%])/g,($,se)=>{if($==="%%")return"%";L++;let ae=t.formatters[se];if(typeof ae=="function"){let X=C[L];$=ae.call(E,X),C.splice(L,1),L--}return $}),t.formatArgs.call(E,C),(E.log||t.log).apply(E,C)}return b.namespace=u,b.useColors=t.useColors(),b.color=t.selectColor(u),b.extend=n,b.destroy=t.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(g!==t.namespaces&&(g=t.namespaces,v=t.enabled(u)),v),set:C=>{f=C}}),typeof t.init=="function"&&t.init(b),b}function n(u,p){let f=t(this.namespace+(typeof p>"u"?":":p)+u);return f.log=this.log,f}function i(u){t.save(u),t.namespaces=u,t.names=[],t.skips=[];let p,f=(typeof u=="string"?u:"").split(/[\s,]+/),g=f.length;for(p=0;p<g;p++)f[p]&&(u=f[p].replace(/\*/g,".*?"),u[0]==="-"?t.skips.push(new RegExp("^"+u.slice(1)+"$")):t.names.push(new RegExp("^"+u+"$")))}function o(){let u=[...t.names.map(a),...t.skips.map(a).map(p=>"-"+p)].join(",");return t.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let p,f;for(p=0,f=t.skips.length;p<f;p++)if(t.skips[p].test(u))return!1;for(p=0,f=t.names.length;p<f;p++)if(t.names[p].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}IB.exports=yce});var SB=N(($o,fP)=>{$o.formatArgs=Ice;$o.save=Sce;$o.load=xce;$o.useColors=bce;$o.storage=Cce();$o.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();$o.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function bce(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Ice(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+fP.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(t++,i==="%c"&&(n=t))}),r.splice(n,0,e)}$o.log=console.debug||console.log||(()=>{});function Sce(r){try{r?$o.storage.setItem("debug",r):$o.storage.removeItem("debug")}catch{}}function xce(){let r;try{r=$o.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Cce(){try{return localStorage}catch{}}fP.exports=kM()($o);var{formatters:wce}=fP.exports;wce.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var CB=N((mRe,xB)=>{"use strict";xB.exports=(r,e)=>{e=e||process.argv;let t=r.startsWith("-")?"":r.length===1?"-":"--",n=e.indexOf(t+r),i=e.indexOf("--");return n!==-1&&(i===-1?!0:n<i)}});var hP=N((fRe,wB)=>{"use strict";var Ece=require("os"),Ca=CB(),Ui=process.env,jg;Ca("no-color")||Ca("no-colors")||Ca("color=false")?jg=!1:(Ca("color")||Ca("colors")||Ca("color=true")||Ca("color=always"))&&(jg=!0);"FORCE_COLOR"in Ui&&(jg=Ui.FORCE_COLOR.length===0||parseInt(Ui.FORCE_COLOR,10)!==0);function kce(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function Pce(r){if(jg===!1)return 0;if(Ca("color=16m")||Ca("color=full")||Ca("color=truecolor"))return 3;if(Ca("color=256"))return 2;if(r&&!r.isTTY&&jg!==!0)return 0;let e=jg?1:0;if(process.platform==="win32"){let t=Ece.release().split(".");return Number(process.versions.node.split(".")[0])>=8&&Number(t[0])>=10&&Number(t[2])>=10586?Number(t[2])>=14931?3:2:1}if("CI"in Ui)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(t=>t in Ui)||Ui.CI_NAME==="codeship"?1:e;if("TEAMCITY_VERSION"in Ui)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ui.TEAMCITY_VERSION)?1:0;if(Ui.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Ui){let t=parseInt((Ui.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ui.TERM_PROGRAM){case"iTerm.app":return t>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Ui.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ui.TERM)||"COLORTERM"in Ui?1:(Ui.TERM==="dumb",e)}function PM(r){let e=Pce(r);return kce(e)}wB.exports={supportsColor:PM,stdout:PM(process.stdout),stderr:PM(process.stderr)}});var kB=N((ui,vP)=>{var Dce=require("tty"),gP=require("util");ui.init=Oce;ui.log=Ace;ui.formatArgs=Tce;ui.save=Nce;ui.load=Mce;ui.useColors=_ce;ui.destroy=gP.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");ui.colors=[6,2,3,4,5,1];try{let r=hP();r&&(r.stderr||r).level>=2&&(ui.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}ui.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function _ce(){return"colors"in ui.inspectOpts?!!ui.inspectOpts.colors:Dce.isatty(process.stderr.fd)}function Tce(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${e} \x1B[0m`;r[0]=o+r[0].split(`
|
||
`).join(`
|
||
`+o),r.push(i+"m+"+vP.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Rce()+e+" "+r[0]}function Rce(){return ui.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Ace(...r){return process.stderr.write(gP.format(...r)+`
|
||
`)}function Nce(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function Mce(){return process.env.DEBUG}function Oce(r){r.inspectOpts={};let e=Object.keys(ui.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=ui.inspectOpts[e[t]]}vP.exports=kM()(ui);var{formatters:EB}=vP.exports;EB.o=function(r){return this.inspectOpts.colors=this.useColors,gP.inspect(r,this.inspectOpts).split(`
|
||
`).map(e=>e.trim()).join(" ")};EB.O=function(r){return this.inspectOpts.colors=this.useColors,gP.inspect(r,this.inspectOpts)}});var PB=N((hRe,DM)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?DM.exports=SB():DM.exports=kB()});var _B=N((gRe,DB)=>{var Tx;DB.exports=function(){if(!Tx){try{Tx=PB()("follow-redirects")}catch{}typeof Tx!="function"&&(Tx=function(){})}Tx.apply(null,arguments)}});var MB=N((vRe,jM)=>{var Nx=require("url"),Rx=Nx.URL,Kce=require("http"),Fce=require("https"),NM=require("stream").Writable,MM=require("assert"),TB=_B(),OM=!1;try{MM(new Rx)}catch(r){OM=r.code==="ERR_INVALID_URL"}var Lce=["auth","host","hostname","href","path","pathname","port","protocol","query","search","hash"],KM=["abort","aborted","connect","error","socket","timeout"],FM=Object.create(null);KM.forEach(function(r){FM[r]=function(e,t,n){this._redirectable.emit(r,e,t,n)}});var TM=Mx("ERR_INVALID_URL","Invalid URL",TypeError),RM=Mx("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),Uce=Mx("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded",RM),jce=Mx("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),Wce=Mx("ERR_STREAM_WRITE_AFTER_END","write after end"),Vce=NM.prototype.destroy||AB;function Co(r,e){NM.call(this),this._sanitizeOptions(r),this._options=r,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],e&&this.on("response",e);var t=this;this._onNativeResponse=function(n){try{t._processResponse(n)}catch(i){t.emit("error",i instanceof RM?i:new RM({cause:i}))}},this._performRequest()}Co.prototype=Object.create(NM.prototype);Co.prototype.abort=function(){UM(this._currentRequest),this._currentRequest.abort(),this.emit("abort")};Co.prototype.destroy=function(r){return UM(this._currentRequest,r),Vce.call(this,r),this};Co.prototype.write=function(r,e,t){if(this._ending)throw new Wce;if(!Rm(r)&&!Jce(r))throw new TypeError("data should be a string, Buffer or Uint8Array");if(Ax(e)&&(t=e,e=null),r.length===0){t&&t();return}this._requestBodyLength+r.length<=this._options.maxBodyLength?(this._requestBodyLength+=r.length,this._requestBodyBuffers.push({data:r,encoding:e}),this._currentRequest.write(r,e,t)):(this.emit("error",new jce),this.abort())};Co.prototype.end=function(r,e,t){if(Ax(r)?(t=r,r=e=null):Ax(e)&&(t=e,e=null),!r)this._ended=this._ending=!0,this._currentRequest.end(null,null,t);else{var n=this,i=this._currentRequest;this.write(r,e,function(){n._ended=!0,i.end(null,null,t)}),this._ending=!0}};Co.prototype.setHeader=function(r,e){this._options.headers[r]=e,this._currentRequest.setHeader(r,e)};Co.prototype.removeHeader=function(r){delete this._options.headers[r],this._currentRequest.removeHeader(r)};Co.prototype.setTimeout=function(r,e){var t=this;function n(s){s.setTimeout(r),s.removeListener("timeout",s.destroy),s.addListener("timeout",s.destroy)}function i(s){t._timeout&&clearTimeout(t._timeout),t._timeout=setTimeout(function(){t.emit("timeout"),o()},r),n(s)}function o(){t._timeout&&(clearTimeout(t._timeout),t._timeout=null),t.removeListener("abort",o),t.removeListener("error",o),t.removeListener("response",o),t.removeListener("close",o),e&&t.removeListener("timeout",e),t.socket||t._currentRequest.removeListener("socket",i)}return e&&this.on("timeout",e),this.socket?i(this.socket):this._currentRequest.once("socket",i),this.on("socket",n),this.on("abort",o),this.on("error",o),this.on("response",o),this.on("close",o),this};["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach(function(r){Co.prototype[r]=function(e,t){return this._currentRequest[r](e,t)}});["aborted","connection","socket"].forEach(function(r){Object.defineProperty(Co.prototype,r,{get:function(){return this._currentRequest[r]}})});Co.prototype._sanitizeOptions=function(r){if(r.headers||(r.headers={}),r.host&&(r.hostname||(r.hostname=r.host),delete r.host),!r.pathname&&r.path){var e=r.path.indexOf("?");e<0?r.pathname=r.path:(r.pathname=r.path.substring(0,e),r.search=r.path.substring(e))}};Co.prototype._performRequest=function(){var r=this._options.protocol,e=this._options.nativeProtocols[r];if(!e)throw new TypeError("Unsupported protocol "+r);if(this._options.agents){var t=r.slice(0,-1);this._options.agent=this._options.agents[t]}var n=this._currentRequest=e.request(this._options,this._onNativeResponse);n._redirectable=this;for(var i of KM)n.on(i,FM[i]);if(this._currentUrl=/^\//.test(this._options.path)?Nx.format(this._options):this._options.path,this._isRedirect){var o=0,s=this,a=this._requestBodyBuffers;(function l(c){if(n===s._currentRequest)if(c)s.emit("error",c);else if(o<a.length){var u=a[o++];n.finished||n.write(u.data,u.encoding,l)}else s._ended&&n.end()})()}};Co.prototype._processResponse=function(r){var e=r.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:r.headers,statusCode:e});var t=r.headers.location;if(!t||this._options.followRedirects===!1||e<300||e>=400){r.responseUrl=this._currentUrl,r.redirects=this._redirects,this.emit("response",r),this._requestBodyBuffers=[];return}if(UM(this._currentRequest),r.destroy(),++this._redirectCount>this._options.maxRedirects)throw new Uce;var n,i=this._options.beforeRedirect;i&&(n=Object.assign({Host:r.req.getHeader("host")},this._options.headers));var o=this._options.method;((e===301||e===302)&&this._options.method==="POST"||e===303&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],_M(/^content-/i,this._options.headers));var s=_M(/^host$/i,this._options.headers),a=LM(this._currentUrl),l=s||a.host,c=/^\w+:/.test(t)?this._currentUrl:Nx.format(Object.assign(a,{host:l})),u=Bce(t,c);if(TB("redirecting to",u.href),this._isRedirect=!0,AM(u,this._options),(u.protocol!==a.protocol&&u.protocol!=="https:"||u.host!==l&&!qce(u.host,l))&&_M(/^(?:(?:proxy-)?authorization|cookie)$/i,this._options.headers),Ax(i)){var p={headers:r.headers,statusCode:e},f={url:c,method:o,headers:n};i(this._options,p,f),this._sanitizeOptions(this._options)}this._performRequest()};function RB(r){var e={maxRedirects:21,maxBodyLength:10485760},t={};return Object.keys(r).forEach(function(n){var i=n+":",o=t[i]=r[n],s=e[n]=Object.create(o);function a(c,u,p){return $ce(c)?c=AM(c):Rm(c)?c=AM(LM(c)):(p=u,u=NB(c),c={protocol:i}),Ax(u)&&(p=u,u=null),u=Object.assign({maxRedirects:e.maxRedirects,maxBodyLength:e.maxBodyLength},c,u),u.nativeProtocols=t,!Rm(u.host)&&!Rm(u.hostname)&&(u.hostname="::1"),MM.equal(u.protocol,i,"protocol mismatch"),TB("options",u),new Co(u,p)}function l(c,u,p){var f=s.request(c,u,p);return f.end(),f}Object.defineProperties(s,{request:{value:a,configurable:!0,enumerable:!0,writable:!0},get:{value:l,configurable:!0,enumerable:!0,writable:!0}})}),e}function AB(){}function LM(r){var e;if(OM)e=new Rx(r);else if(e=NB(Nx.parse(r)),!Rm(e.protocol))throw new TM({input:r});return e}function Bce(r,e){return OM?new Rx(r,e):LM(Nx.resolve(e,r))}function NB(r){if(/^\[/.test(r.hostname)&&!/^\[[:0-9a-f]+\]$/i.test(r.hostname))throw new TM({input:r.href||r});if(/^\[/.test(r.host)&&!/^\[[:0-9a-f]+\](:\d+)?$/i.test(r.host))throw new TM({input:r.href||r});return r}function AM(r,e){var t=e||{};for(var n of Lce)t[n]=r[n];return t.hostname.startsWith("[")&&(t.hostname=t.hostname.slice(1,-1)),t.port!==""&&(t.port=Number(t.port)),t.path=t.search?t.pathname+t.search:t.pathname,t}function _M(r,e){var t;for(var n in e)r.test(n)&&(t=e[n],delete e[n]);return t===null||typeof t>"u"?void 0:String(t).trim()}function Mx(r,e,t){function n(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=r,this.message=this.cause?e+": "+this.cause.message:e}return n.prototype=new(t||Error),Object.defineProperties(n.prototype,{constructor:{value:n,enumerable:!1},name:{value:"Error ["+r+"]",enumerable:!1}}),n}function UM(r,e){for(var t of KM)r.removeListener(t,FM[t]);r.on("error",AB),r.destroy(e)}function qce(r,e){MM(Rm(r)&&Rm(e));var t=r.length-e.length-1;return t>0&&r[t]==="."&&r.endsWith(e)}function Rm(r){return typeof r=="string"||r instanceof String}function Ax(r){return typeof r=="function"}function Jce(r){return typeof r=="object"&&"length"in r}function $ce(r){return Rx&&r instanceof Rx}jM.exports=RB({http:Kce,https:Fce});jM.exports.wrap=RB});var w6=N((yRe,C6)=>{"use strict";var Hce=gB(),Gce=require("url"),zce=yB(),Qce=require("http"),Yce=require("https"),XB=require("util"),Xce=MB(),Zce=require("zlib"),ZB=require("stream"),eue=require("events");function $c(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var e6=$c(Hce),tue=$c(Gce),rue=$c(Qce),nue=$c(Yce),iue=$c(XB),oue=$c(Xce),Mp=$c(Zce),Ap=$c(ZB),sue=$c(eue);function t6(r,e){return function(){return r.apply(e,arguments)}}var{toString:aue}=Object.prototype,{getPrototypeOf:tO}=Object,CP=(r=>e=>{let t=aue.call(e);return r[t]||(r[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Fl=r=>(r=r.toLowerCase(),e=>CP(e)===r),wP=r=>e=>typeof e===r,{isArray:qg}=Array,Fx=wP("undefined");function lue(r){return r!==null&&!Fx(r)&&r.constructor!==null&&!Fx(r.constructor)&&Ls(r.constructor.isBuffer)&&r.constructor.isBuffer(r)}var r6=Fl("ArrayBuffer");function cue(r){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(r):e=r&&r.buffer&&r6(r.buffer),e}var uue=wP("string"),Ls=wP("function"),n6=wP("number"),EP=r=>r!==null&&typeof r=="object",pue=r=>r===!0||r===!1,bP=r=>{if(CP(r)!=="object")return!1;let e=tO(r);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in r)&&!(Symbol.iterator in r)},due=Fl("Date"),mue=Fl("File"),fue=Fl("Blob"),hue=Fl("FileList"),gue=r=>EP(r)&&Ls(r.pipe),vue=r=>{let e;return r&&(typeof FormData=="function"&&r instanceof FormData||Ls(r.append)&&((e=CP(r))==="formdata"||e==="object"&&Ls(r.toString)&&r.toString()==="[object FormData]"))},yue=Fl("URLSearchParams"),bue=r=>r.trim?r.trim():r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ux(r,e,{allOwnKeys:t=!1}={}){if(r===null||typeof r>"u")return;let n,i;if(typeof r!="object"&&(r=[r]),qg(r))for(n=0,i=r.length;n<i;n++)e.call(null,r[n],n,r);else{let o=t?Object.getOwnPropertyNames(r):Object.keys(r),s=o.length,a;for(n=0;n<s;n++)a=o[n],e.call(null,r[a],a,r)}}function i6(r,e){e=e.toLowerCase();let t=Object.keys(r),n=t.length,i;for(;n-- >0;)if(i=t[n],e===i.toLowerCase())return i;return null}var o6=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),s6=r=>!Fx(r)&&r!==o6;function JM(){let{caseless:r}=s6(this)&&this||{},e={},t=(n,i)=>{let o=r&&i6(e,i)||i;bP(e[o])&&bP(n)?e[o]=JM(e[o],n):bP(n)?e[o]=JM({},n):qg(n)?e[o]=n.slice():e[o]=n};for(let n=0,i=arguments.length;n<i;n++)arguments[n]&&Ux(arguments[n],t);return e}var Iue=(r,e,t,{allOwnKeys:n}={})=>(Ux(e,(i,o)=>{t&&Ls(i)?r[o]=t6(i,t):r[o]=i},{allOwnKeys:n}),r),Sue=r=>(r.charCodeAt(0)===65279&&(r=r.slice(1)),r),xue=(r,e,t,n)=>{r.prototype=Object.create(e.prototype,n),r.prototype.constructor=r,Object.defineProperty(r,"super",{value:e.prototype}),t&&Object.assign(r.prototype,t)},Cue=(r,e,t,n)=>{let i,o,s,a={};if(e=e||{},r==null)return e;do{for(i=Object.getOwnPropertyNames(r),o=i.length;o-- >0;)s=i[o],(!n||n(s,r,e))&&!a[s]&&(e[s]=r[s],a[s]=!0);r=t!==!1&&tO(r)}while(r&&(!t||t(r,e))&&r!==Object.prototype);return e},wue=(r,e,t)=>{r=String(r),(t===void 0||t>r.length)&&(t=r.length),t-=e.length;let n=r.indexOf(e,t);return n!==-1&&n===t},Eue=r=>{if(!r)return null;if(qg(r))return r;let e=r.length;if(!n6(e))return null;let t=new Array(e);for(;e-- >0;)t[e]=r[e];return t},kue=(r=>e=>r&&e instanceof r)(typeof Uint8Array<"u"&&tO(Uint8Array)),Pue=(r,e)=>{let n=(r&&r[Symbol.iterator]).call(r),i;for(;(i=n.next())&&!i.done;){let o=i.value;e.call(r,o[0],o[1])}},Due=(r,e)=>{let t,n=[];for(;(t=r.exec(e))!==null;)n.push(t);return n},_ue=Fl("HTMLFormElement"),Tue=r=>r.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,n,i){return n.toUpperCase()+i}),OB=(({hasOwnProperty:r})=>(e,t)=>r.call(e,t))(Object.prototype),Rue=Fl("RegExp"),a6=(r,e)=>{let t=Object.getOwnPropertyDescriptors(r),n={};Ux(t,(i,o)=>{let s;(s=e(i,o,r))!==!1&&(n[o]=s||i)}),Object.defineProperties(r,n)},Aue=r=>{a6(r,(e,t)=>{if(Ls(r)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;let n=r[t];if(Ls(n)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},Nue=(r,e)=>{let t={},n=i=>{i.forEach(o=>{t[o]=!0})};return qg(r)?n(r):n(String(r).split(e)),t},Mue=()=>{},Oue=(r,e)=>(r=+r,Number.isFinite(r)?r:e),WM="abcdefghijklmnopqrstuvwxyz",KB="0123456789",l6={DIGIT:KB,ALPHA:WM,ALPHA_DIGIT:WM+WM.toUpperCase()+KB},Kue=(r=16,e=l6.ALPHA_DIGIT)=>{let t="",{length:n}=e;for(;r--;)t+=e[Math.random()*n|0];return t};function Fue(r){return!!(r&&Ls(r.append)&&r[Symbol.toStringTag]==="FormData"&&r[Symbol.iterator])}var Lue=r=>{let e=new Array(10),t=(n,i)=>{if(EP(n)){if(e.indexOf(n)>=0)return;if(!("toJSON"in n)){e[i]=n;let o=qg(n)?[]:{};return Ux(n,(s,a)=>{let l=t(s,i+1);!Fx(l)&&(o[a]=l)}),e[i]=void 0,o}}return n};return t(r,0)},Uue=Fl("AsyncFunction"),jue=r=>r&&(EP(r)||Ls(r))&&Ls(r.then)&&Ls(r.catch),Y={isArray:qg,isArrayBuffer:r6,isBuffer:lue,isFormData:vue,isArrayBufferView:cue,isString:uue,isNumber:n6,isBoolean:pue,isObject:EP,isPlainObject:bP,isUndefined:Fx,isDate:due,isFile:mue,isBlob:fue,isRegExp:Rue,isFunction:Ls,isStream:gue,isURLSearchParams:yue,isTypedArray:kue,isFileList:hue,forEach:Ux,merge:JM,extend:Iue,trim:bue,stripBOM:Sue,inherits:xue,toFlatObject:Cue,kindOf:CP,kindOfTest:Fl,endsWith:wue,toArray:Eue,forEachEntry:Pue,matchAll:Due,isHTMLForm:_ue,hasOwnProperty:OB,hasOwnProp:OB,reduceDescriptors:a6,freezeMethods:Aue,toObjectSet:Nue,toCamelCase:Tue,noop:Mue,toFiniteNumber:Oue,findKey:i6,global:o6,isContextDefined:s6,ALPHABET:l6,generateString:Kue,isSpecCompliantForm:Fue,toJSONObject:Lue,isAsyncFn:Uue,isThenable:jue};function He(r,e,t,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),n&&(this.request=n),i&&(this.response=i)}Y.inherits(He,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Y.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var c6=He.prototype,u6={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(r=>{u6[r]={value:r}});Object.defineProperties(He,u6);Object.defineProperty(c6,"isAxiosError",{value:!0});He.from=(r,e,t,n,i,o)=>{let s=Object.create(c6);return Y.toFlatObject(r,s,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),He.call(s,r.message,e,t,n,i),s.cause=r,s.name=r.name,o&&Object.assign(s,o),s};function $M(r){return Y.isPlainObject(r)||Y.isArray(r)}function p6(r){return Y.endsWith(r,"[]")?r.slice(0,-2):r}function FB(r,e,t){return r?r.concat(e).map(function(i,o){return i=p6(i),!t&&o?"["+i+"]":i}).join(t?".":""):e}function Wue(r){return Y.isArray(r)&&!r.some($M)}var Vue=Y.toFlatObject(Y,{},null,function(e){return/^is[A-Z]/.test(e)});function kP(r,e,t){if(!Y.isObject(r))throw new TypeError("target must be an object");e=e||new(e6.default||FormData),t=Y.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,C){return!Y.isUndefined(C[b])});let n=t.metaTokens,i=t.visitor||u,o=t.dots,s=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Y.isSpecCompliantForm(e);if(!Y.isFunction(i))throw new TypeError("visitor must be a function");function c(v){if(v===null)return"";if(Y.isDate(v))return v.toISOString();if(!l&&Y.isBlob(v))throw new He("Blob is not supported. Use a Buffer instead.");return Y.isArrayBuffer(v)||Y.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function u(v,b,C){let E=v;if(v&&!C&&typeof v=="object"){if(Y.endsWith(b,"{}"))b=n?b:b.slice(0,-2),v=JSON.stringify(v);else if(Y.isArray(v)&&Wue(v)||(Y.isFileList(v)||Y.endsWith(b,"[]"))&&(E=Y.toArray(v)))return b=p6(b),E.forEach(function(_,L){!(Y.isUndefined(_)||_===null)&&e.append(s===!0?FB([b],L,o):s===null?b:b+"[]",c(_))}),!1}return $M(v)?!0:(e.append(FB(C,b,o),c(v)),!1)}let p=[],f=Object.assign(Vue,{defaultVisitor:u,convertValue:c,isVisitable:$M});function g(v,b){if(!Y.isUndefined(v)){if(p.indexOf(v)!==-1)throw Error("Circular reference detected in "+b.join("."));p.push(v),Y.forEach(v,function(E,R){(!(Y.isUndefined(E)||E===null)&&i.call(e,E,Y.isString(R)?R.trim():R,b,f))===!0&&g(E,b?b.concat(R):[R])}),p.pop()}}if(!Y.isObject(r))throw new TypeError("data must be an object");return g(r),e}function LB(r){let e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(r).replace(/[!'()~]|%20|%00/g,function(n){return e[n]})}function d6(r,e){this._pairs=[],r&&kP(r,this,e)}var m6=d6.prototype;m6.append=function(e,t){this._pairs.push([e,t])};m6.toString=function(e){let t=e?function(n){return e.call(this,n,LB)}:LB;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Bue(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rO(r,e,t){if(!e)return r;let n=t&&t.encode||Bue,i=t&&t.serialize,o;if(i?o=i(e,t):o=Y.isURLSearchParams(e)?e.toString():new d6(e,t).toString(n),o){let s=r.indexOf("#");s!==-1&&(r=r.slice(0,s)),r+=(r.indexOf("?")===-1?"?":"&")+o}return r}var HM=class{constructor(){this.handlers=[]}use(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Y.forEach(this.handlers,function(n){n!==null&&e(n)})}},UB=HM,nO={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},que=tue.default.URLSearchParams,Jue={isNode:!0,classes:{URLSearchParams:que,FormData:e6.default,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]},f6=typeof window<"u"&&typeof document<"u",$ue=(r=>f6&&["ReactNative","NativeScript","NS"].indexOf(r)<0)(typeof navigator<"u"&&navigator.product),Hue=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Gue=Object.freeze({__proto__:null,hasBrowserEnv:f6,hasStandardBrowserWebWorkerEnv:Hue,hasStandardBrowserEnv:$ue}),Fs={...Gue,...Jue};function zue(r,e){return kP(r,new Fs.classes.URLSearchParams,Object.assign({visitor:function(t,n,i,o){return Fs.isNode&&Y.isBuffer(t)?(this.append(n,t.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function Que(r){return Y.matchAll(/\w+|\[(\w*)]/g,r).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Yue(r){let e={},t=Object.keys(r),n,i=t.length,o;for(n=0;n<i;n++)o=t[n],e[o]=r[o];return e}function h6(r){function e(t,n,i,o){let s=t[o++],a=Number.isFinite(+s),l=o>=t.length;return s=!s&&Y.isArray(i)?i.length:s,l?(Y.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!a):((!i[s]||!Y.isObject(i[s]))&&(i[s]=[]),e(t,n,i[s],o)&&Y.isArray(i[s])&&(i[s]=Yue(i[s])),!a)}if(Y.isFormData(r)&&Y.isFunction(r.entries)){let t={};return Y.forEachEntry(r,(n,i)=>{e(Que(n),i,t,0)}),t}return null}function Xue(r,e,t){if(Y.isString(r))try{return(e||JSON.parse)(r),Y.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(t||JSON.stringify)(r)}var iO={transitional:nO,adapter:["xhr","http"],transformRequest:[function(e,t){let n=t.getContentType()||"",i=n.indexOf("application/json")>-1,o=Y.isObject(e);if(o&&Y.isHTMLForm(e)&&(e=new FormData(e)),Y.isFormData(e))return i&&i?JSON.stringify(h6(e)):e;if(Y.isArrayBuffer(e)||Y.isBuffer(e)||Y.isStream(e)||Y.isFile(e)||Y.isBlob(e))return e;if(Y.isArrayBufferView(e))return e.buffer;if(Y.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return zue(e,this.formSerializer).toString();if((a=Y.isFileList(e))||n.indexOf("multipart/form-data")>-1){let l=this.env&&this.env.FormData;return kP(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(t.setContentType("application/json",!1),Xue(e)):e}],transformResponse:[function(e){let t=this.transitional||iO.transitional,n=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Y.isString(e)&&(n&&!this.responseType||i)){let s=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(s)throw a.name==="SyntaxError"?He.from(a,He.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Fs.classes.FormData,Blob:Fs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Y.forEach(["delete","get","head","post","put","patch"],r=>{iO.headers[r]={}});var oO=iO,Zue=Y.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),epe=r=>{let e={},t,n,i;return r&&r.split(`
|
||
`).forEach(function(s){i=s.indexOf(":"),t=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!t||e[t]&&Zue[t])&&(t==="set-cookie"?e[t]?e[t].push(n):e[t]=[n]:e[t]=e[t]?e[t]+", "+n:n)}),e},jB=Symbol("internals");function Ox(r){return r&&String(r).trim().toLowerCase()}function IP(r){return r===!1||r==null?r:Y.isArray(r)?r.map(IP):String(r)}function tpe(r){let e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=t.exec(r);)e[n[1]]=n[2];return e}var rpe=r=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(r.trim());function VM(r,e,t,n,i){if(Y.isFunction(n))return n.call(this,e,t);if(i&&(e=t),!!Y.isString(e)){if(Y.isString(n))return e.indexOf(n)!==-1;if(Y.isRegExp(n))return n.test(e)}}function npe(r){return r.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,n)=>t.toUpperCase()+n)}function ipe(r,e){let t=Y.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(r,n+t,{value:function(i,o,s){return this[n].call(this,e,i,o,s)},configurable:!0})})}var Wg=class{constructor(e){e&&this.set(e)}set(e,t,n){let i=this;function o(a,l,c){let u=Ox(l);if(!u)throw new Error("header name must be a non-empty string");let p=Y.findKey(i,u);(!p||i[p]===void 0||c===!0||c===void 0&&i[p]!==!1)&&(i[p||l]=IP(a))}let s=(a,l)=>Y.forEach(a,(c,u)=>o(c,u,l));return Y.isPlainObject(e)||e instanceof this.constructor?s(e,t):Y.isString(e)&&(e=e.trim())&&!rpe(e)?s(epe(e),t):e!=null&&o(t,e,n),this}get(e,t){if(e=Ox(e),e){let n=Y.findKey(this,e);if(n){let i=this[n];if(!t)return i;if(t===!0)return tpe(i);if(Y.isFunction(t))return t.call(this,i,n);if(Y.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ox(e),e){let n=Y.findKey(this,e);return!!(n&&this[n]!==void 0&&(!t||VM(this,this[n],n,t)))}return!1}delete(e,t){let n=this,i=!1;function o(s){if(s=Ox(s),s){let a=Y.findKey(n,s);a&&(!t||VM(n,n[a],a,t))&&(delete n[a],i=!0)}}return Y.isArray(e)?e.forEach(o):o(e),i}clear(e){let t=Object.keys(this),n=t.length,i=!1;for(;n--;){let o=t[n];(!e||VM(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){let t=this,n={};return Y.forEach(this,(i,o)=>{let s=Y.findKey(n,o);if(s){t[s]=IP(i),delete t[o];return}let a=e?npe(o):String(o).trim();a!==o&&delete t[o],t[a]=IP(i),n[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){let t=Object.create(null);return Y.forEach(this,(n,i)=>{n!=null&&n!==!1&&(t[i]=e&&Y.isArray(n)?n.join(", "):n)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
||
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){let n=new this(e);return t.forEach(i=>n.set(i)),n}static accessor(e){let n=(this[jB]=this[jB]={accessors:{}}).accessors,i=this.prototype;function o(s){let a=Ox(s);n[a]||(ipe(i,s),n[a]=!0)}return Y.isArray(e)?e.forEach(o):o(e),this}};Wg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Y.reduceDescriptors(Wg.prototype,({value:r},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>r,set(n){this[t]=n}}});Y.freezeMethods(Wg);var Us=Wg;function BM(r,e){let t=this||oO,n=e||t,i=Us.from(n.headers),o=n.data;return Y.forEach(r,function(a){o=a.call(t,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function g6(r){return!!(r&&r.__CANCEL__)}function Am(r,e,t){He.call(this,r??"canceled",He.ERR_CANCELED,e,t),this.name="CanceledError"}Y.inherits(Am,He,{__CANCEL__:!0});function Kx(r,e,t){let n=t.config.validateStatus;!t.status||!n||n(t.status)?r(t):e(new He("Request failed with status code "+t.status,[He.ERR_BAD_REQUEST,He.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function ope(r){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(r)}function spe(r,e){return e?r.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):r}function sO(r,e){return r&&!ope(e)?spe(r,e):e}var xP="1.6.1";function v6(r){let e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(r);return e&&e[1]||""}var ape=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function lpe(r,e,t){let n=t&&t.Blob||Fs.classes.Blob,i=v6(r);if(e===void 0&&n&&(e=!0),i==="data"){r=i.length?r.slice(i.length+1):r;let o=ape.exec(r);if(!o)throw new He("Invalid URL",He.ERR_INVALID_URL);let s=o[1],a=o[2],l=o[3],c=Buffer.from(decodeURIComponent(l),a?"base64":"utf8");if(e){if(!n)throw new He("Blob is not supported",He.ERR_NOT_SUPPORT);return new n([c],{type:s})}return c}throw new He("Unsupported protocol "+i,He.ERR_NOT_SUPPORT)}function cpe(r,e){let t=0,n=1e3/e,i=null;return function(s,a){let l=Date.now();if(s||l-t>n)return i&&(clearTimeout(i),i=null),t=l,r.apply(null,a);i||(i=setTimeout(()=>(i=null,t=Date.now(),r.apply(null,a)),n-(l-t)))}}function y6(r,e){r=r||10;let t=new Array(r),n=new Array(r),i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){let c=Date.now(),u=n[o];s||(s=c),t[i]=l,n[i]=c;let p=o,f=0;for(;p!==i;)f+=t[p++],p=p%r;if(i=(i+1)%r,i===o&&(o=(o+1)%r),c-s<e)return;let g=u&&c-u;return g?Math.round(f*1e3/g):void 0}}var yP=Symbol("internals"),GM=class extends Ap.default.Transform{constructor(e){e=Y.toFlatObject(e,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(a,l)=>!Y.isUndefined(l[a])),super({readableHighWaterMark:e.chunkSize});let t=this,n=this[yP]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},i=y6(n.ticksRate*e.samplesCount,n.timeWindow);this.on("newListener",a=>{a==="progress"&&(n.isCaptured||(n.isCaptured=!0))});let o=0;n.updateProgress=cpe(function(){let l=n.length,c=n.bytesSeen,u=c-o;if(!u||t.destroyed)return;let p=i(u);o=c,process.nextTick(()=>{t.emit("progress",{loaded:c,total:l,progress:l?c/l:void 0,bytes:u,rate:p||void 0,estimated:p&&l&&c<=l?(l-c)/p:void 0})})},n.ticksRate);let s=()=>{n.updateProgress(!0)};this.once("end",s),this.once("error",s)}_read(e){let t=this[yP];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,n){let i=this,o=this[yP],s=o.maxRate,a=this.readableHighWaterMark,l=o.timeWindow,c=1e3/l,u=s/c,p=o.minChunkSize!==!1?Math.max(o.minChunkSize,u*.01):0;function f(v,b){let C=Buffer.byteLength(v);o.bytesSeen+=C,o.bytes+=C,o.isCaptured&&o.updateProgress(),i.push(v)?process.nextTick(b):o.onReadCallback=()=>{o.onReadCallback=null,process.nextTick(b)}}let g=(v,b)=>{let C=Buffer.byteLength(v),E=null,R=a,_,L=0;if(s){let te=Date.now();(!o.ts||(L=te-o.ts)>=l)&&(o.ts=te,_=u-o.bytes,o.bytes=_<0?-_:0,L=0),_=u-o.bytes}if(s){if(_<=0)return setTimeout(()=>{b(null,v)},l-L);_<R&&(R=_)}R&&C>R&&C-R>p&&(E=v.subarray(R),v=v.subarray(0,R)),f(v,E?()=>{process.nextTick(b,null,E)}:b)};g(e,function v(b,C){if(b)return n(b);C?g(C,v):n(null)})}setLength(e){return this[yP].length=+e,this}},WB=GM,{asyncIterator:VB}=Symbol,upe=async function*(r){r.stream?yield*r.stream():r.arrayBuffer?yield await r.arrayBuffer():r[VB]?yield*r[VB]():yield r},b6=upe,ppe=Y.ALPHABET.ALPHA_DIGIT+"-_",Lx=new XB.TextEncoder,Np=`\r
|
||
`,dpe=Lx.encode(Np),mpe=2,zM=class{constructor(e,t){let{escapeName:n}=this.constructor,i=Y.isString(t),o=`Content-Disposition: form-data; name="${n(e)}"${!i&&t.name?`; filename="${n(t.name)}"`:""}${Np}`;i?t=Lx.encode(String(t).replace(/\r?\n|\r\n?/g,Np)):o+=`Content-Type: ${t.type||"application/octet-stream"}${Np}`,this.headers=Lx.encode(o+Np),this.contentLength=i?t.byteLength:t.size,this.size=this.headers.byteLength+this.contentLength+mpe,this.name=e,this.value=t}async*encode(){yield this.headers;let{value:e}=this;Y.isTypedArray(e)?yield e:yield*b6(e),yield dpe}static escapeName(e){return String(e).replace(/[\r\n"]/g,t=>({"\r":"%0D","\n":"%0A",'"':"%22"})[t])}},fpe=(r,e,t)=>{let{tag:n="form-data-boundary",size:i=25,boundary:o=n+"-"+Y.generateString(i,ppe)}=t||{};if(!Y.isFormData(r))throw TypeError("FormData instance required");if(o.length<1||o.length>70)throw Error("boundary must be 10-70 characters long");let s=Lx.encode("--"+o+Np),a=Lx.encode("--"+o+"--"+Np+Np),l=a.byteLength,c=Array.from(r.entries()).map(([p,f])=>{let g=new zM(p,f);return l+=g.size,g});l+=s.byteLength*c.length,l=Y.toFiniteNumber(l);let u={"Content-Type":`multipart/form-data; boundary=${o}`};return Number.isFinite(l)&&(u["Content-Length"]=l),e&&e(u),ZB.Readable.from(async function*(){for(let p of c)yield s,yield*p.encode();yield a}())},hpe=fpe,QM=class extends Ap.default.Transform{__transform(e,t,n){this.push(e),n()}_transform(e,t,n){if(e.length!==0&&(this._transform=this.__transform,e[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,t)}this.__transform(e,t,n)}},gpe=QM,vpe=(r,e)=>Y.isAsyncFn(r)?function(...t){let n=t.pop();r.apply(this,t).then(i=>{try{e?n(null,...e(i)):n(null,i)}catch(o){n(o)}},n)}:r,ype=vpe,BB={flush:Mp.default.constants.Z_SYNC_FLUSH,finishFlush:Mp.default.constants.Z_SYNC_FLUSH},bpe={flush:Mp.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Mp.default.constants.BROTLI_OPERATION_FLUSH},qB=Y.isFunction(Mp.default.createBrotliDecompress),{http:Ipe,https:Spe}=oue.default,xpe=/https:?/,JB=Fs.protocols.map(r=>r+":");function Cpe(r){r.beforeRedirects.proxy&&r.beforeRedirects.proxy(r),r.beforeRedirects.config&&r.beforeRedirects.config(r)}function I6(r,e,t){let n=e;if(!n&&n!==!1){let i=zce.getProxyForUrl(t);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let o=Buffer.from(n.auth,"utf8").toString("base64");r.headers["Proxy-Authorization"]="Basic "+o}r.headers.host=r.hostname+(r.port?":"+r.port:"");let i=n.hostname||n.host;r.hostname=i,r.host=i,r.port=n.port,r.path=t,n.protocol&&(r.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}r.beforeRedirects.proxy=function(o){I6(o,e,o.href)}}var wpe=typeof process<"u"&&Y.kindOf(process)==="process",Epe=r=>new Promise((e,t)=>{let n,i,o=(l,c)=>{i||(i=!0,n&&n(l,c))},s=l=>{o(l),e(l)},a=l=>{o(l,!0),t(l)};r(s,a,l=>n=l).catch(a)}),kpe=({address:r,family:e})=>{if(!Y.isString(r))throw TypeError("address must be a string");return{address:r,family:e||(r.indexOf(".")<0?6:4)}},$B=(r,e)=>kpe(Y.isObject(r)?r:{address:r,family:e}),Ppe=wpe&&function(e){return Epe(async function(n,i,o){let{data:s,lookup:a,family:l}=e,{responseType:c,responseEncoding:u}=e,p=e.method.toUpperCase(),f,g=!1,v;if(a){let Q=ype(a,fe=>Y.isArray(fe)?fe:[fe]);a=(fe,Le,fn)=>{Q(fe,Le,(xt,Br,gs)=>{let Ut=Y.isArray(Br)?Br.map(rn=>$B(rn)):[$B(Br,gs)];Le.all?fn(xt,Ut):fn(xt,Ut[0].address,Ut[0].family)})}}let b=new sue.default,C=()=>{e.cancelToken&&e.cancelToken.unsubscribe(E),e.signal&&e.signal.removeEventListener("abort",E),b.removeAllListeners()};o((Q,fe)=>{f=!0,fe&&(g=!0,C())});function E(Q){b.emit("abort",!Q||Q.type?new Am(null,e,v):Q)}b.once("abort",i),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(E),e.signal&&(e.signal.aborted?E():e.signal.addEventListener("abort",E)));let R=sO(e.baseURL,e.url),_=new URL(R,"http://localhost"),L=_.protocol||JB[0];if(L==="data:"){let Q;if(p!=="GET")return Kx(n,i,{status:405,statusText:"method not allowed",headers:{},config:e});try{Q=lpe(e.url,c==="blob",{Blob:e.env&&e.env.Blob})}catch(fe){throw He.from(fe,He.ERR_BAD_REQUEST,e)}return c==="text"?(Q=Q.toString(u),(!u||u==="utf8")&&(Q=Y.stripBOM(Q))):c==="stream"&&(Q=Ap.default.Readable.from(Q)),Kx(n,i,{data:Q,status:200,statusText:"OK",headers:new Us,config:e})}if(JB.indexOf(L)===-1)return i(new He("Unsupported protocol "+L,He.ERR_BAD_REQUEST,e));let te=Us.from(e.headers).normalize();te.set("User-Agent","axios/"+xP,!1);let $=e.onDownloadProgress,se=e.onUploadProgress,ae=e.maxRate,X,be;if(Y.isSpecCompliantForm(s)){let Q=te.getContentType(/boundary=([-_\w\d]{10,70})/i);s=hpe(s,fe=>{te.set(fe)},{tag:`axios-${xP}-boundary`,boundary:Q&&Q[1]||void 0})}else if(Y.isFormData(s)&&Y.isFunction(s.getHeaders)){if(te.set(s.getHeaders()),!te.hasContentLength())try{let Q=await iue.default.promisify(s.getLength).call(s);Number.isFinite(Q)&&Q>=0&&te.setContentLength(Q)}catch{}}else if(Y.isBlob(s))s.size&&te.setContentType(s.type||"application/octet-stream"),te.setContentLength(s.size||0),s=Ap.default.Readable.from(b6(s));else if(s&&!Y.isStream(s)){if(!Buffer.isBuffer(s))if(Y.isArrayBuffer(s))s=Buffer.from(new Uint8Array(s));else if(Y.isString(s))s=Buffer.from(s,"utf-8");else return i(new He("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",He.ERR_BAD_REQUEST,e));if(te.setContentLength(s.length,!1),e.maxBodyLength>-1&&s.length>e.maxBodyLength)return i(new He("Request body larger than maxBodyLength limit",He.ERR_BAD_REQUEST,e))}let Me=Y.toFiniteNumber(te.getContentLength());Y.isArray(ae)?(X=ae[0],be=ae[1]):X=be=ae,s&&(se||X)&&(Y.isStream(s)||(s=Ap.default.Readable.from(s,{objectMode:!1})),s=Ap.default.pipeline([s,new WB({length:Me,maxRate:Y.toFiniteNumber(X)})],Y.noop),se&&s.on("progress",Q=>{se(Object.assign(Q,{upload:!0}))}));let it;if(e.auth){let Q=e.auth.username||"",fe=e.auth.password||"";it=Q+":"+fe}if(!it&&_.username){let Q=_.username,fe=_.password;it=Q+":"+fe}it&&te.delete("authorization");let ut;try{ut=rO(_.pathname+_.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(Q){let fe=new Error(Q.message);return fe.config=e,fe.url=e.url,fe.exists=!0,i(fe)}te.set("Accept-Encoding","gzip, compress, deflate"+(qB?", br":""),!1);let Xe={path:ut,method:p,headers:te.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:it,protocol:L,family:l,beforeRedirect:Cpe,beforeRedirects:{}};!Y.isUndefined(a)&&(Xe.lookup=a),e.socketPath?Xe.socketPath=e.socketPath:(Xe.hostname=_.hostname,Xe.port=_.port,I6(Xe,e.proxy,L+"//"+_.hostname+(_.port?":"+_.port:"")+Xe.path));let ne,Ce=xpe.test(Xe.protocol);if(Xe.agent=Ce?e.httpsAgent:e.httpAgent,e.transport?ne=e.transport:e.maxRedirects===0?ne=Ce?nue.default:rue.default:(e.maxRedirects&&(Xe.maxRedirects=e.maxRedirects),e.beforeRedirect&&(Xe.beforeRedirects.config=e.beforeRedirect),ne=Ce?Spe:Ipe),e.maxBodyLength>-1?Xe.maxBodyLength=e.maxBodyLength:Xe.maxBodyLength=1/0,e.insecureHTTPParser&&(Xe.insecureHTTPParser=e.insecureHTTPParser),v=ne.request(Xe,function(fe){if(v.destroyed)return;let Le=[fe],fn=+fe.headers["content-length"];if($){let rn=new WB({length:Y.toFiniteNumber(fn),maxRate:Y.toFiniteNumber(be)});$&&rn.on("progress",$i=>{$(Object.assign($i,{download:!0}))}),Le.push(rn)}let xt=fe,Br=fe.req||v;if(e.decompress!==!1&&fe.headers["content-encoding"])switch((p==="HEAD"||fe.statusCode===204)&&delete fe.headers["content-encoding"],(fe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Le.push(Mp.default.createUnzip(BB)),delete fe.headers["content-encoding"];break;case"deflate":Le.push(new gpe),Le.push(Mp.default.createUnzip(BB)),delete fe.headers["content-encoding"];break;case"br":qB&&(Le.push(Mp.default.createBrotliDecompress(bpe)),delete fe.headers["content-encoding"])}xt=Le.length>1?Ap.default.pipeline(Le,Y.noop):Le[0];let gs=Ap.default.finished(xt,()=>{gs(),C()}),Ut={status:fe.statusCode,statusText:fe.statusMessage,headers:new Us(fe.headers),config:e,request:Br};if(c==="stream")Ut.data=xt,Kx(n,i,Ut);else{let rn=[],$i=0;xt.on("data",function(ar){rn.push(ar),$i+=ar.length,e.maxContentLength>-1&&$i>e.maxContentLength&&(g=!0,xt.destroy(),i(new He("maxContentLength size of "+e.maxContentLength+" exceeded",He.ERR_BAD_RESPONSE,e,Br)))}),xt.on("aborted",function(){if(g)return;let ar=new He("maxContentLength size of "+e.maxContentLength+" exceeded",He.ERR_BAD_RESPONSE,e,Br);xt.destroy(ar),i(ar)}),xt.on("error",function(ar){v.destroyed||i(He.from(ar,null,e,Br))}),xt.on("end",function(){try{let ar=rn.length===1?rn[0]:Buffer.concat(rn);c!=="arraybuffer"&&(ar=ar.toString(u),(!u||u==="utf8")&&(ar=Y.stripBOM(ar))),Ut.data=ar}catch(ar){return i(He.from(ar,null,e,Ut.request,Ut))}Kx(n,i,Ut)})}b.once("abort",rn=>{xt.destroyed||(xt.emit("error",rn),xt.destroy())})}),b.once("abort",Q=>{i(Q),v.destroy(Q)}),v.on("error",function(fe){i(He.from(fe,null,e,v))}),v.on("socket",function(fe){fe.setKeepAlive(!0,1e3*60)}),e.timeout){let Q=parseInt(e.timeout,10);if(Number.isNaN(Q)){i(new He("error trying to parse `config.timeout` to int",He.ERR_BAD_OPTION_VALUE,e,v));return}v.setTimeout(Q,function(){if(f)return;let Le=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",fn=e.transitional||nO;e.timeoutErrorMessage&&(Le=e.timeoutErrorMessage),i(new He(Le,fn.clarifyTimeoutError?He.ETIMEDOUT:He.ECONNABORTED,e,v)),E()})}if(Y.isStream(s)){let Q=!1,fe=!1;s.on("end",()=>{Q=!0}),s.once("error",Le=>{fe=!0,v.destroy(Le)}),s.on("close",()=>{!Q&&!fe&&E(new Am("Request stream has been aborted",e,v))}),s.pipe(v)}else v.end(s)})},Dpe=Fs.hasStandardBrowserEnv?function(){return{write:function(t,n,i,o,s,a){let l=[];l.push(t+"="+encodeURIComponent(n)),Y.isNumber(i)&&l.push("expires="+new Date(i).toGMTString()),Y.isString(o)&&l.push("path="+o),Y.isString(s)&&l.push("domain="+s),a===!0&&l.push("secure"),document.cookie=l.join("; ")},read:function(t){let n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}(),_pe=Fs.hasStandardBrowserEnv?function(){let e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a"),n;function i(o){let s=o;return e&&(t.setAttribute("href",s),s=t.href),t.setAttribute("href",s),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return n=i(window.location.href),function(s){let a=Y.isString(s)?i(s):s;return a.protocol===n.protocol&&a.host===n.host}}():function(){return function(){return!0}}();function HB(r,e){let t=0,n=y6(50,250);return i=>{let o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-t,l=n(a),c=o<=s;t=o;let u={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:l||void 0,estimated:l&&s&&c?(s-o)/l:void 0,event:i};u[e?"download":"upload"]=!0,r(u)}}var Tpe=typeof XMLHttpRequest<"u",Rpe=Tpe&&function(r){return new Promise(function(t,n){let i=r.data,o=Us.from(r.headers).normalize(),s=r.responseType,a;function l(){r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let c;if(Y.isFormData(i)){if(Fs.hasStandardBrowserEnv||Fs.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((c=o.getContentType())!==!1){let[v,...b]=c?c.split(";").map(C=>C.trim()).filter(Boolean):[];o.setContentType([v||"multipart/form-data",...b].join("; "))}}let u=new XMLHttpRequest;if(r.auth){let v=r.auth.username||"",b=r.auth.password?unescape(encodeURIComponent(r.auth.password)):"";o.set("Authorization","Basic "+btoa(v+":"+b))}let p=sO(r.baseURL,r.url);u.open(r.method.toUpperCase(),rO(p,r.params,r.paramsSerializer),!0),u.timeout=r.timeout;function f(){if(!u)return;let v=Us.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),C={data:!s||s==="text"||s==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:v,config:r,request:u};Kx(function(R){t(R),l()},function(R){n(R),l()},C),u=null}if("onloadend"in u?u.onloadend=f:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(f)},u.onabort=function(){u&&(n(new He("Request aborted",He.ECONNABORTED,r,u)),u=null)},u.onerror=function(){n(new He("Network Error",He.ERR_NETWORK,r,u)),u=null},u.ontimeout=function(){let b=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded",C=r.transitional||nO;r.timeoutErrorMessage&&(b=r.timeoutErrorMessage),n(new He(b,C.clarifyTimeoutError?He.ETIMEDOUT:He.ECONNABORTED,r,u)),u=null},Fs.hasStandardBrowserEnv){let v=_pe(p)&&r.xsrfCookieName&&Dpe.read(r.xsrfCookieName);v&&o.set(r.xsrfHeaderName,v)}i===void 0&&o.setContentType(null),"setRequestHeader"in u&&Y.forEach(o.toJSON(),function(b,C){u.setRequestHeader(C,b)}),Y.isUndefined(r.withCredentials)||(u.withCredentials=!!r.withCredentials),s&&s!=="json"&&(u.responseType=r.responseType),typeof r.onDownloadProgress=="function"&&u.addEventListener("progress",HB(r.onDownloadProgress,!0)),typeof r.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",HB(r.onUploadProgress)),(r.cancelToken||r.signal)&&(a=v=>{u&&(n(!v||v.type?new Am(null,r,u):v),u.abort(),u=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));let g=v6(p);if(g&&Fs.protocols.indexOf(g)===-1){n(new He("Unsupported protocol "+g+":",He.ERR_BAD_REQUEST,r));return}u.send(i||null)})},YM={http:Ppe,xhr:Rpe};Y.forEach(YM,(r,e)=>{if(r){try{Object.defineProperty(r,"name",{value:e})}catch{}Object.defineProperty(r,"adapterName",{value:e})}});var GB=r=>`- ${r}`,Ape=r=>Y.isFunction(r)||r===null||r===!1,S6={getAdapter:r=>{r=Y.isArray(r)?r:[r];let{length:e}=r,t,n,i={};for(let o=0;o<e;o++){t=r[o];let s;if(n=t,!Ape(t)&&(n=YM[(s=String(t)).toLowerCase()],n===void 0))throw new He(`Unknown adapter '${s}'`);if(n)break;i[s||"#"+o]=n}if(!n){let o=Object.entries(i).map(([a,l])=>`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build")),s=e?o.length>1?`since :
|
||
`+o.map(GB).join(`
|
||
`):" "+GB(o[0]):"as no adapter specified";throw new He("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return n},adapters:YM};function qM(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new Am(null,r)}function zB(r){return qM(r),r.headers=Us.from(r.headers),r.data=BM.call(r,r.transformRequest),["post","put","patch"].indexOf(r.method)!==-1&&r.headers.setContentType("application/x-www-form-urlencoded",!1),S6.getAdapter(r.adapter||oO.adapter)(r).then(function(n){return qM(r),n.data=BM.call(r,r.transformResponse,n),n.headers=Us.from(n.headers),n},function(n){return g6(n)||(qM(r),n&&n.response&&(n.response.data=BM.call(r,r.transformResponse,n.response),n.response.headers=Us.from(n.response.headers))),Promise.reject(n)})}var QB=r=>r instanceof Us?r.toJSON():r;function Vg(r,e){e=e||{};let t={};function n(c,u,p){return Y.isPlainObject(c)&&Y.isPlainObject(u)?Y.merge.call({caseless:p},c,u):Y.isPlainObject(u)?Y.merge({},u):Y.isArray(u)?u.slice():u}function i(c,u,p){if(Y.isUndefined(u)){if(!Y.isUndefined(c))return n(void 0,c,p)}else return n(c,u,p)}function o(c,u){if(!Y.isUndefined(u))return n(void 0,u)}function s(c,u){if(Y.isUndefined(u)){if(!Y.isUndefined(c))return n(void 0,c)}else return n(void 0,u)}function a(c,u,p){if(p in e)return n(c,u);if(p in r)return n(void 0,c)}let l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(c,u)=>i(QB(c),QB(u),!0)};return Y.forEach(Object.keys(Object.assign({},r,e)),function(u){let p=l[u]||i,f=p(r[u],e[u],u);Y.isUndefined(f)&&p!==a||(t[u]=f)}),t}var aO={};["object","boolean","number","function","string","symbol"].forEach((r,e)=>{aO[r]=function(n){return typeof n===r||"a"+(e<1?"n ":" ")+r}});var YB={};aO.transitional=function(e,t,n){function i(o,s){return"[Axios v"+xP+"] Transitional option '"+o+"'"+s+(n?". "+n:"")}return(o,s,a)=>{if(e===!1)throw new He(i(s," has been removed"+(t?" in "+t:"")),He.ERR_DEPRECATED);return t&&!YB[s]&&(YB[s]=!0,console.warn(i(s," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(o,s,a):!0}};function Npe(r,e,t){if(typeof r!="object")throw new He("options must be an object",He.ERR_BAD_OPTION_VALUE);let n=Object.keys(r),i=n.length;for(;i-- >0;){let o=n[i],s=e[o];if(s){let a=r[o],l=a===void 0||s(a,o,r);if(l!==!0)throw new He("option "+o+" must be "+l,He.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new He("Unknown option "+o,He.ERR_BAD_OPTION)}}var XM={assertOptions:Npe,validators:aO},Rp=XM.validators,Bg=class{constructor(e){this.defaults=e,this.interceptors={request:new UB,response:new UB}}request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Vg(this.defaults,t);let{transitional:n,paramsSerializer:i,headers:o}=t;n!==void 0&&XM.assertOptions(n,{silentJSONParsing:Rp.transitional(Rp.boolean),forcedJSONParsing:Rp.transitional(Rp.boolean),clarifyTimeoutError:Rp.transitional(Rp.boolean)},!1),i!=null&&(Y.isFunction(i)?t.paramsSerializer={serialize:i}:XM.assertOptions(i,{encode:Rp.function,serialize:Rp.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let s=o&&Y.merge(o.common,o[t.method]);o&&Y.forEach(["delete","get","head","post","put","patch","common"],v=>{delete o[v]}),t.headers=Us.concat(s,o);let a=[],l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(t)===!1||(l=l&&b.synchronous,a.unshift(b.fulfilled,b.rejected))});let c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,p=0,f;if(!l){let v=[zB.bind(this),void 0];for(v.unshift.apply(v,a),v.push.apply(v,c),f=v.length,u=Promise.resolve(t);p<f;)u=u.then(v[p++],v[p++]);return u}f=a.length;let g=t;for(p=0;p<f;){let v=a[p++],b=a[p++];try{g=v(g)}catch(C){b.call(this,C);break}}try{u=zB.call(this,g)}catch(v){return Promise.reject(v)}for(p=0,f=c.length;p<f;)u=u.then(c[p++],c[p++]);return u}getUri(e){e=Vg(this.defaults,e);let t=sO(e.baseURL,e.url);return rO(t,e.params,e.paramsSerializer)}};Y.forEach(["delete","get","head","options"],function(e){Bg.prototype[e]=function(t,n){return this.request(Vg(n||{},{method:e,url:t,data:(n||{}).data}))}});Y.forEach(["post","put","patch"],function(e){function t(n){return function(o,s,a){return this.request(Vg(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:o,data:s}))}}Bg.prototype[e]=t(),Bg.prototype[e+"Form"]=t(!0)});var SP=Bg,ZM=class r{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let t;this.promise=new Promise(function(o){t=o});let n=this;this.promise.then(i=>{if(!n._listeners)return;let o=n._listeners.length;for(;o-- >0;)n._listeners[o](i);n._listeners=null}),this.promise.then=i=>{let o,s=new Promise(a=>{n.subscribe(a),o=a}).then(i);return s.cancel=function(){n.unsubscribe(o)},s},e(function(o,s,a){n.reason||(n.reason=new Am(o,s,a),t(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}static source(){let e;return{token:new r(function(i){e=i}),cancel:e}}},Mpe=ZM;function Ope(r){return function(t){return r.apply(null,t)}}function Kpe(r){return Y.isObject(r)&&r.isAxiosError===!0}var eO={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(eO).forEach(([r,e])=>{eO[e]=r});var Fpe=eO;function x6(r){let e=new SP(r),t=t6(SP.prototype.request,e);return Y.extend(t,SP.prototype,e,{allOwnKeys:!0}),Y.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return x6(Vg(r,i))},t}var Kn=x6(oO);Kn.Axios=SP;Kn.CanceledError=Am;Kn.CancelToken=Mpe;Kn.isCancel=g6;Kn.VERSION=xP;Kn.toFormData=kP;Kn.AxiosError=He;Kn.Cancel=Kn.CanceledError;Kn.all=function(e){return Promise.all(e)};Kn.spread=Ope;Kn.isAxiosError=Kpe;Kn.mergeConfig=Vg;Kn.AxiosHeaders=Us;Kn.formToJSON=r=>h6(Y.isHTMLForm(r)?new FormData(r):r);Kn.getAdapter=S6.getAdapter;Kn.HttpStatusCode=Fpe;Kn.default=Kn;C6.exports=Kn});var E6=N(PP=>{"use strict";Object.defineProperty(PP,"__esModule",{value:!0});PP.AxiosHttpClient=void 0;var Lpe=w6(),lO=class{constructor(e){this.endpoint=e}get(e){return Lpe.default.get(this.endpoint,Object.assign(Object.assign({},e),{proxy:!1}))}};PP.AxiosHttpClient=lO});var k6=N(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});DP.MemoryKeyValueStorage=void 0;var cO=class{constructor(){this.storage=new Map}async getValue(e,t){return this.storage.has(e)?await Promise.resolve(this.storage.get(e)):await Promise.resolve(t||void 0)}setValue(e,t){this.storage.set(e,t)}};DP.MemoryKeyValueStorage=cO});var P6=N(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});_P.ExperimentationServiceBase=void 0;var Upe=k6(),uO=class{get features(){return this._features}set features(e){this._features=e,this.telemetry&&this.telemetry.setSharedProperty(this.assignmentContextTelemetryPropertyName,this.features.assignmentContext)}constructor(e,t,n,i,o){this.telemetry=e,this.assignmentContextTelemetryPropertyName=t,this.telemetryEventName=n,this.storageKey=i,this.storage=o,this.featuresConsumed=!1,this.cachedTelemetryEvents=[],this._features={features:[],assignmentContext:"",configs:[]},this.storageKey||(this.storageKey="ABExp.Features"),this.storage||(o=new Upe.MemoryKeyValueStorage),this.loadCachePromise=this.loadCachedFeatureData(),this.initializePromise=this.loadCachePromise,this.initialFetch=new Promise((s,a)=>{this.resolveInitialFetchPromise=s})}async getFeaturesAsync(e=!1){if(this.fetchPromise!=null){try{await this.fetchPromise}catch{}return this.features}if(!this.featureProviders||this.featureProviders.length===0)return Promise.resolve({features:[],assignmentContext:"",configs:[]});try{this.fetchPromise=Promise.all(this.featureProviders.map(async n=>await n.getFeatures()));let t=await this.fetchPromise;this.updateFeatures(t,e)}catch{}return this.fetchPromise=void 0,this.resolveInitialFetchPromise&&(this.resolveInitialFetchPromise(),this.resolveInitialFetchPromise=void 0),this.features}updateFeatures(e,t=!1){let n={features:[],assignmentContext:"",configs:[]};for(let i of e){for(let o of i.features)n.features.includes(o)||n.features.push(o);for(let o of i.configs){let s=n.configs.find(a=>a.Id===o.Id);s?s.Parameters=Object.assign(Object.assign({},s.Parameters),o.Parameters):n.configs.push(o)}n.assignmentContext+=i.assignmentContext}(t||!this.featuresConsumed)&&(this.features=n),this.storage&&this.storage.setValue(this.storageKey,n)}async loadCachedFeatureData(){let e;this.storage&&(e=await this.storage.getValue(this.storageKey),e!==void 0&&e.configs===void 0&&(e.configs=[])),this.features.features.length===0&&(this.features=e||{features:[],assignmentContext:"",configs:[]})}isFlightEnabled(e){return this.featuresConsumed=!0,this.PostEventToTelemetry(e),this.features.features.includes(e)}async isCachedFlightEnabled(e){return await this.loadCachePromise,this.featuresConsumed=!0,this.PostEventToTelemetry(e),this.features.features.includes(e)}async isFlightEnabledAsync(e){let t=await this.getFeaturesAsync(!0);return this.featuresConsumed=!0,this.PostEventToTelemetry(e),t.features.includes(e)}getTreatmentVariable(e,t){this.featuresConsumed=!0,this.PostEventToTelemetry(`${e}.${t}`);let n=this.features.configs.find(i=>i.Id===e);return n?.Parameters[t]}async getTreatmentVariableAsync(e,t,n){if(n){let i=this.featuresConsumed,o=this.getTreatmentVariable(e,t);if(o===void 0)this.featuresConsumed=i;else return o}return await this.getFeaturesAsync(!0),this.getTreatmentVariable(e,t)}PostEventToTelemetry(e){this.cachedTelemetryEvents.includes(e)||(this.telemetry.postEvent(this.telemetryEventName,new Map([["ABExp.queriedFeature",e]])),this.cachedTelemetryEvents.push(e))}invokeInit(){this.init()}addFeatureProvider(...e){if(!(e==null||this.featureProviders==null))for(let t of e)this.featureProviders.push(t)}};_P.ExperimentationServiceBase=uO});var D6=N(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});TP.PollingService=void 0;var pO=class{constructor(e){this.fetchInterval=e}StopPolling(){clearInterval(this.intervalHandle),this.intervalHandle=void 0}OnPollTick(e){this.onTick=e}StartPolling(e=!1){this.intervalHandle&&this.StopPolling(),this.onTick!=null&&(e&&this.onTick().then(()=>{}).catch(()=>{}),this.intervalHandle=setInterval(async()=>{await this.onTick()},this.fetchInterval),this.intervalHandle.unref&&this.intervalHandle.unref())}};TP.PollingService=pO});var _6=N(RP=>{"use strict";Object.defineProperty(RP,"__esModule",{value:!0});RP.ExperimentationServiceAutoPolling=void 0;var jpe=P6(),Wpe=D6(),dO=class extends jpe.ExperimentationServiceBase{constructor(e,t,n,i,o,s,a){if(super(e,i,o,s,a),this.telemetry=e,this.filterProviders=t,this.refreshRateMs=n,this.assignmentContextTelemetryPropertyName=i,this.telemetryEventName=o,this.storageKey=s,this.storage=a,n<1e3&&n!==0)throw new Error("The minimum refresh rate for polling is 1000 ms (1 second). If you wish to deactivate this auto-polling use value of 0.");n>0&&(this.pollingService=new Wpe.PollingService(n),this.pollingService.OnPollTick(async()=>{await super.getFeaturesAsync()}))}init(){this.pollingService?this.pollingService.StartPolling(!0):super.getFeaturesAsync()}async getFeaturesAsync(e=!1){if(this.pollingService){this.pollingService.StopPolling();let t=await super.getFeaturesAsync(e);return this.pollingService.StartPolling(),t}else return await super.getFeaturesAsync(e)}};RP.ExperimentationServiceAutoPolling=dO});var T6=N(NP=>{"use strict";Object.defineProperty(NP,"__esModule",{value:!0});NP.ExperimentationService=void 0;var Vpe=O3(),Bpe=E6(),qpe=_6(),AP=class extends qpe.ExperimentationServiceAutoPolling{constructor(e){super(e.telemetry,e.filterProviders||[],e.refetchInterval!=null?e.refetchInterval:0,e.assignmentContextTelemetryPropertyName,e.telemetryEventName,e.storageKey,e.keyValueStorage),this.options=e,this.invokeInit()}init(){this.featureProviders=[],this.addFeatureProvider(new Vpe.TasApiFeatureProvider(new Bpe.AxiosHttpClient(this.options.endpoint),this.telemetry,this.filterProviders)),super.init()}};NP.ExperimentationService=AP;AP.REFRESH_RATE_IN_MINUTES=30});var R6=N(MP=>{"use strict";Object.defineProperty(MP,"__esModule",{value:!0});MP.ExperimentationService=void 0;var Jpe=T6();Object.defineProperty(MP,"ExperimentationService",{enumerable:!0,get:function(){return Jpe.ExperimentationService}})});var A6=N(OP=>{"use strict";Object.defineProperty(OP,"__esModule",{value:!0});OP.MementoKeyValueStorage=void 0;var mO=class{constructor(e){this.mementoGlobalStorage=e}async getValue(e,t){return await this.mementoGlobalStorage.get(e)||t}setValue(e,t){this.mementoGlobalStorage.update(e,t)}};OP.MementoKeyValueStorage=mO});var N6=N(hO=>{"use strict";Object.defineProperty(hO,"__esModule",{value:!0});var fO=class{constructor(){this.initializePromise=Promise.resolve(),this.initialFetch=Promise.resolve()}isFlightEnabled(e){return!1}isCachedFlightEnabled(e){return Promise.resolve(!1)}isFlightEnabledAsync(e){return Promise.resolve(!1)}getTreatmentVariable(e,t){}getTreatmentVariableAsync(e,t){return Promise.resolve(void 0)}};hO.default=fO});var O6=N(Jg=>{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.getExperimentationServiceAsync=Jg.getExperimentationService=void 0;var $pe=pM(),Hpe=R6(),gO=require("vscode"),Gpe=A6(),zpe=N6(),Qpe="https://default.exp-tas.com/vscode/ab",Ype="query-expfeature",Xpe="abexp.assignmentcontext",Zpe="VSCode.ABExp.FeatureData",ede=1e3*60*30;function M6(r,e,t,n,i,...o){if(!i)throw new Error("Memento storage was not provided.");let s=gO.workspace.getConfiguration("telemetry");if(!(gO.env.isTelemetryEnabled===void 0?s.get("enableTelemetry",!0):gO.env.isTelemetryEnabled))return new zpe.default;let c=[new $pe.VSCodeFilterProvider(r,e,t),...o],u=new Gpe.MementoKeyValueStorage(i);return new Hpe.ExperimentationService({filterProviders:c,telemetry:n,storageKey:Zpe,keyValueStorage:u,featuresTelemetryPropertyName:"",assignmentContextTelemetryPropertyName:Xpe,telemetryEventName:Ype,endpoint:Qpe,refetchInterval:ede})}Jg.getExperimentationService=M6;async function tde(r,e,t,n,i,...o){let s=M6(r,e,t,n,i,...o);return await s.initializePromise,s}Jg.getExperimentationServiceAsync=tde});var F6=N(Op=>{"use strict";Object.defineProperty(Op,"__esModule",{value:!0});Op.TargetPopulation=Op.getExperimentationServiceAsync=Op.getExperimentationService=void 0;var K6=O6();Object.defineProperty(Op,"getExperimentationService",{enumerable:!0,get:function(){return K6.getExperimentationService}});Object.defineProperty(Op,"getExperimentationServiceAsync",{enumerable:!0,get:function(){return K6.getExperimentationServiceAsync}});var rde=pM();Object.defineProperty(Op,"TargetPopulation",{enumerable:!0,get:function(){return rde.TargetPopulation}})});var H6=N((AAe,$6)=>{"use strict";function ode(){let r=[].slice.call(arguments).filter(t=>t),e=r.shift();return r.forEach(t=>{Object.keys(t).forEach(n=>{e[n]=t[n]})}),e}$6.exports=ode});var wo=N(bO=>{"use strict";bO.fromCallback=function(r){return Object.defineProperty(function(){if(typeof arguments[arguments.length-1]=="function")r.apply(this,arguments);else return new Promise((e,t)=>{arguments[arguments.length]=(n,i)=>{if(n)return t(n);e(i)},arguments.length++,r.apply(this,arguments)})},"name",{value:r.name})};bO.fromPromise=function(r){return Object.defineProperty(function(){let e=arguments[arguments.length-1];if(typeof e!="function")return r.apply(this,arguments);r.apply(this,arguments).then(t=>e(null,t),e)},"name",{value:r.name})}});var z6=N((MAe,G6)=>{var Up=require("constants"),sde=process.cwd,VP=null,ade=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return VP||(VP=sde.call(process)),VP};try{process.cwd()}catch{}typeof process.chdir=="function"&&(IO=process.chdir,process.chdir=function(r){VP=null,IO.call(process,r)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,IO));var IO;G6.exports=lde;function lde(r){Up.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(r),r.lutimes||t(r),r.chown=o(r.chown),r.fchown=o(r.fchown),r.lchown=o(r.lchown),r.chmod=n(r.chmod),r.fchmod=n(r.fchmod),r.lchmod=n(r.lchmod),r.chownSync=s(r.chownSync),r.fchownSync=s(r.fchownSync),r.lchownSync=s(r.lchownSync),r.chmodSync=i(r.chmodSync),r.fchmodSync=i(r.fchmodSync),r.lchmodSync=i(r.lchmodSync),r.stat=a(r.stat),r.fstat=a(r.fstat),r.lstat=a(r.lstat),r.statSync=l(r.statSync),r.fstatSync=l(r.fstatSync),r.lstatSync=l(r.lstatSync),r.chmod&&!r.lchmod&&(r.lchmod=function(u,p,f){f&&process.nextTick(f)},r.lchmodSync=function(){}),r.chown&&!r.lchown&&(r.lchown=function(u,p,f,g){g&&process.nextTick(g)},r.lchownSync=function(){}),ade==="win32"&&(r.rename=typeof r.rename!="function"?r.rename:function(u){function p(f,g,v){var b=Date.now(),C=0;u(f,g,function E(R){if(R&&(R.code==="EACCES"||R.code==="EPERM")&&Date.now()-b<6e4){setTimeout(function(){r.stat(g,function(_,L){_&&_.code==="ENOENT"?u(f,g,E):v(R)})},C),C<100&&(C+=10);return}v&&v(R)})}return Object.setPrototypeOf&&Object.setPrototypeOf(p,u),p}(r.rename)),r.read=typeof r.read!="function"?r.read:function(u){function p(f,g,v,b,C,E){var R;if(E&&typeof E=="function"){var _=0;R=function(L,te,$){if(L&&L.code==="EAGAIN"&&_<10)return _++,u.call(r,f,g,v,b,C,R);E.apply(this,arguments)}}return u.call(r,f,g,v,b,C,R)}return Object.setPrototypeOf&&Object.setPrototypeOf(p,u),p}(r.read),r.readSync=typeof r.readSync!="function"?r.readSync:function(u){return function(p,f,g,v,b){for(var C=0;;)try{return u.call(r,p,f,g,v,b)}catch(E){if(E.code==="EAGAIN"&&C<10){C++;continue}throw E}}}(r.readSync);function e(u){u.lchmod=function(p,f,g){u.open(p,Up.O_WRONLY|Up.O_SYMLINK,f,function(v,b){if(v){g&&g(v);return}u.fchmod(b,f,function(C){u.close(b,function(E){g&&g(C||E)})})})},u.lchmodSync=function(p,f){var g=u.openSync(p,Up.O_WRONLY|Up.O_SYMLINK,f),v=!0,b;try{b=u.fchmodSync(g,f),v=!1}finally{if(v)try{u.closeSync(g)}catch{}else u.closeSync(g)}return b}}function t(u){Up.hasOwnProperty("O_SYMLINK")&&u.futimes?(u.lutimes=function(p,f,g,v){u.open(p,Up.O_SYMLINK,function(b,C){if(b){v&&v(b);return}u.futimes(C,f,g,function(E){u.close(C,function(R){v&&v(E||R)})})})},u.lutimesSync=function(p,f,g){var v=u.openSync(p,Up.O_SYMLINK),b,C=!0;try{b=u.futimesSync(v,f,g),C=!1}finally{if(C)try{u.closeSync(v)}catch{}else u.closeSync(v)}return b}):u.futimes&&(u.lutimes=function(p,f,g,v){v&&process.nextTick(v)},u.lutimesSync=function(){})}function n(u){return u&&function(p,f,g){return u.call(r,p,f,function(v){c(v)&&(v=null),g&&g.apply(this,arguments)})}}function i(u){return u&&function(p,f){try{return u.call(r,p,f)}catch(g){if(!c(g))throw g}}}function o(u){return u&&function(p,f,g,v){return u.call(r,p,f,g,function(b){c(b)&&(b=null),v&&v.apply(this,arguments)})}}function s(u){return u&&function(p,f,g){try{return u.call(r,p,f,g)}catch(v){if(!c(v))throw v}}}function a(u){return u&&function(p,f,g){typeof f=="function"&&(g=f,f=null);function v(b,C){C&&(C.uid<0&&(C.uid+=4294967296),C.gid<0&&(C.gid+=4294967296)),g&&g.apply(this,arguments)}return f?u.call(r,p,f,v):u.call(r,p,v)}}function l(u){return u&&function(p,f){var g=f?u.call(r,p,f):u.call(r,p);return g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),g}}function c(u){if(!u||u.code==="ENOSYS")return!0;var p=!process.getuid||process.getuid()!==0;return!!(p&&(u.code==="EINVAL"||u.code==="EPERM"))}}});var X6=N((OAe,Y6)=>{var Q6=require("stream").Stream;Y6.exports=cde;function cde(r){return{ReadStream:e,WriteStream:t};function e(n,i){if(!(this instanceof e))return new e(n,i);Q6.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,l=s.length;a<l;a++){var c=s[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}r.open(this.path,this.flags,this.mode,function(u,p){if(u){o.emit("error",u),o.readable=!1;return}o.fd=p,o.emit("open",p),o._read()})}function t(n,i){if(!(this instanceof t))return new t(n,i);Q6.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var l=o[s];this[l]=i[l]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=r.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var eq=N((KAe,Z6)=>{"use strict";Z6.exports=pde;var ude=Object.getPrototypeOf||function(r){return r.__proto__};function pde(r){if(r===null||typeof r!="object")return r;if(r instanceof Object)var e={__proto__:ude(r)};else var e=Object.create(null);return Object.getOwnPropertyNames(r).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}});var Fn=N((FAe,CO)=>{var dn=require("fs"),dde=z6(),mde=X6(),fde=eq(),BP=require("util"),pi,JP;typeof Symbol=="function"&&typeof Symbol.for=="function"?(pi=Symbol.for("graceful-fs.queue"),JP=Symbol.for("graceful-fs.previous")):(pi="___graceful-fs.queue",JP="___graceful-fs.previous");function hde(){}function nq(r,e){Object.defineProperty(r,pi,{get:function(){return e}})}var Nm=hde;BP.debuglog?Nm=BP.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Nm=function(){var r=BP.format.apply(BP,arguments);r="GFS4: "+r.split(/\n/).join(`
|
||
GFS4: `),console.error(r)});dn[pi]||(tq=global[pi]||[],nq(dn,tq),dn.close=function(r){function e(t,n){return r.call(dn,t,function(i){i||rq(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,JP,{value:r}),e}(dn.close),dn.closeSync=function(r){function e(t){r.apply(dn,arguments),rq()}return Object.defineProperty(e,JP,{value:r}),e}(dn.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Nm(dn[pi]),require("assert").equal(dn[pi].length,0)}));var tq;global[pi]||nq(global,dn[pi]);CO.exports=SO(fde(dn));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!dn.__patched&&(CO.exports=SO(dn),dn.__patched=!0);function SO(r){dde(r),r.gracefulify=SO,r.createReadStream=te,r.createWriteStream=$;var e=r.readFile;r.readFile=t;function t(X,be,Me){return typeof be=="function"&&(Me=be,be=null),it(X,be,Me);function it(ut,Xe,ne,Ce){return e(ut,Xe,function(Q){Q&&(Q.code==="EMFILE"||Q.code==="ENFILE")?Zg([it,[ut,Xe,ne],Q,Ce||Date.now(),Date.now()]):typeof ne=="function"&&ne.apply(this,arguments)})}}var n=r.writeFile;r.writeFile=i;function i(X,be,Me,it){return typeof Me=="function"&&(it=Me,Me=null),ut(X,be,Me,it);function ut(Xe,ne,Ce,Q,fe){return n(Xe,ne,Ce,function(Le){Le&&(Le.code==="EMFILE"||Le.code==="ENFILE")?Zg([ut,[Xe,ne,Ce,Q],Le,fe||Date.now(),Date.now()]):typeof Q=="function"&&Q.apply(this,arguments)})}}var o=r.appendFile;o&&(r.appendFile=s);function s(X,be,Me,it){return typeof Me=="function"&&(it=Me,Me=null),ut(X,be,Me,it);function ut(Xe,ne,Ce,Q,fe){return o(Xe,ne,Ce,function(Le){Le&&(Le.code==="EMFILE"||Le.code==="ENFILE")?Zg([ut,[Xe,ne,Ce,Q],Le,fe||Date.now(),Date.now()]):typeof Q=="function"&&Q.apply(this,arguments)})}}var a=r.copyFile;a&&(r.copyFile=l);function l(X,be,Me,it){return typeof Me=="function"&&(it=Me,Me=0),ut(X,be,Me,it);function ut(Xe,ne,Ce,Q,fe){return a(Xe,ne,Ce,function(Le){Le&&(Le.code==="EMFILE"||Le.code==="ENFILE")?Zg([ut,[Xe,ne,Ce,Q],Le,fe||Date.now(),Date.now()]):typeof Q=="function"&&Q.apply(this,arguments)})}}var c=r.readdir;r.readdir=p;var u=/^v[0-5]\./;function p(X,be,Me){typeof be=="function"&&(Me=be,be=null);var it=u.test(process.version)?function(ne,Ce,Q,fe){return c(ne,ut(ne,Ce,Q,fe))}:function(ne,Ce,Q,fe){return c(ne,Ce,ut(ne,Ce,Q,fe))};return it(X,be,Me);function ut(Xe,ne,Ce,Q){return function(fe,Le){fe&&(fe.code==="EMFILE"||fe.code==="ENFILE")?Zg([it,[Xe,ne,Ce],fe,Q||Date.now(),Date.now()]):(Le&&Le.sort&&Le.sort(),typeof Ce=="function"&&Ce.call(this,fe,Le))}}}if(process.version.substr(0,4)==="v0.8"){var f=mde(r);E=f.ReadStream,_=f.WriteStream}var g=r.ReadStream;g&&(E.prototype=Object.create(g.prototype),E.prototype.open=R);var v=r.WriteStream;v&&(_.prototype=Object.create(v.prototype),_.prototype.open=L),Object.defineProperty(r,"ReadStream",{get:function(){return E},set:function(X){E=X},enumerable:!0,configurable:!0}),Object.defineProperty(r,"WriteStream",{get:function(){return _},set:function(X){_=X},enumerable:!0,configurable:!0});var b=E;Object.defineProperty(r,"FileReadStream",{get:function(){return b},set:function(X){b=X},enumerable:!0,configurable:!0});var C=_;Object.defineProperty(r,"FileWriteStream",{get:function(){return C},set:function(X){C=X},enumerable:!0,configurable:!0});function E(X,be){return this instanceof E?(g.apply(this,arguments),this):E.apply(Object.create(E.prototype),arguments)}function R(){var X=this;ae(X.path,X.flags,X.mode,function(be,Me){be?(X.autoClose&&X.destroy(),X.emit("error",be)):(X.fd=Me,X.emit("open",Me),X.read())})}function _(X,be){return this instanceof _?(v.apply(this,arguments),this):_.apply(Object.create(_.prototype),arguments)}function L(){var X=this;ae(X.path,X.flags,X.mode,function(be,Me){be?(X.destroy(),X.emit("error",be)):(X.fd=Me,X.emit("open",Me))})}function te(X,be){return new r.ReadStream(X,be)}function $(X,be){return new r.WriteStream(X,be)}var se=r.open;r.open=ae;function ae(X,be,Me,it){return typeof Me=="function"&&(it=Me,Me=null),ut(X,be,Me,it);function ut(Xe,ne,Ce,Q,fe){return se(Xe,ne,Ce,function(Le,fn){Le&&(Le.code==="EMFILE"||Le.code==="ENFILE")?Zg([ut,[Xe,ne,Ce,Q],Le,fe||Date.now(),Date.now()]):typeof Q=="function"&&Q.apply(this,arguments)})}}return r}function Zg(r){Nm("ENQUEUE",r[0].name,r[1]),dn[pi].push(r),xO()}var qP;function rq(){for(var r=Date.now(),e=0;e<dn[pi].length;++e)dn[pi][e].length>2&&(dn[pi][e][3]=r,dn[pi][e][4]=r);xO()}function xO(){if(clearTimeout(qP),qP=void 0,dn[pi].length!==0){var r=dn[pi].shift(),e=r[0],t=r[1],n=r[2],i=r[3],o=r[4];if(i===void 0)Nm("RETRY",e.name,t),e.apply(null,t);else if(Date.now()-i>=6e4){Nm("TIMEOUT",e.name,t);var s=t.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,l=Math.max(o-i,1),c=Math.min(l*1.2,100);a>=c?(Nm("RETRY",e.name,t),e.apply(null,t.concat([i]))):dn[pi].push(r)}qP===void 0&&(qP=setTimeout(xO,0))}}});var wO=N(ev=>{var gde=wo().fromCallback,wa=Fn(),vde=["access","appendFile","chmod","chown","close","copyFile","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","lchown","link","lstat","mkdir","mkdtemp","open","readFile","readdir","readlink","realpath","rename","rmdir","stat","symlink","truncate","unlink","utimes","writeFile"].filter(r=>typeof wa[r]=="function");Object.keys(wa).forEach(r=>{ev[r]=wa[r]});vde.forEach(r=>{ev[r]=gde(wa[r])});ev.exists=function(r,e){return typeof e=="function"?wa.exists(r,e):new Promise(t=>wa.exists(r,t))};ev.read=function(r,e,t,n,i,o){return typeof o=="function"?wa.read(r,e,t,n,i,o):new Promise((s,a)=>{wa.read(r,e,t,n,i,(l,c,u)=>{if(l)return a(l);s({bytesRead:c,buffer:u})})})};ev.write=function(r,e,t,n,i,o){return typeof arguments[arguments.length-1]=="function"?wa.write(r,e,t,n,i,o):typeof e=="string"?new Promise((s,a)=>{wa.write(r,e,t,n,(l,c,u)=>{if(l)return a(l);s({bytesWritten:c,buffer:u})})}):new Promise((s,a)=>{wa.write(r,e,t,n,i,(l,c,u)=>{if(l)return a(l);s({bytesWritten:c,buffer:u})})})}});var sq=N((UAe,oq)=>{"use strict";var Go=Fn(),iq=require("os"),$P=require("path");function yde(){let r=$P.join("millis-test-sync"+Date.now().toString()+Math.random().toString().slice(2));r=$P.join(iq.tmpdir(),r);let e=new Date(1435410243862);Go.writeFileSync(r,"https://github.com/jprichardson/node-fs-extra/pull/141");let t=Go.openSync(r,"r+");return Go.futimesSync(t,e,e),Go.closeSync(t),Go.statSync(r).mtime>1435410243e3}function bde(r){let e=$P.join("millis-test"+Date.now().toString()+Math.random().toString().slice(2));e=$P.join(iq.tmpdir(),e);let t=new Date(1435410243862);Go.writeFile(e,"https://github.com/jprichardson/node-fs-extra/pull/141",n=>{if(n)return r(n);Go.open(e,"r+",(i,o)=>{if(i)return r(i);Go.futimes(o,t,t,s=>{if(s)return r(s);Go.close(o,a=>{if(a)return r(a);Go.stat(e,(l,c)=>{if(l)return r(l);r(null,c.mtime>1435410243e3)})})})})})}function Ide(r){if(typeof r=="number")return Math.floor(r/1e3)*1e3;if(r instanceof Date)return new Date(Math.floor(r.getTime()/1e3)*1e3);throw new Error("fs-extra: timeRemoveMillis() unknown parameter type")}function Sde(r,e,t,n){Go.open(r,"r+",(i,o)=>{if(i)return n(i);Go.futimes(o,e,t,s=>{Go.close(o,a=>{n&&n(s||a)})})})}oq.exports={hasMillisRes:bde,hasMillisResSync:yde,timeRemoveMillis:Ide,utimesMillis:Sde}});var EO=N((jAe,aq)=>{var zo=Fn(),Vx=require("path"),xde=sq();function Cde(r,e,t,n){n||(n=t,t={});var i=process.cwd(),o=Vx.resolve(i,r),s=Vx.resolve(i,e),a=t.filter,l=t.transform,c=t.overwrite;c===void 0&&(c=t.clobber),c===void 0&&(c=!0);var u=t.errorOnExist,p=t.dereference,f=t.preserveTimestamps===!0,g=0,v=0,b=0,C=!1;E(o);function E(ne){if(g++,a){if(a instanceof RegExp){if(console.warn("Warning: fs-extra: Passing a RegExp filter is deprecated, use a function"),!a.test(ne))return Xe(!0)}else if(typeof a=="function"&&!a(ne,e))return Xe(!0)}return R(ne)}function R(ne){var Ce=p?zo.stat:zo.lstat;b++,Ce(ne,function(Q,fe){if(Q)return ut(Q);var Le={name:ne,mode:fe.mode,mtime:fe.mtime,atime:fe.atime,stats:fe};if(fe.isDirectory())return $(Le);if(fe.isFile()||fe.isCharacterDevice()||fe.isBlockDevice())return _(Le);if(fe.isSymbolicLink())return X(ne)})}function _(ne){var Ce=ne.name.replace(o,s.replace("$","$$$$"));it(Ce,function(Q){Q?L(ne,Ce):c?te(Ce,function(){L(ne,Ce)}):u?ut(new Error(Ce+" already exists")):Xe()})}function L(ne,Ce){var Q=zo.createReadStream(ne.name),fe=zo.createWriteStream(Ce,{mode:ne.mode});Q.on("error",ut),fe.on("error",ut),l?l(Q,fe,ne):fe.on("open",function(){Q.pipe(fe)}),fe.once("close",function(){zo.chmod(Ce,ne.mode,function(Le){if(Le)return ut(Le);f?xde.utimesMillis(Ce,ne.atime,ne.mtime,function(fn){return fn?ut(fn):Xe()}):Xe()})})}function te(ne,Ce){zo.unlink(ne,function(Q){return Q?ut(Q):Ce()})}function $(ne){var Ce=ne.name.replace(o,s.replace("$","$$$$"));it(Ce,function(Q){if(Q)return se(ne,Ce);ae(ne.name)})}function se(ne,Ce){zo.mkdir(Ce,ne.mode,function(Q){if(Q)return ut(Q);zo.chmod(Ce,ne.mode,function(fe){if(fe)return ut(fe);ae(ne.name)})})}function ae(ne){zo.readdir(ne,function(Ce,Q){return Ce?ut(Ce):(Q.forEach(function(fe){E(Vx.join(ne,fe))}),Xe())})}function X(ne){var Ce=ne.replace(o,s);zo.readlink(ne,function(Q,fe){if(Q)return ut(Q);be(fe,Ce)})}function be(ne,Ce){p&&(ne=Vx.resolve(i,ne)),it(Ce,function(Q){if(Q)return Me(ne,Ce);zo.readlink(Ce,function(fe,Le){return fe?ut(fe):(p&&(Le=Vx.resolve(i,Le)),Le===ne?Xe():te(Ce,function(){Me(ne,Ce)}))})})}function Me(ne,Ce){zo.symlink(ne,Ce,function(Q){return Q?ut(Q):Xe()})}function it(ne,Ce){zo.lstat(ne,function(Q){return Q&&Q.code==="ENOENT"?Ce(!0):Ce(!1)})}function ut(ne){if(!C&&n!==void 0)return C=!0,n(ne)}function Xe(ne){if(ne||b--,v++,g===v&&b===0&&n!==void 0)return n(null)}}aq.exports=Cde});var PO=N((WAe,cq)=>{"use strict";var kO=require("path");function lq(r){return r=kO.normalize(kO.resolve(r)).split(kO.sep),r.length>0?r[0]:null}var wde=/[<>:"|?*]/;function Ede(r){let e=lq(r);return r=r.replace(e,""),wde.test(r)}cq.exports={getRootPath:lq,invalidWin32Path:Ede}});var pq=N((VAe,uq)=>{"use strict";var kde=Fn(),DO=require("path"),Pde=PO().invalidWin32Path,Dde=parseInt("0777",8);function _O(r,e,t,n){if(typeof e=="function"?(t=e,e={}):(!e||typeof e!="object")&&(e={mode:e}),process.platform==="win32"&&Pde(r)){let s=new Error(r+" contains invalid WIN32 path characters.");return s.code="EINVAL",t(s)}let i=e.mode,o=e.fs||kde;i===void 0&&(i=Dde&~process.umask()),n||(n=null),t=t||function(){},r=DO.resolve(r),o.mkdir(r,i,s=>{if(!s)return n=n||r,t(null,n);switch(s.code){case"ENOENT":if(DO.dirname(r)===r)return t(s);_O(DO.dirname(r),e,(a,l)=>{a?t(a,l):_O(r,e,t,l)});break;default:o.stat(r,(a,l)=>{a||!l.isDirectory()?t(s,n):t(null,n)});break}})}uq.exports=_O});var mq=N((BAe,dq)=>{"use strict";var _de=Fn(),TO=require("path"),Tde=PO().invalidWin32Path,Rde=parseInt("0777",8);function RO(r,e,t){(!e||typeof e!="object")&&(e={mode:e});let n=e.mode,i=e.fs||_de;if(process.platform==="win32"&&Tde(r)){let o=new Error(r+" contains invalid WIN32 path characters.");throw o.code="EINVAL",o}n===void 0&&(n=Rde&~process.umask()),t||(t=null),r=TO.resolve(r);try{i.mkdirSync(r,n),t=t||r}catch(o){switch(o.code){case"ENOENT":if(TO.dirname(r)===r)throw o;t=RO(TO.dirname(r),e,t),RO(r,e,t);break;default:let s;try{s=i.statSync(r)}catch{throw o}if(!s.isDirectory())throw o;break}}return t}dq.exports=RO});var Qo=N((qAe,fq)=>{"use strict";var Ade=wo().fromCallback,AO=Ade(pq()),NO=mq();fq.exports={mkdirs:AO,mkdirsSync:NO,mkdirp:AO,mkdirpSync:NO,ensureDir:AO,ensureDirSync:NO}});var Hc=N((JAe,gq)=>{"use strict";var Nde=wo().fromPromise,hq=wO();function Mde(r){return hq.access(r).then(()=>!0).catch(()=>!1)}gq.exports={pathExists:Nde(Mde),pathExistsSync:hq.existsSync}});var bq=N(($Ae,yq)=>{"use strict";var Ode=Fn(),Bx=require("path"),vq=EO(),Kde=Qo(),Fde=Hc().pathExists;function Lde(r,e,t,n){typeof t=="function"&&!n?(n=t,t={}):(typeof t=="function"||t instanceof RegExp)&&(t={filter:t}),n=n||function(){},t=t||{},t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
||
|
||
see https://github.com/jprichardson/node-fs-extra/issues/269`);let i=process.cwd(),o=Bx.resolve(i,r),s=Bx.resolve(i,e);if(o===s)return n(new Error("Source and destination must not be the same."));Ode.lstat(r,(a,l)=>{if(a)return n(a);let c=null;if(l.isDirectory()){let u=e.split(Bx.sep);u.pop(),c=u.join(Bx.sep)}else c=Bx.dirname(e);Fde(c,(u,p)=>{if(u)return n(u);if(p)return vq(r,e,t,n);Kde.mkdirs(c,f=>{if(f)return n(f);vq(r,e,t,n)})})})}yq.exports=Lde});var Sq=N((HAe,Iq)=>{var Ude=wo().fromCallback;Iq.exports={copy:Ude(bq())}});var MO=N((GAe,xq)=>{xq.exports=function(r){if(typeof Buffer.allocUnsafe=="function")try{return Buffer.allocUnsafe(r)}catch{return new Buffer(r)}return new Buffer(r)}});var kq=N((zAe,Eq)=>{"use strict";var Ul=Fn(),wq=64*1024,Cq=MO()(wq);function jde(r,e,t){let n=t.overwrite,i=t.errorOnExist,o=t.preserveTimestamps;if(Ul.existsSync(e))if(n)Ul.unlinkSync(e);else{if(i)throw new Error(`${e} already exists`);return}let s=Ul.openSync(r,"r"),a=Ul.fstatSync(s),l=Ul.openSync(e,"w",a.mode),c=1,u=0;for(;c>0;)c=Ul.readSync(s,Cq,0,wq,u),Ul.writeSync(l,Cq,0,c),u+=c;o&&Ul.futimesSync(l,a.atime,a.mtime),Ul.closeSync(s),Ul.closeSync(l)}Eq.exports=jde});var Tq=N((QAe,_q)=>{"use strict";var Mm=Fn(),OO=require("path"),Wde=kq(),Pq=Qo();function Dq(r,e,t){(typeof t=="function"||t instanceof RegExp)&&(t={filter:t}),t=t||{},t.recursive=!!t.recursive,t.clobber="clobber"in t?!!t.clobber:!0,t.overwrite="overwrite"in t?!!t.overwrite:t.clobber,t.dereference="dereference"in t?!!t.dereference:!1,t.preserveTimestamps="preserveTimestamps"in t?!!t.preserveTimestamps:!1,t.filter=t.filter||function(){return!0},t.preserveTimestamps&&process.arch==="ia32"&&console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
|
||
|
||
see https://github.com/jprichardson/node-fs-extra/issues/269`);let n=t.recursive&&!t.dereference?Mm.lstatSync(r):Mm.statSync(r),i=OO.dirname(e),o=Mm.existsSync(i),s=!1;if(t.filter instanceof RegExp?(console.warn("Warning: fs-extra: Passing a RegExp filter is deprecated, use a function"),s=t.filter.test(r)):typeof t.filter=="function"&&(s=t.filter(r,e)),n.isFile()&&s)o||Pq.mkdirsSync(i),Wde(r,e,{overwrite:t.overwrite,errorOnExist:t.errorOnExist,preserveTimestamps:t.preserveTimestamps});else if(n.isDirectory()&&s)Mm.existsSync(e)||Pq.mkdirsSync(e),Mm.readdirSync(r).forEach(l=>{let c=t;c.recursive=!0,Dq(OO.join(r,l),OO.join(e,l),c)});else if(t.recursive&&n.isSymbolicLink()&&s){let a=Mm.readlinkSync(r);Mm.symlinkSync(a,e)}}_q.exports=Dq});var KO=N((YAe,Rq)=>{Rq.exports={copySync:Tq()}});var jq=N((XAe,Uq)=>{"use strict";var Aq=Fn(),Kq=require("path"),lr=require("assert"),qx=process.platform==="win32";function Fq(r){["unlink","chmod","stat","lstat","rmdir","readdir"].forEach(t=>{r[t]=r[t]||Aq[t],t=t+"Sync",r[t]=r[t]||Aq[t]}),r.maxBusyTries=r.maxBusyTries||3}function FO(r,e,t){let n=0;typeof e=="function"&&(t=e,e={}),lr(r,"rimraf: missing path"),lr.equal(typeof r,"string","rimraf: path should be a string"),lr.equal(typeof t,"function","rimraf: callback function required"),lr(e,"rimraf: invalid options argument provided"),lr.equal(typeof e,"object","rimraf: options should be object"),Fq(e),Nq(r,e,function i(o){if(o){if((o.code==="EBUSY"||o.code==="ENOTEMPTY"||o.code==="EPERM")&&n<e.maxBusyTries){n++;let s=n*100;return setTimeout(()=>Nq(r,e,i),s)}o.code==="ENOENT"&&(o=null)}t(o)})}function Nq(r,e,t){lr(r),lr(e),lr(typeof t=="function"),e.lstat(r,(n,i)=>{if(n&&n.code==="ENOENT")return t(null);if(n&&n.code==="EPERM"&&qx)return Mq(r,e,n,t);if(i&&i.isDirectory())return HP(r,e,n,t);e.unlink(r,o=>{if(o){if(o.code==="ENOENT")return t(null);if(o.code==="EPERM")return qx?Mq(r,e,o,t):HP(r,e,o,t);if(o.code==="EISDIR")return HP(r,e,o,t)}return t(o)})})}function Mq(r,e,t,n){lr(r),lr(e),lr(typeof n=="function"),t&&lr(t instanceof Error),e.chmod(r,438,i=>{i?n(i.code==="ENOENT"?null:t):e.stat(r,(o,s)=>{o?n(o.code==="ENOENT"?null:t):s.isDirectory()?HP(r,e,t,n):e.unlink(r,n)})})}function Oq(r,e,t){let n;lr(r),lr(e),t&&lr(t instanceof Error);try{e.chmodSync(r,438)}catch(i){if(i.code==="ENOENT")return;throw t}try{n=e.statSync(r)}catch(i){if(i.code==="ENOENT")return;throw t}n.isDirectory()?GP(r,e,t):e.unlinkSync(r)}function HP(r,e,t,n){lr(r),lr(e),t&&lr(t instanceof Error),lr(typeof n=="function"),e.rmdir(r,i=>{i&&(i.code==="ENOTEMPTY"||i.code==="EEXIST"||i.code==="EPERM")?Vde(r,e,n):i&&i.code==="ENOTDIR"?n(t):n(i)})}function Vde(r,e,t){lr(r),lr(e),lr(typeof t=="function"),e.readdir(r,(n,i)=>{if(n)return t(n);let o=i.length,s;if(o===0)return e.rmdir(r,t);i.forEach(a=>{FO(Kq.join(r,a),e,l=>{if(!s){if(l)return t(s=l);--o===0&&e.rmdir(r,t)}})})})}function Lq(r,e){let t;e=e||{},Fq(e),lr(r,"rimraf: missing path"),lr.equal(typeof r,"string","rimraf: path should be a string"),lr(e,"rimraf: missing options"),lr.equal(typeof e,"object","rimraf: options should be object");try{t=e.lstatSync(r)}catch(n){if(n.code==="ENOENT")return;n.code==="EPERM"&&qx&&Oq(r,e,n)}try{t&&t.isDirectory()?GP(r,e,null):e.unlinkSync(r)}catch(n){if(n.code==="ENOENT")return;if(n.code==="EPERM")return qx?Oq(r,e,n):GP(r,e,n);if(n.code!=="EISDIR")throw n;GP(r,e,n)}}function GP(r,e,t){lr(r),lr(e),t&&lr(t instanceof Error);try{e.rmdirSync(r)}catch(n){if(n.code==="ENOTDIR")throw t;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Bde(r,e);else if(n.code!=="ENOENT")throw n}}function Bde(r,e){lr(r),lr(e),e.readdirSync(r).forEach(i=>Lq(Kq.join(r,i),e));let t=qx?100:1,n=0;do{let i=!0;try{let o=e.rmdirSync(r,e);return i=!1,o}finally{if(++n<t&&i)continue}}while(!0)}Uq.exports=FO;FO.sync=Lq});var Jx=N((ZAe,Vq)=>{"use strict";var qde=wo().fromCallback,Wq=jq();Vq.exports={remove:qde(Wq),removeSync:Wq.sync}});var $q=N((eNe,Jq)=>{var tv;try{tv=Fn()}catch{tv=require("fs")}function Jde(r,e,t){t==null&&(t=e,e={}),typeof e=="string"&&(e={encoding:e}),e=e||{};var n=e.fs||tv,i=!0;"throws"in e&&(i=e.throws),n.readFile(r,e,function(o,s){if(o)return t(o);s=qq(s);var a;try{a=JSON.parse(s,e?e.reviver:null)}catch(l){return i?(l.message=r+": "+l.message,t(l)):t(null,null)}t(null,a)})}function $de(r,e){e=e||{},typeof e=="string"&&(e={encoding:e});var t=e.fs||tv,n=!0;"throws"in e&&(n=e.throws);try{var i=t.readFileSync(r,e);return i=qq(i),JSON.parse(i,e.reviver)}catch(o){if(n)throw o.message=r+": "+o.message,o;return null}}function Bq(r,e){var t,n=`
|
||
`;typeof e=="object"&&e!==null&&(e.spaces&&(t=e.spaces),e.EOL&&(n=e.EOL));var i=JSON.stringify(r,e?e.replacer:null,t);return i.replace(/\n/g,n)+n}function Hde(r,e,t,n){n==null&&(n=t,t={}),t=t||{};var i=t.fs||tv,o="";try{o=Bq(e,t)}catch(s){n&&n(s,null);return}i.writeFile(r,o,t,n)}function Gde(r,e,t){t=t||{};var n=t.fs||tv,i=Bq(e,t);return n.writeFileSync(r,i,t)}function qq(r){return Buffer.isBuffer(r)&&(r=r.toString("utf8")),r=r.replace(/^\uFEFF/,""),r}var zde={readFile:Jde,readFileSync:$de,writeFile:Hde,writeFileSync:Gde};Jq.exports=zde});var QP=N((tNe,Gq)=>{"use strict";var Hq=wo().fromCallback,zP=$q();Gq.exports={readJson:Hq(zP.readFile),readJsonSync:zP.readFileSync,writeJson:Hq(zP.writeFile),writeJsonSync:zP.writeFileSync}});var Yq=N((rNe,Qq)=>{"use strict";var Qde=require("path"),Yde=Qo(),Xde=Hc().pathExists,zq=QP();function Zde(r,e,t,n){typeof t=="function"&&(n=t,t={});let i=Qde.dirname(r);Xde(i,(o,s)=>{if(o)return n(o);if(s)return zq.writeJson(r,e,t,n);Yde.mkdirs(i,a=>{if(a)return n(a);zq.writeJson(r,e,t,n)})})}Qq.exports=Zde});var Zq=N((nNe,Xq)=>{"use strict";var eme=Fn(),tme=require("path"),rme=Qo(),nme=QP();function ime(r,e,t){let n=tme.dirname(r);eme.existsSync(n)||rme.mkdirsSync(n),nme.writeJsonSync(r,e,t)}Xq.exports=ime});var tJ=N((iNe,eJ)=>{"use strict";var ome=wo().fromCallback,to=QP();to.outputJson=ome(Yq());to.outputJsonSync=Zq();to.outputJSON=to.outputJson;to.outputJSONSync=to.outputJsonSync;to.writeJSON=to.writeJson;to.writeJSONSync=to.writeJsonSync;to.readJSON=to.readJson;to.readJSONSync=to.readJsonSync;eJ.exports=to});var oJ=N((oNe,iJ)=>{"use strict";var sme=wo().fromCallback,jl=Fn(),ame=EO(),Om=require("path"),YP=Jx().remove,lme=Qo().mkdirs;function LO(r,e,t,n){typeof t=="function"&&(n=t,t={});let i=t.overwrite||t.clobber||!1;ume(r,e,(s,a)=>{if(s)return n(s);if(a)return n(new Error(`Cannot move '${r}' to a subdirectory of itself, '${e}'.`));lme(Om.dirname(e),l=>{if(l)return n(l);o()})});function o(){Om.resolve(r)===Om.resolve(e)?jl.access(r,n):i?jl.rename(r,e,s=>{if(!s)return n();if(s.code==="ENOTEMPTY"||s.code==="EEXIST"){YP(e,a=>{if(a)return n(a);t.overwrite=!1,LO(r,e,t,n)});return}if(s.code==="EPERM"){setTimeout(()=>{YP(e,a=>{if(a)return n(a);t.overwrite=!1,LO(r,e,t,n)})},200);return}if(s.code!=="EXDEV")return n(s);rJ(r,e,i,n)}):jl.link(r,e,s=>s?s.code==="EXDEV"||s.code==="EISDIR"||s.code==="EPERM"||s.code==="ENOTSUP"?rJ(r,e,i,n):n(s):jl.unlink(r,n))}}function rJ(r,e,t,n){jl.stat(r,(i,o)=>{if(i)return n(i);o.isDirectory()?nJ(r,e,t,n):cme(r,e,t,n)})}function cme(r,e,t,n){let i=t?"w":"wx",o=jl.createReadStream(r),s=jl.createWriteStream(e,{flags:i});o.on("error",l=>{o.destroy(),s.destroy(),s.removeListener("close",a),jl.unlink(e,()=>{l.code==="EISDIR"||l.code==="EPERM"?nJ(r,e,t,n):n(l)})}),s.on("error",l=>{o.destroy(),s.destroy(),s.removeListener("close",a),n(l)}),s.once("close",a),o.pipe(s);function a(){jl.unlink(r,n)}}function nJ(r,e,t,n){let i={overwrite:!1};t?YP(e,s=>{if(s)return n(s);o()}):o();function o(){ame(r,e,i,s=>{if(s)return n(s);YP(r,n)})}}function ume(r,e,t){jl.stat(r,(n,i)=>{if(n)return t(n);if(i.isDirectory()){let o=e.split(Om.dirname(r)+Om.sep)[1];if(o){let s=o.split(Om.sep)[0];return s?t(null,r!==e&&e.indexOf(r)>-1&&s===Om.basename(r)):t(null,!1)}return t(null,!1)}return t(null,!1)})}iJ.exports={move:sme(LO)}});var cJ=N((sNe,lJ)=>{"use strict";var Eo=Fn(),Km=require("path"),pme=KO().copySync,UO=Jx().removeSync,dme=Qo().mkdirsSync,mme=MO();function aJ(r,e,t){t=t||{};let n=t.overwrite||t.clobber||!1;if(r=Km.resolve(r),e=Km.resolve(e),r===e)return Eo.accessSync(r);if(gme(r,e))throw new Error(`Cannot move '${r}' into itself '${e}'.`);dme(Km.dirname(e)),i();function i(){if(n)try{return Eo.renameSync(r,e)}catch(o){if(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM")return UO(e),t.overwrite=!1,aJ(r,e,t);if(o.code!=="EXDEV")throw o;return sJ(r,e,n)}else try{return Eo.linkSync(r,e),Eo.unlinkSync(r)}catch(o){if(o.code==="EXDEV"||o.code==="EISDIR"||o.code==="EPERM"||o.code==="ENOTSUP")return sJ(r,e,n);throw o}}}function sJ(r,e,t){return Eo.statSync(r).isDirectory()?hme(r,e,t):fme(r,e,t)}function fme(r,e,t){let i=mme(65536),o=t?"w":"wx",s=Eo.openSync(r,"r"),a=Eo.fstatSync(s),l=Eo.openSync(e,o,a.mode),c=1,u=0;for(;c>0;)c=Eo.readSync(s,i,0,65536,u),Eo.writeSync(l,i,0,c),u+=c;return Eo.closeSync(s),Eo.closeSync(l),Eo.unlinkSync(r)}function hme(r,e,t){let n={overwrite:!1};t&&UO(e),i();function i(){return pme(r,e,n),UO(r)}}function gme(r,e){try{return Eo.statSync(r).isDirectory()&&r!==e&&e.indexOf(r)>-1&&e.split(Km.dirname(r)+Km.sep)[1].split(Km.sep)[0]===Km.basename(r)}catch{return!1}}lJ.exports={moveSync:aJ}});var vJ=N((aNe,gJ)=>{"use strict";var vme=wo().fromCallback,dJ=require("fs"),mJ=require("path"),fJ=Qo(),hJ=Jx(),uJ=vme(function(e,t){t=t||function(){},dJ.readdir(e,(n,i)=>{if(n)return fJ.mkdirs(e,t);i=i.map(s=>mJ.join(e,s)),o();function o(){let s=i.pop();if(!s)return t();hJ.remove(s,a=>{if(a)return t(a);o()})}})});function pJ(r){let e;try{e=dJ.readdirSync(r)}catch{return fJ.mkdirsSync(r)}e.forEach(t=>{t=mJ.join(r,t),hJ.removeSync(t)})}gJ.exports={emptyDirSync:pJ,emptydirSync:pJ,emptyDir:uJ,emptydir:uJ}});var SJ=N((lNe,IJ)=>{"use strict";var yme=wo().fromCallback,yJ=require("path"),$x=Fn(),bJ=Qo(),bme=Hc().pathExists;function Ime(r,e){function t(){$x.writeFile(r,"",n=>{if(n)return e(n);e()})}$x.stat(r,(n,i)=>{if(!n&&i.isFile())return e();let o=yJ.dirname(r);bme(o,(s,a)=>{if(s)return e(s);if(a)return t();bJ.mkdirs(o,l=>{if(l)return e(l);t()})})})}function Sme(r){let e;try{e=$x.statSync(r)}catch{}if(e&&e.isFile())return;let t=yJ.dirname(r);$x.existsSync(t)||bJ.mkdirsSync(t),$x.writeFileSync(r,"")}IJ.exports={createFile:yme(Ime),createFileSync:Sme}});var kJ=N((cNe,EJ)=>{"use strict";var xme=wo().fromCallback,CJ=require("path"),Fm=Fn(),wJ=Qo(),xJ=Hc().pathExists;function Cme(r,e,t){function n(i,o){Fm.link(i,o,s=>{if(s)return t(s);t(null)})}xJ(e,(i,o)=>{if(i)return t(i);if(o)return t(null);Fm.lstat(r,(s,a)=>{if(s)return s.message=s.message.replace("lstat","ensureLink"),t(s);let l=CJ.dirname(e);xJ(l,(c,u)=>{if(c)return t(c);if(u)return n(r,e);wJ.mkdirs(l,p=>{if(p)return t(p);n(r,e)})})})})}function wme(r,e,t){if(Fm.existsSync(e))return;try{Fm.lstatSync(r)}catch(s){throw s.message=s.message.replace("lstat","ensureLink"),s}let i=CJ.dirname(e);return Fm.existsSync(i)||wJ.mkdirsSync(i),Fm.linkSync(r,e)}EJ.exports={createLink:xme(Cme),createLinkSync:wme}});var DJ=N((uNe,PJ)=>{"use strict";var jp=require("path"),Hx=Fn(),Eme=Hc().pathExists;function kme(r,e,t){if(jp.isAbsolute(r))return Hx.lstat(r,(n,i)=>n?(n.message=n.message.replace("lstat","ensureSymlink"),t(n)):t(null,{toCwd:r,toDst:r}));{let n=jp.dirname(e),i=jp.join(n,r);return Eme(i,(o,s)=>o?t(o):s?t(null,{toCwd:i,toDst:r}):Hx.lstat(r,(a,l)=>a?(a.message=a.message.replace("lstat","ensureSymlink"),t(a)):t(null,{toCwd:r,toDst:jp.relative(n,r)})))}}function Pme(r,e){let t;if(jp.isAbsolute(r)){if(t=Hx.existsSync(r),!t)throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}else{let n=jp.dirname(e),i=jp.join(n,r);if(t=Hx.existsSync(i),t)return{toCwd:i,toDst:r};if(t=Hx.existsSync(r),!t)throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:jp.relative(n,r)}}}PJ.exports={symlinkPaths:kme,symlinkPathsSync:Pme}});var RJ=N((pNe,TJ)=>{"use strict";var _J=Fn();function Dme(r,e,t){if(t=typeof e=="function"?e:t,e=typeof e=="function"?!1:e,e)return t(null,e);_J.lstat(r,(n,i)=>{if(n)return t(null,"file");e=i&&i.isDirectory()?"dir":"file",t(null,e)})}function _me(r,e){let t;if(e)return e;try{t=_J.lstatSync(r)}catch{return"file"}return t&&t.isDirectory()?"dir":"file"}TJ.exports={symlinkType:Dme,symlinkTypeSync:_me}});var LJ=N((dNe,FJ)=>{"use strict";var Tme=wo().fromCallback,NJ=require("path"),rv=Fn(),MJ=Qo(),Rme=MJ.mkdirs,Ame=MJ.mkdirsSync,OJ=DJ(),Nme=OJ.symlinkPaths,Mme=OJ.symlinkPathsSync,KJ=RJ(),Ome=KJ.symlinkType,Kme=KJ.symlinkTypeSync,AJ=Hc().pathExists;function Fme(r,e,t,n){n=typeof t=="function"?t:n,t=typeof t=="function"?!1:t,AJ(e,(i,o)=>{if(i)return n(i);if(o)return n(null);Nme(r,e,(s,a)=>{if(s)return n(s);r=a.toDst,Ome(a.toCwd,t,(l,c)=>{if(l)return n(l);let u=NJ.dirname(e);AJ(u,(p,f)=>{if(p)return n(p);if(f)return rv.symlink(r,e,c,n);Rme(u,g=>{if(g)return n(g);rv.symlink(r,e,c,n)})})})})})}function Lme(r,e,t,n){if(n=typeof t=="function"?t:n,t=typeof t=="function"?!1:t,rv.existsSync(e))return;let o=Mme(r,e);r=o.toDst,t=Kme(o.toCwd,t);let s=NJ.dirname(e);return rv.existsSync(s)||Ame(s),rv.symlinkSync(r,e,t)}FJ.exports={createSymlink:Tme(Fme),createSymlinkSync:Lme}});var jJ=N((mNe,UJ)=>{"use strict";var XP=SJ(),ZP=kJ(),eD=LJ();UJ.exports={createFile:XP.createFile,createFileSync:XP.createFileSync,ensureFile:XP.createFile,ensureFileSync:XP.createFileSync,createLink:ZP.createLink,createLinkSync:ZP.createLinkSync,ensureLink:ZP.createLink,ensureLinkSync:ZP.createLinkSync,createSymlink:eD.createSymlink,createSymlinkSync:eD.createSymlinkSync,ensureSymlink:eD.createSymlink,ensureSymlinkSync:eD.createSymlinkSync}});var qJ=N((fNe,BJ)=>{"use strict";var Ume=wo().fromCallback,Lm=Fn(),WJ=require("path"),VJ=Qo(),jme=Hc().pathExists;function Wme(r,e,t,n){typeof t=="function"&&(n=t,t="utf8");let i=WJ.dirname(r);jme(i,(o,s)=>{if(o)return n(o);if(s)return Lm.writeFile(r,e,t,n);VJ.mkdirs(i,a=>{if(a)return n(a);Lm.writeFile(r,e,t,n)})})}function Vme(r,e,t){let n=WJ.dirname(r);if(Lm.existsSync(n))return Lm.writeFileSync.apply(Lm,arguments);VJ.mkdirsSync(n),Lm.writeFileSync.apply(Lm,arguments)}BJ.exports={outputFile:Ume(Wme),outputFileSync:Vme}});var Wl=N((hNe,JJ)=>{"use strict";var Ws=H6(),Yo={};Ws(Yo,wO());Ws(Yo,Sq());Ws(Yo,KO());Ws(Yo,Qo());Ws(Yo,Jx());Ws(Yo,tJ());Ws(Yo,oJ());Ws(Yo,cJ());Ws(Yo,vJ());Ws(Yo,jJ());Ws(Yo,qJ());Ws(Yo,Hc());JJ.exports=Yo});var fD=N((wKe,ZO)=>{"use strict";function efe(r){var e=void 0;typeof r=="string"?e=[r]:e=r.raw;for(var t="",n=0;n<e.length;n++)t+=e[n].replace(/\\\n[ \t]*/g,"").replace(/\\`/g,"`"),n<(arguments.length<=1?0:arguments.length-1)&&(t+=arguments.length<=n+1?void 0:arguments[n+1]);var i=t.split(`
|
||
`),o=null;return i.forEach(function(s){var a=s.match(/^(\s+)\S+/);if(a){var l=a[1].length;o?o=Math.min(o,l):o=l}}),o!==null&&(t=i.map(function(s){return s[0]===" "?s.slice(o):s}).join(`
|
||
`)),t=t.trim(),t.replace(/\\n/g,`
|
||
`)}typeof ZO<"u"&&(ZO.exports=efe)});var u7=N((x2e,c7)=>{c7.exports=function(r,e){for(var t=[],n=0;n<r.length;n++){var i=e(r[n],n);mfe(i)?t.push.apply(t,i):t.push(i)}return t};var mfe=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"}});var h7=N((C2e,f7)=>{"use strict";f7.exports=d7;function d7(r,e,t){r instanceof RegExp&&(r=p7(r,t)),e instanceof RegExp&&(e=p7(e,t));var n=m7(r,e,t);return n&&{start:n[0],end:n[1],pre:t.slice(0,n[0]),body:t.slice(n[0]+r.length,n[1]),post:t.slice(n[1]+e.length)}}function p7(r,e){var t=e.match(r);return t?t[0]:null}d7.range=m7;function m7(r,e,t){var n,i,o,s,a,l=t.indexOf(r),c=t.indexOf(e,l+1),u=l;if(l>=0&&c>0){if(r===e)return[l,c];for(n=[],o=t.length;u>=0&&!a;)u==l?(n.push(u),l=t.indexOf(r,u+1)):n.length==1?a=[n.pop(),c]:(i=n.pop(),i<o&&(o=i,s=c),c=t.indexOf(e,u+1)),u=l<c&&l>=0?l:c;n.length&&(a=[o,s])}return a}});var C7=N((w2e,x7)=>{var ffe=u7(),g7=h7();x7.exports=vfe;var v7="\0SLASH"+Math.random()+"\0",y7="\0OPEN"+Math.random()+"\0",vK="\0CLOSE"+Math.random()+"\0",b7="\0COMMA"+Math.random()+"\0",I7="\0PERIOD"+Math.random()+"\0";function gK(r){return parseInt(r,10)==r?parseInt(r,10):r.charCodeAt(0)}function hfe(r){return r.split("\\\\").join(v7).split("\\{").join(y7).split("\\}").join(vK).split("\\,").join(b7).split("\\.").join(I7)}function gfe(r){return r.split(v7).join("\\").split(y7).join("{").split(vK).join("}").split(b7).join(",").split(I7).join(".")}function S7(r){if(!r)return[""];var e=[],t=g7("{","}",r);if(!t)return r.split(",");var n=t.pre,i=t.body,o=t.post,s=n.split(",");s[s.length-1]+="{"+i+"}";var a=S7(o);return o.length&&(s[s.length-1]+=a.shift(),s.push.apply(s,a)),e.push.apply(e,s),e}function vfe(r){return r?(r.substr(0,2)==="{}"&&(r="\\{\\}"+r.substr(2)),Tv(hfe(r),!0).map(gfe)):[]}function yfe(r){return"{"+r+"}"}function bfe(r){return/^-?0\d/.test(r)}function Ife(r,e){return r<=e}function Sfe(r,e){return r>=e}function Tv(r,e){var t=[],n=g7("{","}",r);if(!n||/\$$/.test(n.pre))return[r];var i=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=i||o,a=n.body.indexOf(",")>=0;if(!s&&!a)return n.post.match(/,.*\}/)?(r=n.pre+"{"+n.body+vK+n.post,Tv(r)):[r];var l;if(s)l=n.body.split(/\.\./);else if(l=S7(n.body),l.length===1&&(l=Tv(l[0],!1).map(yfe),l.length===1)){var u=n.post.length?Tv(n.post,!1):[""];return u.map(function(Me){return n.pre+l[0]+Me})}var c=n.pre,u=n.post.length?Tv(n.post,!1):[""],p;if(s){var f=gK(l[0]),g=gK(l[1]),v=Math.max(l[0].length,l[1].length),b=l.length==3?Math.abs(gK(l[2])):1,C=Ife,E=g<f;E&&(b*=-1,C=Sfe);var R=l.some(bfe);p=[];for(var _=f;C(_,g);_+=b){var L;if(o)L=String.fromCharCode(_),L==="\\"&&(L="");else if(L=String(_),R){var te=v-L.length;if(te>0){var $=new Array(te+1).join("0");_<0?L="-"+$+L.slice(1):L=$+L}}p.push(L)}}else p=ffe(l,function(be){return Tv(be,!1)});for(var se=0;se<p.length;se++)for(var ae=0;ae<u.length;ae++){var X=c+p[se]+u[ae];(!e||s||X)&&t.push(X)}return t}});var oC=N((E2e,D7)=>{D7.exports=Zo;Zo.Minimatch=mi;var iC=function(){try{return require("path")}catch{}}()||{sep:"/"};Zo.sep=iC.sep;var IK=Zo.GLOBSTAR=mi.GLOBSTAR={},xfe=C7(),w7={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},yK="[^/]",bK=yK+"*?",Cfe="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",wfe="(?:(?!(?:\\/|^)\\.).)*?",E7=Efe("().*{}+?[]^$\\!");function Efe(r){return r.split("").reduce(function(e,t){return e[t]=!0,e},{})}var k7=/\/+/;Zo.filter=kfe;function kfe(r,e){return e=e||{},function(t,n,i){return Zo(t,r,e)}}function zp(r,e){e=e||{};var t={};return Object.keys(r).forEach(function(n){t[n]=r[n]}),Object.keys(e).forEach(function(n){t[n]=e[n]}),t}Zo.defaults=function(r){if(!r||typeof r!="object"||!Object.keys(r).length)return Zo;var e=Zo,t=function(i,o,s){return e(i,o,zp(r,s))};return t.Minimatch=function(i,o){return new e.Minimatch(i,zp(r,o))},t.Minimatch.defaults=function(i){return e.defaults(zp(r,i)).Minimatch},t.filter=function(i,o){return e.filter(i,zp(r,o))},t.defaults=function(i){return e.defaults(zp(r,i))},t.makeRe=function(i,o){return e.makeRe(i,zp(r,o))},t.braceExpand=function(i,o){return e.braceExpand(i,zp(r,o))},t.match=function(n,i,o){return e.match(n,i,zp(r,o))},t};mi.defaults=function(r){return Zo.defaults(r).Minimatch};function Zo(r,e,t){return jD(e),t||(t={}),!t.nocomment&&e.charAt(0)==="#"?!1:new mi(e,t).match(r)}function mi(r,e){if(!(this instanceof mi))return new mi(r,e);jD(r),e||(e={}),r=r.trim(),!e.allowWindowsEscape&&iC.sep!=="/"&&(r=r.split(iC.sep).join("/")),this.options=e,this.set=[],this.pattern=r,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.partial=!!e.partial,this.make()}mi.prototype.debug=function(){};mi.prototype.make=Pfe;function Pfe(){var r=this.pattern,e=this.options;if(!e.nocomment&&r.charAt(0)==="#"){this.comment=!0;return}if(!r){this.empty=!0;return}this.parseNegate();var t=this.globSet=this.braceExpand();e.debug&&(this.debug=function(){console.error.apply(console,arguments)}),this.debug(this.pattern,t),t=this.globParts=t.map(function(n){return n.split(k7)}),this.debug(this.pattern,t),t=t.map(function(n,i,o){return n.map(this.parse,this)},this),this.debug(this.pattern,t),t=t.filter(function(n){return n.indexOf(!1)===-1}),this.debug(this.pattern,t),this.set=t}mi.prototype.parseNegate=Dfe;function Dfe(){var r=this.pattern,e=!1,t=this.options,n=0;if(!t.nonegate){for(var i=0,o=r.length;i<o&&r.charAt(i)==="!";i++)e=!e,n++;n&&(this.pattern=r.substr(n)),this.negate=e}}Zo.braceExpand=function(r,e){return P7(r,e)};mi.prototype.braceExpand=P7;function P7(r,e){return e||(this instanceof mi?e=this.options:e={}),r=typeof r>"u"?this.pattern:r,jD(r),e.nobrace||!/\{(?:(?!\{).)*\}/.test(r)?[r]:xfe(r)}var _fe=1024*64,jD=function(r){if(typeof r!="string")throw new TypeError("invalid pattern");if(r.length>_fe)throw new TypeError("pattern is too long")};mi.prototype.parse=Tfe;var UD={};function Tfe(r,e){jD(r);var t=this.options;if(r==="**")if(t.noglobstar)r="*";else return IK;if(r==="")return"";var n="",i=!!t.nocase,o=!1,s=[],a=[],l,c=!1,u=-1,p=-1,f=r.charAt(0)==="."?"":t.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this;function v(){if(l){switch(l){case"*":n+=bK,i=!0;break;case"?":n+=yK,i=!0;break;default:n+="\\"+l;break}g.debug("clearStateChar %j %j",l,n),l=!1}}for(var b=0,C=r.length,E;b<C&&(E=r.charAt(b));b++){if(this.debug("%s %s %s %j",r,b,n,E),o&&E7[E]){n+="\\"+E,o=!1;continue}switch(E){case"/":return!1;case"\\":v(),o=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",r,b,n,E),c){this.debug(" in class"),E==="!"&&b===p+1&&(E="^"),n+=E;continue}g.debug("call clearStateChar %j",l),v(),l=E,t.noext&&v();continue;case"(":if(c){n+="(";continue}if(!l){n+="\\(";continue}s.push({type:l,start:b-1,reStart:n.length,open:w7[l].open,close:w7[l].close}),n+=l==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",l,n),l=!1;continue;case")":if(c||!s.length){n+="\\)";continue}v(),i=!0;var R=s.pop();n+=R.close,R.type==="!"&&a.push(R),R.reEnd=n.length;continue;case"|":if(c||!s.length||o){n+="\\|",o=!1;continue}v(),n+="|";continue;case"[":if(v(),c){n+="\\"+E;continue}c=!0,p=b,u=n.length,n+=E;continue;case"]":if(b===p+1||!c){n+="\\"+E,o=!1;continue}var _=r.substring(p+1,b);try{RegExp("["+_+"]")}catch{var L=this.parse(_,UD);n=n.substr(0,u)+"\\["+L[0]+"\\]",i=i||L[1],c=!1;continue}i=!0,c=!1,n+=E;continue;default:v(),o?o=!1:E7[E]&&!(E==="^"&&c)&&(n+="\\"),n+=E}}for(c&&(_=r.substr(p+1),L=this.parse(_,UD),n=n.substr(0,u)+"\\["+L[0],i=i||L[1]),R=s.pop();R;R=s.pop()){var te=n.slice(R.reStart+R.open.length);this.debug("setting tail",n,R),te=te.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(fn,xt,Br){return Br||(Br="\\"),xt+xt+Br+"|"}),this.debug(`tail=%j
|
||
%s`,te,te,R,n);var $=R.type==="*"?bK:R.type==="?"?yK:"\\"+R.type;i=!0,n=n.slice(0,R.reStart)+$+"\\("+te}v(),o&&(n+="\\\\");var se=!1;switch(n.charAt(0)){case"[":case".":case"(":se=!0}for(var ae=a.length-1;ae>-1;ae--){var X=a[ae],be=n.slice(0,X.reStart),Me=n.slice(X.reStart,X.reEnd-8),it=n.slice(X.reEnd-8,X.reEnd),ut=n.slice(X.reEnd);it+=ut;var Xe=be.split("(").length-1,ne=ut;for(b=0;b<Xe;b++)ne=ne.replace(/\)[+*?]?/,"");ut=ne;var Ce="";ut===""&&e!==UD&&(Ce="$");var Q=be+Me+ut+Ce+it;n=Q}if(n!==""&&i&&(n="(?=.)"+n),se&&(n=f+n),e===UD)return[n,i];if(!i)return Afe(r);var fe=t.nocase?"i":"";try{var Le=new RegExp("^"+n+"$",fe)}catch{return new RegExp("$.")}return Le._glob=r,Le._src=n,Le}Zo.makeRe=function(r,e){return new mi(r,e||{}).makeRe()};mi.prototype.makeRe=Rfe;function Rfe(){if(this.regexp||this.regexp===!1)return this.regexp;var r=this.set;if(!r.length)return this.regexp=!1,this.regexp;var e=this.options,t=e.noglobstar?bK:e.dot?Cfe:wfe,n=e.nocase?"i":"",i=r.map(function(o){return o.map(function(s){return s===IK?t:typeof s=="string"?Nfe(s):s._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch{this.regexp=!1}return this.regexp}Zo.match=function(r,e,t){t=t||{};var n=new mi(e,t);return r=r.filter(function(i){return n.match(i)}),n.options.nonull&&!r.length&&r.push(e),r};mi.prototype.match=function(e,t){if(typeof t>"u"&&(t=this.partial),this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;var n=this.options;iC.sep!=="/"&&(e=e.split(iC.sep).join("/")),e=e.split(k7),this.debug(this.pattern,"split",e);var i=this.set;this.debug(this.pattern,"set",i);var o,s;for(s=e.length-1;s>=0&&(o=e[s],!o);s--);for(s=0;s<i.length;s++){var a=i[s],l=e;n.matchBase&&a.length===1&&(l=[o]);var c=this.matchOne(l,a,t);if(c)return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate};mi.prototype.matchOne=function(r,e,t){var n=this.options;this.debug("matchOne",{this:this,file:r,pattern:e}),this.debug("matchOne",r.length,e.length);for(var i=0,o=0,s=r.length,a=e.length;i<s&&o<a;i++,o++){this.debug("matchOne loop");var l=e[o],c=r[i];if(this.debug(e,l,c),l===!1)return!1;if(l===IK){this.debug("GLOBSTAR",[e,l,c]);var u=i,p=o+1;if(p===a){for(this.debug("** at the end");i<s;i++)if(r[i]==="."||r[i]===".."||!n.dot&&r[i].charAt(0)===".")return!1;return!0}for(;u<s;){var f=r[u];if(this.debug(`
|
||
globstar while`,r,u,e,p,f),this.matchOne(r.slice(u),e.slice(p),t))return this.debug("globstar found match!",u,s,f),!0;if(f==="."||f===".."||!n.dot&&f.charAt(0)==="."){this.debug("dot detected!",r,u,e,p);break}this.debug("globstar swallow a segment, and continue"),u++}return!!(t&&(this.debug(`
|
||
>>> no match, partial?`,r,u,e,p),u===s))}var g;if(typeof l=="string"?(g=c===l,this.debug("string match",l,c,g)):(g=c.match(l),this.debug("pattern match",l,c,g)),!g)return!1}if(i===s&&o===a)return!0;if(i===s)return t;if(o===a)return i===s-1&&r[i]==="";throw new Error("wtf?")};function Afe(r){return r.replace(/\\(.)/g,"$1")}function Nfe(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var K7=N(wK=>{var Jm=require("path"),Yp=process.platform==="win32",Qp=require("fs"),Kfe=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function Ffe(){var r;if(Kfe){var e=new Error;r=t}else r=n;return r;function t(i){i&&(e.message=i.message,i=e,n(i))}function n(i){if(i){if(process.throwDeprecation)throw i;if(!process.noDeprecation){var o="fs: missing callback "+(i.stack||i.message);process.traceDeprecation?console.trace(o):console.error(o)}}}}function Lfe(r){return typeof r=="function"?r:Ffe()}var fVe=Jm.normalize;Yp?eu=/(.*?)(?:[\/\\]+|$)/g:eu=/(.*?)(?:[\/]+|$)/g;var eu;Yp?cC=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/:cC=/^[\/]*/;var cC;wK.realpathSync=function(e,t){if(e=Jm.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return t[e];var n=e,i={},o={},s,a,l,c;u();function u(){var C=cC.exec(e);s=C[0].length,a=C[0],l=C[0],c="",Yp&&!o[l]&&(Qp.lstatSync(l),o[l]=!0)}for(;s<e.length;){eu.lastIndex=s;var p=eu.exec(e);if(c=a,a+=p[0],l=c+p[1],s=eu.lastIndex,!(o[l]||t&&t[l]===l)){var f;if(t&&Object.prototype.hasOwnProperty.call(t,l))f=t[l];else{var g=Qp.lstatSync(l);if(!g.isSymbolicLink()){o[l]=!0,t&&(t[l]=l);continue}var v=null;if(!Yp){var b=g.dev.toString(32)+":"+g.ino.toString(32);i.hasOwnProperty(b)&&(v=i[b])}v===null&&(Qp.statSync(l),v=Qp.readlinkSync(l)),f=Jm.resolve(c,v),t&&(t[l]=f),Yp||(i[b]=v)}e=Jm.resolve(f,e.slice(s)),u()}}return t&&(t[n]=e),e};wK.realpath=function(e,t,n){if(typeof n!="function"&&(n=Lfe(t),t=null),e=Jm.resolve(e),t&&Object.prototype.hasOwnProperty.call(t,e))return process.nextTick(n.bind(null,null,t[e]));var i=e,o={},s={},a,l,c,u;p();function p(){var C=cC.exec(e);a=C[0].length,l=C[0],c=C[0],u="",Yp&&!s[c]?Qp.lstat(c,function(E){if(E)return n(E);s[c]=!0,f()}):process.nextTick(f)}function f(){if(a>=e.length)return t&&(t[i]=e),n(null,e);eu.lastIndex=a;var C=eu.exec(e);return u=l,l+=C[0],c=u+C[1],a=eu.lastIndex,s[c]||t&&t[c]===c?process.nextTick(f):t&&Object.prototype.hasOwnProperty.call(t,c)?b(t[c]):Qp.lstat(c,g)}function g(C,E){if(C)return n(C);if(!E.isSymbolicLink())return s[c]=!0,t&&(t[c]=c),process.nextTick(f);if(!Yp){var R=E.dev.toString(32)+":"+E.ino.toString(32);if(o.hasOwnProperty(R))return v(null,o[R],c)}Qp.stat(c,function(_){if(_)return n(_);Qp.readlink(c,function(L,te){Yp||(o[R]=te),v(L,te)})})}function v(C,E,R){if(C)return n(C);var _=Jm.resolve(u,E);t&&(t[R]=_),b(_)}function b(C){e=Jm.resolve(C,e.slice(a)),p()}}});var DK=N((gVe,j7)=>{j7.exports=Xp;Xp.realpath=Xp;Xp.sync=PK;Xp.realpathSync=PK;Xp.monkeypatch=jfe;Xp.unmonkeypatch=Wfe;var Vv=require("fs"),EK=Vv.realpath,kK=Vv.realpathSync,Ufe=process.version,F7=/^v[0-5]\./.test(Ufe),L7=K7();function U7(r){return r&&r.syscall==="realpath"&&(r.code==="ELOOP"||r.code==="ENOMEM"||r.code==="ENAMETOOLONG")}function Xp(r,e,t){if(F7)return EK(r,e,t);typeof e=="function"&&(t=e,e=null),EK(r,e,function(n,i){U7(n)?L7.realpath(r,e,t):t(n,i)})}function PK(r,e){if(F7)return kK(r,e);try{return kK(r,e)}catch(t){if(U7(t))return L7.realpathSync(r,e);throw t}}function jfe(){Vv.realpath=Xp,Vv.realpathSync=PK}function Wfe(){Vv.realpath=EK,Vv.realpathSync=kK}});var W7=N((vVe,_K)=>{typeof Object.create=="function"?_K.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:_K.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}});var V7=N((yVe,RK)=>{try{if(TK=require("util"),typeof TK.inherits!="function")throw"";RK.exports=TK.inherits}catch{RK.exports=W7()}var TK});var BD=N((bVe,VD)=>{"use strict";function B7(r){return r.charAt(0)==="/"}function q7(r){var e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,t=e.exec(r),n=t[1]||"",i=!!(n&&n.charAt(1)!==":");return!!(t[2]||i)}VD.exports=process.platform==="win32"?q7:B7;VD.exports.posix=B7;VD.exports.win32=q7});var NK=N(Zp=>{Zp.setopts=Hfe;Zp.ownProp=J7;Zp.makeAbs=uC;Zp.finish=Gfe;Zp.mark=zfe;Zp.isIgnored=H7;Zp.childrenIgnored=Qfe;function J7(r,e){return Object.prototype.hasOwnProperty.call(r,e)}var Vfe=require("fs"),Bv=require("path"),Bfe=oC(),$7=BD(),AK=Bfe.Minimatch;function qfe(r,e){return r.localeCompare(e,"en")}function Jfe(r,e){r.ignore=e.ignore||[],Array.isArray(r.ignore)||(r.ignore=[r.ignore]),r.ignore.length&&(r.ignore=r.ignore.map($fe))}function $fe(r){var e=null;if(r.slice(-3)==="/**"){var t=r.replace(/(\/\*\*)+$/,"");e=new AK(t,{dot:!0})}return{matcher:new AK(r,{dot:!0}),gmatcher:e}}function Hfe(r,e,t){if(t||(t={}),t.matchBase&&e.indexOf("/")===-1){if(t.noglobstar)throw new Error("base matching requires globstar");e="**/"+e}r.silent=!!t.silent,r.pattern=e,r.strict=t.strict!==!1,r.realpath=!!t.realpath,r.realpathCache=t.realpathCache||Object.create(null),r.follow=!!t.follow,r.dot=!!t.dot,r.mark=!!t.mark,r.nodir=!!t.nodir,r.nodir&&(r.mark=!0),r.sync=!!t.sync,r.nounique=!!t.nounique,r.nonull=!!t.nonull,r.nosort=!!t.nosort,r.nocase=!!t.nocase,r.stat=!!t.stat,r.noprocess=!!t.noprocess,r.absolute=!!t.absolute,r.fs=t.fs||Vfe,r.maxLength=t.maxLength||1/0,r.cache=t.cache||Object.create(null),r.statCache=t.statCache||Object.create(null),r.symlinks=t.symlinks||Object.create(null),Jfe(r,t),r.changedCwd=!1;var n=process.cwd();J7(t,"cwd")?(r.cwd=Bv.resolve(t.cwd),r.changedCwd=r.cwd!==n):r.cwd=n,r.root=t.root||Bv.resolve(r.cwd,"/"),r.root=Bv.resolve(r.root),process.platform==="win32"&&(r.root=r.root.replace(/\\/g,"/")),r.cwdAbs=$7(r.cwd)?r.cwd:uC(r,r.cwd),process.platform==="win32"&&(r.cwdAbs=r.cwdAbs.replace(/\\/g,"/")),r.nomount=!!t.nomount,t.nonegate=!0,t.nocomment=!0,r.minimatch=new AK(e,t),r.options=r.minimatch.options}function Gfe(r){for(var e=r.nounique,t=e?[]:Object.create(null),n=0,i=r.matches.length;n<i;n++){var o=r.matches[n];if(!o||Object.keys(o).length===0){if(r.nonull){var s=r.minimatch.globSet[n];e?t.push(s):t[s]=!0}}else{var a=Object.keys(o);e?t.push.apply(t,a):a.forEach(function(l){t[l]=!0})}}if(e||(t=Object.keys(t)),r.nosort||(t=t.sort(qfe)),r.mark){for(var n=0;n<t.length;n++)t[n]=r._mark(t[n]);r.nodir&&(t=t.filter(function(l){var c=!/\/$/.test(l),u=r.cache[l]||r.cache[uC(r,l)];return c&&u&&(c=u!=="DIR"&&!Array.isArray(u)),c}))}r.ignore.length&&(t=t.filter(function(l){return!H7(r,l)})),r.found=t}function zfe(r,e){var t=uC(r,e),n=r.cache[t],i=e;if(n){var o=n==="DIR"||Array.isArray(n),s=e.slice(-1)==="/";if(o&&!s?i+="/":!o&&s&&(i=i.slice(0,-1)),i!==e){var a=uC(r,i);r.statCache[a]=r.statCache[t],r.cache[a]=r.cache[t]}}return i}function uC(r,e){var t=e;return e.charAt(0)==="/"?t=Bv.join(r.root,e):$7(e)||e===""?t=e:r.changedCwd?t=Bv.resolve(r.cwd,e):t=Bv.resolve(e),process.platform==="win32"&&(t=t.replace(/\\/g,"/")),t}function H7(r,e){return r.ignore.length?r.ignore.some(function(t){return t.matcher.match(e)||!!(t.gmatcher&&t.gmatcher.match(e))}):!1}function Qfe(r,e){return r.ignore.length?r.ignore.some(function(t){return!!(t.gmatcher&&t.gmatcher.match(e))}):!1}});var X7=N((wVe,Y7)=>{Y7.exports=Q7;Q7.GlobSync=Bn;var Yfe=DK(),G7=oC(),SVe=G7.Minimatch,xVe=KK().Glob,CVe=require("util"),MK=require("path"),z7=require("assert"),qD=BD(),$m=NK(),Xfe=$m.setopts,OK=$m.ownProp,Zfe=$m.childrenIgnored,ehe=$m.isIgnored;function Q7(r,e){if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
||
See: https://github.com/isaacs/node-glob/issues/167`);return new Bn(r,e).found}function Bn(r,e){if(!r)throw new Error("must provide pattern");if(typeof e=="function"||arguments.length===3)throw new TypeError(`callback provided to sync glob
|
||
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof Bn))return new Bn(r,e);if(Xfe(this,r,e),this.noprocess)return this;var t=this.minimatch.set.length;this.matches=new Array(t);for(var n=0;n<t;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}Bn.prototype._finish=function(){if(z7(this instanceof Bn),this.realpath){var r=this;this.matches.forEach(function(e,t){var n=r.matches[t]=Object.create(null);for(var i in e)try{i=r._makeAbs(i);var o=Yfe.realpathSync(i,r.realpathCache);n[o]=!0}catch(s){if(s.syscall==="stat")n[r._makeAbs(i)]=!0;else throw s}})}$m.finish(this)};Bn.prototype._process=function(r,e,t){z7(this instanceof Bn);for(var n=0;typeof r[n]=="string";)n++;var i;switch(n){case r.length:this._processSimple(r.join("/"),e);return;case 0:i=null;break;default:i=r.slice(0,n).join("/");break}var o=r.slice(n),s;i===null?s=".":((qD(i)||qD(r.join("/")))&&(!i||!qD(i))&&(i="/"+i),s=i);var a=this._makeAbs(s);if(!Zfe(this,s)){var l=o[0]===G7.GLOBSTAR;l?this._processGlobStar(i,s,a,o,e,t):this._processReaddir(i,s,a,o,e,t)}};Bn.prototype._processReaddir=function(r,e,t,n,i,o){var s=this._readdir(t,o);if(s){for(var a=n[0],l=!!this.minimatch.negate,c=a._glob,u=this.dot||c.charAt(0)===".",p=[],f=0;f<s.length;f++){var g=s[f];if(g.charAt(0)!=="."||u){var v;l&&!r?v=!g.match(a):v=g.match(a),v&&p.push(g)}}var b=p.length;if(b!==0){if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var f=0;f<b;f++){var g=p[f];r&&(r.slice(-1)!=="/"?g=r+"/"+g:g=r+g),g.charAt(0)==="/"&&!this.nomount&&(g=MK.join(this.root,g)),this._emitMatch(i,g)}return}n.shift();for(var f=0;f<b;f++){var g=p[f],C;r?C=[r,g]:C=[g],this._process(C.concat(n),i,o)}}}};Bn.prototype._emitMatch=function(r,e){if(!ehe(this,e)){var t=this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=t),!this.matches[r][e]){if(this.nodir){var n=this.cache[t];if(n==="DIR"||Array.isArray(n))return}this.matches[r][e]=!0,this.stat&&this._stat(e)}}};Bn.prototype._readdirInGlobStar=function(r){if(this.follow)return this._readdir(r,!1);var e,t,n;try{t=this.fs.lstatSync(r)}catch(o){if(o.code==="ENOENT")return null}var i=t&&t.isSymbolicLink();return this.symlinks[r]=i,!i&&t&&!t.isDirectory()?this.cache[r]="FILE":e=this._readdir(r,!1),e};Bn.prototype._readdir=function(r,e){var t;if(e&&!OK(this.symlinks,r))return this._readdirInGlobStar(r);if(OK(this.cache,r)){var n=this.cache[r];if(!n||n==="FILE")return null;if(Array.isArray(n))return n}try{return this._readdirEntries(r,this.fs.readdirSync(r))}catch(i){return this._readdirError(r,i),null}};Bn.prototype._readdirEntries=function(r,e){if(!this.mark&&!this.stat)for(var t=0;t<e.length;t++){var n=e[t];r==="/"?n=r+n:n=r+"/"+n,this.cache[n]=!0}return this.cache[r]=e,e};Bn.prototype._readdirError=function(r,e){switch(e.code){case"ENOTSUP":case"ENOTDIR":var t=this._makeAbs(r);if(this.cache[t]="FILE",t===this.cwdAbs){var n=new Error(e.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=e.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(r)]=!1;break;default:if(this.cache[this._makeAbs(r)]=!1,this.strict)throw e;this.silent||console.error("glob error",e);break}};Bn.prototype._processGlobStar=function(r,e,t,n,i,o){var s=this._readdir(t,o);if(s){var a=n.slice(1),l=r?[r]:[],c=l.concat(a);this._process(c,i,!1);var u=s.length,p=this.symlinks[t];if(!(p&&o))for(var f=0;f<u;f++){var g=s[f];if(!(g.charAt(0)==="."&&!this.dot)){var v=l.concat(s[f],a);this._process(v,i,!0);var b=l.concat(s[f],n);this._process(b,i,!0)}}}};Bn.prototype._processSimple=function(r,e){var t=this._stat(r);if(this.matches[e]||(this.matches[e]=Object.create(null)),!!t){if(r&&qD(r)&&!this.nomount){var n=/[\/\\]$/.test(r);r.charAt(0)==="/"?r=MK.join(this.root,r):(r=MK.resolve(this.root,r),n&&(r+="/"))}process.platform==="win32"&&(r=r.replace(/\\/g,"/")),this._emitMatch(e,r)}};Bn.prototype._stat=function(r){var e=this._makeAbs(r),t=r.slice(-1)==="/";if(r.length>this.maxLength)return!1;if(!this.stat&&OK(this.cache,e)){var s=this.cache[e];if(Array.isArray(s)&&(s="DIR"),!t||s==="DIR")return s;if(t&&s==="FILE")return!1}var n,i=this.statCache[e];if(!i){var o;try{o=this.fs.lstatSync(e)}catch(a){if(a&&(a.code==="ENOENT"||a.code==="ENOTDIR"))return this.statCache[e]=!1,!1}if(o&&o.isSymbolicLink())try{i=this.fs.statSync(e)}catch{i=o}else i=o}this.statCache[e]=i;var s=!0;return i&&(s=i.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,t&&s==="FILE"?!1:s};Bn.prototype._mark=function(r){return $m.mark(this,r)};Bn.prototype._makeAbs=function(r){return $m.makeAbs(this,r)}});var FK=N((EVe,e$)=>{e$.exports=Z7;function Z7(r,e){if(r&&e)return Z7(r)(e);if(typeof r!="function")throw new TypeError("need wrapper function");return Object.keys(r).forEach(function(n){t[n]=r[n]}),t;function t(){for(var n=new Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];var o=r.apply(this,n),s=n[n.length-1];return typeof o=="function"&&o!==s&&Object.keys(s).forEach(function(a){o[a]=s[a]}),o}}});var UK=N((kVe,LK)=>{var t$=FK();LK.exports=t$(JD);LK.exports.strict=t$(r$);JD.proto=JD(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return JD(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return r$(this)},configurable:!0})});function JD(r){var e=function(){return e.called?e.value:(e.called=!0,e.value=r.apply(this,arguments))};return e.called=!1,e}function r$(r){var e=function(){if(e.called)throw new Error(e.onceError);return e.called=!0,e.value=r.apply(this,arguments)},t=r.name||"Function wrapped with `once`";return e.onceError=t+" shouldn't be called more than once",e.called=!1,e}});var i$=N((PVe,n$)=>{var the=FK(),pC=Object.create(null),rhe=UK();n$.exports=the(nhe);function nhe(r,e){return pC[r]?(pC[r].push(e),null):(pC[r]=[e],ihe(r))}function ihe(r){return rhe(function e(){var t=pC[r],n=t.length,i=ohe(arguments);try{for(var o=0;o<n;o++)t[o].apply(null,i)}finally{t.length>n?(t.splice(0,n),process.nextTick(function(){e.apply(null,i)})):delete pC[r]}})}function ohe(r){for(var e=r.length,t=[],n=0;n<e;n++)t[n]=r[n];return t}});var KK=N((TVe,s$)=>{s$.exports=Hm;var she=DK(),o$=oC(),DVe=o$.Minimatch,ahe=V7(),lhe=require("events").EventEmitter,jK=require("path"),WK=require("assert"),dC=BD(),BK=X7(),Gm=NK(),che=Gm.setopts,VK=Gm.ownProp,qK=i$(),_Ve=require("util"),uhe=Gm.childrenIgnored,phe=Gm.isIgnored,dhe=UK();function Hm(r,e,t){if(typeof e=="function"&&(t=e,e={}),e||(e={}),e.sync){if(t)throw new TypeError("callback provided to sync glob");return BK(r,e)}return new fr(r,e,t)}Hm.sync=BK;var mhe=Hm.GlobSync=BK.GlobSync;Hm.glob=Hm;function fhe(r,e){if(e===null||typeof e!="object")return r;for(var t=Object.keys(e),n=t.length;n--;)r[t[n]]=e[t[n]];return r}Hm.hasMagic=function(r,e){var t=fhe({},e);t.noprocess=!0;var n=new fr(r,t),i=n.minimatch.set;if(!r)return!1;if(i.length>1)return!0;for(var o=0;o<i[0].length;o++)if(typeof i[0][o]!="string")return!0;return!1};Hm.Glob=fr;ahe(fr,lhe);function fr(r,e,t){if(typeof e=="function"&&(t=e,e=null),e&&e.sync){if(t)throw new TypeError("callback provided to sync glob");return new mhe(r,e)}if(!(this instanceof fr))return new fr(r,e,t);che(this,r,e),this._didRealPath=!1;var n=this.minimatch.set.length;this.matches=new Array(n),typeof t=="function"&&(t=dhe(t),this.on("error",t),this.on("end",function(l){t(null,l)}));var i=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(n===0)return a();for(var o=!0,s=0;s<n;s++)this._process(this.minimatch.set[s],s,!1,a);o=!1;function a(){--i._processing,i._processing<=0&&(o?process.nextTick(function(){i._finish()}):i._finish())}}fr.prototype._finish=function(){if(WK(this instanceof fr),!this.aborted){if(this.realpath&&!this._didRealpath)return this._realpath();Gm.finish(this),this.emit("end",this.found)}};fr.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var r=this.matches.length;if(r===0)return this._finish();for(var e=this,t=0;t<this.matches.length;t++)this._realpathSet(t,n);function n(){--r===0&&e._finish()}};fr.prototype._realpathSet=function(r,e){var t=this.matches[r];if(!t)return e();var n=Object.keys(t),i=this,o=n.length;if(o===0)return e();var s=this.matches[r]=Object.create(null);n.forEach(function(a,l){a=i._makeAbs(a),she.realpath(a,i.realpathCache,function(c,u){c?c.syscall==="stat"?s[a]=!0:i.emit("error",c):s[u]=!0,--o===0&&(i.matches[r]=s,e())})})};fr.prototype._mark=function(r){return Gm.mark(this,r)};fr.prototype._makeAbs=function(r){return Gm.makeAbs(this,r)};fr.prototype.abort=function(){this.aborted=!0,this.emit("abort")};fr.prototype.pause=function(){this.paused||(this.paused=!0,this.emit("pause"))};fr.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var r=this._emitQueue.slice(0);this._emitQueue.length=0;for(var e=0;e<r.length;e++){var t=r[e];this._emitMatch(t[0],t[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var e=0;e<n.length;e++){var i=n[e];this._processing--,this._process(i[0],i[1],i[2],i[3])}}}};fr.prototype._process=function(r,e,t,n){if(WK(this instanceof fr),WK(typeof n=="function"),!this.aborted){if(this._processing++,this.paused){this._processQueue.push([r,e,t,n]);return}for(var i=0;typeof r[i]=="string";)i++;var o;switch(i){case r.length:this._processSimple(r.join("/"),e,n);return;case 0:o=null;break;default:o=r.slice(0,i).join("/");break}var s=r.slice(i),a;o===null?a=".":((dC(o)||dC(r.join("/")))&&(!o||!dC(o))&&(o="/"+o),a=o);var l=this._makeAbs(a);if(uhe(this,a))return n();var c=s[0]===o$.GLOBSTAR;c?this._processGlobStar(o,a,l,s,e,t,n):this._processReaddir(o,a,l,s,e,t,n)}};fr.prototype._processReaddir=function(r,e,t,n,i,o,s){var a=this;this._readdir(t,o,function(l,c){return a._processReaddir2(r,e,t,n,i,o,c,s)})};fr.prototype._processReaddir2=function(r,e,t,n,i,o,s,a){if(!s)return a();for(var l=n[0],c=!!this.minimatch.negate,u=l._glob,p=this.dot||u.charAt(0)===".",f=[],g=0;g<s.length;g++){var v=s[g];if(v.charAt(0)!=="."||p){var b;c&&!r?b=!v.match(l):b=v.match(l),b&&f.push(v)}}var C=f.length;if(C===0)return a();if(n.length===1&&!this.mark&&!this.stat){this.matches[i]||(this.matches[i]=Object.create(null));for(var g=0;g<C;g++){var v=f[g];r&&(r!=="/"?v=r+"/"+v:v=r+v),v.charAt(0)==="/"&&!this.nomount&&(v=jK.join(this.root,v)),this._emitMatch(i,v)}return a()}n.shift();for(var g=0;g<C;g++){var v=f[g],E;r&&(r!=="/"?v=r+"/"+v:v=r+v),this._process([v].concat(n),i,o,a)}a()};fr.prototype._emitMatch=function(r,e){if(!this.aborted&&!phe(this,e)){if(this.paused){this._emitQueue.push([r,e]);return}var t=dC(e)?e:this._makeAbs(e);if(this.mark&&(e=this._mark(e)),this.absolute&&(e=t),!this.matches[r][e]){if(this.nodir){var n=this.cache[t];if(n==="DIR"||Array.isArray(n))return}this.matches[r][e]=!0;var i=this.statCache[t];i&&this.emit("stat",e,i),this.emit("match",e)}}};fr.prototype._readdirInGlobStar=function(r,e){if(this.aborted)return;if(this.follow)return this._readdir(r,!1,e);var t="lstat\0"+r,n=this,i=qK(t,o);i&&n.fs.lstat(r,i);function o(s,a){if(s&&s.code==="ENOENT")return e();var l=a&&a.isSymbolicLink();n.symlinks[r]=l,!l&&a&&!a.isDirectory()?(n.cache[r]="FILE",e()):n._readdir(r,!1,e)}};fr.prototype._readdir=function(r,e,t){if(!this.aborted&&(t=qK("readdir\0"+r+"\0"+e,t),!!t)){if(e&&!VK(this.symlinks,r))return this._readdirInGlobStar(r,t);if(VK(this.cache,r)){var n=this.cache[r];if(!n||n==="FILE")return t();if(Array.isArray(n))return t(null,n)}var i=this;i.fs.readdir(r,hhe(this,r,t))}};function hhe(r,e,t){return function(n,i){n?r._readdirError(e,n,t):r._readdirEntries(e,i,t)}}fr.prototype._readdirEntries=function(r,e,t){if(!this.aborted){if(!this.mark&&!this.stat)for(var n=0;n<e.length;n++){var i=e[n];r==="/"?i=r+i:i=r+"/"+i,this.cache[i]=!0}return this.cache[r]=e,t(null,e)}};fr.prototype._readdirError=function(r,e,t){if(!this.aborted){switch(e.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(r);if(this.cache[n]="FILE",n===this.cwdAbs){var i=new Error(e.code+" invalid cwd "+this.cwd);i.path=this.cwd,i.code=e.code,this.emit("error",i),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(r)]=!1;break;default:this.cache[this._makeAbs(r)]=!1,this.strict&&(this.emit("error",e),this.abort()),this.silent||console.error("glob error",e);break}return t()}};fr.prototype._processGlobStar=function(r,e,t,n,i,o,s){var a=this;this._readdir(t,o,function(l,c){a._processGlobStar2(r,e,t,n,i,o,c,s)})};fr.prototype._processGlobStar2=function(r,e,t,n,i,o,s,a){if(!s)return a();var l=n.slice(1),c=r?[r]:[],u=c.concat(l);this._process(u,i,!1,a);var p=this.symlinks[t],f=s.length;if(p&&o)return a();for(var g=0;g<f;g++){var v=s[g];if(!(v.charAt(0)==="."&&!this.dot)){var b=c.concat(s[g],l);this._process(b,i,!0,a);var C=c.concat(s[g],n);this._process(C,i,!0,a)}}a()};fr.prototype._processSimple=function(r,e,t){var n=this;this._stat(r,function(i,o){n._processSimple2(r,e,i,o,t)})};fr.prototype._processSimple2=function(r,e,t,n,i){if(this.matches[e]||(this.matches[e]=Object.create(null)),!n)return i();if(r&&dC(r)&&!this.nomount){var o=/[\/\\]$/.test(r);r.charAt(0)==="/"?r=jK.join(this.root,r):(r=jK.resolve(this.root,r),o&&(r+="/"))}process.platform==="win32"&&(r=r.replace(/\\/g,"/")),this._emitMatch(e,r),i()};fr.prototype._stat=function(r,e){var t=this._makeAbs(r),n=r.slice(-1)==="/";if(r.length>this.maxLength)return e();if(!this.stat&&VK(this.cache,t)){var i=this.cache[t];if(Array.isArray(i)&&(i="DIR"),!n||i==="DIR")return e(null,i);if(n&&i==="FILE")return e()}var o,s=this.statCache[t];if(s!==void 0){if(s===!1)return e(null,s);var a=s.isDirectory()?"DIR":"FILE";return n&&a==="FILE"?e():e(null,a,s)}var l=this,c=qK("stat\0"+t,u);c&&l.fs.lstat(t,c);function u(p,f){if(f&&f.isSymbolicLink())return l.fs.stat(t,function(g,v){g?l._stat2(r,t,null,f,e):l._stat2(r,t,g,v,e)});l._stat2(r,t,p,f,e)}};fr.prototype._stat2=function(r,e,t,n,i){if(t&&(t.code==="ENOENT"||t.code==="ENOTDIR"))return this.statCache[e]=!1,i();var o=r.slice(-1)==="/";if(this.statCache[e]=n,e.slice(-1)==="/"&&n&&!n.isDirectory())return i(null,!1,n);var s=!0;return n&&(s=n.isDirectory()?"DIR":"FILE"),this.cache[e]=this.cache[e]||s,o&&s==="FILE"?i():i(null,s,n)}});var c$=N((RVe,l$)=>{"use strict";var a$=process.platform==="win32",ghe=a$?/[^:]\\$/:/.\/$/;l$.exports=function(){var r;return a$?r=process.env.TEMP||process.env.TMP||(process.env.SystemRoot||process.env.windir)+"\\temp":r=process.env.TMPDIR||process.env.TMP||process.env.TEMP||"/tmp",ghe.test(r)&&(r=r.slice(0,-1)),r}});var C$=N((AVe,tu)=>{var Do=require("fs"),JK=require("path"),u$=require("crypto"),vhe=c$(),mC=require("constants"),$K=vhe(),p$="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",HK=/XXXXXX/,m$=3,f$=mC.O_CREAT|mC.O_EXCL|mC.O_RDWR,h$=448,g$=384,qv=[],v$=!1,GK=!1;function d$(r){var e=[],t=null;try{t=u$.randomBytes(r)}catch{t=u$.pseudoRandomBytes(r)}for(var n=0;n<r;n++)e.push(p$[t[n]%p$.length]);return e.join("")}function yhe(r){return typeof r>"u"}function Jv(r,e){if(typeof r=="function"){var t=r;r=e||{},e=t}else typeof r>"u"&&(r={});return[r,e]}function y$(r){if(r.name)return JK.join(r.dir||$K,r.name);if(r.template)return r.template.replace(HK,d$(6));var e=[r.prefix||"tmp-",process.pid,d$(12),r.postfix||""].join("");return JK.join(r.dir||$K,e)}function zK(r,e){var t=Jv(r,e),n=t[0],i=t[1],o=n.tries||m$;if(isNaN(o)||o<0)return i(new Error("Invalid tries"));if(n.template&&!n.template.match(HK))return i(new Error("Invalid template provided"));(function s(){var a=y$(n);Do.stat(a,function(l){if(!l)return o-- >0?s():i(new Error("Could not get a unique tmp filename, max tries reached "+a));i(null,a)})})()}function QK(r){var e=Jv(r),t=e[0],n=t.tries||m$;if(isNaN(n)||n<0)throw new Error("Invalid tries");if(t.template&&!t.template.match(HK))throw new Error("Invalid template provided");do{var i=y$(t);try{Do.statSync(i)}catch{return i}}while(n-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function bhe(r,e){var t=Jv(r,e),n=t[0],i=t[1];n.postfix=yhe(n.postfix)?".tmp":n.postfix,zK(n,function(s,a){if(s)return i(s);Do.open(a,f$,n.mode||g$,function(c,u){if(c)return i(c);i(null,a,u,b$(a,u,n))})})}function Ihe(r){var e=Jv(r),t=e[0];t.postfix=t.postfix||".tmp";var n=QK(t),i=Do.openSync(n,f$,t.mode||g$);return{name:n,fd:i,removeCallback:b$(n,i,t)}}function She(r){var e=[r];do{for(var t=e.pop(),n=!1,i=Do.readdirSync(t),o=0,s=i.length;o<s;o++){var a=JK.join(t,i[o]),l=Do.lstatSync(a);l.isDirectory()?(n||(n=!0,e.push(t)),e.push(a)):Do.unlinkSync(a)}n||Do.rmdirSync(t)}while(e.length!==0)}function xhe(r,e){var t=Jv(r,e),n=t[0],i=t[1];zK(n,function(s,a){if(s)return i(s);Do.mkdir(a,n.mode||h$,function(c){if(c)return i(c);i(null,a,I$(a,n))})})}function Che(r){var e=Jv(r),t=e[0],n=QK(t);return Do.mkdirSync(n,t.mode||h$),{name:n,removeCallback:I$(n,t)}}function b$(r,e,t){var n=S$(function(o){try{Do.closeSync(o[0])}catch(s){if(s.errno!=-mC.EBADF&&s.errno!=-mC.ENOENT)throw s}Do.unlinkSync(o[1])},[e,r]);return t.keep||qv.unshift(n),n}function I$(r,e){var t=e.unsafeCleanup?She:Do.rmdirSync.bind(Do),n=S$(t,r);return e.keep||qv.unshift(n),n}function S$(r,e){var t=!1;return function n(){if(!t){var i=qv.indexOf(n);i>=0&&qv.splice(i,1),t=!0,r(e)}}}function x$(){if(!(GK&&!v$))for(var r=0,e=qv.length;r<e;r++)try{qv[r].call(null)}catch{}}function whe(){v$=!0}var $D=process.versions.node.split(".").map(function(r){return parseInt(r,10)});$D[0]===0&&($D[1]<9||$D[1]===9&&$D[2]<5)&&process.addListener("uncaughtException",function(e){throw GK=!0,x$(),e});process.addListener("exit",function(e){e&&(GK=!0),x$()});tu.exports.tmpdir=$K;tu.exports.dir=xhe;tu.exports.dirSync=Che;tu.exports.file=bhe;tu.exports.fileSync=Ihe;tu.exports.tmpName=zK;tu.exports.tmpNameSync=QK;tu.exports.setGracefulCleanup=whe});var E$=N((zm,w$)=>{var fC=require("node-fetch"),Ehe=fC.default||fC,HD=function(r,e){return/^\/\//.test(r)&&(r="https:"+r),Ehe.call(this,r,e)};HD.ponyfill=!0;w$.exports=zm=HD;zm.fetch=HD;zm.Headers=fC.Headers;zm.Request=fC.Request;zm.Response=fC.Response;zm.default=HD});var u5=N((I7e,c5)=>{var Lhe=require("crypto");c5.exports=function(){return Lhe.randomBytes(16)}});var m5=N((S7e,d5)=>{var p5=[];for(wC=0;wC<256;++wC)p5[wC]=(wC+256).toString(16).substr(1);var wC;function Uhe(r,e){var t=e||0,n=p5;return[n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],"-",n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]],n[r[t++]]].join("")}d5.exports=Uhe});var To=N((x7e,f5)=>{var jhe=u5(),Whe=m5();function Vhe(r,e,t){var n=e&&t||0;typeof r=="string"&&(e=r==="binary"?new Array(16):null,r=null),r=r||{};var i=r.random||(r.rng||jhe)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,e)for(var o=0;o<16;++o)e[n+o]=i[o];return e||Whe(i)}f5.exports=Vhe});var I5=N((E5e,b5)=>{"use strict";function uf(r){if(!(this instanceof uf))return new uf(r);r=r||{},this.concurrency=r.concurrency||1/0,this.pending=0,this.jobs=[],this.cbs=[],this._done=Jhe.bind(this)}var qhe=["push","unshift","splice"];qhe.forEach(function(r){uf.prototype[r]=function(){var e=Array.prototype[r].apply(this.jobs,arguments);return this._run(),e}});Object.defineProperty(uf.prototype,"length",{get:function(){return this.pending+this.jobs.length}});uf.prototype._run=function(){if(this.pending!==this.concurrency){if(this.jobs.length){var r=this.jobs.shift();this.pending++,r(this._done),this._run()}if(this.pending===0)for(;this.cbs.length!==0;){var e=this.cbs.pop();process.nextTick(e)}}};uf.prototype.onDone=function(r){typeof r=="function"&&(this.cbs.push(r),this._run())};function Jhe(){this.pending--,this._run()}b5.exports=uf});var pf=N((k5e,S5)=>{"use strict";S5.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),EMPTY_BUFFER:Buffer.alloc(0),NOOP:()=>{}}});var F5=N((P5e,K5)=>{var E5=require("fs"),au=require("path"),k5=require("os"),P5=typeof __webpack_require__=="function"?__non_webpack_require__:require,$he=process.config&&process.config.variables||{},Hhe=!!process.env.PREBUILDS_ONLY,x5=process.versions.modules,lF=Qhe()?"electron":zhe()?"node-webkit":"node",cF=process.env.npm_config_arch||k5.arch(),uF=process.env.npm_config_platform||k5.platform(),D5=process.env.LIBC||(Yhe(uF)?"musl":"glibc"),pF=process.env.ARM_VERSION||(cF==="arm64"?"8":$he.arm_version)||"",_5=(process.versions.uv||"").split(".")[0];K5.exports=Zl;function Zl(r){return P5(Zl.resolve(r))}Zl.resolve=Zl.path=function(r){r=au.resolve(r||".");try{var e=P5(au.join(r,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(r=process.env[e+"_PREBUILD"])}catch{}if(!Hhe){var t=C5(au.join(r,"build/Release"),w5);if(t)return t;var n=C5(au.join(r,"build/Debug"),w5);if(n)return n}var i=a(r);if(i)return i;var o=a(au.dirname(process.execPath));if(o)return o;var s=["platform="+uF,"arch="+cF,"runtime="+lF,"abi="+x5,"uv="+_5,pF?"armv="+pF:"","libc="+D5,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+s+`
|
||
loaded from: `+r+`
|
||
`);function a(l){var c=dF(au.join(l,"prebuilds")).map(T5),u=c.filter(R5(uF,cF)).sort(A5)[0];if(u){var p=au.join(l,"prebuilds",u.name),f=dF(p).map(N5),g=f.filter(M5(lF,x5)),v=g.sort(O5(lF))[0];if(v)return au.join(p,v.file)}}};function dF(r){try{return E5.readdirSync(r)}catch{return[]}}function C5(r,e){var t=dF(r).filter(e);return t[0]&&au.join(r,t[0])}function w5(r){return/\.node$/.test(r)}function T5(r){var e=r.split("-");if(e.length===2){var t=e[0],n=e[1].split("+");if(t&&n.length&&n.every(Boolean))return{name:r,platform:t,architectures:n}}}function R5(r,e){return function(t){return t==null||t.platform!==r?!1:t.architectures.includes(e)}}function A5(r,e){return r.architectures.length-e.architectures.length}function N5(r){var e=r.split("."),t=e.pop(),n={file:r,specificity:0};if(t==="node"){for(var i=0;i<e.length;i++){var o=e[i];if(o==="node"||o==="electron"||o==="node-webkit")n.runtime=o;else if(o==="napi")n.napi=!0;else if(o.slice(0,3)==="abi")n.abi=o.slice(3);else if(o.slice(0,2)==="uv")n.uv=o.slice(2);else if(o.slice(0,4)==="armv")n.armv=o.slice(4);else if(o==="glibc"||o==="musl")n.libc=o;else continue;n.specificity++}return n}}function M5(r,e){return function(t){return!(t==null||t.runtime!==r&&!Ghe(t)||t.abi!==e&&!t.napi||t.uv&&t.uv!==_5||t.armv&&t.armv!==pF||t.libc&&t.libc!==D5)}}function Ghe(r){return r.runtime==="node"&&r.napi}function O5(r){return function(e,t){return e.runtime!==t.runtime?e.runtime===r?-1:1:e.abi!==t.abi?e.abi?-1:1:e.specificity!==t.specificity?e.specificity>t.specificity?-1:1:0}}function zhe(){return!!(process.versions&&process.versions.nw)}function Qhe(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<"u"&&window.process&&window.process.type==="renderer"}function Yhe(r){return r==="linux"&&E5.existsSync("/etc/alpine-release")}Zl.parseTags=N5;Zl.matchTags=M5;Zl.compareTags=O5;Zl.parseTuple=T5;Zl.matchTuple=R5;Zl.compareTuples=A5});var fF=N((D5e,mF)=>{typeof process.addon=="function"?mF.exports=process.addon.bind(process):mF.exports=F5()});var U5=N((_5e,L5)=>{"use strict";var Xhe=(r,e,t,n,i)=>{for(var o=0;o<i;o++)t[n+o]=r[o]^e[o&3]},Zhe=(r,e)=>{let t=r.length;for(var n=0;n<t;n++)r[n]^=e[n&3]};L5.exports={mask:Xhe,unmask:Zhe}});var j5=N((T5e,hF)=>{"use strict";try{hF.exports=fF()(__dirname)}catch{hF.exports=U5()}});var S_=N((R5e,gF)=>{"use strict";var{EMPTY_BUFFER:ege}=pf();function W5(r,e){if(r.length===0)return ege;if(r.length===1)return r[0];let t=Buffer.allocUnsafe(e);for(var n=0,i=0;i<r.length;i++){let o=r[i];o.copy(t,n),n+=o.length}return t}function V5(r,e,t,n,i){for(var o=0;o<i;o++)t[n+o]=r[o]^e[o&3]}function B5(r,e){let t=r.length;for(var n=0;n<t;n++)r[n]^=e[n&3]}function q5(r){return r.byteLength===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}function I_(r){if(I_.readOnly=!0,Buffer.isBuffer(r))return r;var e;return r instanceof ArrayBuffer?e=Buffer.from(r):ArrayBuffer.isView(r)?e=tge(r):(e=Buffer.from(r),I_.readOnly=!1),e}function tge(r){let e=Buffer.from(r.buffer);return r.byteLength!==r.buffer.byteLength?e.slice(r.byteOffset,r.byteOffset+r.byteLength):e}try{let r=j5(),e=r.BufferUtil||r;gF.exports={concat:W5,mask(t,n,i,o,s){s<48?V5(t,n,i,o,s):e.mask(t,n,i,o,s)},toArrayBuffer:q5,toBuffer:I_,unmask(t,n){t.length<32?B5(t,n):e.unmask(t,n)}}}catch{gF.exports={concat:W5,mask:V5,toArrayBuffer:q5,toBuffer:I_,unmask:B5}}});var DC=N((A5e,z5)=>{"use strict";var rge=I5(),PC=require("zlib"),J5=S_(),{kStatusCode:$5,NOOP:nge}=pf(),ige=Buffer.from([0,0,255,255]),oge=Buffer.from([0]),C_=Symbol("permessage-deflate"),lu=Symbol("total-length"),H5=Symbol("callback"),cd=Symbol("buffers"),vF=Symbol("error"),x_,yF=class{constructor(e,t,n){if(this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!x_){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;x_=new rge({concurrency:i})}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate&&(this._deflate.close(),this._deflate=null)}acceptAsServer(e){let t=this._options,n=e.find(i=>!(t.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>i.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(n=>{var i=t[n];if(i.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(i=i[0],n==="client_max_window_bits"){if(i!==!0){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else if(n==="server_max_window_bits"){let o=+i;if(!Number.isInteger(o)||o<8||o>15)throw new TypeError(`Invalid value for parameter "${n}": ${i}`);i=o}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${i}`)}else throw new Error(`Unknown parameter "${n}"`);t[n]=i})}),e}decompress(e,t,n){x_.push(i=>{this._decompress(e,t,(o,s)=>{i(),n(o,s)})})}compress(e,t,n){x_.push(i=>{this._compress(e,t,(o,s)=>{i(),n(o,s)})})}_decompress(e,t,n){let i=this._isServer?"client":"server";if(!this._inflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?PC.Z_DEFAULT_WINDOWBITS:this.params[o];this._inflate=PC.createInflateRaw(Object.assign({},this._options.zlibInflateOptions,{windowBits:s})),this._inflate[C_]=this,this._inflate[lu]=0,this._inflate[cd]=[],this._inflate.on("error",age),this._inflate.on("data",G5)}this._inflate[H5]=n,this._inflate.write(e),t&&this._inflate.write(ige),this._inflate.flush(()=>{let o=this._inflate[vF];if(o){this._inflate.close(),this._inflate=null,n(o);return}let s=J5.concat(this._inflate[cd],this._inflate[lu]);t&&this.params[`${i}_no_context_takeover`]?(this._inflate.close(),this._inflate=null):(this._inflate[lu]=0,this._inflate[cd]=[]),n(null,s)})}_compress(e,t,n){if(!e||e.length===0){process.nextTick(n,null,oge);return}let i=this._isServer?"server":"client";if(!this._deflate){let o=`${i}_max_window_bits`,s=typeof this.params[o]!="number"?PC.Z_DEFAULT_WINDOWBITS:this.params[o];this._deflate=PC.createDeflateRaw(Object.assign({},this._options.zlibDeflateOptions,{windowBits:s})),this._deflate[lu]=0,this._deflate[cd]=[],this._deflate.on("error",nge),this._deflate.on("data",sge)}this._deflate.write(e),this._deflate.flush(PC.Z_SYNC_FLUSH,()=>{if(this._deflate){var o=J5.concat(this._deflate[cd],this._deflate[lu]);t&&(o=o.slice(0,o.length-4)),t&&this.params[`${i}_no_context_takeover`]?(this._deflate.close(),this._deflate=null):(this._deflate[lu]=0,this._deflate[cd]=[]),n(null,o)}})}};z5.exports=yF;function sge(r){this[cd].push(r),this[lu]+=r.length}function G5(r){if(this[lu]+=r.length,this[C_]._maxPayload<1||this[lu]<=this[C_]._maxPayload){this[cd].push(r);return}this[vF]=new RangeError("Max payload size exceeded"),this[vF][$5]=1009,this.removeListener("data",G5),this.reset()}function age(r){this[C_]._inflate=null,r[$5]=1007,this[H5](r)}});var Y5=N((N5e,Q5)=>{"use strict";var Ey=class{constructor(e,t){this.target=t,this.type=e}},bF=class extends Ey{constructor(e,t){super("message",t),this.data=e}},IF=class extends Ey{constructor(e,t,n){super("close",n),this.wasClean=n._closeFrameReceived&&n._closeFrameSent,this.reason=t,this.code=e}},SF=class extends Ey{constructor(e){super("open",e)}},xF=class extends Ey{constructor(e,t){super("error",t),this.message=e.message,this.error=e}},lge={addEventListener(r,e){if(typeof e!="function")return;function t(s){e.call(this,new bF(s,this))}function n(s,a){e.call(this,new IF(s,a,this))}function i(s){e.call(this,new xF(s,this))}function o(){e.call(this,new SF(this))}r==="message"?(t._listener=e,this.on(r,t)):r==="close"?(n._listener=e,this.on(r,n)):r==="error"?(i._listener=e,this.on(r,i)):r==="open"?(o._listener=e,this.on(r,o)):this.on(r,e)},removeEventListener(r,e){let t=this.listeners(r);for(var n=0;n<t.length;n++)(t[n]===e||t[n]._listener===e)&&this.removeListener(r,t[n])}};Q5.exports=lge});var CF=N((M5e,X5)=>{"use strict";var _C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function ec(r,e,t){Object.prototype.hasOwnProperty.call(r,e)?r[e].push(t):r[e]=[t]}function cge(r){let e={};if(r===void 0||r==="")return e;for(var t={},n=!1,i=!1,o=!1,s,a,l=-1,c=-1,u=0;u<r.length;u++){let g=r.charCodeAt(u);if(s===void 0)if(c===-1&&_C[g]===1)l===-1&&(l=u);else if(g===32||g===9)c===-1&&l!==-1&&(c=u);else if(g===59||g===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u);let v=r.slice(l,c);g===44?(ec(e,v,t),t={}):s=v,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${u}`);else if(a===void 0)if(c===-1&&_C[g]===1)l===-1&&(l=u);else if(g===32||g===9)c===-1&&l!==-1&&(c=u);else if(g===59||g===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u),ec(t,r.slice(l,c),!0),g===44&&(ec(e,s,t),t={},s=void 0),l=c=-1}else if(g===61&&l!==-1&&c===-1)a=r.slice(l,u),l=c=-1;else throw new SyntaxError(`Unexpected character at index ${u}`);else if(i){if(_C[g]!==1)throw new SyntaxError(`Unexpected character at index ${u}`);l===-1?l=u:n||(n=!0),i=!1}else if(o)if(_C[g]===1)l===-1&&(l=u);else if(g===34&&l!==-1)o=!1,c=u;else if(g===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${u}`);else if(g===34&&r.charCodeAt(u-1)===61)o=!0;else if(c===-1&&_C[g]===1)l===-1&&(l=u);else if(l!==-1&&(g===32||g===9))c===-1&&(c=u);else if(g===59||g===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${u}`);c===-1&&(c=u);var p=r.slice(l,c);n&&(p=p.replace(/\\/g,""),n=!1),ec(t,a,p),g===44&&(ec(e,s,t),t={},s=void 0),a=void 0,l=c=-1}else throw new SyntaxError(`Unexpected character at index ${u}`)}if(l===-1||o)throw new SyntaxError("Unexpected end of input");c===-1&&(c=u);let f=r.slice(l,c);return s===void 0?ec(e,f,{}):(a===void 0?ec(t,f,!0):n?ec(t,a,f.replace(/\\/g,"")):ec(t,a,f),ec(e,s,t)),e}function uge(r){return Object.keys(r).map(e=>{var t=r[e];return Array.isArray(t)||(t=[t]),t.map(n=>[e].concat(Object.keys(n).map(i=>{var o=n[i];return Array.isArray(o)||(o=[o]),o.map(s=>s===!0?i:`${i}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}X5.exports={format:uge,parse:cge}});var eH=N((O5e,Z5)=>{"use strict";function pge(r){let e=r.length,t=0;for(;t<e;)if(!(r[t]&128))t++;else if((r[t]&224)===192){if(t+1===e||(r[t+1]&192)!==128||(r[t]&254)===192)return!1;t+=2}else if((r[t]&240)===224){if(t+2>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||r[t]===224&&(r[t+1]&224)===128||r[t]===237&&(r[t+1]&224)===160)return!1;t+=3}else if((r[t]&248)===240){if(t+3>=e||(r[t+1]&192)!==128||(r[t+2]&192)!==128||(r[t+3]&192)!==128||r[t]===240&&(r[t+1]&240)===128||r[t]===244&&r[t+1]>143||r[t]>244)return!1;t+=4}else return!1;return!0}Z5.exports=pge});var tH=N((K5e,wF)=>{"use strict";try{wF.exports=fF()(__dirname)}catch{wF.exports=eH()}});var EF=N(w_=>{"use strict";try{let r=tH();w_.isValidUTF8=typeof r=="object"?r.Validation.isValidUTF8:r}catch{w_.isValidUTF8=()=>!0}w_.isValidStatusCode=r=>r>=1e3&&r<=1013&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999});var _F=N((L5e,aH)=>{"use strict";var{Writable:dge}=require("stream"),rH=DC(),{BINARY_TYPES:mge,EMPTY_BUFFER:fge,kStatusCode:hge,kWebSocket:gge}=pf(),{concat:kF,toArrayBuffer:vge,unmask:yge}=S_(),{isValidStatusCode:bge,isValidUTF8:nH}=EF(),TC=0,iH=1,oH=2,sH=3,PF=4,Ige=5,DF=class extends dge{constructor(e,t,n){super(),this._binaryType=e||mge[0],this[gge]=void 0,this._extensions=t||{},this._maxPayload=n|0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=TC,this._loop=!1}_write(e,t,n){if(this._opcode===8&&this._state==TC)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=n.slice(e),n.slice(0,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0];e>=n.length?this._buffers.shift().copy(t,t.length-e):(n.copy(t,t.length-e,0,e),this._buffers[0]=n.slice(e)),e-=n.length}while(e>0);return t}startLoop(e){var t;this._loop=!0;do switch(this._state){case TC:t=this.getInfo();break;case iH:t=this.getPayloadLength16();break;case oH:t=this.getPayloadLength64();break;case sH:this.getMask();break;case PF:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}let e=this.consume(2);if(e[0]&48)return this._loop=!1,gi(RangeError,"RSV2 and RSV3 must be clear",!0,1002);let t=(e[0]&64)===64;if(t&&!this._extensions[rH.extensionName])return this._loop=!1,gi(RangeError,"RSV1 must be clear",!0,1002);if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,gi(RangeError,"RSV1 must be clear",!0,1002);if(!this._fragmented)return this._loop=!1,gi(RangeError,"invalid opcode 0",!0,1002);this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,gi(RangeError,`invalid opcode ${this._opcode}`,!0,1002);this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,gi(RangeError,"FIN must be set",!0,1002);if(t)return this._loop=!1,gi(RangeError,"RSV1 must be clear",!0,1002);if(this._payloadLength>125)return this._loop=!1,gi(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002)}else return this._loop=!1,gi(RangeError,`invalid opcode ${this._opcode}`,!0,1002);if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._payloadLength===126)this._state=iH;else if(this._payloadLength===127)this._state=oH;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}let e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,53-32)-1?(this._loop=!1,gi(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009)):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,gi(RangeError,"Max payload size exceeded",!1,1009);this._masked?this._state=sH:this._state=PF}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=PF}getData(e){var t=fge;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&yge(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=Ige,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[rH.extensionName].decompress(e,this._fin,(i,o)=>{if(i)return t(i);if(o.length){if(this._messageLength+=o.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(gi(RangeError,"Max payload size exceeded",!1,1009));this._fragments.push(o)}let s=this.dataMessage();if(s)return t(s);this.startLoop(t)})}dataMessage(){if(this._fin){let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){var e;this._binaryType==="nodebuffer"?e=kF(n,t):this._binaryType==="arraybuffer"?e=vge(kF(n,t)):e=n,this.emit("message",e)}else{let i=kF(n,t);if(!nH(i))return this._loop=!1,gi(Error,"invalid UTF-8 sequence",!0,1007);this.emit("message",i.toString())}}this._state=TC}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,""),this.end();else{if(e.length===1)return gi(RangeError,"invalid payload length 1",!0,1002);{let t=e.readUInt16BE(0);if(!bge(t))return gi(RangeError,`invalid status code ${t}`,!0,1002);let n=e.slice(2);if(!nH(n))return gi(Error,"invalid UTF-8 sequence",!0,1007);this.emit("conclude",t,n.toString()),this.end()}}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=TC}};aH.exports=DF;function gi(r,e,t,n){let i=new r(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(i,gi),i[hge]=n,i}});var RF=N((U5e,uH)=>{"use strict";var{randomBytes:Sge}=require("crypto"),lH=DC(),{EMPTY_BUFFER:xge}=pf(),{isValidStatusCode:Cge}=EF(),{mask:cH,toBuffer:cu}=S_(),TF=class r{constructor(e,t){this._extensions=t||{},this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let n=t.mask&&t.readOnly;var i=t.mask?6:2,o=e.length;e.length>=65536?(i+=8,o=127):e.length>125&&(i+=2,o=126);let s=Buffer.allocUnsafe(n?e.length+i:i);if(s[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(s[0]|=64),s[1]=o,o===126?s.writeUInt16BE(e.length,2):o===127&&(s.writeUInt32BE(0,2),s.writeUInt32BE(e.length,6)),!t.mask)return[s,e];let a=Sge(4);return s[1]|=128,s[i-4]=a[0],s[i-3]=a[1],s[i-2]=a[2],s[i-1]=a[3],n?(cH(e,a,s,i,e.length),[s]):(cH(e,a,e,0,e.length),[s,e])}close(e,t,n,i){var o;if(e===void 0)o=xge;else{if(typeof e!="number"||!Cge(e))throw new TypeError("First argument must be a valid error code number");t===void 0||t===""?(o=Buffer.allocUnsafe(2),o.writeUInt16BE(e,0)):(o=Buffer.allocUnsafe(2+Buffer.byteLength(t)),o.writeUInt16BE(e,0),o.write(t,2))}this._deflating?this.enqueue([this.doClose,o,n,i]):this.doClose(o,n,i)}doClose(e,t,n){this.sendFrame(r.frame(e,{fin:!0,rsv1:!1,opcode:8,mask:t,readOnly:!1}),n)}ping(e,t,n){let i=cu(e);this._deflating?this.enqueue([this.doPing,i,t,cu.readOnly,n]):this.doPing(i,t,cu.readOnly,n)}doPing(e,t,n,i){this.sendFrame(r.frame(e,{fin:!0,rsv1:!1,opcode:9,mask:t,readOnly:n}),i)}pong(e,t,n){let i=cu(e);this._deflating?this.enqueue([this.doPong,i,t,cu.readOnly,n]):this.doPong(i,t,cu.readOnly,n)}doPong(e,t,n,i){this.sendFrame(r.frame(e,{fin:!0,rsv1:!1,opcode:10,mask:t,readOnly:n}),i)}send(e,t,n){let i=cu(e),o=this._extensions[lH.extensionName];var s=t.binary?2:1,a=t.compress;if(this._firstFragment?(this._firstFragment=!1,a&&o&&(a=i.length>=o._threshold),this._compress=a):(a=!1,s=0),t.fin&&(this._firstFragment=!0),o){let l={fin:t.fin,rsv1:a,opcode:s,mask:t.mask,readOnly:cu.readOnly};this._deflating?this.enqueue([this.dispatch,i,this._compress,l,n]):this.dispatch(i,this._compress,l,n)}else this.sendFrame(r.frame(i,{fin:t.fin,rsv1:!1,opcode:s,mask:t.mask,readOnly:cu.readOnly}),n)}dispatch(e,t,n,i){if(!t){this.sendFrame(r.frame(e,n),i);return}let o=this._extensions[lH.extensionName];this._deflating=!0,o.compress(e,n.fin,(s,a)=>{this._deflating=!1,n.readOnly=!1,this.sendFrame(r.frame(a,n),i),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[1].length,e[0].apply(this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[1].length,this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};uH.exports=TF});var MF=N((j5e,SH)=>{"use strict";var wge=require("events"),pH=require("crypto"),Ege=require("https"),kge=require("http"),Pge=require("net"),Dge=require("tls"),ky=require("url"),ud=DC(),hH=Y5(),dH=CF(),_ge=_F(),Tge=RF(),{BINARY_TYPES:mH,EMPTY_BUFFER:AF,GUID:Rge,kStatusCode:Age,kWebSocket:Ro,NOOP:gH}=pf(),E_=["CONNECTING","OPEN","CLOSING","CLOSED"],NF=[8,13],Nge=30*1e3,Ao=class r extends wge{constructor(e,t,n){super(),this.readyState=r.CONNECTING,this.protocol="",this._binaryType=mH[0],this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage="",this._closeTimer=null,this._closeCode=1006,this._extensions={},this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._isServer=!1,this._redirects=0,Array.isArray(t)?t=t.join(", "):typeof t=="object"&&t!==null&&(n=t,t=void 0),vH(this,e,t,n)):this._isServer=!0}get CONNECTING(){return r.CONNECTING}get CLOSING(){return r.CLOSING}get CLOSED(){return r.CLOSED}get OPEN(){return r.OPEN}get binaryType(){return this._binaryType}set binaryType(e){mH.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?(this._socket.bufferSize||0)+this._sender._bufferedBytes:0}get extensions(){return Object.keys(this._extensions).join()}setSocket(e,t,n){let i=new _ge(this._binaryType,this._extensions,n);this._sender=new Tge(e,this._extensions),this._receiver=i,this._socket=e,i[Ro]=this,e[Ro]=this,i.on("conclude",Kge),i.on("drain",Fge),i.on("error",Lge),i.on("message",Uge),i.on("ping",jge),i.on("pong",Wge),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",yH),e.on("data",k_),e.on("end",bH),e.on("error",IH),this.readyState=r.OPEN,this.emit("open")}emitClose(){if(this.readyState=r.CLOSED,!this._socket){this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[ud.extensionName]&&this._extensions[ud.extensionName].cleanup(),this._receiver.removeAllListeners(),this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let n="WebSocket was closed before the connection was established";return uu(this,this._req,n)}if(this.readyState===r.CLOSING){this._closeFrameSent&&this._closeFrameReceived&&this._socket.end();return}this.readyState=r.CLOSING,this._sender.close(e,t,!this._isServer,n=>{n||(this._closeFrameSent=!0,this._closeFrameReceived&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Nge)}}ping(e,t,n){if(typeof e=="function"?(n=e,e=t=void 0):typeof t=="function"&&(n=t,t=void 0),this.readyState!==r.OPEN){let i=new Error(`WebSocket is not open: readyState ${this.readyState} (${E_[this.readyState]})`);if(n)return n(i);throw i}typeof e=="number"&&(e=e.toString()),t===void 0&&(t=!this._isServer),this._sender.ping(e||AF,t,n)}pong(e,t,n){if(typeof e=="function"?(n=e,e=t=void 0):typeof t=="function"&&(n=t,t=void 0),this.readyState!==r.OPEN){let i=new Error(`WebSocket is not open: readyState ${this.readyState} (${E_[this.readyState]})`);if(n)return n(i);throw i}typeof e=="number"&&(e=e.toString()),t===void 0&&(t=!this._isServer),this._sender.pong(e||AF,t,n)}send(e,t,n){if(typeof t=="function"&&(n=t,t={}),this.readyState!==r.OPEN){let o=new Error(`WebSocket is not open: readyState ${this.readyState} (${E_[this.readyState]})`);if(n)return n(o);throw o}typeof e=="number"&&(e=e.toString());let i=Object.assign({binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0},t);this._extensions[ud.extensionName]||(i.compress=!1),this._sender.send(e||AF,i,n)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){let e="WebSocket was closed before the connection was established";return uu(this,this._req,e)}this._socket&&(this.readyState=r.CLOSING,this._socket.destroy())}}};E_.forEach((r,e)=>{Ao[r]=e});["open","error","close","message"].forEach(r=>{Object.defineProperty(Ao.prototype,`on${r}`,{get(){let e=this.listeners(r);for(var t=0;t<e.length;t++)if(e[t]._listener)return e[t]._listener},set(e){let t=this.listeners(r);for(var n=0;n<t.length;n++)t[n]._listener&&this.removeListener(r,t[n]);this.addEventListener(r,e)}})});Ao.prototype.addEventListener=hH.addEventListener;Ao.prototype.removeEventListener=hH.removeEventListener;SH.exports=Ao;function vH(r,e,t,n){let i=Object.assign({protocolVersion:NF[1],maxPayload:104857600,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10},n,{createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:void 0,auth:void 0,host:void 0,path:void 0,port:void 0});if(!NF.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${NF.join(", ")})`);var o;typeof e=="object"&&e.href!==void 0?(o=e,r.url=e.href):(o=ky.URL?new ky.URL(e):ky.parse(e),r.url=e);let s=o.protocol==="ws+unix:";if(!o.host&&(!s||!o.pathname))throw new Error(`Invalid URL: ${r.url}`);let a=o.protocol==="wss:"||o.protocol==="https:",l=a?443:80,c=pH.randomBytes(16).toString("base64"),u=a?Ege.get:kge.get,p=o.search?`${o.pathname||"/"}${o.search}`:o.pathname||"/";var f;if(i.createConnection=a?Oge:Mge,i.defaultPort=i.defaultPort||l,i.port=o.port||l,i.host=o.hostname.startsWith("[")?o.hostname.slice(1,-1):o.hostname,i.headers=Object.assign({"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},i.headers),i.path=p,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(f=new ud(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=dH.format({[ud.extensionName]:f.offer()})),t&&(i.headers["Sec-WebSocket-Protocol"]=t),i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),o.auth?i.auth=o.auth:(o.username||o.password)&&(i.auth=`${o.username}:${o.password}`),s){let v=p.split(":");i.socketPath=v[0],i.path=v[1]}var g=r._req=u(i);i.timeout&&g.on("timeout",()=>{uu(r,g,"Opening handshake has timed out")}),g.on("error",v=>{r._req.aborted||(g=r._req=null,r.readyState=Ao.CLOSING,r.emit("error",v),r.emitClose())}),g.on("response",v=>{let b=v.headers.location,C=v.statusCode;if(b&&i.followRedirects&&C>=300&&C<400){if(++r._redirects>i.maxRedirects){uu(r,g,"Maximum redirects exceeded");return}g.abort();let E=ky.URL?new ky.URL(b,e):ky.resolve(e,b);vH(r,E,t,n)}else r.emit("unexpected-response",g,v)||uu(r,g,`Unexpected server response: ${v.statusCode}`)}),g.on("upgrade",(v,b,C)=>{if(r.emit("upgrade",v),r.readyState!==Ao.CONNECTING)return;g=r._req=null;let E=pH.createHash("sha1").update(c+Rge).digest("base64");if(v.headers["sec-websocket-accept"]!==E){uu(r,b,"Invalid Sec-WebSocket-Accept header");return}let R=v.headers["sec-websocket-protocol"],_=(t||"").split(/, */);var L;if(!t&&R?L="Server sent a subprotocol but none was requested":t&&!R?L="Server sent no subprotocol":R&&!_.includes(R)&&(L="Server sent an invalid subprotocol"),L){uu(r,b,L);return}if(R&&(r.protocol=R),f)try{let te=dH.parse(v.headers["sec-websocket-extensions"]);te[ud.extensionName]&&(f.accept(te[ud.extensionName]),r._extensions[ud.extensionName]=f)}catch{uu(r,b,"Invalid Sec-WebSocket-Extensions header");return}r.setSocket(b,C,i.maxPayload)})}function Mge(r){return r.protocolVersion&&(r.path=r.socketPath),Pge.connect(r)}function Oge(r){return r.path=void 0,r.servername=r.servername||r.host,Dge.connect(r)}function uu(r,e,t){r.readyState=Ao.CLOSING;let n=new Error(t);Error.captureStackTrace(n,uu),e.setHeader?(e.abort(),e.once("abort",r.emitClose.bind(r)),r.emit("error",n)):(e.destroy(n),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Kge(r,e){let t=this[Ro];t._socket.removeListener("data",k_),t._socket.resume(),t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=r,r===1005?t.close():t.close(r,e)}function Fge(){this[Ro]._socket.resume()}function Lge(r){let e=this[Ro];e._socket.removeListener("data",k_),e.readyState=Ao.CLOSING,e._closeCode=r[Age],e.emit("error",r),e._socket.destroy()}function fH(){this[Ro].emitClose()}function Uge(r){this[Ro].emit("message",r)}function jge(r){let e=this[Ro];e.pong(r,!e._isServer,gH),e.emit("ping",r)}function Wge(r){this[Ro].emit("pong",r)}function yH(){let r=this[Ro];this.removeListener("close",yH),this.removeListener("end",bH),r.readyState=Ao.CLOSING,r._socket.read(),r._receiver.end(),this.removeListener("data",k_),this[Ro]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",fH),r._receiver.on("finish",fH))}function k_(r){this[Ro]._receiver.write(r)||this.pause()}function bH(){let r=this[Ro];r.readyState=Ao.CLOSING,r._receiver.end(),this.end()}function IH(){let r=this[Ro];this.removeListener("error",IH),this.on("error",gH),r.readyState=Ao.CLOSING,this.destroy()}});var wH=N((W5e,CH)=>{"use strict";var Vge=require("events"),Bge=require("crypto"),D_=require("http"),df=DC(),xH=CF(),qge=MF(),{GUID:Jge}=pf(),$ge=/^[+/0-9A-Za-z]{22}==$/,OF=class extends Vge{constructor(e,t){if(super(),e=Object.assign({maxPayload:100*1024*1024,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null},e),e.port==null&&!e.server&&!e.noServer)throw new TypeError('One of the "port", "server", or "noServer" options must be specified');e.port!=null?(this._server=D_.createServer((n,i)=>{let o=D_.STATUS_CODES[426];i.writeHead(426,{"Content-Length":o.length,"Content-Type":"text/plain"}),i.end(o)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server&&(this._removeListeners=Hge(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(n,i,o)=>{this.handleUpgrade(n,i,o,s=>{this.emit("connection",s,n)})}})),e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set),this.options=e}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(e&&this.once("close",e),this.clients)for(let n of this.clients)n.terminate();let t=this._server;if(t&&(this._removeListeners(),this._removeListeners=this._server=null,this.options.port!=null)){t.close(()=>this.emit("close"));return}process.nextTick(Gge,this)}shouldHandle(e){if(this.options.path){let t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,i){t.on("error",KF);let o=e.headers["sec-websocket-key"]!==void 0?e.headers["sec-websocket-key"].trim():!1,s=+e.headers["sec-websocket-version"],a={};if(e.method!=="GET"||e.headers.upgrade.toLowerCase()!=="websocket"||!o||!$ge.test(o)||s!==8&&s!==13||!this.shouldHandle(e))return P_(t,400);if(this.options.perMessageDeflate){let l=new df(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let c=xH.parse(e.headers["sec-websocket-extensions"]);c[df.extensionName]&&(l.accept(c[df.extensionName]),a[df.extensionName]=l)}catch{return P_(t,400)}}if(this.options.verifyClient){let l={origin:e.headers[`${s===8?"sec-websocket-origin":"origin"}`],secure:!!(e.connection.authorized||e.connection.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(l,(c,u,p,f)=>{if(!c)return P_(t,u||401,p,f);this.completeUpgrade(o,a,e,t,n,i)});return}if(!this.options.verifyClient(l))return P_(t,401)}this.completeUpgrade(o,a,e,t,n,i)}completeUpgrade(e,t,n,i,o,s){if(!i.readable||!i.writable)return i.destroy();let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Bge.createHash("sha1").update(e+Jge).digest("base64")}`],c=new qge(null);var u=n.headers["sec-websocket-protocol"];if(u&&(u=u.split(",").map(zge),this.options.handleProtocols?u=this.options.handleProtocols(u,n):u=u[0],u&&(l.push(`Sec-WebSocket-Protocol: ${u}`),c.protocol=u)),t[df.extensionName]){let p=t[df.extensionName].params,f=xH.format({[df.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${f}`),c._extensions=t}this.emit("headers",l,n),i.write(l.concat(`\r
|
||
`).join(`\r
|
||
`)),i.removeListener("error",KF),c.setSocket(i,o,this.options.maxPayload),this.clients&&(this.clients.add(c),c.on("close",()=>this.clients.delete(c))),s(c)}};CH.exports=OF;function Hge(r,e){for(let t of Object.keys(e))r.on(t,e[t]);return function(){for(let n of Object.keys(e))r.removeListener(n,e[n])}}function Gge(r){r.emit("close")}function KF(){this.destroy()}function P_(r,e,t,n){r.writable&&(t=t||D_.STATUS_CODES[e],n=Object.assign({Connection:"close","Content-type":"text/html","Content-Length":Buffer.byteLength(t)},n),r.write(`HTTP/1.1 ${e} ${D_.STATUS_CODES[e]}\r
|
||
`+Object.keys(n).map(i=>`${i}: ${n[i]}`).join(`\r
|
||
`)+`\r
|
||
\r
|
||
`+t)),r.removeListener("error",KF),r.destroy()}function zge(r){return r.trim()}});var kH=N((V5e,EH)=>{"use strict";var __=MF();__.Server=wH();__.Receiver=_F();__.Sender=RF();EH.exports=__});var DH=N((B5e,PH)=>{"use strict";PH.exports=kH()});var OH=N((M_,MH)=>{(function(r,e){typeof M_=="object"&&typeof MH<"u"?e(M_):typeof define=="function"&&define.amd?define(["exports"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.lumino_algorithm={}))})(M_,function(r){"use strict";r.ArrayExt=void 0,function(F){function j(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(Z===0)return-1;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);var we;V<W?we=V+1+(Z-W):we=V-W+1;for(var Ne=0;Ne<we;++Ne){var cr=(W+Ne)%Z;if(re[cr]===ue)return cr}return-1}F.firstIndexOf=j;function he(re,ue,W,V){W===void 0&&(W=-1),V===void 0&&(V=0);var Z=re.length;if(Z===0)return-1;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);var we;W<V?we=W+1+(Z-V):we=W-V+1;for(var Ne=0;Ne<we;++Ne){var cr=(W-Ne+Z)%Z;if(re[cr]===ue)return cr}return-1}F.lastIndexOf=he;function Ae(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(Z===0)return-1;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);var we;V<W?we=V+1+(Z-W):we=V-W+1;for(var Ne=0;Ne<we;++Ne){var cr=(W+Ne)%Z;if(ue(re[cr],cr))return cr}return-1}F.findFirstIndex=Ae;function Ze(re,ue,W,V){W===void 0&&(W=-1),V===void 0&&(V=0);var Z=re.length;if(Z===0)return-1;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);var we;W<V?we=W+1+(Z-V):we=W-V+1;for(var Ne=0;Ne<we;++Ne){var cr=(W-Ne+Z)%Z;if(ue(re[cr],cr))return cr}return-1}F.findLastIndex=Ze;function nn(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=Ae(re,ue,W,V);return Z!==-1?re[Z]:void 0}F.findFirstValue=nn;function qt(re,ue,W,V){W===void 0&&(W=-1),V===void 0&&(V=0);var Z=Ze(re,ue,W,V);return Z!==-1?re[Z]:void 0}F.findLastValue=qt;function Ft(re,ue,W,V,Z){V===void 0&&(V=0),Z===void 0&&(Z=-1);var we=re.length;if(we===0)return 0;V<0?V=Math.max(0,V+we):V=Math.min(V,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);for(var Ne=V,cr=Z-V+1;cr>0;){var xi=cr>>1,Tc=Ne+xi;W(re[Tc],ue)<0?(Ne=Tc+1,cr-=xi+1):cr=xi}return Ne}F.lowerBound=Ft;function Rt(re,ue,W,V,Z){V===void 0&&(V=0),Z===void 0&&(Z=-1);var we=re.length;if(we===0)return 0;V<0?V=Math.max(0,V+we):V=Math.min(V,we-1),Z<0?Z=Math.max(0,Z+we):Z=Math.min(Z,we-1);for(var Ne=V,cr=Z-V+1;cr>0;){var xi=cr>>1,Tc=Ne+xi;W(re[Tc],ue)>0?cr=xi:(Ne=Tc+1,cr-=xi+1)}return Ne}F.upperBound=Rt;function Cr(re,ue,W){if(re===ue)return!0;if(re.length!==ue.length)return!1;for(var V=0,Z=re.length;V<Z;++V)if(W?!W(re[V],ue[V]):re[V]!==ue[V])return!1;return!0}F.shallowEqual=Cr;function qr(re,ue){ue===void 0&&(ue={});var W=ue.start,V=ue.stop,Z=ue.step;if(Z===void 0&&(Z=1),Z===0)throw new Error("Slice `step` cannot be zero.");var we=re.length;W===void 0?W=Z<0?we-1:0:W<0?W=Math.max(W+we,Z<0?-1:0):W>=we&&(W=Z<0?we-1:we),V===void 0?V=Z<0?-1:we:V<0?V=Math.max(V+we,Z<0?-1:0):V>=we&&(V=Z<0?we-1:we);var Ne;Z<0&&V>=W||Z>0&&W>=V?Ne=0:Z<0?Ne=Math.floor((V-W+1)/Z+1):Ne=Math.floor((V-W-1)/Z+1);for(var cr=[],xi=0;xi<Ne;++xi)cr[xi]=re[W+xi*Z];return cr}F.slice=qr;function Dr(re,ue,W){var V=re.length;if(!(V<=1)&&(ue<0?ue=Math.max(0,ue+V):ue=Math.min(ue,V-1),W<0?W=Math.max(0,W+V):W=Math.min(W,V-1),ue!==W)){for(var Z=re[ue],we=ue<W?1:-1,Ne=ue;Ne!==W;Ne+=we)re[Ne]=re[Ne+we];re[W]=Z}}F.move=Dr;function on(re,ue,W){ue===void 0&&(ue=0),W===void 0&&(W=-1);var V=re.length;if(!(V<=1))for(ue<0?ue=Math.max(0,ue+V):ue=Math.min(ue,V-1),W<0?W=Math.max(0,W+V):W=Math.min(W,V-1);ue<W;){var Z=re[ue],we=re[W];re[ue++]=we,re[W--]=Z}}F.reverse=on;function J(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(!(Z<=1)&&(W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1),!(W>=V))){var we=V-W+1;if(ue>0?ue=ue%we:ue<0&&(ue=(ue%we+we)%we),ue!==0){var Ne=W+ue;on(re,W,Ne-1),on(re,Ne,V),on(re,W,V)}}}F.rotate=J;function ee(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(Z!==0){W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);var we;V<W?we=V+1+(Z-W):we=V-W+1;for(var Ne=0;Ne<we;++Ne)re[(W+Ne)%Z]=ue}}F.fill=ee;function de(re,ue,W){var V=re.length;ue<0?ue=Math.max(0,ue+V):ue=Math.min(ue,V);for(var Z=V;Z>ue;--Z)re[Z]=re[Z-1];re[ue]=W}F.insert=de;function Ie(re,ue){var W=re.length;if(ue<0&&(ue+=W),!(ue<0||ue>=W)){for(var V=re[ue],Z=ue+1;Z<W;++Z)re[Z-1]=re[Z];return re.length=W-1,V}}F.removeAt=Ie;function Je(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=j(re,ue,W,V);return Z!==-1&&Ie(re,Z),Z}F.removeFirstOf=Je;function sn(re,ue,W,V){W===void 0&&(W=-1),V===void 0&&(V=0);var Z=he(re,ue,W,V);return Z!==-1&&Ie(re,Z),Z}F.removeLastOf=sn;function Ct(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(Z===0)return 0;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);for(var we=0,Ne=0;Ne<Z;++Ne)W<=V&&Ne>=W&&Ne<=V&&re[Ne]===ue||V<W&&(Ne<=V||Ne>=W)&&re[Ne]===ue?we++:we>0&&(re[Ne-we]=re[Ne]);return we>0&&(re.length=Z-we),we}F.removeAllOf=Ct;function Pt(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z,we=Ae(re,ue,W,V);return we!==-1&&(Z=Ie(re,we)),{index:we,value:Z}}F.removeFirstWhere=Pt;function et(re,ue,W,V){W===void 0&&(W=-1),V===void 0&&(V=0);var Z,we=Ze(re,ue,W,V);return we!==-1&&(Z=Ie(re,we)),{index:we,value:Z}}F.removeLastWhere=et;function Kt(re,ue,W,V){W===void 0&&(W=0),V===void 0&&(V=-1);var Z=re.length;if(Z===0)return 0;W<0?W=Math.max(0,W+Z):W=Math.min(W,Z-1),V<0?V=Math.max(0,V+Z):V=Math.min(V,Z-1);for(var we=0,Ne=0;Ne<Z;++Ne)W<=V&&Ne>=W&&Ne<=V&&ue(re[Ne],Ne)||V<W&&(Ne<=V||Ne>=W)&&ue(re[Ne],Ne)?we++:we>0&&(re[Ne-we]=re[Ne]);return we>0&&(re.length=Z-we),we}F.removeAllWhere=Kt}(r.ArrayExt||(r.ArrayExt={}));function e(F){var j;return typeof F.iter=="function"?j=F.iter():j=new p(F),j}function t(F){return new f(F)}function n(F){return new g(F)}function i(F){return new v(F)}function o(F){return new b(F)}function s(F,j){for(var he=0,Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)if(j(Ze,he++)===!1)return}function a(F,j){for(var he=0,Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)if(!j(Ze,he++))return!1;return!0}function l(F,j){for(var he=0,Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)if(j(Ze,he++))return!0;return!1}function c(F){for(var j=0,he=[],Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)he[j++]=Ze;return he}function u(F){for(var j=e(F),he,Ae={};(he=j.next())!==void 0;)Ae[he[0]]=he[1];return Ae}var p=function(){function F(j){this._index=0,this._source=j}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},F}(),f=function(){function F(j,he){he===void 0&&(he=Object.keys(j)),this._index=0,this._source=j,this._keys=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source,this._keys);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index>=this._keys.length)){var j=this._keys[this._index++];return j in this._source?j:this.next()}},F}(),g=function(){function F(j,he){he===void 0&&(he=Object.keys(j)),this._index=0,this._source=j,this._keys=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source,this._keys);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index>=this._keys.length)){var j=this._keys[this._index++];return j in this._source?this._source[j]:this.next()}},F}(),v=function(){function F(j,he){he===void 0&&(he=Object.keys(j)),this._index=0,this._source=j,this._keys=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source,this._keys);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index>=this._keys.length)){var j=this._keys[this._index++];return j in this._source?[j,this._source[j]]:this.next()}},F}(),b=function(){function F(j){this._fn=j}return F.prototype.iter=function(){return this},F.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},F.prototype.next=function(){return this._fn.call(void 0)},F}();function C(){for(var F=[],j=0;j<arguments.length;j++)F[j]=arguments[j];return new E(e(F.map(e)))}var E=function(){function F(j){this._cloned=!1,this._source=j,this._active=void 0}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source.clone());return j._active=this._active&&this._active.clone(),j._cloned=!0,this._cloned=!0,j},F.prototype.next=function(){if(this._active===void 0){var j=this._source.next();if(j===void 0)return;this._active=this._cloned?j.clone():j}var he=this._active.next();return he!==void 0?he:(this._active=void 0,this.next())},F}();function R(){return new _}var _=function(){function F(){}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F},F.prototype.next=function(){},F}();function L(F,j){return j===void 0&&(j=0),new te(e(F),j)}var te=function(){function F(j,he){this._source=j,this._index=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F(this._source.clone(),this._index)},F.prototype.next=function(){var j=this._source.next();if(j!==void 0)return[this._index++,j]},F}();function $(F,j){return new se(e(F),j)}var se=function(){function F(j,he){this._index=0,this._source=j,this._fn=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source.clone(),this._fn);return j._index=this._index,j},F.prototype.next=function(){for(var j=this._fn,he=this._source,Ae;(Ae=he.next())!==void 0;)if(j(Ae,this._index++))return Ae},F}();function ae(F,j){for(var he=0,Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)if(j(Ze,he++))return Ze}function X(F,j){for(var he=0,Ae=e(F),Ze;(Ze=Ae.next())!==void 0;)if(j(Ze,he++))return he-1;return-1}function be(F,j){var he=e(F),Ae=he.next();if(Ae!==void 0){for(var Ze=Ae;(Ae=he.next())!==void 0;)j(Ae,Ze)<0&&(Ze=Ae);return Ze}}function Me(F,j){var he=e(F),Ae=he.next();if(Ae!==void 0){for(var Ze=Ae;(Ae=he.next())!==void 0;)j(Ae,Ze)>0&&(Ze=Ae);return Ze}}function it(F,j){var he=e(F),Ae=he.next();if(Ae!==void 0){for(var Ze=Ae,nn=Ae;(Ae=he.next())!==void 0;)j(Ae,Ze)<0?Ze=Ae:j(Ae,nn)>0&&(nn=Ae);return[Ze,nn]}}function ut(F,j){return new Xe(e(F),j)}var Xe=function(){function F(j,he){this._index=0,this._source=j,this._fn=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source.clone(),this._fn);return j._index=this._index,j},F.prototype.next=function(){var j=this._source.next();if(j!==void 0)return this._fn.call(void 0,j,this._index++)},F}();function ne(F,j,he){return j===void 0?new Ce(0,F,1):he===void 0?new Ce(F,j,1):new Ce(F,j,he)}var Ce=function(){function F(j,he,Ae){this._index=0,this._start=j,this._stop=he,this._step=Ae,this._length=Q.rangeLength(j,he,Ae)}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._start,this._stop,this._step);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++},F}(),Q;(function(F){function j(he,Ae,Ze){return Ze===0?1/0:he>Ae&&Ze>0||he<Ae&&Ze<0?0:Math.ceil((Ae-he)/Ze)}F.rangeLength=j})(Q||(Q={}));function fe(F,j,he){var Ae=0,Ze=e(F),nn=Ze.next();if(nn===void 0&&he===void 0)throw new TypeError("Reduce of empty iterable with no initial value.");if(nn===void 0)return he;var qt=Ze.next();if(qt===void 0&&he===void 0)return nn;if(qt===void 0)return j(he,nn,Ae++);var Ft;he===void 0?Ft=j(nn,qt,Ae++):Ft=j(j(he,nn,Ae++),qt,Ae++);for(var Rt;(Rt=Ze.next())!==void 0;)Ft=j(Ft,Rt,Ae++);return Ft}function Le(F,j){return new xt(F,j)}function fn(F){return new xt(F,1)}var xt=function(){function F(j,he){this._value=j,this._count=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F(this._value,this._count)},F.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},F}();function Br(F){var j;return typeof F.retro=="function"?j=F.retro():j=new gs(F),j}var gs=function(){function F(j){this._source=j,this._index=j.length-1}return F.prototype.iter=function(){return this},F.prototype.clone=function(){var j=new F(this._source);return j._index=this._index,j},F.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},F}();function Ut(F){var j=[],he=new Set,Ae=new Map;return s(F,Ze),Ae.forEach(function(qt,Ft){nn(Ft)}),j;function Ze(qt){var Ft=qt[0],Rt=qt[1],Cr=Ae.get(Rt);Cr?Cr.push(Ft):Ae.set(Rt,[Ft])}function nn(qt){if(!he.has(qt)){he.add(qt);var Ft=Ae.get(qt);Ft&&Ft.forEach(nn),j.push(qt)}}}function rn(F,j){return new $i(e(F),j)}var $i=function(){function F(j,he){this._source=j,this._step=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F(this._source.clone(),this._step)},F.prototype.next=function(){for(var j=this._source.next(),he=this._step-1;he>0;--he)this._source.next();return j},F}();r.StringExt=void 0,function(F){function j(qt,Ft,Rt){Rt===void 0&&(Rt=0);for(var Cr=new Array(Ft.length),qr=0,Dr=Rt,on=Ft.length;qr<on;++qr,++Dr){if(Dr=qt.indexOf(Ft[qr],Dr),Dr===-1)return null;Cr[qr]=Dr}return Cr}F.findIndices=j;function he(qt,Ft,Rt){Rt===void 0&&(Rt=0);var Cr=j(qt,Ft,Rt);if(!Cr)return null;for(var qr=0,Dr=0,on=Cr.length;Dr<on;++Dr){var J=Cr[Dr]-Rt;qr+=J*J}return{score:qr,indices:Cr}}F.matchSumOfSquares=he;function Ae(qt,Ft,Rt){Rt===void 0&&(Rt=0);var Cr=j(qt,Ft,Rt);if(!Cr)return null;for(var qr=0,Dr=Rt-1,on=0,J=Cr.length;on<J;++on){var ee=Cr[on];qr+=ee-Dr-1,Dr=ee}return{score:qr,indices:Cr}}F.matchSumOfDeltas=Ae;function Ze(qt,Ft,Rt){for(var Cr=[],qr=0,Dr=0,on=Ft.length;qr<on;){for(var J=Ft[qr],ee=Ft[qr];++qr<on&&Ft[qr]===ee+1;)ee++;Dr<J&&Cr.push(qt.slice(Dr,J)),J<ee+1&&Cr.push(Rt(qt.slice(J,ee+1))),Dr=ee+1}return Dr<qt.length&&Cr.push(qt.slice(Dr)),Cr}F.highlight=Ze;function nn(qt,Ft){return qt<Ft?-1:qt>Ft?1:0}F.cmp=nn}(r.StringExt||(r.StringExt={}));function Tt(F,j){return new ar(e(F),j)}var ar=function(){function F(j,he){this._source=j,this._count=he}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F(this._source.clone(),this._count)},F.prototype.next=function(){if(!(this._count<=0)){var j=this._source.next();if(j!==void 0)return this._count--,j}},F}();function ii(){for(var F=[],j=0;j<arguments.length;j++)F[j]=arguments[j];return new _c(F.map(e))}var _c=function(){function F(j){this._source=j}return F.prototype.iter=function(){return this},F.prototype.clone=function(){return new F(this._source.map(function(j){return j.clone()}))},F.prototype.next=function(){for(var j=new Array(this._source.length),he=0,Ae=this._source.length;he<Ae;++he){var Ze=this._source[he].next();if(Ze===void 0)return;j[he]=Ze}return j},F}();r.ArrayIterator=p,r.ChainIterator=E,r.EmptyIterator=_,r.EnumerateIterator=te,r.FilterIterator=se,r.FnIterator=b,r.ItemIterator=v,r.KeyIterator=f,r.MapIterator=Xe,r.RangeIterator=Ce,r.RepeatIterator=xt,r.RetroArrayIterator=gs,r.StrideIterator=$i,r.TakeIterator=ar,r.ValueIterator=g,r.ZipIterator=_c,r.chain=C,r.each=s,r.empty=R,r.enumerate=L,r.every=a,r.filter=$,r.find=ae,r.findIndex=X,r.iter=e,r.iterFn=o,r.iterItems=i,r.iterKeys=t,r.iterValues=n,r.map=ut,r.max=Me,r.min=be,r.minmax=it,r.once=fn,r.range=ne,r.reduce=fe,r.repeat=Le,r.retro=Br,r.some=l,r.stride=rn,r.take=Tt,r.toArray=c,r.toObject=u,r.topologicSort=Ut,r.zip=ii,Object.defineProperty(r,"__esModule",{value:!0})})});var FH=N((O_,KH)=>{(function(r,e){typeof O_=="object"&&typeof KH<"u"?e(O_):typeof define=="function"&&define.amd?define(["exports"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.lumino_properties={}))})(O_,function(r){"use strict";r.AttachedProperty=function(){function t(n){this._pid=e.nextPID(),this.name=n.name,this._create=n.create,this._coerce=n.coerce||null,this._compare=n.compare||null,this._changed=n.changed||null}return t.prototype.get=function(n){var i,o=e.ensureMap(n);return this._pid in o?i=o[this._pid]:i=o[this._pid]=this._createValue(n),i},t.prototype.set=function(n,i){var o,s=e.ensureMap(n);this._pid in s?o=s[this._pid]:o=s[this._pid]=this._createValue(n);var a=this._coerceValue(n,i);this._maybeNotify(n,o,s[this._pid]=a)},t.prototype.coerce=function(n){var i,o=e.ensureMap(n);this._pid in o?i=o[this._pid]:i=o[this._pid]=this._createValue(n);var s=this._coerceValue(n,i);this._maybeNotify(n,i,o[this._pid]=s)},t.prototype._createValue=function(n){var i=this._create;return i(n)},t.prototype._coerceValue=function(n,i){var o=this._coerce;return o?o(n,i):i},t.prototype._compareValue=function(n,i){var o=this._compare;return o?o(n,i):n===i},t.prototype._maybeNotify=function(n,i,o){var s=this._changed;s&&!this._compareValue(i,o)&&s(n,i,o)},t}(),function(t){function n(i){e.ownerData.delete(i)}t.clearData=n}(r.AttachedProperty||(r.AttachedProperty={}));var e;(function(t){t.ownerData=new WeakMap,t.nextPID=function(){var i=0;return function(){var o=Math.random(),s=(""+o).slice(2);return"pid-"+s+"-"+i++}}();function n(i){var o=t.ownerData.get(i);return o||(o=Object.create(null),t.ownerData.set(i,o),o)}t.ensureMap=n})(e||(e={})),Object.defineProperty(r,"__esModule",{value:!0})})});var F_=N((K_,LH)=>{(function(r,e){typeof K_=="object"&&typeof LH<"u"?e(K_,OH(),FH()):typeof define=="function"&&define.amd?define(["exports","@lumino/algorithm","@lumino/properties"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.lumino_signaling={},r.lumino_algorithm,r.lumino_properties))})(K_,function(r,e,t){"use strict";r.Signal=function(){function i(o){this._blockedCount=0,this.sender=o}return i.prototype.block=function(o){this._blockedCount++;try{o()}finally{this._blockedCount--}},i.prototype.connect=function(o,s){return n.connect(this,o,s)},i.prototype.disconnect=function(o,s){return n.disconnect(this,o,s)},i.prototype.emit=function(o){this._blockedCount||n.emit(this,o)},i}(),function(i){function o(g,v){var b=n.blockedProperty;b.set(g,b.get(g)+1);try{v()}finally{b.set(g,b.get(g)-1)}}i.blockAll=o;function s(g,v){n.disconnectBetween(g,v)}i.disconnectBetween=s;function a(g){n.disconnectSender(g)}i.disconnectSender=a;function l(g){n.disconnectReceiver(g)}i.disconnectReceiver=l;function c(g){n.disconnectAll(g)}i.disconnectAll=c;function u(g){n.disconnectAll(g)}i.clearData=u;function p(){return n.exceptionHandler}i.getExceptionHandler=p;function f(g){var v=n.exceptionHandler;return n.exceptionHandler=g,v}i.setExceptionHandler=f}(r.Signal||(r.Signal={}));var n;(function(i){i.exceptionHandler=function($){console.error($)};function o($,se,ae){ae=ae||void 0;var X=f.get($.sender);if(X||(X=[],f.set($.sender,X)),C(X,$,se,ae))return!1;var be=ae||se,Me=g.get(be);Me||(Me=[],g.set(be,Me));var it={signal:$,slot:se,thisArg:ae};return X.push(it),Me.push(it),!0}i.connect=o;function s($,se,ae){ae=ae||void 0;var X=f.get($.sender);if(!X||X.length===0)return!1;var be=C(X,$,se,ae);if(!be)return!1;var Me=ae||se,it=g.get(Me);return be.signal=null,R(X),R(it),!0}i.disconnect=s;function a($,se){var ae=f.get($);if(!(!ae||ae.length===0)){var X=g.get(se);!X||X.length===0||(e.each(X,function(be){be.signal&&be.signal.sender===$&&(be.signal=null)}),R(ae),R(X))}}i.disconnectBetween=a;function l($){var se=f.get($);!se||se.length===0||(e.each(se,function(ae){if(ae.signal){var X=ae.thisArg||ae.slot;ae.signal=null,R(g.get(X))}}),R(se))}i.disconnectSender=l;function c($){var se=g.get($);!se||se.length===0||(e.each(se,function(ae){if(ae.signal){var X=ae.signal.sender;ae.signal=null,R(f.get(X))}}),R(se))}i.disconnectReceiver=c;function u($){l($),c($)}i.disconnectAll=u;function p($,se){if(!(i.blockedProperty.get($.sender)>0)){var ae=f.get($.sender);if(!(!ae||ae.length===0))for(var X=0,be=ae.length;X<be;++X){var Me=ae[X];Me.signal===$&&E(Me,se)}}}i.emit=p;var f=new WeakMap,g=new WeakMap,v=new Set,b=function(){var $=typeof requestAnimationFrame=="function";return $?requestAnimationFrame:setImmediate}();function C($,se,ae,X){return e.find($,function(be){return be.signal===se&&be.slot===ae&&be.thisArg===X})}function E($,se){var ae=$.signal,X=$.slot,be=$.thisArg;try{X.call(be,ae.sender,se)}catch(Me){i.exceptionHandler(Me)}}function R($){v.size===0&&b(_),v.add($)}function _(){v.forEach(L),v.clear()}function L($){e.ArrayExt.removeAllWhere($,te)}function te($){return $.signal===null}i.blockedProperty=new t.AttachedProperty({name:"blocked",create:function(){return 0}})})(n||(n={})),Object.defineProperty(r,"__esModule",{value:!0})})});var zF=N((_rt,ZH)=>{"use strict";var lve=require("child_process").spawn;function cve(r){if(r){r=r.trim();var e=/your \d+x\d+ screen size is bogus\. expect trouble/gi;return r=r.replace(e,""),r.trim()}}function uve(r,e,t,n){typeof t=="function"&&(n=t,t=void 0);var i=!1,o=lve(r,e,t),s="",a="";o.stdout.on("data",function(l){s+=l.toString()}),o.stderr.on("data",function(l){a+=l.toString()}),o.on("error",function(l){i||(i=!0,n(new Error(l)))}),o.on("close",function(l){if(!i){if(i=!0,a=cve(a),a)return n(new Error(a));n(null,s,l)}})}ZH.exports=uve});var t4=N((Trt,e4)=>{"use strict";var pve=require("os"),dve=zF();function mve(r){var e=["-A","-o","ppid,pid"];dve("ps",e,function(t,n,i){if(t)return r(t);if(i!==0)return r(new Error("pidtree ps command exited with code "+i));try{n=n.split(pve.EOL);for(var o=[],s=1;s<n.length;s++)n[s]=n[s].trim(),n[s]&&(n[s]=n[s].split(/\s+/),n[s][0]=parseInt(n[s][0],10),n[s][1]=parseInt(n[s][1],10),o.push(n[s]));r(null,o)}catch(a){r(a)}})}e4.exports=mve});var n4=N((Rrt,r4)=>{"use strict";var fve=require("os"),hve=zF();function gve(r){var e=["PROCESS","get","ParentProcessId,ProcessId"],t={windowsHide:!0,windowsVerbatimArguments:!0};hve("wmic",e,t,function(n,i,o){if(n){r(n);return}if(o!==0){r(new Error("pidtree wmic command exited with code "+o));return}try{i=i.split(fve.EOL);for(var s=[],a=1;a<i.length;a++)i[a]=i[a].trim(),i[a]&&(i[a]=i[a].split(/\s+/),i[a][0]=parseInt(i[a][0],10),i[a][1]=parseInt(i[a][1],10),s.push(i[a]));r(null,s)}catch(l){r(l)}})}r4.exports=gve});var a4=N((Art,s4)=>{"use strict";var o4=require("os"),vve={darwin:"ps",sunos:"ps",freebsd:"ps",netbsd:"ps",win:"wmic",linux:"ps",aix:"ps"},yve={ps:()=>t4(),wmic:()=>n4()},QF=o4.platform();QF.startsWith("win")&&(QF="win");var i4=vve[QF];function bve(r){i4===void 0&&r(new Error(o4.platform()+" is not supported yet, please open an issue (https://github.com/simonepri/pidtree)"));var e=yve[i4]();e(r)}s4.exports=bve});var c4=N((Nrt,l4)=>{"use strict";var Ive=a4();function Sve(r,e,t){if(typeof e=="function"&&(t=e,e={}),typeof e!="object"&&(e={}),r=parseInt(r,10),isNaN(r)||r<-1){t(new TypeError("The pid provided is invalid"));return}Ive(function(n,i){if(n){t(n);return}if(r===-1){for(var o=0;o<i.length;o++)i[o]=e.advanced?{ppid:i[o][0],pid:i[o][1]}:i[o]=i[o][1];t(null,i);return}for(var s,a=0;a<i.length;a++){if(i[a][1]===r){s=e.advanced?{ppid:i[a][0],pid:r}:r;break}i[a][0]===r&&(s=e.advanced?{pid:r}:r)}if(!s){t(new Error("No matching pid found"));return}for(var l={};i.length>0;){var c=i.pop();l[c[0]]?l[c[0]].push(c[1]):l[c[0]]=[c[1]]}for(var u=0,p=[s];u<p.length;){var f=e.advanced?p[u++].pid:p[u++];if(l[f]){for(var g=l[f].length,v=0;v<g;v++)p.push(e.advanced?{ppid:f,pid:l[f][v]}:l[f][v]);delete l[f]}}e.root||p.shift(),t(null,p)})}l4.exports=Sve});var d4=N((Mrt,p4)=>{"use strict";function xve(r,e,t){return new Promise(function(n,i){r(e,t,function(o,s){if(o)return i(o);n(s)})})}String.prototype.startsWith||(String.prototype.startsWith=function(r){return this.substring(0,r.length)===r});var u4=c4();function Cve(r,e,t){if(typeof e=="function"&&(t=e,e=void 0),typeof t=="function"){u4(r,e,t);return}return xve(u4,r,e)}p4.exports=Cve});var I4=N((Ort,b4)=>{var m4=Array.prototype.slice,f4=typeof Object.keys=="function"?Object.keys:function(r){var e=[];for(var t in r)e.push(t);return e},h4=b4.exports=function(r,e){return r===0&&e===0?wve(r,e):r===e?!0:r instanceof Date&&e instanceof Date?r.getTime()===e.getTime():y4(r)?y4(e):typeof r!="object"&&typeof e!="object"?r==e:Eve(r,e)};function g4(r){return r==null}function v4(r){return Object.prototype.toString.call(r)=="[object Arguments]"}function y4(r){return typeof r=="number"&&r!==r}function wve(r,e){return 1/r===1/e}function Eve(r,e){if(g4(r)||g4(e)||r.prototype!==e.prototype)return!1;if(v4(r))return v4(e)?(r=m4.call(r),e=m4.call(e),h4(r,e)):!1;try{var t=f4(r),n=f4(e),i,o}catch{return!1}if(t.length!=n.length)return!1;for(t.sort(),n.sort(),o=t.length-1;o>=0;o--)if(t[o]!=n[o])return!1;for(o=t.length-1;o>=0;o--)if(i=t[o],!h4(r[i],e[i]))return!1;return!0}});var C4=N((Krt,x4)=>{"use strict";var S4="[a-fA-F\\d:]",vd=r=>r&&r.includeBoundaries?`(?:(?<=\\s|^)(?=${S4})|(?<=${S4})(?=\\s|$))`:"",Na="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",Ln="[a-fA-F\\d]{1,4}",aT=`
|
||
(?:
|
||
(?:${Ln}:){7}(?:${Ln}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
||
(?:${Ln}:){6}(?:${Na}|:${Ln}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
||
(?:${Ln}:){5}(?::${Na}|(?::${Ln}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
||
(?:${Ln}:){4}(?:(?::${Ln}){0,1}:${Na}|(?::${Ln}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
||
(?:${Ln}:){3}(?:(?::${Ln}){0,2}:${Na}|(?::${Ln}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
||
(?:${Ln}:){2}(?:(?::${Ln}){0,3}:${Na}|(?::${Ln}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
||
(?:${Ln}:){1}(?:(?::${Ln}){0,4}:${Na}|(?::${Ln}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
||
(?::(?:(?::${Ln}){0,5}:${Na}|(?::${Ln}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
||
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
||
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),kve=new RegExp(`(?:^${Na}$)|(?:^${aT}$)`),Pve=new RegExp(`^${Na}$`),Dve=new RegExp(`^${aT}$`),YF=r=>r&&r.exact?kve:new RegExp(`(?:${vd(r)}${Na}${vd(r)})|(?:${vd(r)}${aT}${vd(r)})`,"g");YF.v4=r=>r&&r.exact?Pve:new RegExp(`${vd(r)}${Na}${vd(r)}`,"g");YF.v6=r=>r&&r.exact?Dve:new RegExp(`${vd(r)}${aT}${vd(r)}`,"g");x4.exports=YF});var w4=N((Frt,_ve)=>{_ve.exports={name:"is2",version:"2.0.7",description:"A type checking library where each exported function returns either true or false and does not throw. Also added tests.",license:"MIT",tags:["type","check","checker","checking","utilities","network","networking","credit","card","validation"],keywords:["type","check","checker","checking","utilities","network","networking","credit","card","validation"],author:"Enrico Marino <enrico.marino@email.com>",maintainers:"Edmond Meinfelder <edmond@stdarg.com>, Chris Oyler <christopher.oyler@gmail.com>",homepage:"http://github.com/stdarg/is2",repository:{type:"git",url:"git@github.com:stdarg/is2.git"},bugs:{url:"http://github.com/stdarg/is/issues"},main:"./index.js",scripts:{test:"./node_modules/.bin/mocha -C --reporter list tests.js"},engines:{node:">=v0.10.0"},dependencies:{"deep-is":"^0.1.3","ip-regex":"^4.1.0","is-url":"^1.2.4"},devDependencies:{mocha:"6.1.4",mongodb:"3.2.4"}}});var k4=N((Lrt,E4)=>{E4.exports=Nve;var Tve=/^(?:\w+:)?\/\/(\S+)$/,Rve=/^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/,Ave=/^[^\s\.]+\.\S{2,}$/;function Nve(r){if(typeof r!="string")return!1;var e=r.match(Tve);if(!e)return!1;var t=e[1];return t?!!(Rve.test(t)||Ave.test(t)):!1}});var _4=N(D4=>{"use strict";var P4={}.hasOwnProperty,hr={}.toString,x=D4,Mve=I4(),Ove=C4();x.version=w4().version;x.browser=function(){return!x.node()&&typeof window<"u"&&hr.call(window)==="[object global]"};x.defined=function(r){return typeof r<"u"};x.def=x.defined;x.nodejs=function(){return process&&process.hasOwnProperty("version")&&process.hasOwnProperty("versions")};x.node=x.nodejs;x.undefined=function(r){return r===void 0};x.udef=x.undef=x.undefined;x.array=function(r){return hr.call(r)==="[object Array]"};x.arr=x.ary=x.arry=x.array;x.arrayLike=function(r){return x.nullOrUndef(r)?!1:r!==void 0&&P4.call(r,"length")&&isFinite(r.length)};x.arrLike=x.arryLike=x.aryLike=x.arraylike=x.arrayLike;x.arguments=function(r){return hr.call(r)==="[object Arguments]"};x.args=x.arguments;x.boolean=function(r){return hr.call(r)==="[object Boolean]"};x.bool=x.boolean;x.buffer=function(r){return x.nodejs()&&Buffer&&Buffer.hasOwnProperty("isBuffer")&&Buffer.isBuffer(r)};x.buff=x.buf=x.buffer;x.date=function(r){return hr.call(r)==="[object Date]"};x.error=function(r){return hr.call(r)==="[object Error]"};x.err=x.error;x.false=function(r){return r===!1};x.function=function(r){return x.syncFunction(r)||x.asyncFunction(r)};x.fun=x.func=x.function;x.asyncFunction=function(r){return hr.call(r)==="[object AsyncFunction]"};x.asyncFun=x.asyncFunc=x.asyncFunction;x.syncFunction=function(r){return hr.call(r)==="[object Function]"};x.syncFun=x.syncFunc=x.syncFunction;x.null=function(r){return r===null};x.nullOrUndefined=function(r){return r===null||typeof r>"u"};x.nullOrUndef=x.nullOrUndefined;x.number=function(r){return hr.call(r)==="[object Number]"};x.num=x.number;x.object=function(r){return hr.call(r)==="[object Object]"};x.obj=x.object;x.regExp=function(r){return hr.call(r)==="[object RegExp]"};x.re=x.regexp=x.regExp;x.string=function(r){return hr.call(r)==="[object String]"};x.str=x.string;x.true=function(r){return r===!0};var Kve=new RegExp("[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}","i");x.uuid=function(r){return Kve.test(r)};x.equal=function(r,e){var t=hr.call(r);return typeof r!=typeof e||t!==hr.call(e)?!1:t==="[object Object]"||t==="[object Array]"?Mve(r,e):t==="[object Function]"?r.prototype===e.prototype:t==="[object Date]"?r.getTime()===e.getTime():r===e};x.objEquals=x.eq=x.equal;var Fve={boolean:1,number:1,string:1,undefined:1};x.hosted=function(r,e){if(x.nullOrUndef(r))return!1;var t=typeof e[r];return t==="object"?!!e[r]:!Fve[t]};x.instanceOf=function(r,e){return x.nullOrUndef(r)||x.nullOrUndef(e)?!1:r instanceof e};x.instOf=x.instanceof=x.instanceOf;x.objectInstanceOf=function(r,e){try{return hr.call(r)==="[object Object]"&&r instanceof e}catch{return!1}};x.instOf=x.instanceOf=x.objInstOf=x.objectInstanceOf;x.type=function(r,e){return typeof r===e};x.a=x.type;x.empty=function(r){var e=hr.call(r);if(e==="[object Array]"||e==="[object Arguments]")return r.length===0;if(e==="[object Object]"){for(var t in r)if(P4.call(r,t))return!1;return!0}return e==="[object String]"?r==="":!1};x.emptyArguments=function(r){return hr.call(r)==="[object Arguments]"&&r.length===0};x.noArgs=x.emptyArgs=x.emptyArguments;x.emptyArray=function(r){return hr.call(r)==="[object Array]"&&r.length===0};x.emptyArry=x.emptyAry=x.emptyArray;x.emptyArrayLike=function(r){return r.length===0};x.emptyArrLike=x.emptyArrayLike;x.emptyString=function(r){return x.string(r)&&r.length===0};x.emptyStr=x.emptyString;x.nonEmptyArray=function(r){return hr.call(r)==="[object Array]"&&r.length>0};x.nonEmptyArr=x.nonEmptyArry=x.nonEmptyAry=x.nonEmptyArray;x.nonEmptyObject=function(r){return hr.call(r)==="[object Object]"&&Object.keys(r).length>0};x.nonEmptyObj=x.nonEmptyObject;x.emptyObject=function(r){return hr.call(r)==="[object Object]"&&Object.keys(r).length===0};x.emptyObj=x.emptyObject;x.nonEmptyString=function(r){return x.string(r)&&r.length>0};x.nonEmptyStr=x.nonEmptyString;x.even=function(r){return hr.call(r)==="[object Number]"&&r%2===0};x.decimal=function(r){return hr.call(r)==="[object Number]"&&r%1!==0};x.dec=x.decNum=x.decimal;x.integer=function(r){return hr.call(r)==="[object Number]"&&r%1===0};x.int=x.integer;x.notANumber=function(r){return!x.num(r)||r!==r};x.nan=x.notANum=x.notANumber;x.odd=function(r){return!x.decimal(r)&&hr.call(r)==="[object Number]"&&r%2!==0};x.oddNumber=x.oddNum=x.odd;x.positiveNumber=function(r){return hr.call(r)==="[object Number]"&&r>0};x.pos=x.positive=x.posNum=x.positiveNum=x.positiveNumber;x.negativeNumber=function(r){return hr.call(r)==="[object Number]"&&r<0};x.neg=x.negNum=x.negativeNum=x.negativeNumber;x.negativeInteger=function(r){return hr.call(r)==="[object Number]"&&r%1===0&&r<0};x.negativeInt=x.negInt=x.negativeInteger;x.positiveInteger=function(r){return hr.call(r)==="[object Number]"&&r%1===0&&r>0};x.posInt=x.positiveInt=x.positiveInteger;x.divisibleBy=function(r,e){return r===0?!1:hr.call(r)==="[object Number]"&&e!==0&&r%e===0};x.divBy=x.divisBy=x.divisibleBy;x.greaterOrEqualTo=function(r,e){return r>=e};x.greaterOrEqual=x.ge=x.greaterOrEqualTo;x.greaterThan=function(r,e){return r>e};x.gt=x.greaterThan;x.lessThanOrEqualTo=function(r,e){return r<=e};x.lessThanOrEq=x.lessThanOrEqual=x.le=x.lessThanOrEqualTo;x.lessThan=function(r,e){return r<e};x.lt=x.lessThan;x.maximum=function(r,e){if(!x.arrayLike(e)||!x.number(r))return!1;for(var t=e.length;--t>-1;)if(r<e[t])return!1;return!0};x.max=x.maximum;x.minimum=function(r,e){if(!x.arrayLike(e)||!x.number(r))return!1;for(var t=e.length;--t>-1;)if(r>e[t])return!1;return!0};x.min=x.minimum;x.within=function(r,e,t){return r>=e&&r<=t};x.withIn=x.within;x.prettyClose=function(r,e,t){return!x.number(r)||!x.number(e)||x.defined(t)&&!x.posInt(t)?!1:(x.undefined(t)&&(t=2),r.toFixed(t)===e.toFixed(t))};x.closish=x.near=x.prettyClose;x.dnsAddress=function(r){return!(!x.nonEmptyStr(r)||r.length>255||Uve.test(r)||!Lve.test(r))};x.dnsAddr=x.dns=x.dnsAddress;var Lve=/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/,Uve=/^([0-9]|[0-9][0-9\-]{0,61}[0-9])(\.([0-9]|[0-9][0-9\-]{0,61}[0-9]))*$/;x.emailAddress=function(r){return x.nonEmptyStr(r)?jve.test(r):!1};x.email=x.emailAddr=x.emailAddress;var jve=/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/;x.ipv4Address=function(r){if(!x.nonEmptyStr(r)||r.length>15)return!1;var e=r.split(".");if(!x.array(e)||e.length!==4)return!1;for(var t=0;t<e.length;t++){var n=parseInt(e[t],10);if(isNaN(n)||n<0||n>255)return!1}return!0};x.ipv4=x.ipv4Addr=x.ipv4Address;x.ipv6Address=function(r){return x.nonEmptyStr(r)?Ove.v6({extract:!0}).test(r):!1};x.ipv6=x.ipv6Addr=x.ipv6Address;x.ipAddress=function(r){return x.nonEmptyStr(r)?x.ipv4Address(r)||x.ipv6Address(r):!1};x.ip=x.ipAddr=x.ipAddress;x.hostAddress=function(r){return x.nonEmptyStr(r)?x.dns(r)||x.ipv4(r)||x.ipv6(r):!1};x.host=x.hostIp=x.hostAddr=x.hostAddress;x.port=function(r){return!(!x.num(r)||x.negativeInt(r)||r>65535)};x.systemPort=function(r){return!!(x.port(r)&&r<1024)};x.sysPort=x.systemPort;x.userPort=function(r){return!!(x.port(r)&&r>1023)};x.creditCardNumber=function(r){if(!x.str(r))return!1;var e=r.split(""),t,n;for(t=e.length-1,n=1;t>-1;t--,n++)n%2===0&&(e[t]*=2);r=e.join("");var i=0;for(t=0;t<r.length;t++)i+=Math.floor(r[t]);return i%10===0};x.creditCard=x.creditCardNum=x.creditCardNumber;x.americanExpressCardNumber=function(r){if(!x.str(r)||r.length!==15)return!1;var e=Math.floor(r.slice(0,2));return!(e!==34&&e!==37||!x.creditCardNumber(r))};x.amexCard=x.amexCardNum=x.americanExpressCardNumber;x.chinaUnionPayCardNumber=function(r){if(!x.str(r)||r.length<16&&r.length>19)return!1;var e=Math.floor(r.slice(0,2));return!(e!==62&&e!==88)};x.chinaUnion=x.chinaUnionPayCard=x.chinaUnionPayCardNumber;x.dinersClubCarteBlancheCardNumber=function(r){if(!x.str(r)||r.length!==14)return!1;var e=Math.floor(r.slice(0,3));return!(e<300||e>305||!x.creditCardNumber(r))};x.dinersClubCB=x.dinersClubCarteBlancheCard=x.dinersClubCarteBlancheCardNumber;x.dinersClubInternationalCardNumber=function(r){if(!x.str(r)||r.length!==14)return!1;var e=Math.floor(r.slice(0,3)),t=Math.floor(r.slice(0,2));return!((e<300||e>305)&&e!==309&&t!==36&&(t<38||t>39)||!x.creditCardNumber(r))};x.dinersClubInt=x.dinersClubInternationalCard=x.dinersClubInternationalCardNumber;x.dinersClubUSACanadaCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,2));return!(e!==54&&e!==55||!x.creditCardNumber(r))};x.dinersClub=x.dinersClubUSACanCard=x.dinersClubUSACanadaCardNumber;x.discoverCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,6)),t=Math.floor(r.slice(0,3));return!(r.slice(0,4)!=="6011"&&(e<622126||e>622925)&&(t<644||t>649)&&r.slice(0,2)!=="65"||!x.creditCardNumber(r))};x.discover=x.discoverCard=x.discoverCardNumber;x.instaPaymentCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,3));return!(e<637||e>639||!x.creditCardNumber(r))};x.instaPayment=x.instaPaymentCardNumber;x.jcbCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,4));return!(e<3528||e>3589||!x.creditCardNumber(r))};x.jcb=x.jcbCard=x.jcbCardNumber;x.laserCardNumber=function(r){if(!x.str(r)||r.length<16&&r.length>19)return!1;var e=Math.floor(r.slice(0,4)),t=[6304,6706,6771,6709];return!(t.indexOf(e)===-1||!x.creditCardNumber(r))};x.laser=x.laserCard=x.laserCardNumber;x.maestroCardNumber=function(r){if(!x.str(r)||r.length<12||r.length>19)return!1;var e=r.slice(0,4),t=["5018","5020","5038","5612","5893","6304","6759","6761","6762","6763","0604","6390"];return!(t.indexOf(e)===-1||!x.creditCardNumber(r))};x.maestro=x.maestroCard=x.maestroCardNumber;x.dankortCardNumber=function(r){return!(!x.str(r)||r.length!==16||r.slice(0,4)!=="5019"||!x.creditCardNumber(r))};x.dankort=x.dankortCard=x.dankortCardNumber;x.masterCardCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,2));return!(e<50||e>55||!x.creditCardNumber(r))};x.masterCard=x.masterCardCard=x.masterCardCardNumber;x.visaCardNumber=function(r){return!(!x.str(r)||r.length!==13&&r.length!==16||r.slice(0,1)!=="4"||!x.creditCardNumber(r))};x.visa=x.visaCard=x.visaCardNumber;x.visaElectronCardNumber=function(r){if(!x.str(r)||r.length!==16)return!1;var e=Math.floor(r.slice(0,4)),t=[4026,4405,4508,4844,4913,4917];return r.slice(0,6)!=="417500"&&t.indexOf(e)===-1||!x.creditCardNumber(r),!1};x.visaElectron=x.visaElectronCard=x.visaElectronCardNumber;var Wve=/^[0-9a-fA-F]{24}$/;x.mongoId=x.objectId=x.objId=function(r){return!!r&&!Array.isArray(r)&&Wve.test(String(r))};x.matching=x.match=x.inArgs=function(r){if(arguments.length<2)return!1;for(var e=!1,t=1;t<arguments.length;t++){var n=x.equal(r,arguments[t]);e=e||n}return e};x.streetAddress=function(r){if(!x.str(r))return!1;var e=/\b\d+[\s](?:[A-Za-z0-9.-]+[\s]+)+\b(ALLEY|ALY|AVENUE|AVE|BEND|BND|BLUFFS?|BLFS?|BOULEVARD|BLVD|BRANCH|BR|CENTERS?|CTRS?|CIRCLES?|CIRS?|CLIFFS?|CLFS?|COURTS?|CTS?|COVES?|CVS?|CREEK|CRK|CRESCENT|CRES|CREST|CRST|CROSSING|XING|DRIVES?|DRS?|EXPRESSWAY|EXPY|FREEWAY|FWY|HEIGHTS|HTS|HIGHWAY|HWY|HILLS?|HLS?|LANE|LN|LOOP|MANORS?|MNRS?|MOTORWAY|MTWY|MOUNT|MT|PARKS?|PARKWAYS?|PKWY|PASS|PLACE|PL|PLAZA|PLZ|POINTS?|PTS?|RIDGES?|RDGS?|ROADS?|RDS?|ROUTE|RTE?|SHOALS?|SHLS?|SHORES?|SHRS?|SPRINGS?|SPGS?|SPURS?|STREETS?|STS?|SUMMIT|SMT|TERRACE|TER|THROUGHWAY|TRWY|TRAFFICWAY|TRFY|TRAIL|TRL|TURNPIKE|TPKE|VALLEYS?|VLYS?|WAYS?)+(?:[\.\-\s\,]?)*((APARTMENT|APT|APPT|#|NUMBER|NUM|FLOOR|FL|\s)?(\d)*)\b/ig;return e.test(r)};x.street=x.address=x.streetAddress;x.zipCode=function(r){if(x.undefined(r)||!(x.string(r)||x.number(r)))return!1;var e=/^\d{5}(?:-\d{4})?$/;return e.test(r)};x.zip=x.zipCode;x.phoneNumber=function(r){if(!x.string(r))return!1;var e=/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:(\(?)(?:(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\)?)\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})/g;return e.test(r)};x.phone=x.phoneNumber;var Vve=k4();x.url=function(r){return Vve(r)};x.uri=x.url;x.enumerator=function(r,e){var t=!1;if(!x.defined(r)||!x.defined(e)||!x.arrayLike(e))return t;for(var n=0,i=e.length;n<i;n++)if(x.equal(r,e[n])){t=!0;break}return t};x.enum=x.inArray=x.enumerator});var XF=N((jrt,T4)=>{function Bve(r){t.debug=t,t.default=t,t.coerce=l,t.disable=o,t.enable=i,t.enabled=s,t.humanize=mP(),t.destroy=c,Object.keys(r).forEach(u=>{t[u]=r[u]}),t.names=[],t.skips=[],t.formatters={};function e(u){let p=0;for(let f=0;f<u.length;f++)p=(p<<5)-p+u.charCodeAt(f),p|=0;return t.colors[Math.abs(p)%t.colors.length]}t.selectColor=e;function t(u){let p,f=null;function g(...v){if(!g.enabled)return;let b=g,C=Number(new Date),E=C-(p||C);b.diff=E,b.prev=p,b.curr=C,p=C,v[0]=t.coerce(v[0]),typeof v[0]!="string"&&v.unshift("%O");let R=0;v[0]=v[0].replace(/%([a-zA-Z%])/g,(L,te)=>{if(L==="%%")return"%";R++;let $=t.formatters[te];if(typeof $=="function"){let se=v[R];L=$.call(b,se),v.splice(R,1),R--}return L}),t.formatArgs.call(b,v),(b.log||t.log).apply(b,v)}return g.namespace=u,g.useColors=t.useColors(),g.color=t.selectColor(u),g.extend=n,g.destroy=t.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f===null?t.enabled(u):f,set:v=>{f=v}}),typeof t.init=="function"&&t.init(g),g}function n(u,p){let f=t(this.namespace+(typeof p>"u"?":":p)+u);return f.log=this.log,f}function i(u){t.save(u),t.names=[],t.skips=[];let p,f=(typeof u=="string"?u:"").split(/[\s,]+/),g=f.length;for(p=0;p<g;p++)f[p]&&(u=f[p].replace(/\*/g,".*?"),u[0]==="-"?t.skips.push(new RegExp("^"+u.substr(1)+"$")):t.names.push(new RegExp("^"+u+"$")))}function o(){let u=[...t.names.map(a),...t.skips.map(a).map(p=>"-"+p)].join(",");return t.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let p,f;for(p=0,f=t.skips.length;p<f;p++)if(t.skips[p].test(u))return!1;for(p=0,f=t.names.length;p<f;p++)if(t.names[p].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function l(u){return u instanceof Error?u.stack||u.message:u}function c(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}T4.exports=Bve});var R4=N((ls,lT)=>{ls.formatArgs=Jve;ls.save=$ve;ls.load=Hve;ls.useColors=qve;ls.storage=Gve();ls.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();ls.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function qve(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Jve(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+lT.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;r.splice(1,0,e,"color: inherit");let t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,i=>{i!=="%%"&&(t++,i==="%c"&&(n=t))}),r.splice(n,0,e)}ls.log=console.debug||console.log||(()=>{});function $ve(r){try{r?ls.storage.setItem("debug",r):ls.storage.removeItem("debug")}catch{}}function Hve(){let r;try{r=ls.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function Gve(){try{return localStorage}catch{}}lT.exports=XF()(ls);var{formatters:zve}=lT.exports;zve.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var N4=N((yi,uT)=>{var Qve=require("tty"),cT=require("util");yi.init=nye;yi.log=eye;yi.formatArgs=Xve;yi.save=tye;yi.load=rye;yi.useColors=Yve;yi.destroy=cT.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");yi.colors=[6,2,3,4,5,1];try{let r=hP();r&&(r.stderr||r).level>=2&&(yi.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}yi.inspectOpts=Object.keys(process.env).filter(r=>/^debug_/i.test(r)).reduce((r,e)=>{let t=e.substring(6).toLowerCase().replace(/_([a-z])/g,(i,o)=>o.toUpperCase()),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function Yve(){return"colors"in yi.inspectOpts?!!yi.inspectOpts.colors:Qve.isatty(process.stderr.fd)}function Xve(r){let{namespace:e,useColors:t}=this;if(t){let n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=` ${i};1m${e} \x1B[0m`;r[0]=o+r[0].split(`
|
||
`).join(`
|
||
`+o),r.push(i+"m+"+uT.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=Zve()+e+" "+r[0]}function Zve(){return yi.inspectOpts.hideDate?"":new Date().toISOString()+" "}function eye(...r){return process.stderr.write(cT.format(...r)+`
|
||
`)}function tye(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function rye(){return process.env.DEBUG}function nye(r){r.inspectOpts={};let e=Object.keys(yi.inspectOpts);for(let t=0;t<e.length;t++)r.inspectOpts[e[t]]=yi.inspectOpts[e[t]]}uT.exports=XF()(yi);var{formatters:A4}=uT.exports;A4.o=function(r){return this.inspectOpts.colors=this.useColors,cT.inspect(r,this.inspectOpts).split(`
|
||
`).map(e=>e.trim()).join(" ")};A4.O=function(r){return this.inspectOpts.colors=this.useColors,cT.inspect(r,this.inspectOpts)}});var M4=N((Wrt,ZF)=>{typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?ZF.exports=R4():ZF.exports=N4()});var W4=N(If=>{"use strict";If.check=U4;If.waitUntilFreeOnHost=oye;If.waitUntilFree=sye;If.waitUntilUsedOnHost=j4;If.waitUntilUsed=aye;If.waitForStatus=dT;var Ma=_4(),iye=require("net"),O4=require("util"),pT=M4()("tcp-port-used"),K4=2e3,F4=250;function L4(){var r,e,t=new Promise(function(n,i){r=n,e=i});return{resolve:r,reject:e,promise:t}}function zy(r,e,t,n,i){var o={};return o.port=r,o.host=e,o.inUse=t,o.retryTimeMs=n,o.timeOutMs=i,o}function U4(r,e){var t=L4(),n=!0,i,o;if(Ma.obj(r)?o=r:o=zy(r,e),!Ma.port(o.port))return pT("Error invalid port: "+O4.inspect(o.port)),t.reject(new Error("invalid port: "+O4.inspect(o.port))),t.promise;Ma.nullOrUndefined(o.host)&&(pT("set host address to default 127.0.0.1"),o.host="127.0.0.1");function s(){i&&(i.removeAllListeners("connect"),i.removeAllListeners("error"),i.end(),i.destroy(),i.unref())}function a(){t.resolve(n),s()}function l(c){c.code!=="ECONNREFUSED"?t.reject(c):(n=!1,t.resolve(n)),s()}return i=new iye.Socket,i.once("connect",a),i.once("error",l),i.connect({port:o.port,host:o.host},function(){}),t.promise}function dT(r,e,t,n,i){var o=L4(),s,a=!1,l,c;if(Ma.obj(r)?c=r:c=zy(r,e,t,n,i),!Ma.bool(c.inUse))return o.reject(new Error("inUse must be a boolean")),o.promise;Ma.positiveInt(c.retryTimeMs)||(c.retryTimeMs=F4,pT("set retryTime to default "+F4+"ms")),Ma.positiveInt(c.timeOutMs)||(c.timeOutMs=K4,pT("set timeOutMs to default "+K4+"ms"));function u(){s&&clearTimeout(s),l&&clearTimeout(l)}function p(){a=!0,u(),o.reject(new Error("timeout"))}s=setTimeout(p,c.timeOutMs);function f(){U4(c.port,c.host).then(function(g){if(!a)if(g===c.inUse){o.resolve(),u();return}else{l=setTimeout(function(){f()},c.retryTimeMs);return}},function(g){a||(o.reject(g),u())})}return f(),o.promise}function oye(r,e,t,n){var i;return Ma.obj(r)?(i=r,i.inUse=!1):i=zy(r,e,!1,t,n),dT(i)}function sye(r,e,t){var n;return Ma.obj(r)?(n=r,n.host="127.0.0.1",n.inUse=!1):n=zy(r,"127.0.0.1",!1,e,t),dT(n)}function j4(r,e,t,n){var i;return Ma.obj(r)?(i=r,i.inUse=!0):i=zy(r,e,!0,t,n),dT(i)}function aye(r,e,t){var n;return Ma.obj(r)?(n=r,n.host="127.0.0.1",n.inUse=!0):n=zy(r,"127.0.0.1",!0,e,t),j4(n)}});var G4=N((mT,sc)=>{(function(r,e){typeof mT=="object"&&typeof sc<"u"?e(mT):typeof define=="function"&&define.amd?define(["exports"],e):e(r.async=r.async||{})})(mT,function(r){"use strict";function e(S,k){k=k|0;for(var T=Math.max(S.length-k,0),K=Array(T),G=0;G<T;G++)K[G]=S[k+G];return K}var t=function(S){var k=e(arguments,1);return function(){var T=e(arguments);return S.apply(null,k.concat(T))}},n=function(S){return function(){var k=e(arguments),T=k.pop();S.call(this,k,T)}};function i(S){var k=typeof S;return S!=null&&(k=="object"||k=="function")}var o=typeof setImmediate=="function"&&setImmediate,s=typeof process=="object"&&typeof process.nextTick=="function";function a(S){setTimeout(S,0)}function l(S){return function(k){var T=e(arguments,1);S(function(){k.apply(null,T)})}}var c;o?c=setImmediate:s?c=process.nextTick:c=a;var u=l(c);function p(S){return n(function(k,T){var K;try{K=S.apply(this,k)}catch(G){return T(G)}i(K)&&typeof K.then=="function"?K.then(function(G){f(T,null,G)},function(G){f(T,G.message?G:new Error(G))}):T(null,K)})}function f(S,k,T){try{S(k,T)}catch(K){u(g,K)}}function g(S){throw S}var v=typeof Symbol=="function";function b(S){return v&&S[Symbol.toStringTag]==="AsyncFunction"}function C(S){return b(S)?p(S):S}function E(S){return function(k){var T=e(arguments,1),K=n(function(G,H){var ie=this;return S(k,function(ce,ke){C(ce).apply(ie,G.concat(ke))},H)});return T.length?K.apply(this,T):K}}var R=typeof global=="object"&&global&&global.Object===Object&&global,_=typeof self=="object"&&self&&self.Object===Object&&self,L=R||_||Function("return this")(),te=L.Symbol,$=Object.prototype,se=$.hasOwnProperty,ae=$.toString,X=te?te.toStringTag:void 0;function be(S){var k=se.call(S,X),T=S[X];try{S[X]=void 0;var K=!0}catch{}var G=ae.call(S);return K&&(k?S[X]=T:delete S[X]),G}var Me=Object.prototype,it=Me.toString;function ut(S){return it.call(S)}var Xe="[object Null]",ne="[object Undefined]",Ce=te?te.toStringTag:void 0;function Q(S){return S==null?S===void 0?ne:Xe:Ce&&Ce in Object(S)?be(S):ut(S)}var fe="[object AsyncFunction]",Le="[object Function]",fn="[object GeneratorFunction]",xt="[object Proxy]";function Br(S){if(!i(S))return!1;var k=Q(S);return k==Le||k==fn||k==fe||k==xt}var gs=9007199254740991;function Ut(S){return typeof S=="number"&&S>-1&&S%1==0&&S<=gs}function rn(S){return S!=null&&Ut(S.length)&&!Br(S)}var $i={};function Tt(){}function ar(S){return function(){if(S!==null){var k=S;S=null,k.apply(this,arguments)}}}var ii=typeof Symbol=="function"&&Symbol.iterator,_c=function(S){return ii&&S[ii]&&S[ii]()};function F(S,k){for(var T=-1,K=Array(S);++T<S;)K[T]=k(T);return K}function j(S){return S!=null&&typeof S=="object"}var he="[object Arguments]";function Ae(S){return j(S)&&Q(S)==he}var Ze=Object.prototype,nn=Ze.hasOwnProperty,qt=Ze.propertyIsEnumerable,Ft=Ae(function(){return arguments}())?Ae:function(S){return j(S)&&nn.call(S,"callee")&&!qt.call(S,"callee")},Rt=Array.isArray;function Cr(){return!1}var qr=typeof r=="object"&&r&&!r.nodeType&&r,Dr=qr&&typeof sc=="object"&&sc&&!sc.nodeType&&sc,on=Dr&&Dr.exports===qr,J=on?L.Buffer:void 0,ee=J?J.isBuffer:void 0,de=ee||Cr,Ie=9007199254740991,Je=/^(?:0|[1-9]\d*)$/;function sn(S,k){var T=typeof S;return k=k??Ie,!!k&&(T=="number"||T!="symbol"&&Je.test(S))&&S>-1&&S%1==0&&S<k}var Ct="[object Arguments]",Pt="[object Array]",et="[object Boolean]",Kt="[object Date]",re="[object Error]",ue="[object Function]",W="[object Map]",V="[object Number]",Z="[object Object]",we="[object RegExp]",Ne="[object Set]",cr="[object String]",xi="[object WeakMap]",Tc="[object ArrayBuffer]",Se="[object DataView]",sU="[object Float32Array]",aU="[object Float64Array]",lU="[object Int8Array]",cU="[object Int16Array]",uU="[object Int32Array]",pU="[object Uint8Array]",dU="[object Uint8ClampedArray]",mU="[object Uint16Array]",fU="[object Uint32Array]",Kr={};Kr[sU]=Kr[aU]=Kr[lU]=Kr[cU]=Kr[uU]=Kr[pU]=Kr[dU]=Kr[mU]=Kr[fU]=!0,Kr[Ct]=Kr[Pt]=Kr[Tc]=Kr[et]=Kr[Se]=Kr[Kt]=Kr[re]=Kr[ue]=Kr[W]=Kr[V]=Kr[Z]=Kr[we]=Kr[Ne]=Kr[cr]=Kr[xi]=!1;function hU(S){return j(S)&&Ut(S.length)&&!!Kr[Q(S)]}function gU(S){return function(k){return S(k)}}var aR=typeof r=="object"&&r&&!r.nodeType&&r,ah=aR&&typeof sc=="object"&&sc&&!sc.nodeType&&sc,vU=ah&&ah.exports===aR,Aw=vU&&R.process,lR=function(){try{var S=ah&&ah.require&&ah.require("util").types;return S||Aw&&Aw.binding&&Aw.binding("util")}catch{}}(),cR=lR&&lR.isTypedArray,yU=cR?gU(cR):hU,bU=Object.prototype,IU=bU.hasOwnProperty;function SU(S,k){var T=Rt(S),K=!T&&Ft(S),G=!T&&!K&&de(S),H=!T&&!K&&!G&&yU(S),ie=T||K||G||H,ce=ie?F(S.length,String):[],ke=ce.length;for(var Ye in S)(k||IU.call(S,Ye))&&!(ie&&(Ye=="length"||G&&(Ye=="offset"||Ye=="parent")||H&&(Ye=="buffer"||Ye=="byteLength"||Ye=="byteOffset")||sn(Ye,ke)))&&ce.push(Ye);return ce}var xU=Object.prototype;function CU(S){var k=S&&S.constructor,T=typeof k=="function"&&k.prototype||xU;return S===T}function wU(S,k){return function(T){return S(k(T))}}var EU=wU(Object.keys,Object),kU=Object.prototype,PU=kU.hasOwnProperty;function DU(S){if(!CU(S))return EU(S);var k=[];for(var T in Object(S))PU.call(S,T)&&T!="constructor"&&k.push(T);return k}function Nw(S){return rn(S)?SU(S):DU(S)}function _U(S){var k=-1,T=S.length;return function(){return++k<T?{value:S[k],key:k}:null}}function TU(S){var k=-1;return function(){var K=S.next();return K.done?null:(k++,{value:K.value,key:k})}}function RU(S){var k=Nw(S),T=-1,K=k.length;return function G(){var H=k[++T];return H==="__proto__"?G():T<K?{value:S[H],key:H}:null}}function AU(S){if(rn(S))return _U(S);var k=_c(S);return k?TU(k):RU(S)}function ua(S){return function(){if(S===null)throw new Error("Callback was already called.");var k=S;S=null,k.apply(this,arguments)}}function lS(S){return function(k,T,K){if(K=ar(K||Tt),S<=0||!k)return K(null);var G=AU(k),H=!1,ie=0,ce=!1;function ke(Pe,bt){if(ie-=1,Pe)H=!0,K(Pe);else{if(bt===$i||H&&ie<=0)return H=!0,K(null);ce||Ye()}}function Ye(){for(ce=!0;ie<S&&!H;){var Pe=G();if(Pe===null){H=!0,ie<=0&&K(null);return}ie+=1,T(Pe.value,Pe.key,ua(ke))}ce=!1}Ye()}}function qu(S,k,T,K){lS(k)(S,C(T),K)}function Hn(S,k){return function(T,K,G){return S(T,k,K,G)}}function NU(S,k,T){T=ar(T||Tt);var K=0,G=0,H=S.length;H===0&&T(null);function ie(ce,ke){ce?T(ce):(++G===H||ke===$i)&&T(null)}for(;K<H;K++)k(S[K],K,ua(ie))}var MU=Hn(qu,1/0),Rc=function(S,k,T){var K=rn(S)?NU:MU;K(S,C(k),T)};function Zd(S){return function(k,T,K){return S(Rc,k,C(T),K)}}function uR(S,k,T,K){K=K||Tt,k=k||[];var G=[],H=0,ie=C(T);S(k,function(ce,ke,Ye){var Pe=H++;ie(ce,function(bt,Jr){G[Pe]=Jr,Ye(bt)})},function(ce){K(ce,G)})}var cS=Zd(uR),pR=E(cS);function em(S){return function(k,T,K,G){return S(lS(T),k,C(K),G)}}var tm=em(uR),Mw=Hn(tm,1),dR=E(Mw);function uS(S,k){for(var T=-1,K=S==null?0:S.length;++T<K&&k(S[T],T,S)!==!1;);return S}function OU(S){return function(k,T,K){for(var G=-1,H=Object(k),ie=K(k),ce=ie.length;ce--;){var ke=ie[S?ce:++G];if(T(H[ke],ke,H)===!1)break}return k}}var KU=OU();function lh(S,k){return S&&KU(S,k,Nw)}function FU(S,k,T,K){for(var G=S.length,H=T+(K?1:-1);K?H--:++H<G;)if(k(S[H],H,S))return H;return-1}function LU(S){return S!==S}function UU(S,k,T){for(var K=T-1,G=S.length;++K<G;)if(S[K]===k)return K;return-1}function pS(S,k,T){return k===k?UU(S,k,T):FU(S,LU,T)}var Ow=function(S,k,T){typeof k=="function"&&(T=k,k=null),T=ar(T||Tt);var K=Nw(S),G=K.length;if(!G)return T(null);k||(k=G);var H={},ie=0,ce=!1,ke=Object.create(null),Ye=[],Pe=[],bt={};lh(S,function(Gr,an){if(!Rt(Gr)){Jr(an,[Gr]),Pe.push(an);return}var Gn=Gr.slice(0,Gr.length-1),Nc=Gn.length;if(Nc===0){Jr(an,Gr),Pe.push(an);return}bt[an]=Nc,uS(Gn,function(gh){if(!S[gh])throw new Error("async.auto task `"+an+"` has a non-existent dependency `"+gh+"` in "+Gn.join(", "));Qa(gh,function(){Nc--,Nc===0&&Jr(an,Gr)})})}),zY(),Ci();function Jr(Gr,an){Ye.push(function(){Ya(Gr,an)})}function Ci(){if(Ye.length===0&&ie===0)return T(null,H);for(;Ye.length&&ie<k;){var Gr=Ye.shift();Gr()}}function Qa(Gr,an){var Gn=ke[Gr];Gn||(Gn=ke[Gr]=[]),Gn.push(an)}function ys(Gr){var an=ke[Gr]||[];uS(an,function(Gn){Gn()}),Ci()}function Ya(Gr,an){if(!ce){var Gn=ua(function(gh,aA){if(ie--,arguments.length>2&&(aA=e(arguments,1)),gh){var lA={};lh(H,function(YY,XY){lA[XY]=YY}),lA[Gr]=aA,ce=!0,ke=Object.create(null),T(gh,lA)}else H[Gr]=aA,ys(Gr)});ie++;var Nc=C(an[an.length-1]);an.length>1?Nc(H,Gn):Nc(Gn)}}function zY(){for(var Gr,an=0;Pe.length;)Gr=Pe.pop(),an++,uS(QY(Gr),function(Gn){--bt[Gn]===0&&Pe.push(Gn)});if(an!==G)throw new Error("async.auto cannot execute tasks due to a recursive dependency")}function QY(Gr){var an=[];return lh(S,function(Gn,Nc){Rt(Gn)&&pS(Gn,Gr,0)>=0&&an.push(Nc)}),an}};function rm(S,k){for(var T=-1,K=S==null?0:S.length,G=Array(K);++T<K;)G[T]=k(S[T],T,S);return G}var jU="[object Symbol]";function WU(S){return typeof S=="symbol"||j(S)&&Q(S)==jU}var VU=1/0,mR=te?te.prototype:void 0,fR=mR?mR.toString:void 0;function Kw(S){if(typeof S=="string")return S;if(Rt(S))return rm(S,Kw)+"";if(WU(S))return fR?fR.call(S):"";var k=S+"";return k=="0"&&1/S==-VU?"-0":k}function BU(S,k,T){var K=-1,G=S.length;k<0&&(k=-k>G?0:G+k),T=T>G?G:T,T<0&&(T+=G),G=k>T?0:T-k>>>0,k>>>=0;for(var H=Array(G);++K<G;)H[K]=S[K+k];return H}function qU(S,k,T){var K=S.length;return T=T===void 0?K:T,!k&&T>=K?S:BU(S,k,T)}function JU(S,k){for(var T=S.length;T--&&pS(k,S[T],0)>-1;);return T}function $U(S,k){for(var T=-1,K=S.length;++T<K&&pS(k,S[T],0)>-1;);return T}function HU(S){return S.split("")}var GU="\\ud800-\\udfff",zU="\\u0300-\\u036f",QU="\\ufe20-\\ufe2f",YU="\\u20d0-\\u20ff",XU=zU+QU+YU,ZU="\\ufe0e\\ufe0f",ej="\\u200d",tj=RegExp("["+ej+GU+XU+ZU+"]");function rj(S){return tj.test(S)}var hR="\\ud800-\\udfff",nj="\\u0300-\\u036f",ij="\\ufe20-\\ufe2f",oj="\\u20d0-\\u20ff",sj=nj+ij+oj,aj="\\ufe0e\\ufe0f",lj="["+hR+"]",Fw="["+sj+"]",Lw="\\ud83c[\\udffb-\\udfff]",cj="(?:"+Fw+"|"+Lw+")",gR="[^"+hR+"]",vR="(?:\\ud83c[\\udde6-\\uddff]){2}",yR="[\\ud800-\\udbff][\\udc00-\\udfff]",uj="\\u200d",bR=cj+"?",IR="["+aj+"]?",pj="(?:"+uj+"(?:"+[gR,vR,yR].join("|")+")"+IR+bR+")*",dj=IR+bR+pj,mj="(?:"+[gR+Fw+"?",Fw,vR,yR,lj].join("|")+")",fj=RegExp(Lw+"(?="+Lw+")|"+mj+dj,"g");function hj(S){return S.match(fj)||[]}function SR(S){return rj(S)?hj(S):HU(S)}function gj(S){return S==null?"":Kw(S)}var vj=/^\s+|\s+$/g;function yj(S,k,T){if(S=gj(S),S&&(T||k===void 0))return S.replace(vj,"");if(!S||!(k=Kw(k)))return S;var K=SR(S),G=SR(k),H=$U(K,G),ie=JU(K,G)+1;return qU(K,H,ie).join("")}var bj=/^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m,Ij=/,/,Sj=/(=.+)?(\s*)$/,xj=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;function Cj(S){return S=S.toString().replace(xj,""),S=S.match(bj)[2].replace(" ",""),S=S?S.split(Ij):[],S=S.map(function(k){return yj(k.replace(Sj,""))}),S}function xR(S,k){var T={};lh(S,function(K,G){var H,ie=b(K),ce=!ie&&K.length===1||ie&&K.length===0;if(Rt(K))H=K.slice(0,-1),K=K[K.length-1],T[G]=H.concat(H.length>0?ke:K);else if(ce)T[G]=K;else{if(H=Cj(K),K.length===0&&!ie&&H.length===0)throw new Error("autoInject task functions require explicit parameters.");ie||H.pop(),T[G]=H.concat(ke)}function ke(Ye,Pe){var bt=rm(H,function(Jr){return Ye[Jr]});bt.push(Pe),C(K).apply(null,bt)}}),Ow(T,k)}function vs(){this.head=this.tail=null,this.length=0}function CR(S,k){S.length=1,S.head=S.tail=k}vs.prototype.removeLink=function(S){return S.prev?S.prev.next=S.next:this.head=S.next,S.next?S.next.prev=S.prev:this.tail=S.prev,S.prev=S.next=null,this.length-=1,S},vs.prototype.empty=function(){for(;this.head;)this.shift();return this},vs.prototype.insertAfter=function(S,k){k.prev=S,k.next=S.next,S.next?S.next.prev=k:this.tail=k,S.next=k,this.length+=1},vs.prototype.insertBefore=function(S,k){k.prev=S.prev,k.next=S,S.prev?S.prev.next=k:this.head=k,S.prev=k,this.length+=1},vs.prototype.unshift=function(S){this.head?this.insertBefore(this.head,S):CR(this,S)},vs.prototype.push=function(S){this.tail?this.insertAfter(this.tail,S):CR(this,S)},vs.prototype.shift=function(){return this.head&&this.removeLink(this.head)},vs.prototype.pop=function(){return this.tail&&this.removeLink(this.tail)},vs.prototype.toArray=function(){for(var S=Array(this.length),k=this.head,T=0;T<this.length;T++)S[T]=k.data,k=k.next;return S},vs.prototype.remove=function(S){for(var k=this.head;k;){var T=k.next;S(k)&&this.removeLink(k),k=T}return this};function wR(S,k,T){if(k==null)k=1;else if(k===0)throw new Error("Concurrency must not be zero");var K=C(S),G=0,H=[],ie=!1;function ce(bt,Jr,Ci){if(Ci!=null&&typeof Ci!="function")throw new Error("task callback must be a function");if(Pe.started=!0,Rt(bt)||(bt=[bt]),bt.length===0&&Pe.idle())return u(function(){Pe.drain()});for(var Qa=0,ys=bt.length;Qa<ys;Qa++){var Ya={data:bt[Qa],callback:Ci||Tt};Jr?Pe._tasks.unshift(Ya):Pe._tasks.push(Ya)}ie||(ie=!0,u(function(){ie=!1,Pe.process()}))}function ke(bt){return function(Jr){G-=1;for(var Ci=0,Qa=bt.length;Ci<Qa;Ci++){var ys=bt[Ci],Ya=pS(H,ys,0);Ya===0?H.shift():Ya>0&&H.splice(Ya,1),ys.callback.apply(ys,arguments),Jr!=null&&Pe.error(Jr,ys.data)}G<=Pe.concurrency-Pe.buffer&&Pe.unsaturated(),Pe.idle()&&Pe.drain(),Pe.process()}}var Ye=!1,Pe={_tasks:new vs,concurrency:k,payload:T,saturated:Tt,unsaturated:Tt,buffer:k/4,empty:Tt,drain:Tt,error:Tt,started:!1,paused:!1,push:function(bt,Jr){ce(bt,!1,Jr)},kill:function(){Pe.drain=Tt,Pe._tasks.empty()},unshift:function(bt,Jr){ce(bt,!0,Jr)},remove:function(bt){Pe._tasks.remove(bt)},process:function(){if(!Ye){for(Ye=!0;!Pe.paused&&G<Pe.concurrency&&Pe._tasks.length;){var bt=[],Jr=[],Ci=Pe._tasks.length;Pe.payload&&(Ci=Math.min(Ci,Pe.payload));for(var Qa=0;Qa<Ci;Qa++){var ys=Pe._tasks.shift();bt.push(ys),H.push(ys),Jr.push(ys.data)}G+=1,Pe._tasks.length===0&&Pe.empty(),G===Pe.concurrency&&Pe.saturated();var Ya=ua(ke(bt));K(Jr,Ya)}Ye=!1}},length:function(){return Pe._tasks.length},running:function(){return G},workersList:function(){return H},idle:function(){return Pe._tasks.length+G===0},pause:function(){Pe.paused=!0},resume:function(){Pe.paused!==!1&&(Pe.paused=!1,u(Pe.process))}};return Pe}function ER(S,k){return wR(S,1,k)}var nm=Hn(qu,1);function Ac(S,k,T,K){K=ar(K||Tt);var G=C(T);nm(S,function(H,ie,ce){G(k,H,function(ke,Ye){k=Ye,ce(ke)})},function(H){K(H,k)})}function Uw(){var S=rm(arguments,C);return function(){var k=e(arguments),T=this,K=k[k.length-1];typeof K=="function"?k.pop():K=Tt,Ac(S,k,function(G,H,ie){H.apply(T,G.concat(function(ce){var ke=e(arguments,1);ie(ce,ke)}))},function(G,H){K.apply(T,[G].concat(H))})}}var kR=function(){return Uw.apply(null,e(arguments).reverse())},wj=Array.prototype.concat,dS=function(S,k,T,K){K=K||Tt;var G=C(T);tm(S,k,function(H,ie){G(H,function(ce){return ce?ie(ce):ie(null,e(arguments,1))})},function(H,ie){for(var ce=[],ke=0;ke<ie.length;ke++)ie[ke]&&(ce=wj.apply(ce,ie[ke]));return K(H,ce)})},PR=Hn(dS,1/0),DR=Hn(dS,1),_R=function(){var S=e(arguments),k=[null].concat(S);return function(){var T=arguments[arguments.length-1];return T.apply(this,k)}};function ch(S){return S}function im(S,k){return function(T,K,G,H){H=H||Tt;var ie=!1,ce;T(K,function(ke,Ye,Pe){G(ke,function(bt,Jr){bt?Pe(bt):S(Jr)&&!ce?(ie=!0,ce=k(!0,ke),Pe(null,$i)):Pe()})},function(ke){ke?H(ke):H(null,ie?ce:k(!1))})}}function TR(S,k){return k}var mS=Zd(im(ch,TR)),uh=em(im(ch,TR)),fS=Hn(uh,1);function RR(S){return function(k){var T=e(arguments,1);T.push(function(K){var G=e(arguments,1);typeof console=="object"&&(K?console.error&&console.error(K):console[S]&&uS(G,function(H){console[S](H)}))}),C(k).apply(null,T)}}var AR=RR("dir");function NR(S,k,T){T=ua(T||Tt);var K=C(S),G=C(k);function H(ce){if(ce)return T(ce);var ke=e(arguments,1);ke.push(ie),G.apply(this,ke)}function ie(ce,ke){if(ce)return T(ce);if(!ke)return T(null);K(H)}ie(null,!0)}function jw(S,k,T){T=ua(T||Tt);var K=C(S),G=function(H){if(H)return T(H);var ie=e(arguments,1);if(k.apply(this,ie))return K(G);T.apply(null,[null].concat(ie))};K(G)}function MR(S,k,T){jw(S,function(){return!k.apply(this,arguments)},T)}function OR(S,k,T){T=ua(T||Tt);var K=C(k),G=C(S);function H(ce){if(ce)return T(ce);G(ie)}function ie(ce,ke){if(ce)return T(ce);if(!ke)return T(null);K(H)}G(ie)}function KR(S){return function(k,T,K){return S(k,K)}}function hS(S,k,T){Rc(S,KR(C(k)),T)}function ph(S,k,T,K){lS(k)(S,KR(C(T)),K)}var dh=Hn(ph,1);function Ww(S){return b(S)?S:n(function(k,T){var K=!0;k.push(function(){var G=arguments;K?u(function(){T.apply(null,G)}):T.apply(null,G)}),S.apply(this,k),K=!1})}function gS(S){return!S}var vS=Zd(im(gS,gS)),mh=em(im(gS,gS)),yS=Hn(mh,1);function FR(S){return function(k){return k?.[S]}}function Ej(S,k,T,K){var G=new Array(k.length);S(k,function(H,ie,ce){T(H,function(ke,Ye){G[ie]=!!Ye,ce(ke)})},function(H){if(H)return K(H);for(var ie=[],ce=0;ce<k.length;ce++)G[ce]&&ie.push(k[ce]);K(null,ie)})}function kj(S,k,T,K){var G=[];S(k,function(H,ie,ce){T(H,function(ke,Ye){ke?ce(ke):(Ye&&G.push({index:ie,value:H}),ce())})},function(H){H?K(H):K(null,rm(G.sort(function(ie,ce){return ie.index-ce.index}),FR("value")))})}function Vw(S,k,T,K){var G=rn(k)?Ej:kj;G(S,k,C(T),K||Tt)}var bS=Zd(Vw),fh=em(Vw),IS=Hn(fh,1);function LR(S,k){var T=ua(k||Tt),K=C(Ww(S));function G(H){if(H)return T(H);K(G)}G()}var SS=function(S,k,T,K){K=K||Tt;var G=C(T);tm(S,k,function(H,ie){G(H,function(ce,ke){return ce?ie(ce):ie(null,{key:ke,val:H})})},function(H,ie){for(var ce={},ke=Object.prototype.hasOwnProperty,Ye=0;Ye<ie.length;Ye++)if(ie[Ye]){var Pe=ie[Ye].key,bt=ie[Ye].val;ke.call(ce,Pe)?ce[Pe].push(bt):ce[Pe]=[bt]}return K(H,ce)})},UR=Hn(SS,1/0),jR=Hn(SS,1),WR=RR("log");function xS(S,k,T,K){K=ar(K||Tt);var G={},H=C(T);qu(S,k,function(ie,ce,ke){H(ie,ce,function(Ye,Pe){if(Ye)return ke(Ye);G[ce]=Pe,ke()})},function(ie){K(ie,G)})}var VR=Hn(xS,1/0),BR=Hn(xS,1);function qR(S,k){return k in S}function JR(S,k){var T=Object.create(null),K=Object.create(null);k=k||ch;var G=C(S),H=n(function(ce,ke){var Ye=k.apply(null,ce);qR(T,Ye)?u(function(){ke.apply(null,T[Ye])}):qR(K,Ye)?K[Ye].push(ke):(K[Ye]=[ke],G.apply(null,ce.concat(function(){var Pe=e(arguments);T[Ye]=Pe;var bt=K[Ye];delete K[Ye];for(var Jr=0,Ci=bt.length;Jr<Ci;Jr++)bt[Jr].apply(null,Pe)})))});return H.memo=T,H.unmemoized=S,H}var CS;s?CS=process.nextTick:o?CS=setImmediate:CS=a;var $R=l(CS);function Bw(S,k,T){T=T||Tt;var K=rn(k)?[]:{};S(k,function(G,H,ie){C(G)(function(ce,ke){arguments.length>2&&(ke=e(arguments,1)),K[H]=ke,ie(ce)})},function(G){T(G,K)})}function HR(S,k){Bw(Rc,S,k)}function GR(S,k,T){Bw(lS(k),S,T)}var qw=function(S,k){var T=C(S);return wR(function(K,G){T(K[0],G)},k,1)},zR=function(S,k){var T=qw(S,k);return T.push=function(K,G,H){if(H==null&&(H=Tt),typeof H!="function")throw new Error("task callback must be a function");if(T.started=!0,Rt(K)||(K=[K]),K.length===0)return u(function(){T.drain()});G=G||0;for(var ie=T._tasks.head;ie&&G>=ie.priority;)ie=ie.next;for(var ce=0,ke=K.length;ce<ke;ce++){var Ye={data:K[ce],priority:G,callback:H};ie?T._tasks.insertBefore(ie,Ye):T._tasks.push(Ye)}u(T.process)},delete T.unshift,T};function QR(S,k){if(k=ar(k||Tt),!Rt(S))return k(new TypeError("First argument to race must be an array of functions"));if(!S.length)return k();for(var T=0,K=S.length;T<K;T++)C(S[T])(k)}function wS(S,k,T,K){var G=e(S).reverse();Ac(G,k,T,K)}function ES(S){var k=C(S);return n(function(K,G){return K.push(function(ie,ce){if(ie)G(null,{error:ie});else{var ke;arguments.length<=2?ke=ce:ke=e(arguments,1),G(null,{value:ke})}}),k.apply(this,K)})}function YR(S){var k;return Rt(S)?k=rm(S,ES):(k={},lh(S,function(T,K){k[K]=ES.call(this,T)})),k}function XR(S,k,T,K){Vw(S,k,function(G,H){T(G,function(ie,ce){H(ie,!ce)})},K)}var ZR=Zd(XR),Jw=em(XR),eA=Hn(Jw,1);function tA(S){return function(){return S}}function kS(S,k,T){var K=5,G=0,H={times:K,intervalFunc:tA(G)};function ie(Pe,bt){if(typeof bt=="object")Pe.times=+bt.times||K,Pe.intervalFunc=typeof bt.interval=="function"?bt.interval:tA(+bt.interval||G),Pe.errorFilter=bt.errorFilter;else if(typeof bt=="number"||typeof bt=="string")Pe.times=+bt||K;else throw new Error("Invalid arguments for async.retry")}if(arguments.length<3&&typeof S=="function"?(T=k||Tt,k=S):(ie(H,S),T=T||Tt),typeof k!="function")throw new Error("Invalid arguments for async.retry");var ce=C(k),ke=1;function Ye(){ce(function(Pe){Pe&&ke++<H.times&&(typeof H.errorFilter!="function"||H.errorFilter(Pe))?setTimeout(Ye,H.intervalFunc(ke)):T.apply(null,arguments)})}Ye()}var rA=function(S,k){k||(k=S,S=null);var T=C(k);return n(function(K,G){function H(ie){T.apply(null,K.concat(ie))}S?kS(S,H,G):kS(H,G)})};function nA(S,k){Bw(nm,S,k)}var PS=Zd(im(Boolean,ch)),hh=em(im(Boolean,ch)),DS=Hn(hh,1);function iA(S,k,T){var K=C(k);cS(S,function(H,ie){K(H,function(ce,ke){if(ce)return ie(ce);ie(null,{value:H,criteria:ke})})},function(H,ie){if(H)return T(H);T(null,rm(ie.sort(G),FR("value")))});function G(H,ie){var ce=H.criteria,ke=ie.criteria;return ce<ke?-1:ce>ke?1:0}}function oA(S,k,T){var K=C(S);return n(function(G,H){var ie=!1,ce;function ke(){var Ye=S.name||"anonymous",Pe=new Error('Callback function "'+Ye+'" timed out.');Pe.code="ETIMEDOUT",T&&(Pe.info=T),ie=!0,H(Pe)}G.push(function(){ie||(H.apply(null,arguments),clearTimeout(ce))}),ce=setTimeout(ke,k),K.apply(null,G)})}var Pj=Math.ceil,Dj=Math.max;function D(S,k,T,K){for(var G=-1,H=Dj(Pj((k-S)/(T||1)),0),ie=Array(H);H--;)ie[K?H:++G]=S,S+=T;return ie}function U(S,k,T,K){var G=C(T);tm(D(0,S,1),k,G,K)}var Ge=Hn(U,1/0),$w=Hn(U,1);function _j(S,k,T,K){arguments.length<=3&&(K=T,T=k,k=Rt(S)?[]:{}),K=ar(K||Tt);var G=C(T);Rc(S,function(H,ie,ce){G(k,H,ie,ce)},function(H){K(H,k)})}function Tj(S,k){var T=null,K;k=k||Tt,dh(S,function(G,H){C(G)(function(ie,ce){arguments.length>2?K=e(arguments,1):K=ce,T=ie,H(!ie)})},function(){k(T,K)})}function Rj(S){return function(){return(S.unmemoized||S).apply(null,arguments)}}function sA(S,k,T){T=ua(T||Tt);var K=C(k);if(!S())return T(null);var G=function(H){if(H)return T(H);if(S())return K(G);var ie=e(arguments,1);T.apply(null,[null].concat(ie))};K(G)}function Aj(S,k,T){sA(function(){return!S.apply(this,arguments)},k,T)}var Nj=function(S,k){if(k=ar(k||Tt),!Rt(S))return k(new Error("First argument to waterfall must be an array of functions"));if(!S.length)return k();var T=0;function K(H){var ie=C(S[T++]);H.push(ua(G)),ie.apply(null,H)}function G(H){if(H||T===S.length)return k.apply(null,arguments);K(e(arguments,1))}K([])},GY={apply:t,applyEach:pR,applyEachSeries:dR,asyncify:p,auto:Ow,autoInject:xR,cargo:ER,compose:kR,concat:PR,concatLimit:dS,concatSeries:DR,constant:_R,detect:mS,detectLimit:uh,detectSeries:fS,dir:AR,doDuring:NR,doUntil:MR,doWhilst:jw,during:OR,each:hS,eachLimit:ph,eachOf:Rc,eachOfLimit:qu,eachOfSeries:nm,eachSeries:dh,ensureAsync:Ww,every:vS,everyLimit:mh,everySeries:yS,filter:bS,filterLimit:fh,filterSeries:IS,forever:LR,groupBy:UR,groupByLimit:SS,groupBySeries:jR,log:WR,map:cS,mapLimit:tm,mapSeries:Mw,mapValues:VR,mapValuesLimit:xS,mapValuesSeries:BR,memoize:JR,nextTick:$R,parallel:HR,parallelLimit:GR,priorityQueue:zR,queue:qw,race:QR,reduce:Ac,reduceRight:wS,reflect:ES,reflectAll:YR,reject:ZR,rejectLimit:Jw,rejectSeries:eA,retry:kS,retryable:rA,seq:Uw,series:nA,setImmediate:u,some:PS,someLimit:hh,someSeries:DS,sortBy:iA,timeout:oA,times:Ge,timesLimit:U,timesSeries:$w,transform:_j,tryEach:Tj,unmemoize:Rj,until:Aj,waterfall:Nj,whilst:sA,all:vS,allLimit:mh,allSeries:yS,any:PS,anyLimit:hh,anySeries:DS,find:mS,findLimit:uh,findSeries:fS,forEach:hS,forEachSeries:dh,forEachLimit:ph,forEachOf:Rc,forEachOfSeries:nm,forEachOfLimit:qu,inject:Ac,foldl:Ac,foldr:wS,select:bS,selectLimit:fh,selectSeries:IS,wrapSync:p};r.default=GY,r.apply=t,r.applyEach=pR,r.applyEachSeries=dR,r.asyncify=p,r.auto=Ow,r.autoInject=xR,r.cargo=ER,r.compose=kR,r.concat=PR,r.concatLimit=dS,r.concatSeries=DR,r.constant=_R,r.detect=mS,r.detectLimit=uh,r.detectSeries=fS,r.dir=AR,r.doDuring=NR,r.doUntil=MR,r.doWhilst=jw,r.during=OR,r.each=hS,r.eachLimit=ph,r.eachOf=Rc,r.eachOfLimit=qu,r.eachOfSeries=nm,r.eachSeries=dh,r.ensureAsync=Ww,r.every=vS,r.everyLimit=mh,r.everySeries=yS,r.filter=bS,r.filterLimit=fh,r.filterSeries=IS,r.forever=LR,r.groupBy=UR,r.groupByLimit=SS,r.groupBySeries=jR,r.log=WR,r.map=cS,r.mapLimit=tm,r.mapSeries=Mw,r.mapValues=VR,r.mapValuesLimit=xS,r.mapValuesSeries=BR,r.memoize=JR,r.nextTick=$R,r.parallel=HR,r.parallelLimit=GR,r.priorityQueue=zR,r.queue=qw,r.race=QR,r.reduce=Ac,r.reduceRight=wS,r.reflect=ES,r.reflectAll=YR,r.reject=ZR,r.rejectLimit=Jw,r.rejectSeries=eA,r.retry=kS,r.retryable=rA,r.seq=Uw,r.series=nA,r.setImmediate=u,r.some=PS,r.someLimit=hh,r.someSeries=DS,r.sortBy=iA,r.timeout=oA,r.times=Ge,r.timesLimit=U,r.timesSeries=$w,r.transform=_j,r.tryEach=Tj,r.unmemoize=Rj,r.until=Aj,r.waterfall=Nj,r.whilst=sA,r.all=vS,r.allLimit=mh,r.allSeries=yS,r.any=PS,r.anyLimit=hh,r.anySeries=DS,r.find=mS,r.findLimit=uh,r.findSeries=fS,r.forEach=hS,r.forEachSeries=dh,r.forEachLimit=ph,r.forEachOf=Rc,r.forEachOfSeries=nm,r.forEachOfLimit=qu,r.inject=Ac,r.foldl=Ac,r.foldr=wS,r.select=bS,r.selectLimit=fh,r.selectSeries=IS,r.wrapSync=p,Object.defineProperty(r,"__esModule",{value:!0})})});var eL=N((vnt,z4)=>{"use strict";function lye(r){t.debug=t,t.default=t,t.coerce=l,t.disable=s,t.enable=o,t.enabled=a,t.humanize=mP(),Object.keys(r).forEach(function(c){t[c]=r[c]}),t.instances=[],t.names=[],t.skips=[],t.formatters={};function e(c){for(var u=0,p=0;p<c.length;p++)u=(u<<5)-u+c.charCodeAt(p),u|=0;return t.colors[Math.abs(u)%t.colors.length]}t.selectColor=e;function t(c){var u;function p(){if(p.enabled){for(var f=arguments.length,g=new Array(f),v=0;v<f;v++)g[v]=arguments[v];var b=p,C=Number(new Date),E=C-(u||C);b.diff=E,b.prev=u,b.curr=C,u=C,g[0]=t.coerce(g[0]),typeof g[0]!="string"&&g.unshift("%O");var R=0;g[0]=g[0].replace(/%([a-zA-Z%])/g,function(L,te){if(L==="%%")return L;R++;var $=t.formatters[te];if(typeof $=="function"){var se=g[R];L=$.call(b,se),g.splice(R,1),R--}return L}),t.formatArgs.call(b,g);var _=b.log||t.log;_.apply(b,g)}}return p.namespace=c,p.enabled=t.enabled(c),p.useColors=t.useColors(),p.color=e(c),p.destroy=n,p.extend=i,typeof t.init=="function"&&t.init(p),t.instances.push(p),p}function n(){var c=t.instances.indexOf(this);return c!==-1?(t.instances.splice(c,1),!0):!1}function i(c,u){return t(this.namespace+(typeof u>"u"?":":u)+c)}function o(c){t.save(c),t.names=[],t.skips=[];var u,p=(typeof c=="string"?c:"").split(/[\s,]+/),f=p.length;for(u=0;u<f;u++)p[u]&&(c=p[u].replace(/\*/g,".*?"),c[0]==="-"?t.skips.push(new RegExp("^"+c.substr(1)+"$")):t.names.push(new RegExp("^"+c+"$")));for(u=0;u<t.instances.length;u++){var g=t.instances[u];g.enabled=t.enabled(g.namespace)}}function s(){t.enable("")}function a(c){if(c[c.length-1]==="*")return!0;var u,p;for(u=0,p=t.skips.length;u<p;u++)if(t.skips[u].test(c))return!1;for(u=0,p=t.names.length;u<p;u++)if(t.names[u].test(c))return!0;return!1}function l(c){return c instanceof Error?c.stack||c.message:c}return t.enable(t.load()),t}z4.exports=lye});var Q4=N((Zs,hT)=>{"use strict";function fT(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?fT=function(t){return typeof t}:fT=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fT(r)}Zs.log=pye;Zs.formatArgs=uye;Zs.save=dye;Zs.load=mye;Zs.useColors=cye;Zs.storage=fye();Zs.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function cye(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function uye(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+hT.exports.humanize(this.diff),!!this.useColors){var e="color: "+this.color;r.splice(1,0,e,"color: inherit");var t=0,n=0;r[0].replace(/%[a-zA-Z%]/g,function(i){i!=="%%"&&(t++,i==="%c"&&(n=t))}),r.splice(n,0,e)}}function pye(){var r;return(typeof console>"u"?"undefined":fT(console))==="object"&&console.log&&(r=console).log.apply(r,arguments)}function dye(r){try{r?Zs.storage.setItem("debug",r):Zs.storage.removeItem("debug")}catch{}}function mye(){var r;try{r=Zs.storage.getItem("debug")}catch{}return!r&&typeof process<"u"&&"env"in process&&(r=process.env.DEBUG),r}function fye(){try{return localStorage}catch{}}hT.exports=eL()(Zs);var hye=hT.exports.formatters;hye.j=function(r){try{return JSON.stringify(r)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var X4=N((Bi,yT)=>{"use strict";var gye=require("tty"),vT=require("util");Bi.init=Cye;Bi.log=Iye;Bi.formatArgs=yye;Bi.save=Sye;Bi.load=xye;Bi.useColors=vye;Bi.colors=[6,2,3,4,5,1];try{gT=hP(),gT&&(gT.stderr||gT).level>=2&&(Bi.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}var gT;Bi.inspectOpts=Object.keys(process.env).filter(function(r){return/^debug_/i.test(r)}).reduce(function(r,e){var t=e.substring(6).toLowerCase().replace(/_([a-z])/g,function(i,o){return o.toUpperCase()}),n=process.env[e];return/^(yes|on|true|enabled)$/i.test(n)?n=!0:/^(no|off|false|disabled)$/i.test(n)?n=!1:n==="null"?n=null:n=Number(n),r[t]=n,r},{});function vye(){return"colors"in Bi.inspectOpts?!!Bi.inspectOpts.colors:gye.isatty(process.stderr.fd)}function yye(r){var e=this.namespace,t=this.useColors;if(t){var n=this.color,i="\x1B[3"+(n<8?n:"8;5;"+n),o=" ".concat(i,";1m").concat(e," \x1B[0m");r[0]=o+r[0].split(`
|
||
`).join(`
|
||
`+o),r.push(i+"m+"+yT.exports.humanize(this.diff)+"\x1B[0m")}else r[0]=bye()+e+" "+r[0]}function bye(){return Bi.inspectOpts.hideDate?"":new Date().toISOString()+" "}function Iye(){return process.stderr.write(vT.format.apply(vT,arguments)+`
|
||
`)}function Sye(r){r?process.env.DEBUG=r:delete process.env.DEBUG}function xye(){return process.env.DEBUG}function Cye(r){r.inspectOpts={};for(var e=Object.keys(Bi.inspectOpts),t=0;t<e.length;t++)r.inspectOpts[e[t]]=Bi.inspectOpts[e[t]]}yT.exports=eL()(Bi);var Y4=yT.exports.formatters;Y4.o=function(r){return this.inspectOpts.colors=this.useColors,vT.inspect(r,this.inspectOpts).split(`
|
||
`).map(function(e){return e.trim()}).join(" ")};Y4.O=function(r){return this.inspectOpts.colors=this.useColors,vT.inspect(r,this.inspectOpts)}});var Z4=N((ynt,tL)=>{"use strict";typeof process>"u"||process.type==="renderer"||process.browser===!0||process.__nwjs?tL.exports=Q4():tL.exports=X4()});var nG=N((bnt,rG)=>{var VC=require("path"),eG=require("fs"),tG=parseInt("0777",8);rG.exports=Zy.mkdirp=Zy.mkdirP=Zy;function Zy(r,e,t,n){typeof e=="function"?(t=e,e={}):(!e||typeof e!="object")&&(e={mode:e});var i=e.mode,o=e.fs||eG;i===void 0&&(i=tG),n||(n=null);var s=t||function(){};r=VC.resolve(r),o.mkdir(r,i,function(a){if(!a)return n=n||r,s(null,n);switch(a.code){case"ENOENT":if(VC.dirname(r)===r)return s(a);Zy(VC.dirname(r),e,function(l,c){l?s(l,c):Zy(r,e,s,c)});break;default:o.stat(r,function(l,c){l||!c.isDirectory()?s(a,n):s(null,n)});break}})}Zy.sync=function r(e,t,n){(!t||typeof t!="object")&&(t={mode:t});var i=t.mode,o=t.fs||eG;i===void 0&&(i=tG),n||(n=null),e=VC.resolve(e);try{o.mkdirSync(e,i),n=n||e}catch(a){switch(a.code){case"ENOENT":n=r(VC.dirname(e),t,n),r(e,t,n);break;default:var s;try{s=o.statSync(e)}catch{throw a}if(!s.isDirectory())throw a;break}}return n}});var sG=N(xr=>{"use strict";var iG=require("fs"),wye=require("os"),Eye=require("net"),bT=require("path"),oG=G4(),iL=Z4(),kye=nG().mkdirp,rL=iL("portfinder:testPort"),BC=iL("portfinder:getPort"),Pye=iL("portfinder:defaultHosts"),nL={};nL.testPort=function(r,e){e||(e=r,r={}),r.server=r.server||Eye.createServer(function(){}),rL("entered testPort(): trying",r.host,"port",r.port);function t(){rL("done w/ testPort(): OK",r.host,"port",r.port),r.server.removeListener("error",n),r.server.close(),e(null,r.port)}function n(i){if(rL("done w/ testPort(): failed",r.host,"w/ port",r.port,"with error",i.code),r.server.removeListener("listening",t),!(i.code=="EADDRINUSE"||i.code=="EACCES"))return e(i);var o=xr.nextPort(r.port);if(o>xr.highestPort)return e(new Error("No open ports available"));nL.testPort({port:o,host:r.host,server:r.server},e)}r.server.once("error",n),r.server.once("listening",t),r.host?r.server.listen(r.port,r.host):r.server.listen(r.port)};xr.basePort=8e3;xr.highestPort=65535;xr.basePath="/tmp/portfinder";xr.getPort=function(r,e){if(e||(e=r,r={}),r.port=Number(r.port)||Number(xr.basePort),r.host=r.host||null,r.stopPort=Number(r.stopPort)||Number(xr.highestPort),!r.startPort){if(r.startPort=Number(r.port),r.startPort<0)throw Error("Provided options.startPort("+r.startPort+") is less than 0, which are cannot be bound.");if(r.stopPort<r.startPort)throw Error("Provided options.stopPort("+r.stopPort+"is less than options.startPort ("+r.startPort+")")}if(r.host){for(var t,n=0;n<xr._defaultHosts.length;n++)if(xr._defaultHosts[n]===r.host){t=!0;break}t||xr._defaultHosts.push(r.host)}var i=[],o;return oG.eachSeries(xr._defaultHosts,function(s,a){return BC("in eachSeries() iteration callback: host is",s),nL.testPort({host:s,port:r.port},function(l,c){return l?(BC("in eachSeries() iteration callback testPort() callback","with an err:",l.code),o=s,a(l)):(BC("in eachSeries() iteration callback testPort() callback","with a success for port",c),i.push(c),a())})},function(s){if(s)if(BC("in eachSeries() result callback: err is",s),s.code==="EADDRNOTAVAIL"||s.code==="EINVAL")if(r.host===o){var a="Provided host "+r.host+" could NOT be bound. Please provide a different host address or hostname";return e(Error(a))}else{var l=xr._defaultHosts.indexOf(o);return xr._defaultHosts.splice(l,1),xr.getPort(r,e)}else return e(s);if(i.sort(function(c,u){return c-u}),BC("in eachSeries() result callback: openPorts is",i),i[0]===i[i.length-1]){if(i[0]<=r.stopPort)return e(null,i[0]);var a="No open ports found in between "+r.startPort+" and "+r.stopPort;return e(Error(a))}else return xr.getPort({port:i.pop(),host:r.host,startPort:r.startPort,stopPort:r.stopPort},e)})};xr.getPortPromise=function(r){if(typeof Promise!="function")throw Error("Native promise support is not available in this version of node.Please install a polyfill and assign Promise to global.Promise before calling this method");return r||(r={}),new Promise(function(e,t){xr.getPort(r,function(n,i){if(n)return t(n);e(i)})})};xr.getPorts=function(r,e,t){t||(t=e,e={});var n=null;oG.timesSeries(r,function(i,o){n&&(e.port=xr.nextPort(n)),xr.getPort(e,function(s,a){s?o(s):(n=a,o(null,a))})},t)};xr.getSocket=function(r,e){e||(e=r,r={}),r.mod=r.mod||parseInt(755,8),r.path=r.path||xr.basePath+".sock";function t(){iG.stat(r.path,function(o){o?o.code=="ENOENT"?e(null,r.path):e(o):(r.path=xr.nextSocket(r.path),xr.getSocket(r,e))})}function n(o){kye(o,r.mod,function(s){if(s)return e(s);r.exists=!0,t()})}function i(){var o=bT.dirname(r.path);iG.stat(o,function(s,a){if(s||!a.isDirectory())return n(o);r.exists=!0,t()})}return r.exists?t():i()};xr.nextPort=function(r){return r+1};xr.nextSocket=function(r){var e=bT.dirname(r),t=bT.basename(r,".sock"),n=t.match(/^([a-zA-z]+)(\d*)$/i),i=parseInt(n[2]),o=n[1];return isNaN(i)&&(i=0),i+=1,bT.join(e,o+i+".sock")};xr._defaultHosts=function(){var r={};try{r=wye.networkInterfaces()}catch(l){if(l.syscall!=="uv_interface_addresses")throw l}for(var e=Object.keys(r),t="0.0.0.0",n=[t],i=0;i<e.length;i++)for(var o=r[e[i]],s=0;s<o.length;s++){var a=o[s];n.push(a.address)}return n.push(null),Pye("exports._defaultHosts is: %o",n),n}()});var hG=N(eb=>{"use strict";Object.defineProperty(eb,"__esModule",{value:!0});eb.encode=eb.decode=void 0;var dG=require("crypto"),oL="<IDS|MSG>",Tye=5;function xT(r){return JSON.parse(r.toString())}function mG(r){return Object.assign({},{header:{},parent_header:{},metadata:{},content:{},idents:[],buffers:[]},r)}function fG(r){let e=r;switch(r){case"hmac-sha256":e="sha256";break}return e}function Rye(r,e,t="sha256"){var n=0;let i=[];for(n=0;n<r.length;n++){var o=r[n];if(o.toString()===oL)break;i.push(o)}if(r.length-n<Tye)throw new Error("Message Decoding: Not enough message frames");if(r[n].toString()!==oL)throw new Error("Message Decoding: Missing delimiter");if(e){let u=fG(t);var s=r[n+1].toString(),a=dG.createHmac(u,e);a.update(r[n+2]),a.update(r[n+3]),a.update(r[n+4]),a.update(r[n+5]);var l=a.digest("hex");if(l!==s)throw new Error(`Message Decoding: Incorrect;
|
||
Obtained "${s}"
|
||
Expected "${l}"`)}var c=mG({idents:i,header:xT(r[n+2]),parent_header:xT(r[n+3]),content:xT(r[n+5]),metadata:xT(r[n+4]),buffers:Array.prototype.slice.apply(r,[n+6])});return c}eb.decode=Rye;function Aye(r,e,t="sha256"){let n=mG(r),i=fG(t),o=n.idents,s=Buffer.from(JSON.stringify(n.header),"utf-8"),a=Buffer.from(JSON.stringify(n.parent_header),"utf-8"),l=Buffer.from(JSON.stringify(n.metadata),"utf-8"),c=Buffer.from(JSON.stringify(n.content),"utf-8"),u="";if(e){let f=dG.createHmac(i,e);f.update(s),f.update(a),f.update(l),f.update(c),u=f.digest("hex")}var p=o.concat([Buffer.from(oL),Buffer.from(u),s,a,l,c]).concat(n.buffers);return p}eb.encode=Aye});var DG=N((Dat,PG)=>{"use strict";PG.exports=({onlyFirst:r=!1}={})=>{let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(e,r?void 0:"g")}});var ez=N((lmt,ZG)=>{"use strict";var Yye=(r,e={})=>{let t=e.safe===!0||e.keepProtected===!0,n=!1,i=(o,s)=>{let a="",l,c;for(let u of o.nodes)switch(u.type){case"block":if(e.first&&n===!0){a+=i(u,o);break}if(e.preserveNewlines===!0){l=i(u,o),c=l.split(`
|
||
`),a+=`
|
||
`.repeat(c.length-1);break}if(t===!0&&u.protected===!0){a+=i(u,o);break}n=!0;break;case"line":if(e.first&&n===!0){a+=u.value;break}t===!0&&u.protected===!0&&(a+=u.value),n=!0;break;case"open":case"close":case"text":case"newline":default:{a+=u.value||"";break}}return a};return i(r)};ZG.exports=Yye});var rz=N((cmt,tz)=>{"use strict";var e0=class{constructor(e){this.type=e.type,e.value&&(this.value=e.value),e.match&&(this.match=e.match),this.newline=e.newline||""}get protected(){return!!this.match&&this.match[1]==="!"}},fL=class extends e0{constructor(e){super(e),this.nodes=e.nodes||[]}push(e){this.nodes.push(e)}get protected(){return this.nodes.length>0&&this.nodes[0].protected===!0}};tz.exports={Node:e0,Block:fL}});var iz=N(nz=>{"use strict";nz.javascript={BLOCK_OPEN_REGEX:/^\/\*\*?(!?)/,BLOCK_CLOSE_REGEX:/^\*\/(\n?)/,LINE_REGEX:/^\/\/(!?).*/}});var az=N((pmt,sz)=>{"use strict";var{Node:kd,Block:oz}=rz(),Xye=iz(),hL={ESCAPED_CHAR_REGEX:/^\\./,QUOTED_STRING_REGEX:/^(['"`])((?:\\.|[^\1])+?)(\1)/,NEWLINE_REGEX:/^\r*\n/},Zye=(r,e={})=>{if(typeof r!="string")throw new TypeError("Expected input to be a string");let t=new oz({type:"root",nodes:[]}),n=[t],i=(e.language||"javascript").toLowerCase(),o=Xye[i];if(typeof o>"u")throw new Error(`Language "${i}" is not supported by strip-comments`);let{LINE_REGEX:s,BLOCK_OPEN_REGEX:a,BLOCK_CLOSE_REGEX:l}=o,c=t,u=r,p,f,g=[a,l].filter(Boolean),v=!1;g.every(_=>_.source==='^"""')&&(v=!0);let b=(_=u[0]||"")=>(u=u.slice(_.length),_),C=(_,L="text")=>{let te=_.exec(u);if(te)return b(te[0]),{type:L,value:te[0],match:te}},E=_=>{if(f&&f.type==="text"&&_.type==="text"){f.value+=_.value;return}c.push(_),_.nodes&&(n.push(_),c=_),f=_},R=()=>{if(c.type==="root")throw new SyntaxError("Unclosed block comment");n.pop(),c=n[n.length-1]};for(;u!=="";){if(p=C(hL.ESCAPED_CHAR_REGEX,"text")){E(new kd(p));continue}if(c.type!=="block"&&(!f||!/\w$/.test(f.value))&&!(v&&u.startsWith('"""'))&&(p=C(hL.QUOTED_STRING_REGEX,"text"))){E(new kd(p));continue}if(p=C(hL.NEWLINE_REGEX,"newline")){E(new kd(p));continue}if(a&&e.block&&!(v&&c.type==="block")&&(p=C(a,"open"))){E(new oz({type:"block"})),E(new kd(p));continue}if(l&&c.type==="block"&&e.block&&(p=C(l,"close"))){p.newline=p.match[1]||"",E(new kd(p)),R();continue}if(s&&c.type!=="block"&&e.line&&(p=C(s,"line"))){E(new kd(p));continue}if(p=C(/^[a-zABD-Z0-9\t ]+/,"text")){E(new kd(p));continue}E(new kd({type:"text",value:b(u[0])}))}return t};sz.exports=Zye});var cz=N((dmt,lz)=>{"use strict";var t0=ez(),GC=az(),r0=lz.exports=(r,e)=>{let t={...e,block:!0,line:!0};return t0(GC(r,t),t)};r0.block=(r,e)=>{let t={...e,block:!0};return t0(GC(r,t),t)};r0.line=(r,e)=>{let t={...e,line:!0};return t0(GC(r,t),t)};r0.first=(r,e)=>{let t={...e,block:!0,line:!0,first:!0};return t0(GC(r,t),t)};r0.parse=GC});var Qz=N((kTt,zz)=>{var Pbe=typeof global=="object"&&global&&global.Object===Object&&global;zz.exports=Pbe});var Xz=N((PTt,Yz)=>{var Dbe=Qz(),_be=typeof self=="object"&&self&&self.Object===Object&&self,Tbe=Dbe||_be||Function("return this")();Yz.exports=Tbe});var Y0=N((DTt,Zz)=>{var Rbe=Xz(),Abe=Rbe.Symbol;Zz.exports=Abe});var tQ=N((_Tt,eQ)=>{function Nbe(r,e){for(var t=-1,n=r==null?0:r.length,i=Array(n);++t<n;)i[t]=e(r[t],t,r);return i}eQ.exports=Nbe});var nQ=N((TTt,rQ)=>{var Mbe=Array.isArray;rQ.exports=Mbe});var aQ=N((RTt,sQ)=>{var iQ=Y0(),oQ=Object.prototype,Obe=oQ.hasOwnProperty,Kbe=oQ.toString,dw=iQ?iQ.toStringTag:void 0;function Fbe(r){var e=Obe.call(r,dw),t=r[dw];try{r[dw]=void 0;var n=!0}catch{}var i=Kbe.call(r);return n&&(e?r[dw]=t:delete r[dw]),i}sQ.exports=Fbe});var cQ=N((ATt,lQ)=>{var Lbe=Object.prototype,Ube=Lbe.toString;function jbe(r){return Ube.call(r)}lQ.exports=jbe});var mQ=N((NTt,dQ)=>{var uQ=Y0(),Wbe=aQ(),Vbe=cQ(),Bbe="[object Null]",qbe="[object Undefined]",pQ=uQ?uQ.toStringTag:void 0;function Jbe(r){return r==null?r===void 0?qbe:Bbe:pQ&&pQ in Object(r)?Wbe(r):Vbe(r)}dQ.exports=Jbe});var hQ=N((MTt,fQ)=>{function $be(r){return r!=null&&typeof r=="object"}fQ.exports=$be});var vQ=N((OTt,gQ)=>{var Hbe=mQ(),Gbe=hQ(),zbe="[object Symbol]";function Qbe(r){return typeof r=="symbol"||Gbe(r)&&Hbe(r)==zbe}gQ.exports=Qbe});var CQ=N((KTt,xQ)=>{var yQ=Y0(),Ybe=tQ(),Xbe=nQ(),Zbe=vQ(),eIe=1/0,bQ=yQ?yQ.prototype:void 0,IQ=bQ?bQ.toString:void 0;function SQ(r){if(typeof r=="string")return r;if(Xbe(r))return Ybe(r,SQ)+"";if(Zbe(r))return IQ?IQ.call(r):"";var e=r+"";return e=="0"&&1/r==-eIe?"-0":e}xQ.exports=SQ});var EQ=N((FTt,wQ)=>{var tIe=CQ();function rIe(r){return r==null?"":tIe(r)}wQ.exports=rIe});var DQ=N((LTt,PQ)=>{var nIe=EQ(),kQ=/[\\^$.*+?()[\]{}|]/g,iIe=RegExp(kQ.source);function oIe(r){return r=nIe(r),r&&iIe.test(r)?r.replace(kQ,"\\$&"):r}PQ.exports=oIe});var SSe={};Oj(SSe,{activate:()=>hSe,deactivate:()=>gSe});module.exports=Fj(SSe);Reflect.metadata===void 0&&Uj();var rr=require("vscode");function vh(){try{return(Wj(),Fj(jj)).isPreRelesVersionOfJupyterExtension===!0}catch{return!0}}var TS={isExiting:!1},Hw="_builtin.JupyterServerSelectorForTesting",cA="_builtin.jupyterServerUrlProvider";var Vj=!1;function Bj(r){Vj=r}function om(){return Vj}var qj=!1;function Jj(r){qj=r}function ln(){return qj}var ye="python",RS="markdown",Mc="vscode-notebook-cell",oX={scheme:"untitled",language:ye},sX={scheme:"file",language:ye},Gw={language:ye},aX={scheme:Mc,language:ye},$j=[oX,sX,aX],zw="vscode-interactive-input",Et="jupyter-notebook",yt="interactive";var Xa="GitHub.codespaces",Ue="ms-toolsai.jupyter",Hj="ms-toolsai.vscode-jupyter-powertoys",yh="ms-toolsai.jupyter-hub",Gj="0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255",Ju="STANDARD_OUTPUT_CHANNEL",AS;(t=>(t.PythonInteractiveHelpLink="https://aka.ms/pyaiinstall",t.JupyterDataRateHelpLink="https://aka.ms/AA5ggm0"))(AS||={});var oi;(o=>(o.JupyterServerRemoteLaunchNameSeparator=`
|
||
`,o.JupyterServerRemoteLaunchService=Ue,o.JupyterServerUriListMax=10,o.IntellisenseTimeout=2e3,o.IntellisenseResolveTimeout=5e3))(oi||={});var wi=!1;var lX=!1;function _r(){return lX||NS()}var cX=!1;function NS(){return cX}var qe;(b=>(b.GeneratedThemeName="ipython-theme",b.MatplotLibDefaultParams="_VSCode_defaultMatplotlib_Params",b.MatplotLibFigureFormats="_VSCode_matplotLib_FigureFormats",b.DefaultCodeCellMarker="# %%",b.DefaultCommTarget="jupyter.widget",b.ALL_VARIABLES="ALL_VARIABLES",b.KERNEL_VARIABLES="KERNEL_VARIABLES",b.DEBUGGER_VARIABLES="DEBUGGER_VARIABLES",b.PYTHON_VARIABLES_REQUESTER="PYTHON_VARIABLES_REQUESTER",b.MULTIPLEXING_DEBUGSERVICE="MULTIPLEXING_DEBUGSERVICE",b.RUN_BY_LINE_DEBUGSERVICE="RUN_BY_LINE_DEBUGSERVICE",b.REMOTE_URI="https://remote/",b.REMOTE_URI_ID_PARAM="id",b.REMOTE_URI_HANDLE_PARAM="uriHandle",b.REMOTE_URI_EXTENSION_ID_PARAM="extensionId"))(qe||={});var bh;(n=>(n.ImportIPython=`{0}
|
||
from IPython import get_ipython
|
||
|
||
{1}`,n.MatplotLibInit=`import matplotlib
|
||
%matplotlib inline
|
||
${qe.MatplotLibDefaultParams} = dict(matplotlib.rcParams)
|
||
`,n.DisableJedi="%config Completer.use_jedi = False"))(bh||={});var Ih="JUPYTER_OUTPUT_CHANNEL",uA="Default Light+",si="ms-python.python",Sh="ms-toolsai.jupyter-renderers",sm="ms-python.vscode-pylance",zj=["python","html","xml","javascript","markdown","latex","shellscript","bat","powershell","kusto","ruby","sql","perl","qsharp","raw"],Qj=new Map([["bash","shellscript"],["c#","csharp"],["f#","fsharp"],["q#","qsharp"],["c++11","c++"],["c++12","c++"],["c++14","c++"]]),MS=["python","r","julia","c++","c#","f#","q#","powershell","java","scala","haskell","bash","cling","rust","sas","sos","ocaml"];var q;(Se=>(Se.RunAllCells="jupyter.runallcells",Se.RunAllCellsAbove="jupyter.runallcellsabove",Se.RunCellAndAllBelow="jupyter.runcellandallbelow",Se.RunAllCellsAbovePalette="jupyter.runallcellsabove.palette",Se.RunCellAndAllBelowPalette="jupyter.runcurrentcellandallbelow.palette",Se.RunToLine="jupyter.runtoline",Se.RunFromLine="jupyter.runfromline",Se.RunCell="jupyter.runcell",Se.RunCurrentCell="jupyter.runcurrentcell",Se.RunCurrentCellAdvance="jupyter.runcurrentcelladvance",Se.CreateNewInteractive="jupyter.createnewinteractive",Se.ImportNotebook="jupyter.importnotebook",Se.ImportNotebookFile="jupyter.importnotebookfile",Se.ExportFileAsNotebook="jupyter.exportfileasnotebook",Se.ExportFileAndOutputAsNotebook="jupyter.exportfileandoutputasnotebook",Se.InterruptKernel="jupyter.interruptkernel",Se.RestartKernel="jupyter.restartkernel",Se.RestartKernelAndRunAllCells="jupyter.restartkernelandrunallcells",Se.RestartKernelAndRunUpToSelectedCell="jupyter.restartkernelandrunuptoselectedcell",Se.NotebookEditorRemoveAllCells="jupyter.notebookeditor.removeallcells",Se.NotebookEditorRunAllCells="jupyter.notebookeditor.runallcells",Se.NotebookEditorRunSelectedCell="jupyter.notebookeditor.runselectedcell",Se.NotebookEditorAddCellBelow="jupyter.notebookeditor.addcellbelow",Se.ExpandAllCells="jupyter.expandallcells",Se.CollapseAllCells="jupyter.collapseallcells",Se.ExportOutputAsNotebook="jupyter.exportoutputasnotebook",Se.ExecSelectionInInteractiveWindow="jupyter.execSelectionInteractive",Se.RunFileInInteractiveWindows="jupyter.runFileInteractive",Se.DebugFileInInteractiveWindows="jupyter.debugFileInteractive",Se.AddCellBelow="jupyter.addcellbelow",Se.DebugCurrentCellPalette="jupyter.debugcurrentcell.palette",Se.DebugCell="jupyter.debugcell",Se.DebugStepOver="jupyter.debugstepover",Se.DebugContinue="jupyter.debugcontinue",Se.DebugStop="jupyter.debugstop",Se.RunCurrentCellAndAddBelow="jupyter.runcurrentcellandaddbelow",Se.InsertCellBelowPosition="jupyter.insertCellBelowPosition",Se.InsertCellBelow="jupyter.insertCellBelow",Se.InsertCellAbove="jupyter.insertCellAbove",Se.DeleteCells="jupyter.deleteCells",Se.SelectCell="jupyter.selectCell",Se.SelectCellContents="jupyter.selectCellContents",Se.ExtendSelectionByCellAbove="jupyter.extendSelectionByCellAbove",Se.ExtendSelectionByCellBelow="jupyter.extendSelectionByCellBelow",Se.MoveCellsUp="jupyter.moveCellsUp",Se.MoveCellsDown="jupyter.moveCellsDown",Se.ChangeCellToMarkdown="jupyter.changeCellToMarkdown",Se.ChangeCellToCode="jupyter.changeCellToCode",Se.GotoNextCellInFile="jupyter.gotoNextCellInFile",Se.GotoPrevCellInFile="jupyter.gotoPrevCellInFile",Se.ScrollToCell="jupyter.scrolltocell",Se.CreateNewNotebook="jupyter.createnewnotebook",Se.ViewJupyterOutput="jupyter.viewOutput",Se.ExportAsPythonScript="jupyter.exportAsPythonScript",Se.ExportToHTML="jupyter.exportToHTML",Se.ExportToPDF="jupyter.exportToPDF",Se.Export="jupyter.export",Se.NativeNotebookExport="jupyter.notebookeditor.export",Se.LatestExtension="jupyter.latestExtension",Se.EnableLoadingWidgetsFrom3rdPartySource="jupyter.enableLoadingWidgetScriptsFromThirdPartySource",Se.ShowDataViewer="jupyter.showDataViewer",Se.ShowJupyterDataViewer="jupyter.showJupyterDataViewer",Se.RefreshDataViewer="jupyter.refreshDataViewer",Se.ClearSavedJupyterUris="jupyter.clearSavedJupyterUris",Se.OpenVariableView="jupyter.openVariableView",Se.OpenOutlineView="jupyter.openOutlineView",Se.InteractiveClearAll="jupyter.interactive.clearAllCells",Se.InteractiveGoToCode="jupyter.interactive.goToCode",Se.InteractiveCopyCell="jupyter.interactive.copyCell",Se.InteractiveExportAsNotebook="jupyter.interactive.exportasnotebook",Se.InteractiveExportAs="jupyter.interactive.exportas",Se.RunByLine="jupyter.runByLine",Se.RunAndDebugCell="jupyter.runAndDebugCell",Se.RunByLineNext="jupyter.runByLineNext",Se.RunByLineStop="jupyter.runByLineStop",Se.ReplayPylanceLog="jupyter.replayPylanceLog",Se.ReplayPylanceLogStep="jupyter.replayPylanceLogStep",Se.InstallPythonExtensionViaKernelPicker="jupyter.installPythonExtensionViaKernelPicker",Se.InstallPythonViaKernelPicker="jupyter.installPythonViaKernelPicker",Se.ContinueEditSessionInCodespace="jupyter.continueEditSessionInCodespace"))(q||={});var $u;(n=>(n.DefaultDesignLenses=[q.RunCurrentCell,q.RunAllCellsAbove,q.DebugCell],n.DefaultDebuggingLenses=[q.DebugContinue,q.DebugStop,q.DebugStepOver],n.DebuggerCommands=[q.DebugContinue,q.DebugStop,q.DebugStepOver]))($u||={});var yr;(ae=>(ae.HasCodeCells="jupyter.hascodecells",ae.IsInteractiveActive="jupyter.isinteractiveactive",ae.OwnsSelection="jupyter.ownsSelection",ae.HaveNativeCells="jupyter.havenativecells",ae.HaveNative="jupyter.havenative",ae.IsNativeActive="jupyter.isnativeactive",ae.IsInteractiveOrNativeActive="jupyter.isinteractiveornativeactive",ae.IsPythonOrNativeActive="jupyter.ispythonornativeactive",ae.IsPythonOrInteractiveActive="jupyter.ispythonorinteractiveeactive",ae.IsPythonOrInteractiveOrNativeActive="jupyter.ispythonorinteractiveornativeeactive",ae.CanRestartNotebookKernel="jupyter.notebookeditor.canrestartNotebookkernel",ae.CanInterruptNotebookKernel="jupyter.notebookeditor.canInterruptNotebookKernel",ae.CanRestartInteractiveWindowKernel="jupyter.interactive.canRestartNotebookKernel",ae.CanInterruptInteractiveWindowKernel="jupyter.interactive.canInterruptNotebookKernel",ae.RunByLineCells="jupyter.notebookeditor.runByLineCells",ae.RunByLineDocuments="jupyter.notebookeditor.runByLineDocuments",ae.DebugDocuments="jupyter.notebookeditor.debugDocuments",ae.IsPythonNotebook="jupyter.ispythonnotebook",ae.IsJupyterKernelSelected="jupyter.kernel.isjupyter",ae.IsDataViewerActive="jupyter.dataViewerActive",ae.HasNativeNotebookOrInteractiveWindowOpen="jupyter.hasNativeNotebookOrInteractiveWindowOpen",ae.ZmqAvailable="jupyter.zmqavailable",ae.ReplayLogLoaded="jupyter.replayLogLoaded",ae.KernelSource="jupyter.kernelSource"))(yr||={});var am;(l=>(l.PythonCellMarker=/^(#\s*%%|#\s*\<codecell\>|#\s*In\[\d*?\]|#\s*In\[ \])/,l.PythonMarkdownCellMarker=/^(#\s*%%\s*\[markdown\]|#\s*\<markdowncell\>)/,l.UrlPatternRegEx="(?<PREFIX>https?:\\/\\/)((\\(.+\\s+or\\s+(?<IP>.+)\\))|(?<LOCAL>[^\\s]+))(?<REST>:.+)",l.HttpPattern=/https?:\/\//,l.ShapeSplitterRegEx=/.*,\s*(\d+).*/,l.SvgHeightRegex=/(\<svg.*height=\")(.*?)\"/,l.SvgWidthRegex=/(\<svg.*width=\")(.*?)\"/,l.SvgSizeTagRegex=/\<svg.*tag=\"sizeTag=\{(.*),\s*(.*)\}\"/))(am||={});var Yj=Symbol("DataScienceStartupTime"),pA={major:4,minor:2},Hi="application/vnd.jupyter.widget-view+json";var OS=7,xh="unknown";var FS=class{constructor(e,t){this._data=t;this.expiryTime=e+Date.now()}get expired(){let e=this.expiryTime<=Date.now();return e&&(this._data=void 0),e}get data(){return this.expired&&(this._data=void 0),this._data}},KS=new Map;function Xj(){return KS}function Zj(r,e){let t=e.map(n=>`${JSON.stringify(n)}`).join("-Arg-Separator-");return`KeyPrefix=${r}-Args=${t}`}var lm=class{constructor(e,t=""){this.expiryDurationMs=e;this.cacheKey=t}get hasData(){let e=KS.get(this.cacheKey);return!!(e&&!e.expired)}get data(){return this.hasData?KS.get(this.cacheKey)?.data:void 0}set data(e){let t=new FS(this.expiryDurationMs,e);KS.set(this.cacheKey,t)}clear(){KS.delete(this.cacheKey)}};var e2=Symbol("MicrotaskDelay");async function Ei(r){return new Promise(e=>{setTimeout(()=>e(r),r)})}async function Yw(r,e,t){return new Promise(n=>{let i,o=setTimeout(()=>i(!1),e),s=setInterval(()=>{r().then(a=>{a&&i(!0)}).catch(a=>i(!1))},t);i=a=>{clearTimeout(o),clearInterval(s),n(a)}})}function br(r,e,...t){let n=Qw(e)?void 0:e;Qw(e)&&t.push(e);let i,o=setTimeout(()=>i?.(n),r);return Promise.race([Promise.race(t).finally(()=>clearTimeout(o)),new Promise(s=>i=s)])}function wh(r,e,...t){let n,i=setTimeout(()=>n?.(e),r);return Promise.race([Promise.race(t).finally(()=>clearTimeout(i)),new Promise((o,s)=>n=s)])}function Hu(r){return typeof r?.then=="function"&&typeof r?.catch=="function"}function Qw(r){return typeof r?.then=="function"}var dA=class{constructor(e=null){this.scope=e;this._resolved=!1;this._rejected=!1;this._promise=new Promise((t,n)=>{this._resolve=t,this._reject=n})}get value(){return this._value}resolve(e){this._value=e,this._resolve.apply(this.scope?this.scope:this,arguments),this._resolved=!0}reject(e){this._reject.apply(this.scope?this.scope:this,arguments),this._rejected=!0}get promise(){return this._promise}get resolved(){return this._resolved}get rejected(){return this._rejected}get completed(){return this._rejected||this._resolved}};function oe(r=null){return new dA(r)}function Is(r){let e=oe();return r.then(e.resolve.bind(e)).catch(e.reject.bind(e)),e}var Ch=class{constructor(){this.currentPromise=Promise.resolve(void 0)}async chain(e){let t=oe(),n=this.currentPromise;return this.currentPromise=this.currentPromise.then(async()=>{try{let i=await e();t.resolve(i)}catch(i){throw t.reject(i),i}}),await n,t.promise}chainFinally(e){let t=oe();return this.currentPromise=this.currentPromise.finally(()=>e().then(n=>t.resolve(n)).catch(n=>t.reject(n))),t.promise}};var uX=(r,e)=>{let t=!0,n=setTimeout(()=>{t=!1,e()},r);return{isTriggered:()=>t,dispose:()=>{clearTimeout(n),t=!1}}},pX=r=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,r())}),{isTriggered:()=>e,dispose:()=>{e=!1}}},bs=class{constructor(e){this.defaultDelay=e;this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((i,o)=>{this.doResolve=i,this.doReject=o}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){let i=this.task;return this.task=null,i()}}),this.completionPromise.catch(h));let n=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===e2?pX(n):uX(t,n),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new Error("Canceled")),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}};function h(){}function ai(r){try{let e=r();Hu(e)&&e.catch(h)}catch{}}function Gu(r){if(!r)return!0;let e=r;return typeof e.path=="string"&&typeof e.scheme=="string"}function xn(r){if(!r)return!1;let e=r;return typeof e.path=="string"&&typeof e.scheme=="string"}function r2(r){let e=xn(r)?r:r.uri;return e.scheme.includes(Mc)||e.path.endsWith(".interactive")}function zu(){return process.platform.toString()==="web"}function t2(r,e){return xn(e)?e.toString():e}function pa(r,e){return r===e?!0:r&&!e||!r&&e?!1:JSON.stringify(r,t2)===JSON.stringify(e,t2)}var We=class{constructor(){this.started=Date.now()}get elapsedTime(){return Date.now()-this.started}reset(){this.started=Date.now()}};var n2=Xj();function mA(r){return function(e,t,n){let i=n.value,s=`Cache_Method_Output_${"constructor"in e&&e.constructor.name?e.constructor.name:""}.${t}`;n.value=async function(...a){if(_r())return i.apply(this,a);let l=Zj(s,a),c=n2.get(l);if(c&&!c.expired)return d.debug(`Cached data exists ${l}`),Promise.resolve(c.data);let u=i.apply(this,a);return u.then(p=>n2.set(l,new FS(r,p))).catch(h),u}}}function zr(r){return function(e,t,n){let i=n.value,o=`Jupyter Extension (Error in ${r||t}, method:${t}):`;n.value=function(...s){try{let a=i.apply(this,s);if(a&&typeof a.then=="function"&&typeof a.catch=="function")return a.catch(l=>{_r()||d.error(o,l)})}catch(a){if(_r())return;d.error(o,a)}}}}function dX(r,e,t){let n=new We;try{t&&r(void 0);let i=e();return Hu(i)?i.then(o=>(r({elapsed:n.elapsedTime,returnValue:o}),o)).catch(o=>{r({elapsed:n.elapsedTime,err:o})}):r({elapsed:n.elapsedTime,returnValue:i}),i}catch(i){throw r({elapsed:n.elapsedTime,err:i}),i}}function i2(r,e){return function(t,n,i){let o=i.value;return i.value=function(...s){let a={kind:"Class",name:t&&t.constructor?t.constructor.name:"",args:s,methodName:n,target:t},l=this;return dX(c=>r(a,c),()=>o.apply(l,s),e)},i}}function Eh(){return function(r,e,t){let n=t.value;return t.value=function(...i){if(!_r())throw new Error(`Function: ${e} can only be called from test code`);return n.apply(this,i)},t}}function fA(){return function(r,e,t){let n=t.value,i=`chainedPromiseFor_${e}`;return t.value=async function(...o){let s=this[i];s?s=s.then(()=>n.apply(this,o)):s=n.apply(this,o),this[i]=s;let a=s.then(l=>l).catch(l=>{throw this[i]=void 0,l});return a.catch(h),a},t}}function hA(r,e){if(Array.isArray(r))return r.map(t=>hA(t,e)).join(", ");if(r===void 0)return"undefined";if(r===null)return"null";try{return r&&r.path?`<Uri:${r.path}>`:JSON.stringify(r)}catch{return`<${e} cannot be serialized for logging>`}}function gA(r){if(!r)return"";try{return r.map((t,n)=>{let i=hA(t,"argument");return`Arg ${n+1}: ${i}`}).join(", ")}catch{return""}}function o2(r){return`Return Value: ${hA(r,"Return value")}`}function Xw(){let r=new Date,e=String(r.getHours()).padStart(2,"0"),t=String(r.getMinutes()).padStart(2,"0"),n=String(r.getSeconds()).padStart(2,"0"),i=String(r.getMilliseconds()).padStart(3,"0");return`${e}:${t}:${n}.${i}`}function Fe(r,e={removeEmptyEntries:!0,trim:!0}){r=r||"";let t=r.split(/\r?\n/g);return e&&e.trim&&(t=t.map(n=>n.trim())),e&&e.removeEmptyEntries&&(t=t.filter(n=>n.length>0)),t}function LS(r){return r&&(r.indexOf(" ")>=0&&!r.startsWith('"')&&!r.endsWith('"')?`"${r}"`:r.toString())}function US(r){return r&&LS(r).replace(/\\/g,"/")}function cm(r){return r&&r.replace(/(^['"])|(['"]$)/g,"")}function jS(r,...e){return r.replace(/{(\d+)}/g,(t,n)=>e[n]===void 0?t:e[n])}function kh(r){return r?r.replace(/\$\([a-z0-9\-]+?\)/gi,"").trim():r||""}function Ph(r){let e=r.split(`
|
||
`),t=e.find(n=>n.trim().length>0&&!n.trim().startsWith("#"));if(t){let n=t.match(/^\s*/)[0];return e.map(i=>i.startsWith(n)?i.replace(n,""):i).join(`
|
||
`)}return r}var EA=require("vscode");var eE="en",rE=!1,nE=!1,WS=!1,mX=!1,fX=!1,yA=!1,hX=!1,gX=!1,vX=!1,Zw,tE=eE,yX,Yu,Ss=typeof self=="object"?self:typeof global=="object"?global:{},ao;typeof Ss.vscode<"u"&&typeof Ss.vscode.process<"u"?ao=Ss.vscode.process:typeof process<"u"&&(ao=process);var s2=typeof ao?.versions?.electron=="string",a2=s2&&ao?.type==="renderer",HSe=a2&&ao?.sandboxed;if(typeof navigator=="object"&&!a2)Yu=navigator.userAgent,rE=Yu.indexOf("Windows")>=0,nE=Yu.indexOf("Macintosh")>=0,gX=(Yu.indexOf("Macintosh")>=0||Yu.indexOf("iPad")>=0||Yu.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,WS=Yu.indexOf("Linux")>=0,yA=!0,Zw=navigator.language,tE=Zw;else if(typeof ao=="object"){rE=ao.platform==="win32",nE=ao.platform==="darwin",WS=ao.platform==="linux",mX=WS&&!!ao.env.SNAP&&!!ao.env.SNAP_REVISION,hX=s2,vX=!!ao.env.CI||!!ao.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Zw=eE,tE=eE;let r=ao.env.VSCODE_NLS_CONFIG;if(r)try{let e=JSON.parse(r),t=e.availableLanguages["*"];Zw=e.locale,tE=t||eE,yX=e._translationsConfigFile}catch{}fX=!0}else console.error("Unable to resolve platform.");var vA=0;nE?vA=1:rE?vA=3:WS&&(vA=2);var VS=rE,l2=nE,c2=WS;var iE=yA,GSe=yA&&typeof Ss.importScripts=="function";var Za=Yu,Qu=tE,bX;(n=>{function r(){return Qu}n.value=r;function e(){return Qu.length===2?Qu==="en":Qu.length>=3?Qu[0]==="e"&&Qu[1]==="n"&&Qu[2]==="-":!1}n.isDefaultVariant=e;function t(){return Qu==="en"}n.isDefault=t})(bX||={});var zSe=(()=>{if(typeof Ss.postMessage=="function"&&!Ss.importScripts){let r=[];Ss.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,i=r.length;n<i;n++){let o=r[n];if(o.id===t.data.vscodeScheduleAsyncWork){r.splice(n,1),o.callback();return}}});let e=0;return t=>{let n=++e;r.push({id:n,callback:t}),Ss.postMessage({vscodeScheduleAsyncWork:n},"*")}}return r=>setTimeout(r)})();var IX=!!(Za&&Za.indexOf("Chrome")>=0),QSe=!!(Za&&Za.indexOf("Firefox")>=0),YSe=!!(!IX&&Za&&Za.indexOf("Safari")>=0),XSe=!!(Za&&Za.indexOf("Edg/")>=0),ZSe=!!(Za&&Za.indexOf("Android")>=0);var um;if(typeof Ss.vscode<"u"&&typeof Ss.vscode.process<"u"){let r=Ss.vscode.process;um={get platform(){return r.platform},get arch(){return r.arch},get env(){return r.env},cwd(){return r.cwd()}}}else typeof process<"u"?um={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:um={get platform(){return VS?"win32":l2?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var oE=um.cwd,u2=um.env,lo=um.platform,nxe=um.arch;var xX=65,CX=97,wX=90,EX=122,ep=46,zn=47,co=92,Xu=58,kX=63,sE=class extends Error{constructor(t,n,i){let o;typeof n=="string"&&n.indexOf("not ")===0?(o="must not be",n=n.replace(/^not /,"")):o="must be";let s=t.indexOf(".")!==-1?"property":"argument",a=`The "${t}" ${s} ${o} of type ${n}`;a+=`. Received type ${typeof i}`;super(a);this.code="ERR_INVALID_ARG_TYPE"}};function hn(r,e){if(typeof r!="string")throw new sE(e,"string",r)}function At(r){return r===zn||r===co}function bA(r){return r===zn}function Zu(r){return r>=xX&&r<=wX||r>=CX&&r<=EX}function aE(r,e,t,n){let i="",o=0,s=-1,a=0,l=0;for(let c=0;c<=r.length;++c){if(c<r.length)l=r.charCodeAt(c);else{if(n(l))break;l=zn}if(n(l)){if(!(s===c-1||a===1))if(a===2){if(i.length<2||o!==2||i.charCodeAt(i.length-1)!==ep||i.charCodeAt(i.length-2)!==ep){if(i.length>2){let u=i.lastIndexOf(t);u===-1?(i="",o=0):(i=i.slice(0,u),o=i.length-1-i.lastIndexOf(t)),s=c,a=0;continue}else if(i.length!==0){i="",o=0,s=c,a=0;continue}}e&&(i+=i.length>0?`${t}..`:"..",o=2)}else i.length>0?i+=`${t}${r.slice(s+1,c)}`:i=r.slice(s+1,c),o=c-s-1;s=c,a=0}else l===ep&&a!==-1?++a:a=-1}return i}function p2(r,e){if(e===null||typeof e!="object")throw new sE("pathObject","Object",e);let t=e.dir||e.root,n=e.base||`${e.name||""}${e.ext||""}`;return t?t===e.root?`${t}${n}`:`${t}${r}${n}`:n}var Dn={resolve(...r){let e="",t="",n=!1;for(let i=r.length-1;i>=-1;i--){let o;if(i>=0){if(o=r[i],hn(o,"path"),o.length===0)continue}else e.length===0?o=oE():(o=u2[`=${e}`]||oE(),(o===void 0||o.slice(0,2).toLowerCase()!==e.toLowerCase()&&o.charCodeAt(2)===co)&&(o=`${e}\\`));let s=o.length,a=0,l="",c=!1,u=o.charCodeAt(0);if(s===1)At(u)&&(a=1,c=!0);else if(At(u))if(c=!0,At(o.charCodeAt(1))){let p=2,f=p;for(;p<s&&!At(o.charCodeAt(p));)p++;if(p<s&&p!==f){let g=o.slice(f,p);for(f=p;p<s&&At(o.charCodeAt(p));)p++;if(p<s&&p!==f){for(f=p;p<s&&!At(o.charCodeAt(p));)p++;(p===s||p!==f)&&(l=`\\\\${g}\\${o.slice(f,p)}`,a=p)}}}else a=1;else Zu(u)&&o.charCodeAt(1)===Xu&&(l=o.slice(0,2),a=2,s>2&&At(o.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(n){if(e.length>0)break}else if(t=`${o.slice(a)}\\${t}`,n=c,c&&e.length>0)break}return t=aE(t,!n,"\\",At),n?`${e}\\${t}`:`${e}${t}`||"."},normalize(r){hn(r,"path");let e=r.length;if(e===0)return".";let t=0,n,i=!1,o=r.charCodeAt(0);if(e===1)return bA(o)?"\\":r;if(At(o))if(i=!0,At(r.charCodeAt(1))){let a=2,l=a;for(;a<e&&!At(r.charCodeAt(a));)a++;if(a<e&&a!==l){let c=r.slice(l,a);for(l=a;a<e&&At(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!At(r.charCodeAt(a));)a++;if(a===e)return`\\\\${c}\\${r.slice(l)}\\`;a!==l&&(n=`\\\\${c}\\${r.slice(l,a)}`,t=a)}}}else t=1;else Zu(o)&&r.charCodeAt(1)===Xu&&(n=r.slice(0,2),t=2,e>2&&At(r.charCodeAt(2))&&(i=!0,t=3));let s=t<e?aE(r.slice(t),!i,"\\",At):"";return s.length===0&&!i&&(s="."),s.length>0&&At(r.charCodeAt(e-1))&&(s+="\\"),n===void 0?i?`\\${s}`:s:i?`${n}\\${s}`:`${n}${s}`},isAbsolute(r){hn(r,"path");let e=r.length;if(e===0)return!1;let t=r.charCodeAt(0);return At(t)||e>2&&Zu(t)&&r.charCodeAt(1)===Xu&&At(r.charCodeAt(2))},join(...r){if(r.length===0)return".";let e,t;for(let o=0;o<r.length;++o){let s=r[o];hn(s,"path"),s.length>0&&(e===void 0?e=t=s:e+=`\\${s}`)}if(e===void 0)return".";let n=!0,i=0;if(typeof t=="string"&&At(t.charCodeAt(0))){++i;let o=t.length;o>1&&At(t.charCodeAt(1))&&(++i,o>2&&(At(t.charCodeAt(2))?++i:n=!1))}if(n){for(;i<e.length&&At(e.charCodeAt(i));)i++;i>=2&&(e=`\\${e.slice(i)}`)}return Dn.normalize(e)},relative(r,e){if(hn(r,"from"),hn(e,"to"),r===e)return"";let t=Dn.resolve(r),n=Dn.resolve(e);if(t===n||(r=t.toLowerCase(),e=n.toLowerCase(),r===e))return"";let i=0;for(;i<r.length&&r.charCodeAt(i)===co;)i++;let o=r.length;for(;o-1>i&&r.charCodeAt(o-1)===co;)o--;let s=o-i,a=0;for(;a<e.length&&e.charCodeAt(a)===co;)a++;let l=e.length;for(;l-1>a&&e.charCodeAt(l-1)===co;)l--;let c=l-a,u=s<c?s:c,p=-1,f=0;for(;f<u;f++){let v=r.charCodeAt(i+f);if(v!==e.charCodeAt(a+f))break;v===co&&(p=f)}if(f!==u){if(p===-1)return n}else{if(c>u){if(e.charCodeAt(a+f)===co)return n.slice(a+f+1);if(f===2)return n.slice(a+f)}s>u&&(r.charCodeAt(i+f)===co?p=f:f===2&&(p=3)),p===-1&&(p=0)}let g="";for(f=i+p+1;f<=o;++f)(f===o||r.charCodeAt(f)===co)&&(g+=g.length===0?"..":"\\..");return a+=p,g.length>0?`${g}${n.slice(a,l)}`:(n.charCodeAt(a)===co&&++a,n.slice(a,l))},toNamespacedPath(r){if(typeof r!="string")return r;if(r.length===0)return"";let e=Dn.resolve(r);if(e.length<=2)return r;if(e.charCodeAt(0)===co){if(e.charCodeAt(1)===co){let t=e.charCodeAt(2);if(t!==kX&&t!==ep)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(Zu(e.charCodeAt(0))&&e.charCodeAt(1)===Xu&&e.charCodeAt(2)===co)return`\\\\?\\${e}`;return r},dirname(r){hn(r,"path");let e=r.length;if(e===0)return".";let t=-1,n=0,i=r.charCodeAt(0);if(e===1)return At(i)?r:".";if(At(i)){if(t=n=1,At(r.charCodeAt(1))){let a=2,l=a;for(;a<e&&!At(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&At(r.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!At(r.charCodeAt(a));)a++;if(a===e)return r;a!==l&&(t=n=a+1)}}}}else Zu(i)&&r.charCodeAt(1)===Xu&&(t=e>2&&At(r.charCodeAt(2))?3:2,n=t);let o=-1,s=!0;for(let a=e-1;a>=n;--a)if(At(r.charCodeAt(a))){if(!s){o=a;break}}else s=!1;if(o===-1){if(t===-1)return".";o=t}return r.slice(0,o)},basename(r,e){e!==void 0&&hn(e,"ext"),hn(r,"path");let t=0,n=-1,i=!0,o;if(r.length>=2&&Zu(r.charCodeAt(0))&&r.charCodeAt(1)===Xu&&(t=2),e!==void 0&&e.length>0&&e.length<=r.length){if(e===r)return"";let s=e.length-1,a=-1;for(o=r.length-1;o>=t;--o){let l=r.charCodeAt(o);if(At(l)){if(!i){t=o+1;break}}else a===-1&&(i=!1,a=o+1),s>=0&&(l===e.charCodeAt(s)?--s===-1&&(n=o):(s=-1,n=a))}return t===n?n=a:n===-1&&(n=r.length),r.slice(t,n)}for(o=r.length-1;o>=t;--o)if(At(r.charCodeAt(o))){if(!i){t=o+1;break}}else n===-1&&(i=!1,n=o+1);return n===-1?"":r.slice(t,n)},extname(r){hn(r,"path");let e=0,t=-1,n=0,i=-1,o=!0,s=0;r.length>=2&&r.charCodeAt(1)===Xu&&Zu(r.charCodeAt(0))&&(e=n=2);for(let a=r.length-1;a>=e;--a){let l=r.charCodeAt(a);if(At(l)){if(!o){n=a+1;break}continue}i===-1&&(o=!1,i=a+1),l===ep?t===-1?t=a:s!==1&&(s=1):t!==-1&&(s=-1)}return t===-1||i===-1||s===0||s===1&&t===i-1&&t===n+1?"":r.slice(t,i)},format:p2.bind(null,"\\"),parse(r){hn(r,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;let t=r.length,n=0,i=r.charCodeAt(0);if(t===1)return At(i)?(e.root=e.dir=r,e):(e.base=e.name=r,e);if(At(i)){if(n=1,At(r.charCodeAt(1))){let p=2,f=p;for(;p<t&&!At(r.charCodeAt(p));)p++;if(p<t&&p!==f){for(f=p;p<t&&At(r.charCodeAt(p));)p++;if(p<t&&p!==f){for(f=p;p<t&&!At(r.charCodeAt(p));)p++;p===t?n=p:p!==f&&(n=p+1)}}}}else if(Zu(i)&&r.charCodeAt(1)===Xu){if(t<=2)return e.root=e.dir=r,e;if(n=2,At(r.charCodeAt(2))){if(t===3)return e.root=e.dir=r,e;n=3}}n>0&&(e.root=r.slice(0,n));let o=-1,s=n,a=-1,l=!0,c=r.length-1,u=0;for(;c>=n;--c){if(i=r.charCodeAt(c),At(i)){if(!l){s=c+1;break}continue}a===-1&&(l=!1,a=c+1),i===ep?o===-1?o=c:u!==1&&(u=1):o!==-1&&(u=-1)}return a!==-1&&(o===-1||u===0||u===1&&o===a-1&&o===s+1?e.base=e.name=r.slice(s,a):(e.name=r.slice(s,o),e.base=r.slice(s,a),e.ext=r.slice(o,a))),s>0&&s!==n?e.dir=r.slice(0,s-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},Ir={resolve(...r){let e="",t=!1;for(let n=r.length-1;n>=-1&&!t;n--){let i=n>=0?r[n]:oE();hn(i,"path"),i.length!==0&&(e=`${i}/${e}`,t=i.charCodeAt(0)===zn)}return e=aE(e,!t,"/",bA),t?`/${e}`:e.length>0?e:"."},normalize(r){if(hn(r,"path"),r.length===0)return".";let e=r.charCodeAt(0)===zn,t=r.charCodeAt(r.length-1)===zn;return r=aE(r,!e,"/",bA),r.length===0?e?"/":t?"./":".":(t&&(r+="/"),e?`/${r}`:r)},isAbsolute(r){return hn(r,"path"),r.length>0&&r.charCodeAt(0)===zn},join(...r){if(r.length===0)return".";let e;for(let t=0;t<r.length;++t){let n=r[t];hn(n,"path"),n.length>0&&(e===void 0?e=n:e+=`/${n}`)}return e===void 0?".":Ir.normalize(e)},relative(r,e){if(hn(r,"from"),hn(e,"to"),r===e||(r=Ir.resolve(r),e=Ir.resolve(e),r===e))return"";let t=1,n=r.length,i=n-t,o=1,s=e.length-o,a=i<s?i:s,l=-1,c=0;for(;c<a;c++){let p=r.charCodeAt(t+c);if(p!==e.charCodeAt(o+c))break;p===zn&&(l=c)}if(c===a)if(s>a){if(e.charCodeAt(o+c)===zn)return e.slice(o+c+1);if(c===0)return e.slice(o+c)}else i>a&&(r.charCodeAt(t+c)===zn?l=c:c===0&&(l=0));let u="";for(c=t+l+1;c<=n;++c)(c===n||r.charCodeAt(c)===zn)&&(u+=u.length===0?"..":"/..");return`${u}${e.slice(o+l)}`},toNamespacedPath(r){return r},dirname(r){if(hn(r,"path"),r.length===0)return".";let e=r.charCodeAt(0)===zn,t=-1,n=!0;for(let i=r.length-1;i>=1;--i)if(r.charCodeAt(i)===zn){if(!n){t=i;break}}else n=!1;return t===-1?e?"/":".":e&&t===1?"//":r.slice(0,t)},basename(r,e){e!==void 0&&hn(e,"ext"),hn(r,"path");let t=0,n=-1,i=!0,o;if(e!==void 0&&e.length>0&&e.length<=r.length){if(e===r)return"";let s=e.length-1,a=-1;for(o=r.length-1;o>=0;--o){let l=r.charCodeAt(o);if(l===zn){if(!i){t=o+1;break}}else a===-1&&(i=!1,a=o+1),s>=0&&(l===e.charCodeAt(s)?--s===-1&&(n=o):(s=-1,n=a))}return t===n?n=a:n===-1&&(n=r.length),r.slice(t,n)}for(o=r.length-1;o>=0;--o)if(r.charCodeAt(o)===zn){if(!i){t=o+1;break}}else n===-1&&(i=!1,n=o+1);return n===-1?"":r.slice(t,n)},extname(r){hn(r,"path");let e=-1,t=0,n=-1,i=!0,o=0;for(let s=r.length-1;s>=0;--s){let a=r.charCodeAt(s);if(a===zn){if(!i){t=s+1;break}continue}n===-1&&(i=!1,n=s+1),a===ep?e===-1?e=s:o!==1&&(o=1):e!==-1&&(o=-1)}return e===-1||n===-1||o===0||o===1&&e===n-1&&e===t+1?"":r.slice(e,n)},format:p2.bind(null,"/"),parse(r){hn(r,"path");let e={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return e;let t=r.charCodeAt(0)===zn,n;t?(e.root="/",n=1):n=0;let i=-1,o=0,s=-1,a=!0,l=r.length-1,c=0;for(;l>=n;--l){let u=r.charCodeAt(l);if(u===zn){if(!a){o=l+1;break}continue}s===-1&&(a=!1,s=l+1),u===ep?i===-1?i=l:c!==1&&(c=1):i!==-1&&(c=-1)}if(s!==-1){let u=o===0&&t?1:o;i===-1||c===0||c===1&&i===s-1&&i===o+1?e.base=e.name=r.slice(u,s):(e.name=r.slice(u,i),e.base=r.slice(u,s),e.ext=r.slice(i,s))}return o>0?e.dir=r.slice(0,o-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};Ir.win32=Dn.win32=Dn;Ir.posix=Dn.posix=Ir;var Cn=lo==="win32"?Dn.normalize:Ir.normalize,lE=lo==="win32"?Dn.isAbsolute:Ir.isAbsolute,je=lo==="win32"?Dn.join:Ir.join,d2=lo==="win32"?Dn.resolve:Ir.resolve,cE=lo==="win32"?Dn.relative:Ir.relative,lt=lo==="win32"?Dn.dirname:Ir.dirname,Ee=lo==="win32"?Dn.basename:Ir.basename,Gi=lo==="win32"?Dn.extname:Ir.extname,ixe=lo==="win32"?Dn.format:Ir.format,m2=lo==="win32"?Dn.parse:Ir.parse,oxe=lo==="win32"?Dn.toNamespacedPath:Ir.toNamespacedPath,Un=lo==="win32"?Dn.sep:Ir.sep,Qn=lo==="win32"?Dn.delimiter:Ir.delimiter;var qS=require("vscode");var PX=require("vscode");var uE=class{constructor(e){this.computeFn=e;this.lastCache=void 0;this.lastArgKey=void 0}get(e){let t=JSON.stringify(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this.computeFn(e)),this.lastCache}};var BS=class r{constructor(e){this.executor=e;this._didRun=!1}hasValue(){return this._didRun}getValue(){if(!this._didRun)try{this._value=this.executor()}catch(e){this._error=e}finally{this._didRun=!0}if(this._error)throw this._error;return this._value}get rawValue(){return this._value}map(e){return new r(()=>e(this.getValue()))}};function y2(r,e){return r<e?-1:r>e?1:0}function DX(r,e,t=0,n=r.length,i=0,o=e.length){for(;t<n&&i<o;t++,i++){let l=r.charCodeAt(t),c=e.charCodeAt(i);if(l<c)return-1;if(l>c)return 1}let s=n-t,a=o-i;return s<a?-1:s>a?1:0}function b2(r,e,t=0,n=r.length,i=0,o=e.length){for(;t<n&&i<o;t++,i++){let l=r.charCodeAt(t),c=e.charCodeAt(i);if(l===c)continue;if(l>=128||c>=128)return DX(r.toLowerCase(),e.toLowerCase(),t,n,i,o);f2(l)&&(l-=32),f2(c)&&(c-=32);let u=l-c;if(u!==0)return u}let s=n-t,a=o-i;return s<a?-1:s>a?1:0}function f2(r){return r>=97&&r<=122}function I2(r,e){return r.length===e.length&&b2(r,e)===0}function S2(r,e){let t=e.length;return e.length>r.length?!1:b2(r,e,0,t)===0}var h2=class r{constructor(e){this.confusableDictionary=e}static{this.ambiguousCharacterData=new BS(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,8218,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,8242,96,1370,96,1523,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71922,67,71913,67,65315,67,8557,67,8450,67,8493,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71919,87,71910,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,66293,90,71909,90,65338,90,8484,90,8488,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65297,49,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125],"_default":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"cs":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"es":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"fr":[65374,126,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"it":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ja":[8211,45,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65292,44,65307,59],"ko":[8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"pt-BR":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"ru":[65374,126,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65288,40,65289,41,65292,44,65307,59,65311,63],"zh-hans":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41],"zh-hant":[8211,45,65374,126,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65283,35,65307,59]}'))}static{this.cache=new uE(e=>{function t(u){let p=new Map;for(let f=0;f<u.length;f+=2)p.set(u[f],u[f+1]);return p}function n(u,p){let f=new Map(u);for(let[g,v]of p)f.set(g,v);return f}function i(u,p){if(!u)return p;let f=new Map;for(let[g,v]of u)p.has(g)&&f.set(g,v);return f}let o=this.ambiguousCharacterData.getValue(),s=e.filter(u=>!u.startsWith("_")&&u in o);s.length===0&&(s=["_default"]);let a;for(let u of s){let p=t(o[u]);a=i(a,p)}let l=t(o._common),c=n(l,a);return new r(c)})}static getInstance(e){return r.cache.get(Array.from(e))}static{this._locales=new BS(()=>Object.keys(r.ambiguousCharacterData.getValue()).filter(e=>!e.startsWith("_")))}static getLocales(){return r._locales.getValue()}isAmbiguous(e){return this.confusableDictionary.has(e)}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}},g2=class r{static getRawData(){return JSON.parse("[9,10,11,12,13,32,127,160,173,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8203,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12288,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999]")}static{this._data=void 0}static getData(){return this._data||(this._data=new Set(r.getRawData())),this._data}static isInvisibleCharacter(e){return r.getData().has(e)}static get codePoints(){return r.getData()}};function tp(r){return r===47||r===92}function IA(r){return r.replace(/[\\/]/g,Ir.sep)}function x2(r){return r.indexOf("/")===-1&&(r=IA(r)),/^[a-zA-Z]:(\/|$)/.test(r)&&(r="/"+r),r}function SA(r,e=Ir.sep){if(!r)return"";let t=r.length,n=r.charCodeAt(0);if(tp(n)){if(tp(r.charCodeAt(1))&&!tp(r.charCodeAt(2))){let o=3,s=o;for(;o<t&&!tp(r.charCodeAt(o));o++);if(s!==o&&!tp(r.charCodeAt(o+1))){for(o+=1;o<t;o++)if(tp(r.charCodeAt(o)))return r.slice(0,o+1).replace(/[\\/]/g,e)}}return e}else if(_X(n)&&r.charCodeAt(1)===58)return tp(r.charCodeAt(2))?r.slice(0,2)+e:r.slice(0,2);let i=r.indexOf("://");if(i!==-1){for(i+=3;i<t;i++)if(tp(r.charCodeAt(i)))return r.slice(0,i+1)}return""}function xA(r,e,t,n=Un){if(r===e)return!0;if(!r||!e||e.length>r.length)return!1;if(t){if(!S2(r,e))return!1;if(e.length===r.length)return!0;let o=e.length;return e.charAt(e.length-1)===n&&o--,r.charAt(o)===n}return e.charAt(e.length-1)!==n&&(e+=n),r.indexOf(e)===0}function _X(r){return r>=65&&r<=90||r>=97&&r<=122}var el;(ne=>(ne.inMemory="inmemory",ne.vscode="vscode",ne.internal="private",ne.walkThrough="walkThrough",ne.walkThroughSnippet="walkThroughSnippet",ne.http="http",ne.https="https",ne.file="file",ne.mailto="mailto",ne.untitled="untitled",ne.data="data",ne.command="command",ne.vscodeRemote="vscode-remote",ne.vscodeRemoteResource="vscode-remote-resource",ne.vscodeUserData="vscode-userdata",ne.vscodeCustomEditor="vscode-custom-editor",ne.vscodeNotebook="vscode-notebook",ne.vscodeNotebookCell="vscode-notebook-cell",ne.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",ne.vscodeNotebookCellOutput="vscode-notebook-cell-output",ne.vscodeInteractive="vscode-interactive",ne.vscodeInteractiveInput="vscode-interactive-input",ne.vscodeSettings="vscode-settings",ne.vscodeWorkspaceTrust="vscode-workspace-trust",ne.vscodeTerminal="vscode-terminal",ne.webviewPanel="webview-panel",ne.vscodeWebview="vscode-webview",ne.extension="extension",ne.vscodeFileResource="vscode-file",ne.tmp="tmp",ne.vsls="vsls"))(el||={});function da(r){return iE?r?.path||"":r?.fsPath||""}var JS=class{constructor(e){this._ignorePathCasing=e}compare(e,t,n=!1){return e===t?0:y2(this.getComparisonKey(e,n),this.getComparisonKey(t,n))}isEqual(e,t,n=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,n)===this.getComparisonKey(t,n)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:void 0}).toString()}ignorePathCasing(e){return this._ignorePathCasing(e)}isEqualOrParent(e,t,n=!1,i=VS?"\\":"/"){if(e.scheme===t.scheme){if(e.scheme===el.file)return xA(da(e),da(t),this._ignorePathCasing(e),i)&&e.query===t.query&&(n||e.fragment===t.fragment);if(C2(e.authority,t.authority))return xA(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(n||e.fragment===t.fragment)}return!1}joinPath(e,...t){return qS.Uri.joinPath(e,...t)}basenameOrAuthority(e){return vn(e)||e.authority}basename(e,t){return Ir.basename(e.path,t)}extname(e){return Ir.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===el.file?t=qS.Uri.file(lt(da(e))).path:(t=Ir.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===el.file?t=qS.Uri.file(Cn(da(e))).path:t=Ir.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!C2(e.authority,t.authority))return;if(e.scheme===el.file){let o=cE(da(e),da(t));return VS?IA(o):o}let n=e.path||"/",i=t.path||"/";if(this._ignorePathCasing(e)){let o=0;for(let s=Math.min(n.length,i.length);o<s&&!(n.charCodeAt(o)!==i.charCodeAt(o)&&n.charAt(o).toLowerCase()!==i.charAt(o).toLowerCase());o++);n=i.substr(0,o)+n.substr(o)}return Ir.relative(n,i)}resolvePath(e,t){if(e.scheme===el.file){let n=qS.Uri.file(d2(da(e),t));return e.with({authority:n.authority,path:n.path})}return t=x2(t),e.with({path:Ir.resolve(e.path,t)})}isAbsolutePath(e){return!!e.path&&e.path[0]==="/"}isEqualAuthority(e,t){return e===t||e!==void 0&&t!==void 0&&I2(e,t)}hasTrailingPathSeparator(e,t=Un){if(e.scheme===el.file){let n=da(e);return n.length>SA(n).length&&n[n.length-1]===t}else{let n=e.path;return n.length>1&&n.charCodeAt(n.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=Un){return w2(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=Un){let n=!1;if(e.scheme===el.file){let i=da(e);n=i!==void 0&&i.length===SA(i).length&&i[i.length-1]===t}else{t="/";let i=e.path;n=i.length===1&&i.charCodeAt(i.length-1)===47}return!n&&!w2(e,t)?e.with({path:e.path+"/"}):e}},Zt=new JS(()=>!1),Cxe=new JS(r=>r.scheme===el.file?!c2:!0),wxe=new JS(r=>!0),ki=Zt.isEqual.bind(Zt),Dh=Zt.isEqualOrParent.bind(Zt),gn=Zt.getComparisonKey.bind(Zt),Exe=Zt.basenameOrAuthority.bind(Zt),vn=Zt.basename.bind(Zt),rp=Zt.extname.bind(Zt),Pi=Zt.dirname.bind(Zt),er=Zt.joinPath.bind(Zt),kxe=Zt.normalizePath.bind(Zt),CA=Zt.relativePath.bind(Zt),Pxe=Zt.resolvePath.bind(Zt),Dxe=Zt.isAbsolutePath.bind(Zt),C2=Zt.isEqualAuthority.bind(Zt),w2=Zt.hasTrailingPathSeparator.bind(Zt),_xe=Zt.removeTrailingPathSeparator.bind(Zt),Txe=Zt.addTrailingPathSeparator.bind(Zt),RX;(o=>{o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function i(s){let a=new Map;s.path.substring(s.path.indexOf(";")+1,s.path.lastIndexOf(";")).split(";").forEach(u=>{let[p,f]=u.split(":");p&&f&&a.set(p,f)});let c=s.path.substring(0,s.path.indexOf(";"));return c&&a.set(o.META_DATA_MIME,c),a}o.parseMetaData=i})(RX||={});function Fr(r=process.platform){return/^win/.test(r)?"Windows":/^darwin/.test(r)?"OSX":/^linux/.test(r)?"Linux":"Unknown"}function _h(r,e){return r.replace(/^~(?=$|\/|\\)/,e)}function AX(){if(!zu())return EA.Uri.file(require("os").homedir())}function De(r){let e=Fr()==="Windows";if(r){let t=da(r);return t&&t.startsWith(Un)&&t.length>1&&t[1]!==Un&&e?t.slice(1):t||""}return""}function B(r,e=[],t){t=t||AX();let n;typeof r=="string"&&(n=EA.Uri.file(r)),typeof r!="string"&&(n=r);let i=wA(n,void 0,t),o=e.find(l=>n&&Dh(n,l.uri,!0));if(e.length>1&&o)return`${o.name}${Un}${wA(n,o.uri,t)}`;let s=o?[wA(n,o.uri,t)]:[],a=i;return[i,...s].forEach(l=>{l.length<a.length&&(a=l)}),a}function wA(r,e,t){let n=Fr()==="Windows";if(r&&e&&Dh(r,e,!0)){let i=CA(e,r);if(i)return n?i.replace(/\//g,"\\"):i}if(r&&t&&Dh(r,t,!0)){let i=CA(t,r);if(i)return i=n?i.replace(/\//g,"\\"):i,`~${Un}${i}`}return De(r)}var P2=P(E2());function jt(r){let e=this,t=!1,n;return function(){return t||(t=!0,n=r.apply(e,arguments)),n}}var PA;(C=>{function r(E){return E&&typeof E=="object"&&typeof E[Symbol.iterator]=="function"}C.is=r;let e=Object.freeze([]);function t(){return e}C.empty=t;function*n(E){yield E}C.single=n;function i(E){return r(E)?E:n(E)}C.wrap=i;function o(E){return E||e}C.from=o;function s(E){return!E||E[Symbol.iterator]().next().done===!0}C.isEmpty=s;function a(E){return E[Symbol.iterator]().next().value}C.first=a;function l(E,R){for(let _ of E)if(R(_))return!0;return!1}C.some=l;function c(E,R){for(let _ of E)if(R(_))return _}C.find=c;function*u(E,R){for(let _ of E)R(_)&&(yield _)}C.filter=u;function*p(E,R){let _=0;for(let L of E)yield R(L,_++)}C.map=p;function*f(...E){for(let R of E)for(let _ of R)yield _}C.concat=f;function g(E,R,_){let L=_;for(let te of E)L=R(L,te);return L}C.reduce=g;function*v(E,R,_=E.length){for(R<0&&(R+=E.length),_<0?_+=E.length:_>E.length&&(_=E.length);R<_;R++)yield E[R]}C.slice=v;function b(E,R=Number.POSITIVE_INFINITY){let _=[];if(R===0)return[_,E];let L=E[Symbol.iterator]();for(let te=0;te<R;te++){let $=L.next();if($.done)return[_,C.empty()];_.push($.value)}return[_,{[Symbol.iterator](){return L}}]}C.consume=b})(PA||={});var D2;function _2(r){D2=r}function ma(r){return D2?.push(r),r}function z(r){if(PA.is(r)){for(let e of r)if(e)try{e.dispose()}catch(t){console.warn(`dispose() failed for ${e}`,t)}return Array.isArray(r)?[]:r}else if(r)return r.dispose(),r}var $r=class r{constructor(...e){this._toDispose=new Set;this._isDisposed=!1;e.forEach(t=>this.add(t)),ma(this)}static{this.DISABLE_DISPOSED_WARNING=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{z(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?r.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}},tr=class{constructor(...e){this._store=new $r;this._isDisposed=!1;e.forEach(t=>this._store.add(t)),ma(this)}get isDisposed(){return this._isDisposed}dispose(){this._store.dispose(),this._isDisposed=!0}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}},Yn=class extends tr{constructor(){super();this._onDidDispose=new P2.EventEmitter,this.onDidDispose=this._onDidDispose.event}dispose(){super.dispose(),this._onDidDispose.fire(),this._onDidDispose.dispose()}};var k2=class{constructor(){this._store=new Map;this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{z(this._store.values())}finally{this._store.clear()}}has(e){return this._store.has(e)}get(e){return this._store.get(e)}set(e,t,n=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),n||this._store.get(e)?.dispose(),this._store.set(e,t)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}[Symbol.iterator](){return this._store[Symbol.iterator]()}};var pE=class{constructor(){this.references=new Map}acquire(e,...t){let n=this.references.get(e);n||(n={counter:0,object:this.createReferencedObject(e,...t)},this.references.set(e,n));let{object:i}=n,o=jt(()=>{n&&--n.counter===0&&(this.destroyReferencedObject(e,n.object),this.references.delete(e))});return n.counter++,{object:i,dispose:o}}};var w=require("vscode");var nt=require("vscode"),DA=60,_A=DA*60,$S=_A*24,T2=$S*7,R2=$S*30,A2=$S*365;function Th(r,e,t,n){typeof r!="number"&&(r=r.getTime());let i=Math.round((new Date().getTime()-r)/1e3);if(i<-30)return nt.l10n.t("in {0}",Th(new Date().getTime()+i*1e3,!1));if(!n&&i<30)return nt.l10n.t("now");let o;return i<DA?(o=i,e?o===1?t?nt.l10n.t("{0} second ago",o):nt.l10n.t("{0} sec ago",o):t?nt.l10n.t("{0} seconds ago",o):nt.l10n.t("{0} secs ago",o):o===1?t?nt.l10n.t("{0} second",o):nt.l10n.t("{0} sec",o):t?nt.l10n.t("{0} seconds",o):nt.l10n.t("{0} secs",o)):i<_A?(o=Math.floor(i/DA),e?o===1?t?nt.l10n.t("{0} minute ago",o):nt.l10n.t("{0} min ago",o):t?nt.l10n.t("{0} minutes ago",o):nt.l10n.t("{0} mins ago",o):o===1?t?nt.l10n.t("{0} minute",o):nt.l10n.t("{0} min",o):t?nt.l10n.t("{0} minutes",o):nt.l10n.t("{0} mins",o)):i<$S?(o=Math.floor(i/_A),e?o===1?t?nt.l10n.t("{0} hour ago",o):nt.l10n.t("{0} hr ago",o):t?nt.l10n.t("{0} hours ago",o):nt.l10n.t("{0} hrs ago",o):o===1?t?nt.l10n.t("{0} hour",o):nt.l10n.t("{0} hr",o):t?nt.l10n.t("{0} hours",o):nt.l10n.t("{0} hrs",o)):i<T2?(o=Math.floor(i/$S),e?o===1?nt.l10n.t("{0} day ago",o):nt.l10n.t("{0} days ago",o):o===1?nt.l10n.t("{0} day",o):nt.l10n.t("{0} days",o)):i<R2?(o=Math.floor(i/T2),e?o===1?t?nt.l10n.t("{0} week ago",o):nt.l10n.t("{0} wk ago",o):t?nt.l10n.t("{0} weeks ago",o):nt.l10n.t("{0} wks ago",o):o===1?t?nt.l10n.t("{0} week",o):nt.l10n.t("{0} wk",o):t?nt.l10n.t("{0} weeks",o):nt.l10n.t("{0} wks",o)):i<A2?(o=Math.floor(i/R2),e?o===1?t?nt.l10n.t("{0} month ago",o):nt.l10n.t("{0} mo ago",o):t?nt.l10n.t("{0} months ago",o):nt.l10n.t("{0} mos ago",o):o===1?t?nt.l10n.t("{0} month",o):nt.l10n.t("{0} mo",o):t?nt.l10n.t("{0} months",o):nt.l10n.t("{0} mos",o)):(o=Math.floor(i/A2),e?o===1?t?nt.l10n.t("{0} year ago",o):nt.l10n.t("{0} yr ago",o):t?nt.l10n.t("{0} years ago",o):nt.l10n.t("{0} yrs ago",o):o===1?t?nt.l10n.t("{0} year",o):nt.l10n.t("{0} yr",o):t?nt.l10n.t("{0} years",o):nt.l10n.t("{0} yrs",o))}var oV=P(M());var Lh=class{async createHash(e,t="SHA-256"){return va(e,t)}};Lh=y([(0,oV.injectable)()],Lh);var BE={},iV=!1,qE;typeof window=="object"?qE=window.crypto:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?qE=self.crypto:qE=require("node:crypto").webcrypto;async function va(r,e){let t=r.includes("/")||r.includes("\\")||r.endsWith(".interactive");if(t&&BE[r])return BE[r];let n=await Ine(r,e);return t&&!iV&&(Object.keys(BE).length>1e4&&(iV=!0),BE[r]=n),n}async function Ine(r,e){let t=new TextEncoder().encode(r),n=await qE.subtle.digest({name:e},t);return Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")}function op(r){if(typeof r=="string")try{let[e,t,n]=`${r.trim()}...`.split(".").map(i=>parseInt(i,10));return isNaN(e)?"":isNaN(t)?e.toString():isNaN(n)?`${e}.${t}`:`${e}.${t}.${n}`}catch(e){return d.error(`Failed to parse version ${r}`,e),""}return r?`${r.major}.${r.minor}.${r.micro}`:""}async function mt(r){return va(r,"SHA-256")}var lN=P(sV());var XS=require("vscode");function Yr(r){let e=Tr(r);if(e){let l=[];typeof e.version?.major=="number"&&(l.push(e.version.major.toString()),typeof e.version.minor=="number"&&(l.push(e.version.minor.toString()),typeof e.version.micro=="number"&&l.push(e.version.micro.toString())));let c=l.length?l.join("."):"",u=e.environment?.name||(e.environment?vn(e.environment?.folderUri):""),p=c?`Python ${c}`:"Python";return Hr(r)&&u?u:u?`${u} (${p})`:p}if(Object.keys(r).length===1&&r.id)return r.id;let t=op(Yi(r)||"").trim(),n=Hr(r),i=t?`Python ${t}`:"Python",o=jo(r);if(n&&o)return o;let s=[];o&&s.push(o);let a=Be(r);return a&&a!=="Unknown"&&s.push(a),[i,s.length?`(${s.join(": ")})`:""].join(" ").trim()}function jo(r){let e=Tr(r),t=e?.environment?.name;return!t&&e?.environment?.folderUri&&Be(r)==="Conda"&&(t=vn(e?.environment?.folderUri)),t}var Cne=["Unknown","Conda","PipEnv","Poetry","Pyenv","Venv","VirtualEnv","VirtualEnvWrapper"];function Be(r){let e=Tr(r);return e?wne(e):"Unknown"}function wne(r){if(r.environment?.type==="Conda")return"Conda";let e=[["Conda","Conda"],["Pyenv","Pyenv"],["Pipenv","PipEnv"],["Poetry","Poetry"],["VirtualEnvWrapper","VirtualEnvWrapper"],["VirtualEnv","VirtualEnv"],["Venv","Venv"]];for(let[t,n]of e)if(r.tools.includes(t))return n;if(r.environment?.type==="VirtualEnvironment")return"VirtualEnv";for(let t of Cne)if(r.tools.some(n=>n.toLowerCase()===t.toLowerCase()))return t;return"Unknown"}var fo;function aV(r){fo=r}function Hr(r){if(!r||!fo)return!1;let e=Tr(r);return e&&Be(e)==="Conda"&&!e.executable.uri}function Tr(r){if(r){if(!fo)throw new Error("Python API not initialized");return fo.environments.known.find(e=>e.id===r.id)}}async function ya(r){if(!r?.id)return;if(fo){let n=fo.environments.known.find(i=>i.id===r.id);if(n?.executable?.sysPrefix)return n.executable.sysPrefix}let t=await(await lN.PythonExtension.api()).environments.resolveEnvironment(r.id).then(n=>n?.executable?.sysPrefix);return t||d.warn(`Unable to find sysPrefix for interpreter ${B(r.id)}`),t}function Uh(r){if(!r?.id)return;if(!fo)throw new Error("Python API not initialized");return fo.environments.known.find(t=>t.id===r.id)?.executable?.sysPrefix}async function ap(r,e=!1){if(!r?.id)return;if(fo&&!e){let i=fo.environments.known.find(o=>o.id===r.id);if(i?.version)return i.version}let n=await(await lN.PythonExtension.api()).environments.resolveEnvironment(r.id);return n?.version||d.warn(`Unable to find Version for interpreter ${B(r.id)}`),n?.version}function Yi(r){if(!r?.id)return;if(!fo)throw new Error("Python API not initialized");return fo.environments.known.find(t=>t.id===r.id)?.version}function ho(){return fo?fo.environments.known:[]}function Ai(r){if(!r)return;let e,t=r.id;if(r.executable.uri)e=r.executable.uri;else if(Be(r)==="Conda")e=Fr()==="Windows"?XS.Uri.joinPath(r.environment?.folderUri||XS.Uri.file(r.path),"python.exe"):XS.Uri.joinPath(r.environment?.folderUri||XS.Uri.file(r.path),"bin","python");else{d.warn(`Python environment ${B(r.id)} excluded as Uri is undefined`);return}return{id:t,uri:e}}function Ene(r){return Yr(r)}var me;(E=>(E.bannerLabelYes=w.l10n.t("Yes"),E.bannerLabelNo=w.l10n.t("No"),E.canceled=w.l10n.t("Canceled"),E.cancel=w.l10n.t("Cancel"),E.ok=w.l10n.t("Ok"),E.refresh=w.l10n.t("Refresh"),E.refreshing=w.l10n.t("Refreshing..."),E.install=w.l10n.t("Install"),E.loadingExtension=w.l10n.t("Jupyter Extension loading..."),E.handleExtensionActivationError=w.l10n.t("Extension activation failed, run the 'Developer: Toggle Developer Tools' command for more information."),E.doNotShowAgain=w.l10n.t("Do not show again"),E.reload=w.l10n.t("Reload"),E.moreInfo=w.l10n.t("More Info"),E.learnMore=w.l10n.t("Learn more"),E.and=w.l10n.t("and"),E.reportThisIssue=w.l10n.t("Report this issue"),E.clickHereForMoreInfoWithHtml=R=>w.l10n.t("Click <a href='{0}'>here</a> for more info.",R)))(me||={});var fm;(t=>(t.notInGroup=n=>w.l10n.t("User does not belong to experiment group '{0}'",n),t.inGroup=n=>w.l10n.t("User belongs to experiment group '{0}'",n)))(fm||={});var cN;(e=>e.jupyter=w.l10n.t("Jupyter"))(cN||={});var uN;(e=>e.currentWorkingDirectory="cwd:")(uN||={});var pN;(e=>e.bannerMessage=w.l10n.t("Would you like shift-enter to send code to the new Interactive Window experience?"))(pN||={});var dN;(e=>e.bannerMessage=w.l10n.t("Can you please take a minute to tell us about your notebooks experience in VS Code?"))(dN||={});var JE;(t=>(t.bannerLabelYes=w.l10n.t("Yes, take survey now"),t.bannerLabelNo=w.l10n.t("No, thanks")))(JE||={});var I;(D=>(D.warnWhenSelectingKernelWithUnSupportedPythonVersion=w.l10n.t("The version of Python associated with the selected kernel is no longer supported. Please consider selecting a different kernel."),D.installingPythonExtension=w.l10n.t("Installing Python extension and locating kernels."),D.pythonExtensionRequired=w.l10n.t("The Python Extension is required to perform that task. Click Yes to open Python Extension installation page."),D.rendererExtensionRequired=w.l10n.t("The Renderer Extension is required to view IPyWidgets. Click Yes to open Jupyter Notebook Renderer Extension installation page."),D.rendererExtension1015Required=w.l10n.t("The installed version of the Renderer Extension is outdated and requires and update to view IPyWidgets. Click Yes to open Jupyter Notebook Renderer Extension installation page."),D.pythonExtensionInstalled=w.l10n.t("Python Extension is now installed. Some features might not be available until a notebook or interactive window session is restarted."),D.unknownPackage=w.l10n.t("unknown"),D.interactiveWindowTitleFormat=U=>w.l10n.t("Interactive - {0}",U),D.interactiveWindowModeBannerTitle=w.l10n.t({message:"Do you want to open a new Interactive Window for this file? [More Information](command:workbench.action.openSettings?%5B%22jupyter.interactiveWindowMode%22%5D).",args:[],comment:'The string "command:workbench.action.openSettings?%5B%22jupyter.interactiveWindowMode%22%5D" should not be translated. It is a command that opens the settings page with the "jupyter.interactiveWindowMode" setting selected.'}),D.interactiveWindowModeBannerSwitchYes=w.l10n.t("Yes"),D.interactiveWindowModeBannerSwitchNo=w.l10n.t("No"),D.dataExplorerTitle=w.l10n.t("Data Viewer"),D.badWebPanelFormatString=U=>w.l10n.t({message:"<html><body><h1>{0} is not a valid file name</h1></body></html>",args:[U],comment:["Only translate the text within the HTML tags"]}),D.installingMissingDependencies=w.l10n.t("Installing missing dependencies"),D.validatingKernelDependencies=w.l10n.t("Validating kernel dependencies"),D.performingExport=w.l10n.t("Performing Export"),D.exportNotebookToPython=w.l10n.t("Exporting Notebook to Python"),D.sessionDisposed=w.l10n.t("Cannot execute code, session has been disposed. Please try restarting the Kernel."),D.passwordFailure=w.l10n.t("Failed to connect to password protected server. Check that password is correct."),D.incorrectPassword=w.l10n.t("Incorrect Password."),D.exportDialogFilter=w.l10n.t("Jupyter Notebooks"),D.exportDialogComplete=U=>w.l10n.t("Notebook written to {0}",U),D.exportDialogFailed=U=>w.l10n.t("Failed to export notebook. {0}",U),D.exportOpenQuestion1=w.l10n.t("Open in editor"),D.runCellLensCommandTitle=w.l10n.t("Run Cell"),D.importDialogTitle=w.l10n.t("Import Jupyter Notebook"),D.importDialogFilter="Jupyter Notebooks",D.notebookCheckForImportNo=w.l10n.t("Later"),D.libraryRequiredToLaunchJupyterNotInstalled=U=>w.l10n.t("Running cells requires {0} package.",U),D.librariesRequiredToLaunchJupyterNotInstalled=U=>w.l10n.t("Running cells requires {0} package.",U),D.libraryRequiredToLaunchJupyterNotInstalledInterpreter=(U,Ge)=>w.l10n.t("Running cells with '{0}' requires the {1} package.",U,Ge),D.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreter=(U,Ge)=>w.l10n.t("Running cells with '{0}' requires the {1} package.",U,Ge),D.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreterAndRequiresUpdate=(U,Ge)=>w.l10n.t("Running cells with '{0}' requires the {1} package to be installed or requires an update.",U,Ge),D.librariesRequiredToLaunchJupyterNotInstalledInterpreter=(U,Ge)=>w.l10n.t("Running cells with '{0}' requires the {1} package.",U,Ge),D.installPackageInstructions=(U,Ge)=>w.l10n.t(`Run the following command to install '{0}' into the Python environment.
|
||
Command: '{1}'`,U,Ge),D.pythonCondaKernelsWithoutPython=w.l10n.t("The Python Runtime and IPyKernel will be automatically installed upon selecting this environment."),D.selectJupyterInterpreter=w.l10n.t("Select an Interpreter to start Jupyter"),D.jupyterInstall=w.l10n.t("Install"),D.currentlySelectedJupyterInterpreterForPlaceholder=U=>w.l10n.t("Selected Environment {0}",U),D.jupyterNotSupported=U=>w.l10n.t("Jupyter cannot be started. Error attempting to locate Jupyter: {0}",U),D.jupyterNotebookNotInstalledOrNotFound=U=>{if(U){let Ge=Ene(U);return w.l10n.t("Failed to start Jupyter Server as the packages 'jupyter' and 'notebook' could not be located in the Python environment '{0}'.",Ge)}else return w.l10n.t("Failed to start Jupyter Server as the packages 'jupyter' and 'notebook' could not be located in the Python environment.")},D.jupyterNotSupportedBecauseOfEnvironment=(U,Ge)=>w.l10n.t("Activating {0} to run Jupyter failed with {1}",U,Ge),D.jupyterNbConvertNotSupported=w.l10n.t("Jupyter nbconvert is not installed"),D.jupyterLaunchTimedOut=w.l10n.t("The Jupyter notebook server failed to launch in time"),D.jupyterLaunchNoURL=w.l10n.t("Failed to find the URL of the launched Jupyter notebook server"),D.jupyterSelfCertFail=U=>w.l10n.t(`The security certificate used by server {0} was not issued by a trusted certificate authority.\r
|
||
This may indicate an attempt to steal your information.\r
|
||
Do you want to enable the Allow Unauthorized Remote Connection setting for this workspace to allow you to connect?`,U),D.jupyterExpiredCertFail=U=>w.l10n.t(`The security certificate used by server {0} has expired.\r
|
||
This may indicate an attempt to steal your information.\r
|
||
Do you want to enable the Allow Unauthorized Remote Connection setting for this workspace to allow you to connect?`,U),D.jupyterSelfCertFailErrorMessageOnly=w.l10n.t(`The security certificate used by server was not issued by a trusted certificate authority.\r
|
||
This may indicate an attempt to steal your information.`),D.jupyterSelfCertExpiredErrorMessageOnly=w.l10n.t(`The security certificate used by server has expired.\r
|
||
This may indicate an attempt to steal your information.`),D.jupyterSelfCertEnable=w.l10n.t("Yes, connect anyways"),D.jupyterSelfCertClose=w.l10n.t("No, close the connection"),D.pythonInteractiveHelpLink=w.l10n.t("See <https://aka.ms/pyaiinstall> for help on installing Jupyter."),D.importingFormat=U=>w.l10n.t("Importing {0}",U),D.startingJupyter=w.l10n.t("Starting Jupyter Server"),D.connectingToKernel=U=>w.l10n.t("Connecting to kernel: {0}",U),D.connectingToJupyter=w.l10n.t("Connecting to Jupyter Server"),D.exportingFormat=U=>w.l10n.t("Exporting {0}",U),D.runAllCellsLensCommandTitle=w.l10n.t("Run All Cells"),D.runAllCellsAboveLensCommandTitle=w.l10n.t("Run Above"),D.runCellAndAllBelowLensCommandTitle=w.l10n.t("Run Below"),D.restartKernelMessage=w.l10n.t("Do you want to restart the Jupyter kernel? All variables will be lost."),D.restartKernelMessageYes=w.l10n.t("Restart"),D.restartKernelMessageDontAskAgain=w.l10n.t("Don't Ask Again"),D.automaticallyReconnectingToAKernelProgressMessage=U=>w.l10n.t("Reconnecting to the kernel {0}",U),D.restartingKernelStatus=U=>w.l10n.t("Restarting Kernel {0}",U),D.interruptingKernelFailed=w.l10n.t("Kernel interrupt failed. Jupyter Server is hung. Please reload VS Code."),D.sessionStartFailedWithKernel=U=>w.l10n.t({message:`Failed to start the Kernel '{0}'.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.failedToStartJupyter=U=>w.l10n.t({message:`Failed to start Jupyter in the environment '{0}'.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.failedToStartJupyterWithErrorInfo=(U,Ge)=>w.l10n.t({message:`Failed to start Jupyter in the environment '{0}'.
|
||
{1}
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U,Ge],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.failedToStartJupyterDueToOutdatedTraitlets=(U,Ge)=>w.l10n.t({message:`Failed to start Jupyter in the environment '{0}' possibly due to an outdated version of 'traitlets'.
|
||
{1}
|
||
Consider updating the 'traitlets' module to '5.1.1' or later.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U,Ge],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel',"Do not translate the text 'traitlets', that is a Python module name"]}),D.failedToStartKernel=w.l10n.t("Failed to start the Kernel."),D.failedToRestartKernel=w.l10n.t("Failed to restart the Kernel."),D.failedToInterruptKernel=w.l10n.t("Failed to interrupt the Kernel."),D.rawKernelStartFailedDueToTimeout=U=>w.l10n.t({message:`Unable to start Kernel '{0}' due to a connection timeout.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.rawKernelStartFailedDueToTimeoutWaitingForPort=U=>w.l10n.t({message:`Unable to start Kernel '{0}' due to a timeout waiting for the ports to get used.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.viewJupyterLogForFurtherInfo=w.l10n.t({message:"View Jupyter [log](command:jupyter.viewOutput) for further details.",comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.kernelDied=U=>w.l10n.t({message:"The kernel died. Error: {0}... View Jupyter [log](command:jupyter.viewOutput) for further details.",args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.kernelDiedWithoutError=U=>w.l10n.t({message:"The kernel '{0}' died. Click [here](https://aka.ms/vscodeJupyterKernelCrash) for more info. View Jupyter [log](command:jupyter.viewOutput) for further details.",args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel',"Do not translate the link https://aka.ms/vscodeJupyterKernelCrash"]}),D.failedToStartAnUntrustedKernelSpec=(U,Ge)=>w.l10n.t({message:`The kernel '{0}' was not started as it is located in an insecure location '{1}'.
|
||
Click [here](https://aka.ms/JupyterTrustedKernelPaths) for further details, optionally update the setting [jupyter.kernels.trusted](command:workbench.action.openSettings?["jupyter.kernels.trusted"]) to trust the kernel.`,args:[U,Ge],comment:['Do not translate the text "jupyter.kernels.trusted", that is a setting in VS Code','Do not translate the text command:workbench.action.openSettings?["jupyter.kernels.trusted"], that is a command Id that will be used by VS Code to open the output panel',"Do not translate the link https://aka.ms/JupyterTrustedKernelPaths"]}),D.kernelDiedWithoutErrorAndAutoRestarting=U=>w.l10n.t({message:"The kernel '{0}' died and is being automatically restarted by Jupyter. Click [here](https://aka.ms/vscodeJupyterKernelCrash) for more info. View Jupyter [log](command:jupyter.viewOutput) for further details.",args:[U],comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel',"Do not translate the link https://aka.ms/vscodeJupyterKernelCrash"]}),D.kernelCrashedDueToCodeInCurrentOrPreviousCell=w.l10n.t({message:`The Kernel crashed while executing code in the current cell or a previous cell.
|
||
Please review the code in the cell(s) to identify a possible cause of the failure.
|
||
Click <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info.
|
||
View Jupyter [log](command:jupyter.viewOutput) for further details.`,comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel',"Do not translate the link https://aka.ms/vscodeJupyterKernelCrash"]}),D.kernelDisconnected=U=>w.l10n.t("Unable to connect to the kernel '{0}', please verify the Jupyter Server connection. View Jupyter [log](command:jupyter.viewOutput) for further details.",U),D.cannotRunCellKernelIsDead=U=>w.l10n.t("Cannot run cells, as the kernel '{0}' is dead.",U),D.showJupyterLogs=w.l10n.t("Show Jupyter Logs."),D.restartKernel=w.l10n.t("Restart Kernel"),D.reloadRequired=w.l10n.t("Please reload the window for new settings to take effect."),D.restartedKernelHeader=U=>w.l10n.t("Restarted {0}",U),D.connectedKernelHeader=U=>w.l10n.t("Connected to {0}",U),D.restartingKernelCustomHeader=U=>w.l10n.t("_Restarting {0}..._",U),D.restartingKernelHeader=w.l10n.t("_Restarting kernel..._"),D.startingNewKernelHeader=w.l10n.t("_Connecting to kernel..._"),D.startingNewKernelCustomHeader=U=>w.l10n.t("_Connecting to {0}..._",U),D.noKernelConnected=w.l10n.t("No kernel connected"),D.jupyterSelectUriCommandLabel=w.l10n.t("Enter the URL of the running Jupyter Server..."),D.jupyterSelectUriInputTitle=w.l10n.t("Enter the URL of the running Jupyter Server"),D.jupyterSelectUriInputPlaceholder=w.l10n.t("Enter the url of the running Jupyter Server"),D.connectToToTheJupyterServer=U=>w.l10n.t("Connect to the Jupyter Server {0}",U),D.enterOrSelectRemoteJupyterPlaceholder=w.l10n.t("Enter a remote url, or select a remote server"),D.selectRemoteJupyterPlaceholder=w.l10n.t("Select a remote server"),D.jupyterServerLastConnectionForQuickPickDescription=U=>w.l10n.t("Last connected {0}",Th(U,!0,!1,!1)),D.jupyterServerNotUsedBeforeQuickPickSeparatorTitle=w.l10n.t("Jupyter Servers"),D.jupyterSelectURIInvalidURI=w.l10n.t("Invalid URL specified"),D.jupyterSelectURIMustBeHttpOrHttps=w.l10n.t("Invalid protocol in URL specified, only HTTP or HTTPS are supported."),D.jupyterSelectLiveRemoteKernelDescription=(U,Ge)=>U?Ge===0?w.l10n.t("Last activity {0}",Th(U,!0,!1,!1)):Ge===1?w.l10n.t("Last activity {0}, 1 connection",Th(U,!0,!1,!1)):w.l10n.t("Last activity {0}, {1} connections",Th(U,!0,!1,!1),Ge.toString()):Ge===0?"":Ge===1?w.l10n.t("1 connection"):w.l10n.t("{0} connections",Ge.toString()),D.installJupyterHub=w.l10n.t("Install the JupyterHub extension to connect to JupyterHub servers."),D.useJupyterHubExtension=w.l10n.t("Select 'Existing JupyterHub Server...' from the Kernel Picker"),D.useJupyterHubExtensionDetail=w.l10n.t("Use this option when connecting to JupyterHub servers"),D.installJupyterHubDetail=w.l10n.t("Once installed, open the Kernel Picker and select 'Existing JupyterHub Server...'"),D.jupyterSelectUserAndPasswordTitle=w.l10n.t("Enter your user name and password to connect to Jupyter Hub"),D.jupyterRenameServer=w.l10n.t("Change Server Display Name (Leave Blank To Use URL)"),D.jupyterServerUriDisplayNameInputPlaceholder=w.l10n.t("Enter a display name"),D.jupyterSelectUserPrompt=w.l10n.t("Enter your user name"),D.jupyterSelectPasswordPrompt=w.l10n.t("Enter your password"),D.jupyterSelectPasswordTitle=w.l10n.t("Enter your password for the Jupyter Server"),D.pythonNotInstalled=w.l10n.t(`Python is not installed.
|
||
Please download and install Python in order to execute cells in this notebook.
|
||
Once installed please reload VS Code.`),D.pleaseReloadVSCodeOncePythonHasBeenInstalled=w.l10n.t("Upon installing Python please reload VS Code."),D.jupyterNotebookFailure=U=>w.l10n.t(`Jupyter notebook failed to launch. \r
|
||
{0}`,U),D.remoteJupyterServerProvidedBy3rdPartyExtensionNoLongerValid=U=>w.l10n.t("The remote Jupyter Server contributed by the extension '{0}' is no longer available.",U),D.remoteJupyterConnectionFailedWithServerWithError=(U,Ge)=>w.l10n.t("Failed to connect to the remote Jupyter Server '{0}'. Verify the server is running and reachable. ({1}).",U,Ge),D.remoteJupyterConnectionFailedWithServer=U=>w.l10n.t("Failed to connect to the remote Jupyter Server '{0}'. Verify the server is running and reachable.",U),D.remoteJupyterConnectionFailedWithoutServerWithError=U=>w.l10n.t("Connection failure. Verify the server is running and reachable. ({0}).",U),D.remoteJupyterConnectionFailedWithoutServerWithErrorWeb=U=>w.l10n.t(`Connection failure. Verify the server is running and reachable from a browser. ({0}).
|
||
When connecting from vscode.dev Jupyter servers must be started with specific options to connect.
|
||
Click [here](https://aka.ms/vscjremoteweb) for more information.`,U),D.removeRemoteJupyterConnectionButtonText=w.l10n.t("Forget Connection"),D.jupyterNotebookRemoteConnectFailedWeb=U=>w.l10n.t(`Failed to connect to remote Jupyter Server.\r
|
||
Check that the Jupyter Server URL can be reached from a browser.\r
|
||
{0}. Click [here](https://aka.ms/vscjremoteweb) for more information.`,U),D.packageNotInstalledWindowsLongPathNotEnabledError=(U,Ge)=>w.l10n.t(`Support for Windows Long Path has not been enabled, hence the package {0} could not be installed into the Python Environment '{1}'.
|
||
Please ensure that support for Windows Long Path is enabled.
|
||
See [here](https://pip.pypa.io/warnings/enable-long-paths) for more information.`,U,Ge),D.changeRemoteJupyterConnectionButtonText=w.l10n.t("Manage Connections"),D.rawConnectionBrokenError=w.l10n.t("Direct kernel connection broken"),D.jupyterServerCrashed=U=>w.l10n.t(`Jupyter Server crashed. Unable to connect. \r
|
||
Error code from Jupyter: {0}`,U.toString()),D.jupyterKernelSpecModuleNotFound=U=>w.l10n.t(`'Kernelspec' module not installed in the selected interpreter ({0}).
|
||
Please re-install or update 'jupyter'.`,U),D.interruptKernelStatus=U=>w.l10n.t("Interrupting Kernel {0}",U),D.exportPythonQuickPickLabel=w.l10n.t("Python Script"),D.exportHTMLQuickPickLabel=w.l10n.t("HTML"),D.exportPDFQuickPickLabel=w.l10n.t("PDF"),D.restartKernelAfterInterruptMessage=U=>w.l10n.t("Interrupting the kernel '{0}' timed out. Do you want to restart the kernel instead? All variables will be lost.",U),D.documentMismatch=U=>w.l10n.t("Cannot run cells, duplicate documents for {0} found.",U),D.jupyterGetVariablesBadResults=w.l10n.t("Failed to fetch variable info from the Jupyter Server."),w.l10n.t("Failure to create an 'Interactive' window. Try reinstalling the Python Extension."),D.jupyterGetVariablesExecutionError=U=>w.l10n.t(`Failure during variable extraction: \r
|
||
{0}`,U),D.selectKernel=w.l10n.t("Change Kernel"),D.selectDifferentKernel=w.l10n.t("Select a different Kernel"),D.kernelFilterPlaceholder=w.l10n.t("Choose the kernels that are available in the kernel picker."),D.recommendedItemCategoryInQuickPick=w.l10n.t("Recommended"),D.selectedKernelCategoryInQuickPick=w.l10n.t("Selected"),D.createPythonEnvironmentInQuickPick=w.l10n.t("Create Python Environment"),D.createPythonEnvironmentInQuickPickTooltip=w.l10n.t("Create an isolated Python Environment per workspace folder"),D.selectDifferentJupyterInterpreter=w.l10n.t("Change Interpreter"),D.pandasTooOldForViewingFormat=(U,Ge)=>w.l10n.t({message:"Python package 'pandas' is version {0}. Version {1} or greater is required for viewing data.",args:[U,Ge],comment:["Do not translate 'pandas' as that is a Python module name"]}),D.pandasRequiredForViewing=U=>w.l10n.t({message:"Python package 'pandas' version {0} (or above) is required for viewing data.",args:[U],comment:["Do not translate 'pandas' as that is a Python module name"]}),D.tooManyColumnsMessage=w.l10n.t("Variables with over a 1000 columns may take a long time to display. Are you sure you wish to continue?"),D.tooManyColumnsYes=w.l10n.t("Yes"),D.tooManyColumnsNo=w.l10n.t("No"),D.tooManyColumnsDontAskAgain=w.l10n.t("Don't Ask Again"),D.plotViewerTitle=w.l10n.t("Plots"),D.exportPlotTitle=w.l10n.t("Save plot image"),D.pdfFilter="PDF",D.pngFilter="PNG",D.svgFilter="SVG",D.exportImageFailed=U=>w.l10n.t("Error exporting image: {0}",U),D.jupyterDataRateExceeded=w.l10n.t({message:"Cannot view variable because data rate exceeded. Please restart your server with a higher data rate limit. For example, --NotebookApp.iopub_data_rate_limit=10000000000.0",comment:["Do not translate the text --NotebookApp.iopub_data_rate_limit=10000000000.0 as that is a command argument."]}),D.addCellBelowCommandTitle=w.l10n.t("Add cell"),D.debugCellCommandTitle=w.l10n.t("Debug Cell"),D.debugStepOverCommandTitle=w.l10n.t("Step over"),D.debugContinueCommandTitle=w.l10n.t("Continue"),D.debugStopCommandTitle=w.l10n.t("Stop"),D.runCurrentCellAndAddBelow=w.l10n.t("Run current cell and add empty cell below"),D.jupyterDebuggerNotInstalledError=U=>w.l10n.t("Pip module {0} is required for debugging cells. You will need to install it to debug cells.",U),D.jupyterDebuggerOutputParseError=U=>w.l10n.t("Unable to parse {0} output, please log an issue with https://github.com/microsoft/vscode-jupyter",U),D.cellStopOnErrorMessage=w.l10n.t("Cell was canceled due to an error in a previous cell."),D.scrollToCellTitleFormatMessage=U=>w.l10n.t("Go to [{0}]",U.toString()),D.instructionComments=U=>w.l10n.t(`# To add a new cell, type '{0}'
|
||
# To add a new markdown cell, type '{0} [markdown]'
|
||
`,U),D.exportButtonTitle=w.l10n.t("Export"),D.exportAsQuickPickPlaceholder=w.l10n.t("Export As..."),D.openExportedFileMessage=w.l10n.t("Would you like to open the exported file?"),D.openExportFileYes=w.l10n.t("Yes"),D.openExportFileNo=w.l10n.t("No"),D.exportFailedGeneralMessage=w.l10n.t({message:"Please check the 'Jupyter' [output](command:jupyter.viewOutput) panel for further details.",comment:['Do not translate the text "command:jupyter.viewOutput", that is a command Id that will be used by VS Code to open the output panel']}),D.exportToPDFDependencyMessage=w.l10n.t(`If you have not installed xelatex (TeX), you will need to do so before you can export to PDF. For further instructions, please see https://nbconvert.readthedocs.io/en/latest/install.html#installing-tex. \r
|
||
To avoid installing xelatex (TeX), you might want to try exporting to HTML and using your browser's "Print to PDF" feature.`),D.failedExportMessage=w.l10n.t("Export failed."),D.startingJupyterLogMessage=(U,Ge)=>w.l10n.t("Starting Jupyter from {0} with arguments {1}",U,Ge),D.waitingForJupyterSessionToBeIdle=w.l10n.t("Waiting for Jupyter Session to be idle"),D.gettingListOfKernelsForRemoteConnection=w.l10n.t("Fetching Kernels"),D.gettingListOfKernelSpecs=w.l10n.t("Fetching Kernel specs"),D.startingJupyterNotebook=w.l10n.t("Starting Jupyter Notebook"),D.registeringKernel=w.l10n.t("Registering Kernel"),D.jupyterCommandLineReloadQuestion=w.l10n.t("Please reload the window when changing the Jupyter command line."),D.jupyterCommandLineReloadAnswer=w.l10n.t("Reload"),D.createdNewKernel=(U,Ge)=>w.l10n.t("{0}: Kernel started: {1}",U,Ge),D.kernelInvalid=U=>w.l10n.t("Kernel {0} is not usable. Check the Jupyter output tab for more information.",U),D.removeRemoteJupyterServerEntryInQuickPick=w.l10n.t("Remove"),D.loadClassFailedWithNoInternet=(U,Ge)=>w.l10n.t("Error loading {0}:{1}. Internet connection required for loading 3rd party widgets.",U,Ge),D.useCDNForWidgetsNoInformation=w.l10n.t("Widgets require us to download supporting files from a 3rd party website."),D.enableCDNForWidgetsSetting=(U,Ge)=>w.l10n.t("Widgets require us to download supporting files from a 3rd party website. (Error loading {0}:{1}).",U,Ge),D.enableCDNForWidgetsButton=w.l10n.t("Enable Downloads"),D.unhandledMessage=(U,Ge)=>w.l10n.t("Unhandled kernel message from a widget: {0} : {1}",U,Ge),D.cdnWidgetScriptNotAccessibleWarningMessage=(U,Ge)=>w.l10n.t("Unable to download widget '{0}' from 3rd party website {1}, due to network access. Expected behavior may be affected. Click [here](https://aka.ms/PVSCIPyWidgets) for more information.",U,Ge),D.widgetScriptNotFoundOnCDNWidgetMightNotWork=(U,Ge,$w)=>w.l10n.t("Unable to find widget '{0}' version '{1}' from configured widget sources {2}. Expected behavior may be affected. Click [here](https://aka.ms/PVSCIPyWidgets) for more information.",U,Ge,$w),D.insecureSessionMessage=w.l10n.t("Connecting over HTTP without a token may be an insecure connection. Do you want to connect to a possibly insecure server?"),D.insecureSessionDenied=w.l10n.t("Denied connection to insecure server."),D.selectKernelForEditor=w.l10n.t("[Select a kernel](command:_notebook.selectKernel) to run cells."),D.needIpykernel6=w.l10n.t("Ipykernel setup required for this feature"),D.setup=w.l10n.t("Setup"),D.showDataViewerFail=w.l10n.t("Failed to create the Data Viewer. Check the Jupyter tab of the Output window for more info."),D.defaultNotebookName=w.l10n.t("default"),D.recommendExtensionForNotebookLanguage=(U,Ge)=>w.l10n.t("The {0} extension is recommended for notebooks targeting the language '{1}'",U,Ge),D.kernelWasNotStarted=w.l10n.t("Kernel was not started. A kernel session is needed to start debugging."),D.noNotebookToDebug=w.l10n.t("No active notebook document to debug."),D.cantStartDebugging=w.l10n.t("Can't start debugging."),D.restartNotSupported=w.l10n.t("Restarting is not supported in the interactive window."),D.importingIpynb=w.l10n.t("Importing notebook file"),D.exportingToFormat=U=>w.l10n.t("Exporting to {0}",U),D.kernelCategoryForJupyterSession=w.l10n.t("Jupyter Session"),D.kernelDefaultRemoteDisplayName=w.l10n.t("Remote"),D.kernelCategoryForJupyterKernel=w.l10n.t("Jupyter Kernel"),D.kernelCategoryForRemoteJupyterKernel=w.l10n.t("Jupyter Kernel"),D.kernelCategoryForConda=w.l10n.t("Conda Env"),D.kernelCategoryForCondaWithoutPython=w.l10n.t("Conda Env Without Python"),D.kernelCategoryForPoetry=w.l10n.t("Poetry Env"),D.kernelCategoryForPipEnv=w.l10n.t("Pipenv Env"),D.kernelCategoryForPyEnv=w.l10n.t("PyEnv Env"),D.kernelCategoryForGlobal=w.l10n.t("Global Env"),D.kernelCategoryForVirtual=w.l10n.t("Virtual Env"),D.fileSeemsToBeInterferingWithKernelStartup=U=>w.l10n.t("The file '{0}' seems to be overriding built in modules and interfering with the startup of the kernel. Consider renaming the file and starting the kernel again.",U),D.moduleSeemsToBeInterferingWithKernelStartup=U=>w.l10n.t("The module '{0}' seems to be overriding built in modules and interfering with the startup of the kernel. Consider renaming the folder and starting the kernel again.",U),D.pipCondaInstallHoverWarning=(U,Ge)=>w.l10n.t("'!{0} install' could install packages into the wrong environment. [More info]({1})",U,Ge),D.percentPipCondaInstallInsteadOfBang=U=>w.l10n.t({message:"Use '%{0} install' instead of '!{0} install'",args:[U],comment:['Do not translate the string within quotes, such as "%{0} install" and "!{0} install" as that is a Jupyter Shell Magic command']}),D.replacePipCondaInstallCodeAction=U=>w.l10n.t("Replace with '%{0} install'",U),D.failedToStartKernelDueToMissingModule=U=>w.l10n.t("The kernel failed to start due to the missing module '{0}'. Consider installing this module.",U),D.failedToStartKernelDueToImportFailure=U=>w.l10n.t("The kernel failed to start as the module '{0}' could not be imported.",U),D.failedToStartKernelDueToImportFailureFromFile=(U,Ge)=>w.l10n.t("The kernel failed to start as '{0}' could not be imported from '{1}'.",U,Ge),D.failedToStartKernelDueToUnknownDllLoadFailure=w.l10n.t("The kernel failed to start as a dll could not be loaded."),D.failedToStartKernelDueToDllLoadFailure=U=>w.l10n.t("The kernel failed to start as the dll '{0}' could not be loaded.",U),D.failedToStartKernelDueToWin32APIFailure=w.l10n.t("The kernel failed to start due to an error with the Win32api module. Consider (re) installing this module."),D.failedToStartKernelDueToPyZmqFailure=w.l10n.t({message:"The kernel failed to start due to an error with the 'pyzmq' module. Consider re-installing this module.",comment:['Do not translate the string "pyzmq" as that is a Python module.']}),D.failedToStartKernelDueToOldIPython=w.l10n.t("The kernel failed to start due to an outdated version of IPython. Consider updating this module to the latest version."),D.failedToStartKernelDueToOldIPyKernel=w.l10n.t("The kernel failed to start due to an outdated version of IPyKernel. Consider updating this module to the latest version."),D.failedToStartKernelDueToMissingPythonEnv=U=>w.l10n.t("The kernel failed to start as the Python Environment '{0}' is no longer available. Consider selecting another kernel or refreshing the list of Python Environments.",U),D.matplotlibWidgetInsteadOfOther=w.l10n.t("'%matplotlib' widget works best inside of VS Code"),D.matplotlibWidgetCodeActionTitle=w.l10n.t("More info"),D.allowExtensionToUseJupyterKernelApi=(U,Ge)=>w.l10n.t("Do you want to give the extension '{0}' access to the Jupyter Kernels? Clicking '{1}' would allow this extension to execute code against the Jupyter Kernels.",U,Ge),D.thanksForUsingJupyterKernelApiPleaseRegisterWithUs=U=>w.l10n.t("Thank you for trying the Jupyter API. Please file an issue on our repo to allow the extension {0} to use this API in production. This would prevent us from breaking your extension when updating the API (as it is still a work in progress).",U),D.activatingPythonEnvironment=U=>w.l10n.t("Activating Python Environment '{0}'",U),D.runningKernelStartupHooksFor=U=>w.l10n.t("Running Kernel startup hooks in '{0}'",U),D.cellAtFormat=(U,Ge)=>w.l10n.t("{0} Cell {1}",U,Ge),D.jupyterServerConsoleOutputChannel=w.l10n.t("Jupyter Server Console"),D.kernelConsoleOutputChannel=U=>w.l10n.t("{0} Kernel Console Output",U),D.webNotSupported=w.l10n.t("Operation not supported in web version of Jupyter Extension."),D.failedToInstallPythonExtension=w.l10n.t("Failed to install the Python Extension."),D.filesPossiblyOverridingPythonModulesMayHavePreventedKernelFromStarting=U=>w.l10n.t("Some of the following files found in the working directory may have prevented the Kernel from starting. Consider renaming them.",U),D.listOfFilesWithLinksThatMightNeedToBeRenamed=U=>w.l10n.t("File(s): {0} might need to be renamed.",U),D.failedToGetVersionOfPandas=w.l10n.t("Failed to get version of Pandas to use the Data Viewer."),D.failedToInstallPandas=w.l10n.t("Failed to install Pandas to use the Data Viewer."),D.localKernelSpecs=w.l10n.t("Jupyter Kernel..."),D.localPythonEnvironments=w.l10n.t("Python Environments..."),D.quickPickTitleForSelectionOfJupyterServer=w.l10n.t("Select a Jupyter Server"),D.UserJupyterServerUrlProviderDisplayName=w.l10n.t("Existing Jupyter Server..."),D.UserJupyterServerUrlProviderDetail=w.l10n.t("Connect to an existing Jupyter Server"),D.kernelPickerSelectKernelTitle=w.l10n.t("Select Kernel"),D.kernelPickerSelectLocalKernelSpecTitle=w.l10n.t("Select a Jupyter Kernel"),D.quickPickSelectPythonEnvironmentTitle=w.l10n.t("Select a Python Environment"),D.kernelPickerSelectKernelFromRemoteTitle=U=>w.l10n.t("Select a Kernel from {0}",U),D.kernelPickerSelectKernelFromRemoteTitleWithoutName=w.l10n.t("Select a Jupyter Kernel"),D.installPythonExtensionViaKernelPickerTitle=w.l10n.t("Install Python Extension"),D.installPythonExtensionViaKernelPickerToolTip=w.l10n.t("Python Extension is required to detect and use Python environments for the execution of code cells."),D.installPythonQuickPickTitle=w.l10n.t("Install Python"),D.installPythonQuickPickToolTip=w.l10n.t("Python Environments not detected. Upon installation reload VS Code or refresh the list of Kernels."),D.failedToFetchKernelSpecsRemoteErrorMessageForQuickPickLabel=w.l10n.t({message:"$(error) Unable to connect to the remote server",comment:"Do not translate the string $(error) as that is a VS Code icon."}),D.failedToFetchKernelSpecsRemoteErrorMessageForQuickPickDetail=w.l10n.t("Ensure the server is running and reachable."),D.dataViewerDeprecationMessage=w.l10n.t("The built-in data viewer will be deprecated soon. Please install other data viewing extensions to keep the ability to inspect data."),D.dataViewerDeprecationRecommendationActionMessage=w.l10n.t("See Recommended Extensions")))(I||={});var Wt;(Q=>(Q.collapseSingle=w.l10n.t("Collapse"),Q.expandSingle=w.l10n.t("Expand"),Q.noRowsInDataViewer=w.l10n.t("No rows match current filter"),Q.sliceIndexError=w.l10n.t({message:"Index {0} out of range for axis {1} with {2} elements",comment:["Do not translate the strings {0}, {1} and {2} as they are variable names and will be replaced later"]}),Q.sliceMismatchedAxesError=w.l10n.t({message:"Expected {0} axes, got {1} in slice expression",comment:["Do not translate the strings {0} and {2} as they are variable names and will be replaced later"]}),Q.fetchingDataViewer=w.l10n.t("Fetching data ..."),Q.dataViewerHideFilters=w.l10n.t("Hide filters"),Q.dataViewerShowFilters=w.l10n.t("Show filters"),Q.refreshDataViewer=w.l10n.t("Refresh data viewer"),Q.sliceSummaryTitle=w.l10n.t("SLICING"),Q.sliceData=w.l10n.t("Slice Data"),Q.sliceSubmitButton=w.l10n.t("Apply"),Q.sliceDropdownAxisLabel=w.l10n.t("Axis"),Q.sliceDropdownIndexLabel=w.l10n.t("Index"),Q.variableExplorerNameColumn=w.l10n.t("Name"),Q.variableExplorerTypeColumn=w.l10n.t("Type"),Q.variableExplorerCountColumn=w.l10n.t("Size"),Q.variableExplorerValueColumn=w.l10n.t("Value"),Q.collapseVariableExplorerLabel=w.l10n.t("Variables"),Q.variableLoadingValue=w.l10n.t("Loading..."),Q.showDataExplorerTooltip=w.l10n.t("Show variable snapshot in data viewer"),Q.noRowsInVariableExplorer=w.l10n.t("No variables defined"),Q.loadingRowsInVariableExplorer=w.l10n.t("Loading variables"),Q.previousPlot=w.l10n.t("Previous"),Q.nextPlot=w.l10n.t("Next"),Q.panPlot=w.l10n.t("Pan"),Q.zoomInPlot=w.l10n.t("Zoom in"),Q.zoomOutPlot=w.l10n.t("Zoom out"),Q.exportPlot=w.l10n.t("Export to different formats"),Q.deletePlot=w.l10n.t("Remove"),Q.selectedImageListLabel=w.l10n.t("Selected Image"),Q.selectedImageLabel=w.l10n.t("Image"),Q.errorOutputExceedsLinkToOpenFormatString=w.l10n.t({message:"Output exceeds the <a href={0}>size limit</a>. Open the full output data <a href={1}>in a text editor</a>",comment:['Do not translate the the Hyperlink text "<a href={0}>size limit</a>" and "<a href={1}>in a text editor</a>". However the text inside those tags can be translated']})))(Wt||={});var ZS;(n=>(n.SHOW_DEPRECATED_FEATURE_PROMPT_FORMAT_ON_SAVE=w.l10n.t({message:"The setting 'python.formatting.formatOnSave' is deprecated, please use 'editor.formatOnSave'.",comment:['Do not translate the string "python.formatting.formatOnSave" as that is a setting in VS Code','Do not translate the string "editor.formatOnSave" as that is a setting in VS Code']}),n.SHOW_DEPRECATED_FEATURE_PROMPT_LINT_ON_TEXT_CHANGE=w.l10n.t({message:"The setting 'python.linting.lintOnTextChange' is deprecated, please enable 'python.linting.lintOnSave' and 'files.autoSave'.",comment:['Do not translate the string "python.linting.lintOnTextChange" as that is a setting in VS Code','Do not translate the string "python.linting.lintOnSave" as that is a setting in VS Code']}),n.SHOW_DEPRECATED_FEATURE_PROMPT_FOR_AUTO_COMPLETE_PRELOAD_MODULES=w.l10n.t({message:"The setting 'python.autoComplete.preloadModules' is deprecated, please consider using Pylance Language Server ('python.languageServer' setting).",comment:['Do not translate the string "python.autoComplete.preloadModules" as that is a setting in VS Code','Do not translate the string "python.languageServer" as that is a setting in VS Code']})))(ZS||={});var jh;(n=>(n.noCondaOrPipInstaller=w.l10n.t("There is no Conda or Pip installer available in the selected environment."),n.noPipInstaller=w.l10n.t("There is no Pip installer available in the selected environment."),n.searchForHelp=w.l10n.t("Search for help")))(jh||={});var mN;(e=>e.installingModule=t=>w.l10n.t("Installing {0}",t))(mN||={});var cV=fN(),$E=class{constructor(e,t,n){this.channel=e;this.homeReplaceRegEx=t,this.userNameReplaceRegEx=n}format(e,t,...n){let i=e?`${Xw()} [${e}] ${cV(t,...n)}`:cV(t,...n);return this.homeReplaceRegEx&&(i=i.replace(this.homeReplaceRegEx,"~")),this.userNameReplaceRegEx&&(i=i.replace(this.userNameReplaceRegEx,"<username>")),i}error(e,...t){this.channel.appendLine(this.format("error",e,...t))}warn(e,...t){this.channel.appendLine(this.format("warn",e,...t))}info(e,...t){this.channel.appendLine(this.format("info",e,...t))}debug(e,...t){this.channel.appendLine(this.format("debug",e,...t))}trace(e,...t){this.channel.appendLine(this.format("trace",e,...t))}ci(e,...t){}};var uV=fN();function ex(r,e,...t){let i=[...t].length===0?uV(e):uV(e,...t);return r?`${r} ${Xw()}: ${i}`:i}var HE=class{constructor(e){this.prefix=e}error(e,...t){console.error(ex("error",`${this.prefix||""} ${e}`,...t))}warn(e,...t){console.warn(ex("warn",`${this.prefix||""} ${e}`,...t))}info(e,...t){console.info(ex("info",`${this.prefix||""} ${e}`,...t))}debug(e,...t){console.log(ex("debug",`${this.prefix||""} ${e}`,...t))}trace(e,...t){console.trace(ex("trace",`${this.prefix||""} ${e}`,...t))}ci(e,...t){}};var zE="",fV=3,lp=[],cp=rr.LogLevel.Info,d={error:(r,...e)=>kne(r,...e),warn:(r,...e)=>yV(r,...e),info:(r,...e)=>Pne(r,...e),debug:(r,...e)=>Dne(r,...e),trace:(r,...e)=>_ne(r,...e),ci:(r,...e)=>{e&&Array.isArray(e)?mV(r,...e):mV(r)}};function hV(r){cp=dV(),ma(rr.workspace.onDidChangeConfiguration(t=>{t.affectsConfiguration("jupyter.logging")&&(cp=dV())}));let e=rr.window.createOutputChannel(cN.jupyter,"log");return pV(new $E(e,r?.userNameRegEx,r?.homePathRegEx)),pV(new HE(wi?void 0:"Jupyter Extension:")),e}function pV(r){return lp.push(r),{dispose:()=>{lp=lp.filter(e=>e!==r)}}}function dV(){try{let{level:r}=rr.workspace.getConfiguration("jupyter").get("logging",{level:"Info"});switch(r){case"debug":case"Debug":return rr.LogLevel.Debug;case"warn":case"Warn":case"warning":case"Warning":return rr.LogLevel.Warning;case"Off":case"off":return rr.LogLevel.Off;case"Error":case"error":return rr.LogLevel.Error;case"Trace":case"trace":return rr.LogLevel.Trace;default:return rr.LogLevel.Info}}catch(r){return console.error("Failed to get logging level from configuration",r),rr.LogLevel.Info}}function gV(r){zE=r.toLowerCase()}function vV(...r){return cp<=rr.LogLevel.Debug?r:r.map(t=>{if(!(t instanceof Error)||!("isJupyterError"in t))return t;let n=[`${t.name}: ${t.message}`.trim()];if("kernelConnectionMetadata"in t&&t.kernelConnectionMetadata&&typeof t.kernelConnectionMetadata=="object"&&"id"in t.kernelConnectionMetadata&&(n.push(`Kernel Id = ${t.kernelConnectionMetadata.id}`),"interpreter"in t.kernelConnectionMetadata&&t.kernelConnectionMetadata.interpreter&&typeof t.kernelConnectionMetadata.interpreter=="object"&&"id"in t.kernelConnectionMetadata.interpreter&&typeof t.kernelConnectionMetadata.interpreter.id=="string"&&n.push(`Interpreter Id = ${B(t.kernelConnectionMetadata.interpreter.id)}`)),t.stack){let o=Fe(t.stack),s=o.find(a=>a.indexOf("at ")===0);o.length===1||(o.length===1?n.push(o[0]):o.length>1&&s?.length?n.push(s):n.push(o[0]))}let i=["stack","message","name","kernelConnectionMetadata","category","exitCode","isJupyterError"];return Object.keys(t).filter(o=>i.indexOf(o)===-1).forEach(o=>n.push(`${o} = ${String(t[o]).trim()}`)),n.filter(o=>o.trim().length).map((o,s)=>s===0?o:` > ${o}`).join(`
|
||
`)})}function kne(r,...e){cp<=rr.LogLevel.Error&&(e=vV(...e),lp.forEach(t=>t.error(r,...e)))}function yV(r,...e){cp<=rr.LogLevel.Warning&&(e=vV(...e),lp.forEach(t=>t.warn(r,...e)))}function Pne(r,...e){cp<=rr.LogLevel.Info&&lp.forEach(t=>t.info(r,...e))}function Dne(r,...e){cp<=rr.LogLevel.Debug&&lp.forEach(t=>t.debug(r,...e))}function _ne(r,...e){cp<=rr.LogLevel.Trace&&lp.forEach(t=>t.trace(r,...e))}function mV(r,...e){if(wi)if(typeof r=="function"){let n=r(),i="",o=[];typeof n=="string"?i=n:(i=n.shift(),o=n),d.info(i,...o)}else d.info(r,...e)}function li(r,e=fV){return bV({message:r,opts:e,level:rr.LogLevel.Debug})}function Vh(r){return bV({message:r,opts:fV,level:rr.LogLevel.Error})}var Fc=new WeakMap;function Lc(r){return(e,t,n)=>{Fc.has(e)||Fc.set(e,new Map);let i=Fc.get(e);i||Fc.set(e,i=new Map),i.has(t)||i.set(t,[]),i.get(t).push({parameterIndex:n,propertyOfParameterToLog:r})}}function up(){return(r,e,t)=>{Fc.has(r)||Fc.set(r,new Map);let n=Fc.get(r);n||Fc.set(r,n=new Map),n.has(e)||n.set(e,[]),n.get(e).push({parameterIndex:t,ignore:!0})}}function bV(r){return i2((e,t)=>Mne(r,t,e),(r.opts&4)>0)}function Tne(r){let{kind:e,name:t,args:n}=r;return(!e||e==="")&&(e="Function"),(!t||t==="")&&(t="<anon>"),n||(n=[]),{kind:e,name:t,args:n,methodName:r.methodName||"",target:r.target||void 0}}function Rne(r){if(!r)return!1;let e=r;return typeof e.path=="string"&&typeof e.scheme=="string"}function hN(r){let e=zE?r.toLowerCase().indexOf(zE):-1;return e===-1?r:`~${r.substring(e+zE.length)}`}function Ane(r,e,t,n){if(Rne(t))return hN(t.path);if(!t)return t;let o=Fc.get(r)?.get(e)?.find(a=>a.parameterIndex===n);if(!o)return typeof t=="string"?hN(t):t;if("ignore"in o&&o.ignore)return"";let s=t;return"propertyOfParameterToLog"in o&&o.propertyOfParameterToLog&&(s=t[o.propertyOfParameterToLog]),typeof s=="string"?hN(s):s}function Nne(r,e,t){t=Tne(t);let n=[r.message];return n.push(`${t.kind} name = ${t.name}`.trim()),e?(n.push(`completed in ${e.elapsed}ms`),n.push(`has a ${e.returnValue?"truthy":"falsy"} return value`)):n[n.length-1]=`${n[n.length-1]} (started execution)`,(r.opts&1)===1&&(r.level===rr.LogLevel.Debug?n.push(gA(t.args.map((i,o)=>t?Ane(t.target,t.methodName,i,o):i))):n.push(gA(t.args))),e&&(r.opts&2)===2&&n.push(o2(e.returnValue)),n.join(", ")}function Mne(r,e,t){let n=Nne(r,e,t);e?e.err===void 0?r.level&&r.level===rr.LogLevel.Error||(r.level?GE(r.level,n):GE(rr.LogLevel.Info,n)):GE(rr.LogLevel.Error,n,e.err):r.level&&r.level!==rr.LogLevel.Error&&GE(r.level,n)}function GE(r,e,...t){switch(r){case rr.LogLevel.Error:d.error(e,...t);break;case rr.LogLevel.Warning:yV(e,...t);break;case rr.LogLevel.Info:d.info(e,...t);break;case rr.LogLevel.Debug:case rr.LogLevel.Trace:d.debug(e,...t);break;default:break}}var za=require("vscode");var sM=require("vscode");var IV=Symbol("IsDevMode"),Wo=Symbol("IOutputChannel"),SV=Symbol("IS_WINDOWS"),O=Symbol("IDisposableRegistry"),Ve=Symbol("IGlobalMemento"),ft=Symbol("IGlobalMemento"),ci=Symbol("IWorkspaceMemento");var yl=Symbol("IPersistentStateFactory"),Rwe=Symbol("IRandom"),le=Symbol("IConfigurationService"),ot=Symbol("ExtensionContext"),ba=Symbol("IExtensions"),xV=Symbol("IJupyterExtensionBanner"),QE=Symbol("IFeaturesManager"),Bh=Symbol("ICryptoUtils"),Vo=Symbol("IAsyncDisposableRegistry");var ks=Symbol("IExperimentService"),qh=Symbol("IDataScienceCommandListener"),Jh=Symbol("IVariableScriptGenerator"),$h=Symbol("IDataFrameScriptGenerator");var a3=require("vscode");var CV=require("events"),tx=P(M());try{(0,tx.decorate)((0,tx.injectable)(),CV.EventEmitter)}catch(r){d.warn("Failed to decorate EventEmitter for DI (possibly already decorated by another Extension)",r)}var xe=class{constructor(e){this.container=e;xe._instance=this}static get instance(){return xe._instance}get(e,t){return t?this.container.getNamed(e,t):this.container.get(e)}getAll(e,t){return t?this.container.getAllNamed(e,t):this.container.getAll(e)}tryGet(e,t){try{return t?this.container.getNamed(e,t):this.container.get(e)}catch{}}};xe=y([(0,tx.injectable)()],xe);var wt=require("vscode");var Yt=Symbol("IPythonApi"),$e=Symbol("IPythonExtensionChecker");var As=P(M());var rx="Python Kernel Debug Adapter",nx="Python Interactive Window Debug Adapter";var ZE=require("node-fetch"),sx=P(wV());var Hh=require("vscode");var ze=class extends Error{constructor(t,n){super(n);this.category=t;this.isJupyterError=!0}},cn=class r extends ze{constructor(t,n,i){super(i||gN(n),t);this.originalException=n;n&&(this.stack=`${new Error("").stack}
|
||
|
||
${n.stack}`)}static from(t,n){return n instanceof ze?n:new r(t,n)}static unwrap(t){return t&&(t instanceof r&&t.originalException&&t.originalException instanceof ze&&(t=t.originalException),t)}};function gN(r){return r&&r instanceof ze?r.category:"unknown"}var Ps=class extends ze{constructor(t,n,i){super("jupyterconnection",t+(n?`
|
||
${n}`:""));this.interpreter=i}};var yn=class extends ze{constructor(){super("sessionDisposed",I.sessionDisposed)}};var YE=class{static outputHasModuleNotInstalledError(e,t){return!!(t&&(t.indexOf(`No module named ${e}`)>0||t.indexOf(`No module named '${e}'`)>0))}};function Gh(r=""){if(!r)return;let e=/\S+Error: /g,t=`${r.trim()}: `.split(`
|
||
`).filter(s=>s.trim().length).reverse();if(t.length===0)return;let n=t[0],o=((n.match(e)?n:void 0)||"").split(":");return o.length&&o[0].endsWith("Error")?o[0]:void 0}function XE(r=""){let e=kV(r);return e?e[1]:void 0}function kV(r=""){if(!r)return;let e=r.trim().split(`
|
||
`).map(t=>t.trim()).filter(t=>t.trim().length).reverse();if(e.length!==0&&e[0].includes("Error"))return[e.length>1?e[1]:"",e[0]]}function PV(r){if(!r)return;let t=(Array.isArray(r)?r[0]:r).split(`
|
||
`).map(l=>l.trim().toLowerCase()).filter(l=>l.length).reverse().find(l=>l.startsWith("file ")&&l.includes(", line ")&&l.includes(".py")&&l.includes(".py"));if(!t)return;let i=(t.substring(0,t.lastIndexOf(".py"))+".py").replace(/\\/g,"/").split("/"),o=i.indexOf("site-packages"),s=o>=0&&i.length>o+1?i[o+1]:"",a=i.reverse();if(!(a.length<2))return{fileName:a[0],folderName:a[1],packageName:s}}function hm(r,e,t,n="",i=[]){let o=e instanceof ze?e.stdErr||e.stack||"":e.toString(),s=kV(o),a=o.toLowerCase();if(e instanceof yn)return{reason:"sessionDisposed",message:I.sessionDisposed,moreInfoLink:"https://aka.ms/kernelDisposedCannotRunCell",telemetrySafeTags:["deadSession"]};if(a.includes("ImportError: No module named 'win32api'".toLowerCase()))return{reason:"importWin32apiFailure",message:I.failedToStartKernelDueToWin32APIFailure,moreInfoLink:"https://aka.ms/kernelFailuresWin32Api",telemetrySafeTags:["win32api"]};if(a.includes("ImportError: DLL load failed".toLowerCase())&&a.includes("win32api"))return{reason:"importWin32apiFailure",message:I.failedToStartKernelDueToWin32APIFailure,moreInfoLink:"https://aka.ms/kernelFailuresWin32Api",telemetrySafeTags:["dll.load.failed","win32api"]};if(a.includes("ImportError: DLL load failed".toLowerCase())){let u=s&&s[0].toLowerCase().startsWith("import")?s[0].substring(6).trim():void 0;return{reason:"dllLoadFailure",moduleName:u,message:u?I.failedToStartKernelDueToDllLoadFailure(u):I.failedToStartKernelDueToUnknownDllLoadFailure,moreInfoLink:"https://aka.ms/kernelFailuresDllLoad",telemetrySafeTags:["dll.load.failed"]}}if(a.includes("AssertionError: Couldn't find Class NSProcessInfo".toLowerCase()))return{reason:"oldIPythonFailure",message:I.failedToStartKernelDueToOldIPython,moreInfoLink:"https://aka.ms/kernelFailuresOldIPython",telemetrySafeTags:["oldipython"]};if(a.includes("NotImplementedError".toLowerCase())&&a.includes("asyncio".toLowerCase())&&a.includes("events.py".toLowerCase()))return{reason:"oldIPyKernelFailure",message:I.failedToStartKernelDueToOldIPyKernel,moreInfoLink:"https://aka.ms/kernelFailuresOldIPyKernel",telemetrySafeTags:["oldipykernel"]};{let u=[];if(a.includes("ImportError: cannot import name".toLowerCase())&&a.includes("from partially initialized module".toLowerCase())&&a.includes("zmq.backend.cython".toLowerCase())&&u.push("zmq.backend.cython"),a.includes("zmq".toLowerCase())&&a.includes("cython".toLowerCase())&&a.includes("__init__.py".toLowerCase())&&u.push("zmq.cython"),a.includes("zmq.error.ZMQError")&&u.push("zmq.error"),u.length)return{reason:"zmqModuleFailure",message:I.failedToStartKernelDueToPyZmqFailure,moreInfoLink:"https://aka.ms/kernelFailuresPyzmq",telemetrySafeTags:u}}if(s&&s[1].toLowerCase().startsWith("importerror")){let u=EV(s[1]);if(u&&n){let p=Fne(u.moduleName,u.fileName,r,n);return p||{reason:"importFailure",moduleName:u.moduleName,fileName:u.fileName,message:u.fileName?I.failedToStartKernelDueToImportFailureFromFile(u.moduleName,u.fileName):I.failedToStartKernelDueToImportFailure(u.moduleName),moreInfoLink:u.fileName?"https://aka.ms/kernelFailuresModuleImportErrFromFile":"https://aka.ms/kernelFailuresModuleImportErr",telemetrySafeTags:["import.error"]}}}let l="No module named".toLowerCase(),c="is not a package".toLowerCase();if(a.includes(l)&&!c){let u=Fe(o).map(f=>f.trim()).filter(f=>f.length).find(f=>f.toLowerCase().includes(l)),p=u?u.substring(u.toLowerCase().indexOf(l)+l.length).trim():"";if(u)return{reason:"moduleNotFound",moduleName:p,message:I.failedToStartKernelDueToMissingModule(p),moreInfoLink:"https://aka.ms/kernelFailuresMissingModule",telemetrySafeTags:["module.notfound.error"]}}else if(a.includes(l)&&c){let u=Fe(o).map(b=>b.trim()).filter(b=>b.length).find(b=>b.toLowerCase().includes(l)),p=u?u.substring(u.toLowerCase().indexOf(l)+l.length).trim():"",f="",g="";p.split("'").length>2&&(f=p.split("'").slice(-2)[0]||"",f=f?`${f}.py`:"",g=f||"",p=p.split("'")[1]||p);let v=i.filter(b=>vn(b).toLowerCase()==="__init__.py").map(b=>vn(Pi(b)));return p&&f&&p!==f&&i.some(b=>vn(b).toLowerCase()===f.toLowerCase())?{reason:"overridingBuiltinModules",fileName:f,moduleName:p,message:I.fileSeemsToBeInterferingWithKernelStartup(f),moreInfoLink:"https://aka.ms/kernelFailuresOverridingBuiltInModules",telemetrySafeTags:["import.error","override.modules"]}:p&&v&&p!==g&&v.some(b=>b.toLowerCase()===g.toLowerCase())?{reason:"overridingBuiltinModules",folderName:g,moduleName:p,message:I.moduleSeemsToBeInterferingWithKernelStartup(g),moreInfoLink:"https://aka.ms/kernelFailuresOverridingBuiltInModules",telemetrySafeTags:["import.error","override.modules"]}:{reason:"moduleNotFound",moduleName:p,message:I.failedToStartKernelDueToMissingModule(p),moreInfoLink:"https://aka.ms/kernelFailuresMissingModule",telemetrySafeTags:["module.notfound.error"]}}else if(e instanceof ze&&e.category==="invalidkernel"&&i.length){let u=vn(i[0]);return{reason:"overridingBuiltinModules",fileName:u,moduleName:vn(i[0],".py"),message:I.fileSeemsToBeInterferingWithKernelStartup(u),moreInfoLink:"https://aka.ms/kernelFailuresOverridingBuiltInModules",telemetrySafeTags:["import.error","override.modules"]}}else if(s&&s[1].toLowerCase().startsWith("ModuleNotFoundError".toLowerCase())){let u=EV(s[1]);if(u)return{reason:"moduleNotFound",moduleName:u.moduleName,message:I.failedToStartKernelDueToMissingModule(u.moduleName),moreInfoLink:"https://aka.ms/kernelFailuresMissingModule",telemetrySafeTags:["module.notfound.error"]}}if(e instanceof Ps){let u=Fe(o).map(C=>C.trim()).reverse().find(C=>C.toLowerCase().includes("error: ")),p="AttributeError: 'Namespace' object has no attribute '_flags'",f=["jupyter.startup.failure"],g,v="jupyterStartFailure",b=Fe(e.message,{removeEmptyEntries:!0,trim:!0}).reverse().find(C=>C.toLowerCase().includes("error: "));if(b=b||Fe(e.stdErr||"",{removeEmptyEntries:!0,trim:!0}).reverse().find(C=>C.toLowerCase().includes("error: ")),a.includes(p.toLowerCase())?(v="jupyterStartFailureOutdatedTraitlets",u=I.failedToStartJupyterDueToOutdatedTraitlets(t||"",b||""),f.push("outdated.traitlets"),g="https://aka.ms/kernelFailuresJupyterTrailtletsOutdated"):(u=b?I.failedToStartJupyterWithErrorInfo(t||"",b):I.failedToStartJupyter(t||""),g=void 0),u)return{reason:v,message:u,pythonError:b,moreInfoLink:g,telemetrySafeTags:f}}}function EV(r){r=r.replace(/"/g,"'");let e=r.match(/'[^\\']*(\\'[^\\']*)*'/g),t=r.match(/\((.*?)\)/g),n,i;return e&&e[0].length>2&&(n=e[0],n=n.substring(1,n.length-1)),t&&t[0].length>2&&(i=t[0],i=i.substring(1,i.length-1)),n?{moduleName:n,fileName:i}:void 0}function Fne(r,e,t,n){if(n&&t.length!==0&&e&&!e.toLowerCase().startsWith(n)&&t.some(i=>e.toLowerCase().startsWith(i.uri.fsPath.toLowerCase())))return{reason:"overridingBuiltinModules",fileName:e,moduleName:r,message:I.fileSeemsToBeInterferingWithKernelStartup(B(Hh.Uri.file(e),t||[])),moreInfoLink:"https://aka.ms/kernelFailuresOverridingBuiltInModules",telemetrySafeTags:["import.error","override.modules"]}}function zh(r){if(!r)return;let e=/\[([^\[\]]*)\]\((.*?)\)/gm,t;for(;(t=e.exec(r))!==null;)t.length===3&&(r=r.replace(t[0],`<a href='${t[2]}'>${t[1]}</a>`));let n=Fe(r,{removeEmptyEntries:!1,trim:!1}).map(i=>`\x1B[1;31m${i}`).join(`
|
||
`);return new Hh.NotebookCellOutput([Hh.NotebookCellOutputItem.error({message:"",name:"",stack:n})])}var Lne=[Une,jne];function DV(r){let e=[],t=Array.isArray(r)?r[0].toLowerCase():r.toLowerCase();Lne.forEach(i=>i(t,e));let n=hm([],t,void 0);return n?.telemetrySafeTags.length&&e.push(...n.telemetrySafeTags),Array.from(new Set(e)).join(",")}function Une(r,e=[]){r.includes("ChildProcess.exithandler".toLowerCase())&&e.push("childproc.exit")}function jne(r,e=[]){r.includes("KernelRestarter: restart failed".toLowerCase())&&e.push("KernelRestarter.failed")}function _V(){return(new Error().stack||"").split(`
|
||
`).filter(r=>r.includes(Ue))}async function TV(r,e){r.failed=!0,r.failureCategory=r.failureCategory||gN(e);let t=!ZE.FetchError&&e?.name==="TypeError"&&e?.message==="Failed to fetch",i=(t||ZE.FetchError!==void 0)&&Bne(e,t?TypeError:ZE.FetchError);r.failureCategory==="unknown"&&i&&(r.failureCategory="fetcherror"),r.stackTrace=Wne(e),typeof e=="string"&&(r.failureSubCategory="errorisstring");let o=e.stdErr?e.stdErr:e.stack||"";if(!o)return;r.failureSubCategory=r.failureSubCategory||DV(o);let s=PV(o);s&&([r.pythonErrorFile,r.pythonErrorFolder,r.pythonErrorPackage]=await Promise.all([Promise.resolve(r.pythonErrorFile||mt(s.fileName)),Promise.resolve(r.pythonErrorFolder||mt(s.folderName)),Promise.resolve(r.pythonErrorPackage||mt(s.packageName))]))}function vN(r){if(r.stack&&Array.isArray(r.stack)){let e={...r,stack:r.stack.join(`
|
||
`)};return sx.parse.call(sx,e)}return sx.parse.call(sx,r)}function Wne(r){let e="";for(let t of vN(r)){let n=t.getFileName();if(n){let i=t.getLineNumber(),o=t.getColumnNumber();e+=`
|
||
at ${Vne(t)} ${n}:${i}:${o}`}else e+=`
|
||
at <anonymous>`}return e.trim().replace(/\\/g,"/")}function Vne(r){let e=[];return typeof r.getTypeName()=="string"&&r.getTypeName().length>0&&e.push(r.getTypeName()),typeof r.getMethodName()=="string"&&r.getMethodName().length>0&&e.push(r.getMethodName()),typeof r.getFunctionName()=="string"&&r.getFunctionName().length>0&&(e.length!==2||e.join(".")!==r.getFunctionName())&&e.push(r.getFunctionName()),e.join(".")}function Bne(r,e){return e?r instanceof e||r instanceof cn&&r.originalException instanceof e:(console.error("Error type is not defined",r),!1)}var ek=require("vscode");function qne(){try{return require("vscode")===void 0?!1:NV()!==void 0}catch{return!1}}function rk(){return ek.workspace.getConfiguration("telemetry").inspect("enableTelemetry").globalValue===!1}function nk(r){return ek.workspace.onDidChangeConfiguration(e=>{if(!e.affectsConfiguration("telemetry"))return;let n=ek.workspace.getConfiguration("telemetry").inspect("enableTelemetry").globalValue===!1;r(n)})}var tk={};function Qh(r,e){let t=r;NS()&&t.startsWith("ds_")||(e===void 0?delete tk[t]:tk[t]=e)}var yN;function NV(){if(yN)return yN;let r=require("@vscode/extension-telemetry").default;return yN=new r(Gj)}function RV(r,e){let t={};return Object.getOwnPropertyNames(e).forEach(n=>{if(!(e[n]===void 0||e[n]===null))try{t[n]=typeof e[n]=="string"?e[n]:typeof e[n]=="object"?"object":e[n].toString()}catch(i){d.error(`Failed to serialize ${n} for ${r}`,i)}}),t}function A(r,e,t,n){!MV(r.toString())&&(_r()||!qne())||Jne(r,e,t,n)}function MV(r){return r==="DATASCIENCE.JUPYTER_NOTEBOOK_EDIT_PERFORMANCE"||r==="DATASCIENCE.JUPYTER_JUPYTER_NOTEBOOK_EXEC_PERFORMANCE"||r==="DATASCIENCE.JUPYTER_NOTEBOOK_EXEC_PERFORMANCE"}function Jne(r,e,t,n){let i=NV(),o={},s=r;n?(o={},Object.assign(o,tk),Object.assign(o,t||{}),TV(o,n).then(()=>{o=RV(s,o),i.sendTelemetryEvent(s,o,e)}).catch(h)):(t&&(o=RV(s,t)),Object.assign(o,tk),MV(s)?i.sendDangerousTelemetryEvent(s,o,e):i.sendTelemetryEvent(s,o,e))}var AV=new Set;function ur(r,e){return function(t,n,i){let o=i.value;return i.value=function(...s){let a=e||{},l=new We,c=`${r.toString()}${JSON.stringify(a)}`,u=!AV.has(c);AV.add(c);let p=o.apply(this,s);return p&&typeof p.then=="function"&&typeof p.catch=="function"?p.then(f=>{let g={...a};return u&&(g.firstTime=u),A(r,l?{duration:l?.elapsedTime}:void 0,g),f}).catch(f=>{let g={...a};g.failed=!0,A(r,l?{duration:l?.elapsedTime}:{},g,f)}):A(r,l?{duration:l?.elapsedTime}:void 0,a),p},i}}function Xr(r,e){return function(t,n,i){let o=i.value;return i.value=function(...s){return A(r,void 0,e),o.apply(this,s)},i}}function $ne(){return{isInsiderExtension:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Whether this is the Insider version of the Jupyter extension or not. Common to all events."},isPythonExtensionInstalled:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Whether Python extension is installed or not. Common to all events."},rawKernelSupported:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Whether the raw kernel is supported or not. Common to all events."}}}function It(){return{duration:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth",isMeasurement:!0}}}function go(){return{resourceType:{classification:"PublicNonPersonalData",comment:"",purpose:"FeatureInsight"}}}function Uc(){return{failed:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},failureCategory:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},failureSubCategory:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonErrorFile:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonErrorFolder:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonErrorPackage:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},stackTrace:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"}}}function Ni(){return{properties:{actionSource:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},disableUI:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},userExecutedCell:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},resourceHash:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"},pythonEnvironmentVersion:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonEnvironmentType:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonEnvironmentPath:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},pythonEnvironmentPackages:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},kernelSessionId:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},kernelLanguage:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},kernelSpecHash:{classification:"EndUserPseudonymizedInformation",purpose:"FeatureInsight"},kernelId:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},kernelConnectionType:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},isUsingActiveInterpreter:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},capturedEnvVars:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},newKernelPicker:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"},...go()}}}var PEe={...It(),...Uc(),...$ne()};var Hne,Gne,zne,Qne,Yne,Xne,Zne,eie,tie,rie,nie,iie,oie,sie,aie,lie,cie,uie,pie,die,mie,fie,hie,gie,vie,yie,bie,Iie,Sie,xie,Cie,wie,Eie,kie,Pie,Die,_ie,Tie,Rie,Aie,Nie,Mie,Oie,Kie,Fie,Lie,Uie,jie,Wie,Vie,Bie,qie,Jie,$ie,Hie,Gie,zie,Qie,Yie,Xie,Zie,eoe,toe,roe,noe,ioe,ooe,soe,aoe,loe,coe,uoe,poe,doe,moe,foe,hoe,goe,voe,yoe,boe,Ioe,Soe,xoe,Coe,woe,Eoe,koe,Poe,Doe,_oe,Toe,Roe,Aoe,Noe,Moe,Ooe,Koe,Foe,Loe,Uoe,joe,Woe,Voe,Boe,qoe,Joe,$oe,Hoe,Goe,zoe,Qoe,Yoe,Xoe,Zoe,ese,tse,rse,nse,ise,ose,sse,ase,lse,cse,use,pse,dse,mse,fse,hse,gse,vse,yse,bse,Ise,Sse,xse,Cse,wse,Ese,kse,Pse,Dse,_se,Tse,Rse,Ase,Nse,Mse,Ose,Kse,Fse,Lse,Use,jse,Wse,Vse,Bse,qse,Jse,$se,OV=class{constructor(){this[Hne]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:{totalActivateTime:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},codeLoadingTime:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},workspaceFolderCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0}}};this[Gne]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:It()};this[zne]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[Qne]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[Yne]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{hashedNamev2:{classification:"SystemMetaData",purpose:"FeatureInsight"},when:{classification:"SystemMetaData",purpose:"FeatureInsight"},...go()}};this[Xne]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{firstTime:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}},measures:It()};this[Zne]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{mimeType:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},when:{classification:"SystemMetaData",purpose:"FeatureInsight"},...go()}};this[eie]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{envType:{classification:"SystemMetaData",purpose:"FeatureInsight"},failed:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},reason:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},source:{classification:"SystemMetaData",purpose:"FeatureInsight"}},measures:It()};this[tie]={owner:"IanMatthewHuff",source:"User Action",feature:["DataFrameViewer","VariableViewer"]};this[rie]={owner:"IanMatthewHuff",source:"N/A",feature:["DataFrameViewer","VariableViewer"]};this[nie]={owner:"IanMatthewHuff",source:"User Action",feature:["DataFrameViewer","VariableViewer"]};this[iie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action",measures:It()};this[oie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action",measures:It()};this[sie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:{codeLensUpdateTime:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},maxCellCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0}}};this[aie]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[lie]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[cie]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[uie]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[pie]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[die]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"],properties:{...Uc(),failed:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},reason:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Reason for failure to fetch kernel specs"},sessionManagerReady:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},specsManagerReady:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},wasSessionManagerReady:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},wasSpecsManagerReady:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}},measures:It()};this[mie]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{kernelSpecHash:{classification:"EndUserPseudonymizedInformation",purpose:"FeatureInsight"},serverIdHash:{classification:"SystemMetaData",purpose:"FeatureInsight"},providerExtensionId:{classification:"SystemMetaData",purpose:"FeatureInsight"},baseUrlHash:{classification:"SystemMetaData",purpose:"FeatureInsight"},kernelId:{classification:"SystemMetaData",purpose:"FeatureInsight"},kernelConnectionType:{classification:"SystemMetaData",purpose:"FeatureInsight"},kernelLanguage:{classification:"SystemMetaData",purpose:"FeatureInsight"},envType:{classification:"SystemMetaData",purpose:"FeatureInsight"},isArgv0SameAsInterpreter:{classification:"SystemMetaData",purpose:"FeatureInsight"},argv0:{classification:"SystemMetaData",purpose:"FeatureInsight"},argv:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[fie]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"],properties:{serverIdHash:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},baseUrlHash:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},failed:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"},isLocalHost:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"},isJupyterHub:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"},reason:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"}}};this[hie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[gie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[vie]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"],properties:Ni().properties,measures:{...It()}};this[yie]={owner:"IanMatthewHuff",feature:["Import-Export","InteractiveWindow"],source:"User Action"};this[bie]={owner:"IanMatthewHuff",feature:["Import-Export","InteractiveWindow"],source:"User Action"};this[Iie]={owner:"IanMatthewHuff",feature:["Import-Export","InteractiveWindow"],source:"User Action",properties:{format:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Sie]={owner:"IanMatthewHuff",feature:["Import-Export"],source:"N/A",properties:{format:{classification:"SystemMetaData",purpose:"FeatureInsight"},cancelled:{classification:"SystemMetaData",purpose:"FeatureInsight"},successful:{classification:"SystemMetaData",purpose:"FeatureInsight"},opened:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[xie]={owner:"IanMatthewHuff",feature:["Import-Export"],source:"User Action",properties:{scope:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Cie]={owner:"IanMatthewHuff",feature:["Import-Export"],source:"User Action",properties:{format:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[wie]={owner:"IanMatthewHuff",feature:["Import-Export"],source:"N/A",properties:{format:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Eie]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[kie]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[Pie]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{failed:{classification:"SystemMetaData",purpose:"FeatureInsight"},info:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Die]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[_ie]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[Tie]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[Rie]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[Aie]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:{nbformat:{classification:"PublicNonPersonalData",isMeasurement:!0,purpose:"FeatureInsight"},nbformat_minor:{classification:"PublicNonPersonalData",isMeasurement:!0,purpose:"FeatureInsight"}}};this[Nie]={owner:"IanMatthewHuff",feature:["PlotViewer"],source:"User Action"};this[Mie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Oie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Kie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Fie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Lie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Uie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[jie]={owner:"amunger",feature:["InteractiveWindow"],source:"User Action"};this[Wie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A"};this[Vie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A"};this[Bie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[qie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Jie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[$ie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Hie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Gie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[zie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Qie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Yie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Xie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[Zie]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[eoe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[toe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[roe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[noe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",measures:It()};this[ioe]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[ooe]={owner:"donjayamanne",feature:"N/A",source:"N/A"};this[soe]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"]};this[aoe]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[loe]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"]};this[coe]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[uoe]={owner:"IanMatthewHuff",feature:["KernelPicker"],source:"User Action",properties:{action:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[poe]={owner:"donjayamanne",feature:["KernelPicker"],source:"User Action",properties:{action:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[doe]={owner:"donjayamanne",feature:["KernelPicker"],source:"User Action",properties:{action:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[moe]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{action:{classification:"SystemMetaData",purpose:"FeatureInsight"},isModulePresent:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},moduleName:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},pythonEnvType:{classification:"SystemMetaData",purpose:"FeatureInsight"},resourceHash:{classification:"SystemMetaData",purpose:"FeatureInsight"},...go()},measures:It()};this[foe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A"};this[hoe]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"User Action",measures:It()};this[goe]={owner:"IanMatthewHuff",source:"N/A",feature:["DataFrameViewer"],measures:{rows:{classification:"PublicNonPersonalData",purpose:"FeatureInsight",isMeasurement:!0},columns:{classification:"PublicNonPersonalData",purpose:"FeatureInsight",isMeasurement:!0}}};this[voe]={owner:"IanMatthewHuff",source:"N/A",feature:["DataFrameViewer"],measures:{rowsTimer:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}}};this[yoe]={owner:"IanMatthewHuff",feature:["DataFrameViewer","VariableViewer"],source:"N/A"};this[boe]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"User Action"};this[Ioe]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{failed:{classification:"SystemMetaData",purpose:"FeatureInsight"},fallbackTried:{classification:"SystemMetaData",purpose:"FeatureInsight"},alpine:{classification:"SystemMetaData",purpose:"FeatureInsight"},zmqarch:{classification:"SystemMetaData",purpose:"FeatureInsight"},libc:{classification:"SystemMetaData",purpose:"FeatureInsight"},armv:{classification:"SystemMetaData",purpose:"FeatureInsight"},distro_id:{classification:"SystemMetaData",purpose:"FeatureInsight"},distro_version_id:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Soe]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{failed:{classification:"SystemMetaData",purpose:"FeatureInsight"},fallbackTried:{classification:"SystemMetaData",purpose:"FeatureInsight"},alpine:{classification:"SystemMetaData",purpose:"FeatureInsight"},zmqarch:{classification:"SystemMetaData",purpose:"FeatureInsight"},libc:{classification:"SystemMetaData",purpose:"FeatureInsight"},armv:{classification:"SystemMetaData",purpose:"FeatureInsight"},distro_id:{classification:"SystemMetaData",purpose:"FeatureInsight"},distro_version_id:{classification:"SystemMetaData",purpose:"FeatureInsight"},errorMessage:{classification:"CallstackOrException",purpose:"FeatureInsight"},fallbackErrorMessage:{classification:"CallstackOrException",purpose:"FeatureInsight"},zmqBinaries:{classification:"CallstackOrException",purpose:"FeatureInsight"}}};this[xoe]={owner:"IanMatthewHuff",feature:["VariableViewer"],source:"N/A",measures:It()};this[Coe]={owner:"IanMatthewHuff",feature:["VariableViewer"],source:"N/A",measures:{variableCount:{classification:"PublicNonPersonalData",purpose:"FeatureInsight",isMeasurement:!0}}};this[woe]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"],properties:{kind:{classification:"SystemMetaData",purpose:"FeatureInsight"},language:{classification:"SystemMetaData",purpose:"FeatureInsight"},usesShell:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Eoe]={owner:"donjayamanne",feature:"N/A",source:"N/A",tags:["KernelStartup"],properties:{...Uc(),...go()},measures:{...It()}};this[koe]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{kernelConnectionType:{classification:"SystemMetaData",purpose:"FeatureInsight"},pythonPathDefined:{classification:"SystemMetaData",purpose:"FeatureInsight"},pythonEnvFound:{classification:"SystemMetaData",purpose:"FeatureInsight"},language:{classification:"SystemMetaData",purpose:"FeatureInsight"},kernelSpecHash:{classification:"EndUserPseudonymizedInformation",purpose:"FeatureInsight"},argv0:{classification:"SystemMetaData",purpose:"FeatureInsight"},isCreatedByUs:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Poe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A"};this[Doe]={owner:"amunger",feature:["InteractiveWindow"],source:"N/A",properties:{hasKernel:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"If the kernel was known at the time of creation"},hasOwner:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"If the window was created for a text file"},mode:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Creation mode: multiple, perfile or single"},restored:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Was the window restored from a previous session"}},measures:{windowCount:{classification:"SystemMetaData",purpose:"FeatureInsight",comment:"Number of active interactive windows the user has open",isMeasurement:!0}}};this[_oe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{cdnSearched:{classification:"SystemMetaData",purpose:"FeatureInsight"},hashedName:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},source:{classification:"SystemMetaData",purpose:"FeatureInsight"},moduleName:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},modelName:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},moduleVersion:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Toe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{type:{classification:"SystemMetaData",purpose:"FeatureInsight"}},measures:It()};this[Roe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A"};this[Aoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{moduleHash:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},moduleVersion:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Noe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{timedout:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},isOnline:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},moduleHash:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},moduleVersion:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Moe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{moduleHash:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},moduleVersion:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Ooe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A"};this[Koe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{selection:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Foe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A"};this[Loe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],tags:["Widgets"],source:"N/A",properties:{msg_type:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"}}};this[Uoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",tags:["KernelStartup"],measures:{...It(),attempts:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0}},properties:{...Ni().properties,timedout:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}}};this[joe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",tags:["KernelStartup"],measures:It()};this[Woe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"User Action",tags:["Cell Execution"],measures:{...It()},properties:{...Ni().properties,...Uc()}};this[Voe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"User Action",tags:["Code Execution"],measures:It(),properties:{...Ni().properties,...Uc(),extensionId:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Boe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"User Action",tags:["Cell Execution"],properties:{...Ni().properties,...Uc()}};this[qoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",tags:["KernelStartup"],properties:{...Ni().properties,...Uc()}};this[Joe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:Ni().properties};this[$oe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"User Action",properties:{result:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},...go(),...Uc(),...Ni().properties},measures:{...It()}};this[Hoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"User Action",properties:{...go(),...Uc(),...Ni().properties},measures:It()};this[Goe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{...go(),...Ni().properties},measures:{reason:{classification:"SystemMetaData",isMeasurement:!0,purpose:"PerformanceAndHealth"}}};this[zoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{exitReason:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},...go(),...Ni().properties},measures:{exitCode:{classification:"CallstackOrException",purpose:"PerformanceAndHealth",isMeasurement:!0}}};this[Qoe]={owner:"donjayamanne",feature:["Notebook"],source:"N/A",properties:{...go(),...Ni().properties,manuallySelectedKernel:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},wasAlreadyOpen:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}},measures:{...It(),computeCwd:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},duration:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},envVars:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},executeCell:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},getConnection:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},interruptHandle:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},kernelIdle:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},kernelInfo:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},kernelReady:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},portUsage:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},postKernelStart:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},preExecuteCellTelemetry:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},pythonEnvVars:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},sessionTelemetry:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},spawn:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},startKernel:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},startupCode:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},updateConnection:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},codeCellCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},mdCellCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},codeCellCharLength:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},mdCellCharLength:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},outputCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},outputsByteSize:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},attachmentCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},attachmentCharLength:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0}}};this[Yoe]={owner:"donjayamanne",feature:["Notebook"],source:"N/A",properties:{...go(),...Ni().properties,wasAlreadyOpen:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}},measures:{...It(),callPythonApi:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},activatePython:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},discoverEnv:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},createController:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},selectController:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0}}};this[Xoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{isRequestToShutdownRestartSession:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},stacktrace:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},...go(),...Ni().properties}};this[Zoe]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{stacktrace:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},...go(),...Ni().properties}};this[ese]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[tse]={owner:"donjayamanne",feature:["KernelPicker"],source:"N/A",measures:{kernelSpecCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},kernelInterpreterCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},kernelLiveCount:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0},localKernelSpecCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},remoteKernelSpecCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0}}};this[rse]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{outputType:{classification:"PublicNonPersonalData",purpose:"PerformanceAndHealth"}}};this[nse]={owner:"IanMatthewHuff",feature:["InteractiveWindow"],tags:["IntelliSense"],source:"N/A",measures:It(),properties:{isResultNull:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[ise]={owner:"IanMatthewHuff",feature:["VariableViewer"],source:"N/A",measures:It()};this[ose]={owner:"IanMatthewHuff",feature:["VariableViewer"],source:"N/A"};this[sse]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A",measures:It()};this[ase]={owner:"IanMatthewHuff",feature:["PlotViewer"],source:"N/A",measures:It()};this[lse]={owner:"amunger",feature:"N/A",source:"N/A",properties:{command:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[cse]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"User Action",properties:{newState:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[use]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A",measures:{numberOfDimensions:{classification:"SystemMetaData",purpose:"FeatureInsight",isMeasurement:!0}}};this[pse]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"User Action",properties:{source:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[dse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{failed:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},reason:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},dependenciesInstalled:{classification:"SystemMetaData",purpose:"FeatureInsight"},envType:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[mse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{extensionId:{classification:"SystemMetaData",purpose:"FeatureInsight"},action:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[fse]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[hse]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[gse]={owner:"roblourens",feature:["Debugger"],properties:{status:{classification:"SystemMetaData",purpose:"FeatureInsight"}},source:"N/A"};this[vse]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[yse]={owner:"roblourens",feature:["Debugger"],source:"N/A"};this[bse]={owner:"roblourens",feature:["Debugger"],source:"N/A"};this[Ise]={owner:"roblourens",feature:["Debugger"],source:"User Action"};this[Sse]={owner:"roblourens",feature:["Debugger"],source:"N/A"};this[xse]={owner:"roblourens",feature:["Debugger"],source:"N/A",properties:{reason:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Cse]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:{...It(),requestDuration:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},timesExceededTimeout:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0},completionItems:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",isMeasurement:!0}},properties:{kernelConnectionType:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelLanguage:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},monacoLanguage:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},cancelled:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},completed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelStatusAfterRequest:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelStatusBeforeRequest:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},requestSent:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[wse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{kernelConnectionType:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelLanguage:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Ese]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},pemUsed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[kse]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:{executionCount:{classification:"SystemMetaData",isMeasurement:!0,purpose:"FeatureInsight"}},properties:{extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},pemUsed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Pse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{accessAllowed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},pemUsed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Dse]={owner:"donjayamanne",feature:"N/A",source:"N/A",measures:{executionCount:{classification:"SystemMetaData",isMeasurement:!0,purpose:"FeatureInsight"},cancelledAfter:{classification:"SystemMetaData",isMeasurement:!0,purpose:"FeatureInsight"},requestAcknowledgedAfter:{classification:"SystemMetaData",isMeasurement:!0,purpose:"FeatureInsight"},requestSentAfter:{classification:"SystemMetaData",isMeasurement:!0,purpose:"FeatureInsight"},...It()},properties:{extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},kernelId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},cancelled:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},requestAcknowledged:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},requestSent:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},cancelledBeforeRequestAcknowledged:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},cancelledBeforeRequestSent:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},mimeTypes:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},failed:{classification:"PublicNonPersonalData",comment:"",purpose:"PerformanceAndHealth"}}};this[_se]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{clientExtId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},pemUsed:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}}};this[Tse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},allowed:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Rse]={owner:"donjayamanne",feature:"N/A",source:"N/A",properties:{extensionId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"},providerId:{classification:"PublicNonPersonalData",purpose:"FeatureInsight"}},measures:It()};this[Ase]={owner:"IanMatthewHuff",feature:["VariableViewer"],source:"N/A"};this[Nse]={owner:"roblourens",feature:["InteractiveWindow","Debugger"],source:"N/A"};this[Mse]={owner:"donjayamanne",feature:["Notebook","InteractiveWindow"],source:"N/A",properties:{...Ni().properties,...go()}};this[Ose]={owner:"donjayamanne",source:"N/A",feature:["KernelPicker"]};this[Kse]={owner:"donjayamanne",source:"User Action",feature:["KernelPicker"]};this[Fse]={owner:"amunger",feature:"N/A",source:"N/A",properties:{testName:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},testResult:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},perfWarmup:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},commitHash:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},timedCheckpoints:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"}}};this[Lse]={owner:"donjayamanne",feature:["KernelPicker"],source:"N/A",measures:{matchedReason:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[Use]={owner:"donjayamanne",feature:["Notebook","Notebook"],tags:["Widgets"],source:"N/A",measures:{requireEntryPointCount:{classification:"SystemMetaData",isMeasurement:!0,purpose:"PerformanceAndHealth"}},properties:{failed:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},failure:{classification:"CallstackOrException",purpose:"PerformanceAndHealth"},patternUsedToRegisterRequireConfig:{classification:"SystemMetaData",purpose:"PerformanceAndHealth"},widgetFolderNameHash:{classification:"SystemMetaData",purpose:"FeatureInsight"}}};this[jse]={owner:"donjayamanne",feature:["Notebook","Notebook"],tags:["Widgets"],source:"N/A",measures:It()};this[Wse]={owner:"donjayamanne",feature:["DataFrameViewer"],source:"N/A"};this[Vse]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[Bse]={owner:"IanMatthewHuff",feature:["DataFrameViewer"],source:"N/A"};this[qse]={owner:"donjayamanne",feature:["Notebook","Notebook"],tags:["Widgets"],source:"N/A",measures:{...It(),codeCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of code cells.",isMeasurement:!0},markdownCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of markdown cells.",isMeasurement:!0},preExecuteDuration:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total time spent in VS Code before starting execution.",isMeasurement:!0},executeDuration:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total time spent executing cells.",isMeasurement:!0},postExecuteDuration:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total time spent in VS Code after executing cells.",isMeasurement:!0}},properties:{outputType:{classification:"PublicNonPersonalData",purpose:"FeatureInsight",comment:"The kind of outputs generated in the notebook, text, html or images."}}};this[Jse]={owner:"donjayamanne",feature:["Notebook","Notebook"],tags:["Widgets"],source:"N/A",measures:{...It(),codeCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of code cells.",isMeasurement:!0},markdownCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of markdown cells.",isMeasurement:!0}},properties:{outputType:{classification:"PublicNonPersonalData",purpose:"FeatureInsight",comment:"The kind of outputs generated in the notebook, text, html or images."}}};this[$se]={owner:"donjayamanne",feature:["Notebook","Notebook"],tags:["Widgets"],source:"N/A",measures:{...It(),codeCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of code cells.",isMeasurement:!0},markdownCellCount:{classification:"SystemMetaData",purpose:"PerformanceAndHealth",comment:"Total number of markdown cells.",isMeasurement:!0}}}}static{Hne="EXTENSION.LOAD",Gne="DS_INTERNAL.EXPERIMENT_LOAD",zne="ENVFILE_VARIABLE_SUBSTITUTION",Qne="ENVFILE_WORKSPACE",Yne="HASHED_PACKAGE_NAME",Xne="DS_INTERNAL.ACTIVE_INTERPRETER_LISTING_PERF",Zne="DS_INTERNAL.CELL_OUTPUT_MIME_TYPE",eie="DS_INTERNAL.GET_ACTIVATED_ENV_VARIABLES",tie="OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST_EX",rie="OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR_EX",nie="OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS_EX",iie="DATASCIENCE.ADD_CELL_BELOW",oie="DS_INTERNAL.CODE_LENS_ACQ_TIME",sie="DS_INTERNAL.DOCUMENT_WITH_CODE_CELLS",aie="DATASCIENCE.DEBUG_CONTINUE",lie="DATASCIENCE.DEBUG_CURRENT_CELL",cie="DATASCIENCE.DEBUG_STEP_OVER",uie="DATASCIENCE.DEBUG_STOP",pie="DATASCIENCE.DEBUG_FILE_INTERACTIVE",die="DATASCIENCE.JUPYTER_KERNEL_SPEC_FETCH_FAILURE",mie="DS_INTERNAL.JUPYTER_KERNEL_SPEC",fie="DATASCIENCE.ENTER_REMOTE_JUPYTER_URL",hie="DATASCIENCE.DISABLE_INTERACTIVE_SHIFT_ENTER",gie="DATASCIENCE.ENABLE_INTERACTIVE_SHIFT_ENTER",vie="DS_INTERNAL.PERCEIVED_JUPYTER_STARTUP_NOTEBOOK",yie="DATASCIENCE.EXPORT_PYTHON_FILE",bie="DATASCIENCE.EXPORT_PYTHON_FILE_AND_OUTPUT",Iie="DATASCIENCE.CLICKED_EXPORT_NOTEBOOK_AS_QUICK_PICK",Sie="DATASCIENCE.EXPORT_NOTEBOOK_AS",xie="DATASCIENCE.IMPORT_NOTEBOOK",Cie="DATASCIENCE.EXPORT_NOTEBOOK_AS_COMMAND",wie="DATASCIENCE.EXPORT_NOTEBOOK_AS_FAILED",Eie="DS_INTERNAL.GET_PASSWORD_FAILURE",kie="DS_INTERNAL.GET_PASSWORD_SUCCESS",Pie="DS_INTERNAL.JUPYTER_HUB_PASSWORD",Die="DS_INTERNAL.SHOW_DATA_NO_PANDAS",_ie="DS_INTERNAL.SHOW_DATA_PANDAS_TOO_OLD",Tie="DS_INTERNAL.SHOW_DATA_PANDAS_OK",Rie="DS_INTERNAL.SHOW_DATA_PANDAS_INSTALL_CANCELED",Aie="DATASCIENCE.NATIVE.OPEN_NOTEBOOK_ALL",Nie="DATASCIENCE.OPEN_PLOT_VIEWER",Mie="DATASCIENCE.RUN_ALL_CELLS",Oie="DATASCIENCE.RUN_SELECTION_OR_LINE",Kie="DATASCIENCE.RUN_CURRENT_CELL",Fie="DATASCIENCE.RUN_ALL_CELLS_ABOVE",Lie="DATASCIENCE.RUN_CELL_AND_ALL_BELOW",Uie="DATASCIENCE.RUN_CURRENT_CELL_AND_ADVANCE",jie="DATASCIENCE.RUN_FILE_INTERACTIVE",Wie="DATASCIENCE.RUN_TO_LINE",Vie="DATASCIENCE.RUN_FROM_LINE",Bie="DATASCIENCE.RUN_INSERT_CELL_BELOW_POSITION",qie="DATASCIENCE.RUN_INSERT_CELL_BELOW",Jie="DATASCIENCE.RUN_INSERT_CELL_ABOVE",$ie="DATASCIENCE.RUN_DELETE_CELLS",Hie="DATASCIENCE.RUN_SELECT_CELL",Gie="DATASCIENCE.RUN_SELECT_CELL_CONTENTS",zie="DATASCIENCE.RUN_EXTEND_SELECTION_BY_CELL_ABOVE",Qie="DATASCIENCE.RUN_EXTEND_SELECTION_BY_CELL_BELOW",Yie="DATASCIENCE.RUN_MOVE_CELLS_UP",Xie="DATASCIENCE.RUN_MOVE_CELLS_DOWN",Zie="DATASCIENCE.RUN_CHANGE_CELL_TO_MARKDOWN",eoe="DATASCIENCE.RUN_CHANGE_CELL_TO_CODE",toe="DATASCIENCE.GOTO_NEXT_CELL_IN_FILE",roe="DATASCIENCE.GOTO_PREV_CELL_IN_FILE",noe="DATASCIENCE.RUN_CURRENT_CELL_AND_ADD_BELOW",ioe="DATASCIENCE.SELFCERTSMESSAGECLOSE",ooe="DATASCIENCE.SELFCERTSMESSAGEENABLED",soe="DATASCIENCE.USER_INSTALLED_JUPYTER",aoe="DATASCIENCE.USER_INSTALLED_PANDAS",loe="DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER",coe="DATASCIENCE.USER_DID_NOT_INSTALL_PANDAS",uoe="DS_INTERNAL.PYTHON_NOT_INSTALLED",poe="DS_INTERNAL.PYTHON_EXTENSION_NOT_INSTALLED",doe="DS_INTERNAL.PYTHON_EXTENSION_INSTALLED_VIA_KERNEL_PICKER",moe="DS_INTERNAL.PYTHON_MODULE_INSTALL",foe="DS_INTERNAL.SHIFTENTER_BANNER_SHOWN",hoe="DATASCIENCE.START_SHOW_DATA_EXPLORER",goe="DATASCIENCE.SHOW_DATA_EXPLORER",voe="DATASCIENCE.SHOW_DATA_EXPLORER_ROWS_LOADED",yoe="DATASCIENCE.FAILED_SHOW_DATA_EXPLORER",boe="DATASCIENCE.REFRESH_DATA_VIEWER",Ioe="DS_INTERNAL.JUPYTER_ZMQ_SUPPORT",Soe="DS_INTERNAL.JUPYTER_ZMQ_SUPPORT_FAILURE",xoe="DS_INTERNAL.VARIABLE_EXPLORER_FETCH_TIME",Coe="DS_INTERNAL.VARIABLE_EXPLORER_VARIABLE_COUNT",woe="DATASCIENCE.KERNEL_SPEC_LANGUAGE",Eoe="DS_INTERNAL.KERNEL_LAUNCHER_PERF",koe="GLOBAL_PYTHON_KERNELSPEC",Poe="DS_INTERNAL.NEW_FILE_USED_IN_INTERACTIVE",Doe="DS_INTERNAL.CREATED_INTERACTIVE_WINDOW",_oe="DS_INTERNAL.IPYWIDGET_USED_BY_USER",Toe="DS_INTERNAL.IPYWIDGET_DISCOVER_WIDGETS_NB_EXTENSIONS",Roe="DS_INTERNAL.IPYWIDGET_DISCOVERY_ERRORED",Aoe="DS_INTERNAL.IPYWIDGET_LOAD_SUCCESS",Noe="DS_INTERNAL.IPYWIDGET_LOAD_FAILURE",Moe="DS_INTERNAL.IPYWIDGET_WIDGET_VERSION_NOT_SUPPORTED_LOAD_FAILURE",Ooe="DS_INTERNAL.IPYWIDGET_PROMPT_TO_USE_CDN",Koe="DS_INTERNAL.IPYWIDGET_PROMPT_TO_USE_CDN_SELECTION",Foe="DS_INTERNAL.IPYWIDGET_RENDER_FAILURE",Loe="DS_INTERNAL.IPYWIDGET_UNHANDLED_MESSAGE",Uoe="DS_INTERNAL.RAWKERNEL_INFO_RESPONSE",joe="DS_INTERNAL.RAWKERNEL_PROCESS_LAUNCH",Woe="DATASCIENCE.EXECUTE_CELL",Voe="DATASCIENCE.EXECUTE_CODE",Boe="DATASCIENCE.RESUME_EXECUTE_CELL",qoe="DATASCIENCE.NOTEBOOK_START",Joe="DS_INTERNAL.SWITCH_KERNEL",$oe="DATASCIENCE.NOTEBOOK_INTERRUPT",Hoe="DATASCIENCE.NOTEBOOK_RESTART",Goe="DS_INTERNAL.RAWKERNEL_SESSION_NO_IPYKERNEL",zoe="DS_INTERNAL.RAWKERNEL_SESSION_KERNEL_PROCESS_EXITED",Qoe="DATASCIENCE.NOTEBOOK_FIRST_START_BREAKDOWN",Yoe="DATASCIENCE.NOTEBOOK_FIRST_KERNEL_AUTO_SELECTION_BREAKDOWN",Xoe="DS_INTERNAL.RAWKERNEL_SESSION_SHUTDOWN",Zoe="DS_INTERNAL.RAWKERNEL_SESSION_DISPOSED",ese="DATASCIENCE.RUN_BY_LINE_VARIABLE_HOVER",tse="DS_INTERNAL.KERNEL_COUNT",rse="DS_INTERNAL.VSCNOTEBOOK_CELL_TRANSLATION_FAILED",nse="DS_INTERNAL.INTERACTIVE_FILE_TOOLTIPS_PERF",ise="DS_INTERNAL.NATIVE_VARIABLE_VIEW_LOADED",ose="DS_INTERNAL.NATIVE_VARIABLE_VIEW_MADE_VISIBLE",sse="DATAVIEWER.WEBVIEW_LOADED",ase="PLOTVIEWER.WEBVIEW_LOADED",lse="DS_INTERNAL.COMMAND_EXECUTED",cse="DATASCIENCE.DATA_VIEWER_SLICE_ENABLEMENT_STATE_CHANGED",use="DATASCIENCE.DATA_VIEWER_DATA_DIMENSIONALITY",pse="DATASCIENCE.DATA_VIEWER_SLICE_OPERATION",dse="DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",mse="DATASCIENCE.RECOMMENT_EXTENSION",fse="DATASCIENCE.DEBUGGING.CLICKED_ON_SETUP",hse="DATASCIENCE.DEBUGGING.CLOSED_MODAL",gse="DATASCIENCE.DEBUGGING.IPYKERNEL6_STATUS",vse="DATASCIENCE.DEBUGGING.CLICKED_RUNBYLINE",yse="DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_RUNBYLINE",bse="DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_IW_JUPYTER",Ise="DATASCIENCE.DEBUGGING.CLICKED_RUN_AND_DEBUG_CELL",Sse="DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_RUN_AND_DEBUG_CELL",xse="DATASCIENCE.DEBUGGING.ENDED_SESSION",Cse="DATASCIENCE.JUPYTER_KERNEL_CODE_COMPLETION",wse="DATASCIENCE.JUPYTER_KERNEL_CODE_COMPLETION_CANNOT_RESOLVE",Ese="DATASCIENCE.JUPYTER_KERNEL_API_USAGE",kse="DATASCIENCE.JUPYTER_NEW_KERNEL_API_USAGE",Pse="DATASCIENCE.JUPYTER_NEW_KERNELS_API_USAGE",Dse="DATASCIENCE.JUPYTER_NEW_KERNEL_API_EXEC",_se="DATASCIENCE.JUPYTER_API_USAGE",Tse="DATASCIENCE.JUPYTER_KERNEL_API_ACCESS",Rse="DATASCIENCE.JUPYTER_KERNEL_STARTUP_HOOK",Ase="DATASCIENCE.PYTHON_VARIABLE_FETCHING_CODE_FAILURE",Nse="DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE",Mse="DATASCIENCE.KERNEL_CRASH",Ose="DATASCIENCE.JUPYTER_KERNEL_HIDDEN_VIA_FILTER",Kse="DATASCIENCE.JUPYTER_KERNEL_FILTER_USED",Fse="DS_INTERNAL.RUNTEST",Lse="DS_INTERNAL.PREFERRED_KERNEL_EXACT_MATCH",Use="DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO",jse="DS_INTERNAL.IPYWIDGET_TIME_TO_COPY_NBEXTENSIONS_DIR",Wse="DATASCIENCE.NO_ACTIVE_KERNEL_SESSION",Vse="DATAVIEWER.USING_INTERPRETER",Bse="DATAVIEWER.USING_KERNEL",qse="DATASCIENCE.JUPYTER_NOTEBOOK_EXEC_PERFORMANCE",Jse="DATASCIENCE.JUPYTER_JUPYTER_NOTEBOOK_EXEC_PERFORMANCE",$se="DATASCIENCE.JUPYTER_NOTEBOOK_EDIT_PERFORMANCE"}};var pp=require("vscode");function Il(r){let e=bl(r.uri);return mt(e.path)}function Bo(r=pp.Uri.file(""),e=pp.Uri.file(""),t=Fr(),n=!1){let i=bl(r,t,t=="Windows"||n),o=bl(e,t,t=="Windows"||n);return i===o||ki(i,o,!0)}function bl(r=pp.Uri.file(""),e=Fr(),t=!1){let n=De(r);return t&&(n=n.toLowerCase()),n.endsWith("/bin/python")?["Linux","OSX"].includes(e)?n.endsWith("/bin/python")&&n.split("/").length>4?pp.Uri.file(n.replace("/bin/python","/python")):pp.Uri.file(n):pp.Uri.file(n):pp.Uri.file(n)}var KV=require("vscode");var vo=class{constructor(){this.promises=new Set;this._onStateChange=new KV.EventEmitter;this.onStateChange=this._onStateChange.event}get isComplete(){return this.promises.size===0}dispose(){this._onStateChange.dispose()}push(e){this.promises.add(e),this._onStateChange.fire(),e.finally(()=>{this.promises.delete(e),this.isComplete&&this._onStateChange.fire()}).catch(h)}};var ik=class extends cn{constructor(e){super("Python Extension failed to activate",e,"pythonExtension")}};var ok=class extends ze{constructor(){super("pythonExtension","Python Extension API not exported")}};var f9=P(ig());var Im=require("vscode");var hk=class{};function _s(r,e=""){let t=r?Im.workspace.getWorkspaceFolder(r):Im.workspace.workspaceFolders?Im.workspace.workspaceFolders[0]:void 0;return t?Cn(Fr()==="Windows"?t.uri.path.toUpperCase():t.uri.path):e}function xl(){return(Array.isArray(Im.workspace.workspaceFolders)&&Im.workspace.workspaceFolders.length>0?Im.workspace.workspaceFolders[0]:void 0)?.uri}var Cm=require("vscode");var ZV=P(ig());var Sm=require("vscode");function Ia(r){return(e,t=null,n)=>{let i=!1,o;return o=r(s=>{if(!i)return o?o.dispose():i=!0,e.call(t,s)},null,n),i&&o.dispose(),o}}function mx(r,e=null,t){return new Promise(n=>Ia(r)(n,e,t))}var _ae={output_type:"stream",name:"stdout",text:""},Tae={output_type:"error",ename:"",evalue:"",traceback:[""]},Rae={output_type:"display_data",data:{},metadata:{}},Aae={output_type:"execute_result",execution_count:0,data:{},metadata:{}},eke={stream:new Set(Object.keys(_ae)),error:new Set(Object.keys(Tae)),display_data:new Set(Object.keys(Rae)),execute_result:new Set(Object.keys(Aae))};function Zi(r){return r&&rp(r).toLowerCase().endsWith("ipynb")?"notebook":"interactive"}function Cl(r){return r=r.toLowerCase(),r.length===2&&r.endsWith("#")?`${r.substring(0,1)}sharp`:Qj.get(r)||r}function Dt(r){return typeof r=="string"?r===Et||r===yt:r.notebookType===Et||r.notebookType===yt}function yo(r){let e=r.metadata;return JSON.parse(JSON.stringify(e?.metadata||{}))}function e9(r){let e=r.metadata;return{nbformat:e?.nbformat,nbformat_minor:e?.nbformat_minor}}async function t9(r,e){let t=new Sm.WorkspaceEdit;t.set(r.uri,[Sm.NotebookEdit.updateNotebookMetadata(LN({...r.metadata||{},metadata:e}))]),await Sm.workspace.applyEdit(t)}function og(r){return Sm.workspace.notebookDocuments.find(e=>Dt(e)&&e.getCells().some(t=>t.document===r))}function Ts(r){if(Array.isArray(r)){let e="";for(let t=0;t<r.length;t+=1){let n=r[t];t<r.length-1&&!n.endsWith(`
|
||
`)?e=e.concat(`${n}
|
||
`):e=e.concat(n)}return e}return r.toString()}function sg(r){if(Array.isArray(r))return r;let e=r.toString();if(e.length>0){let t=e.split(`
|
||
`);return t.map((n,i)=>i<t.length-1?`${n}
|
||
`:n).filter(n=>n.length>0)}return[]}function Nae(r){let e=r;do r=e,e=r.replace(/[^\n]\x08/gm,"");while(e.length<r.length);return r}function Mae(r){for(r=r.replace(/\r+\n/gm,`
|
||
`);r.search(/\r[^$]/g)>-1;){var e=r.match(/^(.*)\r+/m)[1],t=r.match(/\r+(.*)$/m)[1];t=t+e.slice(t.length,e.length),r=r.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,t)}return r}function r9(r){return Mae(Nae(r))}var gk="'''",vk='"""';function xm(r,e,t){let n,i,o=0;for(let s of r){let a=s.trim(),l=a.startsWith(gk)?gk:a.startsWith(vk)?vk:void 0,c=a.includes(gk)?gk:a.includes(vk)?vk:void 0;if(i)i===c&&(i=void 0),t(s,o);else if(n)n===l&&(n=void 0),n&&e(s,o);else if(c&&!l){let u=a.indexOf(c);i=a.lastIndexOf(c)!==u?void 0:c,t(s,o)}else if(l){let u=a.indexOf(l,3);n=u>=0?void 0:l,a.length>3&&e(a.slice(3,u>=0?u:void 0),o)}else a.startsWith("#")?e(a.slice(1),o):t(s,o);o+=1}}function ag(r,e=`
|
||
`,t){return r.map((n,i)=>{let o=t?t(n):n;return i===r.length-1?`${o}`:`${o}${e}`})}function Oae(r){let e=[];return xm(r,t=>e.push(t),t=>{}),e}function yk(r){return ag(Oae(r.slice(r.length>1?1:0)))}function n9(r){let e=r.length,t=-1;return r.forEach((n,i)=>{n.trim()&&(e=i,t<0&&(t=i))}),t>=0?r.slice(t,e+1):[]}function bk(r){let e=/^\s*(\d+)\.(\d+)\.(.+)\s*$/.exec(r);if(e&&e.length>2){let t=parseInt(e[1],10),n=parseInt(e[2],10),i=parseInt(e[3],10);return(0,ZV.parse)(`${t}.${n}.${i}`,!0)??void 0}}function dp(r){let e=JSON.parse(JSON.stringify(r.metadata||{}))||{metadata:{}};return e.metadata=e.metadata||{},e}function LN(r){return Kae(r)}function Kae(r){return Array.isArray(r)?r.map(LN):r!=null&&typeof r=="object"&&Object.keys(r).length>0?Object.keys(r).sort().reduce((e,t)=>(e[t]=LN(r[t]),e),{}):r}async function Rs(r,e=[]){let t=mx(r.onDidDispose,void 0,e);r.dispose(),await t}var Ik=new Map,jN=new Map,UN;function i9(r){UN=r}function WN(r,e){if(!r.pythonEnvironmentPath)return;let t=oe();Fae({interpreterHash:r.pythonEnvironmentPath}).then(n=>{r.pythonEnvironmentPackages=n||r.pythonEnvironmentPackages,e&&(e.pythonEnvironmentPackages=n||e.pythonEnvironmentPackages)}).catch(()=>{}).finally(()=>{t.resolve()})}async function Fae(r){if(!UN)return d.error("Python package provider is not initialized."),"{}";let e;if("interpreter"in r?e=r.interpreter:e=jN.get(r.interpreterHash),!e)return"{}";let t=await UN(e);return!t||t.size===0?"{}":JSON.stringify(Object.fromEntries(t))}async function o9(r){if(!r)return{};let e=Ik.get(gn(r)),t=Zi(r);if(!e&&t)return{resourceType:t,resourceHash:r?await mt(r.toString()):void 0};if(!e)return{};let n=JSON.parse(JSON.stringify(e[0]));return WN(e[0],n),n}function _t(r,e,t,n,i){o9(r).then(o=>{Object.assign(o,n||{}),A(e,t,o,i)}).catch(h)}var An=!1,lg=new WeakMap,Sk=new Map,cg,a9=0;function Nn(r){if(!r)return;if(xn(r)&&!Sk.has(r.toString())){let t=Cm.workspace.notebookDocuments.find(n=>n.uri.toString()===r.toString());t&&Sk.set(r.toString(),new WeakRef(t))}let e=xn(r)?Sk.get(r.toString())?.deref():r;if(e)return lg.get(e)?.tracker}function l9(r){let e=new $r;return cg=r,a9=r.elapsedTime,Cm.workspace.notebookDocuments.forEach(t=>lg.set(t,s9(t,!0,r))),e.add(Cm.workspace.onDidOpenNotebookDocument(t=>{!lg.has(t)&&!An&&lg.set(t,s9(t,!1,r))})),e.add(Cm.workspace.onDidCloseNotebookDocument(t=>{lg.delete(t),Sk.delete(t.uri.toString())})),e}function c9(r){lg.get(r)?.tracker.kernelManuallySelected()}var xk={starAfter:-1,completedAfter:-1},VN=new Map,u9=new Map,Lae=new Map,p9=jt(()=>(xk.starAfter=cg?.elapsedTime,{stop:jt(()=>{xk.completedAfter=cg.elapsedTime})}));function d9(r,e){VN.set(r,cg?.elapsedTime),Lae.set(r,e||"")}function m9(r){r.executable.uri&&u9.set(r.id,cg?.elapsedTime)}function s9(r,e,t){let n=cg.elapsedTime,i=t.elapsedTime,o={openedAfter:i},s=c=>(c==="executeCell"&&(An=!0),o[`${c}StartedAfter`]=t.elapsedTime,{stop:jt(()=>{o[`${c}CompletedAfter`]=t.elapsedTime})}),a={wasAlreadyOpen:e},l=()=>{};return{measures:o,info:a,tracker:{kernelSelected:jt((c,u)=>{let p=VN.get(c);typeof p=="number"&&(a.wasAlreadyOpen?o.controllerCreatedAfter=VN.get(c):o.controllerCreatedAfter=n-p),o.interpreterDiscoveredAfter=u9.get(u||""),o.kernelSelectedAfter=t.elapsedTime,a.manuallySelectedKernel||Wae(r,{wasAlreadyOpen:a.wasAlreadyOpen},{controllerCreatedAfter:o.controllerCreatedAfter,kernelSelectedAfter:o.kernelSelectedAfter,openedAfter:i,interpreterDiscoveredAfter:o.interpreterDiscoveredAfter})}),kernelManuallySelected:jt(()=>a.manuallySelectedKernel=!0),cellExecutionCount:An?l:jt(c=>o.executeCellCount=c),preExecuteCellTelemetry:An?l:jt(()=>s("preExecuteCellTelemetry")),startKernel:An?l:jt(()=>s("startKernel")),executeCell:An?l:jt(()=>s("executeCell")),executeCellAcknowledged:An?l:jt(()=>{o.executeCellAcknowledgedAfter=t.elapsedTime,Uae(r,a,o)}),jupyterSessionTelemetry:An?l:jt(()=>s("sessionTelemetry")),postKernelStartup:An?l:jt(()=>s("postKernelStart")),computeCwd:An?l:jt(()=>s("computeCwd")),getConnection:An?l:jt(()=>s("getConnection")),updateConnection:An?l:jt(()=>s("updateConnection")),kernelReady:An?l:jt(()=>s("kernelReady")),portUsage:An?l:jt(()=>s("portUsage")),spawn:An?l:jt(()=>s("spawn")),pythonEnvVars:An?l:jt(()=>s("pythonEnvVars")),envVars:An?l:jt(()=>s("envVars")),interruptHandle:An?l:jt(()=>s("interruptHandle")),kernelInfo:An?l:jt(()=>s("kernelInfo")),kernelIdle:An?l:jt(()=>s("kernelIdle"))}}}var Uae=jt(function(r,e,t){if(typeof t.preExecuteCellTelemetryStartedAfter!="number"||typeof t.preExecuteCellTelemetryCompletedAfter!="number"||typeof t.executeCellAcknowledgedAfter!="number"||typeof t.startKernelStartedAfter!="number"||typeof t.startKernelCompletedAfter!="number"||typeof t.executeCellStartedAfter!="number"||typeof t.sessionTelemetryStartedAfter!="number"||typeof t.sessionTelemetryCompletedAfter!="number"||typeof t.postKernelStartStartedAfter!="number"||typeof t.postKernelStartCompletedAfter!="number"||typeof t.kernelInfoStartedAfter!="number"||typeof t.kernelInfoCompletedAfter!="number"||typeof t.kernelIdleStartedAfter!="number"||typeof t.kernelIdleCompletedAfter!="number"||typeof t.computeCwdStartedAfter!="number"||typeof t.computeCwdCompletedAfter!="number"||typeof t.kernelReadyStartedAfter!="number"||typeof t.kernelReadyCompletedAfter!="number"||typeof t.getConnectionStartedAfter!="number"||typeof t.getConnectionCompletedAfter!="number"||typeof t.updateConnectionStartedAfter!="number"||typeof t.updateConnectionCompletedAfter!="number"||typeof t.portUsageStartedAfter!="number"||typeof t.portUsageCompletedAfter!="number"||typeof t.spawnStartedAfter!="number"||typeof t.spawnCompletedAfter!="number"||typeof t.pythonEnvVarsStartedAfter!="number"||typeof t.pythonEnvVarsCompletedAfter!="number"||typeof t.envVarsStartedAfter!="number"||typeof t.envVarsCompletedAfter!="number")return;let n={duration:0,preExecuteCellTelemetry:0,startKernel:0,executeCell:0};{let c=[{name:"preExecuteCellTelemetry",start:t.preExecuteCellTelemetryStartedAfter,end:t.preExecuteCellTelemetryCompletedAfter},{name:"startKernel",start:t.startKernelStartedAfter,end:t.startKernelCompletedAfter},{name:"executeCell",start:t.executeCellStartedAfter,end:t.executeCellAcknowledgedAfter}],u=t.executeCellAcknowledgedAfter-t.preExecuteCellTelemetryStartedAfter;n.duration=u,fx(n,c,u,t.openedAfter)}let i={sessionTelemetry:0,postKernelStart:0,computeCwd:0,getConnection:0,updateConnection:0,kernelReady:0,portUsage:0,spawn:0};{let c=[{name:"sessionTelemetry",start:t.sessionTelemetryStartedAfter,end:t.sessionTelemetryCompletedAfter},{name:"postKernelStart",start:t.postKernelStartStartedAfter,end:t.postKernelStartCompletedAfter},{name:"computeCwd",start:t.computeCwdStartedAfter,end:t.computeCwdCompletedAfter},{name:"getConnection",start:t.getConnectionStartedAfter,end:t.getConnectionCompletedAfter},{name:"updateConnection",start:t.updateConnectionStartedAfter,end:t.updateConnectionCompletedAfter},{name:"spawn",start:t.spawnStartedAfter,end:t.spawnCompletedAfter},{name:"portUsage",start:t.portUsageStartedAfter,end:t.portUsageCompletedAfter},{name:"kernelReady",start:t.kernelReadyStartedAfter,end:t.kernelReadyCompletedAfter}],u=t.startKernelCompletedAfter-t.startKernelStartedAfter;fx(i,c,u,t.openedAfter)}let o={startupCode:0,kernelInfo:0,kernelIdle:0};{let c=[{name:"startupCode",start:t.postKernelStartStartedAfter,end:t.kernelInfoStartedAfter},{name:"kernelInfo",start:t.kernelInfoStartedAfter,end:t.kernelInfoCompletedAfter},{name:"kernelIdle",start:t.kernelIdleStartedAfter,end:t.kernelIdleCompletedAfter}],u=t.postKernelStartCompletedAfter-t.postKernelStartStartedAfter;fx(o,c,u,t.openedAfter)}let s={pythonEnvVars:0,envVars:0,interruptHandle:0};{let c=[{name:"pythonEnvVars",start:t.pythonEnvVarsStartedAfter,end:t.pythonEnvVarsCompletedAfter},{name:"envVars",start:t.envVarsStartedAfter,end:t.envVarsCompletedAfter},{name:"interruptHandle",start:t.interruptHandleStartedAfter||0,end:t.interruptHandleCompletedAfter||0}],u=t.spawnCompletedAfter-t.spawnStartedAfter;fx(s,c,u,t.openedAfter)}let a=jae(r),l={...n,...i,...o,...s,...a};_t(r.uri,"DATASCIENCE.NOTEBOOK_FIRST_START_BREAKDOWN",l,e)});function jae(r){let e={attachmentCharLength:0,attachmentCount:0,codeCellCharLength:0,codeCellCount:0,mdCellCharLength:0,mdCellCount:0,outputCount:0,outputsByteSize:0};return r.getCells().forEach(t=>{let n=t.document.lineAt(t.document.lineCount-1).range.end,i=t.document.offsetAt(n);if(t.kind===Cm.NotebookCellKind.Markup){e.mdCellCount+=1,e.mdCellCharLength+=i;try{let s=dp(t).attachments||{};Object.keys(s).forEach(a=>{e.attachmentCount+=1;let l=s[a];typeof l=="object"&&Object.keys(l).forEach(c=>{let u=l[c];u&&typeof u=="string"&&(e.attachmentCharLength+=u.length)})})}catch(o){d.warn("Error parsing attachments in cell metadata",o)}}else e.codeCellCount+=1,e.codeCellCharLength+=i,e.outputCount+=t.outputs.length,e.outputsByteSize+=t.outputs.reduce((o,s)=>o+s.items.reduce((a,l)=>a+l.data.byteLength,0),0)}),e}var Wae=jt(function(r,e,t){if(t.pythonExtensionActivationStartedAfter=xk.starAfter,t.pythonExtensionActivationCompletedAfter=xk.completedAfter,typeof t.controllerCreatedAfter>"u"||typeof t.interpreterDiscoveredAfter>"u"||typeof t.pythonExtensionActivationCompletedAfter>"u"||typeof t.pythonExtensionActivationStartedAfter>"u")return;let n=[{name:"callPythonApi",start:a9,end:t.pythonExtensionActivationStartedAfter},{name:"activatePython",start:t.pythonExtensionActivationStartedAfter,end:t.pythonExtensionActivationCompletedAfter},{name:"discoverEnv",start:t.pythonExtensionActivationCompletedAfter,end:t.interpreterDiscoveredAfter},{name:"createController",start:t.interpreterDiscoveredAfter,end:t.controllerCreatedAfter},{name:"selectController",start:t.controllerCreatedAfter,end:t.kernelSelectedAfter}],i=t.kernelSelectedAfter-t.openedAfter,o={duration:i};fx(o,n,i,t.openedAfter),_t(r.uri,"DATASCIENCE.NOTEBOOK_FIRST_KERNEL_AUTO_SELECTION_BREAKDOWN",o,e)});function fx(r,e,t,n){e.sort((i,o)=>i.start-o.start).forEach(i=>{typeof n=="number"&&n>=i.start&&n<=i.end?r[i.name]=(i.end-n)*100/t:typeof n=="number"&&n>i.end?r[i.name]=0:(typeof n=="number"&&n<i.start||typeof n!="number")&&(r[i.name]=(i.end-i.start)*100/t)})}function hx(r,e){if(r){let t={...r,uri:wt.Uri.file(r.path||""),id:e||r.id};return delete t.path,t}}function h9(r){let e,t=r.id;if(r.executable.uri)e=r.executable.uri;else if(Be(r)==="Conda")e=Fr()==="Windows"?wt.Uri.joinPath(r.environment?.folderUri||wt.Uri.file(r.path),"python.exe"):wt.Uri.joinPath(r.environment?.folderUri||wt.Uri.file(r.path),"bin","python");else{d.warn(`Python environment ${B(r.id)} excluded as Uri is undefined`);return}return{id:t,uri:e}}function wm(r){if(r){let e=Object.assign({},r,{path:De(r.uri)});return delete e.uri,e}}var ug=class{constructor(e,t){this.disposables=e;this.extensionChecker=t;this.api=oe();this.didActivatePython=new wt.EventEmitter;this._pythonExtensionHooked=oe();this.extensionChecker.isPythonExtensionInstalled||wt.extensions.onDidChange(async()=>{this.extensionChecker.isPythonExtensionInstalled&&await this.registerHooks()},this,this.disposables),this.disposables.push(this.didActivatePython)}get onDidActivatePythonExtension(){return this.didActivatePython.event}get pythonExtensionHooked(){return this._pythonExtensionHooked.promise}get pythonExtensionVersion(){return this._pythonExtensionVersion}getApi(){return this.init().catch(h),this.api.promise}async getNewApi(){await this.init();let e=wt.extensions.getExtension(si);return e?.packageJSON?.version&&(this._pythonExtensionVersion=new f9.SemVer(e?.packageJSON?.version)),e?.exports&&(aV(e.exports),e.exports.environments.known.forEach(t=>{m9(t)})),e?.exports}setApi(e){this.api.resolved||!wt.workspace.isTrusted||this.api.resolve(e)}async init(){if(this.initialized)return;wt.extensions.getExtension(si)?await this.registerHooks():await this.extensionChecker.showPythonExtensionInstallRequiredPrompt(),this.initialized=!0}async registerHooks(){if(this.hooksRegistered)return;let e=wt.extensions.getExtension(si);if(!e)return;let t=!1;if(!e.isActive){let n=p9();try{let i=e.activate();i.then(()=>n.stop(),()=>n.stop()),await i,t=!0}catch(i){d.error("Failed activating the python extension: ",i),this.api.reject(new ik(i));return}}this.hooksRegistered||(this.hooksRegistered=!0,t&&this.didActivatePython.fire(),e.exports?.jupyter?e.exports.jupyter.registerHooks():(d.error("Python extension is not exporting the jupyter API"),this.api.reject(new ok)),this._pythonExtensionHooked.resolve())}};ug=y([(0,As.injectable)(),m(0,(0,As.inject)(O)),m(1,(0,As.inject)($e))],ug);var mp=class{constructor(e){this.disposables=e;this.pythonExtensionInstallationStatusChanged=new wt.EventEmitter;wt.extensions.onDidChange(this.extensionsChangeHandler.bind(this),this,this.disposables),this.previousInstallState=this.isPythonExtensionInstalled}get onPythonExtensionInstallationStatusChanged(){return this.pythonExtensionInstallationStatusChanged.event}get isPythonExtensionInstalled(){return wt.extensions.getExtension(si)!==void 0}get isPythonExtensionActive(){return wt.extensions.getExtension(si)?.isActive===!0}async directlyInstallPythonExtension(){return wt.commands.executeCommand("workbench.extensions.installExtension",si,{context:{skipWalkthrough:!0}})}async showPythonExtensionInstallRequiredPrompt(){if(!wt.workspace.isTrusted)return;mp.promptDisplayed=!0;let e=me.bannerLabelYes;A("DS_INTERNAL.PYTHON_EXTENSION_NOT_INSTALLED",void 0,{action:"displayed"}),await wt.window.showInformationMessage(I.pythonExtensionRequired,{modal:!0},e)===e?(A("DS_INTERNAL.PYTHON_EXTENSION_NOT_INSTALLED",void 0,{action:"download"}),await this.installPythonExtension()):A("DS_INTERNAL.PYTHON_EXTENSION_NOT_INSTALLED",void 0,{action:"dismissed"})}async installPythonExtension(){wt.commands.executeCommand("extension.open",si).then(h,h)}async extensionsChangeHandler(){let e=this.isPythonExtensionInstalled;e!==this.previousInstallState&&(this.pythonExtensionInstallationStatusChanged.fire(e?"installed":"uninstalled"),this.previousInstallState=e)}};mp=y([(0,As.injectable)(),m(0,(0,As.inject)(O))],mp);var pg=class{constructor(e,t,n,i){this.apiProvider=e;this.extensionChecker=t;this.disposables=n;this.context=i;this.didChangeInterpreter=new wt.EventEmitter;this.didChangeInterpreters=new wt.EventEmitter;this._onDidEnvironmentVariablesChange=new wt.EventEmitter;this._onDidRemoveInterpreter=new wt.EventEmitter;this.onDidRemoveInterpreter=this._onDidRemoveInterpreter.event;this.onDidEnvironmentVariablesChange=this._onDidEnvironmentVariablesChange.event;this._status="idle";this._onDidChangeStatus=new wt.EventEmitter;this.onDidChangeStatus=this._onDidChangeStatus.event;this.refreshPromises=new vo;this.onResumeEnvDetection=new wt.EventEmitter;this.workspaceCachedActiveInterpreter=new Set;this.lastLoggedResourceAndInterpreterId="";this.pythonEnvHashes=new Map;this.loggedEnvsWithoutInterpreterPath=new Set;this.pendingInterpreterChangeEventTriggers=new Map;this.pendingInterpretersChangeEventTriggers=new Map;this.extensionChecker.isPythonExtensionInstalled&&!this.extensionChecker.isPythonExtensionActive&&this.apiProvider.onDidActivatePythonExtension(()=>{this.hookupOnDidChangeInterpreterEvent()},this,this.disposables),wt.workspace.onDidGrantWorkspaceTrust(()=>this.refreshInterpreters(!0),this,this.disposables),this.disposables.push(this._onDidChangeStatus),this.disposables.push(this.refreshPromises),this.disposables.push(this.onResumeEnvDetection),this.refreshPromises.onStateChange(()=>{this.status=this.refreshPromises.isComplete?"idle":"refreshing"})}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._onDidChangeStatus.fire())}initialize(){this.hookupOnDidChangeInterpreterEvent()}async resolveEnvironment(e){return this.getApi().then(t=>{if(!t)return;let n=typeof e=="string"?t.environments.known.find(i=>i.id===e||i.path===e):e;return t.environments.resolveEnvironment(n||e)})}get onDidChangeInterpreter(){return this.hookupOnDidChangeInterpreterEvent(),this.didChangeInterpreter.event}get onDidChangeInterpreters(){return this.hookupOnDidChangeInterpreterEvent(),this.didChangeInterpreters.event}async refreshInterpreters(e=!1){let t=(async()=>{let n=await this.getApi();if(n)try{await n.environments.refreshEnvironments({forceRefresh:e}),this.hookupOnDidChangeInterpreterEvent(),d.debug("Refreshed Environments")}catch{d.error("Failed to refresh the list of interpreters")}})();this.refreshPromises.push(t),this.refreshPromises.push(t.then(()=>Ei(1e3))),await t}async getActiveInterpreter(e){if(!wt.workspace.isTrusted)return;let t=new We;this.hookupOnDidChangeInterpreterEvent(),!e&&wt.workspace.workspaceFolders?.length===1&&(e=wt.workspace.workspaceFolders[0].uri),wt.workspace.workspaceFolders?.length&&(e=(e?wt.workspace.getWorkspaceFolder(e)?.uri:void 0)||wt.workspace.workspaceFolders[0].uri);let n=_s(e),i=this.getApi().then(async o=>{if(!o)return;let s=o.environments.getActiveEnvironmentPath(e),a=await o.environments.resolveEnvironment(s);return this.trackResolvedEnvironment(a)});return i.then(()=>{this.workspaceCachedActiveInterpreter.has(n)||(this.workspaceCachedActiveInterpreter.add(n),A("DS_INTERNAL.ACTIVE_INTERPRETER_LISTING_PERF",{duration:t.elapsedTime},{firstTime:!0}))}).catch(o=>{d.warn(`Failed to get active interpreter from Python for workspace ${n}`,o)}),(wi||[wt.ExtensionMode.Development,wt.ExtensionMode.Test].includes(this.context.extensionMode))&&i.then(o=>{let s=`${B(e)}'-${B(o?.id)}`;if(this.lastLoggedResourceAndInterpreterId===s)return;this.lastLoggedResourceAndInterpreterId=s;let a=Yi(o);d.trace(`Active Interpreter ${e?`for '${B(e)}' `:""}is ${B(o?.id)} (${o&&Be(o)}, '${o?jo(o):""}', ${a?.major}.${a?.minor}.${a?.micro})`)}).catch(h),i}getInterpreterHash(e){return this.pythonEnvHashes.get(e)}async getInterpreterDetails(e,t){if(!wt.workspace.isTrusted)throw new Error("Unable to determine active Interpreter as Workspace is not trusted");this.hookupOnDidChangeInterpreterEvent();try{return await this.getApi().then(async n=>{if(!n||t?.isCancellationRequested)return;let i=n.environments.known.find(l=>xn(e)?Bo(l.executable.uri,e):typeof e=="string"?l.id===e:Bo(wt.Uri.file(l.path),wt.Uri.file(e.path))),o=xn(e)?B(e):typeof e=="string"?e:B(wt.Uri.file(e.path));if(i){let l=await n.environments.resolveEnvironment(i),c=this.trackResolvedEnvironment(l);return d.ci(`Interpreter details for ${o} from Python is ${JSON.stringify(l)} and our mapping is ${JSON.stringify(c)}`),c}let s=o;if(this.loggedEnvsWithoutInterpreterPath.has(s)||(this.loggedEnvsWithoutInterpreterPath.add(s),d.warn(`No interpreter with path ${o} found in Python API, will convert Uri path to string as Id ${o}`)),t?.isCancellationRequested)return;let a=await n.environments.resolveEnvironment(xn(e)?e.fsPath:typeof e=="string"?e:e.path);return this.trackResolvedEnvironment(a)})}catch(n){d.warn(`Failed to get Python interpreter details from Python Extension API for ${typeof e=="string"?e:B(xn(e)?e:wt.Uri.file(e.path))}`,n);return}}trackResolvedEnvironment(e){if(e){let t=Ai(e);return t?(Il(t).then(n=>{this.pythonEnvHashes.set(t.id,n)}).catch(h),this.triggerEventIfAllowed("interpretersChangeEvent",t),t):void 0}}triggerEventIfAllowed(e,t){e==="interpreterChangeEvent"?this.pendingInterpreterChangeEventTriggers.set(t?.id||"",t):this.pendingInterpretersChangeEventTriggers.set(t?.id||"",t),this.triggerPendingEvents()}triggerPendingEvents(){this.pendingInterpreterChangeEventTriggers.forEach(t=>this.didChangeInterpreter.fire(t)),this.pendingInterpreterChangeEventTriggers.clear();let e=Array.from(this.pendingInterpretersChangeEventTriggers.values());if(e.length){let t=e.filter(n=>!!n);t.length!==e.length&&t.length===0?this.didChangeInterpreters.fire([]):this.didChangeInterpreters.fire(t)}this.pendingInterpretersChangeEventTriggers.clear()}async getApi(){if(this.extensionChecker.isPythonExtensionInstalled)return this.apiPromise||(this.apiPromise=this.apiProvider.getNewApi()),this.apiPromise}hookupOnDidChangeInterpreterEvent(){this.eventHandlerAdded||this.getApi().then(e=>{!this.eventHandlerAdded&&e&&(this.eventHandlerAdded=!0,e.environments.onDidEnvironmentVariablesChange(t=>{d.debug(`Detected changes to env file ${t.resource?.uri?.path} in PythonApi`),this._onDidEnvironmentVariablesChange.fire()},this,this.disposables),e.environments.onDidChangeActiveEnvironmentPath(()=>{d.trace("Detected change in Active Python environment via Python API"),this.workspaceCachedActiveInterpreter.clear(),this.triggerEventIfAllowed("interpreterChangeEvent",void 0)},this,this.disposables),e.environments.onDidChangeEnvironments(async t=>{if(d.trace(`Python API env change detected, ${t.type} => '${t.env.id}'`),t.type==="remove"){this.triggerEventIfAllowed("interpreterChangeEvent",void 0),this.triggerEventIfAllowed("interpretersChangeEvent",void 0),this._onDidRemoveInterpreter.fire({id:t.env.id});return}let n=Ai(Tr(t.env));n&&(this.triggerEventIfAllowed("interpreterChangeEvent",n),this.triggerEventIfAllowed("interpretersChangeEvent",n))},this,this.disposables),this.didChangeInterpreters.fire(ho().map(Ai).filter(t=>!!t).map(t=>t)))}).catch(h)}};pg=y([(0,As.injectable)(),m(0,(0,As.inject)(Yt)),m(1,(0,As.inject)($e)),m(2,(0,As.inject)(O)),m(3,(0,As.inject)(ot))],pg);var dg=require("vscode");function Ck(r,e){let t=r.length>0?`?token=${r}`:"";return`${e}${t}`}function wk(r,e,t){return r?t.createSystemVariables(e).resolve(r):e?lt(De(e)):process.cwd()}async function Ek(r,e){let t=I.jupyterSelfCertEnable,n=I.jupyterSelfCertClose,i=await dg.window.showErrorMessage(I.jupyterSelfCertFail(e),{modal:!0},t,n);return i===t?(A("DATASCIENCE.SELFCERTSMESSAGEENABLED"),await r.updateSetting("allowUnauthorizedRemoteConnection",!0,void 0,dg.ConfigurationTarget.Workspace),!0):(i===n&&A("DATASCIENCE.SELFCERTSMESSAGECLOSE"),!1)}async function kk(r,e){let t=I.jupyterSelfCertEnable,n=I.jupyterSelfCertClose,i=await dg.window.showErrorMessage(I.jupyterExpiredCertFail(e),{modal:!0},t,n);return i===t?(A("DATASCIENCE.SELFCERTSMESSAGEENABLED"),await r.updateSetting("allowUnauthorizedRemoteConnection",!0,void 0,dg.ConfigurationTarget.Workspace),!0):(i===n&&A("DATASCIENCE.SELFCERTSMESSAGECLOSE"),!1)}function gx(r,e,t,n,i,o,s){let a=e.baseUrl,l=e.token,c=new URL(e.baseUrl).hostname,u=e.authorizationHeader&&Object.keys(e?.authorizationHeader??{}).length>0?e.authorizationHeader:void 0,p=u?()=>u:void 0,f={baseUrl:a,appUrl:"",wsUrl:a.replace("http","ws"),fetch:e.fetch,WebSocket:e.WebSocket},g=t.getRequestInit();(!(l===""||l==="null")||p)&&(f={...f,token:l,appendToken:!0});let b=i.getSettings(void 0).allowUnauthorizedRemoteConnection;if(a.startsWith("https")&&b&&n){let R=n.createHttpRequestAgent();g={...g,agent:R}}let{ServerConnection:C}=require("@jupyterlab/services");return f={...f,init:g,WebSocket:e.WebSocket?t.wrapWebSocketCtor(e.WebSocket):t.getWebsocketCtor(void 0,b,p),fetch:e.fetch||t.getFetchMethod(),Request:t.getRequestCtor(void 0,b,p),Headers:t.getHeadersCtor()},{baseUrl:a,providerId:r.id,serverProviderHandle:r,token:l,hostName:c,displayName:e&&e.displayName?e.displayName:Ck(l,a),dispose:()=>s?.dispose(),rootDirectory:o,getAuthHeader:p,settings:C.makeSettings(f)}}async function g9(r){let e=Lt(r);return va(e,"SHA-256")}var Vae=new Set([Ue,"ms-toolsai.vscode-ai","GitHub.codespaces"].map(r=>r.toLowerCase()));function Lt(r){return Vae.has(r.extensionId.toLowerCase())?`${qe.REMOTE_URI}?${qe.REMOTE_URI_ID_PARAM}=${r.id}&${qe.REMOTE_URI_HANDLE_PARAM}=${encodeURI(r.handle)}`:`${qe.REMOTE_URI}?${qe.REMOTE_URI_ID_PARAM}=${r.id}&${qe.REMOTE_URI_HANDLE_PARAM}=${encodeURI(r.handle)}&${qe.REMOTE_URI_EXTENSION_ID_PARAM}=${encodeURI(r.extensionId)}`}async function Pk(r){if(!zu()&&r.interpreter?.uri){let e=r.interpreter.uri.fsPath,t=bl(r.interpreter.uri).fsPath,n=r.id.replace(e,t);return mt(n)}return mt(r.id)}var Ns=class{static fromJSON(e){let t=Object.assign(e,{});switch(t.interpreter&&(t.interpreter=hx(t.interpreter,"")),e.kind){case"startUsingLocalKernelSpec":return fp.create(t);case"connectToLiveRemoteKernel":return vx.create(t);case"startUsingRemoteKernelSpec":return yx.create(t);case"startUsingPythonInterpreter":return qo.create(t);default:throw new Error(`Invalid object to be deserialized into a connection, kind = ${t.kind}`)}}},vx=class r{constructor(e){this.kind="connectToLiveRemoteKernel";this.kernelModel=e.kernelModel,this.interpreter=e.interpreter,this.baseUrl=e.baseUrl,this.id=e.id,this.serverProviderHandle=e.serverProviderHandle,_k(this)}static create(e){return new r(e)}updateModel(e){Object.assign(this.kernelModel,e)}getHashId(){return Pk(this)}toJSON(){return{id:this.id,kind:this.kind,baseUrl:this.baseUrl,interpreter:wm(this.interpreter),kernelModel:this.kernelModel,serverProviderHandle:this.serverProviderHandle}}static fromJSON(e){return Ns.fromJSON(e)}},fp=class r{constructor(e){this.kind="startUsingLocalKernelSpec";this.kernelSpec=e.kernelSpec,this.interpreter=e.interpreter,this.id=e.id,_k(this)}static create(e){return new r(e)}getHashId(){return Pk(this)}toJSON(){return{id:this.id,kernelSpec:this.kernelSpec,interpreter:wm(this.interpreter),kind:this.kind}}static fromJSON(e){return Ns.fromJSON(e)}},yx=class r{constructor(e){this.kind="startUsingRemoteKernelSpec";this.interpreter=e.interpreter,this.kernelSpec=e.kernelSpec,this.baseUrl=e.baseUrl,this.id=e.id,this.serverProviderHandle=e.serverProviderHandle,_k(this)}static create(e){return new r(e)}getHashId(){return Pk(this)}toJSON(){return{id:this.id,kernelSpec:this.kernelSpec,interpreter:wm(this.interpreter),baseUrl:this.baseUrl,kind:this.kind,serverProviderHandle:this.serverProviderHandle}}static fromJSON(e){return Ns.fromJSON(e)}},qo=class r{constructor(e){this.kind="startUsingPythonInterpreter";this.kernelSpec=e.kernelSpec,this.interpreter=e.interpreter,this.id=e.id,_k(this)}static create(e){return new r(e)}getHashId(){return Pk(this)}toJSON(){return{id:this.id,kernelSpec:this.kernelSpec,interpreter:wm(this.interpreter),kind:this.kind}}updateInterpreter(e){Object.assign(this.interpreter,e)}static fromJSON(e){return Ns.fromJSON(e)}};function ht(r){return r.kind==="startUsingLocalKernelSpec"||r.kind==="startUsingPythonInterpreter"}function Nt(r){return!ht(r)}var Te=Symbol("IKernelProvider"),Em=Symbol("IThirdPartyKernelProvider");var Dk=Symbol("IJupyterServerConnector"),bx=Symbol("IKernelSessionFactory");var Ms=Symbol("IKernelDependencyService"),Rr=Symbol("IKernelFinder"),mg=Symbol("ITracebackFormatter");var Wc=Symbol("IStartupCodeProviders"),v9=new Set;function _k(r){if(v9.has(r.id))return;v9.add(r.id);let e="kernelSpec"in r?r.kernelSpec:void 0,t=e?.language||(r.kind==="startUsingPythonInterpreter"?ye:void 0),n="",i="",o="interpreter"in r?r.interpreter:void 0,s="<#>",a;e&&Array.isArray(e.argv)&&e.argv.length>0&&(n=e.argv[0],a=n.toLowerCase()===o?.uri?.fsPath?.toLowerCase(),Ee(n)!==n&&(n=`<P>${Ee(n)}`),i=e.argv.map(g=>g.includes("/")||g.includes("\\")?`<P>${Ee(g)}`:g).join(s));let l="kernelSpec"in r&&r.kernelSpec.specFile?mt(r.kernelSpec.specFile):Promise.resolve(""),c=mt(r.id),u=Nt(r)?mt(Lt(r.serverProviderHandle)):Promise.resolve(""),p=Nt(r)?r.serverProviderHandle.extensionId:Ue,f=Nt(r)?mt(r.baseUrl.toLowerCase()):Promise.resolve("");Promise.all([l,c,u,f]).then(([g,v,b,C])=>A("DS_INTERNAL.JUPYTER_KERNEL_SPEC",void 0,{kernelId:v,serverIdHash:b,kernelSpecHash:g,baseUrlHash:C,providerExtensionId:p,kernelConnectionType:r.kind,kernelLanguage:t,envType:o&&Be(o),isArgv0SameAsInterpreter:a,argv0:n,argv:i})).catch(h)}var Mn=require("vscode");var ale=P(T9()),Vc=require("vscode");var hp=class{constructor(e,t,n,i){this.specFile=t;this.interpreterPath=n;this.isRegisteredByVSC=i;this.name=e.name,this.argv=e.argv,this.language=e.language,this.executable=e.argv&&e.argv.length>0?e.argv[0]:"",this.display_name=e.display_name,this.metadata=e.metadata,this.env=e.env,this.interrupt_mode=e.interrupt_mode}};var Wn=require("vscode"),L9=P($N());var HN=class{constructor(e,t,n,i=!1){this._impl=e;this.controllerId=t;this._endCallback=n;this.clearOutputOnStartWithTime=i;this._started=!1}get started(){return this._started}get cell(){return this._impl.cell}get token(){return this._impl.token}get executionOrder(){return this._impl.executionOrder}set executionOrder(e){e&&Nn(this._impl.cell.notebook)?.executeCellAcknowledged(),this._impl.executionOrder=e}startIfNecessary(){this.started||this._impl.start()}start(e){this.started||(this._started=!0,this._impl.start(e),this._startTime=e,this.clearOutputOnStartWithTime?(d.trace(`Start cell ${this.cell.index} execution @ ${e} (clear output)`),this._impl.clearOutput().then(h,h)):d.trace(`Start cell ${this.cell.index} execution @ ${e}`))}end(e,t){if(this._endCallback)try{this._impl.end(e,t,this.errorInfo),d.trace(`Cell ${this.cell.index} completed in ${((t||0)-(this._startTime||0))/1e3}s (start: ${this._startTime}, end: ${t})`)}finally{this._endCallback(),this._endCallback=void 0}}clearOutput(e){return this.startIfNecessary(),this._impl.clearOutput(e)}replaceOutput(e,t){return this.startIfNecessary(),this._impl.replaceOutput(e,t)}appendOutput(e,t){return this.startIfNecessary(),this._impl.appendOutput(e,t)}replaceOutputItems(e,t){return this.startIfNecessary(),this._impl.replaceOutputItems(e,t)}appendOutputItems(e,t){return this.startIfNecessary(),this._impl.appendOutputItems(e,t)}},Mi=class r{static{this._map=new WeakMap}static getOrCreate(e,t,n=!1){let i,o=e.document;if(i=this.get(e),!i)i=r.create(o,e,t,n);else if(i.controllerId!==t.id){let s=i;s.end(void 0),i=r.create(o,e,t,n),s.started&&i.start(new Date().getTime())}return i}static get(e){let t=e.document;return r._map.get(t)}static create(e,t,n,i=!1){let o=new HN(n.createNotebookCellExecution(t),n.id,()=>{r._map.delete(e)},i);return r._map.set(e,o),o}};function fg(r){return typeof Buffer<"u"&&typeof Buffer.from=="function"?Buffer.from(r,"base64"):Uint8Array.from(atob(r),e=>e.charCodeAt(0))}var tle=new TextDecoder;function Rk(r){if(typeof Buffer<"u"&&typeof Buffer.from=="function")return Buffer.from(r).toString("base64");{let e=tle.decode(r);return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(t,n){return String.fromCharCode(Number.parseInt("0x"+n))}))}}var M9=["application/vnd.*","application/vdom.*","application/geo+json","application/x-nteract-model-debug+json","text/html","application/javascript","image/gif","text/latex","text/markdown","image/png","image/svg+xml","image/jpeg","application/json","text/plain"];function O9(r){if(r.mime.startsWith("application/vnd."))try{return new TextDecoder().decode(r.data).length===0}catch{}return!1}function rle(r){return r.sort((e,t)=>{let n=(s,a)=>(s.endsWith(".*")&&(s=s.substr(0,s.indexOf(".*"))),a.startsWith(s)),i=M9.findIndex(s=>n(s,e.mime)),o=M9.findIndex(s=>n(s,t.mime));return O9(e)&&(i=-1),O9(t)&&(o=-1),i=i==-1?100:i,o=o==-1?100:o,i-o})}var gp=class r{static{this.cellStates=new WeakMap}static getCellState(e){return r.cellStates.get(e)?.state}static getCellStatus(e){return(r.cellStates.get(e)?.stateTransition||[]).join(", ")||""}static setCellState(e,t){let n=r.cellStates.get(e)?.start||new We,i=r.cellStates.get(e)?.stateTransition||[];i.push(`${t} ${i.length===0?"@ start":`After ${n.elapsedTime}ms`}`),r.cellStates.set(e,{stateTransition:i,state:t,start:n})}};function gt(r,e){let t=typeof e=="string"?()=>e:e;d.ci(()=>`Cell Index:${r.index}, of document ${vn(r.notebook.uri)} with state:${gp.getCellStatus(r)}, exec: ${r.executionSummary?.executionOrder}. ${t()}. called from ${_V()}`)}var gg=new Map;gg.set("display_data",Nk);gg.set("error",sle);gg.set("execute_result",Nk);gg.set("stream",nle);gg.set("update_display_data",Nk);function bo(r){let e=gg.get(r.output_type),t;return e?t=e(r):(d.warn(`Unable to translate cell from ${r.output_type} to NotebookCellData for VS Code.`),t=Nk(r)),t}function GN(r){let e={outputType:r.output_type};switch(r.transient&&(e.transient=r.transient),r.output_type){case"display_data":case"execute_result":case"update_display_data":{e.executionCount=r.execution_count,e.metadata=r.metadata?JSON.parse(JSON.stringify(r.metadata)):{};break}default:break}return e}function km(r){return r.metadata}function Nk(r){let e=GN(r);("image/svg+xml"in r.data||"image/png"in r.data)&&(e.__displayOpenPlotIcon=!0);let t=[];if(r.data)for(let n in r.data)t.push(ole(n,r.data[n]));return new Wn.NotebookCellOutput(rle(t),e)}function nle(r){let e=Ts(r.text),t=r.name==="stderr"?Wn.NotebookCellOutputItem.stderr:Wn.NotebookCellOutputItem.stdout;return new Wn.NotebookCellOutput([t(e)],GN(r))}function ile(r){if(r.items.length>0)return r.items[0].mime==="application/vnd.code.notebook.stderr"?"stderr":"stdout"}function K9(r){let e=r.items[0];if(!e.data)return{output_type:"error",ename:"",evalue:"",traceback:[]};let t=r.metadata?.originalError,n=JSON.parse(new TextDecoder().decode(e.data));return{output_type:"error",ename:n.name,evalue:n.message,traceback:t?.traceback||sg(n.stack||n.message||"")}}var hg=new TextDecoder,U9=["text/plain","text/markdown","application/vnd.code.notebook.stderr","application/vnd.code.notebook.stdout"];function Ak(r,e){if(!e)return"";try{if(r==="application/vnd.code.notebook.error"){let t=hg.decode(e);return JSON.parse(t)}else if(r.startsWith("text/")||U9.includes(r)){let t=hg.decode(e);return sg(t)}else{if(r.startsWith("image/")&&r!=="image/svg+xml")return Rk(e);if(r.toLowerCase().startsWith("application/vnd.holoviews_load.v")&&r.toLowerCase().endsWith("+json")){let t=hg.decode(e);try{return t.length>0?JSON.parse(t):t}catch{return t}}else if(r.toLowerCase().includes("json")){let t=hg.decode(e);return t.length>0?JSON.parse(t):t}else return hg.decode(e)}}catch(t){return d.error(`Failed to convert ${r} output from a buffer ${typeof e}, ${e}`,t),""}}function ole(r,e){if(!e)return Wn.NotebookCellOutputItem.text("",r);try{if((r.startsWith("text/")||U9.includes(r))&&(Array.isArray(e)||typeof e=="string")){let t=Array.isArray(e)?Ts(e):e;return Wn.NotebookCellOutputItem.text(t,r)}else return r.startsWith("image/")&&typeof e=="string"&&r!=="image/svg+xml"?new Wn.NotebookCellOutputItem(fg(e),r):typeof e=="object"&&e!==null&&!Array.isArray(e)?Wn.NotebookCellOutputItem.text(JSON.stringify(e),r):(e=Array.isArray(e)?Ts(e):e,Wn.NotebookCellOutputItem.text(e,r))}catch(t){return d.error(`Failed to convert ${r} output to a buffer ${typeof e}, ${e}`,t),Wn.NotebookCellOutputItem.text("")}}function F9(r){let e=[];r.items.filter(n=>n.mime==="application/vnd.code.notebook.stderr"||n.mime==="application/vnd.code.notebook.stdout").map(n=>hg.decode(n.data)).forEach(n=>{let i=n.split(`
|
||
`);e.length&&i.length&&i[0].length>0&&(e[e.length-1]=`${e[e.length-1]}${i.shift()}`);for(let o of i)e.push(o)});for(let n=0;n<e.length-1;n++)e[n]=`${e[n]}
|
||
`;return e.length&&e[e.length-1].length===0&&e.pop(),{output_type:"stream",name:ile(r)||"stdout",text:e}}function zN(r){let e=r.metadata,t;switch(e?.outputType){case"error":{t=K9(r);break}case"stream":{t=F9(r);break}case"display_data":{t={output_type:"display_data",data:r.items.reduce((i,o)=>(i[o.mime]=Ak(o.mime,o.data),i),{}),metadata:e?.metadata||{}};break}case"execute_result":{t={output_type:"execute_result",data:r.items.reduce((i,o)=>(i[o.mime]=Ak(o.mime,o.data),i),{}),metadata:e?.metadata||{},execution_count:typeof e?.executionCount=="number"?e?.executionCount:null};break}case"update_display_data":{t={output_type:"update_display_data",data:r.items.reduce((i,o)=>(i[o.mime]=Ak(o.mime,o.data),i),{}),metadata:e?.metadata||{}};break}default:{let i=r.items.length===1&&r.items.every(l=>l.mime==="application/vnd.code.notebook.error"),o=r.items.every(l=>l.mime==="application/vnd.code.notebook.stderr"||l.mime==="application/vnd.code.notebook.stdout");if(i)return K9(r);let s=e?.outputType||(o?"stream":"display_data");A("DS_INTERNAL.VSCNOTEBOOK_CELL_TRANSLATION_FAILED",void 0,{outputType:s});let a;s==="stream"?a=F9(r):s==="display_data"?a={data:{},metadata:{},output_type:"display_data"}:a={output_type:s},e?.metadata&&(a.metadata=e.metadata),r.items.length>0&&(a.data=r.items.reduce((l,c)=>(l[c.mime]=Ak(c.mime,c.data),l),{})),t=a;break}}return t&&e&&e.transient&&(t.transient=e.transient),t}function sle(r){return r=r||{output_type:"error",ename:"",evalue:"",traceback:[]},new Wn.NotebookCellOutput([Wn.NotebookCellOutputItem.error({name:r?.ename||"",message:r?.evalue||"",stack:(r?.traceback||[]).join(`
|
||
`)})],{...GN(r),originalError:r})}async function j9(r,e,t){let n=!1,i;if(!r)return{changed:n,kernelId:i};r?.language_info?.name||(r.language_info=r.language_info||{name:""});let o;switch(e?.kind){case"connectToLiveRemoteKernel":o=e.kernelModel.language;break;case"startUsingRemoteKernelSpec":case"startUsingLocalKernelSpec":o=e.kernelSpec.language;break;case"startUsingPythonInterpreter":o=ye;break;default:break}if(r.language_info.name!==o&&o&&(r.language_info.name=o,n=!0),t&&"language_info"in t&&t.language_info)(0,L9.default)(r.language_info,t.language_info)||(r.language_info=JSON.parse(JSON.stringify(t.language_info)),n=!0);else{let a=vt(e),l=a?V9(e):void 0,c=await ap(l),u=c?`${c.major}.${c.minor}.${c.micro}`:"";l&&c&&r&&r.language_info&&r.language_info.version!==u?(r.language_info.version=u,n=!0):!l&&r?.language_info&&a&&(r.language_info=void 0,n=!0)}let s=e&&vg(e)?e.kernelModel:e&&"kernelSpec"in e?e.kernelSpec:void 0;if(e?.kind==="startUsingPythonInterpreter"){let a=e.kernelSpec,l=a.display_name||Tr(e.interpreter)?.environment?.name||"",c="";switch(Vn(a)){case"registeredByOldVersionOfExt":case"registeredByNewVersionOfExt":c="python3";break;case"registeredByNewVersionOfExtForCustomKernelSpec":{c=(a.metadata?.vscode?.originalSpecFile?Ee(lt(a.metadata.vscode.originalSpecFile)):void 0)||a.name,l=a.metadata?.vscode?.originalDisplayName||l;break}default:c=a.name;break}r.kernelspec?.name!==c&&(n=!0,r.kernelspec={name:c,language:ye,display_name:l},"vscode"in r&&delete r.vscode,"interpreter"in r&&delete r.interpreter)}else if(s&&!r.kernelspec){let a=s.metadata?.vscode?.originalSpecFile?Ee(lt(s.metadata.vscode.originalSpecFile)):void 0;r.kernelspec={name:a||s.name||s.display_name||"",display_name:s.metadata?.vscode?.originalDisplayName||s.display_name||s.name||""},s.language&&(r.kernelspec.language=s.language),i=s.id,n=!0}else if(s&&r.kernelspec){let l=(s.metadata?.vscode?.originalSpecFile?Ee(lt(s.metadata.vscode.originalSpecFile)):void 0)||s.name||s.display_name||"",c=s.metadata?.vscode?.originalDisplayName||s.display_name||s.name||"",u=s.language||s.language||"";(r.kernelspec.name!==l||r.kernelspec.language!==u||r.kernelspec.display_name!==c||i!==s.id)&&(n=!0,r.kernelspec.name=l,r.kernelspec.display_name=c,r.kernelspec.language=u,i=s.id);try{delete r.kernelspec.metadata}catch{}}return{changed:n,kernelId:i}}async function vp(r,e,t,n){let i=zh(t);if(!i){let a=Mi.get(r);n&&a?.started&&a.end(n?void 0:!1,r.executionSummary?.timing?.endTime);return}Mi.get(r)||(n=!0);let o=Mi.getOrCreate(r,e),s=o.executionOrder;o.started||(o.start(r.executionSummary?.timing?.startTime),o.executionOrder=r.executionSummary?.executionOrder||s),await o.appendOutput(i),o.end(n?void 0:!1,r.executionSummary?.timing?.endTime)}function W9(r,e){let t=/Cell\s+(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\],\s*line (?<lineNumber>\d+).*/,n=/Input\s+?(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\][^<]*<cell line:\s?(?<lineNumber>\d+)>.*/,i;for(let s of r){let a=t.exec(s)??n.exec(s);if(a&&a.groups){i=parseInt(a.groups.lineNumber);break}}let o;if(i&&i>0&&i<=e.document.lineCount){let s=e.document.lineAt(i-1),a=s.text.split("#")[0].trimEnd().length;o=new Wn.Range(new Wn.Position(s.lineNumber,s.firstNonWhitespaceCharacterIndex),new Wn.Position(s.lineNumber,a))}return o}function Ix(r){if(r.hasOwnProperty("text/html")){let e=r["text/html"];typeof e=="string"&&e.includes('<iframe id="tensorboard-frame-')&&(r["text/html"]=e.replace(/new URL\((.*), window.location\)/,'new URL("http://localhost")'))}return r}var Pm="{connection_file}";function B9(r){return r.argv.findIndex(e=>e.includes(Pm))}var yg="-jvsc-",lle=/^python\d*.?\d*$/;async function Os(r,e){return cle(await ZN(r),r,e)}function cle(r,e,t){let n=e?{path:De(e.uri)}:{},i={name:r,language:"python",display_name:(e?Tr(e)?.environment?.name:"")||"Python 3",metadata:{interpreter:n},argv:["python","-m","ipykernel_launcher","-f",Pm],env:{},resources:{}},o=t&&i.name?er(t,i.name,"kernel.json"):void 0;return new hp(i,o?De(o):void 0,De(e?.uri),"registeredByNewVersionOfExt")}function q9(r){let e=JSON.parse(JSON.stringify(r));return e.env&&Object.keys(e.env).forEach(n=>{if(e.env){let i=e.env[n];i!=null&&(e.env[n]=i.toString())}}),e}function Mk(r){let e=r?.kernelspec;return r?.language_info?.name&&r.language_info.name!==ye?!1:e?.name?.includes(ye)?!0:e?.language===ye||r?.language_info?.name===ye}function xx(r){let e=r.metadata?.vscode?.originalSpecFile||r.metadata?.originalSpecFile,t=e?Ee(lt(e)):r.name||"",n=r.metadata?.vscode?.originalDisplayName||r.display_name||"";return!!(t.toLowerCase().match(lle)||n.toLowerCase()==="python 3 (ipykernel)"||n.toLowerCase()==="python 3")}function ule(r){if(r.includes(yg)){let e=/[a-f0-9]$/;if(r.substring(r.lastIndexOf(yg)+yg.length).search(e)!==-1){let t=r.substring(0,r.lastIndexOf(yg));return t.toLowerCase().endsWith(".ipynb")||t.toLowerCase().endsWith(".py")?t:`${t}.ipynb`}}return r}function Ok(r){return r.kind!=="connectToLiveRemoteKernel"}function vg(r){return r.kind==="connectToLiveRemoteKernel"}function Oi(r,e,t){e=QN(r)?e:void 0;let n=r.name,i=Vn(r);if(i&&n.includes(Sx)&&(n=n.substring(n.indexOf(Sx)),i==="registeredByNewVersionOfExtForCustomKernelSpec")){let c=r.metadata?.vscode?.originalSpecFile||r.metadata?.originalSpecFile;c&&(n=`${n}#${Ee(lt(c))}`)}let o="";QN(r)?o=r.argv.slice(1).filter(c=>!["-f","{connection_file}"].includes(c)).join("#").toLowerCase():o=r.argv.join("#").toLowerCase();let s=t?`${t}.`:"",a=De(bl(r.interpreterPath?Vc.Uri.file(r.interpreterPath):Vc.Uri.file(r.executable))),l=De(bl(e?.uri))||"";return`${s}${r.id||""}.${n}.${a}.${l}.${o}`}function ct(r){let e=ple(r);if(!r)return e;switch(r.kind){case"connectToLiveRemoteKernel":{let n=ule(r.kernelModel?.notebook?.path||r.kernelModel?.model?.path||"");return n?`${e} (${n})`:e}case"startUsingRemoteKernelSpec":case"startUsingLocalKernelSpec":if(r.interpreter&&Be(r.interpreter)!=="Unknown"){let n=jo(r.interpreter);if(r.kernelSpec.language===ye){let i=`Python ${op(Yi(r.interpreter))||""}`.trim();return n?`${e} (${i})`:e}else return n?`${e} (${n})`:e}else return e;case"startUsingPythonInterpreter":let t=(op(Yi(r.interpreter))||"").trim();if(r.interpreter&&Be(r.interpreter)!=="Unknown"){if(r.kernelSpec.display_name&&Vn(r.kernelSpec)==="registeredByNewVersionOfExtForCustomKernelSpec")return r.kernelSpec.display_name;let n=Hr(r.interpreter),i=t.trim()?`Python ${t}`:"Python",o=jo(r.interpreter);return n&&o?o:o?`${o} (${i})`:i}else return`Python ${t}`.trim()}return e}function ple(r){if(!r)return"";let e=r.kind==="connectToLiveRemoteKernel"?r.kernelModel.display_name:r.kernelSpec?.display_name,t=r.kind==="connectToLiveRemoteKernel"?r.kernelModel.name:r.kernelSpec?.name,n=r.kind==="startUsingPythonInterpreter"?Yr(r.interpreter):void 0;return[e,t,n,""].find(i=>typeof i=="string"&&i.length>0)||""}function bg(r,e=""){return r?r.kind==="connectToLiveRemoteKernel"?r.kernelModel.name:r.kernelSpec?.name:e}function dle(r){if(!r)return;let e=vg(r)?r.kernelModel:void 0,t=Ok(r)?r.kernelSpec:void 0;if(r.kind==="startUsingPythonInterpreter"||(r.kind==="startUsingRemoteKernelSpec"||r.kind==="startUsingLocalKernelSpec")&&r.kernelSpec.language===ye){let n=t?.metadata?.interpreter?.path||t?.interpreterPath||t?.executable;if(n==="/python"||n==="python"){let i=Tr(r.interpreter);return i?.environment?.folderUri||(i?Vc.Uri.file(i.path):void 0)}return n?Vc.Uri.file(n):void 0}else{let n=e?.executable||t?.executable||t?.metadata?.interpreter?.path||t?.interpreterPath;return n?Vc.Uri.file(n):void 0}}function YN(r,e=""){if(r?.kind==="connectToLiveRemoteKernel"){let t;if(typeof r.kernelModel.lastActivityTime=="string")try{t=new Date(r.kernelModel.lastActivityTime)}catch(n){d.debug(`Error parsing date ${n}`)}else t=r.kernelModel.lastActivityTime;return I.jupyterSelectLiveRemoteKernelDescription(t,r.kernelModel.numberOfConnections)}return e}function XN(r,e){if(r?.kind==="connectToLiveRemoteKernel")return;let t=dle(r),n=Vc.workspace.workspaceFolders?Vc.workspace.workspaceFolders:[];return t?B(t,n,e.homeDir):""}function V9(r){if(!r)return;if(r.interpreter)return r.interpreter;let e=vg(r)?r.kernelModel:void 0;if(e?.metadata?.interpreter)return hx(e?.metadata?.interpreter,"");let t=Ok(r)?r.kernelSpec:void 0;return hx(t?.metadata?.interpreter,"")}function Ig(r){return r.kind==="startUsingLocalKernelSpec"||r.kind==="startUsingPythonInterpreter"&&r.kernelSpec&&Vn(r.kernelSpec)==="registeredByNewVersionOfExtForCustomKernelSpec"}function vt(r){if(!r)return!1;if(r.kind==="startUsingPythonInterpreter")return!0;let e=vg(r)?r.kernelModel:void 0,t=Ok(r)?r.kernelSpec:void 0;return e?.language===ye||QN(t)}function QN(r){return(r?.language||"").toLowerCase()===ye}function Io(r){if(!r)return;if(r.kind==="startUsingPythonInterpreter")return ye;let e=vg(r)?r.kernelModel:void 0,t=Ok(r)?r.kernelSpec:void 0;return e?.language||J9(t)}function Kk(r){if(!r)return;let e=r.kernelspec;return J9(e)||r.language_info?.name}function J9(r){return r?.language}var Sx="jvsc74a57bd0";async function ZN(r){let t=(op(Yi(r))||"3").replace(/\./g,""),n=r?`python${t}`:"";return r?`${n}${Sx}${await Il(r)}`:"python3"}function Vn(r){if(r.isRegisteredByVSC)return r.isRegisteredByVSC;if(!r.name)return;let e=r.metadata?.vscode?.originalSpecFile||r.metadata?.originalSpecFile,t=e?Ee(lt(e)):r.name,n=xx({...r,name:t})?Object.keys(r.env||{}).length>0:typeof e=="string"&&!e.includes(Sx);if(r.name.includes(Sx))return n?"registeredByNewVersionOfExtForCustomKernelSpec":"registeredByNewVersionOfExt";let i=/[a-f0-9]{32}$/;if(r.metadata?.interpreter&&r.name.toLowerCase().search(i)!==-1)return"registeredByOldVersionOfExt"}function $9(r,e){return!r&&!e?!0:!r&&e||r&&!e?!1:r?.id===e?.id}async function bn(r,e,t){d.trace(`Executing silently Code (${r.status}) = ${Fe(e.substring(0,100)).join("\\n")}`);let n=require("@jupyterlab/services"),i=r.requestExecute({code:e.replace(/\r\n/g,`
|
||
`),silent:!1,stop_on_error:!1,allow_stdin:!0,store_history:!1},!0),o=[];i.onIOPub=a=>{if(n.KernelMessage.isStreamMsg(a))if(d.ci(`Got io pub message (stream), ${Fe(a.content.text.substr(0,100)).join("\\n")}`),o.length>0&&o[o.length-1].output_type==="stream"&&o[o.length-1].name===a.content.name){let l=o[o.length-1];l.text+=a.content.text}else{let l={name:a.content.name,text:a.content.text,output_type:"stream"};o.push(l)}else if(n.KernelMessage.isExecuteResultMsg(a)){d.ci("Got io pub message (execresult)}");let l={data:a.content.data,execution_count:a.content.execution_count,metadata:a.content.metadata,output_type:"execute_result"};o.push(l)}else if(n.KernelMessage.isDisplayDataMsg(a)){d.ci("Got io pub message (displaydata)}");let l={data:a.content.data,metadata:a.content.metadata,output_type:"display_data"};o.push(l)}else if(n.KernelMessage.isErrorMsg(a)){if(d.ci(`Got io pub message (error), ${a.content.ename},${a.content.evalue}, ${a.content.traceback.join().substring(0,100)}}`),t?.traceErrors){let c=`${t.traceErrorsMessage||"Failed to execute (silent) code against the kernel"},
|
||
Code = ${e}
|
||
Error details: `;d.error(`${c} ${a.content.ename},${a.content.evalue}, ${a.content.traceback.join()}`)}let l={ename:a.content.ename,evalue:a.content.evalue,traceback:a.content.traceback,output_type:"error"};o.push(l)}else d.ci(`Got io pub message (${a.header.msg_type})`)},await i.done;let s=Fe(e.substring(0,100)).join("\\n");return t&&mle(o,t,s),d.trace(`Executing silently Code (completed) = ${s} with ${o.length} output(s)`),o}function H9(r,e,t,n){e=e.replace(/\r\n/g,`
|
||
`);let i=require("@jupyterlab/services"),o=r.requestExecute({code:e,silent:!1,stop_on_error:!1,allow_stdin:!1,store_history:!1},!0),s=jt(t);return o.onIOPub=a=>{s(),i.KernelMessage.isStreamMsg(a)?n(bo({output_type:"stream",name:a.content.name,text:a.content.text})):i.KernelMessage.isExecuteResultMsg(a)?n(bo({output_type:"execute_result",data:a.content.data,metadata:a.content.metadata,transient:a.content.transient,execution_count:a.content.execution_count})):i.KernelMessage.isDisplayDataMsg(a)?n(bo({output_type:"display_data",data:Ix(a.content.data),metadata:a.content.metadata,transient:a.content.transient})):i.KernelMessage.isUpdateDisplayDataMsg(a)?n(bo({output_type:"display_data",data:Ix(a.content.data),metadata:a.content.metadata,transient:a.content.transient})):i.KernelMessage.isErrorMsg(a)?n(bo({output_type:"error",ename:a.content.ename,evalue:a.content.evalue,traceback:a.content.traceback})):i.KernelMessage.isExecuteInputMsg(a)||i.KernelMessage.isStatusMsg(a)||d.warn(`Got unexpected io pub message when executing code sillenty (${a.header.msg_type})`)},o}function mle(r,e,t){r.filter(n=>n.output_type==="error").forEach(n=>{let i=n,o=`${i.ename}: ${i.evalue}
|
||
${i.traceback.map(a=>` ${a}`).join(`
|
||
`)}`,s=`${e.traceErrorsMessage||""} ${t} ${o}`;e.traceErrors?d.error(s):d.warn(s),e.telemetryName&&A(e.telemetryName)})}var Fk="application/vnd.vscode.chat_message",G9=`
|
||
def __VSCODE_inject_module():
|
||
|
||
def __VSCODE_call_function(function, callback, data=None):
|
||
__VSCODE_send_chat_message__(function, data, callback=callback)
|
||
|
||
def __VSCODE_send_chat_message__(function, data, callback):
|
||
requests = {}
|
||
try:
|
||
requests = __VSCODE_send_chat_message__.__requests
|
||
except Exception:
|
||
__VSCODE_send_chat_message__.__requests = requests
|
||
|
||
import uuid as __VSCODE_send_chat_message__uuid
|
||
import IPython.display as __VSCODE_send_chat_message__ipython_display
|
||
|
||
id = str(__VSCODE_send_chat_message__uuid.uuid4())
|
||
requests[id] = callback
|
||
data_is_none = data is None
|
||
__VSCODE_send_chat_message__ipython_display.display({"${Fk}": data}, metadata={"id":id, "function": function, "dataIsNone": data_is_none}, raw=True)
|
||
|
||
del __VSCODE_send_chat_message__ipython_display
|
||
del __VSCODE_send_chat_message__uuid
|
||
|
||
def __VSCODE_on_chat_message(id, data):
|
||
requests = {}
|
||
try:
|
||
requests = __VSCODE_send_chat_message__.__requests
|
||
except Exception:
|
||
__VSCODE_send_chat_message__.__requests = requests
|
||
|
||
if id in requests:
|
||
requests[id](data)
|
||
del requests[id]
|
||
else:
|
||
raise NotImplementedError(f"Callback not found for message {id}")
|
||
|
||
import sys as __VSCODE_send_chat_message__sys
|
||
import IPython as __VSCODE_send_chat_message__IPython
|
||
chat = type(__VSCODE_send_chat_message__IPython)("chat")
|
||
chat.send_message = __VSCODE_send_chat_message__
|
||
chat.call_function = __VSCODE_call_function
|
||
chat.__on_message = __VSCODE_on_chat_message
|
||
__VSCODE_send_chat_message__sys.modules["vscode"] = type(__VSCODE_send_chat_message__IPython)("vscode")
|
||
__VSCODE_send_chat_message__sys.modules["vscode"].chat = chat
|
||
del __VSCODE_send_chat_message__sys
|
||
del __VSCODE_send_chat_message__IPython
|
||
|
||
|
||
__VSCODE_inject_module()
|
||
del __VSCODE_inject_module
|
||
`,fle=[[new RegExp("\\\\","g"),"\\\\"],[new RegExp('"',"g"),'\\"'],[new RegExp("'","g"),"'"],[new RegExp("\\\b","g"),"\\b"],[new RegExp("\\f","g"),"\\f"],[new RegExp("\\n","g"),"\\n"],[new RegExp("\\r","g"),"\\r"],[new RegExp("\\t","g"),"\\t"]];function z9(r,e){let t=Cx(e),n=typeof t=="string"?`"${t}"`:"None";return`
|
||
import vscode as __vscode
|
||
try:
|
||
__vscode.chat.__on_message('${r}', ${n})
|
||
finally:
|
||
del __vscode
|
||
`}function Cx(r){if(typeof r!="string")return r;for(let[e,t]of fle)r=r.replace(e,t);return r}var wx=new WeakMap;function Lk(r,e,t){let i=km(t)?.transient?.display_id;if(t.metadata?.outputType!=="display_data"||!i)return;let o=wx.get(e)||new Map;wx.set(e,o);let s=o.get(r)||[];o.set(r,s),s.push(i),s.length>1e3&&s.shift()}function Q9(r,e){let t=wx.get(r)||new Map;for(let n of t.values())if(n.includes(e))return!0;return!1}function Y9(r,e,t){return((wx.get(e)||new Map).get(r)||[]).includes(t)}function X9(r,e){let t=wx.get(r)||new Map;for(let n of t.values()){let i=n.indexOf(e);i>=0&&n.splice(i,1)}}var wn=require("vscode");var Sg=new Map,Z9=new Set,Wk=new wn.EventEmitter;ma(Wk);function e3(r){return Wk.event(r)}async function t3(r){if(!wn.workspace.isTrusted)return{accessAllowed:!1};if(r===Ue)return{accessAllowed:!0};let e=Sg.get(r);return e||(e=hle(r),Sg.set(r,e),e.then(({result:t})=>{(t==="learnMore"||t==="cancelled")&&Sg.get(r)===e&&(Sg.delete(r),Z9.add(r))})),e.then(({result:t})=>({accessAllowed:t==="allowed"}))}async function hle(r){let e=await eM();if(e.get(r)===!0)return{result:"allowed"};if(e.get(r)===!1)return{result:"denied"};let t=wn.extensions.getExtension(r)?.packageJSON?.displayName;if(!t)return d.error(`Kernel API access revoked, as extension ${r} does not exist!`),{result:"denied"};let n=wn.l10n.t("Allow"),i=wn.l10n.t("Deny"),o=await wn.window.showInformationMessage(wn.l10n.t("Do you want to grant Kernel access to the extension {0} ({1})?",t,r),{modal:!0,detail:wn.l10n.t("This allows the extension to execute code against Jupyter Kernels.")},n,me.learnMore,i);switch(o===me.learnMore?wn.env.openExternal(wn.Uri.parse("https://aka.ms/vscodeJupyterKernelApiAccess")).then(h,h):(o===n||o===i)&&await gle(r,o===n),o){case n:return{result:"allowed"};case me.learnMore:return{result:"learnMore"};case i:return{result:"denied"};default:return{result:"cancelled"}}}async function r3(){let r=new Set,[e]=await Promise.all([eM().then(t=>new Map(t)),...Array.from(Sg.entries()).map(async([t,n])=>{(await n).result!=="allowed"&&r.add(t)})]);return r.forEach(t=>e.set(t,!1)),Z9.forEach(t=>e.set(t,e.get(t)===!0)),e}var Uk="API.Access",yp;async function eM(r=!1){let e=xe.instance.get(ot);if(e.extensionMode===wn.ExtensionMode.Test)return new Map;if(jt(()=>{xe.instance.get(O).push(e.secrets.onDidChange(i=>{i.key===Uk&&(yp=void 0)}))})(),yp&&!r)return yp;let t="";try{return t=await e.secrets.get(Uk),!t||t.length===0?new Map:(yp=new Map(Object.entries(JSON.parse(t))),yp)}catch(n){return d.error(`Failed to parse API access information ${t}`,n),new Map}}var jk=Promise.resolve();async function n3(r){return jk=jk.then(async()=>{await Promise.all(Array.from(Sg.entries()).map(async([t,n])=>{let i=await n;i.result=r.includes(t)===!0?"allowed":"denied"})),yp=new Map(r.map(t=>[t,!0]));let e=xe.instance.get(ot);if(e.extensionMode!==wn.ExtensionMode.Test)try{await e.secrets.store(Uk,JSON.stringify(Object.fromEntries(yp))),Wk.fire()}catch(t){d.error(`Failed to update API access information ${JSON.stringify(Object.fromEntries(yp))}`,t)}})}async function gle(r,e){return jk=jk.then(async()=>{let t=xe.instance.get(ot);if(t.extensionMode===wn.ExtensionMode.Test)return;let n=await eM(!0);if(e!==n.get(r)){n.set(r,e);try{await t.secrets.store(Uk,JSON.stringify(Object.fromEntries(n))),Wk.fire()}catch(i){d.error(`Failed to store API access information ${JSON.stringify(Object.fromEntries(n))}`,i)}}})}var i3=" (Interactive)",pt=Symbol("IControllerRegistration");var Vk=Symbol("IRemoteNotebookKernelSourceSelector"),Bk=Symbol("ILocalNotebookKernelSourceSelector"),Dm=Symbol("ILocalPythonNotebookKernelSourceSelector"),bp=Symbol("IConnectionDisplayData");var rM=class extends pE{constructor(t,n){super();this.controller=t;this.notebook=n}dispose(){this.disposeExistingExecution()}createReferencedObject(t,...n){return this.existingExecutions||(this.existingExecutions=this.controller.createNotebookExecution(this.notebook),this.existingExecutions.start()),this.existingExecutions}destroyReferencedObject(t,n){this.disposeExistingExecution()}disposeExistingExecution(){try{this.existingExecutions?.end()}catch{}this.existingExecutions=void 0}},nM=class r{constructor(e,t,n){this.extensionId=e;this.kernel=t;this.executionRefCountedDisposableFactory=n?new rM(n,t.notebook):void 0;let i=Mn.extensions.getExtension(e)?.packageJSON?.displayName||e;this.notebook=Mn.workspace.notebookDocuments.find(o=>o.uri.toString()===t.resourceUri?.toString()),this.controllerDisplayName=ct(t.kernelConnectionMetadata),this.title=Mn.l10n.t("Executing code in {0} from {1}",this.controllerDisplayName,i),this.eventHandler=Mn.window.onDidChangeVisibleNotebookEditors(this.showProgressImpl,this)}static{this.notificationsPerExtension=new WeakMap}dispose(){this.eventHandler.dispose(),this.disposable?.dispose(),this.executionRefCountedDisposableFactory?.dispose()}show(){let e=this.executionRefCountedDisposableFactory?.acquire("");if(this.deferred&&!this.deferred.completed){let t=this.deferred;this.deferred=oe(),t.resolve()}else this.deferred=oe(),this.showProgress().catch(h);return this.disposable=new Mn.Disposable(()=>{e?.dispose(),this.deferred?.resolve()})}async showProgress(){await Ei(1e3),!(!this.deferred||this.deferred.completed||this.displayInProgress)&&(this.shouldDisplayProgress=!0,await Promise.all([this.showProgressImpl(),this.waitUntilCompleted()]),this.shouldDisplayProgress=!1)}async showProgressImpl(){let e=r.notificationsPerExtension.get(this.kernel)||new Set;r.notificationsPerExtension.set(this.kernel,e),!e.has(this.extensionId)&&(e.add(this.extensionId),!(!this.notebook||!this.shouldDisplayProgress)&&Mn.window.visibleNotebookEditors.some(t=>t.notebook===this.notebook)&&(this.displayInProgress=!0,await Mn.window.withProgress({location:Mn.ProgressLocation.Notification,title:this.title},async()=>this.waitUntilCompleted()),this.displayInProgress=!1))}async waitUntilCompleted(){let e=this.deferred;for(;e&&!e.completed;)await e.promise,e=this.deferred}},iM=class r extends tr{constructor(t,n,i,o){super();this.extensionId=t;this.kernel=n;this.execution=i;this._onDidChangeStatus=this._register(new Mn.EventEmitter);this._onDidReceiveDisplayUpdate=this._register(new Mn.EventEmitter);this.progress=this._register(new nM(t,n,o)),this._register(Ia(n.onDisposed)(()=>this.progress.dispose())),this.language=n.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel"?ye:n.kernelConnectionMetadata.kernelSpec.language||ye,this._register(this.kernel.onStatusChanged(()=>this._onDidChangeStatus.fire(this.kernel.status))),this._register(i.onDidReceiveDisplayUpdate(a=>{let l=this.kernel.session,c=km(a);c?.outputType==="display_data"&&c?.transient?.display_id&&l&&Y9(this.extensionId,l,c?.transient?.display_id)&&this._onDidReceiveDisplayUpdate.fire(a)}));let s=this;this._api=Object.freeze({language:this.language,get status(){return s.kernel.status},onDidChangeStatus:s.onDidChangeStatus.bind(this),get onDidReceiveDisplayUpdate(){if(![Ue,Hj].includes(t))throw new Error(`Proposed API is not supported for extension ${t}`);return s.onDidReceiveDisplayUpdate.bind(this)},executeCode:(a,l)=>this.executeCode(a,l),executeChatCode:(a,l,c)=>this.executeChatCode(a,l,c)})}get status(){return this.kernel.status}get onDidChangeStatus(){return this._onDidChangeStatus.event}get onDidReceiveDisplayUpdate(){return this._onDidReceiveDisplayUpdate.event}static createApiKernel(t,n,i,o){let s=new r(t,n,i,o);return xe.instance.get(O).push(s),s._api}async checkAccess(){if(this.extensionId===Ue)return;if(this.accessAllowed||(this.accessAllowed=this.doCheckAccess(),this._register(e3(()=>this.accessAllowed=void 0))),!await this.accessAllowed)throw new Error(Mn.l10n.t("Access to Jupyter Kernel has been revoked"))}async doCheckAccess(){let n=(await t3(this.extensionId)).accessAllowed;return A("DATASCIENCE.JUPYTER_NEW_KERNELS_API_USAGE",void 0,{extensionId:this.extensionId,pemUsed:"getKernel",accessAllowed:n}),n}async*executeCode(t,n){await this.checkAccess();for await(let i of this.executeCodeInternal(t,void 0,n))yield i}async*executeChatCode(t,n,i){if(await this.checkAccess(),!["ms-vscode.dscopilot-agent",Ue].includes(this.extensionId.toLowerCase()))throw new Error(`Proposed API is not supported for extension ${this.extensionId}`);if(!vt(this.kernel.kernelConnectionMetadata))throw new Error("Chat code execution is only supported for Python kernels");for await(let s of this.executeCodeInternal(t,n,i))yield s}async*executeCodeInternal(t,n={},i){let o=!1,s={executionCount:this.execution.executionCount,requestSentAfter:0,requestAcknowledgedAfter:0,cancelledAfter:0,duration:0},a={kernelId:"",extensionId:this.extensionId,cancelled:!1,requestSent:!1,requestAcknowledged:!1,cancelledBeforeRequestSent:!1,cancelledBeforeRequestAcknowledged:!1,mimeTypes:"",failed:!1},l=new We,c=new Set;if(vle(this.extensionId,this.kernel,"executeCode",s.executionCount).catch(h),this.kernel.disposed)throw a.failed=!0,tM(this.kernel,s,a).catch(h),new Error("Kernel is disposed");if(!this.kernel.session?.kernel)throw a.failed=!0,tM(this.kernel,s,a).catch(h),this.kernel.status==="dead"||this.kernel.status==="terminating"?new Error("Kernel is dead or terminating"):new Error("Kernel connection not available to execute 3rd party code");let u=[];u.push({dispose:()=>{s.duration=l.elapsedTime,a.mimeTypes=Array.from(c).join(","),o=!0,tM(this.kernel,s,a).catch(h)}});let p=xe.instance.get(Te).getKernelExecution(this.kernel),f={started:new Mn.EventEmitter,executionAcknowledged:new Mn.EventEmitter};f.started.event(()=>{a.requestSent=!0,s.requestSentAfter=l.elapsedTime,!i.isCancellationRequested&&this.extensionId!==Ue&&u.push(this.progress.show())},this,u),f.executionAcknowledged.event(()=>{a.requestAcknowledged=!0,s.requestAcknowledgedAfter=l.elapsedTime},this,u),i.onCancellationRequested(()=>{o||(a.cancelled=!0,s.cancelledAfter=l.elapsedTime,a.cancelledBeforeRequestSent=!a.requestSent,a.cancelledBeforeRequestAcknowledged=!a.requestAcknowledged,d.debug(`Code execution cancelled by extension ${this.extensionId}`))},this,u);try{for await(let g of p.executeCode(t,this.extensionId,f,i))if(Lk(this.extensionId,this.kernel.session,g),g.items.forEach(v=>c.add(v.mime)),n&&o3(g))for await(let v of this.handleChatOutput(g,p,f,c,n,i))yield v;else yield g}finally{z(u)}}async*handleChatOutput(t,n,i,o,s={},a){let l=t.items.find(C=>C.mime===Fk);if(!l)return;let c=(t.metadata||{}).metadata,u=c.function,p=c.id,f=c.dataIsNone?void 0:new TextDecoder().decode(l.data),g=s[u];if(!g)throw new Error(`Chat Function ${u} not found`);let v=await g(f),b=z9(p,v);for await(let C of n.executeCode(b,this.extensionId,i,a))if(C.items.forEach(E=>o.add(E.mime)),o3(C))for await(let E of this.handleChatOutput(C,n,i,o,s,a))yield E;else yield C}};function o3(r){return r.items.some(e=>e.mime===Fk)}async function vle(r,e,t,n){let i=await mt(e.id);A("DATASCIENCE.JUPYTER_NEW_KERNEL_API_USAGE",{executionCount:n},{kernelId:i,pemUsed:t,extensionId:r})}async function tM(r,e,t){t.kernelId=await mt(r.id),A("DATASCIENCE.JUPYTER_NEW_KERNEL_API_EXEC",e,t)}function qk(r,e){let t=xe.instance.get(Te),n=xe.instance.get(pt).getSelected(e.notebook)?.controller;return iM.createApiKernel(r,e,t.getKernelExecution(e),n)}var s3=new WeakMap;function l3(r){return{async getKernel(e){let t,n=xe.instance.get(Te),i=a3.workspace.notebookDocuments.find(l=>l.uri.toString()===e.toString()),o=n.get(i||e);if(!o||!o.startedAtLeastOnce){A("DATASCIENCE.JUPYTER_NEW_KERNELS_API_USAGE",void 0,{extensionId:r,pemUsed:"getKernel",accessAllowed:t});return}let s=n.getKernelExecution(o);if(!Nt(o.kernelConnectionMetadata)&&s.executionCount===0){A("DATASCIENCE.JUPYTER_NEW_KERNELS_API_USAGE",void 0,{extensionId:r,pemUsed:"getKernel",accessAllowed:t});return}let a=s3.get(o)||qk(r,o);return s3.set(o,a),a}}}var Ip=Symbol("JupyterServerHelper"),Jk=Symbol("INotebookImporter"),xg=Symbol("INotebookExporter"),Sp=Symbol("IJupyterInterpreterDependencyManager"),Cg=Symbol("INbConvertInterpreterDependencyChecker"),$k=Symbol("INbConvertExportToPythonService"),wg=Symbol("IJupyterServerProvider"),zt=Symbol("IJupyterServerUriStorage"),Hk=Symbol("IJupyterKernelService"),xp=Symbol("IJupyterRequestAgentCreator"),Bc=Symbol("IJupyterRequestCreator"),Gk=Symbol("INotebookStarter"),_m=Symbol("ILiveRemoteKernelConnectionUsageTracker"),zk=Symbol("IJupyterRemoteCachedKernelValidator"),$t=Symbol("IJupyterServerProviderRegistry");function Qk(r,e,t,n,i){A("DATASCIENCE.JUPYTER_API_USAGE",void 0,{clientExtId:n,pemUsed:"createJupyterServerCollection"});let s=i.get($t).createJupyterServerCollection(n,r,kh(e),t);return{dispose:()=>{s?.dispose()},get id(){return r},set label(l){s.label=kh(l)},get label(){return s.label},set documentation(l){s.documentation=l},get documentation(){return s.documentation},set commandProvider(l){s.commandProvider=l},get commandProvider(){return s.commandProvider}}}var c3=!1;function u3(r,e){if(c3)return;c3=!0,e.get(Yt).setApi(r)}var kp=require("vscode");var Eg=P(M());var Dl=P(M());var Cp=class extends ze{constructor(t,n){super("remotejupyterserveruriprovider",n.message||n.toString());this.serverProviderHandle=t;this.originalError=n}};var Jo=class extends ze{constructor(e){super("jupyterselfcert",e)}static isSelfCertsError(e){return e.message.indexOf("reason: self signed certificate")>=0}};var kl=class extends ze{constructor(e){super("jupyterselfexpiredcert",e)}static isSelfCertsExpiredError(e){return e.message.indexOf("reason: certificate has expired")>=0}};var Zr=Symbol("IDataScienceErrorHandler"),On=class extends ze{constructor(t,n,i){super(t,n);this.kernelConnectionMetadata=i}},Pl=class extends cn{constructor(t,n,i){super(t,n);this.kernelConnectionMetadata=i}};var Ki=class extends ze{constructor(t,n,i){super("remotejupyterserverconnection",I.remoteJupyterConnectionFailedWithServerWithError(p3(t),i.message||i.toString()));this.url=t;this.serverProviderHandle=n;this.originalError=i;this.baseUrl=p3(t)}};function p3(r){let e=new URL(r);return`${e.protocol}//${e.host}/`}var Ex=require("vscode");var d3=require("vscode");var wp=class r extends Yn{constructor(t){super();this.serverSettings=t;this._isDisposing=!1;this.kernelSpecManager=new this.jupyterlab.KernelSpecManager({serverSettings:this.serverSettings}),this.kernelManager=new this.jupyterlab.KernelManager({serverSettings:this.serverSettings}),this.sessionManager=new this.jupyterlab.SessionManager({serverSettings:this.serverSettings,kernelManager:this.kernelManager}),this.contentsManager=new this.jupyterlab.ContentsManager({serverSettings:this.serverSettings})}get jupyterlab(){return this._jupyterlab||(this._jupyterlab=require("@jupyterlab/services")),this._jupyterlab}static create(t){return new r(t)}dispose(){this.isDisposed||this._isDisposing||(this._isDisposing=!0,(async()=>{d.trace("Disposing Jupyter Lab Helper");try{this.contentsManager&&(d.trace("SessionManager - dispose contents manager"),this.contentsManager.dispose()),this.sessionManager&&!this.sessionManager.isDisposed&&(d.trace("ShutdownSessionAndConnection - dispose session manager"),await br(1e4,this.sessionManager.ready),this.sessionManager.dispose()),this.kernelManager?.isDisposed||this.kernelManager?.dispose(),this.kernelSpecManager?.isDisposed||this.kernelSpecManager?.dispose()}catch(t){d.error("Exception on Jupyter Lab Helper shutdown: ",t)}finally{d.trace("Finished disposing Jupyter Lab Helper")}})().catch(h).finally(()=>super.dispose()))}async getRunningSessions(){if(!this.sessionManager)return[];await br(1e4,this.sessionManager.ready).catch(h),await this.sessionManager.refreshRunning();let t=[],n=this.sessionManager.running(),i=n.next();for(;i;)t.push(i),i=n.next();return t}async getRunningKernels(){let t=await this.jupyterlab.KernelAPI.listRunning(this.serverSettings),n=new Set;return t.map(i=>{let o=i;return{id:i.id,name:i.name,lastActivityTime:o.last_activity?new Date(Date.parse(o.last_activity.toString())):new Date,numberOfConnections:o.connections?parseInt(o.connections.toString(),10):0}}).filter(i=>n.has(i.id)?!1:(n.add(i.id),!0))}async getKernelSpecs(){if(!this.serverSettings||!this.sessionManager||!this.contentsManager)throw new yn;try{let t=new We,n=this.kernelSpecManager;if(!n)return d.error(`No SessionManager to enumerate kernelspecs (no specs manager). Returning a default kernel. Specs ${JSON.stringify(this.kernelSpecManager?.specs?.kernelspecs||{})}.`),A("DATASCIENCE.JUPYTER_KERNEL_SPEC_FETCH_FAILURE",void 0,{failed:!0,reason:"NoSpecsManager"}),[await Os()];let i={wasSessionManagerReady:this.sessionManager.isReady,wasSpecsManagerReady:n.isReady,sessionManagerReady:this.sessionManager.isReady,specsManagerReady:n.isReady,waitedForChangeEvent:!1},o=(c={})=>n.specs&&Object.keys(n.specs.kernelspecs).length?n.specs.kernelspecs:c,s=o();await br(1e4,this.sessionManager.ready),i.sessionManagerReady=this.sessionManager.isReady,await br(1e4,n.refreshSpecs()),i.specsManagerReady=n.isReady;let a=!1;if(n&&Object.keys(n.specs?.kernelspecs||{}).length===0){let c=[],u=oe(),p=u.resolve.bind(u);n.specsChanged.connect(p),c.push(new d3.Disposable(()=>n.specsChanged.disconnect(p)));let f=Promise.all([u.promise,n.ready,n.refreshSpecs(),this.sessionManager.ready]);await br(1e4,f),i.waitedForChangeEvent=!0,u.completed||(a=!0,A("DATASCIENCE.JUPYTER_KERNEL_SPEC_FETCH_FAILURE",void 0,{failed:!0,sessionManagerReady:this.sessionManager.isReady,specsManagerReady:n.isReady,reason:n.isReady?this.sessionManager.isReady?"SpecsDidNotChangeInTime":"SessionManagerIsNotReady":"SpecManagerIsNotReady"})),z(c)}let l=o(s);if(Object.keys(l||{}).length){let c=[];return Object.entries(l).forEach(([u,p])=>{p&&c.push(new hp(p))}),A("DATASCIENCE.JUPYTER_KERNEL_SPEC_FETCH_FAILURE",{duration:t.elapsedTime},i),c}else return d.error(`Jupyter Lab Helper cannot enumerate kernelspecs. Returning a default kernel. Specs ${JSON.stringify(l)}.`),a||A("DATASCIENCE.JUPYTER_KERNEL_SPEC_FETCH_FAILURE",void 0,{failed:!0,reason:"NoSpecsEventAfterRefresh"}),[await Os()]}catch(t){return d.error("Jupyter Lab Helper:getKernelSpecs failure: ",t),[]}}};var pn=class{constructor(e,t,n,i,o){this.jupyterPickerRegistration=e;this.configService=t;this.errorHandler=n;this.requestAgentCreator=i;this.requestCreator=o}async createConnectionInfo(e){let t=await this.getJupyterServerUri(e);if(!t)throw new Error(`Unable to get resolved server information for ${e.extensionId}:${e.id}:${e.handle}`);let n={baseUrl:t.connectionInformation.baseUrl.toString(!0),displayName:t.label,token:t.connectionInformation.token||"",authorizationHeader:t.connectionInformation.headers||{},fetch:t.connectionInformation.fetch,mappedRemoteNotebookDir:void 0,WebSocket:t.connectionInformation.WebSocket};return gx(e,n,this.requestCreator,this.requestAgentCreator,this.configService,Ex.Uri.file(""))}async validateRemoteUri(e,t,n){let i;if(!t){let s=await this.getJupyterServerUri(e);if(s)t={baseUrl:s.connectionInformation.baseUrl.toString(!0),displayName:s.label,token:s.connectionInformation.token||"",authorizationHeader:s.connectionInformation.headers||{},fetch:s.connectionInformation.fetch,mappedRemoteNotebookDir:void 0,WebSocket:s.connectionInformation.WebSocket};else throw new Error(`Unable to get resolved server information for ${e.extensionId}:${e.id}:${e.handle}`)}let o=gx(e,t,this.requestCreator,this.requestAgentCreator,this.configService,Ex.Uri.file(""));try{i=wp.create(o.settings),await Promise.all([i.getRunningKernels(),i.getKernelSpecs()])}catch(s){if(Jo.isSelfCertsError(s)){if(!await Ek(this.configService,s.message))throw s}else if(kl.isSelfCertsExpiredError(s)){if(!await kk(this.configService,s.message))throw s}else throw t&&!n&&await this.errorHandler.handleError(new Ki(t.baseUrl,e,s)),s}finally{o.dispose(),i&&i.dispose()}}async getJupyterServerUri(e){let t=new Ex.CancellationTokenSource;try{let n=this.jupyterPickerRegistration.jupyterCollections.find(l=>l.extensionId===e.extensionId&&l.id===e.id)||await this.jupyterPickerRegistration.activateThirdPartyExtensionAndFindCollection(e.extensionId,e.id);if(!n)return;let i=await Promise.resolve(n.serverProvider.provideJupyterServers(t.token)),o=i?.find(l=>l.id===e.handle);if(!o&&i?.length===0)try{o=await n.serverProvider.resolveJupyterServer({id:e.handle,label:""},t.token)}catch{}if(!o)return;if(o.connectionInformation)return o;let s=await Promise.resolve(n.serverProvider.resolveJupyterServer(o,t.token));if(!s?.connectionInformation)return;let a=Object.assign({},o);return a.connectionInformation=s.connectionInformation,a}catch(n){throw n instanceof ze?n:new Cp(e,n)}finally{t.dispose()}}};pn=y([(0,Dl.injectable)(),m(0,(0,Dl.inject)($t)),m(1,(0,Dl.inject)(le)),m(2,(0,Dl.inject)(Zr)),m(3,(0,Dl.inject)(xp)),m(3,(0,Dl.optional)()),m(4,(0,Dl.inject)(Bc))],pn);var Sa=class{constructor(e,t,n){this.serverUriStorage=e;this.jupyterConnection=t;this.serverProviderRegistry=n}async addJupyterServer(e){if(e.extensionId.toLowerCase()!=Xa.toLowerCase())throw new Error("Deprecated API");try{await this.jupyterConnection.validateRemoteUri(e)}catch(t){d.error(`Error in validating the Remote Uri ${e.id}.${e.handle}`,t);return}this.serverProviderRegistry.jupyterCollections.some(t=>t.extensionId===e.extensionId)||await this.serverUriStorage.add(e)}};Sa=y([(0,Eg.injectable)(),m(0,(0,Eg.inject)(zt)),m(1,(0,Eg.inject)(pn)),m(2,(0,Eg.inject)($t))],Sa);var m3=P(M()),_l=require("vscode");var Ep=require("vscode");function pr(r,e=!1){return typeof r!="object"||!r?!1:!!(r instanceof Ep.CancellationError||e&&(r.message.includes("Canceled")||r.message.includes(me.canceled)))}async function nr(r,e,...t){let n;return Qw(e)?(t.push(e),n=void 0):n=e,r?r.isCancellationRequested?n:new Promise((i,o)=>{if(r.isCancellationRequested)return i(n);let s=r.onCancellationRequested(()=>{s.dispose(),i(n)});Promise.race(t).then(i,o).finally(()=>s.dispose())}):await Promise.race(t)}async function ir(r,...e){if(!r)return Promise.race(e);if(r.isCancellationRequested)throw new Ep.CancellationError;return new Promise((t,n)=>{if(r.isCancellationRequested)return n(new Ep.CancellationError);let i=r.onCancellationRequested(()=>{i.dispose(),n(new Ep.CancellationError)});Promise.race(e).then(t,n).finally(()=>i.dispose())})}function kg(...r){let e=new Ep.CancellationTokenSource,t=[];for(let i of r)i&&(i.isCancellationRequested&&e.cancel(),i.onCancellationRequested(()=>e.cancel(),void 0,t));let n=e.dispose.bind(e);return e.dispose=()=>{n(),z(t)},e}var En;(e=>{function r(t){if(t?.isCancellationRequested)throw new Ep.CancellationError}e.throwIfCanceled=r})(En||={});function f3(r){let e=new Map,t=(a,l)=>{if(!e.has(a)){let c={id:a,label:l.displayName,connectionInformation:{baseUrl:_l.Uri.parse(l.baseUrl),token:l.token,fetch:l.fetch,headers:l.authorizationHeader,WebSocket:l.WebSocket}};e.set(a,{serverUri:l,server:c})}return e.get(a).server},n=new _l.EventEmitter,i={async provideJupyterServers(a){let l=r.getHandles?await ir(a,r.getHandles()):[];return!l||l.length===0?[]:ir(a,Promise.all(l.map(c=>r.getServerUri(c).then(u=>t(c,u)))))},resolveJupyterServer(a,l){return a},onDidChangeServers:n.event};if(!r.handleQuickPick||!r.getQuickPickEntryItems)return{serverProvider:i};let o=new Map;return{serverProvider:i,commandProvider:{async handleCommand(a,l){let c=o.get(a.label);if(!c||!r.handleQuickPick)return;let u=await ir(l,r.handleQuickPick(c,!0));if(u==="back")return;if(!u)throw new _l.CancellationError;let p=await r.getServerUri(u);return t(u,p)},async provideCommands(a,l){return r.getQuickPickEntryItems?(await ir(l,Promise.resolve(r.getQuickPickEntryItems()))).map(u=>{let p={label:kh(u.label),canBeAutoSelected:u.default,description:kh(u.description)};return o.set(p.label,u),p}):[]}}}}var oM=class extends Yn{constructor(t,n,i,o){super();this.extensionId=t;this.id=n;this.label=i;this.serverProvider=o;this._onDidChangeProvider=new _l.EventEmitter;this.onDidChangeProvider=this._onDidChangeProvider.event}set commandProvider(t){this._commandProvider=t,this._onDidChangeProvider.fire()}get commandProvider(){return this._commandProvider}},Pg=class extends tr{constructor(){super();this._onDidChangeCollections=new _l.EventEmitter;this._collections=new Map;xe.instance.get(O).push(this)}get onDidChangeCollections(){return this._onDidChangeCollections.event}get jupyterCollections(){return Array.from(this._collections.values())}async activateThirdPartyExtensionAndFindCollection(t,n){return await this.loadExtension(t,n).catch(h),this.jupyterCollections.find(i=>i.extensionId===t&&i.id===n)}async loadExtension(t,n){if(t===Ue)return;let i=_l.extensions.getExtension(t);if(!i)throw new Error(`Extension '${t}' that provides Jupyter Server '${n}' not found`);i.isActive||await i.activate().then(h,h)}createJupyterServerCollection(t,n,i,o){let s=`${t}#${n}`;if(this._collections.has(s)&&t!==Ue)throw new Error(`Jupyter Server Provider with id ${s} already exists`);let a=new oM(t,n,i,o);return this._collections.set(s,a),this._onDidChangeCollections.fire({added:[a],removed:[]}),this._register(a.onDidDispose(()=>{this._collections.delete(s),this._onDidChangeCollections.fire({removed:[a],added:[]})},this)),a}};Pg=y([(0,m3.injectable)()],Pg);var Yk=Symbol("IExportedKernelServiceFactory");function yle(r,e){return new Promise(t=>{e.onDidChange(n=>{for(let i of n.added)Nt(i.connection)&&i.connection.serverProviderHandle.id===r.id&&i.connection.serverProviderHandle.handle===r.handle&&t()})})}function h3(r,e){let t=e.get(ba),n=r.id.startsWith("_builtin")?Ue:t.determineExtensionFromCallStack().extensionId;if(d.error(`The API registerRemoteServerProvider has being deprecated and will be removed soon, please use createJupyterServerCollection (extension ${n}).`),n.toLowerCase()!=Xa.toLowerCase())throw new Error("Deprecated API");A("DATASCIENCE.JUPYTER_API_USAGE",void 0,{clientExtId:n,pemUsed:"registerRemoteServerProvider"});let{serverProvider:i,commandProvider:o}=f3(r),s=Qk(r.id,r.displayName||r.detail||r.id,i,n,e);return o&&(s.commandProvider=o),{dispose:()=>{s.dispose()}}}function g3(r){return r.then(()=>void 0).catch(e=>(d.error("Failure during activation.",e),Promise.reject(e)))}function v3(r){let e=r.get(ba);return A("DATASCIENCE.JUPYTER_API_USAGE",void 0,{clientExtId:e.determineExtensionFromCallStack().extensionId,pemUsed:"registerRemoteServerProvider"}),r.get(Yk).getService()}async function y3(r,e,t){let n=t.get(ba);d.error("The API addRemoteJupyterServer has being deprecated and will be removed soon, please use createJupyterServerCollection.");let i=n.determineExtensionFromCallStack().extensionId;if(i.toLowerCase()!=Xa.toLowerCase())throw new Error("Deprecated API");A("DATASCIENCE.JUPYTER_API_USAGE",void 0,{clientExtId:i,pemUsed:"addRemoteJupyterServer"});let o=t.get(Sa),s=t.get(pt),a=yle({id:r,handle:e},s);await o.addJupyterServer({id:r,handle:e,extensionId:i}),await a}async function b3(r,e,t){let n=t.get(ba);A("DATASCIENCE.JUPYTER_API_USAGE",void 0,{clientExtId:n.determineExtensionFromCallStack().extensionId,pemUsed:"openNotebook"});let i=t.get(pt),o=typeof e=="string"?e:void 0,s=typeof e=="string"?void 0:e,a=o&&i.all.find(c=>c.id===e)?.id;if(!a&&s&&!zu()&&(a=i.all.find(c=>c.kind==="startUsingPythonInterpreter"&&c.interpreter.id===s.id)?.id,!a)){let u=await t.get(Dm).getKernelConnection(s);a=u&&i.all.find(p=>p.id===u?.id)?.id}if(!a)throw new Error(`Kernel ${e} not found.`);let l=kp.window.activeNotebookEditor?.notebook?.uri?.toString()===r.toString()?kp.window.activeNotebookEditor:await kp.window.showNotebookDocument(await kp.workspace.openNotebookDocument(r));return await kp.commands.executeCommand("notebook.selectKernel",{notebookEditor:l,id:a,extension:Ue}),l.notebook}function I3(r,e,t,n){let i=t.get(ba),o={ready:g3(r),registerPythonApi:s=>u3(s,t),registerRemoteServerProvider:s=>h3(s,t),getKernelService:()=>v3(t),addRemoteJupyterServer:(s,a)=>y3(s,a,t),openNotebook:async(s,a)=>b3(s,a,t),createJupyterServerCollection:(s,a,l)=>Qk(s,a,l,i.determineExtensionFromCallStack().extensionId,t),get kernels(){return l3(i.determineExtensionFromCallStack().extensionId)}};return(_r()||n.extensionMode===sM.ExtensionMode.Development||n.extensionMode===sM.ExtensionMode.Test)&&(o.serviceContainer=t,o.serviceManager=e),o}var S3=require("vscode"),x3={codeLoadingTime:0,endActivateTime:0,startActivateTime:0,totalActivateTime:0,workspaceFolderCount:0};function C3(r,e){if(!_r())try{r.endActivateTime=e.elapsedTime,r.totalActivateTime=e.elapsedTime,Object.assign(x3,r),E3(r),A("EXTENSION.LOAD",r)}catch(t){d.error("sendStartupTelemetry() failed.",t)}}function w3(r,e,t){try{let n={};e.endActivateTime=t.elapsedTime,e.totalActivateTime=t.elapsedTime,Object.assign(x3,e),E3(e),A("EXTENSION.LOAD",e,n,r)}catch(n){d.error("sendErrorTelemetry() failed.",n)}}function E3(r){let e=S3.workspace.workspaceFolders?.length??0;r.workspaceFolderCount=e}var Xk=Symbol("IExtensionActivationManager"),ge=Symbol("IExtensionSyncActivationService");var qc=P(M());var Tl=Symbol("IEnvironmentVariablesService"),Rl=Symbol("ICustomEnvironmentVariablesProvider");var rt=Symbol("IInterpreterService");var tP=P(M()),Al=require("vscode");var ble={JupyterSessionWaitForIdleSession:I.waitingForJupyterSessionToBeIdle,KernelsGetKernelForRemoteConnection:I.gettingListOfKernelsForRemoteConnection,KernelsGetKernelSpecs:I.gettingListOfKernelSpecs,KernelsRegisterKernel:I.registeringKernel,NotebookConnect:I.connectingToJupyter,NotebookStart:I.startingJupyterNotebook,InstallingMissingDependencies:I.installingMissingDependencies,ExportNotebookToPython:I.exportNotebookToPython,PerformingExport:I.performingExport};function eP(r){return ble[r]}var dt=class{constructor(e){this.kernelResourceProgressReporter=new Map;e.push(this),dt.instance=this}activate(){}dispose(){z(Array.from(dt.disposables))}static createProgressReporter(e,t,n){if(!dt.instance)return new Al.Disposable(h);let i=e?gn(e):"";return dt.instance.kernelResourceProgressReporter.has(i)?dt.reportProgress(e,t):dt.createProgressReporterInternal(i,t,n)}static wrapAndReportProgress(e,t,n){let i=e?gn(e):"";if(!dt.instance)return n();let o=dt.reportProgressInternal(i,t);return n().finally(()=>o?.dispose())}static reportProgress(e,t){let n=eP(t)||t,i=e?gn(e):"";return n?dt.reportProgressInternal(i,n||""):new Al.Disposable(()=>h)}static reportProgressInternal(e,t){if(!dt.instance)return new Al.Disposable(h);let n=dt.instance.kernelResourceProgressReporter.get(e);if(n||(n={title:t,pendingProgress:[],progressList:[],dispose:h},dt.instance.kernelResourceProgressReporter.set(e,n)),n.reporter)n.progressList.push(t),n.reporter.report({message:t});else{if(n.progressList.includes(t))return new Al.Disposable(h);n.pendingProgress.push(t)}return{dispose:()=>{try{if(!n)return;let i=n.progressList.findIndex(o=>o===t);if(i>=0&&n.progressList.splice(i),n.progressList.length>0){let o=n.progressList[n.progressList.length-1];n.reporter&&n.reporter.report({message:o===n.title&&n.reporter?"":o})}else dt.instance.kernelResourceProgressReporter.delete(e),n.dispose()}catch(i){d.error(`Failed to dispose Progress reporter for ${e}`,i)}}}}static createProgressReporterInternal(e,t,n){let i=oe(),o=new Al.Disposable(()=>i.resolve()),s=dt.instance.kernelResourceProgressReporter.get(e)||{title:t,pendingProgress:[],progressList:[],tokenSources:[],dispose:()=>{o.dispose()}},a=!1,l=()=>{a||(a=!0,Al.window.withProgress({location:Al.ProgressLocation.Notification,title:t},async(c,u)=>{let p=dt.instance.kernelResourceProgressReporter.get(e);if(p){for(p.reporter=c;p.pendingProgress.length>0;){let f=p.pendingProgress.shift();f===t?p.progressList.push(f):f!==t&&f&&(p.progressList.push(f),c.report({message:f}))}await nr(u,i.promise),dt.instance.kernelResourceProgressReporter.get(e)===p&&dt.instance.kernelResourceProgressReporter.delete(e),dt.disposables.delete(o)}}).then(h,h))};return dt.instance.kernelResourceProgressReporter.set(e,{...s,dispose:()=>o.dispose(),show:l}),dt.disposables.add(o),s.pendingProgress.push(t),n||l(),{dispose:()=>o.dispose(),show:l}}};dt.disposables=new Set,dt=y([(0,tP.injectable)(),m(0,(0,tP.inject)(O))],dt);var Dg=P(M()),rP=require("vscode");var wr=Symbol("IPlatformService"),st=Symbol("IFileSystem");var p0e=Symbol("IBufferDecoder"),Fi=Symbol("IProcessServiceFactory"),kx=class extends ze{constructor(e){super("unknown",e)}};var aM=class{constructor(e,t){this.uri=e;this.value=t}};function Ile(r){return Array.isArray(r)}var Sle,So=class r{constructor(e,t){this[Sle]="ResourceMap";if(e instanceof r)this.map=new Map(e.map),this.toKey=t??r.defaultToKey;else if(Ile(e)){this.map=new Map,this.toKey=t??r.defaultToKey;for(let[n,i]of e)this.set(n,i)}else this.map=new Map,this.toKey=e??r.defaultToKey}static{this.defaultToKey=e=>e.toString()}set(e,t){return this.map.set(this.toKey(e),new aM(e,t)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(let[,n]of this.map)e(n.value,n.uri,this)}*values(){for(let e of this.map.values())yield e.value}*keys(){for(let e of this.map.values())yield e.uri}*entries(){for(let e of this.map.values())yield[e.uri,e.value]}*[(Sle=Symbol.toStringTag,Symbol.iterator)](){for(let[,e]of this.map)yield[e.uri,e.value]}},xle,Nl=class{constructor(e,t){this[xle]="ResourceSet";!e||typeof e=="function"?this._map=new So(e):(this._map=new So(t),e.forEach(this.add,this))}get size(){return this._map.size}add(e){return this._map.set(e,e),this}clear(){this._map.clear()}delete(e){return this._map.delete(e)}forEach(e,t){this._map.forEach((n,i)=>e.call(t,i,i,this))}has(e){return this._map.has(e)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(xle=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}};var Cle,k3=class{constructor(){this[Cle]="LinkedMap";this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=0){let n=this._map.get(e);if(n)return t!==0&&this.touch(n,t),n.value}set(e,t,n=0){let i=this._map.get(e);if(i)i.value=t,n!==0&&this.touch(i,n);else{switch(i={key:e,value:t,next:void 0,previous:void 0},n){case 0:this.addItemLast(i);break;case 1:this.addItemFirst(i);break;case 2:this.addItemLast(i);break;default:this.addItemLast(i);break}this._map.set(e,i),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){let t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");let e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){let n=this._state,i=this._head;for(;i;){if(t?e.bind(t)(i.value,i.key,this):e(i.value,i.key,this),this._state!==n)throw new Error("LinkedMap got modified during iteration.");i=i.next}}keys(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.key,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}values(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:n.value,done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}entries(){let e=this,t=this._state,n=this._head,i={[Symbol.iterator](){return i},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(n){let o={value:[n.key,n.value],done:!1};return n=n.next,o}else return{value:void 0,done:!0}}};return i}[(Cle=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,n=this.size;for(;t&&n>e;)this._map.delete(t.key),t=t.next,n--;this._head=t,this._size=n,t&&(t.previous=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{let t=e.next,n=e.previous;if(!t||!n)throw new Error("Invalid list");t.previous=n,n.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;let n=e.next,i=e.previous;e===this._tail?(i.next=void 0,this._tail=i):(n.previous=i,i.next=n),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;let n=e.next,i=e.previous;e===this._head?(n.previous=void 0,this._head=n):(n.previous=i,i.next=n),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){let e=[];return this.forEach((t,n)=>{e.push([n,t])}),e}fromJSON(e){this.clear();for(let[t,n]of e)this.set(t,n)}};var Ml=class{constructor(e,t,n){this.processFactory=e;this.platform=t;this.fs=n;this.userSitePaths=new So}async getExecutablesPath(e){let t=e.executable.uri;if(!(Be(e)!=="Unknown"||!t)){if(!this.userSitePaths.has(t)){let n=this.getUserSitePathImpl(t);n.catch(()=>{this.userSitePaths.get(t)===n&&this.userSitePaths.delete(t)}),this.userSitePaths.set(t,n)}return this.userSitePaths.get(t)}}async getUserSitePathImpl(e){let t=await this.processFactory.create(void 0),n="USER_BASE_VALUE",i=this.platform.isWindows?"USER_SITE":"USER_BASE",{stdout:o}=await t.exec(e.fsPath,["-c",`import site;print("${n}");print(site.${i});print("${n}");`]);if(o.includes(n)){let s=o.substring(o.indexOf(n)+n.length,o.lastIndexOf(n)).trim(),a=rP.Uri.file(s),l;if(this.platform.isWindows?l=rP.Uri.joinPath(Pi(a),"Scripts"):l=rP.Uri.joinPath(a,"bin"),!l||!this.fs.exists(l))throw new Error(`USER_SITE ${l.fsPath} dir does not exist for the interpreter ${B(e)}`);return d.trace(`USER_SITE for ${B(e)} is ${l.fsPath}`),l}else throw new Error(`USER_SITE not found for the interpreter ${B(e)}. Stdout: ${o}`)}};y([zr()],Ml.prototype,"getExecutablesPath",1),Ml=y([(0,Dg.injectable)(),m(0,(0,Dg.inject)(Fi)),m(1,(0,Dg.inject)(wr)),m(2,(0,Dg.inject)(st))],Ml);var lM=require("vscode");var P3=6e4,Pp=class{constructor(e,t,n,i,o,s){this.interpreterService=e;this.customEnvVarsService=t;this.apiProvider=n;this.extensionChecker=i;this.envVarsService=o;this.globalExecPaths=s;this.disposables=[];this.activatedEnvVariablesCache=new Map;this.cachedEnvVariables=new Map;this.customEnvVarsService.onDidEnvironmentVariablesChange(this.clearCache,this,this.disposables),this.interpreterService.onDidChangeInterpreter(this.clearCache,this,this.disposables),this.interpreterService.onDidEnvironmentVariablesChange(this.clearCache,this,this.disposables)}clearCache(){this.activatedEnvVariablesCache.clear(),this.cachedEnvVariables.clear()}dispose(){this.disposables.forEach(e=>e.dispose())}async getActivatedEnvironmentVariables(e,t,n){let i=I.activatingPythonEnvironment(Yr(t));return dt.wrapAndReportProgress(e,i,async()=>this.getActivatedEnvironmentVariablesImplWithCaching(e,t.id,n))}async getActivatedEnvironmentVariablesImplWithCaching(e,t,n){let i=await this.interpreterService.resolveEnvironment(t);if(!i){d.warn(`Failed to resolve environment for ${t}`);return}let o=`${e?.toString()||""}${t}`,s=this.activatedEnvVariablesCache.get(o);if(s&&s.time.elapsedTime>=P3&&this.activatedEnvVariablesCache.delete(o),!this.activatedEnvVariablesCache.has(o)){let l=this.getActivatedEnvironmentVariablesImpl(e,i,n);l.catch(h),this.activatedEnvVariablesCache.set(o,{promise:l,time:new We})}let a=this.activatedEnvVariablesCache.get(o).promise;return n?a:nr(n,a)}async getActivatedEnvironmentVariablesImpl(e,t,n){if(!this.extensionChecker.isPythonExtensionInstalled)return;let i=new We;return this.getActivatedEnvironmentVariablesFromPython(e,t,n).then(o=>{if(!n?.isCancellationRequested)return o}).catch(o=>{d.error(`Failed to get env vars with python ${B(t.id)} in ${i.elapsedTime}ms`,o)})}async getActivatedEnvironmentVariablesFromPython(e,t,n){let i=`${e?.toString()||""}${t.id||""}`,o=this.cachedEnvVariables.get(i);if(o&&o.lastRequestedTime.elapsedTime>P3&&this.cachedEnvVariables.delete(i),!this.cachedEnvVariables.has(i)){let s=this.getActivatedEnvironmentVariablesFromPythonImpl(e,t,n);this.cachedEnvVariables.set(i,{promise:s,lastRequestedTime:new We})}return nr(n,this.cachedEnvVariables.get(i).promise)}async getActivatedEnvironmentVariablesFromPythonImpl(e,t,n){e=e||(lM.workspace.workspaceFolders?.length?lM.workspace.workspaceFolders[0].uri:void 0);let i=new We,o=this.customEnvVarsService.getEnvironmentVariables(e,"RunPythonCode").catch(()=>{}),s="emptyVariables",a,l=await this.apiProvider.getApi().then(u=>u.getActivatedEnvironmentVariables(e,t,!1).catch(p=>{d.error(`Failed to get activated env variables from Python Extension for ${B(t.path)}`,p),s="failedToGetActivatedEnvVariablesFromPython"}));if(n?.isCancellationRequested)return;let c=Be(t);if(A("DS_INTERNAL.GET_ACTIVATED_ENV_VARIABLES",{duration:i.elapsedTime},{envType:c,source:"python",failed:Object.keys(l||{}).length===0,reason:s},a),l?d.debug(`Got env vars from Python Ext in ${i.elapsedTime}ms for ${B(t.path)}, with env var count ${Object.keys(l||{}).length}.`):c==="Conda"?d.error(`Failed to get activated conda env vars for ${B(t.path)}
|
||
in ${i.elapsedTime}ms`):d.warn(`Failed to get activated env vars for ${B(t.path)} in ${i.elapsedTime}ms`),!l){let u=await o;if(l={},Be(t)==="Conda"){let b=await ya(t);b?l.CONDA_PREFIX=b:d.warn(`Failed to get the SysPrefix for the Conda Environment ${B(t.path)}}`)}this.envVarsService.mergeVariables(process.env,l),this.envVarsService.mergeVariables(u,l),this.envVarsService.mergePaths(process.env,l),process.env.PYTHONPATH&&(l.PYTHONPATH=process.env.PYTHONPATH);let p=u?Object.keys(u).find(b=>b.toLowerCase()=="path"):void 0;p&&u[p]&&this.envVarsService.appendPath(l,u[p]),u.PYTHONPATH&&this.envVarsService.appendPythonPath(l,u.PYTHONPATH);let f=await this.globalExecPaths.getExecutablesPath(t).catch(h);if(n?.isCancellationRequested)return;let g=l.PATH||l.Path,v=g?g.split(Qn):[];f&&v[1]!==f.fsPath?(d.trace(`Prepend PATH with user site path for ${B(t.path)}, user site ${f.fsPath}`),this.envVarsService.prependPath(l,f.fsPath)):Hr(t)||d.error(`Unable to determine site packages path for python ${B(t.path)} (${Be(t)})`),!l.PATH&&l.Path&&(l.PATH=l.Path)}return t.executable.uri&&(d.trace(`Prepend PATH with python bin for ${B(t.path)}`),this.envVarsService.prependPath(l,lt(t.executable.uri.fsPath))),l}};y([li("Getting activated env variables",1),m(1,Lc("id"))],Pp.prototype,"getActivatedEnvironmentVariablesImpl",1),y([m(1,Lc("id")),m(2,up())],Pp.prototype,"getActivatedEnvironmentVariablesFromPython",1),Pp=y([(0,qc.injectable)(),m(0,(0,qc.inject)(rt)),m(1,(0,qc.inject)(Rl)),m(2,(0,qc.inject)(Yt)),m(3,(0,qc.inject)($e)),m(4,(0,qc.inject)(Tl)),m(5,(0,qc.inject)(Ml))],Pp);var Ks=Symbol("IEnvironmentActivationService");var Tg=P(M()),Rg=require("vscode");var _g=class{constructor(e,t,n){this.disposables=e;this.extensionChecker=t;this.pythonApi=n;this._changed=new Rg.EventEmitter;this._registered=!1;Rg.window.onDidChangeActiveNotebookEditor(()=>{this._changed.fire()},this,e)}activate(){this.extensionChecker.isPythonExtensionActive?this.registerStatusFilter():this.pythonApi.onDidActivatePythonExtension(this.registerStatusFilter,this,this.disposables)}get changed(){return this._changed.event}get hidden(){return!!(Rg.window.activeNotebookEditor&&Dt(Rg.window.activeNotebookEditor.notebook))}registerStatusFilter(){this._registered||(this._registered=!0,this.pythonApi.getApi().then(e=>{e.registerInterpreterStatusFilter&&(e.registerInterpreterStatusFilter(this),this._changed.fire())}).catch(h))}};_g=y([(0,Tg.injectable)(),m(0,(0,Tg.inject)(O)),m(1,(0,Tg.inject)($e)),m(2,(0,Tg.inject)(Yt))],_g);function D3(r){r.addSingleton(Yt,ug),r.addSingleton($e,mp),r.addSingleton(rt,pg),r.addSingleton(ge,_g),r.addSingleton(Ks,Pp)}var _3=P(M());var Px=require("vscode");var Ag=class{activate(){Px.commands.registerCommand("jupyter.reloadVSCode",this.onReloadVSCode,this)}async onReloadVSCode(e){await Px.window.showInformationMessage(e,me.reload)===me.reload&&Px.commands.executeCommand("workbench.action.reloadWindow").then(h,h)}};Ag=y([(0,_3.injectable)()],Ag);var T3=P(M()),eo=require("vscode");var Jc=class{get activeDebugConsole(){return eo.debug.activeDebugConsole}get activeDebugSession(){return d.ci(`Getting active debug session, ${eo.debug.activeDebugSession?.name}`),eo.debug.activeDebugSession}get breakpoints(){return eo.debug.breakpoints}get onDidChangeActiveDebugSession(){return eo.debug.onDidChangeActiveDebugSession}get onDidStartDebugSession(){return eo.debug.onDidStartDebugSession}get onDidReceiveDebugSessionCustomEvent(){return eo.debug.onDidReceiveDebugSessionCustomEvent}get onDidTerminateDebugSession(){return eo.debug.onDidTerminateDebugSession}get onDidChangeBreakpoints(){return eo.debug.onDidChangeBreakpoints}registerDebugConfigurationProvider(e,t){return eo.debug.registerDebugConfigurationProvider(e,t)}registerDebugAdapterTrackerFactory(e,t){return eo.debug.registerDebugAdapterTrackerFactory(e,t)}startDebugging(e,t,n){return eo.debug.startDebugging(e,t,n)}addBreakpoints(e){eo.debug.addBreakpoints(e)}removeBreakpoints(e){eo.debug.removeBreakpoints(e)}};Jc.instance=new Jc,Jc=y([(0,T3.injectable)()],Jc);var nP=P(M()),cM=require("vscode");var Ng=class{constructor(e){this.extensionContext=e;this.testingState=new Map}async store(e,t,n){if(wi&&this.extensionContext.extensionMode!==cM.ExtensionMode.Production){this.testingState.set(`${e}#${t}`,n||"");return}if(n)await this.extensionContext.secrets.store(`${e}.${t}`,n);else try{await this.extensionContext.secrets.delete(`${e}.${t}`)}catch(i){d.error(i)}}async retrieve(e,t){if(wi&&this.extensionContext.extensionMode!==cM.ExtensionMode.Production)return this.testingState.get(`${e}#${t}`);try{return await this.extensionContext.secrets.get(`${e}.${t}`)}catch{try{await this.extensionContext.secrets.delete(`${e}.${t}`);return}catch(i){d.error(i)}}}};Ng=y([(0,nP.injectable)(),m(0,(0,nP.inject)(ot))],Ng);var iP=P(M()),Dx=require("vscode");var Mg=class{constructor(e){this._extensions=[];e.push(Dx.extensions.onDidChange(()=>this._extensions=Dx.extensions.all)),this._extensions=Dx.extensions.all}get extensions(){return this._extensions}determineExtensionFromCallStack(e){e=e||new Error().stack;try{let t=Dx.extensions.getExtension(Ue).extensionUri.toString().toLowerCase(),n=[];if(e){n=e.split(`
|
||
`).map(l=>{let c=/\((.*)\)/.exec(l),u=c?c[1]:void 0;try{let p=/\((.*)\:\d*\:\d*\)/.exec(l);if(!p)return u;if(!u||u.startsWith(p[1]))return p[1]}catch{}return u}).filter(l=>l&&!l.toLowerCase().startsWith(t));let i=t.split(/[\\/]/),o=i.findIndex(l=>l.startsWith(Ue)),s=o===-1?void 0:i[o-1];vN(new Error("Ex")).forEach(l=>{let c=l.getFileName();c&&!c.toLowerCase().startsWith(t)&&n.push(c)});for(let l of n){let c=this.extensions.find(u=>u.id!==Ue&&(l.toLowerCase().startsWith(u.extensionUri.fsPath.toLowerCase())||l.toLowerCase().startsWith(u.extensionUri.path.toLowerCase())));if(c)return{extensionId:c.id,displayName:c.packageJSON.displayName}}let a=n.find(l=>l.includes(Ue));if(a&&(a=a.substring(0,a.indexOf(Ue)-1)),!s||!a)return{extensionId:xh,displayName:I.unknownPackage};for(let l of n.filter(c=>c.startsWith(a)&&!c.includes(Ue))){let c=l.substring(a.length).substring(1).split(/[\\/]/)[0];c.includes("-")&&(c=c.substring(0,c.lastIndexOf("-")));let u=this.extensions.find(p=>p.id===c);if(u)return{extensionId:u.id,displayName:u.packageJSON.displayName}}}return d.error("Unable to determine the caller of the extension API for trace stack",e),d.error("Jupyter Root",t),d.error("Frames",n),{extensionId:xh,displayName:I.unknownPackage}}catch(t){return d.error("Unable to determine the caller of the extension API for trace stack.",e),d.error("Failure error",t),{extensionId:xh,displayName:I.unknownPackage}}}};Mg=y([(0,iP.injectable)(),m(0,(0,iP.inject)(O))],Mg);var oP=Symbol("IWorkspaceService"),Li=Symbol("IDebugManager"),Ol=Symbol("IApplicationEnvironment"),O1e=Symbol("IWebviewPanelMessageListener"),K1e=Symbol("IWebviewViewMessageListener"),F1e=Symbol("IWebview"),L1e=Symbol("IWebviewView"),U1e=Symbol("IWebviewPanel"),Dp=Symbol("IWebviewPanelProvider"),sP=Symbol("IWebviewViewProvider"),_x=Symbol("IEncryptedStorage");var R3=P(M());var Og=class{constructor(){this._list=[]}async dispose(){let e=this._list.map(t=>t.dispose());await Promise.all(e),this._list=[]}push(e){e&&this._list.push(e)}get list(){return this._list}};Og=y([(0,R3.injectable)()],Og);var Kp=P(M()),L6=require("vscode"),jx=P(F6());var KP=class{setSharedProperty(e,t){Qh(e,t)}postEvent(e,t){let n={};t.forEach((i,o)=>{n[o]=i}),A(e,void 0,n)}};var vO=P(require("vscode")),FP=P(M());var $g=class{constructor(e){this.extensionContext=e}get extensionVersion(){return this.extensionContext.extension.packageJSON.version}};$g=y([(0,FP.injectable)(),m(0,(0,FP.inject)(ot))],$g);function js(){return vO.env.appName.indexOf("Insider")>0||vO.env.appName.indexOf("Code - OSS Dev")>=0?"insiders":"stable"}var nde="VSCode.ABExp.FeatureData",yO="vscode",Hg=class{constructor(e,t,n){this.configurationService=e;this.appEnvironment=t;this.globalState=n;this._optInto=[];this._optOutFrom=[];this.settings=e.getSettings(void 0);let i=this.settings.experiments.optInto,o=this.settings.experiments.optOutFrom;if(this._optInto=i.filter(l=>!l.endsWith("control")),this._optOutFrom=o.filter(l=>!l.endsWith("control")),!this.enabled)return;let s;js()==="insiders"?s=jx.TargetPopulation.Insiders:s=jx.TargetPopulation.Public;let a=new KP;this.experimentationService=(0,jx.getExperimentationService)(Ue,this.appEnvironment.extensionVersion,s,a,this.globalState)}get enabled(){return this.settings.experiments.enabled&&!this.settings.experiments.optOutFrom.includes("All")}async activate(){this.experimentationService&&this.enabled&&(await this.experimentationService.initializePromise,this.getFeatures().length===0&&await this.experimentationService.initialFetch,this.logExperiments())}inExperiment(e){return!this.experimentationService||!this.enabled||this._optOutFrom.includes(e.toString())?!1:this._optInto.includes(e.toString())||this._optInto.includes("All")?(this.experimentationService.getTreatmentVariable(yO,e),!0):e==="DoNotWaitForZmqPortsToBeUsed"&&(js()==="insiders"||vh())||e==="DataViewerContribution"&&(js()==="insiders"||vh())?!0:this.experimentationService.getTreatmentVariable(yO,e)===!0}async getExperimentValue(e){if(!(!this.experimentationService||!this.enabled||this._optOutFrom.includes(e)))return this.experimentationService.getTreatmentVariable(yO,e)}getFeatures(){return this.globalState.get(nde,{features:[]}).features}logExperiments(){let e=L6.workspace.getConfiguration("telemetry"),t=!1;if(e&&e.get("enableTelemetry")===!1&&(d.info("Telemetry is disabled"),t=!0),e&&e.get("telemetryLevel")==="off"&&(d.info("Telemetry level is off"),t=!0),t&&d.info("Experiments are disabled, only manually opted experiments are active."),this._optOutFrom.includes("All"))return;if(this._optInto.includes("All")){d.info(fm.inGroup("All"));return}let n=new Set(this._optInto),i=new Set;this._optOutFrom.filter(o=>o!=="All").forEach(o=>{d.info(fm.notInGroup(o))}),this._optInto.filter(o=>o!=="All").forEach(o=>{i.add(o),d.info(fm.inGroup(o))}),t&&!i.has("DoNotWaitForZmqPortsToBeUsed")&&(js()==="insiders"||vh())&&d.info(fm.inGroup("DoNotWaitForZmqPortsToBeUsed")),t||this.getFeatures().forEach(o=>{o.toLowerCase().startsWith("jupyter")&&!this._optOutFrom.includes(o)&&!this._optInto.includes(o)&&(n.add(o),d.info(fm.inGroup(o)))})}};Hg=y([(0,Kp.injectable)(),m(0,(0,Kp.inject)(le)),m(1,(0,Kp.inject)(Ol)),m(2,(0,Kp.inject)(Ve)),m(2,(0,Kp.named)(ft))],Hg);var jP=P(M()),Ho=require("vscode");var UP=require("vscode");function Fp(r){UP.env.openExternal(typeof r=="string"?UP.Uri.parse(r):r).then(h,h)}var ide=[{doNotDisplayPromptStateKey:"SHOW_DEPRECATED_FEATURE_PROMPT_FORMAT_ON_SAVE",message:ZS.SHOW_DEPRECATED_FEATURE_PROMPT_FORMAT_ON_SAVE,moreInfoUrl:"https://github.com/Microsoft/vscode-python/issues/309",setting:{setting:"formatting.formatOnSave",values:["true",!0]}},{doNotDisplayPromptStateKey:"SHOW_DEPRECATED_FEATURE_PROMPT_LINT_ON_TEXT_CHANGE",message:ZS.SHOW_DEPRECATED_FEATURE_PROMPT_LINT_ON_TEXT_CHANGE,moreInfoUrl:"https://github.com/Microsoft/vscode-python/issues/313",setting:{setting:"linting.lintOnTextChange",values:["true",!0]}},{doNotDisplayPromptStateKey:"SHOW_DEPRECATED_FEATURE_PROMPT_FOR_AUTO_COMPLETE_PRELOAD_MODULES",message:ZS.SHOW_DEPRECATED_FEATURE_PROMPT_FOR_AUTO_COMPLETE_PRELOAD_MODULES,moreInfoUrl:"https://github.com/Microsoft/vscode-python/issues/1704",setting:{setting:"autoComplete.preloadModules"}}],Gg=class{constructor(e){this.persistentStateFactory=e;this._onDidChangeFeatures=new Ho.EventEmitter;this.onDidChangeFeatures=this._onDidChangeFeatures.event;this._features={};this.disposables=[];this._updateFeatures(),this.disposables.push(Ho.workspace.onDidChangeConfiguration(()=>{this._updateFeatures()}))}get features(){return this._features}set features(e){this._features=e,this._onDidChangeFeatures.fire()}_updateFeatures(){this.features={}}dispose(){this.disposables.forEach(e=>e.dispose())}initialize(){ide.forEach(this.registerDeprecation.bind(this))}registerDeprecation(e){Array.isArray(e.commands)&&e.commands.forEach(t=>{this.disposables.push(Ho.commands.registerCommand(t,()=>this.notifyDeprecation(e),this))}),e.setting&&this.checkAndNotifyDeprecatedSetting(e)}async notifyDeprecation(e){let t=this.persistentStateFactory.createGlobalPersistentState(e.doNotDisplayPromptStateKey,!0);if(!t.value)return;let n="Learn more",i="Never show again",o=await Ho.window.showInformationMessage(e.message,n,i);if(o)switch(o){case n:{Fp(e.moreInfoUrl);break}case i:{await t.updateValue(!1);break}default:throw new Error("Selected option not supported.")}}checkAndNotifyDeprecatedSetting(e){let t=!1;Array.isArray(Ho.workspace.workspaceFolders)&&Ho.workspace.workspaceFolders.length>0?Ho.workspace.workspaceFolders.forEach(n=>{t||(t=this.isDeprecatedSettingAndValueUsed(Ho.workspace.getConfiguration("jupyter",n.uri),e.setting))}):t=this.isDeprecatedSettingAndValueUsed(Ho.workspace.getConfiguration("jupyter"),e.setting),t&&this.notifyDeprecation(e).catch(n=>d.debug("Jupyter Extension: notifyDeprecation",n))}isDeprecatedSettingAndValueUsed(e,t){if(!e.has(t.setting))return!1;let n=e.get(t.setting);return!Array.isArray(t.values)||t.values.length===0?Array.isArray(n)?n.length>0:!0:!Array.isArray(t.values)||t.values.length===0?n===void 0?!1:Array.isArray(n)?n.length>0:!0:t.values.indexOf(e.get(t.setting))>=0}};Gg=y([(0,jP.injectable)(),m(0,(0,jP.inject)(yl))],Gg);var Lp=P(M());var WP=class{constructor(e,t,n,i){this.storage=e;this.key=t;this.defaultValue=n;this.expiryDurationMs=i}get value(){if(this.expiryDurationMs){let e=this.storage.get(this.key,{data:this.defaultValue});return!e||!e.expiry||e.expiry<Date.now()?this.defaultValue:e.data}else return this.storage.get(this.key,this.defaultValue)}async updateValue(e){this.expiryDurationMs?await this.storage.update(this.key,{data:e,expiry:Date.now()+this.expiryDurationMs}):await this.storage.update(this.key,e)}},zg=class{constructor(e,t){this.globalState=e;this.workspaceState=t}createGlobalPersistentState(e,t,n){return new WP(this.globalState,e,t,n)}createWorkspacePersistentState(e,t,n){return new WP(this.workspaceState,e,t,n)}};zg=y([(0,Lp.injectable)(),m(0,(0,Lp.inject)(Ve)),m(0,(0,Lp.named)(ft)),m(1,(0,Lp.inject)(Ve)),m(1,(0,Lp.named)(ci))],zg);var U6="Path",j6="PATH",W6=/^win/.test(process.platform);var V6=P(M()),Ll=require("vscode");var Re=class r extends Error{static{this.back=new r("back")}static{this.cancel=new r("cancel")}static{this.resume=new r("resume")}},Wx=class{constructor(){this.steps=[]}run(e,t){return this.stepThrough(e,t)}async showQuickPick(e){return this.showLazyLoadQuickPick(e).selection}showLazyLoadQuickPick({title:e,step:t,totalSteps:n,items:i,activeItem:o,placeholder:s,buttons:a,shouldResume:l,matchOnDescription:c,matchOnDetail:u,acceptFilterBoxTextAsSelection:p,startBusy:f,stopBusy:g,validate:v,onDidTriggerItemButton:b,onDidTriggerButton:C,supportBackInFirstStep:E,onDidChangeItems:R,ignoreFocusOut:_}){let L=[],te=oe(),$=Ll.window.createQuickPick();return $.title=e,$.step=t,$.totalSteps=n,$.placeholder=s,$.ignoreFocusOut=_??!0,$.items=i,g&&($.busy=f??!1,g(()=>{$.enabled&&($.busy=!1)},this,L)),R&&($.keepScrollPosition=!0,R(se=>{$.items=se},this,L)),b&&$.onDidTriggerItemButton(se=>b(se),void 0,L),$.matchOnDescription=c||!1,$.matchOnDetail=u||!1,o?$.activeItems=[o]:$.activeItems=[],$.buttons=[...this.steps.length>1||E?[Ll.QuickInputButtons.Back]:[],...a||[]],L.push($.onDidTriggerButton(se=>{se===Ll.QuickInputButtons.Back?te.reject(Re.back):C?C(se):te.resolve(se)}),$.onDidChangeSelection(async se=>{let ae=se.length?se[0].label:"",X=!!ae;if(ae&&v&&se.length){$.enabled=!1,$.busy=!0;let be=await v(se[0]);be&&(X=!1,await Ll.window.showErrorMessage(be,{modal:!0})),$.enabled=!0,$.busy=!1}X&&te.resolve(se[0])}),$.onDidHide(()=>{(async()=>{te.reject(l&&await l()?Re.resume:Re.cancel)})().catch(te.reject)})),p&&L.push($.onDidAccept(async()=>{if(!$.busy){let se=v?await v($):void 0;se?($.enabled=!1,$.busy=!0,await Ll.window.showErrorMessage(se),$.enabled=!0,$.busy=!1):te.resolve($.value)}})),this.current&&this.current.dispose(),this.current=$,this.current.show(),te.promise.finally(()=>z(L)).catch(h),{quickPick:$,selection:te.promise}}async showInputBox({title:e,step:t,totalSteps:n,value:i,prompt:o,validate:s,password:a,buttons:l,shouldResume:c,validationMessage:u}){let p=[];try{return await new Promise((f,g)=>{let v=Ll.window.createInputBox();v.title=e,v.step=t,v.totalSteps=n,v.password=!!a,v.value=i||"",v.prompt=o,v.validationMessage=u||"",v.ignoreFocusOut=!0,v.validationMessage=u||"",v.buttons=[...this.steps.length>1?[Ll.QuickInputButtons.Back]:[],...l||[]],p.push(v.onDidTriggerButton(b=>{b===Ll.QuickInputButtons.Back?g(Re.back):f(b)}),v.onDidAccept(async()=>{let b=v.value;v.enabled=!1,v.busy=!0;let C=await s(b);C?(v.validationMessage=C,v.show()):(v.validationMessage="",f(b)),v.enabled=!0,v.busy=!1}),v.onDidChangeValue(async()=>{v.validationMessage=""}),v.onDidHide(()=>{(async()=>{v.busy||g(c&&await c()?Re.resume:Re.cancel)})().catch(g)})),this.current&&this.current.dispose(),this.current=v,this.current.show()})}finally{p.forEach(f=>f.dispose())}}async stepThrough(e,t){let n=e;for(;n;){this.steps.push(n),this.current&&(this.current.enabled=!1,this.current.busy=!0);try{n=await n(this,t)}catch(i){if(i===Re.back)this.steps.pop(),n=this.steps.pop();else if(i===Re.resume)n=this.steps.pop();else if(i===Re.cancel)n=void 0;else throw i;if(!n)return i}}this.current&&this.current.dispose()}},Yg=Symbol("IMultiStepInputFactory"),Qg=class{create(){return new Wx}};Qg=y([(0,V6.injectable)()],Qg);var B6=P(M()),q6=require("vscode");var Xg=class{activate(){q6.languages.getLanguages().then(e=>{e.map(t=>t.toLowerCase()).forEach(t=>{MS.includes(t)||MS.push(t)})},h)}};Xg=y([(0,B6.injectable)()],Xg);var J6=Symbol("IServiceManager"),at=Symbol("IServiceContainer");var Gc=P(Wl());function Wp(r){return Fr()==="Windows"?Cn(r).toUpperCase():Cn(r)}function Vp(r,e){return Wp(r)===Wp(e)}function nv(r,e){return e.endsWith(Un)||(e+=Un),r.endsWith(Un)||(r+=Un),Wp(r).startsWith(Wp(e))}var $J=require("os"),jO;function HJ(r){jO=r}async function GJ(r,e={}){return(await jO.get(Fi).create(void 0)).shellExec(r,e)}function iv(r){return Gc.pathExists(r)}function WO(r){return Gc.pathExistsSync(r)}function zJ(r){return Gc.readFile(r,"utf-8")}function QJ(r){return Gc.readFileSync(r,"utf-8")}var YJ=r=>_h(r,(0,$J.homedir)());function XJ(r){return jO.get(le).getSettings()[r]}var r8=P(M()),jm=P(require("os")),n8=P(ig()),BO=require("vscode");var VO=require("vscode"),e8=P(require("os"));var ZJ=e8.homedir();function Um(r){return process.env[r]}function ov(){if(Fr()==="Windows")return VO.Uri.file(Um("USERPROFILE")||ZJ);let r=Um("HOME")||Um("HOMEPATH")||ZJ;return VO.Uri.file(r.replace(/\\/g,"/"))}var sv=P(ig());function t8(r){r=r.replace(/\.00*(?=[1-9]|0\.)/,".");let e=sv.coerce(r);return e===null||!sv.valid(e)?new sv.SemVer("0.0.0"):e}var Vl=class{constructor(){this._homeDir=ov()||BO.Uri.file(jm.homedir());this._tempDir=BO.Uri.file(jm.tmpdir());this.osType=Fr();this.osType,"Unknown"}get homeDir(){return this._homeDir}get tempDir(){return this._tempDir}get pathVariableName(){return this.isWindows?U6:j6}async getVersion(){if(this.version)return this.version;switch(this.osType){case"Windows":case"OSX":try{let e=(0,n8.coerce)(jm.release());if(e)return this.version=e;throw new Error("Unable to parse version")}catch{return t8(jm.release())}default:throw new Error("Not Supported")}}get isWindows(){return this.osType==="Windows"}get isMac(){return this.osType==="OSX"}get isLinux(){return this.osType==="Linux"}};Vl=y([(0,r8.injectable)()],Vl);function i8(r){r.addSingleton(wr,Vl),HJ(r.get(at))}var iD=P(M()),a8=require("vscode");var Wm=require("child_process"),nD=require("vscode");var qO="utf8";var tD=require("vscode"),o8=require("os"),rD=tD.Uri.file((0,o8.homedir)());function s8(r,e){let t=e?[{uri:tD.Uri.file(e),name:"",index:0}]:[];return B(r?tD.Uri.file(r):void 0,t,rD)}function en(r,e=[]){return B(r,e,rD)}function JO(r,e,t){let n=e.reduce((o,s,a)=>{let l=LS(s);return(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'")&&(s.includes("/")||s.includes("\\")))&&(l=`${s[0]}${en(s.substr(1))}`),a===0?l:`${o} ${l}`},""),i=[`Process Execution: ${en(r)} ${n}`];t&&t.cwd&&i.push(` > ${uN.currentWorkingDirectory} ${en(t.cwd.toString())}`),d.info(i.join(`
|
||
`))}var $O=class{decode(e){return Buffer.concat(e).toString(qO)}},Bp=class Bp{constructor(e){this.env=e;this.processesToKill=new Set;this.decoder=new $O}static isAlive(e){try{return e?(process.kill(e,0),!0):!1}catch{return!1}}static kill(e){try{if(!e)return;process.platform==="win32"?(0,Wm.execSync)(`taskkill /pid ${e} /T /F`):process.kill(e)}catch{}}dispose(){this.processesToKill.forEach(e=>{try{e.dispose()}catch{}})}execObservable(e,t,n={}){let i=this.getDefaultOptions(n),o=(0,Wm.spawn)(e,t,i),s=!1;d.ci(`Exec observable ${e}, ${t.join(" ")}`);let a=[],l={dispose:function(){o&&!o.killed&&!s&&Bp.kill(o.pid),o&&o.unref(),z(a)}};this.processesToKill.add(l);let c=Bme();a.push(c);let u=(f,g,v)=>{f.on(g,v),a.push({dispose:()=>f.removeListener(g,v)})};n.token&&a.push(n.token.onCancellationRequested(()=>{!s&&!o.killed&&(Bp.kill(o.pid),s=!0)}));let p=(f,g)=>{let v=this.decoder.decode([g]);f==="stderr"&&n.throwOnStdErr?c.reject(new kx(v)):c.fire({source:f,out:v})};return u(o.stdout,"data",f=>p("stdout",f)),u(o.stderr,"data",f=>p("stderr",f)),o.once("close",()=>{s=!0,c.resolve(),a.forEach(f=>f.dispose())}),o.once("exit",()=>{s=!0,c.resolve(),a.forEach(f=>f.dispose())}),o.once("error",f=>{s=!0,c.reject(f),a.forEach(g=>g.dispose())}),JO(e,t,n),{proc:o,out:c,dispose:l.dispose}}exec(e,t,n={}){let i=this.getDefaultOptions(n),o=(0,Wm.spawn)(e,t,i),s=oe(),a={dispose:()=>{!o.killed&&!s.completed&&Bp.kill(o.pid)}};this.processesToKill.add(a);let l=[],c=(f,g,v)=>{f.on(g,v),l.push({dispose:()=>f.removeListener(g,v)})};n.token&&l.push(n.token.onCancellationRequested(a.dispose));let u=[];c(o.stdout,"data",f=>u.push(f));let p=[];return c(o.stderr,"data",f=>{n.mergeStdOutErr&&u.push(f),p.push(f)}),o.once("close",()=>{if(s.completed)return;let f=p.length===0?void 0:this.decoder.decode(p);if(f&&f.length>0&&n.throwOnStdErr)s.reject(new kx(f));else{let g=this.decoder.decode(u);s.resolve({stdout:g,stderr:f})}l.forEach(g=>g.dispose())}),o.once("error",f=>{s.reject(f),l.forEach(g=>g.dispose())}),JO(e,t,n),s.promise}shellExec(e,t={}){let n=this.getDefaultOptions(t);return new Promise((i,o)=>{let s,a=(0,Wm.exec)(e,n,(c,u,p)=>{s?.dispose(),c&&c!==null?o(c):n.throwOnStdErr&&p&&p.length?o(new Error(p)):i({stderr:p&&p.length>0?p:void 0,stdout:u})});t.token&&(s=t.token.onCancellationRequested(()=>{a.exitCode===null&&!a.killed&&(o(new nD.CancellationError),Bp.kill(a.pid))}));let l={dispose:()=>{a.killed||Bp.kill(a.pid)}};this.processesToKill.add(l)})}getDefaultOptions(e){let t={...e},n=t;if(n){let i=n.encoding=typeof n.encoding=="string"&&n.encoding.length>0?n.encoding:qO;delete n.encoding,n.encoding=i}if(!t.env||Object.keys(t.env).length===0){let i=this.env?this.env:process.env;t.env={...i}}else t.env={...t.env};return t.env.PYTHONUNBUFFERED="1",t.env.PYTHONIOENCODING||(t.env.PYTHONIOENCODING="utf-8"),t.env.PYTHON_FROZEN_MODULES||(t.env.PYTHON_FROZEN_MODULES="on"),t}};y([li("Execing shell command",5),m(1,up())],Bp.prototype,"shellExec",1);var Bl=Bp;function Bme(){let r=new nD.EventEmitter,e=oe();return e.promise.catch(h),{get onDidChange(){return r.event},get done(){return e.promise},resolve:e.resolve.bind(e),reject:e.reject.bind(e),fire:r.fire.bind(r),dispose:()=>{r.dispose()}}}var Vm=class{constructor(e){this.envVarsService=e}async create(e,t){if(!a8.workspace.isTrusted)throw new Error("Workspace not trusted");let n=await this.envVarsService.getEnvironmentVariables(e,"RunNonPythonCode",t);return ma(new Bl(n))}};y([li("Create ProcessService",5)],Vm.prototype,"create",1),Vm=y([(0,iD.injectable)(),m(0,(0,iD.inject)(Rl))],Vm);function l8(r){r.addSingleton(Fi,Vm)}var u8=P(require("os")),sD=P(M());var av=P(require("vscode")),c8;(l=>{let r=av.FileSystemError.FileNotFound().name,e=av.FileSystemError.FileExists().name,t=av.FileSystemError.FileIsADirectory().name,n=av.FileSystemError.FileNotADirectory().name,i=av.FileSystemError.NoPermissions().name,o=[r,e,t,n,i];function s(c,u){if(o.includes(c.name))return c.name===u}function a(c){return s(c,r)}l.isFileNotFound=a})(c8||={});function qme(r,e){let t=r.code;if(t)return t===e}function oD(r){let e=c8.isFileNotFound(r);return e!==void 0?e:qme(r,"ENOENT")}var p8=require("vscode");var lv=class{constructor(e){this.fs=e}async parseFile(e,t){if(e)try{return Jme(await this.fs.readFile(p8.Uri.file(e)),t)}catch(n){oD(n)||d.error(`Failed to parse env file ${e}`,n)}}mergeVariables(e,t){t&&Object.keys(e).forEach(n=>{let i=n.toLowerCase();if(i=="pythonpath"||i=="path")return;let o=Object.keys(t).find(s=>s.toLowerCase()===i)||n;t[o]=e[n]})}mergePaths(e,t){let n=Object.keys(e).find(o=>o.toLowerCase()==="path"),i=Object.keys(t).find(o=>o.toLowerCase()==="path")||n;n&&i&&(t[i]=e[n])}appendPythonPath(e,...t){return this.appendPaths(e,"PYTHONPATH",!0,...t)}appendPath(e,...t){return this.appendPaths(e,"PATH",!0,...t)}prependPath(e,...t){return this.appendPaths(e,"PATH",!1,...t)}appendPaths(e,t,n,...i){let o=i.filter(f=>typeof f=="string"&&f.trim().length>0).map(f=>f.trim()).join(Qn);if(o.length===0)return e;let s=t.toLowerCase(),a=e?Object.keys(e).find(f=>f.toLowerCase()==s):void 0,l=e&&a?e[a]:void 0,c=a||t;l&&typeof l=="string"&&l.length>0?n&&!(e[c]||"").endsWith(Qn+o)?e[c]=l+Qn+o:!n&&!(e[c]||"").startsWith(o+Qn)&&(e[c]=o+Qn+l):e[c]=o;let p=["Path","PATH"].find(f=>f!==c);if(u8.platform()==="win32"&&p&&p in e&&typeof e[p]=="string"){let f=e[p],g=p;f&&typeof f=="string"&&f.length>0?n&&!(e[g]||"").endsWith(Qn+o)?e[g]=f+Qn+o:!n&&!(e[g]||"").startsWith(o+Qn)&&(e[g]=o+Qn+f):e[g]=o}return e}};lv=y([(0,sD.injectable)(),m(0,(0,sD.inject)(st))],lv);function Jme(r,e){let t=e||{},n={};return r.toString().split(`
|
||
`).forEach((i,o)=>{let[s,a]=$me(i);s!==""&&(n[s]=Gme(a,n,t))}),n}function $me(r){let e=r.match(/^\s*([a-zA-Z]\w*)\s*=\s*(.*?)?\s*$/);if(!e)return["",""];let t=e[1],n=e[2];return n&&n!==""?n[0]==="'"&&n[n.length-1]==="'"?(n=n.substring(1,n.length-1),n=n.replace(/\\n/gm,`
|
||
`)):n[0]==='"'&&n[n.length-1]==='"'&&(n=n.substring(1,n.length-1),n=n.replace(/\\n/gm,`
|
||
`)):n="",[t,n]}var Hme=/\${([a-zA-Z]\w*)?([^}\w].*)?}/g;function Gme(r,e,t,n=""){let i=!1,o=r;return o=o.replace(Hme,(s,a,l,c,u)=>c>0&&u[c-1]==="\\"?s:l&&l!==""||!a||a===""?(i=!0,s):e[a]||t[a]||n),!i&&o!==r&&(r=o,A("ENVFILE_VARIABLE_SUBSTITUTION")),r.replace(/\\\$/g,"$")}var ql=P(M());var ko=require("vscode");var Ea=require("vscode");var HO={number:"number",string:"string",undefined:"undefined",object:"object",function:"function"};function GO(r){return Array.isArray?Array.isArray(r):!!(r&&typeof r.length===HO.number&&r.constructor===Array)}function aD(r){return typeof r===HO.string||r instanceof String}function zO(r){return typeof r===HO.object&&r!==null&&!Array.isArray(r)&&!(r instanceof RegExp)&&!(r instanceof Date)}var lD=class{resolve(e){return aD(e)?this.__resolveString(e):GO(e)?this.__resolveArray(e):zO(e)?this.__resolveLiteral(e):e}resolveAny(e){return aD(e)?this.__resolveString(e):GO(e)?this.__resolveAnyArray(e):zO(e)?this.__resolveAnyLiteral(e):e}__resolveString(e){let t=/\$\{(.*?)\}/g;return e.replace(t,(n,i)=>{let o=this[i];return aD(o)?o:n&&(n.indexOf("env.")>0||n.indexOf("env:")>0)?"":n})}__resolveLiteral(e){let t=Object.create(null);return Object.keys(e).forEach(n=>{let i=e[n];t[n]=this.resolve(i)}),t}__resolveAnyLiteral(e){let t=Object.create(null);return Object.keys(e).forEach(n=>{let i=e[n];t[n]=this.resolveAny(i)}),t}__resolveArray(e){return e.map(t=>this.__resolveString(t))}__resolveAnyArray(e){return e.map(t=>this.resolveAny(t))}};var cv=class extends lD{constructor(t,n){super();let i=t?Ea.workspace.getWorkspaceFolder(t):void 0;this._workspaceFolder=i?i.uri.fsPath:n?.fsPath||__dirname,this._workspaceFolderName=Ee(this._workspaceFolder),this._filePath=t?t.fsPath:void 0,Ea.window&&Ea.window.activeTextEditor&&(this._lineNumber=Ea.window.activeTextEditor.selection.anchor.line+1,this._selectedText=Ea.window.activeTextEditor.document.getText(new Ea.Range(Ea.window.activeTextEditor.selection.start,Ea.window.activeTextEditor.selection.end))),this._execPath=process.execPath,Object.keys(process.env).forEach(o=>{this[`env:${o}`]=this[`env.${o}`]=process.env[o]})}get cwd(){return this.workspaceFolder}get workspaceRoot(){return this._workspaceFolder}get workspaceFolder(){return this._workspaceFolder}get workspaceRootFolderName(){return this._workspaceFolderName}get workspaceFolderBasename(){return this._workspaceFolderName}get file(){return this._filePath}get relativeFile(){return this.file?cE(this._workspaceFolder,this.file):void 0}get relativeFileDirname(){return this.relativeFile?lt(this.relativeFile):void 0}get fileBasename(){return this.file?Ee(this.file):void 0}get fileBasenameNoExtension(){return this.file?m2(this.file).name:void 0}get fileDirname(){return this.file?lt(this.file):void 0}get fileExtname(){return this.file?Gi(this.file):void 0}get lineNumber(){return this._lineNumber}get selectedText(){return this._selectedText}get execPath(){return this._execPath}};var uD=require("vscode"),Gx,cD=!1;function d8(){h8()&&f8()}async function m8(r,e){if(h8()){let n=new cv(e,void 0).resolveAny(g8());await r.exists(uD.Uri.file(n))&&f8()}}function f8(){A("ENVFILE_WORKSPACE"),cD=!0}function h8(){return!cD}function g8(){return Gx||(Gx=uD.workspace.getConfiguration("python").inspect("envFile")?.defaultValue||""),Gx}var Qme;(t=>{function r({telemetrySent:n,defaultSetting:i}){n!==void 0&&(cD=n),g8!==void 0&&(Gx=i)}t.setState=r;function e(){Gx=void 0,cD=!1}t.resetState=e})(Qme||={});var Yme=60*1e3,Bm=class{constructor(e,t,n,i,o=Yme){this.envVarsService=e;this.extensionChecker=n;this.pythonApi=i;this.cacheDuration=o;this.trackedWorkspaceFolders=new Set;this.fileWatchers=new Set;this.disposables=[];this.changeEventEmitter=new ko.EventEmitter;t.push(this)}get onDidEnvironmentVariablesChange(){return this.changeEventEmitter.event}dispose(){this.changeEventEmitter.dispose(),z(this.disposables)}async getEnvironmentVariables(e,t,n){if(e=e||(ko.workspace.workspaceFolders?.length?ko.workspace.workspaceFolders[0].uri:void 0),t==="RunPythonCode")return this._getEnvironmentVariables(e,t,n);let i=new lm(this.cacheDuration,this.getCacheKeyForMergedVars(e));if(i.hasData&&i.data)return d.debug(`Cached data exists getEnvironmentVariables, ${e?e.fsPath:"<No Resource>"}`),i.data;let o=this._getEnvironmentVariables(e,t,n);return o.then(s=>{n?.isCancellationRequested||(i.data=s)}).catch(h),o}async getCustomEnvironmentVariables(e,t,n){e=e||(ko.workspace.workspaceFolders?.length?ko.workspace.workspaceFolders[0].uri:void 0);let i=this.getWorkspaceFolderUri(e);if(!i){d.ci(`No workspace folder found for ${e?e.fsPath:"<No Resource>"}`);return}if(t==="RunPythonCode"&&this.extensionChecker.isPythonExtensionInstalled){let l=await this.pythonApi.getNewApi();if(l&&!n?.isCancellationRequested)return this.pythonEnvVarChangeEventHooked||(this.pythonEnvVarChangeEventHooked=!0,l.environments.onDidEnvironmentVariablesChange(c=>{d.debug(`Python env vars changed ${c.resource?.uri?.path}`),this.onEnvironmentFileChanged(c.resource?.uri),this.changeEventEmitter.fire(c.resource?.uri)},this,this.disposables)),l.environments.getEnvironmentVariables(i)}let o=new lm(this.cacheDuration,this.getCacheKeyForCustomVars(e));if(o.hasData)return d.debug(`Cached custom vars data exists getCustomEnvironmentVariables, ${e?e.fsPath:"<No Resource>"}`),o.data;if(n?.isCancellationRequested)return;this.trackedWorkspaceFolders.add(i.fsPath||"");let s=this.getEnvFile(i);this.createFileWatcher(s,i);let a=this.envVarsService.parseFile(s,process.env);return a.then(l=>{n?.isCancellationRequested||(o.data=l)}).catch(h),a}createFileWatcher(e,t){let n=this.getCacheKeyForMergedVars(t);if(this.fileWatchers.has(n))return;let i=new ko.RelativePattern(ko.Uri.file(lt(e)),Ee(e)),o=ko.workspace.createFileSystemWatcher(i,!1,!1,!1);o?(this.disposables.push(o),this.fileWatchers.add(n),o.onDidChange(()=>this.onEnvironmentFileChanged(t),this,this.disposables),o.onDidCreate(()=>this.onEnvironmentFileCreated(t),this,this.disposables),o.onDidDelete(()=>this.onEnvironmentFileChanged(t),this,this.disposables)):d.error("Failed to create file watcher for environment file")}getEnvFile(e){return je(e.fsPath,".env")}async _getEnvironmentVariables(e,t,n){let i=await this.getCustomEnvironmentVariables(e,t,n);if(n?.isCancellationRequested)return{};if(i&&t==="RunPythonCode"&&this.extensionChecker.isPythonExtensionInstalled)return i;i||(i={});let o={};this.envVarsService.mergeVariables(process.env,o),this.envVarsService.mergeVariables(i,o),this.envVarsService.mergePaths(process.env,o),process.env.PYTHONPATH&&(o.PYTHONPATH=process.env.PYTHONPATH);let s=i?Object.keys(i).find(a=>a.toLowerCase()=="path"):void 0;return s&&i[s]&&this.envVarsService.appendPath(o,i[s]),i.PYTHONPATH&&this.envVarsService.appendPythonPath(o,i.PYTHONPATH),o}getWorkspaceFolderUri(e){let t=ko.workspace.workspaceFolders||[],n=t.length===1?t[0].uri:void 0;return e&&ko.workspace.getWorkspaceFolder(e)?.uri||n}onEnvironmentFileCreated(e){this.onEnvironmentFileChanged(e),d8()}onEnvironmentFileChanged(e){new lm(this.cacheDuration,this.getCacheKeyForMergedVars(e)).clear(),new lm(this.cacheDuration,this.getCacheKeyForCustomVars(e)).clear(),this.changeEventEmitter.fire(e)}getCacheKeyForMergedVars(e){return`${_s(e)}:RunNonPythonCode`}getCacheKeyForCustomVars(e){return`${_s(e)}:RunNonPythonCode:CustomVars`}};y([li("Get Custom Env Variables",1)],Bm.prototype,"getEnvironmentVariables",1),Bm=y([(0,ql.injectable)(),m(0,(0,ql.inject)(Tl)),m(1,(0,ql.inject)(O)),m(2,(0,ql.inject)($e)),m(3,(0,ql.inject)(Yt)),m(4,(0,ql.inject)("number")),m(4,(0,ql.optional)())],Bm);function v8(r){r.addSingleton(Tl,lv),r.addSingleton(Rl,Bm)}var y8=P(M()),qp=require("vscode");var QO=require("vscode");var uv=class{activate(){qp.commands.registerCommand("jupyter.runInDedicatedExtensionHost",this.updateAffinity,this)}async updateAffinity(){let e=QO.workspace.getConfiguration("extensions").get("experimental.affinity"),t=0;e&&Object.values(e).forEach(o=>{t=Math.max(t,o)});let n=t+1,i={"ms-toolsai.jupyter":n,"ms-toolsai.jupyter-renderers":n};qp.extensions.getExtension(si)&&(i[si]=n),qp.extensions.getExtension(sm)&&(i[sm]=n),await QO.workspace.getConfiguration("extensions").update("experimental.affinity",{...e??{},...i},qp.ConfigurationTarget.Global),qp.commands.executeCommand("workbench.action.reloadWindow").then(h,h)}};uv=y([(0,y8.injectable)()],uv);var zx=require("vscode");var Jl=P(M());var b8=["currentServerHash","connectToLocalKernelsOnly","JUPYTER_LOCAL_KERNELSPECS","JUPYTER_LOCAL_KERNELSPECS_V1","JUPYTER_LOCAL_KERNELSPECS_V2","JUPYTER_LOCAL_KERNELSPECS_V3","JUPYTER_REMOTE_KERNELSPECS","JUPYTER_REMOTE_KERNELSPECS_V1","JUPYTER_REMOTE_KERNELSPECS_V2","JUPYTER_REMOTE_KERNELSPECS_V3","JUPYTER_LOCAL_KERNELSPECS_V4","JUPYTER_REMOTE_KERNELSPECS_V4-","LOCAL_KERNEL_SPECS_CACHE_KEY_V_2022_10","LOCAL_KERNEL_PYTHON_AND_RELATED_SPECS_CACHE_KEY_V_2022_10","user-jupyter-server-uri-list-v2","REGISTRATION_ID_EXTENSION_OWNER_MEMENTO_KEY","jupyter.jupyterServer.uriList"],pv=class{constructor(e,t,n,i){this.globalState=e;this.crypto=t;this.workspaceState=n;this.extensionContext=i}activate(){this.removeOldCachedItems().then(h,h)}async removeOldCachedItems(){await Promise.all([await this.getUriAccountKey()].concat(b8).filter(t=>this.globalState.get(t,void 0)!==void 0).map(t=>this.globalState.update(t,void 0).then(h,h)));let e=this.workspaceState.keys().filter(t=>t.startsWith("LAST_EXECUTED_CELL_")&&!t.startsWith("LAST_EXECUTED_CELL_V2_"));await Promise.all(e.map(t=>this.workspaceState.update(t,void 0))),await Promise.all(b8.map(t=>this.globalState.keys().filter(n=>n.startsWith(t)).map(n=>this.globalState.update(n,void 0).then(h,h))).flat()),await this.extensionContext.secrets.delete(`${oi.JupyterServerRemoteLaunchService}.remote-uri-list`).then(h,h)}async getUriAccountKey(){let e=xl();return e?this.crypto.createHash(De(e),"SHA-512"):zx.workspace.workspaceFile?this.crypto.createHash(De(zx.workspace.workspaceFile),"SHA-512"):zx.env.machineId}};pv=y([(0,Jl.injectable)(),m(0,(0,Jl.inject)(Ve)),m(0,(0,Jl.named)(ft)),m(1,(0,Jl.inject)(Bh)),m(2,(0,Jl.inject)(Ve)),m(2,(0,Jl.named)(ci)),m(3,(0,Jl.inject)(ot))],pv);function I8(r){r.addSingletonInstance(SV,W6),r.addSingleton(ba,Mg),r.addSingleton(yl,zg),r.addSingleton(Li,Jc),r.addSingleton(Ol,$g),r.addSingleton(_x,Ng),r.addSingleton(Bh,Lh),r.addSingleton(ks,Hg),r.addSingleton(QE,Gg),r.addSingleton(Vo,Og),r.addSingleton(Yg,Qg),r.addSingleton(ge,Xg),r.addSingleton(ge,pv),r.addSingleton(ge,Ag),r.addSingleton(ge,uv),i8(r),l8(r),v8(r)}var dD=P(M());var Xo=je(__dirname,"..");var YO=je(Xo,"pythonFiles"),Xme=YO;function S8(){let e=[je(Xme,"normalizeSelection.py")];function t(n){return n}return[e,t]}var ji=require("vscode");var pD=class{async normalizeLines(e,t){return e}async getFileToExecute(){let e=ji.window.activeTextEditor;if(!e){ji.window.showErrorMessage("No open file to run in terminal").then(h,h);return}if(e.document.isUntitled){ji.window.showErrorMessage("The active file needs to be saved before it can be run").then(h,h);return}if(e.document.languageId!==ye){ji.window.showErrorMessage("The active file is not a Python source file").then(h,h);return}return e.document.isDirty&&await e.document.save(),e.document.uri}getSelectedTextToExecute(e){if(!e)return;let t=e.selection,n;return t.isEmpty?n=e.document.lineAt(t.start.line).text:t.isSingleLine?n=this.getSingleLineSelectionText(e):n=this.getMultiLineSelectionText(e),Ph(n.trimEnd())}async saveFileIfDirty(e){let t=ji.workspace.textDocuments.filter(n=>n.uri.path===e.path);t.length===1&&t[0].isDirty&&await t[0].save()}getSingleLineSelectionText(e){let t=e.selection,n=new ji.Range(t.start,t.end),i=e.document.getText(n),o=e.document.lineAt(t.start.line).text;return i.trim()===o.trim()?o:i}getMultiLineSelectionText(e){let t=e.selection,n=new ji.Range(t.start,t.end),i=e.document.getText(n),o=new ji.Range(new ji.Position(t.start.line,0),new ji.Position(t.end.line,e.document.lineAt(t.end.line).text.length)),s=e.document.getText(o);if(i.trim()===s.trim())return s;let a=e.document.lineAt(t.start.line).text,l=new ji.Range(t.start,new ji.Position(t.start.line,a.length)),c=e.document.getText(l);return c.trimStart()===a.trimStart()?a+i.substring(c.length):i}};var dv=class extends pD{constructor(t){super();this.processServiceFactory=t.get(Fi),this.interpreterService=t.get(rt)}async normalizeLines(t,n){let i=[];try{let o=t.trim();if(o.length===0)return"";if(t=t.replace(new RegExp("\\r","g"),""),o.indexOf(`
|
||
`)===-1)return o+`
|
||
`;let s=await this.interpreterService.getActiveInterpreter(n),a=await this.processServiceFactory.create(n),[l,c]=S8(),u=a.execObservable(De(s?.uri)||"python",l,{throwOnStdErr:!0}),p="";u.out.onDidChange(R=>{R.source==="stdout"&&(p+=R.out)},this,i);let f=JSON.stringify({code:t});u.proc?.stdin?.write(f),u.proc?.stdin?.end(),await u.out.done;let v=JSON.parse(p),b=c(v.normalized),C=Fe(t,{trim:!0,removeEmptyEntries:!1}).findIndex(R=>R.length),E=Fe(b,{trim:!0,removeEmptyEntries:!1}).findIndex(R=>R.length);if(C>E){let R=C-E;return`${`
|
||
`.repeat(R)}${b}`}return b}catch(o){return d.error(o,"Python: Failed to normalize code for execution in Interactive Window"),t}finally{z(i)}}};dv=y([(0,dD.injectable)(),m(0,(0,dD.inject)(at))],dv);var mD=Symbol("ICodeExecutionHelper");function x8(r){r.addSingleton(mD,dv)}var Jp=P(M()),w8=P(ig()),Qx=require("vscode");var C8="CONDA_INFORMATION_CACHE";function XO(r){return r&&lE(r.fsPath)&&r.fsPath.startsWith(Un)&&`${Un}${Ee(r.fsPath)}`===r.fsPath?Ee(r.fsPath):r?.fsPath}var Vs=class{constructor(e,t,n){this.pythonApi=e;this.globalState=t;this.fs=n}async getCondaVersion(){if(this._version)return this._version;if(this._previousVersionCall)return this._previousVersionCall;let e=async()=>{let t=this.getCondaVersionFromPython();t.then(i=>{this._version=i,this.updateCache().catch(h)}).catch(h);let n=Is(this.getCachedInformation());return await Promise.race([n.promise,t]),n.completed&&n.value?.version?this._version=n.value.version:t};return this._previousVersionCall=e(),this._previousVersionCall}async getCondaFile(){if(this._file)return XO(this._file);if(this._previousFileCall)return this._previousFileCall.then(XO);let e=async()=>{let t=this.pythonApi.getApi().then(i=>i.getCondaFile?i.getCondaFile():void 0);t.then(i=>{d.trace(`Conda file is ${i}`),this._file=i?Qx.Uri.file(i):void 0,this.updateCache().catch(h)}).catch(h);let n=Is(this.getCachedInformation());return await Promise.race([n.promise,t]),n.completed&&n.value?.file?this._file=n.value.file:t.then(i=>i?Qx.Uri.file(i):void 0)};return this._previousFileCall=e(),this._previousFileCall.then(XO)}async isCondaAvailable(){return typeof this.isAvailable=="boolean"?this.isAvailable:this.getCondaVersion().then(e=>this.isAvailable=e!==void 0).catch(()=>this.isAvailable=!1)}async updateCache(){if(!this._file||!this._version)return;let e=this._file.fsPath.toLowerCase().endsWith("conda")?"":await this.fs.getFileHash(this._file);await this.globalState.update(C8,{version:this._version.raw,file:this._file.fsPath,fileHash:e})}async getCachedInformation(){let e=this.globalState.get(C8,void 0);if(!e)return;let t=e.file.toLowerCase().endsWith("conda")?"":await this.fs.getFileHash(Qx.Uri.file(e.file));if(e.fileHash===t)return{version:new w8.SemVer(e.version),file:Qx.Uri.file(e.file)}}async getCondaVersionFromPython(){return this.pythonApi.getApi().then(e=>e.getCondaVersion?e.getCondaVersion():void 0)}};Vs=y([(0,Jp.injectable)(),m(0,(0,Jp.inject)(Yt)),m(1,(0,Jp.inject)(Ve)),m(1,(0,Jp.named)(ft)),m(2,(0,Jp.inject)(st))],Vs);var Yx=P(M());var k8=P(fD());var E8="_VSCODE_getDataFrame",hD=k8.default`
|
||
try:
|
||
del _VSCODE_getDataFrame
|
||
except:
|
||
pass
|
||
`,$l=class{constructor(e,t){this.fs=e;this.context=t}async generateCodeToGetDataFrameInfo(e){let t=await this.getContentsOfDataFrameScript(),n=e.isDebugging?"True":"False",i=`${E8}("info", ${n}, ${e.variableName})`;return e.isDebugging?{initializeCode:t,code:i,cleanupCode:hD}:{code:`${t}
|
||
|
||
${i}
|
||
|
||
${hD}`}}async generateCodeToGetDataFrameRows(e){let t=await this.getContentsOfDataFrameScript(),n=e.isDebugging?"True":"False",i=`${E8}("rows", ${n}, ${e.variableName}, ${e.startIndex}, ${e.endIndex})`;return e.isDebugging?{initializeCode:t,code:i,cleanupCode:hD}:{code:`${t}
|
||
|
||
${i}
|
||
|
||
${hD}`}}async getContentsOfDataFrameScript(){if($l.contentsOfDataFrameScript)return $l.contentsOfDataFrameScript;let e=er(this.context.extensionUri,"pythonFiles","vscode_datascience_helpers","dataframes","vscodeDataFrame.py"),t=await this.fs.readFile(e);return $l.contentsOfDataFrameScript=t,t}};$l=y([(0,Yx.injectable)(),m(0,(0,Yx.inject)(st)),m(1,(0,Yx.inject)(ot))],$l);var Zx=P(M());function gD(r,e){e===void 0&&(e=!1);var t=r.length,n=0,i="",o=0,s=16,a=0,l=0,c=0,u=0,p=0;function f(_,L){for(var te=0,$=0;te<_||!L;){var se=r.charCodeAt(n);if(se>=48&&se<=57)$=$*16+se-48;else if(se>=65&&se<=70)$=$*16+se-65+10;else if(se>=97&&se<=102)$=$*16+se-97+10;else break;n++,te++}return te<_&&($=-1),$}function g(_){n=_,i="",o=0,s=16,p=0}function v(){var _=n;if(r.charCodeAt(n)===48)n++;else for(n++;n<r.length&&mv(r.charCodeAt(n));)n++;if(n<r.length&&r.charCodeAt(n)===46)if(n++,n<r.length&&mv(r.charCodeAt(n)))for(n++;n<r.length&&mv(r.charCodeAt(n));)n++;else return p=3,r.substring(_,n);var L=n;if(n<r.length&&(r.charCodeAt(n)===69||r.charCodeAt(n)===101))if(n++,(n<r.length&&r.charCodeAt(n)===43||r.charCodeAt(n)===45)&&n++,n<r.length&&mv(r.charCodeAt(n))){for(n++;n<r.length&&mv(r.charCodeAt(n));)n++;L=n}else p=3;return r.substring(_,L)}function b(){for(var _="",L=n;;){if(n>=t){_+=r.substring(L,n),p=2;break}var te=r.charCodeAt(n);if(te===34){_+=r.substring(L,n),n++;break}if(te===92){if(_+=r.substring(L,n),n++,n>=t){p=2;break}var $=r.charCodeAt(n++);switch($){case 34:_+='"';break;case 92:_+="\\";break;case 47:_+="/";break;case 98:_+="\b";break;case 102:_+="\f";break;case 110:_+=`
|
||
`;break;case 114:_+="\r";break;case 116:_+=" ";break;case 117:var se=f(4,!0);se>=0?_+=String.fromCharCode(se):p=4;break;default:p=5}L=n;continue}if(te>=0&&te<=31)if(Xx(te)){_+=r.substring(L,n),p=2;break}else p=6;n++}return _}function C(){if(i="",p=0,o=n,l=a,u=c,n>=t)return o=t,s=17;var _=r.charCodeAt(n);if(eK(_)){do n++,i+=String.fromCharCode(_),_=r.charCodeAt(n);while(eK(_));return s=15}if(Xx(_))return n++,i+=String.fromCharCode(_),_===13&&r.charCodeAt(n)===10&&(n++,i+=`
|
||
`),a++,c=n,s=14;switch(_){case 123:return n++,s=1;case 125:return n++,s=2;case 91:return n++,s=3;case 93:return n++,s=4;case 58:return n++,s=6;case 44:return n++,s=5;case 34:return n++,i=b(),s=10;case 47:var L=n-1;if(r.charCodeAt(n+1)===47){for(n+=2;n<t&&!Xx(r.charCodeAt(n));)n++;return i=r.substring(L,n),s=12}if(r.charCodeAt(n+1)===42){n+=2;for(var te=t-1,$=!1;n<te;){var se=r.charCodeAt(n);if(se===42&&r.charCodeAt(n+1)===47){n+=2,$=!0;break}n++,Xx(se)&&(se===13&&r.charCodeAt(n)===10&&n++,a++,c=n)}return $||(n++,p=1),i=r.substring(L,n),s=13}return i+=String.fromCharCode(_),n++,s=16;case 45:if(i+=String.fromCharCode(_),n++,n===t||!mv(r.charCodeAt(n)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=v(),s=11;default:for(;n<t&&E(_);)n++,_=r.charCodeAt(n);if(o!==n){switch(i=r.substring(o,n),i){case"true":return s=8;case"false":return s=9;case"null":return s=7}return s=16}return i+=String.fromCharCode(_),n++,s=16}}function E(_){if(eK(_)||Xx(_))return!1;switch(_){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function R(){var _;do _=C();while(_>=12&&_<=15);return _}return{setPosition:g,getPosition:function(){return n},scan:e?R:C,getToken:function(){return s},getTokenValue:function(){return i},getTokenOffset:function(){return o},getTokenLength:function(){return n-o},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return o-u},getTokenError:function(){return p}}}function eK(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function Xx(r){return r===10||r===13||r===8232||r===8233}function mv(r){return r>=48&&r<=57}var vD;(function(r){r.DEFAULT={allowTrailingComma:!1}})(vD||(vD={}));function P8(r,e){var t=[],n=new Object,i=void 0,o={value:{},offset:0,length:0,type:"object",parent:void 0},s=!1;function a(l,c,u,p){o.value=l,o.offset=c,o.length=u,o.type=p,o.colonOffset=void 0,i=o}try{nK(r,{onObjectBegin:function(l,c){if(e<=l)throw n;i=void 0,s=e>l,t.push("")},onObjectProperty:function(l,c,u){if(e<c||(a(l,c,u,"property"),t[t.length-1]=l,e<=c+u))throw n},onObjectEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onArrayBegin:function(l,c){if(e<=l)throw n;i=void 0,t.push(0)},onArrayEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onLiteralValue:function(l,c,u){if(e<c||(a(l,c,u,D8(l)),e<=c+u))throw n},onSeparator:function(l,c,u){if(e<=c)throw n;if(l===":"&&i&&i.type==="property")i.colonOffset=c,s=!1,i=void 0;else if(l===","){var p=t[t.length-1];typeof p=="number"?t[t.length-1]=p+1:(s=!0,t[t.length-1]=""),i=void 0}}})}catch(l){if(l!==n)throw l}return{path:t,previousNode:i,isAtPropertyKey:s,matches:function(l){for(var c=0,u=0;c<l.length&&u<t.length;u++)if(l[c]===t[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function tK(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=vD.DEFAULT);var n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function o(l){return n.children.push(l),l}var s={onObjectBegin:function(l){n=o({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:function(l,c,u){n=o({type:"property",offset:c,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:c,length:u,parent:n})},onObjectEnd:function(l,c){i(l+c),n.length=l+c-n.offset,n=n.parent,i(l+c)},onArrayBegin:function(l,c){n=o({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:function(l,c){n.length=l+c-n.offset,n=n.parent,i(l+c)},onLiteralValue:function(l,c,u){o({type:D8(l),offset:c,length:u,parent:n,value:l}),i(c+u)},onSeparator:function(l,c,u){n.type==="property"&&(l===":"?n.colonOffset=c:l===","&&i(c))},onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};nK(r,s,t);var a=n.children[0];return a&&delete a.parent,a}function rK(r,e){if(r){for(var t=r,n=0,i=e;n<i.length;n++){var o=i[n];if(typeof o=="string"){if(t.type!=="object"||!Array.isArray(t.children))return;for(var s=!1,a=0,l=t.children;a<l.length;a++){var c=l[a];if(Array.isArray(c.children)&&c.children[0].value===o){t=c.children[1],s=!0;break}}if(!s)return}else{var u=o;if(t.type!=="array"||u<0||!Array.isArray(t.children)||u>=t.children.length)return;t=t.children[u]}}return t}}function yD(r){switch(r.type){case"array":return r.children.map(yD);case"object":for(var e=Object.create(null),t=0,n=r.children;t<n.length;t++){var i=n[t],o=i.children[1];o&&(e[i.children[0].value]=yD(o))}return e;case"null":case"string":case"number":case"boolean":return r.value;default:return}}function nK(r,e,t){t===void 0&&(t=vD.DEFAULT);var n=gD(r,!1);function i(X){return X?function(){return X(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}function o(X){return X?function(be){return X(be,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}var s=i(e.onObjectBegin),a=o(e.onObjectProperty),l=i(e.onObjectEnd),c=i(e.onArrayBegin),u=i(e.onArrayEnd),p=o(e.onLiteralValue),f=o(e.onSeparator),g=i(e.onComment),v=o(e.onError),b=t&&t.disallowComments,C=t&&t.allowTrailingComma;function E(){for(;;){var X=n.scan();switch(n.getTokenError()){case 4:R(14);break;case 5:R(15);break;case 3:R(13);break;case 1:b||R(11);break;case 2:R(12);break;case 6:R(16);break}switch(X){case 12:case 13:b?R(10):g();break;case 16:R(1);break;case 15:case 14:break;default:return X}}}function R(X,be,Me){if(be===void 0&&(be=[]),Me===void 0&&(Me=[]),v(X),be.length+Me.length>0)for(var it=n.getToken();it!==17;){if(be.indexOf(it)!==-1){E();break}else if(Me.indexOf(it)!==-1)break;it=E()}}function _(X){var be=n.getTokenValue();return X?p(be):a(be),E(),!0}function L(){switch(n.getToken()){case 11:var X=n.getTokenValue(),be=Number(X);isNaN(be)&&(R(2),be=0),p(be);break;case 7:p(null);break;case 8:p(!0);break;case 9:p(!1);break;default:return!1}return E(),!0}function te(){return n.getToken()!==10?(R(3,[],[2,5]),!1):(_(!1),n.getToken()===6?(f(":"),E(),ae()||R(4,[],[2,5])):R(5,[],[2,5]),!0)}function $(){s(),E();for(var X=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(X||R(4,[],[]),f(","),E(),n.getToken()===2&&C)break}else X&&R(6,[],[]);te()||R(4,[],[2,5]),X=!0}return l(),n.getToken()!==2?R(7,[2],[]):E(),!0}function se(){c(),E();for(var X=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(X||R(4,[],[]),f(","),E(),n.getToken()===4&&C)break}else X&&R(6,[],[]);ae()||R(4,[],[4,5]),X=!0}return u(),n.getToken()!==4?R(8,[4],[]):E(),!0}function ae(){switch(n.getToken()){case 3:return se();case 1:return $();case 10:return _(!0);default:return L()}}return E(),n.getToken()===17?t.allowEmptyContent?!0:(R(4,[],[]),!1):ae()?(n.getToken()!==17&&R(9,[],[]),!0):(R(4,[],[]),!1)}function D8(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(r){if(Array.isArray(r))return"array"}else return"null";return"object"}default:return"null"}}var iK=P8;var _8=tK,T8=rK;var R8=yD;var sK=require("vscode");var bD=P(M()),zc=require("vscode");var di=class{constructor(e){this.disposables=[];this._onDidChange=new zc.EventEmitter;e.push(this),ln()||zc.workspace.onDidChangeConfiguration(t=>{t.affectsConfiguration("jupyter.kernels.excludePythonEnvironments")&&this._onDidChange.fire()},this,this.disposables)}get onDidChange(){return this._onDidChange.event}dispose(){this._onDidChange.dispose(),z(this.disposables)}isPythonEnvironmentExcluded(e){if(ln())return!1;let t=this.getExcludedPythonEnvironments(),n=oK(e,t),i="uri"in e?e.uri:e.executable.uri;return n&&(A("DATASCIENCE.JUPYTER_KERNEL_HIDDEN_VIA_FILTER"),d.debug(`Python Env hidden via filter: ${B(i)}`)),n}getExcludedPythonEnvironments(){if(!zc.workspace.workspaceFolders||zc.workspace.workspaceFolders.length===0)return zc.workspace.getConfiguration("jupyter",void 0).get("kernels.excludePythonEnvironments",[]);let e=[];return zc.workspace.workspaceFolders.forEach(t=>{e.push(...zc.workspace.getConfiguration("jupyter",t.uri).get("kernels.excludePythonEnvironments",[]))}),e}};di=y([(0,bD.injectable)(),m(0,(0,bD.inject)(O))],di);function oK(r,e){let t="uri"in r?r.envPath:r.environment?.folderUri,n="uri"in r?r.uri:r.executable.uri;return!n&&!t?!1:e.some(o=>{let s=B(o.trim()).toLowerCase().replace(/\\/g,"/");if(o=o.trim().toLowerCase().replace(/\\/g,"/"),o.length===0||s.length===0)return!1;let a=B(n).toLowerCase().replace(/\\/g,"/"),l=n?n.fsPath.toLowerCase().replace(/\\/g,"/"):"";if(o===a||s===a||o===l||s===l)return!0;let c=B(t||"").toLowerCase().replace(/\\/g,"/"),u=B(t||"").toLowerCase().replace(/\\/g,"/");return o===c||s===c||o===u||s===u})}var $p=class{constructor(e,t){this.disposableRegistry=e;this.pythonExtChecker=t;this.supportedWorkspaceTypes={untrustedWorkspace:!1,virtualWorkspace:!1}}async activate(){this.disposableRegistry.push(sK.languages.registerCompletionItemProvider({language:"json"},this,",","[")),this.disposableRegistry.push(sK.languages.registerCompletionItemProvider({language:"jsonc"},this,",","["))}async provideCompletionItems(e,t,n){if(!this.pythonExtChecker.isPythonExtensionInstalled||!this.pythonExtChecker.isPythonExtensionActive||ho().length===0||!$p.canProvideCompletions(e,t))return[];let i=this.getCurrentItemsInList(e,t);return ho().filter(o=>!oK(o,i)).map(o=>{let s=Yr(o),a=B(o.executable.uri);return{label:s,detail:a,insertText:`"${a.replace(/\\/g,"\\\\")}"`,filterText:`${s} ${a}`}})}static canProvideCompletions(e,t){if(Ee(e.uri.fsPath)!=="settings.json")return!1;let n=iK(e.getText(),e.offsetAt(t));return n.path[0]==="jupyter.kernels.excludePythonEnvironments"&&n.path.length===2}getCurrentItemsInList(e,t){try{let n=e.getText(),i=iK(n,e.offsetAt(t)),o=_8(n),s=T8(o,[i.path[0]]);if(!s)return[];let a=R8(s);return Array.isArray(a)?a:[]}catch(n){return d.warn("Failed to provide completions for python env filter",n),[]}}};$p=y([(0,Zx.injectable)(),m(0,(0,Zx.inject)(O)),m(1,(0,Zx.inject)($e))],$p);var A8=P(M()),Wi=require("vscode");var fv=class{activate(){this.migrateFilters().catch(h)}async migrateFilters(){let e=Array.isArray(Wi.workspace.workspaceFolders)?Wi.workspace.workspaceFolders:[];await this.migrateWorkspaceFilters(Wi.workspace.getConfiguration("jupyter",void 0),Wi.ConfigurationTarget.Global),e.length===0?await this.migrateWorkspaceFilters(Wi.workspace.getConfiguration("jupyter",void 0),Wi.ConfigurationTarget.Global):e.length===1?await this.migrateWorkspaceFilters(Wi.workspace.getConfiguration("jupyter",e[0].uri),Wi.ConfigurationTarget.WorkspaceFolder):(await this.migrateWorkspaceFilters(Wi.workspace.getConfiguration("jupyter",void 0),Wi.ConfigurationTarget.Workspace),await Promise.all(e.map(t=>this.migrateWorkspaceFilters(Wi.workspace.getConfiguration("jupyter",t.uri),Wi.ConfigurationTarget.WorkspaceFolder))))}async migrateWorkspaceFilters(e,t){let n=e.inspect("kernels.filter"),i=[];switch(t){case Wi.ConfigurationTarget.Global:i=n?.globalValue||[];break;case Wi.ConfigurationTarget.Workspace:i=n?.workspaceValue||[];break;default:i=n?.workspaceFolderValue||[]}let o=i.filter(s=>s.type==="pythonEnvironment").map(s=>s.path);i.length&&await e.update("kernels.filter",void 0,t),o.length&&await e.update("kernels.excludePythonEnvironments",Array.from(new Set(o)),t)}};fv=y([(0,A8.injectable)()],fv);var ID=P(M());var aK=require("vscode");var hv=class{constructor(e){this.disposables=e}activate(){this.disposables.push(aK.commands.registerCommand("jupyter.filterKernels",()=>aK.commands.executeCommand("workbench.action.openSettings","jupyter.kernels.excludePythonEnvironments").then(h,h),this))}};hv=y([(0,ID.injectable)(),m(0,(0,ID.inject)(O))],hv);var xD=P(M());var qm=Symbol("IModuleInstaller"),SFe=Symbol("IPythonInstallation"),SD=Symbol("IInstallationChannelManager"),eC=Symbol("IProductService"),tC=Symbol("IProductPathService");var Vi=Symbol("IInstaller");var vv=require("vscode");var gv=class{constructor(e){this.serviceContainer=e}async getInstallationChannel(e,t){let n=await this.getInstallationChannels(t);if(n.length>=1)return n[0];if(n.length===0){await this.showNoInstallersMessage(t);return}}async getInstallationChannels(e){let t=this.serviceContainer.getAll(qm),n=[];if(t.length===0)return[];t.sort((o,s)=>s.priority-o.priority);let i=t[0].priority;for(let o of t){if(o.priority!==i){if(n.length>0)break;i=o.priority}await o.isSupported(e)&&n.push(o)}return n}async showNoInstallersMessage(e){let t=Be(e);if(await vv.window.showErrorMessage(t==="Conda"?jh.noCondaOrPipInstaller:jh.noPipInstaller,{modal:!0},jh.searchForHelp)===jh.searchForHelp){let i=this.serviceContainer.get(wr),o=i.isWindows?"Windows":i.isMac?"MacOS":"Linux";vv.env.openExternal(vv.Uri.parse(`https://www.bing.com/search?q=Install Pip ${o} ${t==="Conda"?"Conda":""}`))}}};gv=y([(0,xD.injectable)(),m(0,(0,xD.inject)(at))],gv);var ED=P(M());var CD=require("vscode");function ro(r){switch(r){case 18:return"jupyter";case 20:return"notebook";case 23:return"pandas";case 19:return"ipykernel";case 22:return"nbconvert";case 21:return"kernelspec";case 27:return"pip";case 28:return"ensurepip";default:throw new Error(`Product ${r} cannot be installed as a Python Module.`)}}var N8=require("os");var yv=class extends ze{constructor(t,n,i){super("windowsLongPathNotEnabled",i);this.product=t;this.interpreter=n;this.originalMessage=i}};var Ur=Symbol("IPythonExecutionFactory"),LFe=Symbol("IPythonExecutionService");var Hl=class{constructor(e){this.serviceContainer=e}async installModule(e,t,n,i){let o=typeof e=="string"?e:ro(e),s=await this.getExecutionArgs(o,t,i),a=this.serviceContainer.get(Ur),l=this.serviceContainer.get(Fi),c=this.serviceContainer.get(Ks),u=this.serviceContainer.get(Tl);if(n.token.isCancellationRequested)return;let p=async(g,v)=>{let b=oe(),C=[];v.onCancellationRequested(()=>{n.cancel(),b.resolve()},this,C);let E;if(s.useShellExec){let $=await l.create(void 0);if(n.token.isCancellationRequested)return;try{let se=await $.shellExec(s.args.join(" "),{cwd:s.cwd});d.debug(se.stdout),b.resolve()}catch(se){b.reject(se)}}else if(s.exe){let $=await c.getActivatedEnvironmentVariables(void 0,t);if(n.token.isCancellationRequested)return;let se={...process.env};u.mergeVariables($||{},se),u.mergePaths($||{},se);let ae=await l.create(void 0);if(n.token.isCancellationRequested)return;E=ae.execObservable(s.exe,s.args,{encoding:"utf-8",token:v,env:se,cwd:s.cwd})}else{let $=await a.createActivatedEnvironment({interpreter:t});if(n.token.isCancellationRequested)return;E=$.execObservable(s.args,{encoding:"utf-8",token:v,cwd:s.cwd})}let R,_,L=[".","..","..."],te=0;return E&&(E.out.onDidChange($=>{let se=L[te%3],ae=$.out.trim();te+=1;let X=ae.length>28?`${ae.substring(0,28)}${se}`:ae;g.report({message:X}),d.debug($.out),$.source==="stderr"&&(_?_+=$.out:!_&&$.out.includes("ERROR: Could not install packages")&&(_=$.out.substring($.out.indexOf("ERROR: Could not install packages"))),R=$.out)},this,C),E.out.done.then(()=>{E?.proc?.exitCode!==0?_&&_.includes("https://pip.pypa.io/warnings/enable-long-paths")?(_=Fe(_,{trim:!0,removeEmptyEntries:!0}).filter($=>!$.startsWith("[notice]")).join(N8.EOL),b.reject(new yv(e,t,_))):b.reject(R||E?.proc?.exitCode):b.resolve()},$=>{b.reject($)}).finally(()=>z(C))),b.promise},f={location:CD.ProgressLocation.Notification,cancellable:!0,title:mN.installingModule(o)};await CD.window.withProgress(f,async(g,v)=>p(g,v))}};var sfe=[ro(18),ro(20)];function wD(r,e){return sfe.includes(e)?r==="pip"?["jupyter-client<8","pyzmq<25"]:["jupyter_client<8","pyzmq<25"]:[]}var M8=require("vscode");var bv=class extends Hl{constructor(t){super(t)}get name(){return"Conda"}get displayName(){return"Conda"}get type(){return"Conda"}get priority(){return 0}async isSupported(t){if(this._isCondaAvailable===!1)return!1;let n=this.serviceContainer.get(Vs);return this._isCondaAvailable=await n.isCondaAvailable(),this._isCondaAvailable?Be(t)==="Conda":!1}async installModule(t,n,i,o){if(await super.installModule(t,n,i,o),Hr(n)){if(!this.serviceContainer.get($e).isPythonExtensionActive)return;let l=await this.serviceContainer.get(rt).getInterpreterDetails(n.id);l&&!Hr(l)&&Object.assign(n,l)}}async getExecutionArgs(t,n,i=0){let s=await this.serviceContainer.get(Vs).getCondaFile(),a=Tr(n)?.environment?.name,l=this.getEnvironmentPath(n),c=[i&1?"update":"install"];return[19,23,22,18,20].map(ro).includes(t)&&c.push("-c","conda-forge"),a?(c.push("--name"),c.push(LS(a))):l&&(c.push("--prefix"),c.push(US(l))),i&2&&c.push("--update-deps"),i&4&&c.push("--force-reinstall"),c.push(t),c.push(...wD("conda",t)),c.push("-y"),{exe:s,args:c}}getEnvironmentPath(t){let n,i=Tr(t);if(i?.environment?.folderUri)return i.environment.folderUri.fsPath;n=i?.executable.uri||M8.Uri.file(t.id);let o=lt(n.fsPath),s=Ee(o);return["BIN","SCRIPTS"].indexOf(s.toUpperCase())!==-1?je(o,".."):o}};bv=y([(0,ED.injectable)(),m(0,(0,ED.inject)(at))],bv);var PD=P(M());function afe(){let r=Um("PIPENV_MAX_DEPTH");if(r===void 0)return 3;let e=parseInt(r,10);return isNaN(e)?(d.error(`PIPENV_MAX_DEPTH is incorrectly set. Converting value '${r}' to number results in NaN`),1):e}async function O8(r,e){let t=Um("PIPENV_PIPFILE")||"Pipfile",n=e.lookIntoParentDirectories?afe():1;for(;n>0&&!Vp(r,lt(r));){let i=je(r,t);if(await iv(i))return i;r=lt(r),n-=1}}async function lfe(r){let e=je(r,".project");if(!await iv(e))return;let t=await zJ(e);if(!await iv(t)){d.error(`The .project file inside environment folder: ${r} doesn't contain a valid path to the project`);return}return t}async function cfe(r){let e=lt(lt(r.fsPath)),t=await lfe(e);if(!(t===void 0||!Ee(Wp(e)).startsWith(`${Ee(Wp(t))}-`)))return O8(t,{lookIntoParentDirectories:!1})}async function K8(r,e){let t=await cfe(r);if(!t)return!1;let n=Um("PIPENV_NO_INHERIT")===void 0,i=await O8(e.fsPath,{lookIntoParentDirectories:n});return i?Vp(t,i):!1}var kD=require("vscode");function rC(r){let e="executable"in r?r.executable.uri||kD.Uri.file(r.path):r.uri;return kD.workspace.getWorkspaceFolder(e)?.uri||xl()}var L8=require("vscode");var F8="pipenv",Iv=class extends Hl{constructor(e){super(e)}get name(){return"pipenv"}get type(){return"Pipenv"}get displayName(){return F8}get priority(){return 10}async isSupported(e){if(Gu(e)){let t=await this.serviceContainer.get(rt).getActiveInterpreter(e),n=e?L8.workspace.getWorkspaceFolder(e):void 0;return!t||!n||Be(t)!=="PipEnv"?!1:K8(t.uri,n.uri)}else return Be(e)==="PipEnv"}async getExecutionArgs(e,t,n=0){let o=[n&4||n&2||n&1?"update":"install",e,"--dev"],s=rC(t);return{args:o,exe:F8,cwd:s?De(s):void 0}}};Iv=y([(0,PD.injectable)(),m(0,(0,PD.inject)(at))],Iv);var DD=P(M());var U8=require("vscode");var Sv=class extends Hl{constructor(e){super(e)}get name(){return"Pip"}get type(){return"Pip"}get displayName(){return"Pip"}get priority(){return 0}async isSupported(e){switch(Be(e)){case"Conda":case"PipEnv":case"Poetry":return!1}return this.isPipAvailable(e)}async getExecutionArgs(e,t,n=0){if(e===ro(27))return await this.serviceContainer.get(Vi).isInstalled(28,t)?{args:["-m","ensurepip"]}:{args:[je(YO,"get-pip.py")]};let i=[],o=U8.workspace.getConfiguration("http").get("proxy","");return o.length>0&&(i.push("--proxy"),i.push(o)),i.push("install","-U"),n&4&&i.push("--force-reinstall"),Be(t)==="Unknown"&&i.push("--user"),{args:["-m","pip",...i,e].concat(wD("pip",e))}}isPipAvailable(e){return this.serviceContainer.get(Ur).create({resource:void 0,interpreter:e}).then(n=>n.isModuleInstalled("pip")).catch(()=>!1)}};Sv=y([(0,DD.injectable)(),m(0,(0,DD.inject)(at))],Sv);var nC=P(M());var ufe=5e4,Qc=class Qc{constructor(e,t){this.command=e;this.cwd=t;this.fixCwd()}static{this.poetryPromise=new Map}static async getPoetry(e){if(pfe(e))return(Qc.poetryPromise.get(e)===void 0||_r())&&Qc.poetryPromise.set(e,Qc.locate(e)),Qc.poetryPromise.get(e)}static async locate(e){d.debug(`Getting poetry for cwd ${e}`);function*t(){let n=XJ("poetryPath");n&&n!=="poetry"&&(yield n),yield"poetry";let i=ov();if(i){let o=je(i.fsPath,".poetry","bin","poetry");WO(o)&&(yield o)}}for(let n of t()){d.debug(`Probing poetry binary for ${e}: ${n}`);let i=new Qc(n,e);if(await i.getEnvList()!==void 0)return d.debug(`Found poetry via filesystem probing for ${e}: ${n}`),i;d.debug(`Failed to find poetry for ${e}: ${n}`)}d.debug(`No poetry binary found for ${e}`)}async getEnvList(){return this.getEnvListCached(this.command,this.cwd)}async getEnvListCached(e,t){let n=await this.safeShellExecute(`${e} env list --full-path`);if(!n)return;let i="(Activated)";return(await Promise.all(Fe(n.stdout).map(async s=>{s.endsWith(i)&&(s=s.slice(0,-i.length));let a=s.trim();return await iv(a)?a:void 0}))).filter(s=>s!==void 0).map(s=>s)}async getActiveEnvPath(){return this.getActiveEnvPathCached(this.cwd)}async getActiveEnvPathCached(e){let t=await this.safeShellExecute(`${this.command} env info -p`,!0);if(t)return t.stdout.trim()}async getVirtualenvsPathSetting(){let e=await this.safeShellExecute(`${this.command} config virtualenvs.path`);if(e)return e.stdout.trim()}fixCwd(){if(Fr()==="Windows"&&/^[a-z]:/.test(this.cwd)){let e=this.cwd.split(":");e[0]=e[0].toUpperCase(),this.cwd=e.join(":")}}async safeShellExecute(e,t=!1){let n=new We,i=await GJ(e,{cwd:this.cwd,throwOnStdErr:!0,timeout:ufe}).catch(o=>{t?d.debug(o):d.error(o)});return d.debug(`Time taken to run ${e} in ms`,n.elapsedTime),i}};y([mA(3e4)],Qc.prototype,"getEnvListCached",1),y([mA(2e4)],Qc.prototype,"getActiveEnvPathCached",1);var _D=Qc;async function j8(r,e,t){let i=await(t?new _D(t,e):await _D.getPoetry(e))?.getActiveEnvPath();return i?nv(r,i):!1}function pfe(r){let e=je(r,"pyproject.toml");return!(!WO(e)||!QJ(e).includes("[tool.poetry]"))}var W8=require("vscode");var dfe="poetry",xv=class extends Hl{constructor(t,n){super(t);this.configurationService=n}get name(){return"poetry"}get type(){return"Poetry"}get displayName(){return dfe}get priority(){return 10}async isSupported(t){if(Be(t)!=="Poetry")return!1;let n=rC(t);if(n){let i="executable"in t?t.executable.uri||W8.Uri.file(t.path):t.uri;return j8(i.fsPath,n.fsPath,this.configurationService.getSettings(void 0).poetryPath)}return!1}async getExecutionArgs(t,n){let o=[this.configurationService.getSettings(void 0).poetryPath,"add","--dev",t],s=rC(n)?.fsPath;return{useShellExec:!0,args:o,cwd:s}}};xv=y([(0,nC.injectable)(),m(0,(0,nC.inject)(at)),m(1,(0,nC.inject)(le))],xv);var Gl=P(M()),H8=require("vscode");var dr=new Map;dr.set(18,"jupyter");dr.set(20,"notebook");dr.set(19,"ipykernel");dr.set(22,"nbconvert");dr.set(21,"kernelspec");dr.set(23,"pandas");dr.set(27,"pip");dr.set(28,"ensurepip");var Hp=P(M());var V8=new Set(["ipykernel","ipython-genutils","jupyter","jupyter-client","jupyter-core","ipywidgets","nbconvert","nbformat","notebook","pyzmq","pyzmq32","tornado","traitlets"].map(r=>r.toLowerCase())),B8="NOT INSTALLED",Bs=class{constructor(e,t,n,i,o){this.pythonExtensionChecker=e;this.interpreterService=t;this.executionFactory=n;this.apiProvider=i;this.disposables=o;this.interpreterInformation=new Map;this.pendingInterpreterInformation=new Map;this.pendingInterpreterBeforeActivation=new Set;this.interpreterPackages=new Map;Bs._instance=this,this.apiProvider.onDidActivatePythonExtension(()=>this.pendingInterpreterBeforeActivation.forEach(s=>this.trackPackages(s)),this,this.disposables)}static get instance(){return Bs._instance}getPackageVersions(e){if(!this.pythonExtensionChecker.isPythonExtensionInstalled)return Promise.resolve(new Map);let t=gn(e.uri),n=this.interpreterInformation.get(t);return n||(n=oe(),this.interpreterInformation.set(t,n),this.trackInterpreterPackages(e).catch(h)),n.promise}async getPackageVersion(e,t){if(!this.pythonExtensionChecker.isPythonExtensionInstalled)return Promise.resolve(void 0);let n=await this.getPackageVersions(e),i=await mt(t.toLocaleLowerCase());if(!n.has(i))return;let o=n.get(i);if(o)return o===B8?void 0:o}trackPackages(e,t){this.trackPackagesInternal(e,t).catch(h)}async listPackages(e){if(!this.pythonExtensionChecker.isPythonExtensionInstalled)return[];let t=_s(e);if(!this.interpreterPackages.has(t)){let n=this.listPackagesImpl(e);this.interpreterPackages.set(t,n),n.catch(i=>{this.interpreterPackages.get(t)===n&&this.interpreterPackages.delete(t),d.warn(`Failed to get list of installed packages for ${t}`,i)})}return this.interpreterPackages.get(t).then(n=>Array.from(n))}async listPackagesImpl(e){let t=await this.interpreterService.getActiveInterpreter(e);if(!t)return new Set;let n=await this.executionFactory.createActivatedEnvironment({interpreter:t,resource:e}),i="389a87b7-288f-4235-92bf-73bf19bf6491",o=`import pkgutil;import json;print("${i}");print(json.dumps(list([x.name for x in pkgutil.iter_modules()])));print("${i}");`,s=await n.exec(["-c",o],{throwOnStdErr:!1});if(s.stdout){let a=JSON.parse(s.stdout.split(i)[1].trim());return new Set(a.concat(a.map(l=>l.toLowerCase())))}else return d.error(`Failed to get list of installed packages for ${en(t.uri)}`,s.stderr),new Set}async trackPackagesInternal(e,t){if(!this.pythonExtensionChecker.isPythonExtensionActive){this.pendingInterpreterBeforeActivation.add(e);return}let n;if(Gu(e)){let i=await this.interpreterService.getActiveInterpreter(e);if(!i)return;n=i}else n=e;this.trackInterpreterPackages(n,t).catch(h)}async trackInterpreterPackages(e,t){let n=gn(e.uri);if(this.pendingInterpreterInformation.has(n)&&!t)return;let i=this.getPackageInformation({interpreter:e});i.finally(()=>{let o=setTimeout(()=>{this.pendingInterpreterInformation.get(n)===i&&this.pendingInterpreterInformation.delete(n)},3e5),s={dispose:()=>clearTimeout(o)};this.disposables.push(s)}).catch(h),this.pendingInterpreterInformation.set(n,i)}async getPackageInformation({interpreter:e}){if(Hr(e))return;let n=await(await this.executionFactory.createActivatedEnvironment({interpreter:e})).execModule("pip",["list"],{throwOnStdErr:!1,mergeStdOutErr:!0}),i=new Map;await Promise.all(Array.from(V8).map(async a=>{i.set(await mt(a),B8)})),await Promise.all(n.stdout.split(`
|
||
`).map(a=>a.trim().toLowerCase()).filter(a=>a.length>0).map(async a=>{let l=a.split(" ").filter(f=>f.trim().length);if(l.length<2)return;let[c,u]=l;if(!V8.has(c.toLowerCase().trim()))return;let p=op(u);i.set(await mt(c),p||"")}));let o=gn(e.uri),s=this.interpreterInformation.get(o);s||(s=oe(),this.interpreterInformation.set(o,s)),s.resolve(i)}};Bs=y([(0,Hp.injectable)(),m(0,(0,Hp.inject)($e)),m(1,(0,Hp.inject)(rt)),m(2,(0,Hp.inject)(Ur)),m(3,(0,Hp.inject)(Yt)),m(4,(0,Hp.inject)(O))],Bs);async function TD(r,e,t){if(Gu(t))return;let n=`${await Il(t)}#${dr.get(e)}`;await r.update(n,!0)}async function q8(r,e,t){let n=`${await Il({uri:t})}#${dr.get(e)}`;await r.update(n,void 0)}async function J8(r,e,t){let n=`${await Il(t)}#${dr.get(e)}`;return r.get(n,!1)}var RD=Symbol("IReservedPythonNamedProvider"),Gp=Symbol("IInterpreterPackages"),AD=Symbol("IWorkspaceInterpreterTracker");async function G8(r,e,t){let n=`${await Il(t)}#${dr.get(e)}`;if(r.get(n,!1))return!0;let i=ro(e),o=Bs.instance?Bs.instance.getPackageVersion(t,i).then(s=>typeof s=="string"?"found":"notfound").catch(s=>{d.error("Failed to get interpreter package version",s)}):Promise.resolve(void 0);try{let s=await br(500,o);if(typeof s=="string")return s==="found"}catch{d.error(`Failed to check if package exists ${dr.get(e)}`)}}var ND=class{constructor(e,t){this.serviceContainer=e;this.configService=e.get(le),this.productService=e.get(eC),this.persistentStateFactory=e.get(yl)}async install(e,t,n,i,o){let a=await this.serviceContainer.get(SD).getInstallationChannel(e,t);if(!a)return 2;if(n.token.isCancellationRequested)return 3;let l=i===!0?6:void 0;return o===!0&&(l=l?l|8:8),await a.installModule(e,t,n,l),n.token.isCancellationRequested?3:this.isInstalled(e,t).then(c=>c?0:2)}async isInstalled(e,t){let n=this.getExecutableNameFromSettings(e,void 0);return this.isExecutableAModule(e,void 0)?(await this.serviceContainer.get(Ur).createActivatedEnvironment({resource:void 0,interpreter:t})).isModuleInstalled(n):(await this.serviceContainer.get(Fi).create(void 0)).exec(n,["--version"],{mergeStdOutErr:!0}).then(()=>!0).catch(()=>!1)}getExecutableNameFromSettings(e,t){let n=this.productService.getProductType(e);return this.serviceContainer.get(tC,n).getExecutableNameFromSettings(e,t)}isExecutableAModule(e,t){let n=this.productService.getProductType(e);return this.serviceContainer.get(tC,n).isExecutableAModule(e,t)}};y([li("Checking if product is installed"),m(1,Lc("path"))],ND.prototype,"isInstalled",1);var Cv=class{constructor(e,t,n,i){this.serviceContainer=e;this.interpreterPackages=t;this.memento=n;this.output=i;this._onInstalled=new H8.EventEmitter;this.productService=e.get(eC)}get onInstalled(){return this._onInstalled.event}dispose(){}async install(e,t,n,i,o){t&&this.interpreterPackages.trackPackages(t);let s="installed";try{let a=await this.createInstaller(e).install(e,t,n,i,o);switch(TD(this.memento,e,t).catch(h),a===0&&this._onInstalled.fire({product:e,resource:t}),a){case 3:s="cancelled";break;case 0:s="installed";break;case 2:s="ignored";break;case 1:s="disabled";break;default:break}return a}catch(a){throw s="failed",a}finally{A("DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:s,moduleName:dr.get(e)})}}async isInstalled(e,t){return this.createInstaller(e).isInstalled(e,t)}translateProductToModuleName(e){return ro(e)}createInstaller(e){switch(this.productService.getProductType(e)){case"DataScience":return new ND(this.serviceContainer,this.output);default:break}throw new Error(`Unknown product ${e}`)}};Cv=y([(0,Gl.injectable)(),m(0,(0,Gl.inject)(at)),m(1,(0,Gl.inject)(Gp)),m(2,(0,Gl.inject)(Ve)),m(2,(0,Gl.named)(ft)),m(3,(0,Gl.inject)(Wo)),m(3,(0,Gl.named)(Ju))],Cv);var MD=P(M());var pK=class{constructor(e){this.serviceContainer=e;this.configService=e.get(le),this.productInstaller=e.get(Vi)}isExecutableAModule(e,t){if(e===21)return!1;let n;try{n=this.productInstaller.translateProductToModuleName(e,2)}catch{}let i=this.getExecutableNameFromSettings(e,t);return typeof n=="string"&&n.length>0&&Ee(i)===i}},wv=class extends pK{constructor(e){super(e)}getExecutableNameFromSettings(e,t){return this.productInstaller.translateProductToModuleName(e,2)}};wv=y([(0,MD.injectable)(),m(0,(0,MD.inject)(at))],wv);var z8=P(M());var Ev=class{constructor(){this.ProductTypes=new Map;this.ProductTypes.set(18,"DataScience"),this.ProductTypes.set(20,"DataScience"),this.ProductTypes.set(19,"DataScience"),this.ProductTypes.set(22,"DataScience"),this.ProductTypes.set(21,"DataScience"),this.ProductTypes.set(23,"DataScience"),this.ProductTypes.set(27,"DataScience"),this.ProductTypes.set(28,"DataScience")}getProductType(e){return this.ProductTypes.get(e)}};Ev=y([(0,z8.injectable)()],Ev);var OD=P(M());var kv=class{constructor(e){this.interpreterService=e}activate(){this.interpreterService.initialize()}};kv=y([(0,OD.injectable)(),m(0,(0,OD.inject)(rt))],kv);var dK=require("vscode"),Pv=P(M());var qs=class{constructor(e,t,n){this.title=I.localPythonEnvironments;this._onDidChange=new dK.EventEmitter;this._onDidChangeStatus=new dK.EventEmitter;this.onDidChange=this._onDidChange.event;this.onDidChangeStatus=this._onDidChangeStatus.event;this.refreshedOnceBefore=!1;this.disposables=[];this.promiseMonitor=new vo;this._status="idle";n.push(this),this.promiseMonitor.onStateChange(()=>this.status=this.promiseMonitor.isComplete?"idle":"discovering",this,this.disposables);let i=()=>{let o=e.getNewApi();this.promiseMonitor.push(o),o.then(s=>{if(this.api=s,!s){this.status="idle",this._onDidChangeStatus.fire();return}this._onDidChange.fire(),s.environments.onDidChangeEnvironments(()=>this._onDidChange.fire(),this,this.disposables)}).catch(s=>d.error("Failed to get python api",s))};t.isPythonExtensionInstalled?i():t.onPythonExtensionInstallationStatusChanged(()=>{t.isPythonExtensionInstalled&&i()},this,this.disposables)}get items(){return this.api?(this.refreshedOnceBefore||(this.refreshedOnceBefore=!0,this.refresh().catch(h)),this.api.environments.known):[]}get status(){return this._status}set status(e){this._status=e,this._onDidChangeStatus.fire()}activate(){}dispose(){z(this.disposables)}async refresh(){if(!this.api)return;let e=this.api.environments.refreshEnvironments();this.promiseMonitor.push(e),await e.catch(h)}withFilter(e){return new Proxy(this,{get(t,n){switch(n){case"items":return t.items.filter(e);case"dispose":return h;default:return t[n]}}})}};qs=y([(0,Pv.injectable)(),m(0,(0,Pv.inject)(Yt)),m(1,(0,Pv.inject)($e)),m(2,(0,Pv.inject)(O))],qs);var _v=P(M());function mK(r,e){if(Array.isArray(r)){let t=r.slice(1);return e&&t.push(...e),{args:t,command:r[0],python:[...r],pythonExecutable:r[r.length-1]}}return{command:r,args:e||[],python:[r],pythonExecutable:r}}function Q8(r,e){let t={command:r.command,args:[...r.args],python:[...r.python],pythonExecutable:r.pythonExecutable};return e&&t.args.push(...e),t.pythonExecutable===void 0&&(t.pythonExecutable=t.python[t.python.length-1]),t}var e7=require("vscode");function fK(r,e){return["-m",r,...e]}function Y8(){let r=["-c","import sys;print(sys.executable)"];function e(t){return t.trim()}return[r,e]}function X8(r){let e=["-c",`import ${r};print('6af208d0-cb9c-427f-b937-ff563e17efdf')`];function t(n){return n.includes("6af208d0-cb9c-427f-b937-ff563e17efdf")?!0:(d.debug(`Module ${r} is not installed. Output ${n}`),!1)}return[e,t]}async function t7(r,e){let[t,n]=Y8(),i=Q8(r,t),o=await e(i.command,i.args);return e7.Uri.file(n(o.stdout))}var KD=class{constructor(e,t){this.deps=t;if(this.pythonEnvId=e.id,"executable"in e){if(!e.executable.uri)throw new Error(`interpreter.executable.uri is not defined for ${e.id}`);this.executable=e.executable.uri}else this.executable=e.uri}getExecutionInfo(e=[]){let t=this.deps.getPythonArgv(this.executable);return mK(t,e)}getExecutionObservableInfo(e=[]){let t=this.deps.getObservablePythonArgv(this.executable);return mK(t,e)}async getExecutablePath(){if(await this.deps.isValidExecutable(this.executable))return this.executable;let e=this.getExecutionInfo();return t7(e,this.deps.exec)}async isModuleInstalled(e){let[t,n]=X8(e),i=this.getExecutionInfo(t);try{let o=await this.deps.exec(i.command,i.args,{throwOnStdErr:!1});return n(o.stdout)}catch(o){return d.warn(`Module ${e} not installed in environment ${this.pythonEnvId}`,o),!1}}};function r7(r,e,t,n,i){return{getPythonArgv:o=>e||[De(o)],getObservablePythonArgv:o=>t||[De(o)],isValidExecutable:r,exec:async(o,s,a)=>n(o,s,Object.assign({throwOnStdErr:!0},a||{})),shellExec:async(o,s)=>i(o,{timeout:s})}}function n7(r,e,t){let n=r7(async i=>t.exists(i),void 0,void 0,(i,o,s)=>e.exec(i,o,s),(i,o)=>e.shellExec(i,o));return new KD(r,n)}function i7(r,e,t,n,i){let o=["run"];e.name===""?o.push("-p",e.path):o.push("-n",e.name);let s=[r,...o,"python"],a=r7(async l=>i.exists(l),s,void 0,(l,c,u)=>n.exec(l,c,u),(l,c)=>n.shellExec(l,c));return new KD(t,a)}var FD=class extends ze{constructor(t){super("notinstalled",`Module '${t}' not installed.`);this.moduleName=t}};var hK=class{constructor(e){this.deps=e}execObservable(e,t){let n={...t},i=this.deps.getExecutionObservableInfo(e);return this.deps.execObservable(i.command,i.args,n)}execModuleObservable(e,t,n){let i=fK(e,t),o={...n},s=this.deps.getExecutionObservableInfo(i),a={...n};return a.token=void 0,this.deps.execObservable(s.command,s.args,o)}async exec(e,t){let n={...t},i=this.deps.getExecutionInfo(e);return this.deps.exec(i.command,i.args,n)}async execModule(e,t,n){let i=fK(e,t),o={...n},s=this.deps.getExecutionInfo(i),a=await this.deps.exec(s.command,s.args,o);if(e&&YE.outputHasModuleNotInstalledError(e,a.stderr)&&!await this.deps.isModuleInstalled(e))throw new FD(e);return a}};function o7(r,e){let t={isModuleInstalled:async n=>e.isModuleInstalled(n),getExecutionInfo:n=>e.getExecutionInfo(n),getExecutionObservableInfo:n=>e.getExecutionObservableInfo(n),exec:async(n,i,o)=>r.exec(n,i,o),execObservable:(n,i,o)=>r.execObservable(n,i,o)};return new hK(t)}var LD=require("vscode");var Dv=class{constructor(e,t,n){this.serviceContainer=e;this.activationHelper=t;this.processServiceFactory=n;this.disposables=this.serviceContainer.get(O),this.fileSystem=this.serviceContainer.get(st)}async create(e){let t=await this.processServiceFactory.create(e.resource);return s7(e.interpreter,t,this.fileSystem,void 0)}async createActivatedEnvironment(e){if(e.resource=e.resource?e.resource:LD.workspace.workspaceFolders?.length?LD.workspace.workspaceFolders[0].uri:void 0,!LD.workspace.isTrusted)throw new Error("Workspace not trusted");let t=await this.activationHelper.getActivatedEnvironmentVariables(e.resource,e.interpreter);if(!(t&&Object.keys(t).length>0))return this.create({resource:e.resource,interpreter:e.interpreter});let i=new Bl({...t});return this.disposables.push(i),s7(e.interpreter,i,this.fileSystem)}};Dv=y([(0,_v.injectable)(),m(0,(0,_v.inject)(at)),m(1,(0,_v.inject)(Ks)),m(2,(0,_v.inject)(Fi))],Dv);function s7(r,e,t,n){let i=n7(r,e,t);if(n){let[s,a]=n;i=i7(s,a,r,e,t)}let o=o7(e,i);return{isModuleInstalled:s=>i.isModuleInstalled(s),execObservable:(s,a)=>o.execObservable(s,a),execModuleObservable:(s,a,l)=>o.execModuleObservable(s,a,l),exec:(s,a)=>o.exec(s,a),execModule:(s,a,l)=>o.execModule(s,a,l)}}var Yc=P(M()),Xc=require("vscode");var a7="https://aka.ms/JupyterKernelStartFailureOverrideReservedName",l7=["abc","aifc","antigravity","argparse","array","ast","asynchat","asyncio","asyncore","atexit","audioop","base64","bdb","binascii","binhex","bisect","builtins","bz2","cProfile","calendar","cgi","cgitb","chunk","cmath","cmd","code","codecs","codeop","collections","colorsys","compileall","concurrent","configparser","contextlib","contextvars","copy","copyreg","crypt","csv","ctypes","curses","dataclasses","datetime","dbm","decimal","difflib","dis","distutils","doctest","email","encodings","ensurepip","enum","errno","faulthandler","fcntl","filecmp","fileinput","fnmatch","formatter","fractions","ftplib","functools","gc","genericpath","getopt","getpass","gettext","glob","graphlib","grp","gzip","hashlib","heapq","hmac","html","http","idlelib","imaplib","imghdr","imp","importlib","inspect","io","ipaddress","itertools","json","keyword","lib2to3","linecache","locale","logging","lzma","mailbox","mailcap","marshal","math","mimetypes","mmap","modulefinder","multiprocessing","netrc","nis","nntplib","ntpath","nturl2path","numbers","opcode","operator","optparse","os","parser","pathlib","pdb","pickle","pickletools","pipes","pkgutil","platform","plistlib","poplib","posix","posixpath","pprint","profile","pstats","pty","pwd","py_compile","pyclbr","pydoc","pydoc_data","queue","quopri","random","re","readline","reprlib","resource","rlcompleter","runpy","sched","secrets","select","selectors","shelve","shlex","shutil","signal","site","smtpd","smtplib","sndhdr","socket","socketserver","sqlite3","sre_compile","sre_constants","sre_parse","ssl","stat","statistics","string","stringprep","struct","subprocess","sunau","symbol","symtable","sys","sysconfig","syslog","tabnanny","tarfile","telnetlib","tempfile","termios","textwrap","this","threading","time","timeit","tkinter","token","tokenize","trace","traceback","tracemalloc","tty","turtle","turtledemo","types","typing","unicodedata","unittest","urllib","uu","uuid","warnings","wave","weakref","webbrowser","wsgiref","xdrlib","xml","xmlrpc","zipapp","zipfile","zipimport","zlib","zoneinfo"];var _7=P(oC());var mr=Symbol("IFileSystemNode");var Mfe="jupyter.pythonPackages",SK="diagnostics.reservedPythonNames.exclude",Rv=class{constructor(e,t,n,i){this.cache=e;this.platform=t;this.fs=i;this.ignoredFiles=new Set;this.cachedModules=new Set;this.pendingUpdate=Promise.resolve();this.disposables=[];n.push(this),this.cachedModules=new Set(this.cache.get(Mfe,l7).map(o=>o.toLowerCase())),Xc.workspace.onDidChangeConfiguration(o=>{o.affectsConfiguration(`jupyter.${SK}`)&&this.initializeIgnoreList()},this,this.disposables),this.initializeIgnoreList()}dispose(){z(this.disposables)}async getUriOverridingReservedPythonNames(e){let[t,n]=await Promise.all([this.fs.searchLocal("*.py",e.fsPath,!0),this.fs.searchLocal("*/__init__.py",e.fsPath,!0)]),i=[],o=Promise.all(t.map(a=>Xc.Uri.joinPath(e,a)).map(async a=>{await this.isReserved(a)&&i.push({uri:a,type:"file"})})),s=Promise.all(n.map(a=>Xc.Uri.joinPath(e,a)).map(async a=>{await this.isReserved(a)&&i.push({uri:a,type:"__init__"})}));return await Promise.all([o,s]),i}async isReserved(e){if(!e.fsPath.toLowerCase().endsWith(".py"))return!1;await this.pendingUpdate;let t=this.platform.isWindows?e.fsPath.toLowerCase():e.fsPath;if(Array.from(this.ignoredFiles).some(o=>{if(o===t||(0,_7.default)(t,o,{dot:!0}))return!0}))return!1;let n=vn(e,rp(e)).toLowerCase(),i=n==="__init__"?vn(Pi(e)).toLowerCase():n;return this.cachedModules.has(i)}async addToIgnoreList(e){await this.pendingUpdate;let t=Xc.workspace.getConfiguration("jupyter"),n=this.platform.isWindows?e.fsPath.toLowerCase():e.fsPath;this.initializeIgnoreList();let i=this.ignoredFiles.size;if(this.ignoredFiles.add(n),i!==this.ignoredFiles.size)return this.pendingUpdate=this.pendingUpdate.finally(()=>t.update(SK,Array.from(this.ignoredFiles),Xc.ConfigurationTarget.Global)),this.pendingUpdate}initializeIgnoreList(){let t=Xc.workspace.getConfiguration("jupyter").get(SK,[]);this.platform.isWindows&&(t=t.map(n=>n.toLowerCase())),this.ignoredFiles=new Set(t)}};Rv=y([(0,Yc.injectable)(),m(0,(0,Yc.inject)(Ve)),m(0,(0,Yc.named)(ft)),m(1,(0,Yc.inject)(wr)),m(2,(0,Yc.inject)(O)),m(3,(0,Yc.inject)(mr))],Rv);var sC=P(M());var CK=P(fD());var xK="_VSCODE_getVariable",Av=CK.default`
|
||
try:
|
||
del _VSCODE_getVariable
|
||
except:
|
||
pass
|
||
`,es=class{constructor(e,t){this.fs=e;this.context=t}async generateCodeToGetVariableInfo(e){let t=await this.getContentsOfScript(),n=e.isDebugging?"True":"False",i=`${xK}("info", ${n}, ${e.variableName})`;return e.isDebugging?{initializeCode:t,code:i,cleanupCode:Av}:{code:`${t}
|
||
|
||
${i}
|
||
|
||
${Av}`}}async generateCodeToGetVariableProperties(e){let t=await this.getContentsOfScript(),n=e.isDebugging?"True":"False",i=`${xK}("properties", ${n}, ${e.variableName}, ${e.stringifiedAttributeNameList})`;return e.isDebugging?{initializeCode:t,code:i,cleanupCode:Av}:{code:`${t}
|
||
|
||
${i}
|
||
|
||
${Av}`}}async generateCodeToGetAllVariableDescriptions(e){let t=await this.getContentsOfVariablesScript();return e?t=t+`
|
||
|
||
return _VSCODE_getAllChildrenDescriptions('${e.root}', ${JSON.stringify(e.propertyChain)}, ${e.startIndex})`:t=t+`
|
||
|
||
variables= %who_ls
|
||
return _VSCODE_getVariableDescriptions(variables)`,t}async generateCodeToGetVariableTypes(e){let n=`${await this.getContentsOfScript()}
|
||
|
||
_VSCODE_rwho_ls = %who_ls
|
||
`,i=e.isDebugging?"True":"False",o=CK.default`
|
||
try:
|
||
del _VSCODE_rwho_ls
|
||
except:
|
||
pass
|
||
`,s=`${xK}("types", ${i}, _VSCODE_rwho_ls)`;return e.isDebugging?{initializeCode:n,code:s,cleanupCode:`${Av}
|
||
${o}`}:{code:`${n}${s}
|
||
|
||
${Av}
|
||
${o}`}}async generateCodeToGetVariableValueSummary(e){let t=await this.getContentsOfVariablesScript();return t=t+`
|
||
|
||
variables= %who_ls
|
||
return _VSCODE_getVariableSummary(${e})`,t}async getContentsOfScript(){if(es.contentsOfScript)return es.contentsOfScript;let e=er(this.context.extensionUri,"pythonFiles","vscode_datascience_helpers","getVariableInfo","vscodeGetVariableInfo.py"),t=await this.fs.readFile(e);return es.contentsOfScript=t,t}async getContentsOfVariablesScript(){if(es.contentsOfVariablesScript)return es.contentsOfVariablesScript;let e=er(this.context.extensionUri,"pythonFiles","vscode_datascience_helpers","getVariableInfo","vscodeGetVariablesForProvider.py"),t=await this.fs.readFile(e);return es.contentsOfVariablesScript=t,t}};es=y([(0,sC.injectable)(),m(0,(0,sC.inject)(st)),m(1,(0,sC.inject)(ot))],es);var Nv=P(M());var ka=class{constructor(e){this.workspaceInterpreterTracker=e;ka.isActiveWorkspaceInterpreter=this.isActiveWorkspaceInterpreterImpl.bind(this)}activate(){this.workspaceInterpreterTracker?.activate()}isActiveWorkspaceInterpreterImpl(e,t){return this.workspaceInterpreterTracker?.isActiveWorkspaceInterpreter(e,t)??!1}};ka.isActiveWorkspaceInterpreter=()=>!1,ka=y([(0,Nv.injectable)(),m(0,(0,Nv.inject)(AD)),m(0,(0,Nv.optional)())],ka);var aC=require("vscode");var Ov=P(M());var Mv=class{constructor(e,t,n){this.pythonExtensionChecker=e;this.disposables=t;this.interpreterService=n;this.workspaceInterpreters=new Map}activate(){this.trackActiveInterpreters(),aC.extensions.onDidChange(this.trackActiveInterpreters,this,this.disposables)}isActiveWorkspaceInterpreter(e,t){if(!t)return!1;let n=_s(e),i=this.workspaceInterpreters.get(n);return i?Bo(i,t.uri):!1}trackActiveInterpreters(){ln()||this.trackingInterpreters||!this.pythonExtensionChecker.isPythonExtensionActive||(this.trackingInterpreters=!0,this.interpreterService.onDidChangeInterpreter(async()=>{let e=Array.isArray(aC.workspace.workspaceFolders)?aC.workspace.workspaceFolders.map(t=>t.uri):[];await Promise.all(e.map(async t=>{try{let n=_s(t),i=await this.interpreterService.getActiveInterpreter(t);this.workspaceInterpreters.set(n,i?.uri)}catch{}}))},this,this.disposables))}};Mv=y([(0,Ov.injectable)(),m(0,(0,Ov.inject)($e)),m(1,(0,Ov.inject)(O)),m(2,(0,Ov.inject)(rt))],Mv);function T7(r){r.addSingleton(Ur,Dv),r.addSingleton(Vs,Vs),r.addSingleton(Ml,Ml),r.addSingleton(Gp,Bs),r.addSingleton(ge,ka),r.addSingleton(ge,kv),r.addSingleton(AD,Mv),r.addSingleton(ge,fv),r.addSingleton(ge,hv),r.addSingleton(ge,$p),r.addSingleton(di,di),r.addSingleton(RD,Rv),r.addSingleton(Jh,es),r.addSingleton($h,$l),r.addSingleton(qm,bv),r.addSingleton(qm,Sv),r.addSingleton(qm,Iv),r.addSingleton(qm,xv),r.addSingleton(SD,gv),r.addSingleton(eC,Ev),r.addSingleton(Vi,Cv),r.addSingleton(tC,wv,"DataScience"),r.addSingleton(qs,qs),r.addBinding(qs,ge)}var M7=P(M()),Fv=require("vscode");var A7=new Set;function N7(r){A7.add(r)}function R7(r){try{A7.forEach(e=>e.report(r))}catch(e){d.error("Failed to report progress",e)}}function Kv(r){return function(e,t,n){let i=n.value;n.value=async function(...o){return R7({action:r,phase:"started"}),i.apply(this,o).finally(()=>{R7({action:r,phase:"completed"})})}}}var ts=class{constructor(){this.progressReporters=[];this.actionPhases=new Map;this.currentActions=[];N7(this)}get currentAction(){return this.currentActions.length===0?void 0:this.currentActions[this.currentActions.length-1]}createProgressIndicator(e,t=!1){let n=new Fv.CancellationTokenSource,i=oe(),o={location:Fv.ProgressLocation.Notification,cancellable:t,title:e};return Fv.window.withProgress(o,async(s,a)=>{a.onCancellationRequested(()=>{a.isCancellationRequested&&n.cancel(),i.resolve()}),n.token.onCancellationRequested(()=>{i.resolve()}),this.progressReporters.push(s),await i.promise}).then(h,h),{token:n.token,dispose:()=>i.resolve()}}report(e){if(this.progressReporters.length!==0&&(this.actionPhases.set(e.action,e.phase),e.phase==="started"&&this.currentActions.push(e.action),!!this.currentAction)){for(;this.actionPhases.get(this.currentAction)&&this.actionPhases.get(this.currentAction)!=="started";)this.actionPhases.delete(this.currentAction),this.currentActions.pop();this.updateProgressMessage()}}updateProgressMessage(){if(!this.currentAction||this.progressReporters.length===0)return;let e=eP(this.currentAction);e&&this.progressReporters.forEach(t=>t.report({message:e}))}};ts=y([(0,M7.injectable)()],ts);var O7=P(M());var ti=require("vscode");var Zc=require("vscode");var lC=class r{constructor(e){this.jupyterConfig=e}static{this.migratedSettings={interactiveWindowMode:"interactiveWindow.creationMode",interactiveWindowViewColumn:"interactiveWindow.viewColumn",splitRunFileIntoCells:"interactiveWindow.splitRunFileIntoCells",sendSelectionToInteractiveWindow:"interactiveWindow.textEditor.executeSelection",normalizeSelectionForInteractiveWindow:"interactiveWindow.textEditor.normalizeSelection",magicCommandsAsComments:"interactiveWindow.textEditor.magicCommandsAsComments",enableAutoMoveToNextCell:"interactiveWindow.textEditor.autoMoveToNextCell",newCellOnRunLast:"interactiveWindow.textEditor.autoAddNewCell",pythonCellFolding:"interactiveWindow.textEditor.cellFolding",enableCellCodeLens:"interactiveWindow.codeLens.enable",addGotoCodeLenses:"interactiveWindow.codeLens.enableGotoCell",codeLenses:"interactiveWindow.codeLens.commands",debugCodeLenses:"interactiveWindow.codeLes.debugCommands",codeRegularExpression:"interactiveWindow.cellMarker.codeRegex",markdownRegularExpression:"interactiveWindow.cellMarker.markdownRegex",decorateCells:"interactiveWindow.cellMarker.decorateCells",defaultCellMarker:"interactiveWindow.cellMarker.default",enableExtendedKernelCompletions:"enableExtendedPythonKernelCompletions"}}static{this.fullSettingIds={...this.migratedSettings}}async migrateSettings(){let e=[];for(let t of Object.keys(r.migratedSettings))e.push(...this.migrateSetting(t,r.migratedSettings[t]));e.push(this.migrateIntellisenseSettings());try{await Promise.all(e)}catch(t){Lv(t)}}async migrateIntellisenseSettings(){let e="pythonCompletionTriggerCharacters",t="completionTriggerCharacters",n=this.jupyterConfig.inspect(e),i=this.jupyterConfig.inspect(t);try{if(n?.globalValue===n?.defaultValue||!i||i?.globalValue&&i.globalValue[ye])return;if(typeof n?.globalValue=="string"){let o=i.globalValue||i.defaultValue||{};o[ye]=n.globalValue.split(""),await this.jupyterConfig.update(t,o,Zc.ConfigurationTarget.Global).then(h,Lv)}}finally{n?.globalValue&&await this.jupyterConfig.update(e,void 0,Zc.ConfigurationTarget.Global).then(h,Lv)}}migrateSetting(e,t){let n=this.jupyterConfig.inspect(e),i=this.jupyterConfig.inspect(t),o=[];if(n?.workspaceValue!==void 0){let s=Promise.resolve();i?.workspaceValue===void 0&&(s=this.jupyterConfig.update(t,n.workspaceValue,Zc.ConfigurationTarget.Workspace)),o.push(s.then(()=>this.jupyterConfig.update(e,void 0,Zc.ConfigurationTarget.Workspace),Lv))}if(n?.workspaceFolderValue!==void 0){let s=Promise.resolve();i?.workspaceFolderValue===void 0&&(s=this.jupyterConfig.update(t,n.workspaceFolderValue,Zc.ConfigurationTarget.WorkspaceFolder)),o.push(s.then(()=>this.jupyterConfig.update(e,void 0,Zc.ConfigurationTarget.WorkspaceFolder),Lv))}if(n?.globalValue!==void 0){let s=Promise.resolve();i?.globalValue===void 0&&(s=this.jupyterConfig.update(t,n.globalValue,Zc.ConfigurationTarget.Global)),o.push(s.then(()=>this.jupyterConfig.update(e,void 0,Zc.ConfigurationTarget.Global),Lv))}return o}};function Lv(r){d.warn("Error migrating Jupyter configuration",r)}function Ofe(r){return(e,t,n)=>{let i=null,o=null;if(typeof n.value=="function"?(i="value",o=n.value):typeof n.get=="function"&&(i="get",o=n.get),!o)throw new Error("not supported");n[i]=r(o,t)}}function Uv(r,e,t){return Ofe((n,i)=>{let o=`$debounce$${i}`,s=`$debounce$result$${i}`;return function(...a){this[s]||(this[s]=t?t():void 0),clearTimeout(this[o]),e&&(this[s]=e(this[s],...a),a=[this[s]]),this[o]=setTimeout(()=>{n.apply(this,a),this[s]=t?t():void 0},r)}})}var Pa=class Pa{constructor(e,t,n){this._systemVariablesCtor=t;this._type=n;this.allowUnauthorizedRemoteConnection=!1;this.jupyterInterruptTimeout=1e4;this.jupyterLaunchTimeout=6e4;this.jupyterLaunchRetries=3;this.notebookFileRoot="";this.useDefaultConfigForJupyter=!1;this.sendSelectionToInteractiveWindow=!1;this.normalizeSelectionForInteractiveWindow=!0;this.splitRunFileIntoCells=!0;this.markdownRegularExpression="";this.codeRegularExpression="";this.errorBackgroundColor="";this.variableExplorerExclude="";this.decorateCells="currentCell";this.enableCellCodeLens=!1;this.askForLargeDataFrames=!1;this.enableAutoMoveToNextCell=!1;this.askForKernelRestart=!1;this.codeLenses="";this.debugCodeLenses="";this.debugpyDistPath="";this.stopOnFirstLineWhileDebugging=!1;this.magicCommandsAsComments=!1;this.pythonExportMethod="direct";this.stopOnError=!1;this.addGotoCodeLenses=!1;this.runStartupCommands=[];this.debugJustMyCode=!1;this.defaultCellMarker="";this.themeMatplotlibPlots=!1;this.disableJupyterAutoStart=!1;this.enablePythonKernelLogging=!1;this.jupyterCommandLineArguments=[];this.widgetScriptSources=[];this.interactiveWindowMode="multiple";this.pythonCellFolding=!0;this.interactiveWindowViewColumn="secondGroup";this.disableZMQSupport=!1;this.forceIPyKernelDebugger=!1;this.verboseLogging=!1;this.showVariableViewWhenDebugging=!0;this.newCellOnRunLast=!0;this.logKernelOutputSeparately=!1;this.development=!1;this.poetryPath="";this.excludeUserSitePackages=!1;this.enableExtendedPythonKernelCompletions=!1;this.formatStackTraces=!1;this._changeEmitter=new ti.EventEmitter;this._disposables=[];this._workspaceRoot=e,this.initialize(),ti.workspace.isTrusted===!1&&(this.disableJupyterAutoStart=!0)}get onDidChange(){return this._changeEmitter.event}static{this.jupyterSettings=new Map}static getInstance(e,t,n){let i=Pa.getSettingsUriAndTarget(e).uri,o=i?i.path:"",s=Pa.jupyterSettings.get(o);return s?s._type==="web"&&n==="node"&&(s._systemVariablesCtor=t,s._type=n):(s=new Pa(i,t,n),Pa.jupyterSettings.set(o,s)),s}static getSettingsUriAndTarget(e){let t=e?ti.workspace.getWorkspaceFolder(e):void 0,n=t?t.uri:void 0;!n&&Array.isArray(ti.workspace.workspaceFolders)&&ti.workspace.workspaceFolders.length>0&&(n=ti.workspace.workspaceFolders[0].uri);let i=n?ti.ConfigurationTarget.WorkspaceFolder:ti.ConfigurationTarget.Global;return{uri:n,target:i}}static dispose(){if(!_r())throw new Error("Dispose can only be called from unit tests");Pa.jupyterSettings.forEach(e=>e&&e.dispose()),Pa.jupyterSettings.clear()}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables=[]}createSystemVariables(e){return new this._systemVariablesCtor(e,this._workspaceRoot)}toJSON(){let e={};return this.getSerializableKeys().forEach(n=>e[n]=this[n]),e}update(e,t){let n=this.createSystemVariables(void 0),i=n.resolveAny(e.get("experiments"));this.experiments?Object.assign(this.experiments,i):this.experiments=i,this.experiments=this.experiments?this.experiments:{enabled:!0,optInto:[],optOutFrom:[]};let o=(a,l)=>{let c=lC.fullSettingIds[a],u=c&&l.get(c)!==void 0?l.get(c):l.get(a),p=n.resolveAny(u);p!==void 0&&(this[a]=p)};this.getSerializableKeys().filter(a=>a!=="experiments"&&a!=="logging"&&a!=="kernelPickerType").forEach(a=>o(a,e)),t&&o("poetryPath",t)}onWorkspaceFoldersChanged(){let e=(ti.workspace.workspaceFolders||[]).map(i=>i.uri.path),n=Array.from(Pa.jupyterSettings.keys()).filter(i=>e.indexOf(i)<0);if(n.length>0)for(let i of n)Pa.jupyterSettings.delete(i)}initialize(){let e=()=>{let i=ti.workspace.getConfiguration("jupyter",this._workspaceRoot),o=ti.workspace.getConfiguration("python",this._workspaceRoot);this.update(i,o),this.debounceChangeNotification()};this._disposables.push(ti.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged,this)),this._disposables.push(ti.workspace.onDidChangeConfiguration(i=>{i.affectsConfiguration("jupyter")&&e(),i.affectsConfiguration("python.poetryPath")&&e()}));let t=ti.workspace.getConfiguration("jupyter",this._workspaceRoot),n=ti.workspace.getConfiguration("python",this._workspaceRoot);t&&(this.update(t,n),this.migrateSettings(t).catch(h))}async migrateSettings(e){await new lC(e).migrateSettings()}debounceChangeNotification(){this._changeEmitter.fire()}fireChangeNotification(){this._changeEmitter.fire()}getSerializableKeys(){return Object.getOwnPropertyNames(this).filter(e=>!e.startsWith("_"))}};y([Uv(1)],Pa.prototype,"debounceChangeNotification",1);var jv=Pa;var zl=require("vscode");var WD=class{async updateSectionSetting(e,t,n,i,o){let a={uri:i,target:o||zl.ConfigurationTarget.WorkspaceFolder};e==="jupyter"&&o!==zl.ConfigurationTarget.Global&&(a=jv.getSettingsUriAndTarget(i));let l=zl.workspace.getConfiguration(e,a.uri),c=l.inspect(t);c!==void 0&&(o===zl.ConfigurationTarget.Global&&c.globalValue===n||o===zl.ConfigurationTarget.Workspace&&c.workspaceValue===n||o===zl.ConfigurationTarget.WorkspaceFolder&&c.workspaceFolderValue===n)||(await l.update(t,n,o),o&&await this.verifySetting(l,o,t,n))}async updateSetting(e,t,n,i){return this.updateSectionSetting("jupyter",e,t,n,i)}async verifySetting(e,t,n,i){if(_r()&&!NS()){let o=0;do{let s=e.inspect(n);if(!s&&i===void 0||s&&i!==void 0&&(t===zl.ConfigurationTarget.Global?s.globalValue:t===zl.ConfigurationTarget.Workspace?s.workspaceValue:s.workspaceFolderValue)===i)break;await new Promise(a=>setTimeout(a,250)),o+=1}while(o<20)}}};var Wv=class extends WD{getSettings(e){return jv.getInstance(e,cv,"node")}};Wv=y([(0,O7.injectable)()],Wv);var qn=P(Wl()),T$=P(KK()),R$=P(M()),A$=P(C$()),N$=require("util");var D$=P(M()),ed=P(require("vscode"));var k$=P(E$()),P$=require("vscode"),Ql=class{constructor(e=k$.fetch){this.fetchImplementation=e;this.requestOptions={};let t=P$.workspace.getConfiguration("http").get("proxy","");t&&(this.requestOptions={headers:{proxy:t}})}async downloadFile(e){return this.fetchImplementation(e,this.requestOptions)}async exists(e){try{return(await this.downloadFile(e)).status===200}catch(t){return d.debug(`HttpClient - Failure checking for file ${e}: ${t}`),!1}}};var _$="utf8",$v=class{constructor(){this.vscfs=ed.workspace.fs}arePathsSame(e,t){return ki(e,t)}async getFiles(e){return(await this.vscfs.readDirectory(e)).filter(n=>n[1]===ed.FileType.File).map(n=>ed.Uri.file(n[0]))}async copy(e,t,n){await this.vscfs.copy(e,t,n)}async createDirectory(e){await this.vscfs.createDirectory(e)}async delete(e){await this.vscfs.delete(e)}async readFile(e){let t=await this.vscfs.readFile(e);return new TextDecoder().decode(t)}async stat(e){return this.vscfs.stat(e)}async writeFile(e,t){return this.vscfs.writeFile(e,typeof t=="string"?new TextEncoder().encode(t):t)}async exists(e,t){if(e.scheme.toLowerCase()==="http"||e.scheme.toLowerCase()==="https")return new Ql().exists(e.toString());let n;try{n=await this.stat(e)}catch(i){return oD(i)||d.error(`stat() failed for "${e}"`,i),!1}return t===void 0?!0:t===ed.FileType.Unknown?n.type===ed.FileType.Unknown:(n.type&t)===t}async getFileHash(e){let t=await this.stat(e),n=`${t.ctime}-${t.mtime}`;return va(n,"SHA-512")}};$v=y([(0,D$.injectable)()],$v);var M$=require("vscode");var ru=class extends $v{constructor(){super();this.globFiles=(0,N$.promisify)(T$.default)}createLocalWriteStream(t){return qn.createWriteStream(t)}async createTemporaryLocalFile(t){let n=typeof t=="string"?t:t.fileExtension,i=t&&typeof t=="object"?t.prefix:void 0,o={postfix:n,prefix:i};return new Promise((s,a)=>{A$.file(o,(l,c,u,p)=>{if(l)return a(l);s({filePath:c,dispose:p})})})}async searchLocal(t,n,i){let o;n&&(o={...o,cwd:n}),i&&(o={...o,dot:i});let s=await this.globFiles(t,o);return Array.isArray(s)?s:[]}async writeLocalFile(t,n){return await qn.ensureDir(lt(t)),qn.writeFile(t,n)}async readFile(t){if(Qm(t)){let n=await qn.readFile(De(t));return Buffer.from(n).toString(_$)}else return super.readFile(t)}async delete(t){Qm(t)?await this.exists(t)&&((await this.stat(t)).type===M$.FileType.Directory?await new Promise(i=>qn.rm(De(t),{force:!0,recursive:!0},i)):await qn.unlink(De(t))):await super.delete(t)}async exists(t,n){return Qm(t)?qn.pathExists(De(t)):super.exists(t,n)}async createDirectory(t){Qm(t)?await qn.ensureDir(De(t)):await this.vscfs.createDirectory(t)}async writeFile(t,n){if(Qm(t)){let i=De(t);return await qn.ensureDir(lt(i)),qn.writeFile(i,typeof n=="string"?Buffer.from(n):n)}else await this.vscfs.writeFile(t,typeof n=="string"?new TextEncoder().encode(n):n)}async copy(t,n,i){if(Qm(t)&&Qm(n)){let o=typeof i===void 0||typeof i?.overwrite==null?!0:i?.overwrite;await qn.copy(De(t),De(n),{overwrite:o})}else await super.copy(t,n,i)}};ru=y([(0,R$.injectable)()],ru);function Qm(r){return r.scheme==="file"}var hC=P(Wl());var O$=P(M()),K$=require("vscode");var Hv=class extends hk{async computeWorkingDirectory(e){return gC(e)}};Hv=y([(0,O$.injectable)()],Hv);async function gC(r){let e=r&&r.scheme==="file"?await hC.pathExists(r.fsPath):!1;return(r&&r.scheme==="file"?await hC.pathExists(lt(r.fsPath)):!1)&&r&&r.fsPath.includes(".")?lt(r.fsPath):e&&r&&(await hC.stat(r.fsPath)).isDirectory()?r.fsPath:r&&K$.workspace.getWorkspaceFolder(r)?.uri.fsPath||xl()?.fsPath||process.cwd()}var Ym=P(M());var F$=require("vscode");var Gv=class{constructor(e,t){this.jupyterOutput=e;this.disposableRegistry=t}register(){this.disposableRegistry.push(F$.commands.registerCommand(q.ViewJupyterOutput,this.viewJupyterOutput,this))}viewJupyterOutput(){this.jupyterOutput.show(!0)}};Gv=y([(0,Ym.injectable)(),m(0,(0,Ym.inject)(Wo)),m(0,(0,Ym.named)(Ju)),m(1,(0,Ym.inject)(O))],Gv);var vC=P(M()),U$=require("vscode");var L$=require("vscode");var zv=class{constructor(e,t,n,i=[]){this.fs=e;this.disposableRegistry=t;this.options=n;this.loadFailedEmitter=new L$.EventEmitter;let o={enableScripts:!0,localResourceRoots:[this.options.rootPath,this.options.cwd,...i]};n.webviewHost?(this.webviewHost=n.webviewHost,this.webviewHost.webview.options=o):this.webviewHost=this.createWebview(o),this.loadPromise=this.load()}get loadFailed(){return this.loadFailedEmitter.event}asWebviewUri(e){if(!this.webviewHost?.webview)throw new Error("WebView not initialized, too early to get a Uri");return this.webviewHost.webview.asWebviewUri(e)}postMessage(e){this.webviewHost?.webview&&this.webviewHost?.webview.postMessage(e)}async generateLocalReactHtml(){if(!this.webviewHost?.webview)throw new Error("WebView not initialized, too early to get a Uri");let e=this.webviewHost.webview.asWebviewUri(this.options.cwd).toString(),t=this.options.scripts.map(o=>this.webviewHost.webview.asWebviewUri(o)),n=this.webviewHost.webview.asWebviewUri(this.options.rootPath).toString(),i="false";return`<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
|
||
<meta http-equiv="Content-Security-Policy" content="img-src 'self' data: https: http: blob: ${this.webviewHost.webview.cspSource}; default-src 'unsafe-inline' 'unsafe-eval' data: https: http: blob: ${this.webviewHost.webview.cspSource};">
|
||
<meta name="theme-color" content="#000000">
|
||
<meta name="theme" content="${qe.GeneratedThemeName}"/>
|
||
<title>VS Code Python React UI</title>
|
||
<base href="${e}${e.endsWith("/")?"":"/"}"/>
|
||
</head>
|
||
<body>
|
||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||
<div id="root"></div>
|
||
<script type="text/javascript">
|
||
// Public path that will be used by webpack.
|
||
window.__PVSC_Public_Path = "${n}/";
|
||
function resolvePath(relativePath) {
|
||
if (relativePath && relativePath[0] == '.' && relativePath[1] != '.') {
|
||
return "${e}" + relativePath.substring(1);
|
||
}
|
||
|
||
return "${e}" + relativePath;
|
||
}
|
||
function forceTestMiddleware() {
|
||
return ${i};
|
||
}
|
||
</script>
|
||
${t.map(o=>`<script type="text/javascript" src="${o}"></script>`).join(`
|
||
`)}
|
||
</body>
|
||
</html>`}async load(){try{this.webviewHost?.webview&&((await Promise.all(this.options.scripts.map(t=>this.fs.exists(t)))).every(t=>t===!0)?(this.webviewHost.webview.html=await this.generateLocalReactHtml(),this.postLoad(this.webviewHost)):this.webviewHost.webview.html=I.badWebPanelFormatString(this.options.scripts.join(", ")))}catch(e){d.error(`Error Loading WebviewPanel: ${e}`),this.loadFailedEmitter.fire()}}};var YK=class extends zv{constructor(t,n,i,o=[]){super(t,n,i,o);this.panelOptions=i;this._onDidChangeVisibility=new U$.EventEmitter}get visible(){return this.webviewHost?this.webviewHost.visible:!1}get onDidChangeVisibility(){return this._onDidChangeVisibility.event}createWebview(t){throw new Error("Webview Views must be passed in an initial view")}postLoad(t){this.disposableRegistry.push(t.onDidDispose(()=>{this.webviewHost=void 0,this.panelOptions.listener.dispose()})),this.disposableRegistry.push(t.webview.onDidReceiveMessage(n=>{this.panelOptions.listener.onMessage(n.type,n.payload)})),this.disposableRegistry.push(t.onDidChangeVisibility(()=>{this._onDidChangeVisibility.fire()})),this._onDidChangeVisibility.fire()}},Qv=class{constructor(e,t){this.disposableRegistry=e;this.fs=t}async create(e){return new YK(this.fs,this.disposableRegistry,e)}};Qv=y([(0,vC.injectable)(),m(0,(0,vC.inject)(O)),m(1,(0,vC.inject)(st))],Qv);var Xv=P(M()),GD=require("vscode");var XK=class extends zv{get panel(){return this.webviewHost}get panelOptions(){return this.options}constructor(e,t,n,i=[]){super(e,t,n,i)}async show(e){await this.loadPromise,this.panel&&(e?this.panel.visible||this.panel.reveal(this.panel.viewColumn,e):this.panel.active||this.panel.reveal(this.panel.viewColumn,e))}close(){this.panel&&this.panel.dispose()}get viewColumn(){return this.panel?.viewColumn}isVisible(){return this.panel?this.panel.visible:!1}isActive(){return this.panel?this.panel.active:!1}setTitle(e){this.panelOptions.title=e,this.panel&&(this.panel.title=e)}createWebview(e){return GD.window.createWebviewPanel(this.panelOptions.title.toLowerCase().replace(" ",""),this.panelOptions.title,{viewColumn:this.panelOptions.viewColumn,preserveFocus:!0},{retainContextWhenHidden:!0,enableFindWidget:!0,...e})}postLoad(e){this.disposableRegistry.push(e.onDidDispose(()=>{this.webviewHost=void 0,this.panelOptions.listener.dispose()})),this.disposableRegistry.push(e.webview.onDidReceiveMessage(t=>{this.panelOptions.listener.onMessage(t.type,t.payload)})),this.disposableRegistry.push(e.onDidChangeViewState(t=>{this.panelOptions.listener.onChangeViewState(this)})),this.panelOptions.listener.onChangeViewState(this)}},Yv=class{constructor(e,t,n){this.disposableRegistry=e;this.fs=t;this.context=n}async create(e){let t=[GD.Uri.file(je(this.context.extensionPath,"temp"))];return Array.isArray(e.additionalPaths)&&t.push(...e.additionalPaths),new XK(this.fs,this.disposableRegistry,e,t)}};Yv=y([(0,Xv.injectable)(),m(0,(0,Xv.inject)(O)),m(1,(0,Xv.inject)(st)),m(2,(0,Xv.inject)(ot))],Yv);function j$(r){r.addSingleton(ru,ru),r.addBinding(ru,mr),r.addBinding(ru,st),r.addSingleton(oP,Hv),r.addSingleton(le,Wv),D3(r),I8(r),x8(r),T7(r),r.addSingletonInstance(Yj,Date.now()),r.addSingleton(ts,ts),r.addSingleton(ge,dt),r.addSingleton(qh,Gv),r.add(sP,Qv),r.add(Dp,Yv)}var Xm=P(M()),$$=require("vscode");var nd=P(M()),ty=require("vscode");var yC=P(M()),nu=require("vscode");var Zv=Symbol("IJupyterCommandFactory"),td=Symbol("IJupyterSubCommandExecutionService");function khe(r){r.sort((e,t)=>e===18?-1:t===18?1:e===20?-1:t===20?1:0)}function ZK(r,e){let t=Yr(e)||Yr(e)||Tr(e)?.environment?.folderUri?.fsPath||e.uri.fsPath,n=r.map(i=>dr.get(i)).filter(i=>!!i).map(i=>i);switch(n.length){case 0:return"";case 1:return t?I.libraryRequiredToLaunchJupyterNotInstalledInterpreter(t,n[0]):I.libraryRequiredToLaunchJupyterNotInstalled(n[0]);default:{let i=n.pop();return t?I.librariesRequiredToLaunchJupyterNotInstalledInterpreter(t,`${n.join(", ")} ${me.and} ${i}`):I.librariesRequiredToLaunchJupyterNotInstalled(`${n.join(", ")} ${me.and} ${i}`)}}}var Js=class{constructor(e,t){this.installer=e;this.commandFactory=t;this.dependenciesInstalledInInterpreter=new Set}async installMissingDependencies(e,t){let n=new nu.CancellationTokenSource;try{let i=Be(e)==="Conda"?Promise.resolve(void 0):this.installer.isInstalled(27,e),[o,s]=await Promise.all([this.getDependenciesNotInstalled(e,void 0),i]);if(o.length===0)return 0;let a=ZK(s===!1?[27].concat(o):o,e);switch(A("DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"displayed",moduleName:dr.get(18),pythonEnvType:Be(e)}),await nu.window.showErrorMessage(a,{modal:!0},I.jupyterInstall,I.selectDifferentJupyterInterpreter)){case I.jupyterInstall:{o.includes(21)&&!o.includes(18)&&o.push(18);let c=o.filter(p=>p!==21);khe(c);let u=c.shift();for(;u;)if(await nr(n.token,2,this.installer.install(u,e,n,void 0,s===!1))===0){u=c.shift();continue}else return 2;return A("DATASCIENCE.USER_INSTALLED_JUPYTER"),this.checkKernelSpecAvailability(e)}case I.selectDifferentJupyterInterpreter:return A("DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER"),1;case I.pythonInteractiveHelpLink:return nu.env.openExternal(nu.Uri.parse(AS.PythonInteractiveHelpLink)),A("DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER"),2;default:return A("DATASCIENCE.USER_DID_NOT_INSTALL_JUPYTER"),2}}finally{n.dispose()}}async areDependenciesInstalled(e,t){return this.getDependenciesNotInstalled(e,t).then(n=>n.length===0)}async getDependenciesNotInstalled(e,t){let n=gn(e.uri);if(this.dependenciesInstalledInInterpreter.has(n))return[];let i=[];if(await nr(t,Promise.all([this.installer.isInstalled(18,e).then(s=>s?void 0:i.push(18)),this.installer.isInstalled(20,e).then(s=>s?void 0:i.push(20))])),i.length>0)return i;if(t?.isCancellationRequested)return[];let o=await this.isKernelSpecAvailable(e,t).then(s=>s?[]:[21]);return o.length===0&&this.dependenciesInstalledInInterpreter.add(n),o}async isKernelSpecAvailable(e,t){return this.commandFactory.createInterpreterCommand("kernelspec","jupyter",["-m","jupyter","kernelspec"],e,!1).exec(["--version"],{throwOnStdErr:!0}).then(()=>!0).catch(i=>(d.error("Kernel spec not found: ",i),!1))}async checkKernelSpecAvailability(e,t){return await this.isKernelSpecAvailable(e)?0:t?.isCancellationRequested?2:await nu.window.showErrorMessage(I.jupyterKernelSpecModuleNotFound(e.uri.fsPath),{modal:!0},I.selectDifferentJupyterInterpreter)===I.selectDifferentJupyterInterpreter?1:2}};y([Kv("InstallingMissingDependencies")],Js.prototype,"installMissingDependencies",1),Js=y([(0,yC.injectable)(),m(0,(0,yC.inject)(Vi)),m(1,(0,yC.inject)(Zv))],Js);var ZD=P(M());var e_=require("vscode");var V$=require("vscode");function zD(r,e){let t=Yr(r),i={label:`${r.id===e.recommended?.id?"$(star-full) ":Hr(r)?"$(warning) ":""}${t}`};return i.description=B(r.executable.uri||r.path,V$.workspace.workspaceFolders||[],new Vl().homeDir),i.tooltip=Hr(r)?I.pythonCondaKernelsWithoutPython:"",i}function QD(r){switch(Be(r)){case"Conda":return Hr(r)?{label:I.kernelCategoryForCondaWithoutPython,sortKey:"Z"}:{label:I.kernelCategoryForConda};case"PipEnv":return{label:I.kernelCategoryForPipEnv};case"Poetry":return{label:I.kernelCategoryForPoetry};case"Pyenv":return{label:I.kernelCategoryForPyEnv};case"Venv":case"VirtualEnv":case"VirtualEnvWrapper":return{label:I.kernelCategoryForVirtual};default:return{label:I.kernelCategoryForGlobal}}}var $s=P(M()),B$=require("vscode");var YD="INTERPRETER_PATH_SELECTED_FOR_JUPYTER_SERVER",eF="INTERPRETER_PATH_WAS_SELECTED_FOR_JUPYTER_SERVER",Da=class{constructor(e){this.memento=e}get interpreterSetAtleastOnce(){return!!this.selectedPythonPath||this.memento.get(eF,!1)}get selectedPythonPath(){if(this._interpreterPath)return this._interpreterPath;let e=this.memento.get(YD,void 0);if(e)return B$.Uri.parse(e)}updateSelectedPythonPath(e){this._interpreterPath=e,this.memento.update(YD,e?.toString()).then(h,h),this.memento.update(eF,!0).then(h,h)}};Da=y([(0,$s.injectable)(),m(0,(0,$s.inject)(Ve)),m(0,(0,$s.named)(ft))],Da);var ey=class{constructor(e,t,n,i){this.api=e;this.memento=t;this.checker=n;this.disposables=i}activate(){this.activateBackground().catch(h),this.api.onDidActivatePythonExtension(this.activateBackground,this,this.disposables)}async activateBackground(){!this.memento.get(YD)&&this.checker.isPythonExtensionActive&&await this.migrateSettings()}async migrateSettings(){if(this.settingsMigrated)return;this.settingsMigrated=!0;let t=(await this.api.getApi()).getInterpreterPathSelectedForJupyterServer();await this.memento.update(YD,t),await this.memento.update(eF,!0)}};ey=y([(0,$s.injectable)(),m(0,(0,$s.inject)(Yt)),m(1,(0,$s.inject)(Ve)),m(1,(0,$s.named)(ft)),m(2,(0,$s.inject)($e)),m(3,(0,$s.inject)(O))],ey);var rs=require("vscode");var tF=class{constructor(e){this.label=e}},XD=class extends tF{constructor(t,n){super(t);this.sortKey=n;this.kind=rs.QuickPickItemKind.Separator}},rd=class extends tr{constructor(t,n,i,o,s,a){super();this.provider=t;this.createQuickPickItem=n;this.getCategory=i;this.options=o;this.createErrorQuickPickItem=s;this._title=a;this.categories=new Map;this.quickPickItems=[];this.previouslyEnteredValue="";this.commands=new Set;this._placeholder="";this.quickPickItemMap=new WeakSet;this.errorQuickPickItemMap=new WeakSet}set recommended(t){let n=this._recommended?.id!==t?.id;this._recommended=t,n&&this.quickPick&&this.rebuildQuickPickItems(this.quickPick)}get recommended(){return this._recommended}set placeholder(t){this.quickPick&&(this.quickPick.placeholder=t),this._placeholder=t}get placeholder(){return this._placeholder}set selected(t){let n=this._selected!==t;this._selected=t,n&&this.quickPick&&this.rebuildQuickPickItems(this.quickPick)}get selected(){return this._selected}createQuickPick(){let t=[],n={iconPath:new rs.ThemeIcon("refresh"),tooltip:me.refresh},i=this.quickPick=rs.window.createQuickPick();return t.push(i),this.quickPickItems=[],i.placeholder=this.placeholder,i.matchOnDescription=!0,i.buttons=this.options.supportsBack?[rs.QuickInputButtons.Back,n]:[n],i.ignoreFocusOut=!0,i.busy=!0,i.value=this.previouslyEnteredValue,i.onDidChangeValue(o=>this.previouslyEnteredValue=o,this,t),i.onDidHide(()=>z(t),this,t),i.title=this._title||I.kernelPickerSelectKernelFromRemoteTitleWithoutName,this.provider.then(o=>{this.resolvedProvider=o,this._title||(i.title=I.kernelPickerSelectKernelFromRemoteTitle(o.title)),i.busy=o.status==="discovering",o.onDidChange(()=>this.updateQuickPickItems(i,o),this,t),i.onDidTriggerButton(async a=>{a===n&&(i.busy=!0,await o.refresh().catch(h),this.updateQuickPickItems(i,o),i.busy=!1)},this,t);let s;o.onDidChangeStatus(()=>{switch(s&&clearTimeout(s),o.status){case"discovering":i.busy=!0;break;case"idle":s=setTimeout(()=>i.busy=!1,500),t.push(new rs.Disposable(()=>s&&clearTimeout(s)));break}},this,t),q$(o.items.map(a=>this.toQuickPickItem(a)),(a,l)=>J$(this.getCategory(a.item,this),this.getCategory(l.item,this))).forEach(a=>{let l=this.connectionToCategory(a[0].item);this.quickPickItems.push(l),a.sort((c,u)=>c.label.localeCompare(u.label)),this.quickPickItems.push(...a),this.categories.set(l,new Set(a))}),this.updateQuickPickItems(i,o)}).catch(o=>d.error(`Failed to get quick pick items for ${i.title}`,o)),t.forEach(o=>this._register(o)),{quickPick:i,disposables:t}}isCommandQuickPickItem(t){return this.commands.has(t)}addCommand(t,n){let i=t;return i.execute=n,this.commands.add(i),this.quickPick&&this.rebuildQuickPickItems(this.quickPick),{dispose:()=>{this.commands.delete(i)}}}async selectItem(t){for(;!t.isCancellationRequested;){let{quickPick:n,disposables:i}=this.createQuickPick();n.show();try{this.previouslySelectedItem=void 0;let o=await new Promise((s,a)=>{n.onDidChangeSelection(l=>{if(l.length){let c=l[0];this.isSelectorQuickPickItem(c)?s(c.item):this.isCommandQuickPickItem(c)?s(c):this.isErrorQuickPickItem(c)}}),n.onDidTriggerButton(l=>l===rs.QuickInputButtons.Back?s(Re.back):void 0,this,i),n.onDidHide(()=>s(void 0),this,i)});if(t.isCancellationRequested||!o)return;if(o instanceof Re)return o===Re.back?Re.back:void 0;if(o&&"label"in o&&this.isCommandQuickPickItem(o)){this.previouslySelectedItem=o;let s=await o.execute();if(!s||s===Re.back)continue;return s instanceof Re,s}return o||void 0}finally{z(i)}}}updateQuickPickItems(t,n){let i=new Map(t.items.filter(a=>this.isSelectorQuickPickItem(a)).map(a=>a).map(a=>[a.item.id,a.item])),o=new Map(n.items.map(a=>[a.id,a]));this.quickPickItems=this.quickPickItems.map(a=>{if(this.isSelectorQuickPickItem(a)){let l=i.get(a.item.id);if(l&&l!==a.item)return this.toQuickPickItem(l);let c=o.get(a.item.id);if(c){let u=this.toQuickPickItem(c);if(JSON.stringify({...a,item:""})!==JSON.stringify({...u,item:""}))return this.toQuickPickItem(c)}}return a});let s=n.items.filter(a=>!i.has(a.id)).map(a=>this.toQuickPickItem(a));this.removeOutdatedQuickPickItems(t,n),q$(s,(a,l)=>J$(this.getCategory(a.item,this),this.getCategory(l.item,this))).forEach(a=>{a.sort((u,p)=>u.label.localeCompare(p.label));let l=this.connectionToCategory(a[0].item),c=this.quickPickItems.find(u=>u.kind===rs.QuickPickItemKind.Separator&&u.label===l.label);if(c){let u=this.quickPickItems.indexOf(c),p=this.categories.get(c),f=new Map(Array.from(p).map(b=>[b.item.id,b])),g=p.size;a.forEach(b=>{let C=f.get(b.item.id);C&&p.delete(C),p.add(b)});let v=Array.from(p);v.sort((b,C)=>b.label.localeCompare(C.label)),this.quickPickItems.splice(u+1,g,...v)}else{let u=this.quickPickItems.filter(g=>g instanceof XD).map((g,v)=>[g,v]);u.push([l,-1]),u.sort((g,v)=>g[0].sortKey.localeCompare(v[0].sortKey));let p=u.findIndex(g=>g[1]===-1),f=0;p>0&&(f=u.length===p+1?this.quickPickItems.length:u[p+1][1]),a.sort((g,v)=>g.label.localeCompare(v.label)),this.quickPickItems.splice(f,0,l,...a),this.categories.set(l,new Set(a))}}),this.rebuildQuickPickItems(t)}rebuildQuickPickItems(t){let n=this.recommended?this.toQuickPickItem(this.recommended):void 0,i=[];n&&i.push({label:I.recommendedItemCategoryInQuickPick,kind:rs.QuickPickItemKind.Separator},n);let o=n;o=this.selected?this.quickPickItems.filter(p=>this.isSelectorQuickPickItem(p)).map(p=>p).find(p=>p.item.id===this.selected?.id):o;let s=this.quickPickItems.filter(p=>!this.isSelectorQuickPickItem(p)||p.item.id!==n?.item?.id),a=t.activeItems.length?t.activeItems[0]:void 0;o&&a&&(this.isSelectorQuickPickItem(a)?a.item.id!==o.item.id&&(o=void 0):o=void 0);let l=this.resolvedProvider?.lastError?this.toErrorQuickPickItem(this.resolvedProvider.lastError):void 0,c=[].concat(Array.from(this.commands.values())).concat(i).concat(s).concat(l?[l]:[]),u=o?[o]:t.activeItems.length?[t.activeItems[0]]:[];if(u.length&&!c.includes(u[0])){let p=u[0],f=this.isSelectorQuickPickItem(p)&&c.find(g=>this.isSelectorQuickPickItem(g)&&g.item.id===p.item.id);f?u[0]=f:u.length=0}t.items=c,t.activeItems=u,!t.activeItems.length&&this.previouslySelectedItem&&c.includes(this.previouslySelectedItem)&&(t.activeItems=[this.previouslySelectedItem])}isErrorQuickPickItem(t){return this.errorQuickPickItemMap.has(t)}toErrorQuickPickItem(t){if(!this.createErrorQuickPickItem)return;let n=this.createErrorQuickPickItem(t,this);return this.errorQuickPickItemMap.add(n),n}isSelectorQuickPickItem(t){return this.quickPickItemMap.has(t)}toQuickPickItem(t){let n=this.createQuickPickItem(t,this);return n.item=t,this.quickPickItemMap.add(n),n}removeOutdatedQuickPickItems(t,n){let i=t.items.filter(a=>this.isSelectorQuickPickItem(a)).map(a=>a).map(a=>a.item.id),o=new Map(n.items.map(a=>[a.id,a])),s=i.filter(a=>!o.has(a));if(s.length){let a=[];this.categories.forEach((l,c)=>{l.forEach(u=>{s.includes(u.item.id)&&(l.delete(u),a.push(u))}),l.size||(a.push(c),this.categories.delete(c))}),this.quickPickItems=this.quickPickItems.filter(l=>!a.includes(l)),this.rebuildQuickPickItems(t)}}connectionToCategory(t){let n=this.getCategory(t,this);return new XD(n.label,n.sortKey||n.label)}};function q$(r,e){let t=[],n;for(let i of r.slice(0).sort(e))!n||e(n[0],i)!==0?(n=[i],t.push(n)):n.push(i);return t}function J$(r,e){return(r.sortKey||r.label).localeCompare(e.sortKey||e.label,void 0,{sensitivity:"accent"})}var iu=class{constructor(e){this.serviceContainer=e}async selectPythonInterpreter(){let e=await this.selectPythonEnvironment();return e?.executable?.uri&&await this.serviceContainer.get(rt).getInterpreterDetails(e.executable.uri)}async selectPythonEnvironment(){let e=new e_.CancellationTokenSource,t=new Vl,n=this.serviceContainer.get(Da).selectedPythonPath,i=xe.instance.get(di),o=xe.instance.get(qs).withFilter(u=>!Hr(u)&&!i.isPythonEnvironmentExcluded(u)),s=()=>o.items.find(u=>Bo(u.executable.uri,n,t.osType)),a=n?I.currentlySelectedJupyterInterpreterForPlaceholder(B(n,e_.workspace.workspaceFolders||[],t.homeDir)):"",l=[],c=new rd(Promise.resolve(o),zD,QD,{supportsBack:!1},void 0,I.quickPickSelectPythonEnvironmentTitle);c.placeholder=a,c.selected=s(),l.push(c),l.push(e);try{if(!c.selected&&n){let p=o.onDidChange(()=>{c.selected=s(),c.selected&&p.dispose()});l.push(p)}let u=await c.selectItem(e.token);return!u||u instanceof Re?void 0:u}catch(u){d.error("Failed to select a Python Environment to start Jupyter",u)}finally{z(l)}}};iu=y([(0,ZD.injectable)(),m(0,(0,ZD.inject)(at))],iu);var fi=class{constructor(e,t,n,i,o){this.interpreterSelectionState=e;this.jupyterInterpreterSelector=t;this.interpreterConfiguration=n;this.interpreterService=i;this._onDidChangeInterpreter=new ty.EventEmitter;ty.workspace.onDidGrantWorkspaceTrust(()=>{this.getInitialInterpreterPromiseFailed&&(this.getInitialInterpreterPromise=void 0,this.getInitialInterpreterPromiseFailed=!1)},this,o)}get onDidChangeInterpreter(){return this._onDidChangeInterpreter.event}async getSelectedInterpreter(e){return await this.setInitialInterpreter(e),this._selectedInterpreter}async setInitialInterpreter(e){return this.getInitialInterpreterPromise||(this.getInitialInterpreterPromise=this.getInitialInterpreterImpl(e).then(t=>(t&&this.changeSelectedInterpreterProperty(t),t)),this.getInitialInterpreterPromise.catch(()=>this.getInitialInterpreterPromiseFailed=!0)),this.getInitialInterpreterPromise}async selectInterpreter(){let e=await this.jupyterInterpreterSelector.selectPythonInterpreter();if(!e)return;switch(await this.interpreterConfiguration.installMissingDependencies(e,void 0)){case 0:return await this.setAsSelectedInterpreter(e),e;case 2:return;default:return this.selectInterpreter()}}async installMissingDependencies(e){let t=await this.getSelectedInterpreter(),n=t;if(!n&&(n=await this.interpreterService.getActiveInterpreter(void 0),!n))return e&&await ty.window.showErrorMessage(e.message,{modal:!0},I.selectDifferentJupyterInterpreter)!==I.selectDifferentJupyterInterpreter?2:(await this.selectInterpreter(),1);let i=await this.interpreterConfiguration.installMissingDependencies(n,e);return i===1?(n=await this.selectInterpreter(),n?0:2):(i===0&&n!==t&&await this.setAsSelectedInterpreter(n),i)}async setAsSelectedInterpreter(e){await this.setInitialInterpreter(),this.changeSelectedInterpreterProperty(e)}changeSelectedInterpreterProperty(e){this._selectedInterpreter=e,this._onDidChangeInterpreter.fire(e),this.interpreterSelectionState.updateSelectedPythonPath(e.uri)}async validateInterpreterPath(e,t){try{let n=await nr(t,this.interpreterService.getInterpreterDetails(e));if(n&&await this.interpreterConfiguration.areDependenciesInstalled(n,t))return n}catch{}}async getInitialInterpreterImpl(e){let t;if(this.interpreterSelectionState.selectedPythonPath&&(t=await this.validateInterpreterPath(this.interpreterSelectionState.selectedPythonPath,e),t||this.interpreterSelectionState.updateSelectedPythonPath(void 0)),!t){let n=await this.interpreterService.getActiveInterpreter(void 0);n&&await this.interpreterConfiguration.areDependenciesInstalled(n,e)&&(t=n)}return t}};fi=y([(0,nd.injectable)(),m(0,(0,nd.inject)(Da)),m(1,(0,nd.inject)(iu)),m(2,(0,nd.inject)(Js)),m(3,(0,nd.inject)(rt)),m(4,(0,nd.inject)(O))],fi);var t_=Symbol("IKernelLauncher"),hi=Symbol("IRawNotebookSupportedService"),r_=Symbol("IRawKernelSessionFactory");var ry=class{constructor(e,t,n,i){this.jupyterInterpreterService=e;this.disposables=t;this.rawSupported=n;this.extensionChecker=i;this.notebookOpened=!1}activate(){this.disposables.push($$.workspace.onDidOpenNotebookDocument(this.onDidOpenNotebookEditor,this)),this.disposables.push(this.jupyterInterpreterService.onDidChangeInterpreter(this.onDidChangeInterpreter,this))}onDidOpenNotebookEditor(e){Dt(e)&&(this.notebookOpened=!0,A("DATASCIENCE.NATIVE.OPEN_NOTEBOOK_ALL",e9(e)),!this.rawSupported.isSupported&&this.extensionChecker.isPythonExtensionInstalled&&this.jupyterInterpreterService.setInitialInterpreter().catch(h))}onDidChangeInterpreter(){this.notebookOpened&&!this.rawSupported.isSupported&&this.extensionChecker.isPythonExtensionInstalled&&this.jupyterInterpreterService.setInitialInterpreter().catch(h)}};ry=y([(0,Xm.injectable)(),m(0,(0,Xm.inject)(fi)),m(1,(0,Xm.inject)(O)),m(2,(0,Xm.inject)(hi)),m(3,(0,Xm.inject)($e))],ry);var n_=P(M()),H$=require("vscode");var tn=class{static dispose(){z(tn.disposables)}constructor(e){e.push({dispose:()=>{tn.dispose()}})}activate(){H$.workspace.onDidChangeNotebookDocument(e=>{Dt(e.notebook)&&e.cellChanges.filter(t=>t.outputs?.length===0).map(t=>{let n=tn.cellToDisplayIdMapping.get(t.cell);n&&(tn.cellToDisplayIdMapping.delete(t.cell),tn.displayIdCellOutputMappingPerDocument.get(e.notebook)?.delete(n))})})}static trackOutputByDisplayId(e,t,n,i){let o=tn.displayIdCellOutputMappingPerDocument.get(e.notebook);o||(o=new Map,tn.displayIdCellOutputMappingPerDocument.set(e.notebook,o)),o.set(t,{outputContainer:n,cell:e,outputItems:i}),tn.cellToDisplayIdMapping.set(e,t)}static getMappedOutput(e,t){let n=tn.displayIdCellOutputMappingPerDocument.get(e);if(!n)return;let i=n.get(t);return i?.cell.document.isClosed?void 0:i}};tn.displayIdCellOutputMappingPerDocument=new WeakMap,tn.cellToDisplayIdMapping=new WeakMap,tn.disposables=[],tn=y([(0,n_.injectable)(),m(0,(0,n_.inject)(O))],tn);var Zm=P(M());var rF="Active_Kernel_Id_List",Phe=100,ns=class{constructor(e,t){this.globalMemento=e;this.crypto=t}async getPreferredRemoteKernelId(e){let t=this.globalMemento.get(rF,[]);if(t.length){let n=e.uri,i=await this.crypto.createHash(n.toString()),o=t.find(s=>s.fileHash===i);return d.trace(`Preferred Remote kernel for ${B(n)} is ${o?.kernelId}`),o?.kernelId}}async clearPreferredRemoteKernelId(e){await this.updatePreferredRemoteKernelIdInternal(e)}async storePreferredRemoteKernelId(e,t){await this.updatePreferredRemoteKernelIdInternal(e,t)}async updatePreferredRemoteKernelIdInternal(e,t){let n=!1,i=JSON.parse(JSON.stringify(this.globalMemento.get(rF,[]))),o=await this.crypto.createHash(e.toString()),s=i.findIndex(a=>a.fileHash===o);for(s>=0&&(n=!0,i.splice(s,1)),t&&(n=!0,i.push({fileHash:o,kernelId:t}),d.trace(`Storing Preferred remote kernel for ${B(e)} is ${t}`));i.length>Phe;)n=!0,i.shift();n&&await this.globalMemento.update(rF,i)}};ns=y([(0,Zm.injectable)(),m(0,(0,Zm.inject)(Ve)),m(0,(0,Zm.named)(ft)),m(1,(0,Zm.inject)(Bh))],ns);var iy=P(M());var i_=require("vscode");var or;(n=>{let r=ma(new i_.EventEmitter);n.onDidChangeNotebookCellExecutionState=r.event;function t(i,o,s){if(o!==1||!s){r.fire({cell:i,state:o});return}let a=ma(i_.workspace.onDidChangeNotebookDocument(l=>{if(l.notebook!==i.notebook)return;l.cellChanges.find(u=>u.cell===i)?.cell?.executionSummary?.executionOrder===s&&(a.dispose(),r.fire({cell:i,state:1}))}))}n.changeCellState=t})(or||={});var Dhe=1e3,ny=class{constructor(e,t,n){this.serverStorage=e;this.kernelProvider=t;this.disposables=[];this.timeouts=new Set;this.kernelSpecificUpdates=new WeakMap;n.push(this)}dispose(){z(this.disposables),z(Array.from(this.timeouts.values()))}activate(){this.disposables.push(or.onDidChangeNotebookCellExecutionState(this.onDidChangeNotebookCellExecutionState,this))}onDidChangeNotebookCellExecutionState(e){let t=this.kernelProvider.get(e.cell.notebook);if(!t)return;let n=t.kernelConnectionMetadata;if(!Nt(n))return;let i=this.kernelSpecificUpdates.get(t)||new bs(Dhe);this.kernelSpecificUpdates.set(t,i),i.trigger(()=>{t.disposed||t.disposing||this.serverStorage.update(n.serverProviderHandle).catch(h)})}};ny=y([(0,iy.injectable)(),m(0,(0,iy.inject)(zt)),m(1,(0,iy.inject)(Te)),m(2,(0,iy.inject)(O))],ny);var _a=P(M()),bC=require("vscode");var G$=require("vscode"),Ht=class{constructor(e){this._event=new G$.EventEmitter;this._disableUI=e}get disableUI(){return this._disableUI}set disableUI(e){let t=this._disableUI!==e;this._disableUI=e,t&&this._event.fire()}get onDidChangeDisableUI(){return this._event.event}dispose(){this._event.dispose()}};var _he="last-python-notebook-created",z$="last-notebook-created",oy=class{constructor(e,t,n,i,o,s){this.configService=e;this.serverConnector=t;this.disposables=n;this.rawKernelSupport=i;this.mementoStorage=o;this.kernelProvider=s;bC.workspace.onDidOpenNotebookDocument(this.onDidOpenNotebook.bind(this),this,n)}activate(){this.checkDateForServerStart(),this.disposables.push(this.kernelProvider.onDidStartKernel(this.kernelStarted,this))}get lastNotebookCreated(){let e=this.mementoStorage.get(z$);return e?new Date(e):void 0}checkDateForServerStart(){this.shouldAutoStartStartServer(this.lastNotebookCreated)&&this.createServerIfNecessary().catch(h)}shouldAutoStartStartServer(e){if(!e)return!1;let n=new Date().getTime()-e.getTime();return Math.floor(n/(24*3600*1e3))<=7}async createServerIfNecessary(){if(!bC.workspace.isTrusted||this.rawKernelSupport.isSupported)return;let e=new bC.CancellationTokenSource,t=new Ht(!0);try{d.info("Attempting to start a server because of preload conditions ..."),this.configService.getSettings(void 0).disableJupyterAutoStart||await this.serverConnector.connect({resource:void 0,ui:t,token:e.token})}catch(n){d.error("Error starting server in serverPreload: ",n)}finally{t.dispose(),e.dispose()}}onDidOpenNotebook(e){Dt(e)&&this.createServerIfNecessary().catch(h)}kernelStarted(e){let t=Io(e.kernelConnectionMetadata);this.mementoStorage.update(z$,Date.now()).then(h,h),t===ye&&this.mementoStorage.update(_he,Date.now()).then(h,h)}};oy=y([(0,_a.injectable)(),m(0,(0,_a.inject)(le)),m(1,(0,_a.inject)(Dk)),m(2,(0,_a.inject)(O)),m(3,(0,_a.inject)(hi)),m(4,(0,_a.inject)(Ve)),m(4,(0,_a.named)(ci)),m(5,(0,_a.inject)(Te))],oy);var _o=P(M());var Hs=P(M());var no=class extends ze{constructor(e){super("jupyterinstall",e)}};var Ar=require("vscode");var ef=class extends On{constructor(e){super("timeout",I.rawKernelStartFailedDueToTimeout(ct(e)),e)}};var id=class extends Pl{constructor(t,n,i,o){super(t,i,o);this.stdErr=n}};var sy=class extends On{constructor(e){super("timeout",I.rawKernelStartFailedDueToTimeoutWaitingForPort(ct(e)),e)}};var Yl=class extends On{constructor(t=-1,n,i){super("kerneldied",I.kernelDied(n.trim()),i);this.exitCode=t;this.stdErr=n}};var tf=class extends On{constructor(t,n){super("noipykernel",I.kernelInvalid(ct(n)),n);this.reason=t}};var od=class extends Pl{constructor(e){super(I.kernelDiedWithoutError(ct(e)),void 0,e)}};var o_=class extends ze{constructor(e){super("jupyterexpiredcert",e)}};var sd=class extends ze{constructor(t){super("invalidremotejupyterserverurihandle","Server handle not in list of known handles");this.serverProviderHandle=t}};var ou=class extends ze{constructor(t,n,i){super("jupyternotebooknotinstalled",t+(n?`
|
||
${n}`:""));this.interpreter=i}};var Q$=new Map;function s_(r,e){Q$.set(Lt(r),e)}function ay(r,e,t){let n=e.jupyterCollections.find(i=>i.extensionId===r.extensionId&&i.id===r.id);return Q$.get(Lt(r))||n?.label||t||`${r.id}:${r.handle}`}var cy=class{constructor(e,t,n,i,o,s,a){this.dependencyManager=e;this.configuration=t;this.kernelDependency=n;this.serverUriStorage=i;this.jupyterUriProviderRegistration=o;this.fs=s;this.interpreterService=a;this.handledErrors=new WeakSet;this.handledKernelErrors=new WeakSet}async handleError(e){if(d.warn("DataScience Error",e),e=cn.unwrap(e),!this.handledErrors.has(e)){if(this.handledErrors.add(e),e instanceof no)await this.dependencyManager?.installMissingDependencies(e);else if(e instanceof Jo)await Ek(this.configuration,e.message);else if(e instanceof o_)await kk(this.configuration,e.message);else if(!pr(e))if(e instanceof ef||e instanceof sy)Ar.window.showErrorMessage(e.message).then(h,h);else if(e instanceof id||e instanceof Yl||e instanceof ou||e instanceof Ps)Ar.window.showErrorMessage(ly(e)).then(h,h);else if(e instanceof Ki&&ln())Ar.window.showErrorMessage(I.jupyterNotebookRemoteConnectFailedWeb(e.baseUrl)).then(h,h);else if(e instanceof Ki){let t=await this.handleJupyterServerConnectionError(e,void 0);Ar.window.showErrorMessage(t).then(h,h)}else if(e instanceof Cp){let t=await this.handleJupyterServerUriProviderError(e,void 0);Ar.window.showErrorMessage(t).then(h,h)}else{let t=Y$(e.message||e.toString());Ar.window.showErrorMessage(t).then(h,h)}}}async getErrorMessageForDisplayInCell(e,t,n){if(e=cn.unwrap(e),pr(e)||d.error("Error in execution (get message for cell)",e),e instanceof od)return"";if(e instanceof tf)return nF(e.kernelConnectionMetadata)||e.message;if(e instanceof no)return Ahe(e)||e.message;if(e instanceof Ki&&!ln())return e.message;if(e instanceof Ki&&ln())return I.jupyterNotebookRemoteConnectFailedWeb(e.baseUrl);if(pr(e))return"";if(e instanceof yv){let i=typeof e.product=="string"?e.product:dr.get(e.product)||`${e.product}`,o=Yr(e.interpreter)||e.interpreter.id||"",s=Tr(e.interpreter),a=B(s?.executable.uri),l=o?` ${o} (${a})`:a;return I.packageNotInstalledWindowsLongPathNotEnabledError(i,l)}else{if((e instanceof id||e instanceof Yl)&&(e.kernelConnectionMetadata.kind==="startUsingLocalKernelSpec"||e.kernelConnectionMetadata.kind==="startUsingPythonInterpreter")&&e.kernelConnectionMetadata.interpreter&&!await this.fs.exists(e.kernelConnectionMetadata.interpreter.uri))return I.failedToStartKernelDueToMissingPythonEnv(Yr(e.kernelConnectionMetadata.interpreter)||jo(e.kernelConnectionMetadata.interpreter)||B(e.kernelConnectionMetadata.interpreter.uri));if((e instanceof id||e instanceof Yl)&&(e.kernelConnectionMetadata.kind==="startUsingLocalKernelSpec"||e.kernelConnectionMetadata.kind==="startUsingPythonInterpreter")&&e.kernelConnectionMetadata.interpreter&&this.kernelDependency&&!await this.kernelDependency.areDependenciesInstalled(e.kernelConnectionMetadata,void 0,!0))return nF(e.kernelConnectionMetadata)||e.message;if(e instanceof On||e instanceof Pl){let[i,o]=await Promise.all([this.getFilesInWorkingDirectoryThatCouldPotentiallyOverridePythonModules(n),ya(e.kernelConnectionMetadata.interpreter)]),s=hm(Ar.workspace.workspaceFolders||[],e,ct(e.kernelConnectionMetadata),o,i.map(a=>a.uri));if(s){if(s.reason==="moduleNotFound"&&["ipykernel_launcher","ipykernel"].includes(s.moduleName))return nF(e.kernelConnectionMetadata)||e.message;let a=[s.message];return s.moreInfoLink&&a.push(me.clickHereForMoreInfoWithHtml(s.moreInfoLink)),ht(e.kernelConnectionMetadata)&&s.reason==="moduleNotFound"&&!["ipykernel_launcher","ipykernel"].includes(s.moduleName)&&await this.addErrorMessageIfPythonArePossiblyOverridingPythonModules(a,n),a.join(`
|
||
`)}}else{if(e instanceof Ki)return this.handleJupyterServerConnectionError(e,t);if(e instanceof Cp)return this.handleJupyterServerUriProviderError(e,t);if(e instanceof sd){let i=Ar.extensions.getExtension(e.serverProviderHandle.extensionId)?.packageJSON.displayName||e.serverProviderHandle.extensionId;return ly(I.remoteJupyterServerProvidedBy3rdPartyExtensionNoLongerValid(i),t)}}}return ly(e,t)}async handleJupyterServerUriProviderError(e,t){let n=await ay(e.serverProviderHandle,this.jupyterUriProviderRegistration),i=e.originalError?.message||e.message;return ly(I.remoteJupyterConnectionFailedWithServerWithError(n,i),t)}async handleJupyterServerConnectionError(e,t){let n=await ay(e.serverProviderHandle,this.jupyterUriProviderRegistration,e.baseUrl),i=e.originalError.message||"";return ly(I.remoteJupyterConnectionFailedWithServerWithError(n,i),t)}async handleJupyterServerProviderConnectionError(e,t){let n=new Ar.CancellationTokenSource;try{let i=await Promise.resolve(t.serverProvider.provideJupyterServers(n.token));return i&&(i.find(o=>o.id===e.handle)||await this.serverUriStorage.remove(e).catch(h)),!0}catch{return!1}finally{n.dispose()}}async handleKernelError(e,t,n,i,o){if(pr(e)||d.warn(`Kernel Error, context = ${t}`,e),e=cn.unwrap(e),pr(e))return this.sendKernelTelemetry(e,t,i,"cancelled"),1;if(e instanceof tf)if(d.warn(`Jupyter Kernel Dependency Error, reason=${e.reason}`,e),this.sendKernelTelemetry(e,t,i,e.category),e.reason===4&&this.kernelDependency){let s=new Ar.CancellationTokenSource;try{let a=o==="3rdPartyExtension";return this.kernelDependency.installMissingDependencies({resource:i,kernelConnection:n,ui:new Ht(!1),token:s.token,ignoreCache:!0,cannotChangeKernels:a})}finally{s.dispose()}}else return e.reason;else{if((t==="start"||t==="restart")&&e instanceof no)return this.sendKernelTelemetry(e,t,i,e.category),(this.dependencyManager?await this.dependencyManager.installMissingDependencies(e):2)===0?0:1;if(e instanceof Ki||e instanceof Cp||e instanceof sd){this.sendKernelTelemetry(e,t,i,e.category);let s=e instanceof sd?"":e instanceof Ki?e.originalError.message||"":e.originalError?.message||e.message,a=e.serverProviderHandle.extensionId,l=e.serverProviderHandle.id,c=this.jupyterUriProviderRegistration.jupyterCollections.find(b=>b.extensionId===a&&b.id==l);if(!c||await this.handleJupyterServerProviderConnectionError(e.serverProviderHandle,c))return 3;let u=e instanceof Ki?e.baseUrl:"",p=ay(e.serverProviderHandle,this.jupyterUriProviderRegistration,u),f=e instanceof sd?Ar.extensions.getExtension(e.serverProviderHandle.extensionId)?.packageJSON.displayName||e.serverProviderHandle.extensionId:"",g=o==="jupyterExtension"?[I.selectDifferentKernel]:[];switch(await Ar.window.showErrorMessage(e instanceof sd?I.remoteJupyterServerProvidedBy3rdPartyExtensionNoLongerValid(f):I.remoteJupyterConnectionFailedWithServer(p),{detail:s,modal:!0},I.removeRemoteJupyterConnectionButtonText,I.changeRemoteJupyterConnectionButtonText,...g)){case I.removeRemoteJupyterConnectionButtonText:return await this.serverUriStorage.remove(e.serverProviderHandle).catch(h),1;case I.changeRemoteJupyterConnectionButtonText:return 1;case I.selectDifferentKernel:return 3}return 1}else if(e instanceof Jo){this.sendKernelTelemetry(e,t,i,e.category);let s=I.jupyterSelfCertEnable,a=I.jupyterSelfCertClose;return Ar.window.showErrorMessage(I.jupyterSelfCertFail(e.message),s,a).then(l=>{l===s?(A("DATASCIENCE.SELFCERTSMESSAGEENABLED"),this.configuration.updateSetting("allowUnauthorizedRemoteConnection",!0,void 0,Ar.ConfigurationTarget.Workspace).catch(h)):l===a&&A("DATASCIENCE.SELFCERTSMESSAGECLOSE")}).then(h,h),2}else{if((t==="start"||t==="restart")&&n.kind==="startUsingPythonInterpreter"&&this.interpreterService&&!await this.fs.exists(n.interpreter.uri))return this.sendKernelTelemetry(e,t,i,"pythonEnvironmentMissing"),Ar.window.showErrorMessage(I.failedToStartKernelDueToMissingPythonEnv(Yr(n.interpreter)||jo(n.interpreter)||B(n.interpreter.uri))).then(h,h),this.interpreterService.refreshInterpreters(!0).catch(h),2;if((t==="start"||t==="restart")&&this.kernelDependency&&!await this.kernelDependency.areDependenciesInstalled(n,void 0,!0)){this.sendKernelTelemetry(e,t,i,"noipykernel");let s=new Ar.CancellationTokenSource;try{let a=o==="3rdPartyExtension";return this.kernelDependency.installMissingDependencies({resource:i,kernelConnection:n,ui:new Ht(!1),token:s.token,ignoreCache:!0,cannotChangeKernels:a})}finally{s.dispose()}}else{let[s,a]=await Promise.all([this.getFilesInWorkingDirectoryThatCouldPotentiallyOverridePythonModules(i),ya(n.interpreter)]),l=hm(Ar.workspace.workspaceFolders||[],e,ct(n),a,s.map(c=>c.uri));return this.sendKernelTelemetry(e,t,i,l?.reason),l?this.showMessageWithMoreInfo(l.message,l?.moreInfoLink).catch(h):this.showMessageWithMoreInfo(ly(e,t)).catch(h),2}}}}sendKernelTelemetry(e,t,n,i){this.handledKernelErrors.has(e)||(this.handledKernelErrors.add(e),t==="start"&&_t(n,"DATASCIENCE.NOTEBOOK_START",void 0,{disableUI:!1,failureCategory:i},e))}async showMessageWithMoreInfo(e,t){e.includes(q.ViewJupyterOutput)||(e=`${e}
|
||
${I.viewJupyterLogForFurtherInfo}`);let n=t?[me.learnMore]:[];await Ar.window.showErrorMessage(e,...n).then(i=>{i===me.learnMore&&t&&Ar.env.openExternal(Ar.Uri.parse(t))})}};cy=y([m(0,(0,Hs.inject)(Sp)),m(0,(0,Hs.optional)()),m(1,(0,Hs.inject)(le)),m(2,(0,Hs.inject)(Ms)),m(2,(0,Hs.optional)()),m(3,(0,Hs.inject)(zt)),m(4,(0,Hs.inject)($t)),m(5,(0,Hs.inject)(st)),m(6,(0,Hs.inject)(rt)),m(6,(0,Hs.optional)())],cy);var The={restart:I.failedToRestartKernel,start:I.failedToStartKernel,interrupt:I.failedToInterruptKernel,execution:""};function ly(r,e){r=typeof r=="string"?r:cn.unwrap(r);let t=e?The[e]:"",n="";return r instanceof ou?n=I.jupyterNotebookNotInstalledOrNotFound(r.interpreter):r instanceof ze?n=XE(r.stdErr)||r.stdErr||r.message:n=typeof r=="string"?r:r.message,Y$(t,n)}function Rhe(r){return(new RegExp(/\[([^\[]+)\]\((.*)\)/).exec(r)?.length??0)>0}function Y$(r="",e=""){r&&e.startsWith(r.substring(0,r.length-1))&&(r="");let t=[r,e].map(n=>n.trim()).filter(n=>n.length>0).join(`
|
||
`);return!Rhe(t)&&t.length&&t.indexOf("command:jupyter.viewOutput")===-1?`${t.endsWith(".")?t:t+"."}
|
||
${I.viewJupyterLogForFurtherInfo}`:t}function nF(r){if(r.kind==="connectToLiveRemoteKernel"||r.kind==="startUsingRemoteKernelSpec"||!r.interpreter)return;let e=Yr(r.interpreter)||De(r.interpreter.uri),t=dr.get(19),n=ro(19),i=`${US(De(r.interpreter.uri))} -m pip install ${n} -U --force-reinstall`;if(r.interpreter&&Be(r.interpreter)==="Conda"){let a=Tr(r.interpreter);a?.environment?.name?i=`conda install -n ${a?.environment?.name} ${n} --update-deps --force-reinstall`:a?.environment?.folderUri&&(i=`conda install -p ${De(a?.environment?.folderUri)} ${n} --update-deps --force-reinstall`)}else r.interpreter&&Be(r.interpreter)==="Unknown"&&(i=`${US(De(r.interpreter.uri))} -m pip install ${n} -U --user --force-reinstall`);let o=I.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreter(e,dr.get(19)),s=I.installPackageInstructions(t,i);return o+`
|
||
`+s}function Ahe(r){let e=`${dr.get(18)} ${me.and} ${dr.get(20)}`,t=[18,20].map(ro).join(" "),n=`python -m pip install ${t} -U
|
||
or
|
||
conda install ${t} -U`,i=I.installPackageInstructions(e,n);return r.message+`
|
||
`+i+`
|
||
`+me.clickHereForMoreInfoWithHtml("https://aka.ms/installJupyterForVSCode")}var uy=class extends cy{constructor(t,n,i,o,s,a,l,c){super(t,n,i,o,s,l,c);this.reservedPythonNames=a}async addErrorMessageIfPythonArePossiblyOverridingPythonModules(t,n){let i=await this.getFilesInWorkingDirectoryThatCouldPotentiallyOverridePythonModules(n);if(i.length>0){let o=n?Pi(n):void 0,s=i.map(l=>{if(l.type==="file"){let c=n?B(l.uri,[],o):vn(l.uri);return`<a href='${l.uri.toString()}?line=1'>${c}</a>`}else{let c=n?B(l.uri,[],o):`${vn(Pi(l.uri))}/__init__.py`;return`<a href='${l.uri.toString()}?line=1'>${c}</a>`}}),a="";s.length===1?a=s[0]:a=`${s.slice(0,-1).join(", ")} ${me.and} ${s.slice(-1)}`,t.push(I.filesPossiblyOverridingPythonModulesMayHavePreventedKernelFromStarting(a)),t.push(I.listOfFilesWithLinksThatMightNeedToBeRenamed(a)),t.push(me.clickHereForMoreInfoWithHtml(a7))}}async getFilesInWorkingDirectoryThatCouldPotentiallyOverridePythonModules(t){return t?this.reservedPythonNames.getUriOverridingReservedPythonNames(Pi(t)):[]}};uy=y([(0,_o.injectable)(),m(0,(0,_o.inject)(Sp)),m(0,(0,_o.optional)()),m(1,(0,_o.inject)(le)),m(2,(0,_o.inject)(Ms)),m(2,(0,_o.optional)()),m(3,(0,_o.inject)(zt)),m(4,(0,_o.inject)($t)),m(5,(0,_o.inject)(RD)),m(6,(0,_o.inject)(st)),m(7,(0,_o.inject)(rt))],uy);var l_=P(M());var IC=class{constructor(e,t,n,i){this.moduleName=e;this.args=t;this.pythonExecutionFactory=n;this._interpreter=i;this.interpreterPromise=Promise.resolve(this._interpreter),this.pythonLauncher=this.interpreterPromise.then(async o=>n.createActivatedEnvironment({interpreter:o}))}interpreter(){return this.interpreterPromise}async exec(e,t){let n={...t},i=await this.pythonLauncher,o=[...this.args,...e],s=o[1];return o.shift(),o.shift(),i.execModule(s,o,n)}},iF=class extends IC{constructor(e,t,n,i){super(e,t,n,i)}},oF=class extends IC{constructor(e,t,n,i){super(e,t,n,i)}async exec(e,t){let n,i={stdout:""};try{i=await super.exec(e,t)}catch(a){n=a}if(!i.stderr&&!n)return i;let o=()=>{if(n)throw d.error("Exception attempting to enumerate kernelspecs: ",n),n;return i},s=await this.interpreter();if(!s||this.moduleName.toLowerCase()!=="jupyter"||this.args.join(" ").toLowerCase()!=="-m jupyter kernelspec".toLowerCase())return o();try{if(e.join(" ").toLowerCase()==="list --json")return i=await this.getKernelSpecList(s,t),i;if(e.join(" ").toLowerCase()==="--version")return i=await this.getKernelSpecVersion(s,t),i}catch(a){d.error("Failed to get a list of the kernelspec using python script",a)}return o()}async getKernelSpecList(e,t){return(await this.pythonExecutionFactory.createActivatedEnvironment({interpreter:e})).exec([je(Xo,"pythonFiles","vscode_datascience_helpers","getJupyterKernels.py")],{...t,throwOnStdErr:!0})}async getKernelSpecVersion(e,t){return(await this.pythonExecutionFactory.createActivatedEnvironment({interpreter:e})).exec([je(Xo,"pythonFiles","vscode_datascience_helpers","getJupyterKernelspecVersion.py")],{...t,throwOnStdErr:!0})}},py=class{constructor(e){this.executionFactory=e}createInterpreterCommand(e,t,n,i){return e==="notebook"?new iF(t,n,this.executionFactory,i):e==="kernelspec"?new oF(t,n,this.executionFactory,i):new IC(t,n,this.executionFactory,i)}};py=y([(0,l_.injectable)(),m(0,(0,l_.inject)(Ur))],py);var SC=P(M());var X$=require("vscode");var dy=class{constructor(e,t){this.service=e;this.disposables=t}activate(){this.disposables.push(X$.commands.registerCommand("jupyter.selectJupyterInterpreter",()=>{this.service.selectInterpreter().catch(h)}))}};dy=y([(0,SC.injectable)(),m(0,(0,SC.inject)(fi)),m(1,(0,SC.inject)(O))],dy);var zs=P(M());var Gs=P(M());var Er=require("vscode");var Z$=P(Wl()),e5=require("vscode");async function c_(r){try{let e=await Z$.realpath(r.fsPath);return Fr()!="Windows"&&(e=e.replace(/\\/g,"/")),e5.Uri.file(e)}catch{return r}}var Nhe=je("AppData","Roaming","jupyter","kernels"),t5=je(".local","share","jupyter","kernels"),r5=je("Library","Jupyter","kernels"),Mhe=je("AppData","Roaming","jupyter","runtime"),Ohe=je("Library","Jupyter","runtime"),n5=je("share","jupyter","kernels"),u_="CACHE_KEY_FOR_JUPYTER_KERNELSPEC_ROOT_PATH.",sF="CACHE_KEY_FOR_JUPYTER_KERNEL_PATHS_.",jr=class{constructor(e,t,n,i,o,s,a){this.platformService=e;this.envVarsProvider=t;this.globalState=i;this.fs=o;this.context=s;this.pythonExecFactory=a;this.cachedDataDirs=new Map;this.envVarsProvider.onDidEnvironmentVariablesChange(()=>{this.cachedJupyterKernelPaths=void 0,this.cachedJupyterPaths=void 0},this,n)}async getKernelSpecTempRegistrationFolder(){let e=er(this.context.extensionUri,"temp","jupyter","kernels");return await this.fs.createDirectory(e),e}async getKernelSpecRootPath(){let e=this.getCachedRootPath();return e||this.cachedKernelSpecRootPath?e||this.cachedKernelSpecRootPath:(this.cachedKernelSpecRootPath=(async()=>{let t=this.platformService.homeDir;if(t)return this.platformService.isWindows?c_(er(t,Nhe)):this.platformService.isMac?er(t,r5):er(t,t5)})(),this.cachedKernelSpecRootPath.then(t=>{d.trace(`Getting Jupyter KernelSpec Root Path ${t?.toString()}`),this.updateCachedRootPath(t)}).catch(h),this.cachedKernelSpecRootPath)}async getRuntimeDir(){let e,t=this.platformService.homeDir;if(t&&(this.platformService.isWindows?e=await c_(er(t,Mhe)):this.platformService.isMac?e=er(t,Ohe):e=process.env.$XDG_RUNTIME_DIR?Er.Uri.file(je(process.env.$XDG_RUNTIME_DIR,"jupyter","runtime")):er(t,".local","share","jupyter","runtime")),!e){d.error("Failed to determine Jupyter runtime directory");return}try{return await this.fs.createDirectory(e),e}catch(n){d.error(`Failed to create runtime directory, reverting to temp directory ${e}`,n)}}async getDataDirs(e){let t=e.interpreter?e.interpreter.uri.toString():"";return this.cachedDataDirs.has(t)||this.cachedDataDirs.set(t,this.getDataDirsImpl(e.resource,e.interpreter)),this.cachedDataDirs.get(t)}async getDataDirsImpl(e,t){let n=new So,i=await this.getJupyterPaths();for(let f of i)f&&!n.has(f)&&n.set(f,n.size);if(t)try{d.ci(`Getting Jupyter Data Dir for ${t.uri.fsPath}`);let f=await this.pythonExecFactory.createActivatedEnvironment({interpreter:t,resource:e}),g=Er.Uri.joinPath(this.context.extensionUri,"pythonFiles","printJupyterDataDir.py"),v=await f.exec([g.fsPath],{});if(v.stdout.trim().length){let b=Er.Uri.file(v.stdout.trim());await this.fs.exists(b)&&(n.has(b)||n.set(b,n.size))}else d.debug(`Got an empty Jupyter Data Dir from ${t.id}, stderr = ${v.stderr}`)}catch(f){d.error(`Failed to get DataDir based on ENABLE_USER_SITE for ${Yr(t)}`,f)}let o;t&&(o=await ya(t));let s=o?Er.Uri.joinPath(Er.Uri.file(o),"share","jupyter"):void 0,a=this.getSystemJupyterPaths(),l=s?new Nl(a).has(s)?void 0:s:void 0,c=this.getJupyterDataDir(),u=(process.env.JUPYTER_PREFER_ENV_PATH||"no").toLowerCase();return["no","n","false","off","0","0.0"].includes(u)?[c,l].forEach(f=>{f&&!n.has(f)&&n.set(f,n.size)}):[l,c].forEach(f=>{f&&!n.has(f)&&n.set(f,n.size)}),a.forEach(f=>{f&&!n.has(f)&&n.set(f,n.size)}),Array.from(n.entries()).sort((f,g)=>f[1]-g[1]).map(f=>f[0])}getJupyterConfigDir(){return process.env.JUPYTER_CONFIG_DIR?Er.Uri.file(Cn(process.env.JUPYTER_CONFIG_DIR)):this.platformService.homeDir?Er.Uri.joinPath(this.platformService.homeDir,".jupyter"):void 0}getSystemJupyterPaths(){if(this.platformService.isWindows){let e=process.env.PROGRAMDATA?Cn(process.env.PROGRAMDATA):void 0;return e?[Er.Uri.joinPath(Er.Uri.file(e),"jupyter")]:[]}else return[Er.Uri.file("/usr/local/share/jupyter"),Er.Uri.file("/usr/share/jupyter")]}getJupyterDataDir(){if(process.env.JUPYTER_DATA_DIR)return Er.Uri.file(Cn(process.env.JUPYTER_DATA_DIR));if(this.platformService.homeDir)switch(this.platformService.osType){case"OSX":return Er.Uri.joinPath(this.platformService.homeDir,"Library","Jupyter");case"Windows":let e=process.env.APPDATA?Er.Uri.file(Cn(process.env.APPDATA)):"";if(e)return Er.Uri.joinPath(e,"jupyter");let t=this.getJupyterConfigDir();return t?Er.Uri.joinPath(t,"data"):Er.Uri.joinPath(this.platformService.homeDir,"Library","Jupyter");default:{let n=process.env.XDG_DATA_HOME?Er.Uri.file(Cn(process.env.XDG_DATA_HOME)):Er.Uri.joinPath(this.platformService.homeDir,".local","share");return Er.Uri.joinPath(n,"jupyter")}}}async getKernelSpecRootPaths(e){if(this.cachedKernelSpecRootPaths?.promise&&this.cachedKernelSpecRootPaths.stopWatch.elapsedTime<=6e4)return this.cachedKernelSpecRootPaths.promise;let t=new We,n=this.getKernelSpecRootPathsImpl(e);this.cachedKernelSpecRootPaths={promise:n,stopWatch:t};let i=e.onCancellationRequested(()=>{this.cachedKernelSpecRootPaths?.promise===n&&(this.cachedKernelSpecRootPaths=void 0)},this);return n.finally(()=>i.dispose()).catch(h),n}async getKernelSpecRootPathsImpl(e){let t=new Nl(await this.getJupyterPathKernelPaths(e));if(e.isCancellationRequested)return[];if(this.platformService.isWindows){let n=await this.getKernelSpecRootPath();if(e.isCancellationRequested)return[];n&&t.add(n),process.env.PROGRAMDATA&&t.add(Er.Uri.file(je(process.env.PROGRAMDATA,"jupyter","kernels")))}else{let n=this.platformService.isMac?r5:t5;t.add(Er.Uri.file(je("/","usr","share","jupyter","kernels"))),t.add(Er.Uri.file(je("/","usr","local","share","jupyter","kernels"))),this.platformService.homeDir&&t.add(er(this.platformService.homeDir,n))}return d.debug(`Kernel Spec Root Paths, ${Array.from(t).map(n=>B(n)).join(", ")}`),Array.from(t)}async getJupyterPathKernelPaths(e){return this.cachedJupyterKernelPaths=this.cachedJupyterKernelPaths||this.getJupyterPathSubPaths(e,"kernels"),this.cachedJupyterKernelPaths.then(t=>{t.length>0&&this.updateCachedPaths(t).then(h,h)},h),this.getCachedPaths().length>0?this.getCachedPaths():this.cachedJupyterKernelPaths}async getJupyterPaths(e){return this.cachedJupyterPaths=this.cachedJupyterPaths||this.getJupyterPathSubPaths(e),this.cachedJupyterPaths}async getJupyterPathSubPaths(e,t){let n=new Nl,i=await this.envVarsProvider.getEnvironmentVariables(void 0,"RunPythonCode");if(e?.isCancellationRequested)return[];let o=i.JUPYTER_PATH?i.JUPYTER_PATH.split(Qn).map(s=>t?je(s,t):s):[];return o.length>0&&(await Promise.all(o.map(async a=>c_(Er.Uri.file(a))))).forEach(a=>{a&&n.add(a)}),d.debug(`Jupyter Paths ${B(t)}: ${Array.from(n).map(s=>B(s))}`),Array.from(n)}getCachedPaths(){return this.globalState.get(sF,[]).map(e=>Er.Uri.parse(e))}async updateCachedPaths(e){let t=this.globalState.get(sF,[]),n=e.map(Er.Uri.toString);t.join(",")!==n.join(",")&&await this.globalState.update(sF,n)}getCachedRootPath(){if(this.globalState.get(u_)){let e=this.globalState.get(u_);if(e)return Er.Uri.parse(e)}}updateCachedRootPath(e){e?this.globalState.update(u_,e.toString()).then(h,h):this.globalState.update(u_,void 0).then(h,h)}};y([li("getDataDirsImpl",7),m(1,Lc("id"))],jr.prototype,"getDataDirsImpl",1),y([m(0,up())],jr.prototype,"getJupyterPathKernelPaths",1),jr=y([(0,Gs.injectable)(),m(0,(0,Gs.inject)(wr)),m(1,(0,Gs.inject)(Rl)),m(2,(0,Gs.inject)(O)),m(3,(0,Gs.inject)(Ve)),m(3,(0,Gs.named)(ft)),m(4,(0,Gs.inject)(mr)),m(5,(0,Gs.inject)(ot)),m(6,(0,Gs.inject)(Ur))],jr);var rf=class{constructor(e,t,n,i,o,s,a){this.jupyterInterpreter=e;this.interpreterService=t;this.jupyterDependencyService=n;this.pythonExecutionFactory=i;this.jupyterOutputChannel=o;this.jupyterPaths=s;this.activationHelper=a}async refreshCommands(){}async isNotebookSupported(e){let t=await this.jupyterInterpreter.getSelectedInterpreter(e);return t?this.jupyterDependencyService.areDependenciesInstalled(t,e):!1}async getReasonForJupyterNotebookNotBeingSupported(e){let t=await this.jupyterInterpreter.getSelectedInterpreter(e);if(!t&&(t=await this.interpreterService.getActiveInterpreter(void 0),!t))return I.selectJupyterInterpreter;let n=await this.jupyterDependencyService.getDependenciesNotInstalled(t,e);return n.length===0?"":n.length===1&&n[0]===21?I.jupyterKernelSpecModuleNotFound(t.uri.fsPath):ZK(n,t)}async getSelectedInterpreter(e){return this.jupyterInterpreter.getSelectedInterpreter(e)}async startNotebook(e,t){let n=await this.getSelectedInterpreterAndThrowIfNotAvailable(t.token);this.jupyterOutputChannel.appendLine(I.startingJupyterLogMessage(en(n.uri),e.join(" ")));let i=await this.pythonExecutionFactory.createActivatedEnvironment({interpreter:n}),o={...t};o.token=void 0;let s=await this.activationHelper.getActivatedEnvironmentVariables(void 0,n)||process.env,a=(process.env.JUPYTER_PATH||s.JUPYTER_PATH||"").split(Qn).filter(c=>c.trim().length);a.push(Pi(await this.jupyterPaths.getKernelSpecTempRegistrationFolder()).fsPath),o.env={...s,JUPYTER_PATH:a.join(Qn)},d.trace(`Start Jupyter Notebook with JUPYTER_PATH=${a.join(Qn)}`),d.trace(`Start Jupyter Notebook with PYTHONPATH=${s.PYTHONPATH||""}`);let l=Object.keys(s).filter(c=>c.toLowerCase()==="path");if(l.length){let c=l.map(u=>`${u}=${s[u]}`).join(",");d.trace(`Start Jupyter Notebook with PATH variable. ${c}`)}else d.error("Start Jupyter Notebook without a PATH variable");return i.execModuleObservable("jupyter",["notebook"].concat(e),o)}async getRunningJupyterServers(e){let t=await this.getSelectedInterpreterAndThrowIfNotAvailable(e),n=await this.pythonExecutionFactory.createActivatedEnvironment({interpreter:t}),i={mergeStdOutErr:!0,token:e},o=je(Xo,"pythonFiles","vscode_datascience_helpers","getServerInfo.py"),s=await n.exec([o],i),a;try{a=JSON.parse(s.stdout.trim())}catch(l){d.warn("Failed to parse JSON when getting server info out from getServerInfo.py",l);return}return a}async installMissingDependencies(e){return this.jupyterInterpreter.installMissingDependencies(e)}async getSelectedInterpreterAndThrowIfNotAvailable(e){let t=await this.jupyterInterpreter.getSelectedInterpreter(e);if(!t){let n=await this.getReasonForJupyterNotebookNotBeingSupported();throw new no(n)}return t}};rf=y([(0,zs.injectable)(),m(0,(0,zs.inject)(fi)),m(1,(0,zs.inject)(rt)),m(2,(0,zs.inject)(Js)),m(3,(0,zs.inject)(Ur)),m(4,(0,zs.inject)(Wo)),m(4,(0,zs.named)(Ih)),m(5,(0,zs.inject)(jr)),m(6,(0,zs.inject)(Ks))],rf);var p_=P(M());var nf=class{constructor(e){this.pythonExecutionFactory=e}async exportNotebookToPython(e,t,n,i){let o=await this.pythonExecutionFactory.createActivatedEnvironment({resource:e,interpreter:t}),s=n?[e.fsPath,"--to","python","--stdout","--template",n]:[e.fsPath,"--to","python","--stdout"];return o.execModule("jupyter",["nbconvert"].concat(s),{throwOnStdErr:!1,encoding:"utf8",token:i}).then(a=>{if(a.stdout==="")throw d.error("nbconvert zero size output"),new Error(a.stderr);return a.stdout})}};y([Kv("ExportNotebookToPython")],nf.prototype,"exportNotebookToPython",1),nf=y([(0,p_.injectable)(),m(0,(0,p_.inject)(Ur))],nf);var xC=P(M());var my=class{constructor(e,t){this.installer=e;this.commandFactory=t;this.nbconvertInstalledInInterpreter=new Nl}async isNbConvertInstalled(e,t){if(this.nbconvertInstalledInInterpreter.has(e.uri))return!0;let n=!!await this.installer.isInstalled(22,e)&&!!await this.installer.isInstalled(18,e);return n===!0&&this.nbconvertInstalledInInterpreter.add(e.uri),n}async getNbConvertVersion(e,t){let i=await this.commandFactory.createInterpreterCommand("nbconvert","jupyter",["-m","jupyter","nbconvert"],e,!1).exec(["--version"],{throwOnStdErr:!0});return bk(i.stdout)}};my=y([(0,xC.injectable)(),m(0,(0,xC.inject)(Vi)),m(1,(0,xC.inject)(Zv))],my);var af=P(M());var fy=require("vscode");var ad=P(M());var o5=require("vscode");async function io(r,e){if(!r)return;let t=gn(r),[n,i]=Ik.get(t)||[{resourceType:Zi(r),resourceHash:r?await mt(r.toString()):void 0,kernelSessionId:await mt(Date.now().toString()),capturedEnvVars:void 0,userExecutedCell:void 0,disableUI:void 0,kernelLanguage:void 0,kernelId:void 0,kernelSpecHash:void 0,isUsingActiveInterpreter:void 0,pythonEnvironmentType:void 0,pythonEnvironmentPath:void 0,pythonEnvironmentVersion:void 0,kernelConnectionType:void 0},{previouslySelectedKernelConnectionId:""}];typeof e.capturedEnvVars=="boolean"&&(n.capturedEnvVars=e.capturedEnvVars),e.userExecutedCell&&(n.userExecutedCell=!0),typeof e.disableUI=="boolean"&&(n.disableUI=e.disableUI);let o=e.kernelConnection;if(o){let s=o.id;i.previouslySelectedKernelConnectionId!==s&&(n.userExecutedCell=e.userExecutedCell,n.disableUI=e.disableUI),i.previouslySelectedKernelConnectionId&&i.previouslySelectedKernelConnectionId!==s&&(n.kernelSessionId=await mt(Date.now().toString()));let a;switch(o.kind){case"connectToLiveRemoteKernel":a=o.kernelModel.language;break;case"startUsingRemoteKernelSpec":case"startUsingLocalKernelSpec":a=o.kernelSpec.language;break;case"startUsingPythonInterpreter":a=ye;break;default:break}let l="kernelSpec"in o&&o.kernelSpec.specFile?mt(o.kernelSpec.specFile):Promise.resolve("");n.kernelLanguage=a,[n.kernelId,n.kernelSpecHash]=await Promise.all([mt(o.id),l]),i.previouslySelectedKernelConnectionId=o.id;let c=o.interpreter;if(c){n.isUsingActiveInterpreter=ka.isActiveWorkspaceInterpreter(r,c),n.pythonEnvironmentType=Be(c);let[u,p]=await Promise.all([mt(De(bl(c.uri))),ap(c)]);n.pythonEnvironmentPath=u,jN.set(n.pythonEnvironmentPath,c),p?n.pythonEnvironmentVersion=`${p.major}.${p.minor}.${p.micro}`:n.pythonEnvironmentVersion=void 0,WN(n)}n.kernelConnectionType=n.kernelConnectionType||o?.kind}else i.previouslySelectedKernelConnectionId="";Ik.set(t,[n,i])}async function Qs(r,e){await io(r,{kernelConnection:e,userExecutedCell:!0})}var Ta=class{constructor(e,t,n,i,o){this.interpreterService=e;this.envActivation=t;this.envVarsService=n;this.customEnvVars=i;this.configService=o}async getEnvironmentVariables(e,t,n,i){let o=n.env&&Object.keys(n.env).length>0?n.env:void 0,s=(n.language||"").toLowerCase()===ye;if(!t&&n.interpreterPath&&(t=await this.interpreterService.getInterpreterDetails(o5.Uri.file(n.interpreterPath),i).catch(p=>{d.error("Failed to fetch interpreter information for interpreter that owns a kernel",p)})),i?.isCancellationRequested)return;let[a,l]=await Promise.all([this.customEnvVars.getCustomEnvironmentVariables(e,s?"RunPythonCode":"RunNonPythonCode",i).catch(h),t?this.envActivation.getActivatedEnvironmentVariables(e,t,i).catch(p=>{d.error("Failed to get env variables for interpreter, hence no variables for Kernel",p)}):void 0]);if(i?.isCancellationRequested)return;await io(e,{capturedEnvVars:Object.keys(l||{}).length>0}),!l&&Object.keys(a||{}).length===0&&d.debug("No custom variables nor do we have a conda environment");let c={...process.env};process.platform==="win32"&&(c={},Object.keys(process.env).forEach(p=>{c[p.toUpperCase()]=process.env[p]})),o=o||{},a=a||{};let u={};for(let[p,f]of Object.entries(o||{}))typeof f=="string"&&i5(p,f,process.env)!==f&&(u[p]=f,delete o[p]);s||t?(l=l||a,Object.assign(c,l,o),this.configService.getSettings(void 0).excludeUserSitePackages&&(d.info(`Adding env Variable PYTHONNOUSERSITE to ${B(t?.uri)}`),c.PYTHONNOUSERSITE="True"),s&&(c.PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING="1")):(this.envVarsService.mergeVariables(o,c),this.envVarsService.mergeVariables(a,c));for(let[p,f]of Object.entries(u))c[p]=i5(p,f,c);return c}};Ta=y([(0,ad.injectable)(),m(0,(0,ad.inject)(rt)),m(1,(0,ad.inject)(Ks)),m(2,(0,ad.inject)(Tl)),m(3,(0,ad.inject)(Rl)),m(4,(0,ad.inject)(le))],Ta);var Khe=/\${([a-zA-Z]\w*)?([^}\w].*)?}/g;function i5(r,e,t){if(!e.includes("$"))return e;let n=!1,i=e;return i=i.replace(Khe,(o,s,a,l,c)=>l>0&&c[l-1]==="\\"?o:a&&a!==""||!s||s===""?(n=!0,o):t[s]||""),!n&&i!==e&&(d.debug(`${r} value in kernelSpec updated from ${e} to ${i}`),e=i),e.replace(/\\\$/g,"$")}var s5=require("vscode");async function a5(r,e,t){if(!t.interpreter||!vt(t)||!r.kernel||r.kernel.status==="dead"||r.kernel.status==="terminating"||t.kind!=="startUsingLocalKernelSpec"&&t.kind!=="startUsingPythonInterpreter")return;let n=new We;try{let i=await bn(r.kernel,`import sys as _VSCODE_sys
|
||
print(_VSCODE_sys.executable); del _VSCODE_sys`);if(i.length===0)return;let o=i[0];if(o.name!=="stdout"&&o.output_type!=="stream")return;let s=Ts(o.text).trim().toLowerCase(),a=Bo(t.interpreter.uri,s5.Uri.file(s));await io(e,{interpreterMatchesKernel:a})}catch(i){d.error(`Failed to compare interpreters after ${n.elapsedTime}ms`,i)}}function Fhe(r){let e="kernelSpec"in r?r:void 0;if(e?.kind==="startUsingPythonInterpreter")return!0;if(e&&!ht(e))return!1;let t=e?e.kernelSpec:r;return d_(t.argv[0])}function of(r){let e="kernelSpec"in r?r:void 0;if(e?.kind==="startUsingPythonInterpreter")return!0;if(e&&!ht(e))return!1;let t=e?e.kernelSpec:r;if(t.language&&t.language.toLowerCase()!==ye||!Fhe(r))return!1;let n=t.argv.indexOf("-m");if(n===-1)return!1;let i=t.argv.length-1>=n?t.argv[n+1].toLowerCase():void 0;return i?i.includes("ipykernel_launcher")||i.includes("ipykernel"):!1}function d_(r){return r=Ee(r).trim().toLowerCase(),r==="python"||r==="python3"||r==="python.exe"||r==="python3.exe"}var sf=class{constructor(e,t,n,i){this.kernelDependencyService=e;this.fs=t;this.jupyterPaths=n;this.kernelEnvVars=i}async ensureKernelIsUsable(e,t,n,i,o){if(d.debug(`Check if a kernel ${t.id} is usable`),of(t)&&t.interpreter){let a=await this.kernelDependencyService.installMissingDependencies({resource:e,kernelConnection:t,ui:n,token:i,ignoreCache:!0,cannotChangeKernels:o});switch(a){case 1:case 3:case 2:case 4:throw new tf(a,t);default:break}}var s=void 0;ht(t)&&(s=t.kernelSpec.specFile,!s||!await this.fs.exists(fy.Uri.file(s))?s=await this.registerKernel(t,i):t.interpreter&&s&&Ee(lt(s)).toLowerCase()!=t.kernelSpec.name.toLowerCase()&&(s=await this.registerKernel(t,i)),t.interpreter&&s?(d.debug(`Updating Kernel Environment for ${t.id} for interpreter ${t.interpreter.id}`),await this.updateKernelEnvironment(e,t,s,i)):d.trace(`Not Updating Kernel Environment for ${t.id}`))}async registerKernel(e,t){let n=await this.jupyterPaths.getKernelSpecTempRegistrationFolder();if(!e.kernelSpec||t.isCancellationRequested||!e.kernelSpec.name)return;let i=er(n,e.kernelSpec.name,"kernel.json");if(await this.fs.exists(i))return d.info(`Kernel spec file for ${e.id} already exists ${B(i)}`),i.fsPath;let o={...e.kernelSpec};if(e.kernelSpec.specFile&&!Vp(De(i),e.kernelSpec.specFile)&&(o.metadata=o.metadata||{},o.metadata={...o.metadata,vscode:{...o.metadata.vscode||{},originalSpecFile:e.kernelSpec.metadata?.vscode?.originalSpecFile||e.kernelSpec.specFile,originalDisplayName:e.kernelSpec.metadata?.vscode?.originalDisplayName||e.kernelSpec.display_name}}),e.interpreter&&(o.metadata={...o.metadata,interpreter:wm(e.interpreter)}),d.info(`RegisterKernel for ${e.id} into ${B(i)}`),d.debug(`RegisterKernel for ${e.id} into ${B(i)} with contents ${JSON.stringify(o)}`),await this.fs.writeFile(i,JSON.stringify(o,void 0,4)),t.isCancellationRequested)return;let s=o.metadata?.vscode?.originalSpecFile||o.metadata?.originalSpecFile;if(s){let a=lt(s),l=lt(i.fsPath),c=await this.fs.searchLocal("*.*[^json]",a);await Promise.all(c.map(async u=>{let p=je(a,u),f=je(l,u);await this.fs.copy(fy.Uri.file(p),fy.Uri.file(f))}))}return i.fsPath}async updateKernelEnvironment(e,t,n,i){let o=t.interpreter,s=t.kernelSpec,a=await this.jupyterPaths.getKernelSpecTempRegistrationFolder(),l=s;if(n&&a){let c=Ee(n).toLowerCase()===s.name.toLowerCase()?n:er(a,s.name,"kernel.json").fsPath;if(!await this.fs.exists(fy.Uri.file(c))){d.warn(`Spec file for ${t.id} does not exist ${c} hence not updating env vars.`);return}let u=fy.Uri.file(c);try{let p=JSON.parse(await this.fs.readFile(u));if(i?.isCancellationRequested||(p.metadata?.interpreter?(of(s)&&(d.debug(`Python KernelSpec argv[0] updated for ${t.id} from '${p.argv[0]}' to '${B(o.uri)}'`),p.argv[0]=o.uri.fsPath),p.metadata=p.metadata||{},p.metadata.interpreter=o):d.trace(`KernelSpec argv[0] not updated for ${t.id} ('${p.argv[0]}')`),p.env=await this.kernelEnvVars.getEnvironmentVariables(e,o,l),p=q9(p),await this.fs.writeFile(u,JSON.stringify(p,void 0,2)),d.debug(`Updated kernel spec for ${t.id} with environment variables for ${B(u)}`),i?.isCancellationRequested))return;l.metadata=p.metadata}catch(p){if(i?.isCancellationRequested)return;throw d.error(`Failed to update kernel spec for ${t.id} with environment variables for ${B(u)}`,p),p}}else d.warn(`Either Kernel spec file or root spec file path does not exist for ${t.id}.`)}};y([Vh("Failed to register an interpreter as a kernel")],sf.prototype,"registerKernel",1),sf=y([(0,af.injectable)(),m(0,(0,af.inject)(Ms)),m(1,(0,af.inject)(mr)),m(2,(0,af.inject)(jr)),m(3,(0,af.inject)(Ta))],sf);var CC=P(M());var l5=require("vscode");var hy=class{constructor(e,t){this.liveKernelConnectionTracker=e;this.providerRegistration=t}async isValid(e){if(!this.liveKernelConnectionTracker.wasKernelUsed(e))return!1;let t=await this.providerRegistration.jupyterCollections.find(i=>i.extensionId===e.serverProviderHandle.extensionId&&i.id===e.serverProviderHandle.id);if(!t)return d.warn(`Extension ${e.serverProviderHandle.extensionId} may have been uninstalled for provider ${e.serverProviderHandle.id}, handle ${e.serverProviderHandle.handle}`),!1;let n=new l5.CancellationTokenSource;try{let i=await Promise.resolve(t.serverProvider.provideJupyterServers(n.token));return i?i.map(o=>o.id).includes(e.serverProviderHandle.handle)?!0:(d.warn(`Hiding remote kernel ${e.id} for ${t.id} as the remote Jupyter Server ${e.serverProviderHandle.extensionId}:${e.serverProviderHandle.id}:${e.serverProviderHandle.handle} is no longer available`),!1):!1}catch(i){return d.warn(`Failed to fetch remote servers from ${e.serverProviderHandle.extensionId}:${e.serverProviderHandle.id}`,i),!1}finally{n.dispose()}}};hy=y([(0,CC.injectable)(),m(0,(0,CC.inject)(_m)),m(1,(0,CC.inject)($t))],hy);var h5=P(To()),m_=require("vscode"),Ys=P(M());var gy=class extends On{constructor(e){super("timeout",I.jupyterLaunchTimedOut,e)}};var vy=class extends Yn{constructor(t,n,i,o,s,a){super();this.interpreterService=t;this.disposableRegistry=n;this.configuration=o;this.notebookStarter=s;this.jupyterInterpreterService=a;this._isDisposing=!1;this.disposableRegistry.push(this.interpreterService.onDidChangeInterpreter(()=>this.onSettingsChanged())),this.disposableRegistry.push(this),m_.workspace.onDidChangeConfiguration(l=>{l.affectsConfiguration("python.dataScience",void 0)&&this.onSettingsChanged()},this,this.disposableRegistry),i.push({dispose:()=>Rs(this)})}dispose(){this._isDisposing||(this._isDisposing=!0,this.cache?this.cache.then(t=>t.dispose()).catch(h).finally(()=>super.dispose()):super.dispose())}async startServer(t,n){if(this.isDisposed||this._isDisposing)throw new Error("Notebook server is disposed");if(!this.cache){let i=this.cache=this.startJupyterWithRetry(t,n);i.catch(o=>{d.error("Failed to start the Jupyter Server",o),this.cache===i&&(this.cache=void 0)})}return this.cache}async refreshCommands(){await this.jupyterInterpreterService?.refreshCommands()}async isJupyterServerSupported(t){return this.jupyterInterpreterService?this.jupyterInterpreterService.isNotebookSupported(t):!1}async getJupyterServerError(){return this.jupyterInterpreterService?this.jupyterInterpreterService.getReasonForJupyterNotebookNotBeingSupported():I.webNotSupported}async getUsableJupyterPython(t){return!this.usablePythonInterpreter&&!this.isDisposed&&!this._isDisposing&&this.jupyterInterpreterService&&(this.usablePythonInterpreter=await ir(t,this.jupyterInterpreterService.getSelectedInterpreter(t))),this.usablePythonInterpreter}startJupyterWithRetry(t,n){return ir(n,(async()=>{let o,s=1,a=Math.max(1,this.configuration.getSettings(void 0).jupyterLaunchRetries),l;for(;s<=a&&!this.isDisposed&&!this._isDisposing;){try{return o=await this.startImpl(t,n),d.trace("Connection complete server"),o}catch(c){if(l=c,c instanceof gy&&s<a)d.info("Retry because of wait for idle problem."),o?.dispose(),s+=1;else throw o&&(this.isDisposed||this._isDisposing),c}throw l}throw new Error("Max number of attempts reached")})())}async startImpl(t,n){d.debug("Launching server");let i=this.configuration.getSettings(t),o=i.useDefaultConfigForJupyter,s=await gC(t),a=xl(),l=wk(s,a?er(a,`${(0,h5.default)()}.txt`):void 0,i);if(!this.notebookStarter)throw new Error("Notebook Starter cannot be undefined");return this.notebookStarter.start(t,o,this.configuration.getSettings(void 0).jupyterCommandLineArguments,m_.Uri.file(l),n)}onSettingsChanged(){this.usablePythonInterpreter=void 0}};vy=y([(0,Ys.injectable)(),m(0,(0,Ys.inject)(rt)),m(1,(0,Ys.inject)(O)),m(2,(0,Ys.inject)(Vo)),m(3,(0,Ys.inject)(le)),m(4,(0,Ys.inject)(Gk)),m(4,(0,Ys.optional)()),m(5,(0,Ys.inject)(td)),m(5,(0,Ys.optional)())],vy);var EC=P(M());var f_=class extends cn{constructor(){super("Python Extension not installed",void 0,"pythonExtension")}};var yy=class{constructor(e,t){this.jupyterServerProvider=e;this.extensionChecker=t;this.startupUi=new Ht(!0)}async connect(e){e.ui.disableUI||(this.startupUi.disableUI=!1);let t=e.ui.onDidChangeDisableUI(()=>{e.ui.disableUI||(this.startupUi.disableUI=!1,t.dispose())});if(e.ui=this.startupUi,this.extensionChecker.isPythonExtensionInstalled)return this.jupyterServerProvider.getOrStartServer(e).finally(()=>t.dispose());throw t.dispose(),this.startupUi.disableUI||await this.extensionChecker.showPythonExtensionInstallRequiredPrompt(),new f_}};yy=y([(0,EC.injectable)(),m(0,(0,EC.inject)(wg)),m(1,(0,EC.inject)($e))],yy);var lf=P(M());var h_=class extends ze{constructor(){super("nodeonly",I.webNotSupported)}};var by=class{constructor(e,t){this.jupyterServerHelper=e;this.interpreterService=t}async getOrStartServer(e){if(!this.serverPromise){let t=this.serverPromise=this.startServerImpl(e);t.catch(()=>{t===this.serverPromise&&(this.serverPromise=void 0)})}return this.serverPromise}async startServerImpl(e){let t=this.jupyterServerHelper;if(!t)throw new h_;try{if(d.trace("Checking for server usability."),!await this.checkUsable())throw d.trace("Server not usable (should ask for install now)"),new no(I.jupyterNotSupported(await t.getJupyterServerError()));d.debug("Starting notebook server.");let i=await t.startServer(e.resource,e.token);return En.throwIfCanceled(e.token),i}catch(n){throw e.token?.isCancellationRequested&&pr(n)||await t.refreshCommands(),n}}async checkUsable(){try{return this.jupyterServerHelper?!!await this.jupyterServerHelper.getUsableJupyterPython():!0}catch(e){let t=await this.interpreterService.getActiveInterpreter(void 0);if(t){let n=Yr(t)||De(t.uri);throw new Error(I.jupyterNotSupportedBecauseOfEnvironment(n,e.toString()))}else throw new no(I.jupyterNotSupported(this.jupyterServerHelper?await this.jupyterServerHelper.getJupyterServerError():"Error"))}}};by=y([(0,lf.injectable)(),m(0,(0,lf.inject)(Ip)),m(0,(0,lf.optional)()),m(1,(0,lf.inject)(rt))],by);var g5=P(require("child_process")),su=P(M()),v5=P(require("os"));var y5=P(To()),kC=require("vscode");var v_=require("vscode");var Iy=class extends ze{constructor(t,n,i){super("jupytercannotbelaunchedwitheroot",t+(n?`
|
||
${n}`:""));this.interpreter=i}};var Bhe=new RegExp(am.UrlPatternRegEx),g_=class{constructor(e,t,n,i,o,s){this.launchResult=e;this.notebookDir=t;this.rootDir=n;this.getServerInfo=i;this.serviceContainer=o;this.interpreter=s;this.startPromise=oe();this.output="";this.subscriptions=[];this.ready=this.startPromise.promise;let l=o.get(le).getSettings(void 0).jupyterLaunchTimeout;this.launchTimeout=setTimeout(()=>{this.startPromise.completed||this.rejectStartPromise(I.jupyterLaunchTimedOut)},l);let c=0;e.proc&&e.proc.on("exit",u=>c=u||0),this.subscriptions.push(e.out.onDidChange(u=>{d.trace(u.out),this.output+=u.out,am.HttpPattern.exec(this.output)&&!this.startPromise.completed&&this.getServerInfo().then(p=>this.getJupyterURL(p,this.output)).catch(p=>d.warn("Failed to get server info",p))})),e.out.done.then(()=>this.rejectStartPromise(I.jupyterServerCrashed(c))).catch(u=>this.rejectStartPromise(u))}dispose(){clearTimeout(this.launchTimeout),z(this.subscriptions)}getJupyterURL(e,t){if(e&&e.length>0&&!this.startPromise.completed){let n=e.find(i=>Vp(De(this.notebookDir),De(v_.Uri.file(i.notebook_dir))));if(n){let i=n.url,o=n.token;this.resolveStartPromise(i,o)}}if(!this.startPromise.completed){let i=Bhe.exec(t)?.groups;if(!this.startPromise.completed&&i&&(i.LOCAL||i.IP)){let o=i.LOCAL?i.LOCAL:i.IP,s=`${i.PREFIX}${o}${i.REST}`,a;try{a=new URL(s)}catch(c){d.error(`Failed to parse ${s}`,c),this.rejectStartPromise(I.jupyterLaunchNoURL);return}let l=a.pathname.endsWith("/tree")?a.pathname.replace("/tree",""):a.pathname;this.resolveStartPromise(`${a.protocol}//${a.host}${l}`,`${a.searchParams.get("token")}`)}}}resolveStartPromise(e,t){if(clearTimeout(this.launchTimeout),!this.startPromise.rejected){let n=this.serviceContainer.get(le),i=this.serviceContainer.get(Bc),o=this.serviceContainer.get(xp),s=gx({handle:"",id:"_builtin.jupyterServerLauncher",extensionId:Ue},{baseUrl:e,token:t,displayName:Ck(t,e)},i,o,n,this.rootDir,new v_.Disposable(()=>this.launchResult.dispose()));this.startPromise.resolve(s)}}rejectStartPromise(e){if(clearTimeout(this.launchTimeout),!this.startPromise.resolved){e=typeof e=="string"?e:e.message;let t,n=this.output;n.includes("Jupyter command `jupyter-notebook` not found")?t=new ou(e,n,this.interpreter):n.includes("Running as root is not recommended. Use --allow-root to bypass")?t=new Iy(e,n,this.interpreter):t=new Ps(e,n,this.interpreter),this.startPromise.reject(t)}}};var Sy=require("vscode");var Xs=new Set;function y_(...r){let e=new $r;try{let t=new class{async providePortAttributes(n,i){if(r.includes(n.port))return new Sy.PortAttributes(Sy.PortAutoForwardAction.Ignore)}};for(let n of r){let i={portRange:n};e.add(Sy.workspace.registerPortAttributesProvider(i,t))}}catch(t){d.error("Failure in registering port attributes",t)}return e}var xy=class{constructor(e,t,n,i){this.jupyterInterpreterService=e;this.fs=t;this.serviceContainer=n;this.jupyterOutputChannel=i;this.disposables=[]}dispose(){for(;this.disposables.length>0;){let e=this.disposables.shift();try{e&&e.dispose()}catch{}}}async start(e,t,n,i,o){d.info("Starting Jupyter Server");let s=0,a,l=[],c=dt.reportProgress(e,"NotebookStart");try{let u=this.generateTempDir();u.then(C=>this.disposables.push(C)).catch(h);let p=await this.generateArguments(t,n,u,i.fsPath);En.throwIfCanceled(o);let[f,g,v]=await Promise.all([this.jupyterInterpreterService.startNotebook(p||[],{throwOnStdErr:!1,encoding:"utf8",token:o}),u,this.jupyterInterpreterService.getSelectedInterpreter(o).catch(()=>{})]);f.proc&&(f.proc.on("exit",C=>s=C),f.out.onDidChange(C=>this.jupyterOutputChannel.append(C.out))),f&&o.onCancellationRequested(()=>{f.dispose()},this,l),d.debug("Waiting for Jupyter Notebook"),a=new g_(f,kC.Uri.file(g.path),i,()=>this.jupyterInterpreterService.getRunningJupyterServers(o),this.serviceContainer,v),En.throwIfCanceled(o);let b=await ir(o,a.ready);try{let C=parseInt(new URL(b.baseUrl).port||"0",10);if(C&&!isNaN(C)){let E=y_(C);f.proc&&f.proc.on("exit",()=>{Xs.delete(C),E.dispose()}),Xs.add(C)}}catch(C){d.error(`Parsing failed ${b.baseUrl}`,C)}return z(l),b}catch(u){throw z(l),pr(u)||u instanceof Ps||u instanceof Iy||u instanceof ou?u:await this.jupyterInterpreterService.isNotebookSupported()?s!==0?new Error(I.jupyterServerCrashed(s)):cn.from(I.jupyterNotebookFailure(u),u):new no(await this.jupyterInterpreterService.getReasonForJupyterNotebookNotBeingSupported())}finally{c.dispose(),a?.dispose()}}async generateDefaultArguments(e,t,n){let i=[];i.push(Promise.resolve("--no-browser")),i.push(Promise.resolve(this.getNotebookDirArgument(n))),e&&i.push(this.getConfigArgument(t)),i.push(Promise.resolve("--NotebookApp.iopub_data_rate_limit=10000000000.0"));let[o,s]=await Promise.all([Promise.all(i),this.getDockerArguments()]),a=process.env&&process.env.VSCODE_JUPYTER_DEBUG_JUPYTER?["--debug"]:[];return[...o,...s,...a]}async generateCustomArguments(e){return[...["--no-browser","--NotebookApp.iopub_data_rate_limit=10000000000.0","--KernelManager.autorestart=False"],...e]}async generateArguments(e,t,n,i){return!t||t.length===0?this.generateDefaultArguments(e,n,i):this.generateCustomArguments(t)}getNotebookDirArgument(e){return`--notebook-dir="${e.replace(/\\/g,"\\\\")}"`}async getConfigArgument(e){let t=await e,n=je(t.path,"jupyter_notebook_config.py");return await this.fs.writeFile(kC.Uri.file(n),""),d.debug(`Generating custom default config at ${n}`),`--config=${n}`}async getDockerArguments(){let e=[];try{let t=await this.fs.readFile(kC.Uri.file("/proc/self/cgroup")).catch(()=>"");return!t.includes("docker")&&!t.includes("kubepods")?e:(e.push("--ip"),e.push("127.0.0.1"),new Promise(n=>{g5.exec("id",{encoding:"utf-8"},(i,o)=>{o&&o.toString().includes("(root)")&&e.push("--allow-root"),n(e)})}))}catch{return e}}async generateTempDir(){let e=kC.Uri.file(je(v5.tmpdir(),(0,y5.default)()));return await this.fs.createDirectory(e),{path:De(e),dispose:async()=>{let t=0;for(;t<10;)try{await this.fs.delete(e),t=10}catch{t+=1}}}}};xy=y([(0,su.injectable)(),m(0,(0,su.inject)(td)),m(1,(0,su.inject)(st)),m(2,(0,su.inject)(at)),m(3,(0,su.inject)(Wo)),m(3,(0,su.named)(Ih))],xy);var Xl=require("vscode"),cf=P(M());var Cy=class extends tr{constructor(t,n){super();this._onDidLoad=this._register(new Xl.EventEmitter);this._onDidChangeUri=this._register(new Xl.EventEmitter);this._onDidRemoveUris=this._register(new Xl.EventEmitter);this._onDidAddUri=this._register(new Xl.EventEmitter);this._all=[];n.push(this),this.newStorage=this._register(new aF(t))}get onDidLoad(){return this._onDidLoad.event}get onDidChange(){return this._onDidChangeUri.event}get onDidRemove(){return this._onDidRemoveUris.event}get onDidAdd(){return this._onDidAddUri.event}get all(){return this.updateStore(),this._all}hookupStorageEvents(){this.storageEventsHooked||(this.storageEventsHooked=!0,this._register(this.newStorage.onDidAdd(t=>this._onDidAddUri.fire(t),this)),this._register(this.newStorage.onDidChange(t=>this._onDidChangeUri.fire(t),this)),this._register(this.newStorage.onDidRemove(t=>this._onDidRemoveUris.fire(t),this)))}updateStore(){this.hookupStorageEvents();let t=this._all;return this._all=this.newStorage.getAll(),(t.length!==this._all.length||JSON.stringify(this._all)!==JSON.stringify(t))&&this._onDidLoad.fire(),this._all}async clear(){this.hookupStorageEvents(),await this.newStorage.clear(),this._all=[],this._onDidLoad.fire()}async add(t,n){this.hookupStorageEvents(),d.ci(`setUri: ${t.id}.${t.handle}`);let i={time:n?.time??Date.now(),displayName:"",provider:t};await this.newStorage.add(i),this.updateStore()}async update(t){this.hookupStorageEvents(),await this.newStorage.update(t),this.updateStore()}async remove(t){this.hookupStorageEvents(),await this.newStorage.remove(t),this.updateStore()}};Cy=y([(0,cf.injectable)(),m(0,(0,cf.inject)(Ve)),m(0,(0,cf.named)(ft)),m(1,(0,cf.inject)(O))],Cy);var aF=class{constructor(e){this.memento=e;this._onDidChangeUri=new Xl.EventEmitter;this._onDidRemoveUris=new Xl.EventEmitter;this._onDidAddUri=new Xl.EventEmitter;this.updatePromise=Promise.resolve();this.mementoKey=`MEMENTO_KEY_FOR_STORING_USED_JUPYTER_PROVIDERS_${Xl.env.machineId}`}get onDidChange(){return this._onDidChangeUri.event}get onDidRemove(){return this._onDidRemoveUris.event}get onDidAdd(){return this._onDidAddUri.event}dispose(){this._onDidAddUri.dispose(),this._onDidChangeUri.dispose(),this._onDidRemoveUris.dispose()}async add(e){return this.updatePromise=this.updatePromise.then(async()=>{let t=this.getAll(),n=t.find(a=>Lt(a.provider)===Lt(e.provider)),o=[{displayName:e.displayName||n?.displayName||Lt(e.provider),serverHandle:e.provider,time:e.time}].concat(t.sort((a,l)=>l.time-a.time).filter(a=>Lt(a.provider)!==Lt(e.provider)).map(a=>({displayName:a.displayName,serverHandle:a.provider,time:a.time}))),s=o.splice(oi.JupyterServerUriListMax);if(await this.memento.update(this.mementoKey,o),n||this._onDidAddUri.fire(e),s.length){let a=s.map(l=>({provider:l.serverHandle,time:l.time,displayName:l.displayName||""}));this._onDidRemoveUris.fire(a.map(l=>l.provider))}this._onDidChangeUri.fire()}).catch(h)}async update(e){let n=this.getAll().find(o=>o.provider.id===e.id&&o.provider.handle===e.handle),i={provider:e,time:Date.now(),displayName:n?.displayName||""};await this.add(i)}async remove(e){await(this.updatePromise=this.updatePromise.then(async()=>{let t=!1;try{let n=this.getAll();if(n.length===0)return;let i=n.filter(s=>s.provider.id!==e.id||s.provider.handle!==e.handle),o=n.filter(s=>s.provider.id===e.id&&s.provider.handle===e.handle);if(i.length===0)await this.clear();else if(o.length){let s=i.map(a=>({displayName:a.displayName,serverHandle:a.provider,time:a.time}));t=!0,await this.memento.update(this.mementoKey,s),this._onDidRemoveUris.fire(o.map(a=>a.provider))}}finally{t||this._onDidRemoveUris.fire([e])}}).catch(t=>d.error(`Failed to remove Server handle ${JSON.stringify(e)}`,t)))}getAll(){let e=this.memento.get(this.mementoKey,[]),t=[];return e.forEach(async n=>{let i=Lt(n.serverHandle),o={time:n.time,displayName:n.displayName||i,provider:n.serverHandle};t.push(o)}),t}async clear(){let e=this.getAll();await this.memento.update(this.mementoKey,[]),e.length&&this._onDidRemoveUris.fire(e.map(t=>t.provider))}};var ld=P(M());var b_="removeKernelUrisAndSessionsUsedByResources",wy=class{constructor(e,t,n){this.disposables=e;this.uriStorage=t;this.memento=n;this.usedRemoteKernelServerIdsAndSessions={}}activate(){this.usedRemoteKernelServerIdsAndSessions=this.memento.get(b_,{}),this.uriStorage.onDidRemove(this.onDidRemoveServers,this,this.disposables)}wasKernelUsed(e){let t=Lt(e.serverProviderHandle);return t in this.usedRemoteKernelServerIdsAndSessions&&typeof e.kernelModel.id=="string"&&e.kernelModel.id in this.usedRemoteKernelServerIdsAndSessions[t]}trackKernelIdAsUsed(e,t,n){let i=Lt(t);this.usedRemoteKernelServerIdsAndSessions[i]=this.usedRemoteKernelServerIdsAndSessions[i]||{},this.usedRemoteKernelServerIdsAndSessions[i][n]=this.usedRemoteKernelServerIdsAndSessions[i][n]||[];let o=this.usedRemoteKernelServerIdsAndSessions[i][n];o.includes(e.toString())||(o.push(e.toString()),this.memento.update(b_,this.usedRemoteKernelServerIdsAndSessions).then(h,h))}trackKernelIdAsNotUsed(e,t,n){let i=Lt(t);if(!(i in this.usedRemoteKernelServerIdsAndSessions)||!(n in this.usedRemoteKernelServerIdsAndSessions[i]))return;let o=this.usedRemoteKernelServerIdsAndSessions[i][n];!Array.isArray(o)||!o.includes(e.toString())||(o.splice(o.indexOf(e.toString()),1),o.length===0&&delete this.usedRemoteKernelServerIdsAndSessions[i][n],Object.keys(this.usedRemoteKernelServerIdsAndSessions[i]).length===0&&delete this.usedRemoteKernelServerIdsAndSessions[i],this.memento.update(b_,this.usedRemoteKernelServerIdsAndSessions).then(h,h))}onDidRemoveServers(e){e.forEach(t=>{let n=Lt(t);delete this.usedRemoteKernelServerIdsAndSessions[n],this.memento.update(b_,this.usedRemoteKernelServerIdsAndSessions).then(h,h)})}};wy=y([(0,ld.injectable)(),m(0,(0,ld.inject)(O)),m(1,(0,ld.inject)(zt)),m(2,(0,ld.inject)(Ve)),m(2,(0,ld.named)(ft))],wy);var mf=P(require("node-fetch")),TH=P(DH());var _H=require("vscode");function FF(r){return class extends r{constructor(...n){super(...n);this._onAnyMessage=new _H.EventEmitter;this.onAnyMessage=this._onAnyMessage.event;this.msgChain=Promise.resolve(),this.sendChain=Promise.resolve(),this.receiveHooks=[],this.sendHooks=[]}patchSuperEmit(n){super.emit=n}send(n,i){this.sendHooks?this.sendChain=this.sendChain.then(()=>Promise.all(this.sendHooks.map(o=>o(n,i)))).then(()=>super.send(n,i)):super.send(n,i)}handleEvent(n,i,...o){return i==="message"&&this.receiveHooks.length?(this.msgChain=this.msgChain.then(()=>Promise.all(this.receiveHooks.map(s=>s(o[0])))).then(()=>n(i,...o)).catch(s=>d.error(`Exception while handling messages: ${s}`)),!0):n(i,...o)}emit(n,...i){return this.handleEvent((o,...s)=>super.emit(o,...s),n,...i)}addReceiveHook(n){this.receiveHooks.push(n)}removeReceiveHook(n){this.receiveHooks=this.receiveHooks.filter(i=>i!==n)}addSendHook(n){this.sendHooks.push(n)}removeSendHook(n){this.sendHooks=this.sendHooks.filter(i=>i!==n)}}}var RH=P(M());var oo=new Map;var Py=class{getRequestCtor(e,t,n){class i extends mf.Request{constructor(s,a){super(s,a);let l=this.headers,c=n();Object.keys(c).forEach(f=>l.append(f,c[f].toString())),l.set("Content-Type","application/json");let p=l.append.bind(l);l.append=(f,g)=>{f.toLowerCase()!=="authorization"&&p(f,g)}}}return n&&Object.keys(n()||{}).length?i:mf.Request}getWebsocketCtor(e,t,n){let i=()=>{let s={},a;if(t&&(s={...s,rejectUnauthorized:!1}),e&&(a={Cookie:e}),n){let l=n();a=a?{...a,...l}:l}return a&&(s={...s,headers:a}),s};class o extends FF(TH.default){constructor(l,c){super(l,c,i());let u,p=/.*\/kernels\/(.*)\/.*/.exec(l);p&&p.length>1&&(this.kernelId=p[1]),this.kernelId?(oo.set(this.kernelId,this),this.on("close",()=>{u&&this.timer!==u&&clearInterval(u),oo.get(this.kernelId)===this&&oo.delete(this.kernelId)})):d.error("KernelId not extracted from Kernel WebSocket URL"),u=this.timer=setInterval(()=>this.ping(h),3e4)}}return o}wrapWebSocketCtor(e){class t extends FF(e){constructor(o,s,a){super(o,s,a);let l,c=/.*\/kernels\/(.*)\/.*/.exec(o);c&&c.length>1&&(this.kernelId=c[1]),this.kernelId?(oo.set(this.kernelId,this),this.on("close",()=>{l&&this.timer!==l&&clearInterval(l),oo.get(this.kernelId)===this&&oo.delete(this.kernelId)})):d.error("KernelId not extracted from Kernel WebSocket URL"),l=this.timer=setInterval(()=>this.ping(h),3e4)}}return t}getFetchMethod(){return mf.default}getHeadersCtor(){return mf.Headers}getRequestInit(){return{cache:"no-store",credentials:"same-origin"}}};Py=y([(0,RH.injectable)()],Py);var AH=require("https"),NH=P(M());var Dy=class{createHttpRequestAgent(){return new AH.Agent({rejectUnauthorized:!1})}};Dy=y([(0,NH.injectable)()],Dy);var os=P(M());var is=require("vscode");var Qge=["/bin/sh","/bin/bash","/bin/zsh"];function T_(r,e){let t=(r.argv||[]).some(n=>(n=n.toLowerCase(),Qge.some(i=>n.includes(i))));A("DATASCIENCE.KERNEL_SPEC_LANGUAGE",void 0,{language:r.language,kind:e,usesShell:t})}var _y="remoteKernelSpecCache.json";var Yge=2e3,R_=class extends Yn{constructor(t,n,i,o,s,a,l,c,u,p){super();this.id=t;this.displayName=n;this.env=i;this.cachedRemoteKernelValidator=o;this.kernelProvider=a;this.serverProviderHandle=l;this.jupyterConnection=c;this.fs=u;this.context=p;this._status="idle";this._onDidChangeStatus=new is.EventEmitter;this.onDidChangeStatus=this._onDidChangeStatus.event;this.promiseMonitor=new vo;this.kernelIdsToHide=new Set;this.kind="remote";this.cache=[];this._onDidChangeKernels=new is.EventEmitter;this.onDidChangeKernels=this._onDidChangeKernels.event;this._onDidChange=new is.EventEmitter;this.onDidChange=this._onDidChange.event;this.cacheFile=is.Uri.joinPath(p.globalStorageUri,_y),this.cacheKey=Lt(l),this._register(s.registerKernelFinder(this)),this._register(this._onDidChangeKernels.event(()=>this._onDidChange.fire(),this)),this._register(this._onDidChangeKernels),this._register(this._onDidChange),this._register(this._onDidChangeStatus),this._register(this.promiseMonitor)}get status(){return this._status}set status(t){this._status!==t&&(this._status=t,this._onDidChangeStatus.fire())}get lastError(){return this._lastError}get kernels(){return this.cache}get items(){return this.kernels}get title(){return this.displayName}dispose(){super.dispose(),this._cacheUpdateCancelTokenSource?.dispose(),this.kernelDisposeDelayTimer?.dispose()}async activate(){this.promiseMonitor.onStateChange(()=>{this.status=this.promiseMonitor.isComplete?"idle":"discovering"}),this.loadCache().then(h,h),this._register(this.kernelProvider.onDidStartKernel(t=>{Nt(t.kernelConnectionMetadata)&&this.updateCache().then(h,h)},this)),this._register(this.kernelProvider.onDidDisposeKernel(t=>{if(t&&Nt(t.kernelConnectionMetadata)){this.kernelDisposeDelayTimer?.dispose();let n=setTimeout(()=>{this.updateCache().then(h,h)},Yge);return this.kernelDisposeDelayTimer=new is.Disposable(()=>clearTimeout(n)),n}},this))}async refresh(){await this.loadCache(!0,!0)}getListOfKernelsWithCachedConnection(t,n=!1){return(!this.cachedConnection||n)&&(this.cachedConnection=this.getRemoteConnectionInfo(t)),this.cachedConnection.then(i=>i?(this.cachedConnection=Promise.resolve(i),this.listKernelsFromConnection(i)):Promise.resolve([])).catch(i=>this.isDisposed?Promise.reject(i):n?(this.cachedConnection=void 0,Promise.reject(i)):this.getListOfKernelsWithCachedConnection(t,!0))}async loadCache(t=!1,n=!1){d.ci(`Remote Kernel Finder load cache Server: ${this.id}`);let i=(async()=>{let o=t?[]:await this.getFromCache(),s=[];if(!t&&Array.isArray(o)&&o.length>0)s=o,this.updateCache().then(h,h),this.loadCache(!0).then(h,h);else try{s=await this.getListOfKernelsWithCachedConnection(n),this._lastError=void 0}catch(a){a instanceof is.CancellationError||(d.error("UniversalRemoteKernelFinder: Failed to get kernels without cache",a),this._lastError=a,this._onDidChange.fire())}await this.writeToCache(s)})();this.promiseMonitor.push(i),await i}async updateCache(){let t=(async()=>{let n=[];this._cacheUpdateCancelTokenSource?.dispose();let i=new is.CancellationTokenSource;this._cacheUpdateCancelTokenSource=i;try{n=await this.getListOfKernelsWithCachedConnection(!1)}catch(o){d.warn(`Could not fetch kernels from the ${this.kind} server, falling back to cache: ${o}`),n=await this.getFromCache(i.token),n=n.filter(s=>s.kind==="connectToLiveRemoteKernel")}i.token.isCancellationRequested||await this.writeToCache(n)})();this.promiseMonitor.push(t),await t}async getRemoteConnectionInfo(t=!0){let n=[];return t&&n.push(dt.createProgressReporter(void 0,I.connectingToJupyter)),this.jupyterConnection.createConnectionInfo(this.serverProviderHandle).finally(()=>z(n))}async getFromCache(t){try{if(t?.isCancellationRequested)throw new is.CancellationError;let n=this.cache;(!n||n.length===0)&&(n=await this.getCacheContents());let i=[],o=Promise.all(n.map(async s=>{await this.isValidCachedKernel(s)&&i.push(s)}));return await nr(t,o),i}catch(n){d.error("UniversalRemoteKernelFinder: Failed to get from cache",n)}return[]}async getCacheContents(){try{let t=await this.fs.readFile(this.cacheFile),n=JSON.parse(t);if(n.extensionVersion!==this.env.extensionVersion)return[];let i=n.data[this.cacheKey]||[];return Array.isArray(i)?i.map(o=>Ns.fromJSON(o)):[]}catch{return[]}}async listKernelsFromConnection(t){let n=[];try{let i=wp.create(t.settings);n.push({dispose:()=>Rs(i)});let[o,s,a,l]=await Promise.all([i.getRunningKernels(),i.getKernelSpecs(),i.getRunningSessions(),g9(t.serverProviderHandle)]),c=s.map(f=>(T_(f,"remote"),yx.create({kernelSpec:f,id:Oi(f,void 0,l),baseUrl:t.baseUrl,serverProviderHandle:t.serverProviderHandle})));return[...a.map(f=>{let g=f.kernel,v=g.last_activity?new Date(Date.parse(g.last_activity.toString())):new Date,b=g.connections?parseInt(g.connections.toString(),10):0,C=o.find(_=>_.id===f.kernel?.id)||{},E=s.find(_=>_.name===f.kernel?.name)||{};return vx.create({kernelModel:{...f.kernel,...E,...C,name:f.kernel?.name||"",lastActivityTime:v,numberOfConnections:b,model:f},baseUrl:t.baseUrl,id:f.kernel?.id||"",serverProviderHandle:t.serverProviderHandle})}).filter(f=>!this.kernelIdsToHide.has(f.kernelModel.id||"")),...c]}catch(i){throw d.error(`Error fetching kernels from ${t.baseUrl} (${t.displayName}):`,i),i}finally{await Promise.all(n.map(i=>i.dispose().catch(h)))}}async writeToCache(t){try{d.trace(`UniversalRemoteKernelFinder: Writing ${t.length} remote kernel connection metadata to cache`);let n=this.cache,i=new Map(n.map(f=>[f.id,f])),o=new Map(t.map(f=>[f.id,f])),s=t.filter(f=>!i.has(f.id)),a=t.filter(f=>i.has(f.id)&&!pa(f,i.get(f.id))),l=n.filter(f=>!o.has(f.id)),c=this.cacheKey;this.cache=n.filter(f=>o.has(f.id)).concat(s),this.cache.forEach(f=>{let g=o.get(f.id);f!==g&&g.kind==="connectToLiveRemoteKernel"&&f.kind==="connectToLiveRemoteKernel"&&f.updateModel(g.kernelModel)});let u=t.map(f=>f.toJSON()),p={extensionVersion:this.env.extensionVersion,data:{}};try{let f=await this.fs.readFile(this.cacheFile),g=JSON.parse(f);g.extensionVersion===this.env.extensionVersion&&(p=g)}catch{}p.data[c]=u,await this.fs.createDirectory(this.context.globalStorageUri).then(()=>this.fs.writeFile(this.cacheFile,JSON.stringify(p))).catch(f=>{d.error("Failed to cache the remote kernels.",f)}),(s.length||a.length||l.length)&&this._onDidChangeKernels.fire({removed:l})}catch(n){d.error("UniversalRemoteKernelFinder: Failed to write to cache",n)}}async isValidCachedKernel(t){switch(t.kind){case"startUsingRemoteKernelSpec":return!1;case"connectToLiveRemoteKernel":return this.cachedRemoteKernelValidator.isValid(t)}}};var A_=require("vscode");var pu=class{constructor(e,t,n,i,o,s,a,l,c,u){this.serverUriStorage=e;this.env=t;this.cachedRemoteKernelValidator=n;this.kernelFinder=i;this.kernelProvider=o;this.jupyterConnection=s;this.disposables=a;this.fs=l;this.context=c;this.jupyterServerProviderRegistry=u;this.serverFinderMapping=new Map;this.handledProviders=new WeakSet;this.mappedProviders=new WeakSet;this.mappedServers=new Set}activate(){this.serverUriStorage.onDidAdd(e=>this.validateAndCreateFinder(e),this,this.disposables),this.serverUriStorage.onDidChange(this.buildListOfFinders,this,this.disposables),this.serverUriStorage.onDidLoad(this.handleProviderChanges,this,this.disposables),this.serverUriStorage.onDidLoad(this.buildListOfFinders,this,this.disposables),this.jupyterServerProviderRegistry.onDidChangeCollections(this.handleProviderHandleChanges,this,this.disposables),this.serverUriStorage.onDidRemove(this.urisRemoved,this,this.disposables),this.jupyterServerProviderRegistry.onDidChangeCollections(this.handleProviderChanges,this,this.disposables),this.buildListOfFinders(),this.handleProviderChanges().catch(h)}buildListOfFinders(){this.serverUriStorage.all.map(e=>this.validateAndCreateFinder(e).catch(h))}handleProviderHandleChanges(){this.jupyterServerProviderRegistry.jupyterCollections.forEach(e=>{this.handledProviders.has(e)||(this.handledProviders.add(e),e.serverProvider.onDidChangeServers&&e.serverProvider.onDidChangeServers(this.buildListOfFinders,this,this.disposables))}),this.buildListOfFinders()}async handleProviderChanges(){if(!this.serverUriStorage.all.length)return;let e=new A_.CancellationTokenSource;this.disposables.push(e),await Promise.all(this.jupyterServerProviderRegistry.jupyterCollections.map(t=>{let n=t.serverProvider;if(!(!n||this.mappedProviders.has(n)))return this.mappedProviders.add(n),n?.onDidChangeServers&&n?.onDidChangeServers(()=>this.lookForServersInCollectionAndRemoveOldServers(t),this,this.disposables),this.serverUriStorage.onDidLoad(()=>this.lookForServersInCollectionAndRemoveOldServers(t),this,this.disposables),this.lookForServersInCollectionAndRemoveOldServers(t).catch(h)})),e.dispose()}async lookForServersInCollectionAndRemoveOldServers(e){if(!this.serverUriStorage.all.length)return;let t=new Set(this.serverUriStorage.all.map(o=>Lt(o.provider))),n=e.serverProvider;if(!n)return;let i=new A_.CancellationTokenSource;try{let o=await Promise.resolve(n.provideJupyterServers(i.token)),s=new Set;(o||[]).forEach(a=>{let l={extensionId:e.extensionId,handle:a.id,id:e.id},c=Lt(l);s.add(c),s_(l,a.label),!(this.mappedServers.has(c)||!t.has(c))&&(this.mappedServers.add(c),this.createRemoteKernelFinder(l,a.label))}),this.serverFinderMapping.forEach((a,l)=>{a.serverProviderHandle.extensionId===e.extensionId&&a.serverProviderHandle.id===e.id&&!s.has(Lt(a.serverProviderHandle))&&(a.dispose(),this.serverFinderMapping.delete(l))})}catch(o){d.error(`Failed to get servers for Collection ${e.id} in ${e.extensionId}`,o)}finally{i.dispose()}}async validateAndCreateFinder(e){let t=Lt(e.provider);if(this.serverFinderMapping.has(t))return;let n=new A_.CancellationTokenSource,i=async()=>{let s=this.jupyterServerProviderRegistry.jupyterCollections.find(c=>c.extensionId===e.provider.extensionId&&c.id===e.provider.id);if(!s||!s.serverProvider)return;let l=(await Promise.resolve(s.serverProvider.provideJupyterServers(n.token)))?.find(c=>c.id===e.provider.handle)?.label;l&&this.createRemoteKernelFinder(e.provider,l)},o=async()=>{let s=await this.jupyterServerProviderRegistry.jupyterCollections.find(a=>a.extensionId===e.provider.extensionId&&a.extensionId===Xa&&a.id===e.provider.id)?.label;s&&this.createRemoteKernelFinder(e.provider,s)};await Promise.all([i().catch(h),o().catch(h)]),n.dispose()}getOrCreateRemoteKernelFinder(e,t){let n=Lt(e);if(!this.serverFinderMapping.has(n)){let i=new R_(`remote-${n}`,t,this.env,this.cachedRemoteKernelValidator,this.kernelFinder,this.kernelProvider,e,this.jupyterConnection,this.fs,this.context);this.disposables.push(i),this.serverFinderMapping.set(n,i),i.activate().then(h,h)}return this.serverFinderMapping.get(n)}createRemoteKernelFinder(e,t){this.getOrCreateRemoteKernelFinder(e,t)}urisRemoved(e){e.forEach(t=>{let n=Lt(t),i=this.serverFinderMapping.get(n);i&&i.dispose(),this.serverFinderMapping.delete(n)})}dispose(){this.serverFinderMapping.forEach(e=>e.dispose())}};y([zr("Handle Jupyter Provider Changes")],pu.prototype,"handleProviderChanges",1),y([zr("Check Servers in Jupyter Server Provider")],pu.prototype,"lookForServersInCollectionAndRemoveOldServers",1),y([zr("Failed to create a Remote Kernel Finder")],pu.prototype,"validateAndCreateFinder",1),pu=y([(0,os.injectable)(),m(0,(0,os.inject)(zt)),m(1,(0,os.inject)(Ol)),m(2,(0,os.inject)(zk)),m(3,(0,os.inject)(Rr)),m(4,(0,os.inject)(Te)),m(5,(0,os.inject)(pn)),m(6,(0,os.inject)(O)),m(7,(0,os.inject)(st)),m(8,(0,os.inject)(ot)),m(9,(0,os.inject)($t))],pu);var pd=P(M());var j_=require("vscode");var W_=P(To());var nc=P(M());var N_=class extends ze{constructor(t){super("localjupyterserverconnection",I.jupyterNotebookFailure(t.message||t.toString()));this.originalError=t}};function Ry(r){if(_r()){let e=r;if(e&&e._futures){let t=e._futures;t.forEach&&t.forEach(n=>{n._status!==void 0&&(n._status|=4)})}e&&e._reconnectLimit&&(e._reconnectLimit=0)}}var Ty=class extends cn{constructor(e){super(e.message,e)}};var RC=require("vscode");var ff=class extends On{constructor(e){super("invalidkernel",I.kernelInvalid(ct(e)),e)}};async function Ay(r,e,t,n,i){if(!t.kernel)throw new ff(r);let o=dt.reportProgress(e,I.waitingForJupyterSessionToBeIdle),s=[];o&&s.push(o);try{d.trace(`Waiting for idle on (kernel): ${t.kernel.id} -> ${t.kernel.status}`);let a=oe();i.onCancellationRequested(()=>a.reject(new RC.CancellationError),void 0,s);let l=(f,g)=>{d.trace(`Got status ${g} in waitForIdleOnSession`),g=="idle"&&a.resolve(g)};t.kernel.statusChanged?.connect(l),s.push(new RC.Disposable(()=>ai(()=>t.kernel?.statusChanged?.disconnect(l)))),t.kernel.status=="idle"&&a.resolve(t.kernel.status);let c=oe(),u=()=>c.resolve("");t.disposed.connect(u,c),s.push(new RC.Disposable(()=>ai(()=>t.disposed.disconnect(u,c)))),c.promise.catch(h),a.promise.catch(h);let p=await br(n,"",a.promise,c.promise);if(t.isDisposed)throw d.error("Session disposed while waiting for session to be idle."),new ff(r);if(d.trace(`Finished waiting for idle on (kernel): ${t.kernel.id} -> ${t.kernel.status}`),p=="idle")return;throw d.error(`Shutting down after failing to wait for idle on (kernel): ${t.kernel.id} -> ${t.kernel.status}`),new gy(r)}catch(a){throw d.ci("Error waiting for idle",a),a}finally{z(s)}}var U_=require("vscode");var rc=P(F_()),LF=require("vscode");var Ny=class extends Yn{constructor(t,n){super();this.kind=t;this.session=n;this.propertyChanged=new rc.Signal(this);this.kernelChanged=new rc.Signal(this);this.statusChanged=new rc.Signal(this);this.connectionStatusChanged=new rc.Signal(this);this.iopubMessage=new rc.Signal(this);this.unhandledMessage=new rc.Signal(this);this.anyMessage=new rc.Signal(this);this.disposed=new rc.Signal(this);this.didShutdown=this._register(new LF.EventEmitter);this._onDidKernelSocketChange=this._register(new LF.EventEmitter);n.propertyChanged.connect(this.onPropertyChanged,this),n.kernelChanged.connect(this.onKernelChanged,this),n.statusChanged.connect(this.onStatusChanged,this),n.connectionStatusChanged.connect(this.onConnectionStatusChanged,this),n.iopubMessage.connect(this.onIOPubMessage,this),n.unhandledMessage.connect(this.onUnhandledMessage,this),n.anyMessage.connect(this.onAnyMessage,this),this._register({dispose:()=>{this.session.propertyChanged.disconnect(this.onPropertyChanged,this),this.session.kernelChanged.disconnect(this.onKernelChanged,this),this.session.statusChanged.disconnect(this.onStatusChanged,this),this.session.connectionStatusChanged.disconnect(this.onConnectionStatusChanged,this),this.session.iopubMessage.disconnect(this.onIOPubMessage,this),this.session.unhandledMessage.disconnect(this.onUnhandledMessage,this),this.session.anyMessage.disconnect(this.onAnyMessage,this)}})}get id(){return this.session.id}get path(){return this.session.path}get name(){return this.session.name}get type(){return this.session.type}get serverSettings(){return this.session.serverSettings}get model(){return this.session.model}get kernel(){return this.isDisposed||!this.session.kernel?null:this.session.kernel}get onDidShutdown(){return this.didShutdown.event}get kernelId(){return this.session?.kernel?.id||""}get onDidKernelSocketChange(){return this._onDidKernelSocketChange.event}dispose(){this.isDisposed||(super.dispose(),this.statusChanged.emit("dead"),this.disposed.emit(),rc.Signal.disconnectAll(this))}async restart(){await this.session.kernel?.restart(),this.initializeKernelSocket(),d.info(`Restarted ${this.session?.kernel?.id}`)}initializeKernelSocket(){if(!this.session.kernel)throw new Error("Kernel not initialized in Session");let t={kernel:this.session.kernel,options:{clientId:this.session.kernel.clientId,id:this.session.kernel.id,model:{...this.session.kernel.model},userName:this.session.kernel.username},socket:oo.get(this.session.kernel.id)};JSON.stringify(this.previousKernelSocketInformation?.kernel.model)===JSON.stringify(t.kernel.model)&&this.previousKernelSocketInformation?.kernel===t.kernel&&this.previousKernelSocketInformation?.kernel.id===t.kernel.id&&this.previousKernelSocketInformation?.socket===t.socket||(this.previousKernelSocketInformation=t,this.session.kernel?.connectionStatusChanged.disconnect(this.onKernelConnectionStatusHandler,this),this.session.kernel?.connectionStatusChanged.connect(this.onKernelConnectionStatusHandler,this),this._onDidKernelSocketChange.fire())}onPropertyChanged(t,n){this.propertyChanged.emit(n)}onKernelChanged(t,n){this.kernelChanged.emit(n)}onStatusChanged(t,n){this.statusChanged.emit(n);let i=this.status;d.ci(`Server Status = ${i}`)}onConnectionStatusChanged(t,n){this.connectionStatusChanged.emit(n)}onIOPubMessage(t,n){this.iopubMessage.emit(n)}onUnhandledMessage(t,n){d.warn(`Unhandled message found: ${n.header.msg_type}`),this.unhandledMessage.emit(n)}onAnyMessage(t,n){this.anyMessage.emit(n)}setPath(t){return this.session.setPath(t)}setName(t){return this.session.setName(t)}setType(t){return this.session.setType(t)}changeKernel(t){return this.session.changeKernel(t)}onKernelConnectionStatusHandler(t,n){d.ci(`Server Kernel Status = ${n}`)}};var L_=class extends Ny{constructor(t,n,i,o,s){super(ht(i)?"localJupyter":"remoteJupyter",t);this.resource=n;this.kernelConnectionMetadata=i;this.kernelService=o;this.creator=s;this.isShuttingDown=!1;this.initializeKernelSocket()}get status(){return this.isDisposed?"dead":this.session?.kernel?this.session.kernel.status:(d.ci(`Kernel status not started because real session is ${this.session?"defined":"undefined"} & real kernel is ${this.session?.kernel?"defined":"undefined"}`),"unknown")}dispose(){this.restartToken?.cancel(),this.restartToken?.dispose(),this.shutdownImplementation(!1).finally(()=>super.dispose())}async waitForIdle(t,n){try{await Ay(this.kernelConnectionMetadata,this.resource,this.session,t,n)}catch(i){throw d.ci("Error waiting for idle",i),await this.shutdown().catch(h),i}}async restart(){let t=[],n=new U_.CancellationTokenSource;this.restartToken=n;let i=new Ht(!1);t.push(i),t.push(n);try{await this.validateLocalKernelDependencies(n.token,i),await super.restart()}finally{z(t)}}async validateLocalKernelDependencies(t,n){if(!(!this.kernelConnectionMetadata?.interpreter||!ht(this.kernelConnectionMetadata)||!this.kernelService)){if(t.isCancellationRequested)throw new U_.CancellationError;await this.kernelService.ensureKernelIsUsable(this.resource,this.kernelConnectionMetadata,n,t,this.creator==="3rdPartyExtension")}}async shutdown(){return this.restartToken?.cancel(),this.restartToken?.dispose(),this.shutdownImplementation(!0)}async shutdownImplementation(t){if(this.isDisposed||this.isShuttingDown)return;this.isShuttingDown=!0;let n=(new Error().stack||"").split(`
|
||
`).filter(o=>o.includes(Ue));d.trace(`Shutdown session - current session, called from
|
||
${n.map(o=>` ${o}`).join(`
|
||
`)}`);let i=`${this.session.kernel?.id}, ${this.kernelConnectionMetadata.id}`;d.debug(`shutdownSession ${i} - start`);try{if(t||this.canShutdownSession())try{d.debug(`Session can be shutdown ${this.kernelConnectionMetadata.id}`),Ry(this.session.kernel),this.session.isDisposed||await br(1e3,this.session.shutdown().catch(h))}catch{try{this.session.isDisposed||this.session.dispose()}catch(o){d.warn("Failures in disposing the session",o)}}finally{this.didShutdown.fire()}else d.debug(`Session cannot be shutdown ${this.kernelConnectionMetadata.id}`);try{this.session.isDisposed||this.session.dispose()}catch(o){d.warn("Failures in disposing the session",o)}super.dispose(),d.trace("Shutdown session -- complete")}catch(o){d.warn("Failures in disposing the session",o)}d.debug(`shutdownSession ${i} - shutdown complete`)}canShutdownSession(){return ht(this.kernelConnectionMetadata)?!0:this.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel"?!1:this.resource&&Zi(this.resource)==="interactive"?!0:!(this.resource&&Zi(this.resource)==="notebook"&&Nt(this.kernelConnectionMetadata))}};var du=class{constructor(e,t,n,i,o){this.jupyterNotebookProvider=e;this.jupyterConnection=t;this.asyncDisposables=n;this.kernelService=i;this.configService=o}async create(e){let t=[],n,i=()=>{e.ui.disableUI||n||(n=dt.createProgressReporter(e.resource,Nt(e.kernelConnection)?I.connectingToJupyter:I.startingJupyter),t.push(n))};e.ui.disableUI&&e.ui.onDidChangeDisableUI(i,this,t),i();let o,s=[],a=this.configService.getSettings(e.resource).jupyterLaunchTimeout;try{o=Nt(e.kernelConnection)?await ir(e.token,this.jupyterConnection.createConnectionInfo(e.kernelConnection.serverProviderHandle)):await this.jupyterNotebookProvider.getOrStartServer({resource:e.resource,token:e.token,ui:e.ui}),await ir(e.token,this.validateLocalKernelDependencies(e));let l=wp.create(o.settings);this.asyncDisposables.push({dispose:()=>Rs(l)}),s.push(l),await ir(e.token,this.validateRemoteServer(e,l));let c=await this.connectToOrCreateSession({...e,contentsManager:l.contentsManager,sessionManager:l.sessionManager,kernelManager:l.kernelManager,kernelSpecManager:l.kernelSpecManager,idleTimeout:a,connection:o});e.token.isCancellationRequested&&(await c.shutdown().catch(h),ai(()=>c.dispose())),En.throwIfCanceled(e.token),d.info(`Started session for kernel ${e.kernelConnection.kind}:${e.kernelConnection.id}`);let u=new L_(c,e.resource,e.kernelConnection,this.kernelService,e.creator),p=c.disposed,f=()=>{l.dispose(),p.disconnect(f)};this.asyncDisposables.push({dispose:()=>u.shutdown().finally(()=>u.dispose())}),c.disposed.connect(f);let g=u.onDidDispose(f);return this.asyncDisposables.push(g),u}catch(l){throw z(s),Nt(e.kernelConnection)?o?Jo.isSelfCertsError(l)?new Jo(o.baseUrl):kl.isSelfCertsExpiredError(l)?new kl(o.baseUrl):new Ki(o.baseUrl,e.kernelConnection.serverProviderHandle,l):l:l instanceof ze?l:new N_(l)}finally{z(t)}}async validateRemoteServer(e,t){if(t.isDisposed)throw new yn;if(!ht(e.kernelConnection))try{await Promise.all([t.getRunningKernels(),t.getKernelSpecs()])}catch(n){throw d.error("Failed to fetch running kernels from remote server, connection may be outdated or remote server may be unreachable",n),new Ki(e.kernelConnection.baseUrl,e.kernelConnection.serverProviderHandle,n)}}async validateLocalKernelDependencies(e){if(e.token.isCancellationRequested)throw new j_.CancellationError;e.kernelConnection?.interpreter&&ht(e.kernelConnection)&&this.kernelService&&await this.kernelService.ensureKernelIsUsable(e.resource,e.kernelConnection,e.ui,e.token,e.creator==="3rdPartyExtension")}async connectToOrCreateSession(e){if(e.token.isCancellationRequested)throw new j_.CancellationError;let t;try{if(e.kernelConnection&&e.kernelConnection.kind==="connectToLiveRemoteKernel"&&e.kernelConnection.kernelModel.id&&e.kernelConnection.kernelModel.model){if(!e.kernelConnection.kernelModel.model)throw new Error("Kernel model not defined when connecting to an existing session");t=e.sessionManager.connectTo({...e.kernelConnection.kernelModel,model:e.kernelConnection.kernelModel.model}),await ir(e.token,Yw(async()=>t.kernel?.connectionStatus==="connected"||e.token.isCancellationRequested,e.idleTimeout,100))}else d.trace(`createNewKernelSession ${e.kernelConnection?.id}`),t=await this.createNewSession(e),await Ay(e.kernelConnection,e.resource,t,e.idleTimeout,e.token).catch(h);if(e.token.isCancellationRequested)throw new j_.CancellationError;return t}catch(n){let i=e.ui.disableUI?d.debug:d.error;throw n instanceof ze?(i("Failed to change kernel, re-throwing",n),n):(i("Failed to change kernel",n),new ff(e.kernelConnection))}}async createNewSession(e){let t=(e.connection,e.resource,void 0),n=t?.path,i=bg(e.kernelConnection)??e.kernelSpecManager?.specs?.default??"",o;if(t?.name)o=t.name;else{let a=e.resource?rp(e.resource):"";o=`${e.resource?vn(e.resource,a):""}-${(0,W_.default)()}${a}`}let s={path:n||eve(e.resource),kernel:{name:i},name:o,type:(e.resource?.path||"").toLowerCase().endsWith(".ipynb")?"notebook":"console"};try{let a=await ir(e.token,e.sessionManager.startNew(s,{kernelConnectionOptions:{handleComms:!0}}));if(!a.kernel)throw new Ty(new Error("No kernel created"));return d.info(I.createdNewKernel(e.connection.baseUrl,a?.kernel?.id||"")),a}catch(a){throw a instanceof Ty?a:new Ty(a)}}};du=y([(0,nc.injectable)(),m(0,(0,nc.inject)(wg)),m(1,(0,nc.inject)(pn)),m(2,(0,nc.inject)(Vo)),m(3,(0,nc.inject)(Hk)),m(3,(0,nc.optional)()),m(4,(0,nc.inject)(le))],du);function Zge(){return`${yg}${(0,W_.default)()}`}function eve(r){let e=`${Zge()}${(0,W_.default)()}.ipynb`;return r?`${vn(r,".ipynb")}${e}`:`${I.defaultNotebookName}${e}`}var My=class{constructor(e,t,n){this.rawKernelSupported=e;this.newRawKernelSessionFactory=t;this.newJupyterSessionFactory=n}async create(e){let t=e.kernelConnection;return this.rawKernelSupported.isSupported&&ht(t)&&this.newRawKernelSessionFactory?this.newRawKernelSessionFactory.create({...e,kernelConnection:t}):this.newJupyterSessionFactory.create(e)}};My=y([(0,pd.injectable)(),m(0,(0,pd.inject)(hi)),m(1,(0,pd.inject)(r_)),m(1,(0,pd.optional)()),m(2,(0,pd.inject)(du))],My);var AC=Symbol("RemoteKernelFinderController");function UH(r,e){r.add(Zv,py),r.addSingleton(ge,dy),r.addSingleton(ge,ey),r.addSingleton(Ip,vy),r.addSingleton(Js,Js),r.addSingleton(Cg,my),r.addSingleton($k,nf),r.addSingleton(iu,iu),r.addSingleton(fi,fi),r.addSingleton(Da,Da),r.addSingleton(Sa,Sa),r.addSingleton(Hk,sf),r.addSingleton(wg,by),r.addSingleton(Sp,rf),r.addSingleton(td,rf),r.addSingleton(zt,Cy),r.addSingleton(Gk,xy),r.addSingleton(Dk,yy),r.addSingleton(bx,My),r.addSingleton(du,du),r.addSingleton(Bc,Py),r.addSingleton(xp,Dy),r.addSingleton(pn,pn),r.addSingleton(_m,wy),r.addBinding(_m,ge),r.addSingleton(zk,hy),r.addSingleton(Zr,uy),r.addSingleton(AC,pu),r.addBinding(AC,ge),r.addSingleton($t,Pg)}var hf=P(M()),mu=require("vscode");var Oy=class{constructor(e,t,n,i){this.disposableRegistry=e;this.kernelProvider=t;this.serverUriStorage=n;this.jupyterUriProviderRegistration=i;this.kernelsStartedSuccessfully=new WeakSet;this.kernelDisposables=new WeakMap;this.kernelConnectionToKernelMapping=new WeakMap;this.kernelsRestarting=new WeakSet;this.kernelReconnectProgress=new WeakMap;this.lastExecutedCellPerKernel=new WeakMap}activate(){this.kernelProvider.onDidStartKernel(this.onDidStartKernel,this,this.disposableRegistry),this.disposableRegistry.push(this.kernelProvider.onDidDisposeKernel(e=>{this.kernelDisposables.get(e)?.dispose(),this.kernelDisposables.delete(e),this.kernelReconnectProgress.get(e)?.dispose(),this.kernelReconnectProgress.delete(e)},this)),this.disposableRegistry.push(this.kernelProvider.onDidRestartKernel(e=>{this.kernelReconnectProgress.get(e)?.dispose(),this.kernelReconnectProgress.delete(e)},this)),this.disposableRegistry.push(or.onDidChangeNotebookCellExecutionState(e=>{if(!Dt(e.cell.notebook)||e.state!==1)return;let t=this.kernelProvider.get(e.cell.notebook);!t||this.lastExecutedCellPerKernel.get(t)!==e.cell||this.lastExecutedCellPerKernel.delete(t)}))}getKernelSpecificDisposables(e){let t=this.kernelDisposables.get(e)||new $r;return this.disposableRegistry.push(t),this.kernelDisposables.set(e,t),t}onDidStartKernel(e){if(this.kernelsStartedSuccessfully.has(e)||!e.session?.kernel)return;let t=this.getKernelSpecificDisposables(e);t.add(or.onDidChangeNotebookCellExecutionState(n=>{n.cell.notebook===e.notebook&&this.kernelProvider.get(n.cell.notebook)===e&&n.state===3&&this.lastExecutedCellPerKernel.set(e,n.cell)},this)),this.kernelsStartedSuccessfully.add(e),this.kernelConnectionToKernelMapping.set(e.session.kernel,e),e.session?.kernel?.connectionStatusChanged.connect(this.onKernelStatusChanged,this),t.add(e.addHook("willRestart",async()=>{this.kernelReconnectProgress.get(e)?.dispose(),this.kernelReconnectProgress.delete(e),this.kernelsRestarting.add(e)},this)),t.add(e.onRestarted(()=>this.kernelsRestarting.delete(e),this))}onKernelStatusChanged(e,t){let n=this.kernelConnectionToKernelMapping.get(e);if(n&&!this.kernelsRestarting.has(n))switch(t){case"connected":{this.kernelReconnectProgress.get(n)?.dispose(),this.kernelReconnectProgress.delete(n);return}case"disconnected":{this.kernelReconnectProgress.has(n)&&(this.kernelReconnectProgress.get(n)?.dispose(),this.kernelReconnectProgress.delete(n),this.onKernelDisconnected(n)?.catch(h));return}case"connecting":this.kernelReconnectProgress.has(n)||this.onKernelConnecting(n)?.catch(h);return;default:return}}async onKernelConnecting(e){let t=this.getKernelSpecificDisposables(e),n=oe(),i=new mu.Disposable(()=>n.resolve());if(this.kernelReconnectProgress.set(e,i),Nt(e.kernelConnectionMetadata)&&await this.handleRemoteServerShutdown(e,e.kernelConnectionMetadata))return;let o=I.automaticallyReconnectingToAKernelProgressMessage(ct(e.kernelConnectionMetadata));mu.window.withProgress({location:mu.ProgressLocation.Notification,title:o},async()=>n.promise).then(h,h),t.add(i)}async onKernelDisconnected(e){if(e.disposed||e.disposing||(_t(e.resourceUri,"DATASCIENCE.KERNEL_CRASH"),Nt(e.kernelConnectionMetadata)&&await this.handleRemoteServerShutdown(e,e.kernelConnectionMetadata)))return;let t=ht(e.kernelConnectionMetadata)?I.kernelDisconnected(ct(e.kernelConnectionMetadata)):I.remoteJupyterConnectionFailedWithServer(e.kernelConnectionMetadata.baseUrl);mu.window.showErrorMessage(t).then(h,h);try{let n=this.lastExecutedCellPerKernel.get(e);if(!n||n.document.isClosed||n.notebook.isClosed||n.executionSummary?.success===!1)return;await vp(n,e.controller,t,!1)}finally{await e.dispose()}}async handleRemoteServerShutdown(e,t){let n=this.jupyterUriProviderRegistration.jupyterCollections.find(o=>o.extensionId===t.serverProviderHandle.extensionId&&o.id===t.serverProviderHandle.id);if(!n)return!1;let i=new mu.CancellationTokenSource;try{return(await Promise.resolve(n.serverProvider.provideJupyterServers(i.token))||[]).map(a=>a.id).includes(t.serverProviderHandle.handle)?!1:(await this.serverUriStorage.remove(t.serverProviderHandle),this.kernelReconnectProgress.get(e)?.dispose(),this.kernelReconnectProgress.delete(e),!0)}catch{return!1}finally{i.dispose()}}};Oy=y([(0,hf.injectable)(),m(0,(0,hf.inject)(O)),m(1,(0,hf.inject)(Te)),m(2,(0,hf.inject)(zt)),m(3,(0,hf.inject)($t))],Oy);var NC=P(M());var Ky=class{constructor(e,t){this.disposableRegistry=e;this.kernelProvider=t;this.kernelsStartedSuccessfully=new WeakSet;this.kernelRestartProgress=new WeakMap}activate(){this.kernelProvider.onKernelStatusChanged(this.onKernelStatusChanged,this,this.disposableRegistry),this.kernelProvider.onDidStartKernel(this.onDidStartKernel,this,this.disposableRegistry),this.disposableRegistry.push(this.kernelProvider.onDidDisposeKernel(e=>{this.kernelRestartProgress.get(e)?.dispose(),this.kernelRestartProgress.delete(e)},this)),this.disposableRegistry.push(this.kernelProvider.onDidRestartKernel(e=>{this.kernelRestartProgress.get(e)?.dispose(),this.kernelRestartProgress.delete(e)},this))}onDidStartKernel(e){this.kernelsStartedSuccessfully.add(e)}onKernelStatusChanged({kernel:e}){if(!(!this.kernelsStartedSuccessfully.has(e)||!e.session||e.session.kind==="localRaw"))if(e.status==="autorestarting"){let t=dt.createProgressReporter(e.resourceUri,I.restartingKernelStatus(ct(e.kernelConnectionMetadata)));this.kernelRestartProgress.set(e,t)}else e.status!=="starting"&&e.status!=="busy"&&e.status!=="unknown"&&this.kernelRestartProgress.has(e)&&(this.kernelRestartProgress.get(e)?.dispose(),this.kernelRestartProgress.delete(e))}};Ky=y([(0,NC.injectable)(),m(0,(0,NC.inject)(O)),m(1,(0,NC.inject)(Te))],Ky);var MC=P(M()),UF=require("vscode");var gf=class{constructor(e,t){this.disposableRegistry=e;this.kernelProvider=t;this.lastExecutedCellPerKernel=new WeakMap;this.kernelsStartedSuccessfully=new WeakSet}activate(){this.kernelProvider.onKernelStatusChanged(this.onKernelStatusChanged,this,this.disposableRegistry),this.kernelProvider.onDidStartKernel(this.onDidStartKernel,this,this.disposableRegistry)}onDidStartKernel(e){this.kernelsStartedSuccessfully.add(e),or.onDidChangeNotebookCellExecutionState(t=>{t.cell.notebook===e.notebook&&this.kernelProvider.get(t.cell.notebook)===e&&this.lastExecutedCellPerKernel.set(e,t.cell)})}async onKernelStatusChanged({kernel:e}){this.kernelsStartedSuccessfully.has(e)&&(e.disposed||e.disposing||!e.session||(e.session.kind==="localRaw"&&e.status==="dead"&&(UF.window.showErrorMessage(I.kernelDiedWithoutError(ct(e.kernelConnectionMetadata))).then(h,h),await this.endCellAndDisplayErrorsInCell(e)),e.session.kind!=="localRaw"&&e.status==="autorestarting"&&(UF.window.showErrorMessage(I.kernelDiedWithoutErrorAndAutoRestarting(ct(e.kernelConnectionMetadata))).then(h,h),await this.endCellAndDisplayErrorsInCell(e))))}async endCellAndDisplayErrorsInCell(e){let t=this.lastExecutedCellPerKernel.get(e);if(_t(e.resourceUri,"DATASCIENCE.KERNEL_CRASH"),!!t)return vp(t,e.controller,I.kernelCrashedDueToCodeInCurrentOrPreviousCell,!1)}};y([zr()],gf.prototype,"onKernelStatusChanged",1),gf=y([(0,MC.injectable)(),m(0,(0,MC.inject)(O)),m(1,(0,MC.inject)(Te))],gf);var fu=P(M()),md=require("vscode");var dd=class{constructor(e,t,n,i){this.installer=e;this.memento=t;this.rawSupport=n;this.serviceContainer=i;this.installPromises=new Map}async installMissingDependencies({resource:e,kernelConnection:t,ui:n,token:i,ignoreCache:o,cannotChangeKernels:s,installWithoutPrompting:a}){if(!ht(t)||!vt(t)||!t.interpreter)return 0;d.info(`Check & install missing Kernel dependencies for ${B(t.interpreter?.uri)}, ui.disabled=${n.disableUI} for resource '${B(e)}'`);let l=async()=>{if(await dt.wrapAndReportProgress(e,I.validatingKernelDependencies,()=>this.areDependenciesInstalled(t,i,o)))return 0;if(i?.isCancellationRequested)return 1};if(!a){let g=await l();if(g===0||g===1)return g}let c=gn(t.interpreter.uri),u=this.installPromises.get(c),p;if(!u){let g=new md.CancellationTokenSource,v=i.onCancellationRequested(()=>{g.cancel(),v.dispose()});u=dt.wrapAndReportProgress(e,I.installingMissingDependencies,async()=>{if(a){let b=await l();if(b===0||b===1)return b}return this.runInstaller(e,t.interpreter,n,g,s,a)}),u.finally(()=>{v.dispose(),g.dispose()}).catch(h),this.installPromises.set(c,u)}let f=2;try{f=await u,(p?.token?.isCancellationRequested||i.isCancellationRequested)&&(f=1)}catch(g){d.ci("Failed to install kernel dependency",g),f=2}finally{this.installPromises.delete(c)}return f}async areDependenciesInstalled(e,t,n){if(e.kind==="connectToLiveRemoteKernel"||e.kind==="startUsingRemoteKernelSpec"||e.interpreter===void 0)return!0;if(!n&&this.rawSupport.isSupported&&await J8(this.memento,19,e.interpreter))return d.info(`IPyKernel found previously in this environment ${B(e.interpreter.uri)}`),!0;let i=this.installer.isInstalled(19,e.interpreter).then(o=>o===!0);return i.then(o=>{o&&TD(this.memento,19,e.interpreter).catch(h)},h),nr(t,!1,i)}async runInstaller(e,t,n,i,o,s){if(d.ci(`Run Installer for ${B(e)} ui.disableUI=${n.disableUI}, cancelTokenSource.token.isCancellationRequested=${i.token.isCancellationRequested}`),n.disableUI)return 4;let a=Be(t),[l,c]=await Promise.all([G8(this.memento,19,t),a==="Conda"?void 0:await this.installer.isInstalled(27,t)]);if(i.token.isCancellationRequested)return 1;let u=l?I.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreterAndRequiresUpdate:I.libraryRequiredToLaunchJupyterKernelNotInstalledInterpreter,p=c===!1?[19,27]:[19],f=u(Yr(t)||t.uri.fsPath,p.map(L=>dr.get(L)).join(` ${me.and} `)),g=p.map(L=>dr.get(L)).join(", "),v=e?Zi(e):void 0,b=e?await mt(e.toString()):void 0;_t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"displayed",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a});let C=me.install,E=I.selectKernel,R=me.moreInfo,_=[C];e&&!o&&_.push(E),_.push(R);try{(!om()||!s)&&_t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"prompted",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a});let L;do L=om()||s?C:await nr(i.token,md.window.showInformationMessage(f,{modal:!0},..._)),L===R&&(_t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"moreInfo",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),md.env.openExternal(md.Uri.parse("https://aka.ms/AAhi594")));while(L===R);if(i.token.isCancellationRequested)return _t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"dismissed",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),1;if(L===E)return _t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"differentKernel",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),3;if(L===C){_t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"install",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a});let te=await nr(i.token,3,this.installer.install(19,t,i,l===!0,c===!1));if(te===0)return _t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"installed",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),0;if(te===2)return _t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"failed",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),2}return _t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"dismissed",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),1}catch(L){throw d.error(`Failed to install ${g}`,L),_t(e,"DS_INTERNAL.PYTHON_MODULE_INSTALL",void 0,{action:"error",moduleName:g,resourceType:v,resourceHash:b,pythonEnvType:a}),L}}};y([li("Install Missing Dependencies")],dd.prototype,"installMissingDependencies",1),y([li("Are Dependencies Installed"),m(0,Lc("id"))],dd.prototype,"areDependenciesInstalled",1),dd=y([(0,fu.injectable)(),m(0,(0,fu.inject)(Vi)),m(1,(0,fu.inject)(Ve)),m(1,(0,fu.named)(ft)),m(2,(0,fu.inject)(hi)),m(3,(0,fu.inject)(at))],dd);var V_=P(M()),Ly=require("vscode");var Fy=class extends tr{constructor(t){super();this._onDidChangeRegistrations=this._register(new Ly.EventEmitter);this.onDidChangeRegistrations=this._onDidChangeRegistrations.event;this._finders=[];this.connectionFinderMapping=new Map;this._onDidChangeKernels=this._register(new Ly.EventEmitter);this.onDidChangeKernels=this._onDidChangeKernels.event;this._status="idle";this._onDidChangeStatus=this._register(new Ly.EventEmitter);t.push(this),this._register(this._onDidChangeStatus),this._register(this._onDidChangeRegistrations)}get status(){return this._status}set status(t){this._status!=t&&(this._status=t,this._onDidChangeStatus.fire())}get onDidChangeStatus(){return this._onDidChangeStatus.event}registerKernelFinder(t){this._finders.push(t);let n=()=>{this.status=this._finders.every(s=>s.status==="idle")?"idle":"discovering"};n();let i=this._register(new $r),o=()=>{let s=this._finders.findIndex(a=>a===t);s>=0&&this._finders.splice(s,1),i.dispose(),n(),this._onDidChangeKernels.fire(),this._onDidChangeRegistrations.fire({added:[],removed:[t]})};return i.add(t.onDidChangeStatus(n,this)),i.add(t.onDidChangeKernels(()=>this._onDidChangeKernels.fire())),i.add(t.onDidDispose(()=>o())),this._onDidChangeKernels.fire(),this._onDidChangeRegistrations.fire({added:[t],removed:[]}),new Ly.Disposable(()=>o())}get kernels(){let t=[];this.connectionFinderMapping.clear();let n=new Set;this._finders.filter(o=>o.kind==="localPythonEnvironment").forEach(o=>{o.kernels.forEach(s=>{(s.kind==="startUsingLocalKernelSpec"||s.kind==="startUsingPythonInterpreter")&&s.kernelSpec.specFile&&n.add(s.kernelSpec.specFile),t.push(s),this.connectionFinderMapping.set(s.id,o)})}),this._finders.filter(o=>o.kind==="localKernelSpec").forEach(o=>{o.kernels.forEach(s=>{(s.kind==="startUsingLocalKernelSpec"||s.kind==="startUsingPythonInterpreter")&&s.kernelSpec.specFile&&n.has(s.kernelSpec.specFile)||(t.push(s),this.connectionFinderMapping.set(s.id,o))})});let i=this._finders.filter(o=>o.kind==="remote");for(let o of i){let s=o.kernels;s.forEach(a=>{this.connectionFinderMapping.set(a.id,o)}),t.push(...s)}return t}getFinderForConnection(t){return this.connectionFinderMapping.get(t.id)}get registered(){return this._finders}};Fy=y([(0,V_.injectable)(),m(0,(0,V_.inject)(O))],Fy);var mn=P(M());var vi=require("vscode");var B_=class{constructor(e,t){this.asyncDisposables=e;this.disposables=t;this.executions=new WeakMap;this.kernelsByNotebook=new WeakMap;this.kernelsById=new Map;this.pendingDisposables=new Set;this._onDidRestartKernel=new vi.EventEmitter;this._onDidStartKernel=new vi.EventEmitter;this._onDidCreateKernel=new vi.EventEmitter;this._onDidDisposeKernel=new vi.EventEmitter;this._onKernelStatusChanged=new vi.EventEmitter;this.onKernelStatusChanged=this._onKernelStatusChanged.event;this.asyncDisposables.push(this),vi.workspace.onDidCloseNotebookDocument(n=>this.disposeOldKernel(n),this,t),t.push(this._onDidDisposeKernel),t.push(this._onDidRestartKernel),t.push(this._onKernelStatusChanged),t.push(this._onDidStartKernel),t.push(this._onDidCreateKernel)}get kernels(){let e=new Set;return vi.workspace.notebookDocuments.forEach(t=>{let n=this.get(t);n&&e.add(n)}),Array.from(e)}get onDidDisposeKernel(){return this._onDidDisposeKernel.event}get onDidRestartKernel(){return this._onDidRestartKernel.event}get onDidStartKernel(){return this._onDidStartKernel.event}get onDidCreateKernel(){return this._onDidCreateKernel.event}get(e){if(xn(e)){let t=vi.workspace.notebookDocuments.find(n=>n.uri.toString()===e.toString());return t?this.get(t):void 0}else return typeof e=="string"?this.kernelsById.get(e)?.kernel:this.kernelsByNotebook.get(e)?.kernel}getKernelExecution(e){return this.executions.get(e)}getInternal(e){return this.kernelsByNotebook.get(e)}async dispose(){d.ci("Disposing all kernels from kernel provider");let e=Array.from(this.pendingDisposables.values());this.pendingDisposables.clear(),await Promise.all(e),await Promise.all(this.kernels.map(t=>t.dispose()))}storeKernel(e,t,n){this.kernelsByNotebook.set(e,{options:t,kernel:n}),this.kernelsById.set(n.id,{options:t,kernel:n}),this._onDidCreateKernel.fire(n)}deleteMappingIfKernelIsDisposed(e){e.onDisposed(()=>{this.get(e.notebook)===e&&(this.kernelsByNotebook.delete(e.notebook),this.kernelsById.delete(e.id),d.debug(`Kernel got disposed, hence there is no longer a kernel associated with ${B(e.uri)}`)),this.pendingDisposables.delete(e)},this,this.disposables)}disposeOldKernel(e){let t=this.kernelsByNotebook.get(e);t&&(d.debug(`Disposing kernel associated with ${B(e.uri)}, isClosed=${e.isClosed}`),this.kernelsById.delete(t.kernel.id),this.pendingDisposables.add(t.kernel),t.kernel.dispose().catch(n=>d.warn("Failed to dispose old kernel",n)).finally(()=>this.pendingDisposables.delete(t.kernel)).catch(h)),this.kernelsByNotebook.delete(e)}handleServerRemoval(e){vi.workspace.notebookDocuments.forEach(t=>{let n=this.kernelsByNotebook.get(t);if(n){let i=n.options.metadata;(i.kind==="connectToLiveRemoteKernel"||i.kind==="startUsingRemoteKernelSpec")&&e.find(s=>s.id===i.serverProviderHandle.id&&s.handle===i.serverProviderHandle.handle)&&(this.kernelsByNotebook.delete(t),this.kernelsById.delete(n.kernel.id))}})}},q_=class{constructor(e,t){this.asyncDisposables=e;this.disposables=t;this.kernelsByUri=new Map;this.kernelsById=new Map;this.pendingDisposables=new Set;this._onDidRestartKernel=new vi.EventEmitter;this._onDidStartKernel=new vi.EventEmitter;this._onDidCreateKernel=new vi.EventEmitter;this._onDidDisposeKernel=new vi.EventEmitter;this._onKernelStatusChanged=new vi.EventEmitter;this.onKernelStatusChanged=this._onKernelStatusChanged.event;this.asyncDisposables.push(this),vi.workspace.onDidCloseNotebookDocument(n=>{d.debug(`Notebook document ${B(n.uri)} got closed`),this.disposeOldKernel(n.uri)},this,t),t.push(this._onDidDisposeKernel),t.push(this._onDidRestartKernel),t.push(this._onKernelStatusChanged),t.push(this._onDidStartKernel),t.push(this._onDidCreateKernel)}get kernels(){return Array.from(this.kernelsByUri.values()).map(e=>e.kernel)}get onDidDisposeKernel(){return this._onDidDisposeKernel.event}get onDidRestartKernel(){return this._onDidRestartKernel.event}get onDidStartKernel(){return this._onDidStartKernel.event}get onDidCreateKernel(){return this._onDidCreateKernel.event}get(e){return this.kernelsByUri.get(e.toString())?.kernel||this.kernelsById.get(e.toString())?.kernel}getInternal(e){return this.kernelsByUri.get(e.toString())}async dispose(){d.ci("Disposing all kernels from kernel provider");let e=Array.from(this.pendingDisposables.values());this.pendingDisposables.clear(),await Promise.all(e),await Promise.all(this.kernels.map(t=>t.dispose()))}storeKernel(e,t,n){this.kernelsByUri.set(e.toString(),{options:t,kernel:n}),this.kernelsById.set(n.id,{options:t,kernel:n}),this._onDidCreateKernel.fire(n)}deleteMappingIfKernelIsDisposed(e,t){t.onDisposed(()=>{this.get(e)===t&&(this.kernelsByUri.delete(e.toString()),this.kernelsById.delete(t.id),d.debug(`Kernel got disposed, hence there is no longer a kernel associated with ${B(e)}`)),this.pendingDisposables.delete(t)},this,this.disposables)}disposeOldKernel(e){let t=this.kernelsByUri.get(e.toString());t&&(d.ci(`Disposing kernel associated with ${B(e)}`),this.kernelsById.delete(t.kernel.id),this.pendingDisposables.add(t.kernel),t.kernel.dispose().catch(n=>d.warn("Failed to dispose old kernel",n)).finally(()=>this.pendingDisposables.delete(t.kernel)).catch(h)),this.kernelsByUri.delete(e.toString())}};var WF=P(To()),Nr=require("vscode");var VH=P(fD());var jF="KERNEL_INFO",tve=1e3*60*60*24*2;async function WH(r,e,t){let n=[],i={banner:"",help_links:[],implementation:"",implementation_version:"",language_info:{name:"",version:""},protocol_version:"",status:"ok"};if(!r.kernel)return;r.kernel?.info&&(n.push(r.kernel.info),r.kernel.info.then(a=>jH(t,e,a)).catch(h));let o=r.kernel.requestKernelInfo().then(a=>a?.content);if(n.push(o),o.then(a=>jH(t,e,a)).catch(h),e.kind==="connectToLiveRemoteKernel"){let a=rve(t,e);a?n.push(Promise.resolve(a)):n.push(Ei(5e3).then(()=>i))}let s=await Promise.race(n);return s===i?d.warn("Failed to Kernel info in a timely manner, defaulting to empty info!"):d.trace("Got Kernel info"),s}async function jH(r,e,t){if(!t||!Nt(e))return;let n=r.get(jF,[]).filter(i=>Date.now()-i.age<tve).filter(i=>i.id!==e.id);n.push({id:e.id,age:Date.now(),info:t}),await r.update(jF,n)}function rve(r,e){if(Nt(e))return r.get(jF,[]).find(t=>t.id===e.id)?.info}var J_=class extends On{constructor(e){super("kernelpromisetimeout",I.interruptingKernelFailed,e)}};var $_="e976ee50-99ed-4aba-9b6b-9dcd5634d07d:IPyWidgets:";function Q_(r){let e=typeof r=="string"?r:"";return typeof r!="string"&&"content"in r&&"code"in r.content&&typeof r.content.code=="string"&&(e=r.content.code),!e.includes($_)}function Y_(r){return r.status==="dead"||r.status==="terminating"&&!r.disposed&&!r.disposing||!r.disposed&&!r.disposing&&(r.session?.status=="unknown"||r.session?.kernel?.status=="unknown")&&(r.session.kernel?.isDisposed||r.session.isDisposed)}function BH(r){return r.status==="dead"||r.status==="terminating"&&!r.isDisposed||!r.isDisposed&&(r.status=="unknown"||r.kernel?.status=="unknown")&&(r.kernel?.isDisposed||r.isDisposed)}var H_=class{constructor(e,t,n,i,o,s,a,l,c){this.id=e;this.uri=t;this.resourceUri=n;this.kernelConnectionMetadata=i;this.sessionCreator=o;this.kernelSettings=s;this.startupCodeProviders=a;this._creator=l;this.workspaceMemento=c;this.disposables=[];this._onIPyWidgetVersionResolved=new Nr.EventEmitter;this._onDidKernelSocketChange=new Nr.EventEmitter;this._onStatusChanged=new Nr.EventEmitter;this._onRestarted=new Nr.EventEmitter;this._onStarted=new Nr.EventEmitter;this._onDisposed=new Nr.EventEmitter;this.hookedSessionForEvents=new WeakSet;this.hooks=new Map;this.startCancellation=new Nr.CancellationTokenSource;this.startupUI=new Ht(!0);this.disposables.push(this._onStatusChanged),this.disposables.push(this._onRestarted),this.disposables.push(this._onStarted),this.disposables.push(this._onDisposed),this.disposables.push(this._onIPyWidgetVersionResolved),this.disposables.push(this._onDidKernelSocketChange),io(this.resourceUri,{kernelConnection:this.kernelConnectionMetadata,actionSource:this.creator,disableUI:this.startupUI.disableUI}).catch(h),this.startupUI.onDidChangeDisableUI(()=>{this.startupUI.disableUI||io(this.resourceUri,{disableUI:!1}).catch(h)},this.disposables)}get ipywidgetsVersion(){return this._ipywidgetsVersion}get onIPyWidgetVersionResolved(){return this._onIPyWidgetVersionResolved.event}get onStatusChanged(){return this._onStatusChanged.event}get onRestarted(){return this._onRestarted.event}get onStarted(){return this._onStarted.event}get onDisposed(){return this._onDisposed.event}get creator(){return this._creator}get startedAtLeastOnce(){return this._startedAtLeastOnce}get info(){return this._info}get status(){return this._jupyterSessionPromise&&!this._session?"starting":this._session?.status??(this.isKernelDead?"dead":"unknown")}get disposed(){return this._disposed===!0||this._session?.isDisposed===!0}get disposing(){return this._disposing===!0}get onDidKernelSocketChange(){return this._onDidKernelSocketChange.event}get session(){return this._session}get restarting(){return this._restartPromise||Promise.resolve()}addHook(e,t,n,i){let o=this.hooks.get(e)||new Set;this.hooks.set(e,o),t=n?t.bind(n):t,o.add(t);let s={dispose:()=>{o.delete(t)}};return i&&i.push(s),s}async start(e){return this.startCancellation.token.isCancellationRequested&&(this.startCancellation.dispose(),this.startCancellation=new Nr.CancellationTokenSource),this.startJupyterSession(e)}async interrupt(){let e=Promise.all(Array.from(this.hooks.get("willInterrupt")||new Set).map(n=>n()));d.info(`Interrupt requested ${B(this.resourceUri||this.uri)}`);let t;try{let n=this._jupyterSessionPromise?await this._jupyterSessionPromise.catch(()=>{}):void 0;d.info("Interrupt kernel execution"),n?(t=this._interruptPromise?await this._interruptPromise:await(this._interruptPromise=this.interruptExecution(n,e)),this._interruptPromise=void 0):(d.info("No kernel session to interrupt"),this._interruptPromise=void 0,t="success")}finally{await Promise.all(Array.from(this.hooks.get("interruptCompleted")||new Set).map(n=>n())).catch(h)}if(d.info(`Interrupt requested & sent for ${B(this.uri)} in notebookEditor.`),t==="timeout"){let n=I.restartKernelAfterInterruptMessage(ct(this.kernelConnectionMetadata)),i=I.restartKernelMessageYes;await Nr.window.showInformationMessage(n,{modal:!0},i)===i&&await this.restart()}}async dispose(){if(d.info(`Dispose Kernel '${B(this.uri)}' associated with '${B(this.resourceUri)}'`),this._disposing=!0,this.disposingPromise)return this.disposingPromise;this._ignoreJupyterSessionDisposedErrors=!0,this.startCancellation.cancel();let e=async()=>{let t=[];t.push(Promise.all(Array.from(this.hooks.get("willCancel")||new Set).map(n=>n())).then(h).catch(h)),this._session=this._session?this._session:this._jupyterSessionPromise?await this._jupyterSessionPromise.catch(()=>{}):void 0,this._jupyterSessionPromise=void 0,this._session&&(t.push(Rs(this._session,this.disposables)),this._session=void 0),this._disposed=!0,this._onDisposed.fire(),this._onStatusChanged.fire("dead");try{await Promise.all(t)}finally{this.startCancellation.dispose(),z(this.disposables)}};this.disposingPromise=e(),await this.disposingPromise}async restart(){try{let e=Zi(this.resourceUri);d.info(`Restart requested ${B(this.uri)}`),await Promise.all(Array.from(this.hooks.get("willRestart")||new Set).map(n=>n(this._jupyterSessionPromise))),this.startCancellation.cancel(),this.startCancellation.dispose();let t=new We;try{let n=this._jupyterSessionPromise?await this._jupyterSessionPromise.catch(()=>{}):void 0;n?(this._restartPromise||(this._restartPromise=n.restart(),this._restartPromise.finally(()=>this._restartPromise=void 0).catch(h)),await this._restartPromise,this.startCancellation=new Nr.CancellationTokenSource):await this.start(new Ht(!1)),_t(this.resourceUri,"DATASCIENCE.NOTEBOOK_RESTART",{duration:t.elapsedTime},{resourceType:e})}catch(n){d.error(`Restart failed ${B(this.uri)}`,n),this._ignoreJupyterSessionDisposedErrors=!0;let i=this._session;throw this._session=void 0,this._jupyterSessionPromise=void 0,_t(this.resourceUri,"DATASCIENCE.NOTEBOOK_RESTART",{duration:t.elapsedTime},void 0,n),i&&await Rs(i,this.disposables),this._ignoreJupyterSessionDisposedErrors=!1,n}await this.initializeAfterStart(this._session),this._onRestarted.fire()}catch(e){throw d.error(`Failed to restart kernel ${B(this.uri)}`,e),e}finally{Promise.all(Array.from(this.hooks.get("restartCompleted")||new Set).map(e=>e())).catch(h)}}async startJupyterSession(e=new Ht(!1)){if(this._startedAtLeastOnce=!0,e.disableUI||(this.startupUI.disableUI=!1),e.onDidChangeDisableUI(()=>{!e.disableUI&&this.startupUI.disableUI&&(this.startupUI.disableUI=!1)},this.disposables),this.startupUI.disableUI&&this.startupUI.onDidChangeDisableUI(()=>{this.disposing||this.disposed||this.startupUI.disableUI||Qs(this.resourceUri,this.kernelConnectionMetadata).catch(h)},this,this.disposables),this.disposing)throw new Nr.CancellationError;if(En.throwIfCanceled(this.startCancellation.token),!this._jupyterSessionPromise){let t=new We;this._jupyterSessionPromise=this.createJupyterSession();try{let n=await this._jupyterSessionPromise;return _t(this.resourceUri,"DS_INTERNAL.PERCEIVED_JUPYTER_STARTUP_NOTEBOOK",{duration:t.elapsedTime}),n}catch(n){throw d.ci(`Failed to create Jupyter Session in Kernel.startNotebook for ${B(this.uri)}`),this.startCancellation.cancel(),this._jupyterSessionPromise=void 0,n}}return this._jupyterSessionPromise}async interruptExecution(e,t){let n=oe(),i=new We,o=[],s=c=>{(c==="restarting"||c==="autorestarting")&&(d.warn("Kernel restarting during interrupt"),n.resolve(!0))},a=(c,u)=>s(u);return e.statusChanged.connect(a),o.push(new Nr.Disposable(()=>ai(()=>e.statusChanged.disconnect(a)))),e&&e.kernel&&(d.info(`Interrupting kernel: ${e.kernel.name}`),await wh(this.kernelSettings.interruptTimeout,new J_(this.kernelConnectionMetadata),e.kernel.interrupt()).catch(c=>{d.warn(`Error during interrupt: ${c}`),n.resolve(!0)})),(async()=>{let c=oe();this.status==="busy"&&(this.onDisposed(()=>c.resolve("dead"),this,o),this.onStatusChanged(()=>this.status==="dead"?c.resolve("dead"):void 0,this,o));try{return await br(this.kernelSettings.interruptTimeout,"timeout",t.then(()=>"success"),n.promise.then(()=>"restart"),c.promise)}catch(u){if(n.completed)return"restart";throw _t(this.resourceUri,"DATASCIENCE.NOTEBOOK_INTERRUPT",{duration:i.elapsedTime},void 0,u),u}finally{z(o)}})().then(c=>(_t(this.resourceUri,"DATASCIENCE.NOTEBOOK_INTERRUPT",{duration:i.elapsedTime},{result:c}),c))}async createJupyterSession(){let e=Nr.workspace.notebookDocuments.find(i=>i.uri.toString()===this.uri.toString()),t=e?Nn(e)?.jupyterSessionTelemetry():void 0;if(await io(this.resourceUri,{kernelConnection:this.kernelConnectionMetadata,actionSource:this.creator,userExecutedCell:!this.startupUI.disableUI}),t?.stop(),this.disposing)throw new Nr.CancellationError;En.throwIfCanceled(this.startCancellation.token);let n=[];try{d.info(`Starting Kernel ${ive(this,this.startupUI)}`),this.createProgressIndicator(n),this.isKernelDead=!1,this._onStatusChanged.fire("starting");let i=await this.sessionCreator.create({resource:this.resourceUri,ui:this.startupUI,kernelConnection:this.kernelConnectionMetadata,token:this.startCancellation.token,creator:this.creator});if(this.disposing)throw new Nr.CancellationError;if(En.throwIfCanceled(this.startCancellation.token),await this.initializeAfterStart(i),this.disposing)throw new Nr.CancellationError;return this.sendKernelStartedTelemetry(),this._session=i,this._onStarted.fire(),d.info("Kernel successfully started"),i}catch(i){if(this.startupUI.disableUI?d.trace(`failed to create IJupyterKernelConnectionSession in kernel, UI Disabled = ${this.startupUI.disableUI}`,i):!this.startCancellation.token&&!pr(i)&&d.error(`failed to create IJupyterKernelConnectionSession in kernel, UI Disabled = ${this.startupUI.disableUI}`,i),En.throwIfCanceled(this.startCancellation.token),i instanceof Ps)throw i;let o=I.sessionStartFailedWithKernel(ct(this.kernelConnectionMetadata));throw cn.from(o+" "+("message"in i?i.message:i.toString()),i)}finally{z(n)}}sendKernelStartedTelemetry(){this.uiWasDisabledWhenKernelStartupTelemetryWasLastSent&&this.uiWasDisabledWhenKernelStartupTelemetryWasLastSent===this.startupUI.disableUI||this.startTelemetrySent&&!this.startupUI.disableUI||(this.uiWasDisabledWhenKernelStartupTelemetryWasLastSent=this.startupUI.disableUI===!0,this.startTelemetrySent=!0,_t(this.resourceUri,"DATASCIENCE.NOTEBOOK_START",void 0,{disableUI:this.startupUI.disableUI}))}createProgressIndicator(e){let t=dt.createProgressReporter(this.resourceUri,I.connectingToKernel(ct(this.kernelConnectionMetadata)),this.startupUI.disableUI);e.push(t),this.startupUI.disableUI&&this.startupUI.onDidChangeDisableUI(()=>{this.disposing||this.disposed||this.startupUI.disableUI||t.show&&t.show()},this,e)}async initializeAfterStart(e){let t=Nr.workspace.notebookDocuments.find(o=>o.uri.toString()===this.uri.toString()),n=Nn(t),i=t?n?.postKernelStartup():void 0;try{if(await Promise.all(Array.from(this.hooks.get("didStart")||new Set).map(a=>a(e,this.startCancellation.token).catch(h))),d.trace(`Started running kernel initialization for ${B(this.uri)}`),!e){d.trace("Not running kernel initialization");return}if(!this.hookedSessionForEvents.has(e)){this.hookedSessionForEvents.add(e),e.onDidKernelSocketChange(l=>this._onDidKernelSocketChange.fire(l)),e.onDidDispose(()=>{if(d.ci(`Kernel got disposed as a result of session.onDisposed (1) ${B(this.resourceUri||this.uri)}`),!this._ignoreJupyterSessionDisposedErrors){d.info(`Kernel got disposed as a result of session.onDisposed ${B(this.resourceUri||this.uri)} & _ignoreJupyterSessionDisposedErrors = false.`);let l=this._session===e;this._jupyterSessionPromise=void 0,this._session=void 0,l&&(this.isKernelDead=!0,this._onStatusChanged.fire("dead"))}});let a=(l,c)=>this._onStatusChanged.fire(c);e.statusChanged.connect(a),this.disposables.push(new Nr.Disposable(()=>ai(()=>e.statusChanged.disconnect(a))))}if(e.kernel?.registerCommTarget(qe.DefaultCommTarget,h),this.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel")this.determineVersionOfIPyWidgets(e).catch(a=>d.error("Failed to determine IPyWidget version",a)),this.gatherInternalStartupCode().then(a=>this.executeSilently(e,a,{traceErrors:!0,traceErrorsMessage:"Error executing jupyter extension internal startup code"})).catch(a=>d.error("Failed to execute internal startup code",a));else{await this.determineVersionOfIPyWidgets(e);let a=await this.gatherInternalStartupCode();await this.executeSilently(e,a,{traceErrors:!0,traceErrorsMessage:"Error executing jupyter extension internal startup code"}),await this.executeSilently(e,this.getUserStartupCommands(),{traceErrors:!1})}i?.stop();let o=n?.kernelInfo();try{d.debug("Requesting Kernel info"),this._info=await WH(e,this.kernelConnectionMetadata,this.workspaceMemento)}catch(a){d.warn("Failed to request KernelInfo",a)}o?.stop();let s=n?.kernelIdle();this.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"&&(d.trace("End running kernel initialization, now waiting for idle"),await e.waitForIdle(this.kernelSettings.launchTimeout,this.startCancellation.token),d.trace("End running kernel initialization, session is idle")),s?.stop()}finally{i?.stop()}}async determineVersionOfIPyWidgets(e){if(!vt(this.kernelConnectionMetadata)){this._ipywidgetsVersion==OS,this._onIPyWidgetVersionResolved.fire(OS);return}let t=async()=>{let n=VH.default`
|
||
try:
|
||
import ipywidgets as _VSCODE_ipywidgets
|
||
print("${$_}" + _VSCODE_ipywidgets.__version__)
|
||
del _VSCODE_ipywidgets
|
||
except:
|
||
pass
|
||
`,i=await this.executeSilently(e,[n]).catch(o=>d.error("Failed to determine version of IPyWidgets",o));if(Array.isArray(i)){let o=i.some(l=>(l.text||"")?.toString().includes(`${$_}8.`)),s=i.some(l=>(l.text||"")?.toString().includes(`${$_}7.`)),a=this._ipywidgetsVersion=s?7:o?8:void 0;d.trace(`Determined IPyWidgets Version as ${a}`),this._ipywidgetsVersion==a,this._onIPyWidgetVersionResolved.fire(a)}else d.warn("Failed to determine IPyKernel Version",JSON.stringify(i))};if(await t(),!this._ipywidgetsVersion&&this.session?.kernel){let n=(i,o)=>{if(o.direction==="send")return;let s=o.msg;s.content&&"data"in s.content&&s.content.data&&(s.content.data[Hi]||"target_name"in s.content&&s.content.target_name===qe.DefaultCommTarget)&&(this._ipywidgetsVersion||(t().catch(h),this.session?.kernel&&this.session.kernel.anyMessage.disconnect(n,this)))};this.session.kernel.anyMessage.connect(n,this)}}async gatherInternalStartupCode(){let e=[],t=await Promise.all(this.startupCodeProviders.sort((n,i)=>i.priority-n.priority).map(n=>n.getCode(this)));for(let n of t)e.push(...n);if(vt(this.kernelConnectionMetadata)&&this.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"){let n=De(this.resourceUri);n&&e.push(`__vsc_ipynb_file__ = "${n.replace(/\\/g,"\\\\")}"`),this.kernelSettings.enableExtendedPythonKernelCompletions||e.push(bh.DisableJedi),e.push(...nve(this.getMatplotLibInitializeCode(),"Failed to initialize matplotlib startup code. Matplotlib might be missing."))}return e}getMatplotLibInitializeCode(){let e=[];if(this.kernelSettings.themeMatplotlibPlots){d.ci(`Initialize config for plots for ${B(this.resourceUri||this.uri)}`);let t=bh.MatplotLibInit;d.trace(`Initialize matplotlib for ${B(this.resourceUri||this.uri)}`),e.push(...Fe(t,{trim:!1}));let n=Nr.window.activeColorTheme.kind===Nr.ColorThemeKind.Dark;e.push(n?"matplotlib.style.use('dark_background')":`matplotlib.rcParams.update(${qe.MatplotLibDefaultParams})`)}return e}getUserStartupCommands(){let e=this.kernelSettings.runStartupCommands;if(Array.isArray(e)&&(e=e.join(`
|
||
`)),e){let t=e.replace(/\\n/g,`
|
||
`);return Fe(t,{trim:!1})}return[]}async executeSilently(e,t,n){if(t.join("").trim().length!==0){if(!e.kernel){d.trace(`Not executing startup as there is no session, code: ${t}`);return}return bn(e.kernel,t.join(`
|
||
`),n)}}},G_=class extends H_{get creator(){return"3rdPartyExtension"}constructor(e,t,n,i,o,s,a){super(`3rdPartyKernel_${(0,WF.default)()}`,e,t,n,i,o,s,"3rdPartyExtension",a)}},z_=class extends H_{constructor(t,n,i,o,s,a,l,c){super((0,WF.default)(),n.uri,t,i,o,s,l,"jupyterExtension",c);this.notebook=n;this.controller=a}get creator(){return"jupyterExtension"}};function nve(r,e){return!r||r.length===0||(r=r.map(t=>` ${t}`),r.unshift("try:"),r.push("except:",` print('${e}')`)),r}function X_(r){if(r.length>0){let e=r[0].data;if(e&&e.hasOwnProperty("text/plain"))return Ts(e["text/plain"]);if(r[0].output_type==="stream"){let t=r[0];return Ts(t.text)}}}function ive(r,e){let t=r.kernelConnectionMetadata.interpreter,n=[];if(t){n.push(`Python Path: ${B(t.uri)}`),n.push(t?Be(t):"");let i=Yi(t);i&&n.push(`${i.major}.${i.minor}.${i.micro}`)}else(r.kernelConnectionMetadata.kind==="startUsingLocalKernelSpec"||r.kernelConnectionMetadata.kind==="startUsingRemoteKernelSpec")&&n.push(r.kernelConnectionMetadata.kernelSpec.display_name);return`(${n.filter(i=>i).join(", ")}) for '${B(r.uri)}' (disableUI=${e.disableUI})`}function VF(r,e){return{get enableExtendedPythonKernelCompletions(){return r.getSettings(e).enableExtendedPythonKernelCompletions},get interruptTimeout(){return r.getSettings(e).jupyterInterruptTimeout},get launchTimeout(){return r.getSettings(e).jupyterLaunchTimeout},get runStartupCommands(){return r.getSettings(e).runStartupCommands},get themeMatplotlibPlots(){return r.getSettings(e).themeMatplotlibPlots}}}var vf=require("vscode");var qF=require("vscode");var BF=P($N()),kr=require("vscode");var Uy=new WeakMap;function hu(r){if(r.parent_header&&"msg_id"in r.parent_header)return r.parent_header.msg_id}var fd=class fd{constructor(e,t,n,i,o,s,a,l){this.cell=e;this.controller=t;this.context=n;this.formatters=i;this.kernel=o;this.request=s;this._onErrorHandlingIOPubMessage=new kr.EventEmitter;this.onErrorHandlingExecuteRequestIOPubMessage=this._onErrorHandlingIOPubMessage.event;this.outputsAreSpecificToAWidget=[];this.commIdsMappedToParentWidgetModel=new Map;this.disposables=[];this.prompts=new Set;this.ownedCommIds=new Set;this.commIdsMappedToWidgetOutputModels=new Set;this.ownedRequestMsgIds=new Set;this._completed=oe();this.gotIdleIOPubStatus=!1;this.gotShellReply=!1;this.streamsReAttachedToExecutingCell=!1;this._completed.promise.catch(h),this.executeRequestMessageId=l,this.ownedRequestMsgIds.add(l),kr.workspace.onDidChangeNotebookDocument(c=>{if(!Dt(c.notebook))return;let u=c.cellChanges.find(({cell:p})=>p===this.cell);u&&u.outputs?.length===0&&(this.clearLastUsedStreamOutput(),this.cellHasErrorsInOutput=!1)},this,this.disposables),this.execution=a,this.kernel.anyMessage.connect(this.onKernelAnyMessage,this),this.kernel.iopubMessage.connect(this.onKernelIOPubMessage,this),s&&(s.onIOPub=()=>{this.cell.document.isClosed&&!this.completedExecution&&s.dispose()},s.onReply=c=>{if(this.cell.document.isClosed){s.dispose();return}this.handleReply(c)},s.onStdin=this.handleInputRequest.bind(this),s.done.finally(()=>{this.completedExecution=!0,this.endCellExecution()}).catch(h))}static{this.modelIdsOwnedByCells=new WeakMap}get hasErrorOutput(){return this.cellHasErrorsInOutput===!0}static{this.outputsOwnedByWidgetModel=new Map}get completed(){return this._completed.promise}dispose(){this.disposed||(this.disposed=!0,gt(this.cell,"Execution Message Handler disposed"),z(this.disposables),this.prompts.forEach(e=>e.dispose()),this.prompts.clear(),this.request&&this.clearLastUsedStreamOutput(),this.execution=void 0,this.kernel.anyMessage.disconnect(this.onKernelAnyMessage,this),this.kernel.iopubMessage.disconnect(this.onKernelIOPubMessage,this),this._onErrorHandlingIOPubMessage.dispose())}endCellExecution(){this.prompts.forEach(e=>e.dispose()),this.prompts.clear(),this.request&&this.clearLastUsedStreamOutput(),this.execution=void 0,this._completed.resolve()}onKernelAnyMessage(e,{direction:t,msg:n}){if(this.cell.document.isClosed)return this.endCellExecution();let i=require("@jupyterlab/services");if(!this.request&&t==="recv"){let o=hu(n);i.KernelMessage.isStatusMsg(n)&&n.content.execution_state==="idle"&&o===this.executeRequestMessageId&&(this.gotIdleIOPubStatus=!0),n.channel==="shell"&&o===this.executeRequestMessageId&&(this.gotShellReply=!0);let s=i.KernelMessage.isStatusMsg(n)&&n.content.execution_state!=="idle"&&o!==this.executeRequestMessageId;typeof n.parent_header=="object"&&n.parent_header&&"msg_type"in n.parent_header&&n.parent_header.msg_type;let a=o?o!==this.executeRequestMessageId&&!s:!1,l=typeof n.parent_header=="object"&&n.parent_header&&"msg_type"in n.parent_header&&n.parent_header.msg_type==="interrupt_request",c=this.gotIdleIOPubStatus&&this.gotShellReply,u=["kernel_info_reply","execute_input","execute_reply"],p="msg_type"in n&&typeof n.msg_type=="string"&&u.includes(n.msg_type);if(!this.completedExecution&&c)return this.completedExecution=!0,this.endAbnormallyTimeout&&clearTimeout(this.endAbnormallyTimeout),this.endCellExecution();if(!this.completedExecution&&(p||a)){this.endAbnormallyTimeout&&clearTimeout(this.endAbnormallyTimeout),this.endAbnormallyTimeout=setTimeout(()=>(this.completedExecution=!0,this.endAbnormallyTimeout=void 0,this.endCellExecution()),l?1e3:100),this.disposables.push(new kr.Disposable(()=>{clearTimeout(this.endAbnormallyTimeout),this.endAbnormallyTimeout=void 0}));return}}t!=="send"||!this.completedExecution||i.KernelMessage.isCommMsgMsg(n)&&this.ownedCommIds.has(n.content.comm_id)&&this.ownedRequestMsgIds.add(n.header.msg_id)}onKernelIOPubMessage(e,t){if(this.cell.document.isClosed)return this.endCellExecution();if(!(!t.parent_header||!("msg_id"in t.parent_header)||!this.ownedRequestMsgIds.has(t.parent_header.msg_id)||t.channel!=="iopub"))try{this.handleIOPub(t)}catch(n){d.error("Failed to handle iopub message as a result of some comm message",t,n),!this.completedExecution&&!this.cell.document.isClosed&&this._onErrorHandlingIOPubMessage.fire(n)}}clearLastUsedStreamOutput(){this.lastUsedStreamOutput=void 0}createTemporaryTask(){if(this.cell.document.isClosed)return;let e=Uy.get(this.cell.notebook);return e||(this.previousResultsToRestore={...this.cell.executionSummary||{}},this.temporaryExecution=Mi.getOrCreate(this.cell,this.controller),this.temporaryExecution?.start(),this.previousResultsToRestore?.executionOrder&&this.temporaryExecution&&(this.temporaryExecution.executionOrder=this.previousResultsToRestore.executionOrder),this.temporaryExecution)}endTemporaryTask(){this.previousResultsToRestore?.executionOrder&&this.execution&&(this.execution.executionOrder=this.previousResultsToRestore.executionOrder),this.previousResultsToRestore&&this.temporaryExecution?(this.previousResultsToRestore.executionOrder&&(this.temporaryExecution.executionOrder=this.previousResultsToRestore.executionOrder),this.temporaryExecution.end(this.previousResultsToRestore.success,this.previousResultsToRestore.timing?.endTime)):this.temporaryExecution?.end(void 0),this.previousResultsToRestore=void 0,this.temporaryExecution=void 0}handleIOPub(e){this.startTime||(this.startTime=new Date().getTime(),this.execution?.start(this.startTime),d.debug(`Kernel acknowledged execution of cell ${this.cell.index} @ ${this.startTime}`));let t=require("@jupyterlab/services");if(t.KernelMessage.isCommOpenMsg(e))this.handleCommOpen(e);else if(t.KernelMessage.isExecuteResultMsg(e))this.handleExecuteResult(e);else if(t.KernelMessage.isExecuteInputMsg(e))this.handleExecuteInput(e);else if(t.KernelMessage.isStatusMsg(e)){let n=e;this.handleStatusMessage(n)}else t.KernelMessage.isStreamMsg(e)?this.handleStreamMessage(e):t.KernelMessage.isDisplayDataMsg(e)?this.handleDisplayData(e):t.KernelMessage.isUpdateDisplayDataMsg(e)?this.handleUpdateDisplayDataMessage(e):t.KernelMessage.isClearOutputMsg(e)?this.handleClearOutput(e):t.KernelMessage.isErrorMsg(e)?this.handleError(e):t.KernelMessage.isCommOpenMsg(e)||(t.KernelMessage.isCommMsgMsg(e)?this.handleCommMsg(e):t.KernelMessage.isCommCloseMsg(e)||d.warn(`Unknown message ${e.header.msg_type} : hasData=${"data"in e.content}`));"execution_count"in e.content&&typeof e.content.execution_count=="number"&&this.execution&&(this.execution.executionOrder=e.content.execution_count)}handleCommOpen(e){this.ownedCommIds.add(e.content.comm_id);let t=e.content.data?.state||void 0;e.content.target_name===qe.DefaultCommTarget&&t&&t._model_module==="@jupyter-widgets/output"&&this.commIdsMappedToWidgetOutputModels.add(e.content.comm_id)}handleCommMsg(e){let t=e.content.data;if(!(!t||t.method!=="update"||typeof t.state!="object")){if("msg_id"in t.state&&typeof t.state.msg_id=="string"){let n="msg_id"in e.parent_header?e.parent_header:void 0;(this.ownedRequestMsgIds.has(e.content.comm_id)||n&&this.ownedRequestMsgIds.has(n.msg_id))&&(t.state.msg_id?this.outputsAreSpecificToAWidget.push({handlingCommId:e.content.comm_id,msgIdsToSwallow:t.state.msg_id}):this.outputsAreSpecificToAWidget.length&&this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].handlingCommId===e.content.comm_id&&this.outputsAreSpecificToAWidget.pop())}else if("children"in t.state&&Array.isArray(t.state.children)&&this.ownedCommIds.has(e.content.comm_id)){let n="IPY_MODEL_";t.state.children.forEach(i=>{if(typeof i!="string")return d.warn("Came across a comm update message a child that isn't a string",i);if(!i.startsWith(n))return d.warn(`Came across a comm update message a child that start start with ${n}`,i);let o=i.substring(n.length);this.ownedCommIds.add(o),this.commIdsMappedToParentWidgetModel.set(o,e.content.comm_id)})}}}clearOutputIfNecessary(e){return this.clearOutputOnNextUpdateToOutput?(gt(this.cell,"Clear cell output"),this.clearLastUsedStreamOutput(),e?.clearOutput().then(h,h),this.clearOutputOnNextUpdateToOutput=!1,{previousValueOfClearOutputOnNextUpdateToOutput:!0}):{previousValueOfClearOutputOnNextUpdateToOutput:!1}}addToCellData(e,t){if(e.data&&typeof e.data=="object"&&Hi in e.data){let l=e.data[Hi];if(l&&this.context.extensionMode===kr.ExtensionMode.Test&&(l._vsc_test_cellIndex=this.cell.index),l&&"model_id"in l){let c=fd.modelIdsOwnedByCells.get(this.cell)||new Set;c.add(l.model_id),fd.modelIdsOwnedByCells.set(this.cell,c)}}let n=bo(e),i="transient"in e&&typeof e.transient=="object"&&e.transient&&"display_id"in e.transient&&typeof e.transient?.display_id=="string"?e.transient?.display_id:void 0;if(this.cell.document.isClosed)return;gt(this.cell,()=>`Update output with mimes ${n.items.map(l=>l.mime).toString()}`);let o=this.execution||this.createTemporaryTask();this.clearOutputIfNecessary(o),i&&tn.trackOutputByDisplayId(this.cell,i,n,n.items),this.clearLastUsedStreamOutput(),gt(this.cell,"Append output in addToCellData");let s=!0,a=hu(t);(this.outputsAreSpecificToAWidget.length&&this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].msgIdsToSwallow===a&&n.items.every(l=>this.canMimeTypeBeRenderedByWidgetManager(l))||this.outputsAreSpecificToAWidget.length&&this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].msgIdsToSwallow===a&&this.updateJupyterOutputWidgetWithOutput({commId:this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].handlingCommId,outputToAppend:n},o)?.outputAdded)&&(s=!1),s&&o?.appendOutput([n]).then(h,h),this.endTemporaryTask()}canMimeTypeBeRenderedByWidgetManager(e){let t=e.mime;if(t=="application/vnd.code.notebook.stderr"||t=="application/vnd.code.notebook.stdout"||t=="application/vnd.code.notebook.error")return!0;if(t===Hi){let n=JSON.parse(new TextDecoder().decode(e.data));return!(typeof n.model_id=="string"&&this.commIdsMappedToWidgetOutputModels.has(n.model_id))}return!t.startsWith("application/vnd")}updateJupyterOutputWidgetWithOutput(e,t){let n=this.outputsAreSpecificToAWidget.length?this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].handlingCommId:void 0,i="commId"in e?e.commId:n;if(!i)return;let o="outputToAppend"in e?e.outputToAppend:void 0,s=this.commIdsMappedToParentWidgetModel.get(i)||i,a=this.cell.notebook.getCells().find(C=>fd.modelIdsOwnedByCells.get(C)?.has(s));if(!a){d.warn(`Unable to find a cell that owns the model ${s}`);return}let l=a.outputs.find(C=>C.items.find(E=>{if(E.mime!==Hi)return!1;try{return JSON.parse(new TextDecoder().decode(E.data)).model_id===s}catch(R){d.warn("Failed to deserialize the widget data",R)}return!1}));if(!l)return;let c=fd.outputsOwnedByWidgetModel.get(s)||new Set,p=("clearOutput"in e?e.clearOutput:!1)||(this.outputsAreSpecificToAWidget.length?this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].clearOutputOnNextUpdateToOutput===!0:!1);this.outputsAreSpecificToAWidget.length&&(this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].clearOutputOnNextUpdateToOutput=!1);let f=a.outputs.slice().filter(C=>p?!c.has(C.id):!0),g=f.slice(0,f.indexOf(l)+1),v=f.slice(f.indexOf(l)+1);fd.outputsOwnedByWidgetModel.set(s,c),o&&c.add(o.id);let b=o?g.concat(o).concat(v):g.concat(v);return v.length===0&&o?t?.appendOutput(o,a).then(h,h):p&&!o&&v.length===0||t?.replaceOutput(b,a).then(h,h),{outputAdded:!0}}async handleInputRequest(e){if(e.content&&"prompt"in e.content){let t=new kr.CancellationTokenSource;this.prompts.add(t);let n=e.content.password!==null&&e.content.password;await kr.window.showInputBox({prompt:e.content.prompt?e.content.prompt.toString():"",ignoreFocusOut:!0,password:n},t.token).then(i=>{this.kernel.sendInputReply({value:i||"",status:"ok"})},h),this.prompts.delete(t)}}handleExecuteResult(e){this.addToCellData({output_type:"execute_result",data:e.content.data,metadata:e.content.metadata,transient:e.content.transient,execution_count:e.content.execution_count},e)}handleExecuteReply(e){let t=e.content;t.payload&&t.payload.forEach(n=>{n.source&&n.source==="set_next_input"&&"text"in n&&"replace"in n&&this.handleSetNextInput(n),n.data&&n.data.hasOwnProperty("text/plain")&&this.addToCellData({output_type:"stream",text:n.data["text/plain"].toString(),name:"stdout",metadata:{},execution_count:t.execution_count},e)})}handleSetNextInput(e){let t=new kr.WorkspaceEdit;if(e.replace)t.replace(this.cell.document.uri,new kr.Range(this.cell.document.lineAt(0).range.start,this.cell.document.lineAt(this.cell.document.lineCount-1).range.end),e.text);else{gt(this.cell,"Create new cell after current");let n=new kr.NotebookCellData(kr.NotebookCellKind.Code,e.text,this.cell.document.languageId);n.outputs=[],n.metadata={};let i=kr.NotebookEdit.insertCells(this.cell.index+1,[n]);t.set(this.cell.notebook.uri,[i])}kr.workspace.applyEdit(t).then(h,h)}handleExecuteInput(e){e.content.execution_count&&this.execution&&(this.execution.executionOrder=e.content.execution_count)}handleStatusMessage(e){gt(this.cell,`Kernel switching to ${e.content.execution_state}`)}handleStreamMessage(e){if(hu(e)&&this.outputsAreSpecificToAWidget.length&&this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].msgIdsToSwallow==hu(e))return;gt(this.cell,`Update streamed output, new output '${e.content.text.substring(0,100)}'`);let t=this.execution||this.createTemporaryTask(),n=e.content.name==="stdout"?kr.NotebookCellOutputItem.stdout("").mime:kr.NotebookCellOutputItem.stderr("").mime;!this.request&&!this.streamsReAttachedToExecutingCell&&!this.lastUsedStreamOutput&&this.cell.outputs.length&&this.cell.outputs[this.cell.outputs.length-1].items.length>=1&&this.cell.outputs[this.cell.outputs.length-1].items.every(o=>o.mime===n)&&(this.lastUsedStreamOutput={output:this.cell.outputs[0],stream:e.content.name}),this.streamsReAttachedToExecutingCell=!0;let{previousValueOfClearOutputOnNextUpdateToOutput:i}=this.clearOutputIfNecessary(t);if(this.lastUsedStreamOutput?.stream===e.content.name){let o=bo({output_type:"stream",name:e.content.name,text:e.content.text});gt(this.cell,`Append output items '${e.content.text.substring(0,100)}`),t?.appendOutputItems(o.items,this.lastUsedStreamOutput.output).then(h,h)}else if(i){let o=Ts(e.content.text),s=bo({output_type:"stream",name:e.content.name,text:o});this.lastUsedStreamOutput={output:s,stream:e.content.name},gt(this.cell,`Replace output with '${o.substring(0,100)}'`),t?.replaceOutput([s]).then(h,h)}else{let o=r9(Ts(e.content.text)),s=bo({output_type:"stream",name:e.content.name,text:o});this.lastUsedStreamOutput={output:s,stream:e.content.name},gt(this.cell,`Append new output '${o.substring(0,100)}'`),t?.appendOutput([s]).then(h,h)}this.endTemporaryTask()}handleDisplayData(e){let t={output_type:"display_data",data:Ix(e.content.data),metadata:e.content.metadata,transient:e.content.transient};this.addToCellData(t,e)}handleClearOutput(e){if(this.outputsAreSpecificToAWidget.length&&this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].msgIdsToSwallow===hu(e)){if(e.content.wait)this.outputsAreSpecificToAWidget.length&&(this.outputsAreSpecificToAWidget[this.outputsAreSpecificToAWidget.length-1].clearOutputOnNextUpdateToOutput=!0);else{let t=this.execution||this.createTemporaryTask();this.updateJupyterOutputWidgetWithOutput({clearOutput:!0},t),this.endTemporaryTask()}return}if(e.content.wait)this.clearOutputOnNextUpdateToOutput=!0;else{let t=this.execution||this.createTemporaryTask();this.clearLastUsedStreamOutput(),t?.clearOutput().then(h,h),this.endTemporaryTask()}}handleError(e){let t=e.content.traceback;d.ci(`Traceback for error ${t}`),this.formatters.forEach(i=>{t=i.format(this.cell,t)}),d.ci(`Traceback for error after formatting ${t}`);let n={output_type:"error",ename:e.content.ename,evalue:e.content.evalue,traceback:t};if(this.cell.notebook.notebookType!=="interactive"){let i=Mi.get(this.cell);i&&e.content.ename!=="KeyboardInterrupt"&&(i.errorInfo={message:`${e.content.ename}: ${e.content.evalue}`,location:W9(e.content.traceback,this.cell),uri:this.cell.document.uri,stack:e.content.traceback.join(`
|
||
`)})}this.addToCellData(n,e),this.cellHasErrorsInOutput=!0}handleReply(e){require("@jupyterlab/services").KernelMessage.isExecuteReplyMsg(e)&&(this.handleExecuteReply(e),"execution_count"in e.content&&typeof e.content.execution_count=="number"&&this.execution&&(this.execution.executionOrder=e.content.execution_count))}handleUpdateDisplayDataMessage(e){let t=e.content.transient.display_id;if(!t){d.warn("Update display data message received, but no display id",e.content);return}let n=tn.getMappedOutput(this.cell.notebook,t);if(!n){d.trace("Update display data message received, but no output found to update",e.content);return}if(n.cell.document.isClosed){d.warn("Update display data message received, but output cell is closed",e.content);return}let i=zN(new kr.NotebookCellOutput(n.outputItems,n.outputContainer.metadata)),o=bo({...i,data:e.content.data,metadata:e.content.metadata});if(n.outputItems.length===0&&o.items.length===0){d.trace("Update display data message received, but no output to update",e.content);return}let s=!1;if(n.outputItems.length===o.items.length){let l=!0;if((0,BF.default)(n.outputContainer.metadata||{},o.metadata||{})||(s=!0,l=!1),l){for(let c=0;c<n.outputItems.length;c++)if(!(0,BF.default)(n.outputItems[c],o.items[c])){l=!1;break}}if(l){d.trace("Update display data message received, but no output to update (data is the same)",e.content);return}}let a=this.execution||this.createTemporaryTask();if(gt(this.cell,`Replace output items in display data ${o.items.length}`),s){let l=n.cell.outputs.map(c=>{let u=zN(c);return u.output_type==="display_data"&&"transient"in u&&u.transient&&typeof u.transient=="object"&&"display_id"in u.transient&&typeof u.transient.display_id=="string"&&u.transient.display_id===t?o:c});a?.replaceOutput(l,n.cell).then(h,h),tn.trackOutputByDisplayId(n.cell,t,o,o.items)}else a?.replaceOutputItems(o.items,n.outputContainer).then(h,h),tn.trackOutputByDisplayId(n.cell,t,n.outputContainer,o.items);this.endTemporaryTask()}};y([zr()],fd.prototype,"handleReply",1);var OC=fd;var hd=class extends Error{constructor(t){super(t.evalue||t.ename);this.ename=t.ename,this.evalue=t.evalue,this.traceback=t.traceback}};var Z_=class{constructor(e,t){this.controller=e;this.requestListener=t}create(e,t,n,i){return JF.fromCell(e,t,n,this.controller,this.requestListener,i)}},JF=class r{constructor(e,t,n,i,o,s){this.cell=e;this.codeOverride=t;this.kernelConnection=n;this.controller=i;this.requestListener=o;this.resumeExecution=s;this.type="cell";this._result=oe();this.cancelHandled=!1;this.disposables=[];if(qF.workspace.onDidCloseTextDocument(a=>{if(a===this.cell.document){d.info(`Disposing request as the cell (${this.cell.index}) was deleted ${B(this.cell.notebook.uri)}`);try{this.request?.dispose()}catch(l){d.error(`Error during cell execution dispose: ${l}`)}this.started&&!this._completed&&this.completedDueToCancellation()}},this,this.disposables),this.canExecuteCell())this.execution=Mi.getOrCreate(e,this.controller,!s?.msg_id),gp.setCellState(e,2);else{let a=Mi.get(e);a&&(a.start(),a.end(void 0))}}get result(){return this._result.promise}get executionOrder(){return this._executionOrder}static fromCell(e,t,n,i,o,s){return new r(e,t,n,i,o,s)}async start(e){if(this.session=e,this.resumeExecution?.msg_id)return this.resume(e,this.resumeExecution);if(this.cancelHandled){gt(this.cell,"Not starting as it was cancelled");return}if(gt(this.cell,"Start execution"),d.ci(`Cell Exec contents ${this.cell.document.getText().substring(0,50)}...`),!this.canExecuteCell()){this.execution?.end(void 0),this.execution=void 0,this._result.resolve();return}return e.kind==="remoteJupyter"&&e.status==="unknown"&&(!e.kernel||e.kernel.isDisposed||e.isDisposed)?(this.execution?.start(),this.execution?.clearOutput().then(h,h),this.completedWithErrors(new yn),this.result):this.started?(gt(this.cell,"Cell has already been started yet CellExecution.Start invoked again"),d.error(`Cell has already been started yet CellExecution.Start invoked again ${this.cell.index}`),this.result):(this.started=!0,Uy.set(this.cell.notebook,this.execution),gp.setCellState(this.cell,3),this.execute(this.codeOverride||this.cell.document.getText().replace(/\r\n/g,`
|
||
`),e).catch(t=>this.completedWithErrors(t)).catch(h),this.result)}async resume(e,t){if(this.cancelHandled){gt(this.cell,"Not resuming as it was cancelled");return}if(!e.kernel)throw new Error("Kernel not available to resume execution");if(gt(this.cell,"Start resuming execution"),d.ci(`Cell Exec (resuming) contents ${this.cell.document.getText().substring(0,50)}...`),!this.canExecuteCell()){this.execution?.end(void 0),this.execution=void 0,this._result.resolve();return}return this.started?(d.error(`Cell has already been started yet CellExecution.resume invoked again ${this.cell.index}`),this.result):(this.started=!0,Uy.set(this.cell.notebook,this.execution),this.execution?.start(t.startTime),t.executionCount&&this.execution&&(this.execution.executionOrder=t.executionCount),gp.setCellState(this.cell,3),this.cellExecutionHandler=this.requestListener.registerListenerForResumingExecution(this.cell,{kernel:e.kernel,cellExecution:this.execution,msg_id:t.msg_id}),this.cellExecutionHandler.onErrorHandlingExecuteRequestIOPubMessage(n=>{d.error(`Cell (index = ${this.cell.index}) execution completed with errors (2).`,n),this.completedWithErrors(n.error)},this,this.disposables),this.cellExecutionHandler.completed.finally(()=>this.completedSuccessfully()).catch(h),this.result)}async cancel(e=!1){if(!this.cancelHandled){if(this.cancelRequested=!0,this.started&&!e&&this.execution?.started){gt(this.cell,"Cell is already running, waiting for it to finish or kernel to start"),await this.result.catch(h);return}this.cancelHandled||this._completed||(gt(this.cell,"Execution cancelled"),this.cancelHandled=!0,this.completedDueToCancellation(),this.dispose())}}dispose(){this.disposed||(this.disposed=!0,gt(this.cell,"Execution disposed"),z(this.disposables))}completedWithErrors(e,t,n=!0){if(!this.cancelHandled){if(!this.disposed&&!this.cancelRequested?d.warn("Cell completed with errors",e):d.warn(`Cell completed with errors (${this.disposed?"disposed":"cancelled"})`),gt(this.cell,"Completed with errors"),n){let i,o;e&&!(e instanceof ze)&&e.message?.includes("Canceled future for execute_request message before replies were done")&&this.session&&BH(this.session)&&(e=new yn),e&&(e instanceof ze?i=hm(qF.workspace.workspaceFolders||[],e,ct(this.kernelConnection),Uh(this.kernelConnection.interpreter))?.message:i=e.message||e.name||e.stack),o=zh(i||""),o&&this.execution?.appendOutput(o).then(h,h)}this.endCellTask("failed",t),gt(this.cell,"Completed with errors, & resolving"),this._result.reject(e)}}get isEmptyCodeCell(){return this.cell.document.getText().trim().length===0}completedSuccessfully(e){gt(this.cell,"Completed successfully");let t="success";this.endCellTask("success",e),gt(this.cell,`Completed successfully & resolving with status = ${t}`),this._result.resolve()}endCellTask(e,t=new Date().getTime()){if(!this._completed){if(this._completed=!0,this.isEmptyCodeCell)this.execution&&(this.execution.executionOrder=void 0),this.execution?.end(void 0);else if(e==="success"||e==="failed")this.endTime=t,this.execution?.end(e==="success",this.endTime);else{try{this.request?.dispose()}catch{}this.execution?.end(void 0)}Uy.get(this.cell.notebook)===this.execution&&Uy.set(this.cell.notebook,void 0),this._executionOrder=this.execution?.executionOrder,gp.setCellState(this.cell,1),this.execution=void 0}}completedDueToCancellation(){gt(this.cell,"Completed due to cancellation"),this.endCellTask("cancelled"),gt(this.cell,"Cell cancelled & resolving"),this._result.resolve()}canExecuteCell(){return this.cell.document.languageId==="raw"?!1:!this.cell.document.isClosed}async execute(e,t){if(!t.kernel)throw new Error("No kernel available to execute code");if(gt(this.cell,"Send code for execution"),e.trim().length===0||this.cell.document.isClosed)return e.trim().length===0&&(this.execution?.start(this.resumeExecution?.startTime),this.execution?.clearOutput()?.then(h,h)),gt(this.cell,"Empty cell execution"),this.completedSuccessfully();let n={cellId:this.cell.document.uri.toString(),...dp(this.cell).metadata},i=t.kernel;try{or.changeCellState(this.cell,3),d.trace(`Cell Index:${this.cell.index} sent to kernel`),this.request=i.requestExecute({code:e,silent:!1,stop_on_error:!1,allow_stdin:!0,store_history:!0},!1,n),this.request.done.then(h,h)}catch(o){return d.error(`Cell execution failed without request, for cell Index ${this.cell.index}`,o),this.completedWithErrors(o)}this.cellExecutionHandler=this.requestListener.registerListenerForExecution(this.cell,{kernel:i,cellExecution:this.execution,request:this.request}),this.cellExecutionHandler.onErrorHandlingExecuteRequestIOPubMessage(o=>{d.error(`Cell (index = ${this.cell.index}) execution completed with errors (2).`,o),this.completedWithErrors(o.error)},this,this.disposables);try{gt(this.cell,"Wait for jupyter execution");let o=await this.request.done,s=new Date().getTime();gt(this.cell,"Jupyter execution completed"),o.content.status==="error"?this.completedWithErrors(new hd(o.content),s,!1):this.completedSuccessfully(s),gt(this.cell,"Executed successfully in executeCell")}catch(o){if(this.cancelHandled)return;!this.disposed&&!this.cancelRequested&&d.error("Error in waiting for cell to complete",o),gt(this.cell,"Some other execution error"),o&&o instanceof Error&&pr(o,!0)?this.completedWithErrors({message:o.message}):this.completedWithErrors(o)}}};var qH=require("vscode");var eT=class{constructor(e,t,n,i){this.controller=e;this.context=t;this.formatters=n;this.notebook=i;this.disposables=[];this.messageHandlers=new WeakMap;qH.workspace.onDidChangeNotebookDocument(o=>{o.notebook===this.notebook&&o.contentChanges.forEach(s=>s.removedCells.forEach(a=>this.messageHandlers.get(a)?.dispose()))},this,this.disposables)}dispose(){z(this.disposables),this.notebook&&this.notebook.getCells().forEach(e=>this.messageHandlers.get(e)?.dispose())}registerListenerForExecution(e,t){this.messageHandlers.get(e)?.dispose();let n=new OC(e,this.controller,this.context,this.formatters,t.kernel,t.request,t.cellExecution,t.request.msg.header.msg_id);return this.messageHandlers.set(e,n),n}registerListenerForResumingExecution(e,t){this.messageHandlers.get(e)?.dispose();let n=new OC(e,this.controller,this.context,this.formatters,t.kernel,void 0,t.cellExecution,t.msg_id);return this.messageHandlers.set(e,n),n}};var tT=require("vscode");function ic(r,e,t){r!==Ue&&d.trace(`Execution Id:${e}. ${t}.`)}var JH=new Map,jy=class r{constructor(e,t){this.code=e;this.extensionId=t;this.type="code";this._onDidEmitOutput=new tT.EventEmitter;this.onDidEmitOutput=this._onDidEmitOutput.event;this._onRequestSent=new tT.EventEmitter;this.onRequestSent=this._onRequestSent.event;this._onRequestAcknowledge=new tT.EventEmitter;this.onRequestAcknowledged=this._onRequestAcknowledge.event;this._done=oe();this.cancelHandled=!1;this.disposables=[];let n=JH.get(t)||0;n+=1,JH.set(t,n),this.executionId=`${t}-${n}`,this.disposables.push(this._onDidEmitOutput)}get done(){return this._done.promise}get result(){return this._done.promise}static fromCode(e,t){return new r(e,t)}async start(e){if(this.session=e,this.cancelHandled){ic(this.extensionId,this.executionId,"Not starting as it was cancelled");return}if(ic(this.extensionId,this.executionId,"Start Code execution"),d.ci(`Code Exec contents ${this.code.substring(0,50)}...`),!e.kernel||e.kernel.isDisposed||e.isDisposed){this._done.reject(new yn);return}if(this.started)return ic(this.extensionId,this.executionId,"Code has already been started yet CodeExecution.Start invoked again"),d.error(`Code has already been started yet CodeExecution.Start invoked again ${this.executionId}`),this.done;await this.execute(this.code.replace(/\r\n/g,`
|
||
`),e).catch(h)}async cancel(){if(!(this.cancelHandled||this._completed)){if(this.cancelRequested=!0,this.started){ic(this.extensionId,this.executionId,"Code is already running, interrupting and waiting for it to finish or kernel to start");let e=this.session?.kernel;e&&this.extensionId!==Ue&&await e.interrupt().catch(h),this.request?.dispose(),await this.request?.done.catch(h)}this.cancelHandled||this._completed||(ic(this.extensionId,this.executionId,"Execution cancelled"),this.cancelHandled=!0,this._done.resolve(),this.dispose())}}dispose(){this.disposed||(this.disposed=!0,this._completed||ic(this.extensionId,this.executionId,"Execution disposed"),z(this.disposables))}async execute(e,t){if(!t.kernel){let i=new Error("No kernel available to execute code");throw this._done.resolve(),i}ic(this.extensionId,this.executionId,"Send code for execution");let n=t.kernel;try{this.started=!0,this._onRequestSent.fire(),ic(this.extensionId,this.executionId,"Execution Request Sent to Kernel"),this.request=H9(n,e,()=>this._onRequestAcknowledge.fire(),i=>this._onDidEmitOutput.fire(i)),this.request.done.then(h,h)}catch(i){d.error(`Code execution failed without request, for exec ${this.executionId}`,i),this._completed=!0,this._done.reject(i);return}try{let i=await this.request.done;this._completed=!0,i.content.status==="error"?(ic(this.extensionId,this.executionId,"Executed with errors"),this._done.reject(new hd(i.content))):(ic(this.extensionId,this.executionId,"Executed successfully"),this._done.resolve())}catch(i){if(this._completed=!0,this.cancelHandled)return;!this.disposed&&!this.cancelRequested&&d.error(`Error in waiting for code ${this.executionId} to complete`,i),this._done.reject(i)}}};var rT=class{constructor(e,t,n,i){this.session=e;this.executionFactory=t;this.metadata=n;this.resourceUri=i;this.queueOfItemsToExecute=[];this.cancelledOrCompletedWithErrors=!1;this.startedRunningCells=!1;this.disposables=[]}get queueOfCellsToExecute(){return this.queueOfItemsToExecute.filter(e=>e.type==="cell").map(e=>e)}get isEmpty(){return this.queueOfItemsToExecute.length===0}get failed(){return this.cancelledOrCompletedWithErrors}get queue(){return this.queueOfCellsToExecute.map(e=>e.cell)}dispose(){this.disposables.forEach(e=>e.dispose()),this.lastCellExecution?.dispose()}queueCell(e,t){this.enqueue({cell:e,codeOverride:t})}queueCode(e,t,n){return this.enqueue({code:e,extensionId:t,token:n})}enqueue(e){let t;if("cell"in e){let{cell:n,codeOverride:i}=e,o=this.queueOfCellsToExecute.find(a=>a.cell===n);if(o)return gt(n,"Use existing cell execution"),o;let s=this.executionFactory.create(n,i,this.metadata);t=s,this.disposables.push(s),this.queueOfItemsToExecute.push(s),gt(n,"User queued cell for execution")}else{let{code:n,extensionId:i,token:o}=e,s=jy.fromCode(n,i);t=s,this.disposables.push(s),this.queueOfItemsToExecute.push(s),this.disposables.push(Ia(o.onCancellationRequested)(()=>s.cancel()))}return this.startExecutingCells(),t}resumeCell(e,t){if(this.queueOfCellsToExecute.find(o=>o.cell===e)){gt(e,"Use existing cell execution");return}let i=this.executionFactory.create(e,"",this.metadata,t);this.disposables.push(i),this.queueOfItemsToExecute.push(i),gt(e,"User queued cell for execution"),this.startExecutingCells()}async cancel(e){this.cancelledOrCompletedWithErrors=!0,d.debug("Cancel pending cells"),await Promise.all(this.queueOfItemsToExecute.map(t=>t.cancel(e))),this.lastCellExecution?.dispose(),this.queueOfItemsToExecute.splice(0,this.queueOfItemsToExecute.length)}async cancelQueuedCells(){this.cancelledOrCompletedWithErrors=!0,d.debug("Cancel pending cells"),await Promise.all(this.queueOfCellsToExecute.map(e=>e.cancel())),this.lastCellExecution?.type==="cell"&&this.lastCellExecution?.dispose(),this.queueOfItemsToExecute.push(...this.queueOfItemsToExecute.filter(e=>e.type==="code"))}async waitForCompletion(e){let t=e?this.queueOfCellsToExecute.filter(n=>e===n.cell):this.queueOfItemsToExecute;await Promise.all(t.map(n=>n.result))}startExecutingCells(){this.startedRunningCells||this.start().catch(h),this.startedRunningCells=!0}async start(){try{await this.executeQueuedCells()}catch(e){d.error("Failed to execute cells in CellExecutionQueue",e),this.cancelledOrCompletedWithErrors=!0,await this.cancelQueuedCells()}}async executeQueuedCells(){let e,t=await this.session;for(this.queueOfItemsToExecute.forEach(n=>n.type==="cell"&>(n.cell,"Ready to execute"));this.queueOfItemsToExecute.length;){this.lastCellExecution?.dispose();let n=this.queueOfItemsToExecute[0];this.lastCellExecution=n,n.type==="cell"&>(n.cell,"Before Execute individual cell");let i=!0;try{n.type==="cell"&&n.cell.notebook.isClosed?e=!0:n.type==="cell"&&this.cancelledOrCompletedWithErrors||(i=await n.start(t).then(()=>!0).catch(()=>!1))}finally{n.type==="cell"&>(n.cell,`After Execute individual cell ${i}`);let s=this.queueOfItemsToExecute.indexOf(n);s>=0&&this.queueOfItemsToExecute.splice(s,1),n.type==="cell"&&or.changeCellState(n.cell,1,n.executionOrder)}let o=!1;if(n.type==="cell"&&dp(n.cell).metadata?.tags?.includes("raises-exception")&&(o=!0),e||this.cancelledOrCompletedWithErrors||!i&&!o){this.cancelledOrCompletedWithErrors=!0;let s=[];if(this.cancelledOrCompletedWithErrors&&s.push("cancellation or failure in execution"),e&&s.push("Notebook being closed"),typeof i=="number"&&!i&&s.push("failure in cell execution"),s.length===0&&s.push("an unknown reason"),this.queueOfCellsToExecute.length>0&&this.queueOfCellsToExecute.length===this.queueOfItemsToExecute.length){d.warn(`Cancel all remaining cells due to ${s.join(" or ")}`),await this.cancel();break}else if(this.queueOfCellsToExecute.length>0&&this.queueOfCellsToExecute.length!==this.queueOfItemsToExecute.length)d.warn(`Cancel all remaining cells due to ${s.join(" or ")}`),await this.cancelQueuedCells();else if(e){d.warn(`Cancel all remaining cells due to ${s.join(" or ")}`),await this.cancel();break}}if(t.status==="dead"||t.status==="terminating"){this.cancelledOrCompletedWithErrors=!0,d.warn("Cancel all remaining cells due to dead kernel"),await this.cancel();break}}}};var nT=class{constructor(e,t,n,i){this.kernel=e;this.notebook=i;this.disposables=[];this._visibleExecutionCount=0;this.documentExecutions=new WeakMap;this._onDidReceiveDisplayUpdate=new vf.EventEmitter;this.onDidReceiveDisplayUpdate=this._onDidReceiveDisplayUpdate.event;this.hookedSesions=new WeakSet;let o=new eT(e.controller,t,n,i);this.disposables.push(o),this.executionFactory=new Z_(e.controller,o),or.onDidChangeNotebookCellExecutionState(s=>{s.cell.notebook===e.notebook&&s.state===1&&s.cell.executionSummary?.executionOrder&&(this._visibleExecutionCount=Math.max(this._visibleExecutionCount,s.cell.executionSummary.executionOrder))}),e.onRestarted(()=>this._visibleExecutionCount=0,this,this.disposables),e.onStarted(()=>this._visibleExecutionCount=0,this,this.disposables),e.addHook("willInterrupt",this.onWillInterrupt,this,this.disposables),e.addHook("willCancel",this.onWillCancel,this,this.disposables),e.addHook("willRestart",s=>this.onWillRestart(s),this,this.disposables),e.onStatusChanged(this.hookupIOPubHandler,this,this.disposables),e.onRestarted(this.hookupIOPubHandler,this,this.disposables),this.hookupIOPubHandler()}get executionCount(){return this._visibleExecutionCount}hookupIOPubHandler(){let e=this.kernel.session;if(!e||this.hookedSesions.has(e))return;this.hookedSesions.add(e);let t=(n,i)=>{if(i.header.msg_type!=="update_display_data"&&i.header.msg_type!=="display_data")return;let o=i,s=o.content.transient?.display_id;if(!s||!Q9(e,s))return;let a=bo({output_type:"display_data",data:o.content.data,metadata:o.content.metadata,transient:o.content.transient});this._onDidReceiveDisplayUpdate.fire(a)};e.iopubMessage.connect(t),this.disposables.push({dispose:()=>{e?.iopubMessage.disconnect(t)}})}get pendingCells(){return this.documentExecutions.get(this.notebook)?.queue||[]}async resumeCellExecution(e,t){if(gt(e,`NotebookKernelExecution.resumeCellExecution (start), ${B(e.notebook.uri)}`),e.kind==vf.NotebookCellKind.Markup)return;await Qs(this.kernel.resourceUri,this.kernel.kernelConnectionMetadata),_t(this.kernel.resourceUri,"DATASCIENCE.RESUME_EXECUTE_CELL");let n=this.kernel.start(new Ht(!1)),i=this.getOrCreateCellExecutionQueue(e.notebook,n);i.resumeCell(e,t);let o=await i.waitForCompletion(e).then(()=>!0).catch(()=>!1);gt(e,`NotebookKernelExecution.resumeCellExecution (completed), ${B(e.notebook.uri)}`),d.trace(`Cell ${e.index} executed ${o?"successfully":"with an error"}`)}async executeCell(e,t){gt(e,`NotebookKernelExecution.executeCell (1), ${B(e.notebook.uri)}`);let n=new We;if(e.kind==vf.NotebookCellKind.Markup)return;gt(e,`NotebookKernelExecution.executeCell, ${B(e.notebook.uri)}`),await Qs(this.kernel.resourceUri,this.kernel.kernelConnectionMetadata);let i=this.kernel.start(new Ht(!1));await this.kernel.restarting,gt(e,`NotebookKernelExecution.executeCell (2), ${B(e.notebook.uri)}`);let o=this.getOrCreateCellExecutionQueue(e.notebook,i);o.queueCell(e,t);let s=!0;try{await o.waitForCompletion(e)}catch(a){throw s=!1,a}finally{gt(e,`NotebookKernelExecution.executeCell completed (3), ${B(e.notebook.uri)}`),d.trace(`Cell ${e.index} executed ${s?"successfully":"with an error"}`),_t(this.kernel.resourceUri,"DATASCIENCE.EXECUTE_CELL",{duration:n.elapsedTime})}}async*executeCode(e,t,n,i){let o=new We;await Qs(this.kernel.resourceUri,this.kernel.kernelConnectionMetadata);let s=this.kernel.start(new Ht(!1));await this.kernel.restarting;let a=this.getOrCreateCellExecutionQueue(this.notebook,s),l;t===Ue?(l=jy.fromCode(e,t),s.then(v=>l.start(v))):l=a.queueCode(e,t,i),t!==Ue&&d.trace(`Queue code ${l.executionId} from ${t} after ${o.elapsedTime}ms:
|
||
${e}`);let c=!1,u=[];l.result.finally(()=>{c=!0,!i.isCancellationRequested&&d.debug(`Execution of code ${l.executionId} completed in ${o.elapsedTime}ms`),t!==Ue&&_t(this.kernel.resourceUri,"DATASCIENCE.EXECUTE_CODE",{duration:o.elapsedTime},{extensionId:t}),z(u)}).catch(h);let p=Is(l.result),f=[],g=oe();for(u.push(l.onRequestSent(()=>n.started.fire())),u.push(l.onRequestAcknowledged(()=>n.executionAcknowledged.fire())),l.onDidEmitOutput(v=>{f.push(v),g.resolve(),g=oe()},this,u),i.onCancellationRequested(()=>{c||d.debug(`Code execution cancelled by extension ${t}`)},this,u);;){await Promise.race([g.promise,p.promise]),c&&(g=oe());let v=this.kernel.session;for(;f.length;){let b=f.shift();v&&Lk(t,v,b),yield b}if(p.completed)break}}executeHidden(e){return this.kernel.start().then(n=>n.kernel?bn(n.kernel,e):Promise.reject(new yn))}async onWillInterrupt(){let e=this.documentExecutions.get(this.notebook);!e&&this.kernel.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"||(d.info("Interrupt kernel execution"),e&&(await e.cancel(),await e.waitForCompletion().catch(h)))}async onWillCancel(){let e=this.documentExecutions.get(this.notebook);e&&await e.cancel(!0)}async onWillRestart(e){let t=this.documentExecutions.get(this.notebook),n=e?await e.catch(()=>{}):void 0,i=t?t.cancel(!0).then(()=>t.waitForCompletion().catch(h)):Promise.resolve();n||(d.info("No kernel session to interrupt"),await i)}getOrCreateCellExecutionQueue(e,t){let n=this.documentExecutions.get(e);if(n&&!n.isEmpty&&!n.failed)return n;let i=new rT(t,this.executionFactory,this.kernel.kernelConnectionMetadata,this.kernel.resourceUri);return this.disposables.push(i),vf.workspace.onDidCloseNotebookDocument(async o=>{o===e&&(d.debug(`Cancel executions after closing notebook ${B(o.uri)}`),(!i.failed||!i.isEmpty)&&await i.cancel(!0))},this,this.disposables),this.documentExecutions.set(e,i),i}};var Wy=class extends B_{constructor(t,n,i,o,s,a,l,c,u){super(t,n);this.sessionCreator=i;this.configService=o;this.context=s;this.formatters=l;this.startupCodeProviders=c;this.workspaceStorage=u;n.push(a.onDidRemove(this.handleServerRemoval.bind(this)))}getOrCreate(t,n){let i=this.getInternal(t);if(i&&i.options.metadata.id===n.metadata.id)return i.kernel;this.disposeOldKernel(t);let o=t.notebookType===yt?n.resourceUri:t.uri,s=VF(this.configService,o),a=t.uri.path.endsWith(".interactive")||n.resourceUri?.path.endsWith(".interactive")?yt:Et,l=new z_(o,t,n.metadata,this.sessionCreator,s,n.controller,this.startupCodeProviders.getProviders(a),this.workspaceStorage);return l.onRestarted(()=>this._onDidRestartKernel.fire(l),this,this.disposables),l.onDisposed(()=>{this._onDidDisposeKernel.fire(l)},this,this.disposables),l.onStarted(()=>this._onDidStartKernel.fire(l),this,this.disposables),l.onStatusChanged(c=>this._onKernelStatusChanged.fire({kernel:l,status:c}),this,this.disposables),this.executions.set(l,new nT(l,this.context,this.formatters,t)),this.asyncDisposables.push(l),this.storeKernel(t,n,l),this.deleteMappingIfKernelIsDisposed(l),l}};Wy=y([(0,mn.injectable)(),m(0,(0,mn.inject)(Vo)),m(1,(0,mn.inject)(O)),m(2,(0,mn.inject)(bx)),m(3,(0,mn.inject)(le)),m(4,(0,mn.inject)(ot)),m(5,(0,mn.inject)(zt)),m(6,(0,mn.multiInject)(mg)),m(7,(0,mn.inject)(Wc)),m(8,(0,mn.inject)(Ve)),m(8,(0,mn.named)(ci))],Wy);var Vy=class extends q_{constructor(t,n,i,o,s,a){super(t,n);this.sessionCreator=i;this.configService=o;this.startupCodeProviders=s;this.workspaceStorage=a}getOrCreate(t,n){let i=this.getInternal(t);if(i&&i.options.metadata.id===n.metadata.id)return i.kernel;this.disposeOldKernel(t);let o=t,s=VF(this.configService,o),a=o.path.endsWith(".interactive")?yt:Et,l=new G_(t,o,n.metadata,this.sessionCreator,s,this.startupCodeProviders.getProviders(a),this.workspaceStorage);return l.onRestarted(()=>this._onDidRestartKernel.fire(l),this,this.disposables),l.onDisposed(()=>{this._onDidDisposeKernel.fire(l)},this,this.disposables),l.onStarted(()=>this._onDidStartKernel.fire(l),this,this.disposables),l.onStatusChanged(c=>this._onKernelStatusChanged.fire({kernel:l,status:c}),this,this.disposables),this.asyncDisposables.push(l),this.storeKernel(t,n,l),this.deleteMappingIfKernelIsDisposed(t,l),l}};Vy=y([(0,mn.injectable)(),m(0,(0,mn.inject)(Vo)),m(1,(0,mn.inject)(O)),m(2,(0,mn.inject)(bx)),m(3,(0,mn.inject)(le)),m(4,(0,mn.inject)(Wc)),m(5,(0,mn.inject)(Ve)),m(5,(0,mn.named)(ci))],Vy);var yf=P(M()),gu=require("vscode");var By=class{constructor(e,t,n,i){this.extensionChecker=t;this.interpreterService=n;this.kernelFinder=i;this.refreshedOnceBefore=!1;this.disposables=[];e.push(this)}dispose(){z(this.disposables)}activate(){this.extensionChecker.isPythonExtensionInstalled?this.startRefreshWithPython():(this.startRefreshWithoutPython(),this.extensionChecker.onPythonExtensionInstallationStatusChanged(()=>{this.extensionChecker.isPythonExtensionInstalled&&this.startRefreshWithPython()},this,this.disposables))}startRefreshWithoutPython(){if(this.refreshedOnceBefore)return;this.refreshedOnceBefore=!0;let e=()=>{let t=Date.now().toString();d.debug(`Start refreshing Kernel Picker (${t})`);let n=gu.notebooks.createNotebookControllerDetectionTask(Et),i=gu.notebooks.createNotebookControllerDetectionTask(yt);this.disposables.push(n),this.disposables.push(i),this.kernelFinder.onDidChangeStatus(()=>{this.kernelFinder.status==="idle"&&(d.debug(`End refreshing Kernel Picker (${t})`),n.dispose(),i.dispose())},this,this.disposables)};if(this.kernelFinder.status==="discovering")return e();this.kernelFinder.onDidChangeStatus(()=>{this.kernelFinder.status==="discovering"&&e()},this,this.disposables)}startRefreshWithPython(){if(this.refreshedOnceBefore)return;this.refreshedOnceBefore=!0;let e=!1;gu.window.onDidChangeActiveNotebookEditor(o=>{!e&&o&&Dt(o.notebook)&&(e=!0,d.debug("Start refreshing Interpreter Kernel Picker"),this.interpreterService.refreshInterpreters().catch(h))},this,this.disposables),gu.workspace.onDidOpenNotebookDocument(o=>{!e&&Dt(o)&&(e=!0,d.debug("Start refreshing Interpreter Kernel Picker"),this.interpreterService.refreshInterpreters().catch(h))},this,this.disposables);let t,n="",i=()=>(t&&!t.isDisposed||(n=Date.now().toString(),d.debug(`Start refreshing Kernel Picker (${n})`),t=new $r(gu.notebooks.createNotebookControllerDetectionTask(Et),gu.notebooks.createNotebookControllerDetectionTask(yt)),this.disposables.push(t)),t);this.kernelFinder.status==="idle"?(d.debug(`End refreshing Kernel Picker (${n})`),t?.dispose()):i(),this.kernelFinder.onDidChangeStatus(()=>{this.kernelFinder.status==="idle"?(d.debug(`End refreshing Kernel Picker (${n})`),t?.dispose()):i()},this,this.disposables)}};By=y([(0,yf.injectable)(),m(0,(0,yf.inject)(O)),m(1,(0,yf.inject)($e)),m(2,(0,yf.inject)(rt)),m(3,(0,yf.inject)(Rr))],By);var $H=P(M());var qy=class{constructor(){this.providers=new Map}getProviders(e){return(this.providers.get(e)||[]).slice()}register(e,t){this.providers.set(t,this.providers.get(t)||[]),this.providers.get(t).push(e)}};qy=y([(0,$H.injectable)()],qy);var KC=P(M());var Jy=class{constructor(e,t){this.kernelProvider=e;this.disposables=t}activate(){this.kernelProvider.onDidCreateKernel(e=>this.addOnStartHooks(e),this,this.disposables)}addOnStartHooks(e){e.addHook("didStart",async t=>{t&&await a5(t,e.resourceUri,e.kernelConnectionMetadata)},this,this.disposables)}};Jy=y([(0,KC.injectable)(),m(0,(0,KC.inject)(Te)),m(1,(0,KC.inject)(O))],Jy);var FC=P(M());var HH=require("vscode");var $y=class{constructor(e,t){this.kernelProvider=e;this.disposables=[];this.restartProgress=new WeakMap;this.interruptProgress=new WeakMap;t.push(this)}dispose(){z(this.disposables)}activate(){this.kernelProvider.onDidCreateKernel(this.onDidCreateKernel,this,this.disposables),this.kernelProvider.onDidDisposeKernel(e=>{this.restartProgress.get(e)?.dispose(),this.interruptProgress.get(e)?.dispose()},this,this.disposables)}onDidCreateKernel(e){e.addHook("willRestart",async()=>{this.restartProgress.get(e)?.dispose();let t=dt.createProgressReporter(e.resourceUri,I.restartingKernelStatus(`: ${ct(e.kernelConnectionMetadata)}`));this.restartProgress.set(e,t)},this,this.disposables),e.addHook("restartCompleted",async()=>{this.restartProgress.get(e)?.dispose(),this.interruptProgress.get(e)?.dispose()},this,this.disposables),e.addHook("willInterrupt",async()=>{let t=new $r,n=setTimeout(()=>{t.isDisposed||t.add(dt.createProgressReporter(e.resourceUri,I.interruptKernelStatus(ct(e.kernelConnectionMetadata))))},1e3);t.add(new HH.Disposable(()=>clearTimeout(n))),this.interruptProgress.set(e,t)},this,this.disposables),e.addHook("interruptCompleted",async()=>this.interruptProgress.get(e)?.dispose(),this,this.disposables)}};$y=y([(0,FC.injectable)(),m(0,(0,FC.inject)(Te)),m(1,(0,FC.inject)(O))],$y);var yu=P(M()),UC=require("vscode");var Aa=P(M()),LC=require("vscode");var ss=require("vscode");var ove=/python\s\d*.?\d*$/,$F="__old_vscode_kernelspecs",HF=class{constructor(e,t,n){this.fs=e;this.globalState=t;this.jupyterPaths=n;this.findKernelSpecsInPathCache=new Map;this.pathToKernelSpec=new Map;this.disposables=[];this.oldKernelSpecsFolder&&d.trace(`Old kernelSpecs (created by Jupyter Extension) stored in directory ${this.oldKernelSpecsFolder}`)}get oldKernelSpecsFolder(){return this._oldKernelSpecsFolder||this.globalState.get("OLD_KERNEL_SPECS_FOLDER__","")}set oldKernelSpecsFolder(e){this._oldKernelSpecsFolder=e,this.globalState.update("OLD_KERNEL_SPECS_FOLDER__",e).then(h,h)}clearCache(){this.pathToKernelSpec.clear(),this.findKernelSpecsInPathCache.clear()}dispose(){z(this.disposables)}async loadKernelSpec(e,t,n){if(e.fsPath.includes($F))return;let i=gn(e);if(!this.pathToKernelSpec.has(i)){let o=this.loadKernelSpecImpl(e,t,n).then(async s=>{let a=await this.jupyterPaths.getKernelSpecRootPath(),l=s&&a&&Vn(s)&&s.specFile&&Dh(ss.Uri.file(s.specFile),a);if(s&&!l)return s;s?.specFile&&l&&this.deleteOldKernelSpec(s.specFile).catch(h),this.pathToKernelSpec.get(i)===o&&this.pathToKernelSpec.delete(i),this.cache=this.cache?.filter(c=>ki(c.kernelSpecFile,e))});this.pathToKernelSpec.set(i,o),o.finally(()=>{t.isCancellationRequested&&this.pathToKernelSpec.get(i)===o&&this.pathToKernelSpec.delete(i)}).catch(h)}return this.pathToKernelSpec.get(i)}async deleteOldKernelSpec(e){let t=Ee(lt(e)),n=je(lt(lt(e)),$F);this.oldKernelSpecsFolder=n;let i=je(n,t,Ee(e));await this.fs.createDirectory(ss.Uri.file(lt(i))),await this.fs.copy(ss.Uri.file(e),ss.Uri.file(i)).catch(h),await this.fs.delete(ss.Uri.file(e)),d.trace(`Old KernelSpec '${e}' deleted and backup stored in ${n}`)}async loadKernelSpecImpl(e,t,n){return sve(e,this.fs,t,n)}async findKernelSpecsInPaths(e,t){let n=gn(e),i=this.findKernelSpecsInPathCache.get(n);if(i)return i;let o=(async()=>await this.fs.exists(e)?t.isCancellationRequested?[]:(await this.fs.searchLocal("**/kernel.json",e.fsPath,!0)).map(l=>er(e,l)):[])();this.findKernelSpecsInPathCache.set(n,o);let s=t.onCancellationRequested(()=>{this.findKernelSpecsInPathCache.get(n)===o&&this.findKernelSpecsInPathCache.delete(n)});return o.finally(()=>{t.isCancellationRequested&&this.findKernelSpecsInPathCache.get(n)===o&&this.findKernelSpecsInPathCache.delete(n),s.dispose()}).catch(h),o.catch(a=>{this.findKernelSpecsInPathCache.get(n)===o&&this.findKernelSpecsInPathCache.delete(n),d.warn(`Failed to search for kernels in ${B(e)} with an error`,a)}),o}},Hy=class{constructor(e,t,n,i,o,s){this.fs=e;this.extensionChecker=t;this.memento=n;this.env=o;this.jupyterPaths=s;this.disposables=[];this._status="idle";this.promiseMonitor=new vo;this._onDidChangeStatus=new ss.EventEmitter;this.onDidChangeStatus=this._onDidChangeStatus.event;this._onDidChangeKernels=new ss.EventEmitter;this.onDidChangeKernels=this._onDidChangeKernels.event;this.timeouts=new Map;i.push(this),this.disposables.push(this.promiseMonitor),this.promiseMonitor.onStateChange(()=>{this.status=this.promiseMonitor.isComplete?"idle":"discovering"}),this.kernelSpecFinder=new HF(e,n,s),this.disposables.push(this.kernelSpecFinder),this.disposables.push(new ss.Disposable(()=>z(Array.from(this.timeouts.values()))))}get status(){return this._status}set status(e){this._status!==e&&(this._status=e,this._onDidChangeStatus.fire())}clearCache(){this.kernelSpecFinder.clearCache()}async listKernelsFirstTimeFromMemento(e){let t=(async()=>{let n=this.memento.get(e,JSON.stringify({kernels:[],extensionVersion:""})),i=JSON.parse(n),o=[];i&&Array.isArray(i.kernels)&&i.extensionVersion===this.env.extensionVersion&&(o=i.kernels.map(a=>Ns.fromJSON(a)));let s=[];return await Promise.all(o.map(async a=>{await this.isValidCachedKernel(a)&&s.push(a)})),s})();return this.promiseMonitor.push(t),t}writeToMementoCache(e,t){this.timeouts.get(t)?.dispose();let n=setTimeout(()=>{this.memento.update(t,JSON.stringify({kernels:e.map(i=>i.toJSON()),extensionVersion:this.env.extensionVersion}))},500);this.timeouts.set(t,{dispose:()=>jt(clearTimeout)(n)})}async isValidCachedKernel(e){switch(e.kind){case"startUsingPythonInterpreter":return this.fs.exists(e.interpreter.uri);case"startUsingLocalKernelSpec":return(e.kernelSpec.specFile?this.fs.exists(ss.Uri.file(e.kernelSpec.specFile)):Promise.resolve(!0)).then(n=>n&&e.interpreter?this.fs.exists(e.interpreter.uri):Promise.resolve(!0))}}};async function sve(r,e,t,n){if(r.fsPath.includes($F))return;let i;try{i=JSON.parse(await e.readFile(r))}catch(c){d.error(`Failed to parse kernelspec ${r}`,c);return}if(t.isCancellationRequested||(i.name=n?await ZN(n):i.name,t.isCancellationRequested))return;if(!i.display_name.toLowerCase().match(ove)&&i.language===ye&&i.argv.length>2){let c=i.argv.slice(1).map(u=>u.toLowerCase()).filter(u=>!["-m","ipykernel","ipykernel_launcher","-f","{connection_file}"].includes(u));c.length&&(i.name=`${i.name}.${c.join("#")}`)}i.metadata=i.metadata||{},i.metadata.vscode=i.metadata.vscode||{},i.metadata.vscode.originalSpecFile||(i.metadata.vscode.originalSpecFile=r.fsPath),i.metadata.vscode.originalDisplayName||(i.metadata.vscode.originalDisplayName=i.display_name),i.metadata.originalSpecFile&&(i.metadata.vscode.originalSpecFile=i.metadata.originalSpecFile,delete i.metadata.originalSpecFile);let s=new hp(i,r.fsPath,n?.uri.fsPath||i?.metadata?.interpreter?.path,Vn(i));s.name=i?.name||Ee(lt(r.fsPath));let a=n?.uri.fsPath||i?.metadata?.interpreter?.path,l=Hr(n);if(!(a&&!l&&!await e.exists(ss.Uri.file(a))))return i.isRegisteredByVSC=Vn(i),s}function GH(){return`LOCAL_KERNEL_SPECS_CACHE_KEY_V_2023_2:${LC.env.appHost}:${LC.env.remoteName||""}`}var as=class extends Hy{constructor(t,n,i,o,s,a){super(t,i,o,s,a,n);this._kernels=new Map}activate(){this.listKernelsFirstTimeFromMemento(GH()).then(t=>{this._kernels.size===0&&t.length&&(t.forEach(n=>this._kernels.set(n.id,n)),this._onDidChangeKernels.fire())}).catch(h),this.refresh().then(h,h)}get kernels(){return Array.from(this._kernels.values())}dispose(){this._onDidChangeKernels.dispose()}async refresh(){this.clearCache(),await this.refreshData()}async refreshData(){let t=new LC.CancellationTokenSource;try{await this.listKernelSpecs(t.token)}finally{t.dispose()}}writeKernelsToMemento(){this.writeToMementoCache(Array.from(this._kernels.values()),GH())}async listKernelSpecs(t){let i=(async()=>{let o=await this.findKernelSpecs(t);if(t.isCancellationRequested)return[];let s=Array.from(this._kernels.values()).sort((u,p)=>u.id.localeCompare(p.id)),a=o.sort((u,p)=>u.id.localeCompare(p.id)),l=new Set(o.map(u=>u.id)),c=s.filter(u=>!l.has(u.id));return o.forEach(u=>this._kernels.set(u.id,u)),c.length&&(d.debug(`Local kernel spec connection deleted ${c.map(u=>`${u.kind}:'${u.id}'`)}`),c.forEach(u=>this._kernels.delete(u.id))),(s.length!==a.length||c.length||JSON.stringify(s)!==JSON.stringify(a))&&(this._onDidChangeKernels.fire(),this.writeKernelsToMemento()),o})();return this.promiseMonitor.push(i),i}async findKernelSpecs(t){let n=await this.jupyterPaths.getKernelSpecRootPaths(t);if(t.isCancellationRequested)return[];let i=await Promise.all(n.map(l=>this.kernelSpecFinder.findKernelSpecsInPaths(l,t)));if(t.isCancellationRequested)return[];let o=new Set,s=[],a=new Map;return await Promise.all(i.flat().map(async l=>{try{let c=await this.kernelSpecFinder.loadKernelSpec(l,t);if(!c||t.isCancellationRequested)return;if(T_(c,"local"),c.metadata?.originalSpecFile){if(o.has(c.metadata.originalSpecFile))return;o.add(c.metadata.originalSpecFile)}if(c.specFile){if(o.has(c.specFile))return;o.add(c.specFile)}let u=a.get(c.display_name),p=fp.create({kernelSpec:c,interpreter:void 0,id:Oi(c)});u&&u.executable!==c.executable?(s.push(p),pa(p,this._kernels.get(p.id))||(this._kernels.set(p.id,p),this._onDidChangeKernels.fire(),this.writeKernelsToMemento())):u?d.warn(`Duplicate kernel found ${c.display_name} ${c.executable} in ${c.specFile}`):(s.push(p),a.set(c.display_name,c),pa(p,this._kernels.get(p.id))||(this._kernels.set(p.id,p),this._onDidChangeKernels.fire(),this.writeKernelsToMemento()))}catch(c){d.error(`Failed to load kernelSpec for ${l}`,c);return}})),s}};y([Uv(100)],as.prototype,"writeKernelsToMemento",1),as=y([(0,Aa.injectable)(),m(0,(0,Aa.inject)(mr)),m(1,(0,Aa.inject)(jr)),m(2,(0,Aa.inject)($e)),m(3,(0,Aa.inject)(Ve)),m(3,(0,Aa.named)(ft)),m(4,(0,Aa.inject)(O)),m(5,(0,Aa.inject)(Ol))],as);var No=P(M()),zH=require("vscode");var gd=Symbol("ITrustedKernelPaths");var ri=require("vscode");function GF(){return`LOCAL_KERNEL_PYTHON_AND_RELATED_SPECS_CACHE_KEY_V_2023_3:${ri.env.appHost}:${ri.env.remoteName||""}`}async function ave(r,e,t,n,i){let o=await ya(r);if(!o){d.warn(`Failed to get sysPrefix for interpreter ${en(r.id)}`);return}let s=ri.Uri.file(je(o,n5)),a=await t.getKernelSpecRootPaths(e);if(e.isCancellationRequested||a.some(p=>ki(p,s)))return;let l=await n.findKernelSpecsInPaths(s,e);if(e.isCancellationRequested)return;let c=new Set,u=new Map;await Promise.all(l.map(async p=>{try{let f=await n.loadKernelSpec(p,e,r);if(e.isCancellationRequested||!f)return;if(f.metadata?.originalSpecFile){if(c.has(f.metadata.originalSpecFile))return;c.add(f.metadata.originalSpecFile)}if(f.specFile){if(c.has(f.specFile))return;c.add(f.specFile)}let g=u.get(f.display_name);g&&g.executable!==f.executable?i.fire(f):g||(u.set(f.display_name,f),i.fire(f))}catch(f){d.error(`Failed to load kernel spec ${p}`,f)}}))}var iT=class extends tr{constructor(t,n,i,o,s){super();this.interpreter=t;this.interpreterService=n;this.jupyterPaths=i;this.extensionChecker=o;this.kernelSpecFinder=s;this.cancelToken=new ri.CancellationTokenSource;this._kernels=new Map;this._onDidChangeKernels=this._register(new ri.EventEmitter);this.onDidChangeKernels=this._onDidChangeKernels.event;this.lastKnownInterpreterVersion=Yi(t),this.lastKnownInterpreterSysPrefix=Uh(t),this.lastKnownEnvFolder=Tr(t)?.environment?.folderUri,this._register({dispose:()=>this.cancelToken.cancel()}),this._register(this.cancelToken),this._register(this.interpreterService.onDidChangeInterpreter(this.clearCacheWhenInterpretersChange,this)),this._register(this.interpreterService.onDidChangeInterpreters(this.clearCacheWhenInterpretersChange,this))}async listKernelSpecs(t){return this.extensionChecker.isPythonExtensionInstalled?!t&&this.kernelSpecPromise?this.kernelSpecPromise:(this.cancelToken.cancel(),this.cancelToken.dispose(),this.cancelToken=this._register(new ri.CancellationTokenSource),this.kernelSpecPromise=this.listKernelSpecsImpl(),this.kernelSpecPromise.then(()=>{switch(this._kernels.size){case 0:d.trace(`No Kernels found in interpreter ${this.interpreter.id}`);break;case 1:break;default:d.trace(`Kernels for interpreter ${this.interpreter.id} are ${Array.from(this._kernels.keys()).join(", ")}`)}}),this.kernelSpecPromise):[]}clearCacheWhenInterpretersChange(){let t=Tr({id:this.interpreter.id});if(!t)return;let n=Yi(t),i=Uh(t);(this.lastKnownEnvFolder?.fsPath!==t.environment?.folderUri?.fsPath||this.lastKnownInterpreterVersion?.sysVersion!==n?.sysVersion||Be(this.interpreter)!==Be(t)||this.lastKnownInterpreterSysPrefix!==i)&&(this.lastKnownInterpreterVersion=n,this.lastKnownInterpreterSysPrefix=i,this.listKernelSpecs(!0).catch(h))}async listKernelSpecsImpl(){let t=this.cancelToken.token;if(!Uh(this.interpreter))return;d.trace(`Search for KernelSpecs in Interpreter ${en(this.interpreter.uri)}`);let i=new Map,o=new ri.EventEmitter,s=o.event(f=>{if(t.isCancellationRequested)return;if(f.language===ye&&(!f.env||Object.keys(f.env).length===0)&&xx(f)){d.trace(`Hiding default KernelSpec ${en(f.argv[0])} for interpreter ${en(f.interpreterPath)} (KernelSpec file ${en(f.specFile)})`);return}let g=of(f)?qo.create({kernelSpec:f,interpreter:this.interpreter,id:Oi(f,this.interpreter)}):fp.create({kernelSpec:f,interpreter:this.interpreter,id:Oi(f,this.interpreter)});g&&!this._kernels.has(g.id)&&(this._kernels.set(g.id,g),this._onDidChangeKernels.fire({added:[g],removed:[]})),g&&!i.has(g.id)&&i.set(g.id,g)}),[a]=await Promise.all([this.jupyterPaths.getKernelSpecTempRegistrationFolder(),ave(this.interpreter,t,this.jupyterPaths,this.kernelSpecFinder,o)]);if(o.dispose(),s.dispose(),t.isCancellationRequested)return;let c=await Os(this.interpreter,a);if(t.isCancellationRequested)return;let u=qo.create({kernelSpec:c,interpreter:this.interpreter,id:Oi(c,this.interpreter)});this._kernels.has(u.id)||(this._kernels.set(u.id,u),this._onDidChangeKernels.fire({added:[u],removed:[]})),i.has(u.id)||i.set(u.id,u);let p=Array.from(this._kernels.keys()).filter(f=>!i.has(f)).map(f=>this._kernels.get(f));p.forEach(f=>this._kernels.delete(f.id)),this._onDidChangeKernels.fire({added:[],removed:p})}},oT=class r{constructor(e,t,n,i){this.interpreterService=e;this.kernelSpecsFromKnownLocations=t;this.extensionChecker=n;this.trustedKernels=i;this.kernelsPerInterpreter=new Map;this.disposables=[];this.cancelToken=new ri.CancellationTokenSource;this.lastKnownGlobalPythonKernelSpecs=[];t.onDidChangeKernels(()=>{let o=this.lastKnownGlobalPythonKernelSpecs,s=this.listGlobalPythonKernelSpecs();if(o.length!==s.length||!pa(o,s)){this.kernelSpecPromise=void 0;return}})}static{this.globalPythonKernelSpecsForWhichWeCouldNotFindInterpreterInfo=new Set}dispose(){z(this.disposables),this.cancelToken.dispose()}async listKernelSpecs(e){return this.extensionChecker.isPythonExtensionInstalled?!e&&this.kernelSpecPromise?this.kernelSpecPromise:(this.clear(),this.cancelToken=new ri.CancellationTokenSource,this.kernelSpecPromise=this.listKernelSpecsImpl(),this.kernelSpecPromise):[]}clear(){this.kernelsPerInterpreter.clear(),this.cancelToken.cancel(),this.cancelToken.dispose(),this.kernelSpecPromise=void 0}async findMatchingInterpreter(e,t,n){let i=this.extensionChecker.isPythonExtensionInstalled?ho():[],o=e&&Array.isArray(e.argv)&&e.argv.length>0?e.argv[0]:void 0,s=e.language||"",a=e.specFile?await mt(e.specFile):"",l=!!Vn(e);if(e.language&&e.language!==ye){!l&&o&&e.specFile&&d_(o)&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:Ee(o)!==o,argv0:Ee(o),language:s,isCreatedByUs:l});return}let c=i.find(u=>e.metadata?.interpreter?.path&&Bo(ri.Uri.file(e.metadata.interpreter.path),u.executable.uri)?(d.trace(`Kernel ${e.name} matches ${en(u.id)} based on metadata.interpreter.`),!0):!1);if(c)return Ai(c);if(o&&Ee(o)===o&&e.specFile&&!l&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!1,argv0:Ee(o),language:s,isCreatedByUs:l}),o&&Ee(o)!==o){let u=ri.Uri.file(o),p=i.find(f=>Bo(u,f.executable.uri)?(d.trace(`Kernel ${e.name} matches ${en(f.id)} based on argv.`),!0):!1);if(p)return e.specFile&&!l&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!0,argv0:Ee(o),pythonEnvFound:"found",language:s,isCreatedByUs:l}),Ai(p);if(!e.specFile||this.trustedKernels.isTrusted(ri.Uri.file(e.specFile))){let f=await this.interpreterService.getInterpreterDetails(u,n);if(n?.isCancellationRequested)return;if(f)return e.specFile&&!l&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!0,argv0:Ee(o),pythonEnvFound:"foundViaGetEnvDetails",language:s,isCreatedByUs:l}),f;e.specFile&&!l&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!0,argv0:Ee(o),pythonEnvFound:"notFound",language:s,isCreatedByUs:l})}else e.specFile&&!l&&A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!0,argv0:Ee(o),pythonEnvFound:"notTrusted",language:s,isCreatedByUs:l})}if(e.interpreterPath){let u=ri.Uri.file(e.interpreterPath),p=i.find(f=>e.interpreterPath&&Bo(u,f.executable.uri)?(d.trace(`Kernel ${e.name} matches ${en(f.id)} based on interpreterPath.`),!0):!1);if(p)return Ai(p);if(!e.specFile||this.trustedKernels.isTrusted(ri.Uri.file(e.specFile))){let f=await this.interpreterService.getInterpreterDetails(u,n);if(f)return f}}if(!n?.isCancellationRequested)return Ai(i.find(u=>e.display_name===Tr(u)?.environment?.name?(d.trace(`Kernel ${e.name} matches ${en(u.id)} based on display name`),A("GLOBAL_PYTHON_KERNELSPEC",void 0,{kernelSpecHash:a,kernelConnectionType:t,pythonPathDefined:!0,argv0:o?Ee(o):"",pythonEnvFound:"matchDisplayName",language:s,isCreatedByUs:l}),!0):!1))}listGlobalPythonKernelSpecs(){return this.lastKnownGlobalPythonKernelSpecs=this.kernelSpecsFromKnownLocations.kernels.filter(e=>e.kernelSpec.language===ye)}warnAboutPythonKernelSpecWithInvalidPythonExec(e){let t=e.specFile||JSON.stringify(e);r.globalPythonKernelSpecsForWhichWeCouldNotFindInterpreterInfo.has(t)||(r.globalPythonKernelSpecsForWhichWeCouldNotFindInterpreterInfo.add(t),d.warn(`Kernel Spec for '${e.display_name}' (${en(e.specFile)}) hidden, as we cannot find a matching interpreter argv = '${e.argv[0]}'. To resolve this, please change '${e.argv[0]}' to point to the fully qualified Python executable.`))}async listKernelSpecsImpl(){let e=this.cancelToken.token,t=this.listGlobalPythonKernelSpecs().filter(s=>!Vn(s.kernelSpec)),n=s=>{if(s.kernelSpec.language!==ye)return!1;let a=s.kernelSpec.argv.map(u=>u.toLowerCase()),l=a.indexOf("-m");if(l===-1)return!1;let c=a.length-1>=l?a[l+1]:void 0;return c?c!=="ipykernel_launcher":!1},i=new Map,o=new Set;return await Promise.all(t.filter(s=>{let a=Vn(s.kernelSpec);return!a&&(n(s)||Object.keys(s.kernelSpec.env||{}).length>0)||!a&&s.kernelSpec.language===ye&&!xx(s.kernelSpec)?!0:(d.trace(`Kernel Spec for '${s.kernelSpec.display_name}' (${en(s.kernelSpec.specFile)}) is hidden. (isDefaultKernelSpec = ${xx(s.kernelSpec)}, language = ${s.kernelSpec.language}, registrationInfo = ${a})`),!1)}).map(async s=>{let a=await this.findMatchingInterpreter(s.kernelSpec,"startUsingLocalKernelSpec",e);if(e.isCancellationRequested)return;if(!a){let c=s.kernelSpec.argv.length?s.kernelSpec.argv[0].toLowerCase():"";if(d_(c)){this.warnAboutPythonKernelSpecWithInvalidPythonExec(s.kernelSpec);return}}let l=fp.create({kernelSpec:s.kernelSpec,interpreter:a,id:Oi(s.kernelSpec,a)});i.set(l.id,l),l.kernelSpec.specFile&&o.add(l.kernelSpec.specFile)})),e.isCancellationRequested?[]:e.isCancellationRequested?[]:Array.from(i.values())}};var vu=class extends Hy{constructor(t,n,i,o,s,a,l,c,u){super(n,o,a,l,c,i);this.interpreterService=t;this.kernelSpecsFromKnownLocations=s;this._kernels=new Map;this._kernelsExcludingCachedItems=new Map;this._kernelsFromCache=[];this.cachedInformationForPythonInterpreter=new Map;this.updateCachePromise=Promise.resolve();this.discoveredKernelSpecFiles=new Set;this.lastKnownGlobalPythonKernelSpecs=[];this.interpreterKernelSpecs=new Map;this.globalPythonKernelSpecFinder=new oT(this.interpreterService,this.kernelSpecsFromKnownLocations,this.extensionChecker,u),this.disposables.push(this._onDidChangeKernels),t.onDidChangeInterpreters(()=>{this.refreshCancellation?.cancel(),this.refreshData().catch(h)},this,this.disposables),t.onDidRemoveInterpreter(async p=>{if(await Ei(1e3),Tr(p))return;d.debug(`Interpreter removed ${p.id}`);let f=[];this._kernels.forEach(g=>{g.interpreter?.id===p.id&&(d.debug(`Interpreter ${p.id} deleted, hence deleting corresponding kernel ${g.kind}:'${g.id}`),f.push(g),this._kernels.delete(g.id))}),f.length&&(d.debug(`Local Python connection deleted ${f.map(g=>`${g.kind}:'${g.id}: (interpreter id=${en(g.interpreter?.id)})'`)}`),this.updateCache().catch(h))},this,this.disposables)}activate(){this.listKernelsFirstTimeFromMemento(GF()).then(t=>{t.length&&(t.filter(n=>!this._kernels.has(n.id)).forEach(n=>{this._kernelsFromCache.push(n),this._kernels.set(n.id,n)}),this._onDidChangeKernels.fire())}).finally(async()=>{this.refreshCancellation?.cancel(),this.refreshData().catch(h),this.kernelSpecsFromKnownLocations.onDidChangeKernels(()=>{let t=this.lastKnownGlobalPythonKernelSpecs,n=this.listGlobalPythonKernelSpecsIncludingThoseRegisteredByUs();(t.length!==n.length||!pa(t,n))&&(this.refreshCancellation?.cancel(),this.refreshData().catch(h))},this,this.disposables)}).catch(h)}get kernels(){return Array.from(this._kernels.values())}dispose(){z(this.disposables)}async refresh(){this.globalPythonKernelSpecFinder.clear(),this.clearCache(),this.cachedInformationForPythonInterpreter.clear(),this.discoveredKernelSpecFiles.clear(),this.interpreterService.refreshInterpreters(!0).catch(h),await this.refreshData(!0)}refreshData(t=!1){if(!t&&this.refreshCancellation&&!this.refreshCancellation.token.isCancellationRequested&&this.previousRefresh)return this.previousRefresh;this.refreshCancellation?.cancel(),this.refreshCancellation?.dispose();let n=this.refreshCancellation=new zH.CancellationTokenSource,i=(async()=>{if(await this.listKernelsImplementation(n.token,t).catch(o=>d.error("Failure in listKernelsImplementation",o)),!n.token.isCancellationRequested){if(this.interpreterService.status==="idle"){let o=this._kernelsFromCache.filter(c=>!this._kernelsExcludingCachedItems.has(c.id)),s=[];o.length&&(d.warn(`Kernels ${o.map(c=>`${c.kind}:'${c.id}'`).join(", ")} found in cache but not discovered in current session ${Array.from(this._kernelsExcludingCachedItems.values()).map(c=>`${c.kind}:'${c.id}'`).join(", ")}`),o.forEach(c=>{this._kernels.delete(c.id),s.push(c)}));let a=new Set(ho().map(c=>c.id)),l=Array.from(this._kernels.values()).filter(c=>!!(c.interpreter&&!a.has(c.interpreter.id)));l.length&&(d.warn(`The following kernels use interpreters that are no longer valid or not recognized by Python extension, Kernels ${l.map(c=>`${c.kind}:'id=${c.id}'(interpreterId='${en(c.interpreter?.id)}')`).join(",")} and valid interpreter ids include ${Array.from(a).join(", ")}`),l.forEach(c=>{this._kernels.delete(c.id),s.push(c)})),s.length&&(d.debug(`Local Python connection deleted ${s.map(c=>`${c.kind}:'${c.id}: (interpreter id=${en(c.interpreter?.id)})'`)}`),await this.updateCache())}t&&(this._kernelsFromCache=[])}})().catch(o=>d.error("Failed to discover kernels in interpreters",o)).finally(()=>{n===this.refreshCancellation&&(this.refreshCancellation?.cancel(),this.refreshCancellation?.dispose(),this.refreshCancellation=void 0)});return this.previousRefresh=i,this.promiseMonitor.push(i),i}async updateCache(){this._onDidChangeKernels.fire();let t=Array.from(this._kernels.values());return this.updateCachePromise=this.updateCachePromise.finally(()=>this.writeToMementoCache(t,GF())),this.updateCachePromise}async listKernelsImplementation(t,n){let i=this.extensionChecker.isPythonExtensionInstalled?ho():[],o=Promise.all(i.map(async a=>{let l=this.interpreterKernelSpecs.get(a.id);l||(l=new iT(Ai(a),this.interpreterService,this.jupyterPaths,this.extensionChecker,this.kernelSpecFinder),this.disposables.push(l),this.interpreterKernelSpecs.set(a.id,l),l.onDidChangeKernels(c=>{c.removed.forEach(u=>this._kernels.delete(u.id)),this.appendNewKernels(c.added),!c.added.length&&c.removed.length&&this.updateCache()},this,this.disposables)),await nr(t,[],l.listKernelSpecs(n))})),s=nr(t,[],this.globalPythonKernelSpecFinder.listKernelSpecs(n)).then(a=>this.appendNewKernels(a));await Promise.all([o,s])}async appendNewKernels(t){if(t.length)return t.forEach(n=>{ht(n)&&n.kernelSpec.specFile?(this._kernelsExcludingCachedItems.set(n.id,n),this._kernels.has(n.id)?this._kernels.set(n.id,n):this._kernels.set(n.id,n)):d.warn(`Found a kernel ${n.kind}:'${n.id}', but excluded as specFile is undefined`)}),this.updateCache()}listGlobalPythonKernelSpecs(t){return this.kernelSpecsFromKnownLocations.kernels.filter(i=>i.kernelSpec.language===ye).filter(i=>t?!0:!Vn(i.kernelSpec))}listGlobalPythonKernelSpecsIncludingThoseRegisteredByUs(){return this.lastKnownGlobalPythonKernelSpecs=this.listGlobalPythonKernelSpecs(!0)}};vu=y([(0,No.injectable)(),m(0,(0,No.inject)(rt)),m(1,(0,No.inject)(mr)),m(2,(0,No.inject)(jr)),m(3,(0,No.inject)($e)),m(4,(0,No.inject)(as)),m(5,(0,No.inject)(Ve)),m(5,(0,No.named)(ci)),m(6,(0,No.inject)(O)),m(7,(0,No.inject)(Ol)),m(8,(0,No.inject)(gd))],vu);var bf=class extends Yn{constructor(t,n,i,o,s,a){super();this.nonPythonKernelFinder=t;this.pythonKernelFinder=n;this.disposables=o;this.extensionChecker=s;this.interpreters=a;this._status="idle";this._onDidChangeStatus=new UC.EventEmitter;this.onDidChangeStatus=this._onDidChangeStatus.event;this.promiseMonitor=new vo;this.kind="localKernelSpec";this.id="localKernelSpec";this.displayName=I.localKernelSpecs;this._onDidChangeKernels=new UC.EventEmitter;this.onDidChangeKernels=this._onDidChangeKernels.event;this.wasPythonInstalledWhenFetchingControllers=!1;this.cache=[];this.disposables.push(this),i.registerKernelFinder(this),this.disposables.push(this._onDidChangeStatus),this.disposables.push(this._onDidChangeKernels),this.disposables.push(this.promiseMonitor)}get status(){return this._status}set status(t){this._status!==t&&(this._status=t,this._onDidChangeStatus.fire())}activate(){this.promiseMonitor.onStateChange(()=>{this.status=this.promiseMonitor.isComplete&&this.interpreters.status==="idle"&&this.nonPythonKernelFinder.status==="idle"&&this.pythonKernelFinder.status==="idle"?"idle":"discovering"}),this.updateCache();let t,n=()=>{[this.nonPythonKernelFinder.status,this.pythonKernelFinder.status,this.interpreters.status==="refreshing"?"discovering":"idle"].includes("discovering")?t||(t=oe(),this.promiseMonitor.push(t.promise)):(t?.resolve(),t=void 0)};n(),this.nonPythonKernelFinder.onDidChangeStatus(n,this,this.disposables),this.pythonKernelFinder.onDidChangeStatus(n,this,this.disposables),this.interpreters.onDidChangeStatus(n,this,this.disposables),this.updateCache(),this.interpreters.onDidChangeInterpreters(this.updateCache,this,this.disposables),UC.extensions.onDidChange(()=>{!this.wasPythonInstalledWhenFetchingControllers&&this.extensionChecker.isPythonExtensionInstalled&&this.updateCache()},this,this.disposables),this.nonPythonKernelFinder.onDidChangeKernels(this.updateCache,this,this.disposables),this.pythonKernelFinder.onDidChangeKernels(this.updateCache,this,this.disposables),this.wasPythonInstalledWhenFetchingControllers=this.extensionChecker.isPythonExtensionInstalled}async refresh(){let t=(async()=>{await this.nonPythonKernelFinder.refresh(),await this.pythonKernelFinder.refresh(),this.updateCache()})();this.promiseMonitor.push(t),await t}updateCache(){try{let t=[],n=this.nonPythonKernelFinder.kernels.filter(o=>this.extensionChecker.isPythonExtensionInstalled?o.kernelSpec.language!==ye:!0),i=this.pythonKernelFinder.kernels.filter(o=>Ig(o));t=t.concat(n).concat(i),this.writeToCache(t)}catch(t){d.error("Exception Saving loaded kernels",t)}}get kernels(){let t=new Set,n=[];return this.pythonKernelFinder.kernels.forEach(i=>{let o=Vn(i.kernelSpec);i.kernelSpec.specFile&&o==="registeredByNewVersionOfExtForCustomKernelSpec"&&(t.add(i.kernelSpec.specFile),n.push(i))}),this.cache.forEach(i=>{i.kernelSpec.specFile&&t.has(i.kernelSpec.specFile)||n.push(i)}),n}writeToCache(t){let n=new Set;t=t.filter(u=>n.has(u.id)?!1:(n.add(u.id),!0));let i=this.cache,o=new Map(i.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),a=t.filter(u=>!o.has(u.id)),l=t.filter(u=>o.has(u.id)&&!pa(u,o.get(u.id))),c=i.filter(u=>!s.has(u.id));this.cache=t,(a.length||l.length||c.length)&&this._onDidChangeKernels.fire({removed:c})}};y([Vh("List kernels failed")],bf.prototype,"updateCache",1),bf=y([(0,yu.injectable)(),m(0,(0,yu.inject)(as)),m(1,(0,yu.inject)(vu)),m(2,(0,yu.inject)(Rr)),m(3,(0,yu.inject)(O)),m(4,(0,yu.inject)($e)),m(5,(0,yu.inject)(rt))],bf);var Gy=P(M());var jC=require("vscode"),YH=require("os");function QH(r){let e=Be(r);return!!(XH(r)&&(e==="Unknown"||e==="Pyenv"||e==="Conda"))}function XH(r){let e=Yi(r)?.major??3,t=Yi(r)?.minor??6;return e>=3&&t>=6}var bu=class{constructor(e,t,n){this.pythonExecutionFactory=e;this.disposableRegistry=t;this.context=n;this.messages=new Map;this.requestCounter=0}async createInterrupter(e,t){try{return await this.createInterrupterImpl(e,t)}catch(n){return d.error("Failed to create interrupter, trying again",n),this.createInterrupterImpl(e,t)}}async createInterrupterImpl(e,t){let n=await this.sendCommand({command:"INITIALIZE_INTERRUPT"},e,t);if(!n)throw d.error("Unable to initialize interrupt handle"),new Error("Unable to initialize interrupt handle");return{handle:n,interrupt:async()=>{await this.sendCommand({command:"INTERRUPT",handle:n},e,t)},dispose:()=>{this.sendCommand({command:"DISPOSE_INTERRUPT_HANDLE",handle:n},e,t).catch(i=>d.error(`Failed to dispose interrupt handle for ${e.id}`,i))}}}async getInterpreter(e){if(e&&QH(e))return e;let t=ho();return t.length===0?e:Ai(t.find(QH))||Ai(t.find(XH))||e}async initializeInterrupter(e,t){if(this.startupPromise)return this.startupPromise;let n=(async()=>{let i=await this.getInterpreter(e),o=await this.pythonExecutionFactory.createActivatedEnvironment({interpreter:i,resource:t}),s=jC.Uri.joinPath(this.context.extensionUri,"pythonFiles","vscode_datascience_helpers"),a=jC.Uri.joinPath(s,"kernel_interrupt_daemon.py"),l=o.execObservable([a.fsPath,"--ppid",process.pid.toString()],{cwd:s.fsPath});return await new Promise((c,u)=>{let p=!1,f=l.out.onDidChange(g=>{if(d.ci(`Output from interrupt daemon started = ${p}, output (${g.source}) = ${g.out} ('END)`),g.source==="stdout"&&g.out.trim().includes("DAEMON_STARTED:")&&!p)p=!0,c();else if(g.source==="stderr"&&g.out.includes("INTERRUPT:")&&g.out.includes("ERROR: handling command :INITIALIZE_INTERRUPT:")&&p)Fe(g.out,{trim:!0,removeEmptyEntries:!0}).filter(v=>v.includes("INTERRUPT:")).forEach(v=>{try{let b=v.split(":"),C=parseInt(b[b.indexOf("INITIALIZE_INTERRUPT")+1],10),E=this.messages.get(C);E&&(d.error(`Failed to initialize interrupt daemon for ${C}, ${g.out}`),E.deferred.reject(new Error(`Failed to start interrupt daemon ${g.out}`)),this.messages.delete(C))}catch(b){d.error(`Failed to parse interrupt daemon response, ${g.out}`,b)}});else if(g.source==="stdout"&&g.out.includes("INTERRUPT:")&&p)Fe(g.out,{trim:!0,removeEmptyEntries:!0}).filter(v=>v.includes("INTERRUPT:")).forEach(v=>{try{let[b,C,E]=v.split(":"),R=this.messages.get(parseInt(C,10));R?(d.trace(`Got a response of ${E} for ${b}:${C}`),R.deferred.resolve(E),this.messages.delete(parseInt(C,10))):d.error(`Got a response of ${E} for ${b}:${C} but no command entry found in ${g.out}`)}catch(b){d.error(`Failed to parse interrupt daemon response, ${g.out}`,b)}});else if(g.out.includes("ERROR: handling command")){if(d.warn(`Error output in interrupt daemon response ${g.out} ('END')`),!p)return u(new Error(`Interrupt daemon failed to start, ${g.out}`));try{let v=g.out.split(":")[2],b=this.messages.get(parseInt(v,10));if(b){b.deferred.reject(new Error(g.out)),this.messages.delete(parseInt(v,10));return}}catch(v){d.error(`Failed to parse interrupt daemon response, ${g.out}`,v)}}});this.disposableRegistry.push(f)}),this.disposableRegistry.push(new jC.Disposable(()=>ai(()=>l.proc?.kill()))),l.proc?.on("close",()=>{d.ci("Interrupt daemon closed"),this.startupPromise=void 0}),l.proc?.on("exit",()=>{d.ci("Interrupt daemon exited"),this.startupPromise=void 0}),l})();return n.catch(i=>d.error(`Failed to start interrupt daemon for (${e.id})`,i)),this.startupPromise=n,n}async sendCommand(e,t,n){let i=oe(),o=this.requestCounter++;this.messages.set(o,{command:e,deferred:i});let s=e.command==="INITIALIZE_INTERRUPT"?`${e.command}:${o}`:`${e.command}:${o}:${e.handle}`,{proc:a}=await this.initializeInterrupter(t,n);if(!a||!a.stdin)throw d.error("No process or stdin"),new Error("No process or stdin");a.stdin.write(`${s}${YH.EOL}`),d.ci(`Sending Interrupt Request id=${o}, Command ${e.command} for ${t.id}`);let l=await i.promise;if(d.ci(`Got Interrupt Response id=${o}, Command ${e.command} for ${t.id}`),e.command==="INITIALIZE_INTERRUPT")return parseInt(l,10)}};bu=y([(0,Gy.injectable)(),m(0,(0,Gy.inject)(Ur)),m(1,(0,Gy.inject)(O)),m(2,(0,Gy.inject)(ot))],bu);var sT=P(M());var WC=require("vscode");var oc=class{constructor(e){this.platform=e;this.programData=process.env.PROGRAMDATA?WC.Uri.file(Cn(process.env.PROGRAMDATA)):void 0}get trustedKernelSpecs(){return WC.workspace.getConfiguration("jupyter",void 0).get("kernels.trusted",[])}isTrusted(e){let t=this.isTrustedImpl(e);return!t&&!oc.IsKernelSpecHidden.completed&&oc.IsKernelSpecHidden.resolve(!0),t}isTrustedImpl(e){return e.scheme!=="file"||this.trustedKernelSpecs.map(t=>this.platform.isWindows?t.toLowerCase():t).map(t=>WC.Uri.file(t).path).includes(this.platform.isWindows?e.path.toLowerCase():e.path)?!0:this.platform.isWindows&&this.programData?!e.path.toLowerCase().startsWith(this.programData.path.toLowerCase()):!0}};oc.IsKernelSpecHidden=oe(),oc=y([(0,sT.injectable)(),m(0,(0,sT.inject)(wr))],oc);var aG=P(Wl()),cs=P(M()),lG=P(require("os"));var cG=require("util"),uG=P(To()),IT=require("vscode");var J4=require("process"),$4=P(Wl()),Yy=P(require("os"));var Xy=require("vscode");var H4=P(d4());var V4="To connect another client to this kernel, use:",B4=["NOTE: When using the `ipython kernel` entry point, Ctrl-C will not work.","To exit, you will have to explicitly quit this process, by either sending",'"quit" from a client, or using Ctrl-\\ in UNIX-like environments.',"To read more about this, see https://github.com/ipython/ipython/issues/2049","It seems that frozen modules are being used, which may","make the debugger miss breakpoints. Please pass -Xfrozen_modules=off","to python to disable frozen modules","Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION"],Qy=class extends Yn{constructor(t,n,i,o,s,a,l,c,u,p,f,g,v){super();this.processExecutionFactory=t;this._connection=n;this.fileSystem=o;this.resource=s;this.extensionChecker=a;this.kernelEnvVarsService=l;this.pythonExecFactory=c;this.outputChannel=u;this.jupyterSettings=p;this.jupyterPaths=f;this.pythonKernelInterruptDaemon=g;this.platform=v;this.exitEvent=new Xy.EventEmitter;this.exitEventFired=!1;this._kernelConnectionMetadata=i}get pid(){return this._pid}get exited(){return this.exitEvent.event}get kernelConnectionMetadata(){return this._kernelConnectionMetadata}get connection(){return this._connection}get isPythonKernel(){return vt(this.kernelConnectionMetadata)&&of(this.kernelConnectionMetadata)}get canInterrupt(){return this._kernelConnectionMetadata.kernelSpec.interrupt_mode!=="message"}async interrupt(){if(this.canInterrupt)if(this._kernelConnectionMetadata.kernelSpec.interrupt_mode!=="message"&&this._process&&!this.interrupter)d.info("Interrupting kernel via SIGINT"),this._process.pid&&(0,J4.kill)(this._process.pid,"SIGINT");else{if(this._kernelConnectionMetadata.kernelSpec.interrupt_mode!=="message"&&this._process&&this.interrupter&&vt(this._kernelConnectionMetadata))return d.info("Interrupting kernel via custom event (Win32)"),this.interrupter.interrupt();d.error("No process to interrupt in KernleProcess.ts")}else throw new Error("Kernel interrupt not supported in KernelProcess.ts")}async launch(t,n,i){if(this.launchedOnce)throw new Error("Kernel has already been launched.");this.launchedOnce=!0;let o=Nn(this.resource),s=o?.updateConnection();await this.updateConnectionArgs(),s?.stop(),En.throwIfCanceled(i);let a=o?.spawn(),l=await this.launchAsObservable(t,i);a?.stop();let c=l.proc;if(i.isCancellationRequested)throw new Xy.CancellationError;d.debug(`Kernel process ${c?.pid}.`);let u="",p,f=oe();if(f.promise.catch(h),c){let v=c.pid;c.on("exit",C=>{if(C=C||p,this.isDisposed){d.debug(`KernelProcess Exited ${v}, Exit Code - ${C}`);return}d.debug(`KernelProcess Exited ${v}, Exit Code - ${C}`,u),this.exitEventFired||(this.exitEvent.fire({exitCode:C||void 0,reason:Gh(u)||u,stderr:u}),this.exitEventFired=!0),i.isCancellationRequested||(d.ci("KernelProcessExitedError raised",u),f.reject(new Yl(C||-1,u,this.kernelConnectionMetadata)))});let b=!1;c.stdout?.on("data",C=>{let E=(C||"").toString();vt(this.kernelConnectionMetadata)&&!b&&(E=q4(E),E.includes(V4)&&(E=E.trimStart())),E.includes(V4)&&(b=!0),d.debug(`Kernel output ${v}: ${E}`),this.sendToOutput(E)}),c.stderr?.on("data",C=>{let E=q4((C||"").toString());u+=E,E.trim().length&&!E.includes("It seems that frozen modules are being used, which may")&&!E.includes("make the debugger miss breakpoints. Please pass -Xfrozen_modules=off")&&!E.includes("to python to disable frozen modules")&&!E.includes("Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION")&&(d.debug(`KernelProcess error ${v}: ${E}`),this.sendToOutput(E))})}l.out.done.catch(v=>{if(this.isDisposed){d.warn("Kernel died",v,u);return}d.error("Kernel died",v,u),f.reject(v)});let g=Nn(this.resource)?.portUsage();try{f.rejected&&await f.promise;let v=xe.instance.get(ks).inExperiment("DoNotWaitForZmqPortsToBeUsed"),b=(await Promise.resolve().then(()=>P(W4()))).default,C=new We,E=v?Promise.resolve():Promise.all([b.waitUntilUsed(this.connection.shell_port,200,n),b.waitUntilUsed(this.connection.iopub_port,200,n)]).catch(R=>{if(!(i.isCancellationRequested||f.rejected)&&(d.warn(`Waited ${C.elapsedTime}ms for kernel to start`,R),!v))return Promise.reject(new sy(this.kernelConnectionMetadata))});await ir(i,E,f.promise)}catch(v){let b=(u||"").trim();if(!i?.isCancellationRequested&&!pr(v)&&(d.error("Disposing kernel process due to an error",v),v&&v instanceof Error&&b.length&&v.message.includes(b)||d.error(b)),await this.dispose(),!i?.isCancellationRequested&&v instanceof ze)throw v;{i?.isCancellationRequested&&d.debug("User cancelled the kernel launch");let C=XE(b)||b.substring(0,100);throw d.ci("KernelDiedError raised",C,u+`
|
||
`+u+`
|
||
`),new id(I.kernelDied(C),u+`
|
||
`+u+`
|
||
`,v,this.kernelConnectionMetadata)}}finally{g?.stop()}}dispose(){if(this._disposingPromise||this.isDisposed)return;let t=this._process?.pid;d.debug(`Dispose Kernel process ${t}.`),this._disposingPromise=(async()=>{await br(1e3,this.killChildProcesses(this._process?.pid).catch(h));try{this.interrupter?.dispose(),this._process?.kill(),this.exitEventFired||this.exitEvent.fire({stderr:""})}catch(n){d.error(`Error disposing kernel process ${t}`,n)}this.connectionFile&&await this.fileSystem.delete(this.connectionFile).catch(n=>d.warn(`Failed to delete connection file ${this.connectionFile} for pid ${t}`,n)),d.debug(`Disposed Kernel process ${t}.`)})(),this._disposingPromise.finally(()=>super.dispose()).catch(h)}async killChildProcesses(t){if(!(!t||!Bl.isAlive(t)))try{if(this.platform.isWindows){let n=process.env.WINDIR||"C:\\Windows",i=je(n,"System32","taskkill.exe");await new Bl().exec(i,["/F","/T","/PID",t.toString()])}else await new Promise(n=>{(0,H4.default)(t,(i,o)=>{i?d.warn(`Failed to kill children for ${t}`,i):o.forEach(s=>Bl.kill(s)),n()})})}catch(n){d.warn(`Failed to kill children for ${t}`,n)}}sendToOutput(t){this.outputChannel&&this.outputChannel.append(t)}get launchKernelSpec(){if(this._launchKernelSpec)return this._launchKernelSpec;let t=this._kernelConnectionMetadata.kernelSpec;if(!t)throw new Error("KernelSpec cannot be empty in KernelProcess.ts");return Array.isArray(t.argv)?this._launchKernelSpec={...t,argv:[...t.argv]}:(d.error("KernelSpec.argv in KernelProcess is undefined"),this._launchKernelSpec=void 0),this._launchKernelSpec}async updateConnectionArgs(){let t=B9(this.launchKernelSpec);if(t===-1)throw new Error(`Connection file not found in kernelspec json args, ${this.launchKernelSpec.argv.join(" ")}`);if(this.isPythonKernel&&t===0&&this.launchKernelSpec.argv[t-1]!=="-f")throw new Error(`Connection file not found in kernelspec json args, ${this.launchKernelSpec.argv.join(" ")}`);if(this.connectionFile=await this.createConnectionFile(),this.isPythonKernel)this.launchKernelSpec.argv.splice(t-1,2),this.launchKernelSpec.argv.push(...this.addPythonConnectionArgs(this.connectionFile)),await this.fileSystem.writeFile(this.connectionFile,JSON.stringify(this._connection));else{await this.fileSystem.writeFile(this.connectionFile,JSON.stringify(this._connection));let n=this.connectionFile.fsPath.includes(" ")?`"${this.connectionFile.fsPath}"`:this.connectionFile.fsPath;this.launchKernelSpec.argv[t].includes("--connection-file")?this.launchKernelSpec.argv[t]=this.launchKernelSpec.argv[t].replace(Pm,n):this.launchKernelSpec.argv[t].includes(`=${Pm}`)&&!this.launchKernelSpec.argv[t].trim().startsWith("=")?this.launchKernelSpec.argv[t]=this.launchKernelSpec.argv[t].replace(Pm,n):this.launchKernelSpec.argv[t]=this.launchKernelSpec.argv[t].replace(Pm,this.connectionFile.fsPath)}}async createConnectionFile(){let t=await this.jupyterPaths.getRuntimeDir(),n=await this.fileSystem.createTemporaryLocalFile({fileExtension:".json",prefix:"kernel-v2-"}),i=t?je(t.fsPath,Ee(n.filePath)):n.filePath;return await n.dispose(),Xy.Uri.file(i)}addPythonConnectionArgs(t){let n=[],i=t.fsPath.includes(" ")?`"${t.fsPath}"`:t.fsPath;return n.push(`--f=${i}`),n}async launchAsObservable(t,n){let i;if(d.debug(`Launching kernel ${this.kernelConnectionMetadata.id} for ${B(this.resource)} in ${B(t)} with ports ${this.connection.control_port}, ${this.connection.hb_port}, ${this.connection.iopub_port}, ${this.connection.shell_port}, ${this.connection.stdin_port}`),this.isPythonKernel&&this.extensionChecker.isPythonExtensionInstalled&&this._kernelConnectionMetadata.interpreter){let o=Nn(this.resource),[s,a,l]=[o?.pythonEnvVars(),o?.envVars(),Yy.platform()==="win32"?o?.interruptHandle():void 0],c=this.pythonExecFactory.createActivatedEnvironment({resource:this.resource,interpreter:this._kernelConnectionMetadata.interpreter}),u=Yy.platform()==="win32"?this.getWin32InterruptHandle().finally(()=>l?.stop()):l?.stop(),[p,f,g]=await Promise.all([c.finally(()=>s?.stop()),$4.pathExists(t),this.kernelEnvVarsService.getEnvironmentVariables(this.resource,this._kernelConnectionMetadata.interpreter,this._kernelConnectionMetadata.kernelSpec,n).finally(()=>a?.stop())]);if(En.throwIfCanceled(n),Yy.platform()==="win32"&&u){g=g||process.env;try{let b=await u;g.JPY_INTERRUPT_EVENT=`${b}`,d.ci(`Got interrupt handle kernel id ${b} for interpreter ${this._kernelConnectionMetadata.interpreter.id}`)}catch(b){d.error(`Failed to get interrupt handle kernel id ${this._kernelConnectionMetadata.id} for interpreter ${this._kernelConnectionMetadata.interpreter.id}`,b)}}En.throwIfCanceled(n);let v=this.launchKernelSpec.argv.slice(1);this.jupyterSettings.enablePythonKernelLogging&&v.push("--debug"),i=p.execObservable(v,{cwd:f?t:process.cwd(),env:g}),En.throwIfCanceled(n)}else{let o=this.launchKernelSpec.argv[0];d.info(`Launching Raw Kernel ${this.launchKernelSpec.display_name} # ${o}`);let[s,a]=await Promise.all([this.processExecutionFactory.create(this.resource,n),this.kernelEnvVarsService.getEnvironmentVariables(this.resource,this._kernelConnectionMetadata.interpreter,this.launchKernelSpec,n)]);En.throwIfCanceled(n);let l=this.launchKernelSpec.argv.slice(1);i=s.execObservable(o,l,{env:a,cwd:t})}if(!i.proc)throw new Error("KernelProcess failed to launch");return this._process=i.proc,this._pid=i.proc.pid,i}async getWin32InterruptHandle(){return this.interrupter||(this.interrupter=await this.pythonKernelInterruptDaemon.createInterrupter(this._kernelConnectionMetadata.interpreter,this.resource)),this.interrupter.handle}};y([ur("DS_INTERNAL.RAWKERNEL_PROCESS_LAUNCH")],Qy.prototype,"launch",1),y([m(1,up())],Qy.prototype,"launchAsObservable",1);function q4(r){let e=Fe(r,{trim:!0,removeEmptyEntries:!0});return e.some(t=>t.includes("FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0."))&&e.some(t=>t.trim()==="warn(")&&e.some(t=>t.includes("FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0."))||e.some(t=>B4.some(n=>t.includes(n)))?e.filter(t=>!t.endsWith(`FutureWarning: Supporting extra quotes around strings is deprecated in traitlets 5.0. You can use 'hmac-sha256' instead of '"hmac-sha256"' if you require traitlets >=5.`)&&t.trim()!=="warn("&&!t.includes("FutureWarning: Supporting extra quotes around Bytes is deprecated in traitlets 5.0. Use")&&B4.every(n=>!t.includes(n))).join(Yy.EOL).trimStart():r}var Dye="kernelLauncherPortStart_{0}.tmp",ea=class{constructor(e,t,n,i,o,s,a,l,c,u){this.processExecutionFactory=e;this.fs=t;this.extensionChecker=n;this.kernelEnvVarsService=i;this.disposables=o;this.pythonExecFactory=s;this.configService=a;this.jupyterPaths=l;this.pythonKernelInterruptDaemon=c;this.platformService=u}static async computeStartPort(){if(_r()){let e=9e3,t=0;for(;t===0&&e<65e3;)try{let n=je(lG.tmpdir(),jS(Dye,e.toString()));await aG.open(n,"wx"),t=e}catch{e+=1e3}return d.trace(`Computed port start for KernelLauncher is : ${t}`),t}else return 9e3}async launch(e,t,n,i,o){_ye(n,e,this.pythonExecFactory,o).catch(h);let s=new We,a=Nn(n)?.getConnection(),l=await ir(o,this.getKernelConnection(e));a?.stop();let c=n?Ee(n.fsPath):"",u=this.configService.getSettings(n),p=u.logKernelOutputSeparately||u.development?IT.window.createOutputChannel(I.kernelConsoleOutputChannel(c),"log"):void 0;p?.clear();let f=y_(l.control_port,l.hb_port,l.iopub_port,l.shell_port,l.stdin_port),g=new Qy(this.processExecutionFactory,l,e,this.fs,n,this.extensionChecker,this.kernelEnvVarsService,this.pythonExecFactory,p,u,this.jupyterPaths,this.pythonKernelInterruptDaemon,this.platformService);Ia(g.onDidDispose)(()=>f.dispose(),this,this.disposables),Ia(g.exited)(()=>p?.dispose(),this,this.disposables);try{await ir(o,g.launch(i,t,o))}catch(b){throw await g.dispose(),En.throwIfCanceled(o),b}let v=Ia(g.exited)(({exitCode:b,reason:C})=>{_t(n,"DS_INTERNAL.RAWKERNEL_SESSION_KERNEL_PROCESS_EXITED",b?{exitCode:b}:void 0,{exitReason:Gh(C)}),Xs.delete(l.control_port),Xs.delete(l.hb_port),Xs.delete(l.iopub_port),Xs.delete(l.shell_port),Xs.delete(l.stdin_port),v.dispose()},this,this.disposables);if(o?.isCancellationRequested)throw await g.dispose(),new IT.CancellationError;return A("DS_INTERNAL.KERNEL_LAUNCHER_PERF",{duration:s.elapsedTime},{resourceType:Zi(n)}),g}async chainGetConnectionPorts(){return this.portChain&&await this.portChain,this.portChain=this.getConnectionPorts(),this.portChain}static async findNextFreePort(e){let n=await(0,cG.promisify)((await Promise.resolve().then(()=>P(sG()))).getPorts)(5,{host:"127.0.0.1",port:e});if(n.some(i=>Xs.has(i))){let i=Math.max(...Xs,...n);return ea.findNextFreePort(i)}return n.forEach(i=>Xs.add(i)),n}async getConnectionPorts(){let e=await ea.startPortPromise;return ea.findNextFreePort(e)}async getKernelConnection(e){let t=await this.chainGetConnectionPorts();return{key:(0,uG.default)(),signature_scheme:"hmac-sha256",transport:"tcp",ip:"127.0.0.1",hb_port:t[0],control_port:t[1],shell_port:t[2],stdin_port:t[3],iopub_port:t[4],kernel_name:e.kernelSpec?.name||"python"}}};ea.startPortPromise=ea.computeStartPort(),ea=y([(0,cs.injectable)(),m(0,(0,cs.inject)(Fi)),m(1,(0,cs.inject)(mr)),m(2,(0,cs.inject)($e)),m(3,(0,cs.inject)(Ta)),m(4,(0,cs.inject)(O)),m(5,(0,cs.inject)(Ur)),m(6,(0,cs.inject)(le)),m(7,(0,cs.inject)(jr)),m(8,(0,cs.inject)(bu)),m(9,(0,cs.inject)(wr))],ea);async function _ye(r,e,t,n){let i=e.interpreter;if(!ht(e)||!vt(e)||!i)return;let s=await(await t.createActivatedEnvironment({interpreter:i,resource:r})).exec(["-c",'import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)'],{token:n});if(n.isCancellationRequested)return;let a=B(i.uri);if(s.stdout){let l=s.stdout.trim().split("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d").map(c=>c.trim()).filter(c=>c.length>0);l.length===2?d.trace(`ipykernel version & path ${l[0]}, ${s8(l[1])} for ${a}`):d.trace(`ipykernel version & path ${s.stdout.trim()} for ${a}`)}if(s.stderr){let l=Fe(s.stderr.trim(),{removeEmptyEntries:!0,trim:!0}).map((c,u)=>u===0?c:` ${c}`).join(`
|
||
`);d.warn(`Stderr output when getting ipykernel version & path ${l} for ${a}`)}}var Su=P(require("vscode"));var rb=P(M());var pG=require("vscode"),ST=class extends Ny{constructor(t,n,i){super("localRaw",t);this.resource=n;this.kernelConnectionMetadata=i;this.shutdownInProgress=!1;this._register(new pG.Disposable(()=>this.session.dispose())),this.initializeKernelSocket()}get status(){return this.terminatingStatus&&!this.isDisposed?this.terminatingStatus:this.isDisposed?"dead":this.session.kernel?this.session.kernel.status:(d.ci(`Real kernel is ${this.session.kernel?"defined":"undefined"}`),"unknown")}dispose(){this.shutdown().finally(()=>super.dispose())}async waitForIdle(t,n){try{await Ay(this.kernelConnectionMetadata,this.resource,this.session,t,n)}catch(i){throw d.ci("Error waiting for idle",i),await this.shutdown().catch(h),i}}async shutdown(){if(this.isDisposed||this.shutdownInProgress)return;this.shutdownInProgress=!0,this.terminatingStatus="terminating",this.statusChanged.emit("terminating");let t=`${this.session.kernel?.id}, ${this.kernelConnectionMetadata?.id}`;d.debug(`Shutdown session ${t} - start called from ${new Error("").stack}`),Ry(this.session.kernel),await br(1e3,this.session.shutdown().catch(h)),this.didShutdown.fire(),this.dispose(),d.debug(`Shutdown session ${t} - shutdown complete`)}};var Oa=P(F_()),xG=P(To());var PT=P(To());var kT=P(hG()),SG=P(To());var Iu=P(Wl());var CT=P(require("os"));var gG=P(Wl()),sL=P(require("os"));var Nye=["AlmaLinux","Alt","Amazon","Arch","ArchLinux","Asahi","Asahi Linux","Asianux","Alpine","Berry","BlackArch","BlackArch Linux","Cent","CentOS","Clear","Clear Linux","Clear","ClearOS","Debian","Elementary","Endeavour","EndeavourOS","Easy","EasyOS","Fedora","Fermi","Fuduntu","FreeBSD","Gecko","Gentoo","Kali","KDE","Knoppix","Kubuntu","Linux","LinuxMint","Mageia","Manjaro","Mint","Miracle","MX","MX Linux","Navy","Navy Linux","Nitrux","NixOS","openSUSE","Oracle","Pop!_OS","RasPiOS","Raspbian","Red Hat Enterprise Linux","Red Hat Linux","Red Hat","Rocks","Rocky","Rocky Linux","Rosa","Scientific","Scientific Linux","Slackware","SmartOS","SUSE","SUSE Linux","SUSE Liberty Linux","Ubuntu","VZLinux","Xubuntu","Zorin"],Mye=new RegExp(/^[0-9 .]*$/);async function vG(){let r={id:"",version_id:""};if(sL.platform()==="darwin"||sL.platform()==="win32")return r;try{let e=await gG.readFile("/etc/os-release","utf-8");Fe(e).forEach(t=>{let n=t.toUpperCase().trim().startsWith("ID="),i=t.toUpperCase().trim().startsWith("VERSION_ID=");if(n||i){let o=t.substring(t.indexOf("=")+1).replace(/"/g,"").toUpperCase();if(n)r.id=Nye.filter(s=>o.includes(s.toUpperCase())).join(", ");else{let s=parseFloat(o)||"";r.version_id=Mye.test(o)?o:s.toString()}}})}catch(e){d.error("Failed to read distro info",e)}return r}var Oye="zeromq";function wT(){try{let r=require(Oye);return r.context.blocky=!1,aL(!1).catch(h),r}catch(r){try{let e=require(je(Xo,"dist","node_modules","zeromqold"));return d.info("ZMQ loaded via fallback mechanism."),aL(!1,!0,r.message||r.toString()).catch(h),e}catch(e){throw aL(!0,!0,r.message||r.toString(),e.message||e.toString()).catch(h),d.warn("Exception while attempting zmq :",r.message||r),d.warn("Exception while attempting zmq (fallback) :",e.message||e),e}}}async function Kye(){try{let r=je(Xo,"dist","node_modules","zeromq","prebuilds");if(!await Iu.pathExists(je(Xo,"dist","node_modules")))return;let e=await Iu.readdir(r).then(n=>n.map(async i=>{let o=je(r,i);return(await Iu.stat(o)).isDirectory()?Iu.readdir(o).then(a=>a.map(l=>je(o,l))):[]}));return(await Promise.all(e.flat())).flat().map(n=>n.substring(n.lastIndexOf("prebuilds")+9+1).replace(/\\/g,"<sep>").replace(/\//g,"<sep>"))}catch(r){return d.warn("Failed to determine local zmq binaries.",r),["Failed to determine local zmq binaries."]}}var yG=!1;async function aL(r,e=!1,t="",n=""){if(yG)return;yG=!0;let[i,o]=await Promise.all([vG().catch(()=>({id:"",version_id:""})),Kye()]),s=Fye();A("DS_INTERNAL.JUPYTER_ZMQ_SUPPORT",void 0,{distro_id:i.id,distro_version_id:i.version_id,failed:r,fallbackTried:e,alpine:s.alpine,libc:s.libc,armv:s.armv,zmqarch:s.zmqarch}),A("DS_INTERNAL.JUPYTER_ZMQ_SUPPORT_FAILURE",void 0,{distro_id:i.id,distro_version_id:i.version_id,failed:r,fallbackTried:e,alpine:s.alpine,libc:s.libc,armv:s.armv,zmqarch:s.zmqarch,errorMessage:t,zmqBinaries:o,fallbackErrorMessage:n})}function bG(r){return r==="linux"&&Iu.existsSync("/etc/alpine-release")}function Fye(){try{let r=process.config&&process.config.variables||{},t=(process.env.npm_config_arch||"").trim()||CT.arch(),n=process.env.npm_config_platform||CT.platform(),i=bG(n),o=process.env.LIBC||(bG(n)?"musl":"glibc"),s=process.env.ARM_VERSION||(t==="arm64"?"8":r.arm_version)||"";return{alpine:i,libc:String(o),armv:String(s),zmqarch:t}}catch(r){return d.warn("Failed to determine platform information used to load zeromq binary.",r),{}}}function Lye(r,e){let t=r.transport==="tcp"?":":"-",n=r[`${e}_port`];if(!n)throw new Error(`Port not found for channel "${e}"`);return`${r.transport}://${r.ip}${t}${n}`}var ET=class{constructor(e,t){this.connection=e;this.serialize=t;this.onopen=h;this.onerror=h;this.onclose=h;this.onmessage=h;this.receiveHooks=[];this.sendHooks=[];this.msgChain=Promise.resolve();this.sendChain=Promise.resolve();this.closed=!1;this.channels=this.generateChannels(e)}dispose(){this.closed||this.close()}close(){this.closed=!0;let e=t=>{try{t.close()}catch(n){d.error("Error during socket shutdown",n)}};e(this.channels.control),e(this.channels.iopub),e(this.channels.shell),e(this.channels.stdin)}emit(e,...t){switch(e){case"message":this.onmessage({data:t[0],type:"message",target:this});break;case"close":this.onclose({wasClean:!0,code:0,reason:"",target:this});break;case"error":this.onerror({error:"",message:"to do",type:"error",target:this});break;case"open":this.onopen({target:this});break;default:break}return!0}send(e,t){this.sendMessage(e,!1)}addReceiveHook(e){this.receiveHooks.push(e)}removeReceiveHook(e){this.receiveHooks=this.receiveHooks.filter(t=>t!==e)}addSendHook(e){this.sendHooks.push(e)}removeSendHook(e){this.sendHooks=this.sendHooks.filter(t=>t!==e)}generateChannel(e,t,n){let i=n();return i.connect(Lye(e,t)),this.processSocketMessages(t,i).catch(o=>d.error(`Failed to read messages from channel ${t}`,o)),i}async processSocketMessages(e,t){for await(let n of t){if(this.closed)break;this.onIncomingMessage(e,n)}}generateChannels(e){let t=wT(),n=(0,SG.default)(),i={iopub:this.generateChannel(e,"iopub",()=>new t.Subscriber({maxMessageSize:-1,receiveHighWaterMark:0})),shell:this.generateChannel(e,"shell",()=>new t.Dealer({routingId:n,sendHighWaterMark:0,receiveHighWaterMark:0,maxMessageSize:-1})),control:this.generateChannel(e,"control",()=>new t.Dealer({routingId:n,sendHighWaterMark:0,receiveHighWaterMark:0,maxMessageSize:-1})),stdin:this.generateChannel(e,"stdin",()=>new t.Dealer({routingId:n,sendHighWaterMark:0,receiveHighWaterMark:0,maxMessageSize:-1}))};return i.iopub.subscribe(),i}onIncomingMessage(e,t){let n=this.closed?{}:kT.decode(t,this.connection.key,this.connection.signature_scheme);n.channel=e,this.receiveHooks.length?this.msgChain=this.msgChain.then(()=>{let i=this.serialize(n);return Promise.all(this.receiveHooks.map(o=>o(i)))}).then(()=>this.fireOnMessage(n,e)):this.msgChain=this.msgChain.then(()=>this.fireOnMessage(n,e))}fireOnMessage(e,t){if(!this.closed)try{jye(e,t),this.onmessage({data:e,type:"message",target:this})}catch(n){d.error(`Failed to handle message in Jupyter Kernel package ${JSON.stringify(e)}`,n)}}sendMessage(e,t){let n=kT.encode(e,this.connection.key,this.connection.signature_scheme);if(!t&&this.sendHooks.length){let i=this.serialize(e);this.sendChain=this.sendChain.then(()=>Promise.all(this.sendHooks.map(o=>o(i,h)))).then(async()=>{try{await this.postToSocket(e.channel,n)}catch(o){d.error(`Failed to write data to the kernel channel ${e.channel}`,n,o)}})}else this.sendChain=this.sendChain.then(()=>{this.postToSocket(e.channel,n)});this.sendChain.catch(h)}postToSocket(e,t){let n=this.channels[e];n?n.send(t).catch(i=>{d.error("Error communicating with the kernel",i)}):d.error(`Attempting to send message on invalid channel: ${e}`)}},Uye=["username","version","session","msg_id","msg_type"],IG={stream:{name:"string",text:"string"},display_data:{data:"object",metadata:"object"},execute_input:{code:"string",execution_count:"number"},execute_result:{execution_count:"number",data:"object",metadata:"object"},error:{ename:"string",evalue:"string",traceback:"object"},status:{execution_state:["string",["starting","idle","busy","restarting","dead"]]},clear_output:{wait:"boolean"},comm_open:{comm_id:"string",target_name:"string",data:"object"},comm_msg:{comm_id:"string",data:"object"},comm_close:{comm_id:"string"},shutdown_reply:{restart:"boolean"}};function jye(r,e){let t=r.header;Uye.forEach(n=>{typeof t[n]!="string"&&(t[n]="")}),typeof r.channel!="string"&&(r.channel=e),r.content||(r.content={}),r.metadata||(r.metadata={}),r.channel==="iopub"&&Wye(r)}function Wye(r){if(r.channel!=="iopub")return;let e=r.header.msg_type;if(e in IG){let t=IG[e];if(t===void 0)return;let n=Object.keys(t),i=r.content;for(let o=0;o<n.length;o++){let s=t[n[o]];Array.isArray(s)||(s=[s]);let a=n[o];if(!(a in i)||typeof i[a]!==s[0])switch(s[0]){case"string":i[a]="";break;case"boolean":i[a]=!1;break;case"object":i[a]={};break;case"number":i[a]=0;break}}}}var yd=P(F_()),bd=require("vscode");var lL,DT=class{constructor(e,t,n,i,o){this.resource=e;this.kernelLauncher=t;this.workingDirectory=n;this.launchTimeout=i;this.kernelConnectionMetadata=o;this.statusChanged=new yd.Signal(this);this.connectionStatusChanged=new yd.Signal(this);this.iopubMessage=new yd.Signal(this);this.unhandledMessage=new yd.Signal(this);this.anyMessage=new yd.Signal(this);this.disposed=new yd.Signal(this);this.id=(0,PT.default)();this.clientId=(0,PT.default)();this.username=(0,PT.default)();this.infoDeferred=oe();this.name=bg(o)||"python3",this.model={name:this.name,id:this.id}}get connectionStatus(){return this.realKernel?this.realKernel.connectionStatus:"connecting"}get serverSettings(){return this.realKernel.serverSettings}get status(){return this.isDisposed||this.hasShutdown?"dead":this.isRestarting?"restarting":this.isShuttingDown?"terminating":this.realKernel?this.realKernel.status:"starting"}get info(){return this.realKernel?this.realKernel.info:this.infoDeferred.promise}get handleComms(){return this.realKernel.handleComms}get isDisposed(){return this._isDisposed||this.realKernel?.isDisposed===!0}async restart(){this.stopHandlingKernelMessages(),this._isDisposed=!1,this.isShuttingDown=!1,this.hasShutdown=!1,this.isRestarting=!0,this.restartToken=new bd.CancellationTokenSource;try{this.statusChanged.emit("restarting"),await this.start(this.restartToken.token)}finally{this.restartToken.dispose()}}async start(e){let t=[],n=kg(e);t.push(n);let i;try{let o=this.kernelProcess;this.kernelProcess=void 0,o?.dispose(),ai(()=>this.socket?.dispose()),ai(()=>this.realKernel?.dispose());let s=this.kernelProcess=await dt.wrapAndReportProgress(this.resource,I.connectingToKernel(ct(this.kernelConnectionMetadata)),()=>this.kernelLauncher.launch(this.kernelConnectionMetadata,this.launchTimeout,this.resource,this.workingDirectory.fsPath,e));if(e.isCancellationRequested)throw new bd.CancellationError;this.hookupKernelProcessExitHandler(s);let a=Bye(this.kernelProcess,this.clientId,this.username,this.model);this.kernelProcess=a.kernelProcess,this.realKernel=a.realKernel,this.socket=a.socket,a.realKernel.info.then(c=>this.infoDeferred.resolve(c),c=>this.infoDeferred.reject(c)),jt(this.kernelProcess.exited)(c=>{i=new Yl(c.exitCode||-1,c.stderr,this.kernelConnectionMetadata),n.cancel()},this,t);let l=setTimeout(()=>n.cancel(),this.launchTimeout);if(t.push({dispose:()=>clearTimeout(l)}),await dt.wrapAndReportProgress(this.resource,I.waitingForJupyterSessionToBeIdle,()=>{let c=Nn(this.resource)?.kernelReady();return Vye(n.token,this.launchTimeout,this.resource,this.kernelConnectionMetadata,a.realKernel).finally(()=>c?.stop())}),i)throw i;if(e.isCancellationRequested)throw new bd.CancellationError;this.startHandleKernelMessages(),this.isRestarting=!1,this.statusChanged.emit(this.status)}catch(o){throw await Promise.all([this.kernelProcess?Rs(this.kernelProcess):Promise.resolve(),this.realKernel?.shutdown().catch(s=>d.warn(`Failed to shutdown kernel, ${this.kernelConnectionMetadata.id}`,s))]),i||(pr(o)&&n.token.isCancellationRequested&&!e.isCancellationRequested?new ef(this.kernelConnectionMetadata):(pr(o)||e.isCancellationRequested?d.debug("Starting of raw session cancelled by user"):d.error(`Failed to connect raw kernel session: ${o}`),o))}finally{z(t)}}hookupKernelProcessExitHandler(e){let t=this.exitHandler;this.exitHandler=void 0,t?.dispose(),this.exitHandler=e.exited(n=>{e!==this.kernelProcess||this.isDisposing||!this.kernelProcess||this.status==="dead"||this.status==="terminating"||(d.error(`Disposing session as kernel process died ExitCode: ${n.exitCode}, Reason: ${n.reason}`),_t(this.resource,"DS_INTERNAL.RAWKERNEL_SESSION_KERNEL_PROCESS_EXITED",n.exitCode?{exitCode:n.exitCode}:void 0,{exitReason:Gh(n.reason)}),this.shutdown().catch(h))},this)}dispose(){this.isDisposed||this.isDisposing||(this.isDisposing=!0,this.shutdown().finally(()=>{this._isDisposed=!0,this.disposed.emit(),yd.Signal.disconnectAll(this)}).catch(h))}async shutdown(){this.isShuttingDown||this.hasShutdown||(this.isShuttingDown=!0,this.restartToken?.cancel(),this.restartToken?.dispose(),Ry(this.realKernel),await(this.kernelProcess?Rs(this.kernelProcess).catch(h):Promise.resolve()),this.socket.dispose(),this.stopHandlingKernelMessages(),this.isShuttingDown=!1,this.hasShutdown=!0,this.isDisposing&&(this._isDisposed=!0),this.statusChanged.emit(this.status),this.connectionStatusChanged.emit("disconnected"))}createComm(e,t){return this.realKernel.createComm(e,t)}hasComm(e){return this.realKernel.hasComm(e)}clone(e){return this}get spec(){if(Ig(this.kernelConnectionMetadata)){let e=JSON.parse(JSON.stringify(this.kernelConnectionMetadata.kernelSpec)),t="resources"in e?e.resources:{};return{...e,resources:t}}return d.error("Fetching kernel spec from raw kernel using JLab API"),this.realKernel.spec}sendShellMessage(e,t,n){return this.realKernel.sendShellMessage(e,t,n)}sendControlMessage(e,t,n){return this.realKernel.sendControlMessage(e,t,n)}reconnect(){throw new Error("Reconnect is not supported for Local Kernels as connections cannot be lost.")}async interrupt(){if(this.kernelProcess?.canInterrupt)return this.kernelProcess?.interrupt();if(this.kernelConnectionMetadata.kernelSpec.interrupt_mode==="message"){d.info("Interrupting kernel with a shell message");let t=require("@jupyterlab/services").KernelMessage.createMessage({msgType:"interrupt_request",channel:"shell",username:this.realKernel.username,session:this.realKernel.clientId,content:{}});await this.realKernel.sendShellMessage(t,!0,!0).done.catch(n=>d.error("Failed to interrupt via a message",n))}else d.error("Kernel interrupt not supported")}requestKernelInfo(){return this.realKernel.requestKernelInfo()}requestComplete(e){return this.realKernel.requestComplete(e)}requestInspect(e){return this.realKernel.requestInspect(e)}requestHistory(e){return this.realKernel.requestHistory(e)}requestExecute(e,t,n){return this.realKernel.requestExecute(e,t,n)}requestDebug(e,t){return this.realKernel.requestDebug(e,t)}requestIsComplete(e){return this.realKernel.requestIsComplete(e)}requestCommInfo(e){return this.realKernel.requestCommInfo(e)}sendInputReply(e){return this.realKernel.sendInputReply(e)}registerCommTarget(e,t){return this.realKernel.registerCommTarget(e,t)}removeCommTarget(e,t){return this.realKernel.removeCommTarget(e,t)}registerMessageHook(e,t){this.realKernel.registerMessageHook(e,t)}removeMessageHook(e,t){this.realKernel.removeMessageHook(e,t)}startHandleKernelMessages(){this.realKernel.anyMessage.connect(this.onAnyMessage,this),this.realKernel.iopubMessage.connect(this.onIOPubMessage,this),this.realKernel.unhandledMessage.connect(this.onUnhandledMessage,this),this.realKernel.statusChanged.connect(this.onStatusChanged,this),this.realKernel.disposed.connect(this.onDisposed,this)}stopHandlingKernelMessages(){this.realKernel.anyMessage.disconnect(this.onAnyMessage,this),this.realKernel.iopubMessage.disconnect(this.onIOPubMessage,this),this.realKernel.unhandledMessage.disconnect(this.onUnhandledMessage,this),this.realKernel.statusChanged.disconnect(this.onStatusChanged,this),this.realKernel.disposed.disconnect(this.onDisposed,this)}onAnyMessage(e,t){this.anyMessage.emit(t)}onIOPubMessage(e,t){this.iopubMessage.emit(t)}onUnhandledMessage(e,t){this.unhandledMessage.emit(t)}onStatusChanged(e,t){this.statusChanged.emit(t)}onDisposed(e){this.disposed.emit()}};async function Vye(r,e,t,n,i){try{d.debug("Waiting for Raw Session to be ready in postStartRawSession"),await ir(r,qye(i,n,e)),d.debug("Successfully waited for Raw Session to be ready in postStartRawSession")}catch(u){throw d.error("Failed waiting for Raw Session to be ready",u),pr(u)||r.isCancellationRequested?new bd.CancellationError:u}d.debug(`Kernel status is '${i?.status}' before requesting kernel info and after ready`);let o=oe(),s=oe(),a=()=>o.resolve(!0);o.promise.catch(h),s.promise.catch(h),i.iopubMessage.connect(a);let l=()=>{let p=require("@jupyterlab/services").KernelMessage.createMessage({msgType:"kernel_info_request",channel:"control",username:i.username,session:i.clientId,content:{}});i.sendControlMessage(p,!0,!0).done.then(()=>s.resolve(!0)).catch(h)},c=()=>{i.requestKernelInfo().then(()=>s.resolve(!0)).catch(h)};try{let u=new We,p=0;for(;u.elapsedTime<e*1e3;){p+=1;try{d.debug("Sending request for kernelInfo"),l(),c(),await ir(r,Promise.all([o.promise,s.promise]),Ei(Math.min(e,500)).then(h))}catch(f){throw d.error("Failed to request kernel info",f),f}if(o.completed&&s.completed){d.trace("Got response for requestKernelInfo");break}else{d.trace("Did not get a response for requestKernelInfo");continue}}o.completed&&s.completed?d.debug(`Successfully completed postStartRawSession after ${p} attempt(s) in ${u.elapsedTime}ms`):d.warn(`Didn't get response for requestKernelInfo after ${p} attempt(s) in ${u.elapsedTime}ms.`),_t(t,"DS_INTERNAL.RAWKERNEL_INFO_RESPONSE",{duration:u.elapsedTime,attempts:p},{timedout:!o.completed||!s.completed})}finally{i.iopubMessage.disconnect(a)}}function Bye(r,e,t,n){let i=require("@jupyterlab/services"),o=require("@jupyterlab/services/lib/kernel/serialize"),s;class a extends ET{constructor(){super(r.connection,o.serialize),s=this}}let l=i.ServerConnection.makeSettings({WebSocket:a,wsUrl:"RAW"});lL||(lL=require("@jupyterlab/services/lib/kernel/nonSerializingKernel"));let c=new lL.KernelConnection({serverSettings:l,clientId:e,handleComms:!0,username:t,model:n});return bd.workspace.getConfiguration("jupyter").get("enablePythonKernelLogging",!1)&&c.anyMessage.connect((u,p)=>{d.trace(`[AnyMessage Event] [${p.direction}] [${r.pid}] ${JSON.stringify(p.msg)}`)}),oo.set(c.id,s),s.emit("open"),{realKernel:c,socket:s,kernelProcess:r}}async function qye(r,e,t){d.debug(`Waiting for Raw session to be ready, status: ${r.connectionStatus}`);let n=oe(),i=(s,a)=>{a=="connected"?(d.trace("Raw session connected"),n.resolve(a)):d.trace(`Raw session not connected, status: ${a}`)};r.connectionStatusChanged.connect(i),r.connectionStatus==="connected"&&(d.trace("Raw session connected"),n.resolve(r.connectionStatus));let o=await br(t,n.promise);if(r.connectionStatusChanged.disconnect(i),d.debug(`Waited for Raw session to be ready & got status: ${o}`),o!=="connected")throw new ef(e)}var _T=class{constructor(e,t,n,i,o,s){this.resource=e;this.kernelConnectionMetadata=i;this.type=s;this.isDisposed=!1;this.statusChanged=new Oa.Signal(this);this.kernelChanged=new Oa.Signal(this);this.terminated=new Oa.Signal(this);this.iopubMessage=new Oa.Signal(this);this.unhandledMessage=new Oa.Signal(this);this.anyMessage=new Oa.Signal(this);this.disposed=new Oa.Signal(this);this.connectionStatusChanged=new Oa.Signal(this);this.propertyChanged=new Oa.Signal(this);this._didShutDownOnce=!1;this.id=(0,xG.default)(),this.name=bg(this.kernelConnectionMetadata)||"python3",this.path=this.resource?.fsPath||this.kernelConnectionMetadata.interpreter?.uri.fsPath||"kernel_path",this._kernel=new DT(e,t,n,o,i),this._kernel.statusChanged.connect(this.onKernelStatus,this),this._kernel.iopubMessage.connect(this.onIOPubMessage,this),this._kernel.connectionStatusChanged.connect(this.onKernelConnectionStatus,this),this._kernel.unhandledMessage.connect(this.onUnhandledMessage,this),this._kernel.anyMessage.connect(this.onAnyMessage,this),this._kernel.disposed.connect(this.onDisposed,this)}get connectionStatus(){return this._kernel?.connectionStatus||"disconnected"}get serverSettings(){return require("@jupyterlab/services").ServerConnection.makeSettings({wsUrl:"RAW"})}get model(){return{id:this.id,name:this.name,path:this.path,type:"notebook",kernel:{id:this._kernel?.id,name:this.name}}}get status(){return this.isDisposed?"dead":this.isTerminating?"terminating":this.kernel?.status??"unknown"}get kernel(){return this._kernel}async startKernel(e){await io(this.resource,{kernelConnection:this.kernelConnectionMetadata}),await this._kernel.start(e.token)}dispose(){this._isDisposing=!0;let e=new Error().stack;_t(this.resource,"DS_INTERNAL.RAWKERNEL_SESSION_DISPOSED",void 0,{stacktrace:e});try{this._kernel.statusChanged.disconnect(this.onKernelStatus,this),this._kernel.iopubMessage.disconnect(this.onIOPubMessage,this),this._kernel.connectionStatusChanged.disconnect(this.onKernelConnectionStatus,this),this._kernel.unhandledMessage.disconnect(this.onUnhandledMessage,this),this._kernel.anyMessage.disconnect(this.onAnyMessage,this),this._kernel.disposed.disconnect(this.onDisposed,this)}catch{}this.shutdown().catch(h).finally(()=>{this._kernel.dispose(),this.isDisposed=!0,this.disposed.emit(),Oa.Signal.disconnectAll(this)})}async shutdown(){this._didShutDownOnce||(this._didShutDownOnce=!0,this.isTerminating=!0,this.statusChanged.emit("terminating"),await this._kernel.shutdown().catch(e=>d.warn(`Failed to shutdown kernel, ${this.kernelConnectionMetadata.id}`,e)),this.isTerminating=!1,this._isDisposing&&(this.isDisposed=!0),this.terminated.emit(),this.statusChanged.emit(this.status))}onKernelStatus(e,t){d.ci(`RawSession status changed to ${t}`),this.statusChanged.emit(t)}setPath(e){throw new Error("Not yet implemented")}setName(e){throw new Error("Not yet implemented")}setType(e){throw new Error("Not yet implemented")}changeKernel(e){throw new Error("Not yet implemented")}onIOPubMessage(e,t){this.iopubMessage.emit(t)}onAnyMessage(e,t){this.anyMessage.emit(t)}onUnhandledMessage(e,t){this.unhandledMessage.emit(t)}onKernelConnectionStatus(e,t){this.connectionStatusChanged.emit(t)}onDisposed(e){this.disposed.emit()}};var tb=class{constructor(e,t,n){this.configService=e;this.kernelLauncher=t;this.fs=n}async create(e){d.trace(`Creating raw notebook for resource '${B(e.resource)}'`);let t,n=Nn(e.resource)?.computeCwd(),[i,o]=await Promise.all([ir(e.token,gC(e.resource).then(a=>Su.Uri.file(a))),ht(e.kernelConnection)?ir(e.token,Jye(e.resource,this.configService,this.fs).then(a=>a?Su.Uri.file(a):void 0)):void 0,ir(e.token,io(e.resource,{kernelConnection:e.kernelConnection}))]);n?.stop();let s=this.configService.getSettings(e.resource).jupyterLaunchTimeout;t=new _T(e.resource,this.kernelLauncher,o||i,e.kernelConnection,s,(e.resource?.path||"").toLowerCase().endsWith(".ipynb")?"notebook":"console");try{await ir(e.token,t.startKernel(e))}catch(a){throw pr(a)||e.token.isCancellationRequested?d.debug("Starting of raw session cancelled by user"):d.error(`Failed to connect raw kernel session: ${a}`),t?.shutdown().catch(l=>d.error(`Failed to dispose of raw session on launch error: ${l} `)).finally(()=>t?.dispose()).catch(h),a}return new ST(t,e.resource,e.kernelConnection)}};tb=y([(0,rb.injectable)(),m(0,(0,rb.inject)(le)),m(1,(0,rb.inject)(t_)),m(2,(0,rb.inject)(st))],tb);async function Jye(r,e,t){let n=await $ye(r,e,t);if(n&&await t.exists(n))return n.fsPath;if(r&&r.scheme!=="untitled"&&await t.exists(r)&&(n=Su.Uri.file(wk(De(n),r,e.getSettings(r))),n&&await t.exists(n)))return n.fsPath}async function $ye(r,e,t){let n,i=e.getSettings(r),o=YJ(i.notebookFileRoot);if(o&&Su.workspace.workspaceFolders?.length){let s=Su.Uri.file(o),a=Su.workspace.workspaceFolders[0].uri;if(lE(o))await t.exists(s)?n=s:n=a;else if(o.includes("${"))n=s;else{let l=Su.Uri.joinPath(a,o);await t.exists(l)?n=l:n=a}}return n}var TT=P(M());var nb=class{constructor(e){this.configuration=e}get isSupported(){return this.isSupportedForLocalLaunch()}isSupportedForLocalLaunch(){return!this.isZQMDisabled()&&this.zmqSupported()}isZQMDisabled(){return this.configuration.getSettings().disableZMQSupport}zmqSupported(){if(typeof this._isSupported=="boolean")return this._isSupported;if((process.env.VSC_JUPYTER_NON_RAW_NATIVE_TEST||"").toLowerCase()==="true")return!1;try{wT(),this._isSupported=!0}catch{this._isSupported=!1}return this._isSupported}};nb=y([(0,TT.injectable)(),m(0,(0,TT.inject)(le))],nb);var xu=P(M()),CG=require("vscode");var kn=Symbol("IJupyterVariables"),RT=Symbol("IKernelVariableRequester"),AT=Symbol("IJupyterVariablesProvider");var Sf=class{constructor(e,t,n){this.kernelVariables=t;this.debuggerVariables=n;this.refreshEventEmitter=new CG.EventEmitter;e.push(n.refreshRequired(this.fireRefresh.bind(this))),e.push(t.refreshRequired(this.fireRefresh.bind(this)))}get refreshRequired(){return this.refreshEventEmitter.event}getAllVariableDiscriptions(e,t,n,i){return this.variableHandler.getAllVariableDiscriptions(e,t,n,i)}async getVariables(e,t){return this.variableHandler.getVariables(e,t)}async getFullVariable(e,t){return this.variableHandler.getFullVariable(e,t)}async getMatchingVariable(e,t,n){return this.variableHandler.getMatchingVariable(e,t,n)}async getDataFrameInfo(e,t,n,i){return this.variableHandler.getDataFrameInfo(e,t,n,i)}async getVariableValueSummary(e,t,n){return this.variableHandler.getVariableValueSummary(e,t,n)}async getDataFrameRows(e,t,n,i,o){return this.variableHandler.getDataFrameRows(e,t,n,i,o)}get variableHandler(){return this.debuggerVariables.active?this.debuggerVariables:this.kernelVariables}fireRefresh(){this.refreshEventEmitter.fire()}};y([ur("DS_INTERNAL.VARIABLE_EXPLORER_FETCH_TIME")],Sf.prototype,"getVariables",1),Sf=y([(0,xu.injectable)(),m(0,(0,xu.inject)(O)),m(1,(0,xu.inject)(kn)),m(1,(0,xu.named)(qe.KERNEL_VARIABLES)),m(2,(0,xu.inject)(kn)),m(2,(0,xu.named)(qe.DEBUGGER_VARIABLES))],Sf);var xf=P(M());var EG=require("vscode");var wG=1e3*60*60*24*2,Ka=class extends tr{constructor(t,n,i,o){super();this.serverStorage=n;this.context=i;this.fs=o;this.executedCells=new WeakMap;this.chainedPromises=Promise.resolve();i.globalStorageUri,t.push(this),this.storageFile=EG.Uri.joinPath(this.context.globalStorageUri,"lastExecutedRemoteCell.json")}activate(){this._register(this.serverStorage.onDidRemove(this.onDidRemoveServers,this))}async getLastTrackedCellExecution(t,n){if(t.isUntitled||!Nt(n.kernelConnectionMetadata)||!n.session?.id)return;if(this.staleState&&this.staleState[t.uri.toString()])return this.staleState[t.uri.toString()];let i=await this.getStorageFile(),o={};try{let s=await this.fs.readFile(i);o=JSON.parse(s.toString()),this.staleState=o}catch{return}return o[t.uri.toString()]}trackCellExecution(t,n){if(!Nt(n.kernelConnectionMetadata)||t.document.isUntitled)return;this.executedCells.delete(t);let i=[],o=(a,l)=>{if(l.direction==="send"){let c=l.msg;if(c.header.msg_type==="execute_request"&&c.metadata&&typeof c.metadata=="object"&&c.metadata&&"cellId"in c.metadata&&typeof c.metadata.cellId=="string"&&c.metadata.cellId===t.document.uri.toString()){let u=c.header.msg_id;this.executedCells.set(t,{msg_id:u,kernelId:n.session?.kernel?.id||"",cellIndex:t.index})}}else if(l.direction==="recv"){let c=l.msg,u=this.executedCells.get(t);if(u?.msg_id&&hu(c)===u.msg_id){if(!u.startTime){u.startTime=new Date().getTime();try{u.startTime=new Date(c.header.date).getTime()}catch{}this.executedCells.set(t,u)}"execution_count"in c.content&&typeof c.content.execution_count=="number"&&!u.executionCount&&u.executionCount!==c.content.execution_count&&(u.executionCount=c.content.execution_count,this.executedCells.set(t,u),this.trackLastExecution(t,n,u),z(i))}}},s=()=>{let a=n.session;a&&(a.anyMessage.connect(o),i.push({dispose:()=>ai(()=>a.anyMessage?.disconnect(o))}))};n.onStarted(()=>s(),i),n.session&&s()}deleteTrackedCellExecution(t,n){t.notebook.isUntitled||!Nt(n.kernelConnectionMetadata)||!n.session?.id||(this.chainedPromises=this.chainedPromises.finally(async()=>{let i={};try{let s=await this.getStorageFile().then(()=>this.fs.readFile(this.storageFile));i=JSON.parse(s.toString())}catch{return}let o=t.notebook.uri.toString();i[o].cellIndex===t.index&&(delete i[o],this.staleState=i,await this.fs.writeFile(this.storageFile,JSON.stringify(i)))}))}getStorageFile(){return this.ensureStorageExistsPromise=this.ensureStorageExistsPromise||(async()=>(await this.fs.createDirectory(this.context.globalStorageUri),this.storageFile))(),this.ensureStorageExistsPromise}trackLastExecution(t,n,i){if(!i.executionCount||!i.msg_id||!i.startTime||!Nt(n.kernelConnectionMetadata)||!n.session?.id)return;let o={cellIndex:t.index,executionCount:i.executionCount,kernelId:n.session?.kernel?.id||"",msg_id:i.msg_id,serverId:Lt(n.kernelConnectionMetadata.serverProviderHandle),sessionId:n.session?.id,startTime:i.startTime};this.chainedPromises=this.chainedPromises.finally(async()=>{let s={};try{let l=await this.getStorageFile().then(()=>this.fs.readFile(this.storageFile));s=JSON.parse(l.toString())}catch{}let a=t.notebook.uri.toString();s[a]=o,this.removeOldItems(s),this.staleState=s,await this.fs.writeFile(this.storageFile,JSON.stringify(s))})}onDidRemoveServers(t){t.length!==0&&(this.chainedPromises=this.chainedPromises.finally(async()=>{await this.getStorageFile();let n={};try{let s=await this.fs.readFile(this.storageFile);n=JSON.parse(s.toString())}catch{}let i=!1,o=new Set(t.map(s=>Lt(s)));Object.keys(n).forEach(s=>{let a=n[s];(o.has(a.serverId)||Date.now()-a.startTime>wG)&&(delete n[s],i=!0)}),i&&(this.removeOldItems(n),this.staleState=n,await this.fs.writeFile(this.storageFile,JSON.stringify(n)))}))}removeOldItems(t){Object.keys(t).forEach(n=>{let i=t[n];i&&Date.now()-i.startTime>wG&&delete t[n]})}};Ka=y([(0,xf.injectable)(),m(0,(0,xf.inject)(O)),m(1,(0,xf.inject)(zt)),m(2,(0,xf.inject)(ot)),m(3,(0,xf.inject)(st))],Ka);var ob=P(M());var qC=require("vscode");var ib=class{constructor(e,t,n){this.serverUriStorage=e;this.registrations=t;this.disposables=n}activate(){this.disposables.push(qC.commands.registerCommand(q.ClearSavedJupyterUris,async()=>{await this.serverUriStorage.clear().catch(h),await Promise.all(this.registrations.jupyterCollections.filter(e=>e.id.startsWith("_builtin")||e.extensionId===Ue).map(async e=>{if(!e.serverProvider||!e.serverProvider.removeJupyterServer)return;let t=new qC.CancellationTokenSource,n=await Promise.resolve(e.serverProvider.provideJupyterServers(t.token));await Promise.all((n||[]).map(i=>e.serverProvider.removeJupyterServer(i).catch(h)))})).catch(h),await qC.commands.executeCommand("dataScience.ClearUserProviderJupyterServerCache").then(h,h)},this))}};ib=y([(0,ob.injectable)(),m(0,(0,ob.inject)(zt)),m(1,(0,ob.inject)($t)),m(2,(0,ob.inject)(O))],ib);var NT=P(M());var sb=class{constructor(e){this.registry=e;this.priority=0}activate(){this.registry.register(this,Et),this.registry.register(this,yt)}async getCode(e){return vt(e.kernelConnectionMetadata)?[G9]:[]}};sb=y([(0,NT.injectable)(),m(0,(0,NT.inject)(Wc))],sb);function kG(r,e){r.addSingleton(ge,ry),r.addSingleton(ge,oy),r.addSingleton(hi,nb),r.addSingleton(ns,ns),r.addSingleton(r_,tb),r.addSingleton(t_,ea),r.addSingleton(Ta,Ta),r.addSingleton(Rr,Fy),r.addSingleton(ge,bf),r.addSingleton(ge,ny),r.addSingleton(jr,jr),r.addSingleton(gd,oc),r.addSingleton(as,as),r.addBinding(as,ge),r.addSingleton(vu,vu),r.addSingleton(ge,$y),r.addSingleton(kn,Sf,qe.ALL_VARIABLES),r.addSingleton(Ms,dd),r.addSingleton(ge,gf),r.addSingleton(ge,By),r.addSingleton(ge,Oy),r.addSingleton(ge,Ky),r.addSingleton(ge,Jy),r.addSingleton(Te,Wy),r.addSingleton(Em,Vy),r.addSingleton(ge,ib),r.addSingleton(Ka,Ka),r.addBinding(Ka,ge),UH(r,e),Qh("isInsiderExtension",vh()?"true":"false");let t=r.get($e);Qh("isPythonExtensionInstalled",t.isPythonExtensionInstalled?"true":"false");let n=r.get(hi);Qh("rawKernelSupported",n.isSupported?"true":"false"),r.addSingleton(ge,tn),r.addSingleton(Wc,qy),r.addSingleton(bu,bu),r.addSingleton(ge,sb)}var Id=P(M()),Cf=require("vscode");var ab=class{constructor(e,t,n,i,o){this.disposables=e;this.extensionChecker=t;this.progressReporter=n;this.pythonApi=i;this.errorHandler=o}activate(){this.disposables.push(Cf.commands.registerCommand(q.InstallPythonExtensionViaKernelPicker,this.installPythonExtensionViaKernelPicker,this)),this.disposables.push(Cf.commands.registerCommand(q.InstallPythonViaKernelPicker,this.installPythonViaKernelPicker,this))}async installPythonViaKernelPicker(){A("DS_INTERNAL.PYTHON_NOT_INSTALLED",void 0,{action:"displayed"});let e=this.installedOnceBefore?[me.install,me.reload]:[me.install],t=await Cf.window.showErrorMessage(I.pythonNotInstalled,{modal:!0},...e);t===me.install?(this.installedOnceBefore=!0,A("DS_INTERNAL.PYTHON_NOT_INSTALLED",void 0,{action:"download"}),await Cf.commands.executeCommand("python.installPython")):t===me.reload?(A("DS_INTERNAL.PYTHON_NOT_INSTALLED",void 0,{action:"reload"}),await Cf.commands.executeCommand("jupyter.reloadVSCode",I.reloadRequired)):A("DS_INTERNAL.PYTHON_NOT_INSTALLED",void 0,{action:"dismissed"})}async installPythonExtensionViaKernelPicker(){if(!this.extensionChecker.isPythonExtensionInstalled){A("DS_INTERNAL.PYTHON_EXTENSION_NOT_INSTALLED",void 0,{action:"displayed"});let e=this.progressReporter.createProgressIndicator(I.installingPythonExtension);try{await this.extensionChecker.directlyInstallPythonExtension();let t="hooked",n=await br(6e4,"timeout",this.pythonApi.pythonExtensionHooked.then(()=>t));if(this.extensionChecker.isPythonExtensionInstalled&&n===t)return d.debug("Python Extension installed via Kernel Picker command"),A("DS_INTERNAL.PYTHON_EXTENSION_INSTALLED_VIA_KERNEL_PICKER",void 0,{action:"success"}),!0;d.error("Failed to install Python Extension via Kernel Picker command"),A("DS_INTERNAL.PYTHON_EXTENSION_INSTALLED_VIA_KERNEL_PICKER",void 0,{action:"failed"}),this.errorHandler.handleError(new Error(I.failedToInstallPythonExtension)).then(h,h)}finally{e.dispose()}}}};ab=y([(0,Id.injectable)(),m(0,(0,Id.inject)(O)),m(1,(0,Id.inject)($e)),m(2,(0,Id.inject)(ts)),m(3,(0,Id.inject)(Yt)),m(4,(0,Id.inject)(Zr))],ab);var lb=P(M()),Ef=require("vscode");var wf=class{constructor(e,t,n){this.disposables=e;this.controllerRegistration=t;this.preferredRemoteKernelIdProvider=n}activate(){Ef.workspace.onDidOpenNotebookDocument(this.onDidOpenNotebook,this,this.disposables),Ef.workspace.notebookDocuments.forEach(e=>this.onDidOpenNotebook(e))}async onDidOpenNotebook(e){if(!Dt(e))return;let t=await this.preferredRemoteKernelIdProvider.getPreferredRemoteKernelId(e);if(!t)return;let n=()=>{let o=this.controllerRegistration.getSelected(e),s=this.controllerRegistration.registered.find(a=>a.id===t);return s&&o?.id!==s.id?(this.switchKernel(e,s.connection).catch(h),!0):!1};if(n())return;let i=this.controllerRegistration.onDidChange(o=>{o.added.length&&n()&&i.dispose()},this,this.disposables);this.controllerRegistration.onControllerSelected(o=>{o.notebook===e&&i.dispose()},this,this.disposables)}async switchKernel(e,t){d.debug(`Using notebook.selectKernel to force remote kernel for ${B(e.uri)} to ${t.id}`),await Ef.commands.executeCommand("notebook.selectKernel",{id:t.id,extension:Ue}),await Yw(async()=>{if(Ef.window.activeNotebookEditor?.notebook===e){let i=this.controllerRegistration.getSelected(e);if(i?.connection.id===t.id)return i.restoreConnection(e).catch(h),!0}return!1},2e3,100)?d.debug(`Successfully switched remote kernel for ${B(e.uri)} to ${t.id}`):d.warn(`Failed to switch remote kernel for ${B(e.uri)} to ${t.id}`)}};y([zr()],wf.prototype,"onDidOpenNotebook",1),wf=y([(0,lb.injectable)(),m(0,(0,lb.inject)(O)),m(1,(0,lb.inject)(pt)),m(2,(0,lb.inject)(ns))],wf);var ub=P(M()),xd=require("vscode");var Oo=require("vscode");function ac(r){if(typeof r!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof r}\``);var e=DG();let t=e;return t.default&&(t=t.default),r.replace(t(),"")}var $C=P(M()),MG=require("vscode");var cL=P(To()),RG=require("vscode");function _G(r){if(!r||!Array.isArray(r)||r.length===0)return;let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if("buffer"in n&&"byteOffset"in n){let i=Array.apply(null,new Uint8Array(n.buffer));e.push({...n,byteLength:n.byteLength,byteOffset:n.byteOffset,buffer:i})}else e.push([...new Uint8Array(n)])}return e}function TG(r){if(!Array.isArray(r)||r.length===0)return r;let e=[];for(let t=0;t<r.length;t+=1){let n=r[t];if("buffer"in n&&"byteOffset"in n){let i=new Uint8Array(n.buffer).buffer,o=new DataView(i,n.byteOffset,n.byteLength);e.push(o)}else{let i=new Uint8Array(n).buffer;e.push(i)}}return e}var JC=new WeakMap;function AG(r,e){let t=JC.get(r);t&&(t.targets.add(e),t.registerCommTarget(e))}function NG(r,e){JC.get(r)?.targets?.delete?.(e)}var MT=class{constructor(e,t){this.kernelProvider=e;this.document=t;this.commTargetsRegistered=new Set;this.pendingTargetNames=new Set;this._postMessageEmitter=new RG.EventEmitter;this.messageHooks=new Map;this.pendingHookRemovals=new Map;this.messageHookRequests=new Map;this.disposables=[];this.disposed=!1;this.pendingMessages=[];this.subscribedToKernelSocket=!1;this.waitingMessageIds=new Map;this.outputWidgetIds=new Set;this.isUsingIPyWidgets=!1;this.pendingTargetNames.add("jupyter.widget"),e.onDidStartKernel(i=>{i.notebook===t&&this.initialize()},this,this.disposables),this.mirrorSend=this.mirrorSend.bind(this),this.onKernelSocketMessage=this.onKernelSocketMessage.bind(this);let n=require("@jupyterlab/services/lib/kernel/serialize");this.deserialize=n.deserialize}get postMessage(){return this._postMessageEmitter.event}dispose(){for(this.disposed=!0;this.disposables.length;)this.disposables.shift()?.dispose()}receiveMessage(e){switch(e.message){case"IPyWidgets_logMessage":{let t=e.payload;t.category==="error"?d.error(`Widget Error: ${t.message}`):d.trace(`Widget Message: ${t.message}`);break}case"IPyWidgets_Ready":this.sendKernelOptions(),this.initialize();break;case"IPyWidgets_msg":this.sendRawPayloadToKernelSocket(e.payload);break;case"IPyWidgets_binary_msg":this.sendRawPayloadToKernelSocket(TG(e.payload)[0]);break;case"IPyWidgets_msg_received":this.onKernelSocketResponse(e.payload);break;case"IPyWidgets_registerCommTarget":this.registerCommTarget(e.payload);break;case"IPyWidgets_RegisterMessageHook":this.registerMessageHook(e.payload);break;case"IPyWidgets_RemoveMessageHook":this.possiblyRemoveMessageHook(e.payload);break;case"IPyWidgets_MessageHookResult":this.handleMessageHookResponse(e.payload);break;case"IPyWidgets_iopub_msg_handled":this.iopubMessageHandled(e.payload);break;default:break}}sendRawPayloadToKernelSocket(e){this.pendingMessages.push(e),this.sendPendingMessages()}registerCommTarget(e){this.pendingTargetNames.add(e),this.initialize()}initialize(){this.jupyterLab||(this.jupyterLab=require("@jupyterlab/services"));let e=this.getKernel();e&&(this.subscribeToKernelSocket(e),this.registerCommTargets(e))}raisePostMessage(e,t){this._postMessageEmitter.fire({message:e,payload:t})}subscribeToKernelSocket(e){if(this.subscribedToKernelSocket||!e.session)return;this.subscribedToKernelSocket=!0,this.subscribeToKernelSocketImpl(e);let t=e.session.kernel?.id;e.session.onDidKernelSocketChange(()=>{this.subscribeToKernelSocketImpl(e,t),t=e.session?.kernel?.id||""})}subscribeToKernelSocketImpl(e,t){let n=t?oo.get(t):void 0;if(n?.removeReceiveHook(this.onKernelSocketMessage),n?.removeSendHook(this.mirrorSend),this.kernelWasConnectedAtLeastOnce){for(;this.pendingMessages.length;)this.pendingMessages.shift();this.waitingMessageIds.forEach(s=>s.resultPromise.resolve()),this.waitingMessageIds.clear(),this.messageHookRequests.forEach(s=>s.resolve(!1)),this.messageHookRequests.clear(),this.messageHooks.clear(),this.sendRestartKernel()}if(!e.session?.kernel?.id||!oo.get(e.session?.kernel?.id))return;JC.has(e.session.kernel)||JC.set(e.session.kernel,{targets:new Set,registerCommTarget:s=>{this.raisePostMessage("IPyWidgets_registerCommTarget",s)}}),this.kernelWasConnectedAtLeastOnce=!0;let i=e.session.kernel?.id,o=i?oo.get(i):void 0;o?.addReceiveHook(this.onKernelSocketMessage),o?.addSendHook(this.mirrorSend),this.sendKernelOptions(),this.registerCommTargets(e),this.sendPendingMessages()}sendKernelOptions(){this.kernel?.session?.kernel&&this.raisePostMessage("IPyWidgets_kernelOptions",{id:this.kernel?.session?.kernel?.id||"",clientId:this.kernel?.session?.kernel?.clientId||"",userName:this.kernel?.session?.kernel?.username||"",model:this.kernel?.session?.kernel?.model||{id:"",name:""}})}async mirrorSend(e,t){if(typeof e=="string"&&e.includes("shell")&&e.includes("execute_request")){let n=this.deserialize(e);if(n.channel==="shell"&&n.header.msg_type==="execute_request"){if(!Q_(n))return;let i=this.mirrorExecuteRequest(n);this.isUsingIPyWidgets&&await i}}}sendRestartKernel(){this.raisePostMessage("IPyWidgets_onRestartKernel",void 0)}mirrorExecuteRequest(e){let t=oe();return this.waitingMessageIds.set(e.header.msg_id,{startTime:Date.now(),resultPromise:t}),this.raisePostMessage("IPyWidgets_mirror_execute",{id:e.header.msg_id,msg:e}),t.promise}messageNeedsFullHandle(e){return e.channel==="iopub"&&e.header?.msg_type==="comm_msg"&&e.content?.data?.method==="update"&&this.outputWidgetIds.has(e.content?.comm_id)}iopubMessageHandled(e){let t=e.id;this.fullHandleMessage&&this.fullHandleMessage.id===t&&(this.fullHandleMessage.promise.resolve(),this.fullHandleMessage=void 0)}async onKernelSocketMessage(e){let t=(0,cL.default)(),n=oe();if(this.waitingMessageIds.set(t,{startTime:Date.now(),resultPromise:n}),typeof e=="string"?Q_(e)&&this.raisePostMessage("IPyWidgets_msg",{id:t,data:e}):this.raisePostMessage("IPyWidgets_binary_msg",{id:t,data:_G([e])}),typeof e!="string"||e.includes(Hi)||e.includes(qe.DefaultCommTarget)||e.includes("comm_open")||e.includes("comm_close")||e.includes("comm_msg")){let o=this.deserialize(e);if(!Q_(o))return;o&&o.content&&o.content.data&&(o.content.data[Hi]||o.content.target_name===qe.DefaultCommTarget)&&(this.isUsingIPyWidgets=!0);let s=o.header?.msg_type==="comm_open"&&o.content?.data?.state?._model_module==="@jupyter-widgets/output"&&o.content?.data?.state?._model_name==="OutputModel",a=o.header?.msg_type==="comm_close"&&this.outputWidgetIds.has(o.content?.comm_id);s?this.outputWidgetIds.add(o.content.comm_id):a?this.outputWidgetIds.delete(o.content.comm_id):this.messageNeedsFullHandle(o)&&(this.fullHandleMessage={id:o.header.msg_id,promise:oe()},await n.promise,await this.fullHandleMessage.promise.promise,this.fullHandleMessage=void 0)}}onKernelSocketResponse(e){let t=this.waitingMessageIds.get(e.id);t&&(this.waitingMessageIds.delete(e.id),t.resultPromise.resolve())}sendPendingMessages(){if(this.kernel?.session?.kernel)for(;this.pendingMessages.length;)try{let e=this.pendingMessages[0],t=typeof e=="string"?JSON.parse(e):this.deserialize(e);t.buffers?.length&&(t.buffers=t.buffers.map(n=>n instanceof DataView?n.buffer:n)),t.channel==="control"?this.kernel.session.kernel.sendControlMessage(t):this.kernel.session.kernel.sendShellMessage(t),this.pendingMessages.shift()}catch(e){d.error("Failed to send message to Kernel",e);return}}registerCommTargets(e){for(;this.pendingTargetNames.size>0;){let n=Array.from([...this.pendingTargetNames.values()]).shift();if(n){if(this.commTargetsRegistered.has(n))return;d.trace(`Registering commtarget ${n}`),this.commTargetsRegistered.add(n),this.pendingTargetNames.delete(n),e.session?.kernel&&n!==qe.DefaultCommTarget&&!JC.get(e.session.kernel)?.targets?.has(n)&&e.session.kernel.registerCommTarget(n,h)}}}getKernel(){return this.document&&!this.kernel?.session&&(this.kernel=this.kernelProvider.get(this.document),this.kernel?.onDisposed(()=>this.kernel=void 0)),this.kernel&&!this.kernelRestartHandlerAttached&&(this.kernelRestartHandlerAttached=!0,this.disposables.push(this.kernel.onRestarted(this.handleKernelRestarts,this))),this.kernel}async handleKernelRestarts(){this.disposed||this.commTargetsRegistered.size===0||!this.kernel?.session||(Array.from(this.commTargetsRegistered.keys()).forEach(e=>{this.commTargetsRegistered.delete(e),this.pendingTargetNames.add(e)}),this.subscribeToKernelSocket(this.kernel),this.registerCommTargets(this.kernel))}registerMessageHook(e){try{if(this.kernel?.session?.kernel&&!this.messageHooks.has(e)){let t=this.messageHookCallback.bind(this);this.messageHooks.set(e,t),this.kernel.session.kernel.registerMessageHook(e,t)}}finally{this.raisePostMessage("IPyWidgets_ExtensionOperationHandled",{id:e,type:"IPyWidgets_RegisterMessageHook"})}}possiblyRemoveMessageHook(e){try{e.lastHookedMsgId?this.pendingHookRemovals.set(e.lastHookedMsgId,e.hookMsgId):this.removeMessageHook(e.hookMsgId)}finally{this.raisePostMessage("IPyWidgets_ExtensionOperationHandled",{id:e.hookMsgId,type:"IPyWidgets_RemoveMessageHook"})}}removeMessageHook(e){if(this.kernel?.session?.kernel&&this.messageHooks.has(e)){let t=this.messageHooks.get(e);this.messageHooks.delete(e),this.kernel.session.kernel.removeMessageHook(e,t)}}async messageHookCallback(e){let t=oe(),n=(0,cL.default)(),i=e.parent_header.msg_id;if(this.messageHooks.has(i)?(this.messageHookRequests.set(n,t),this.raisePostMessage("IPyWidgets_MessageHookCall",{requestId:n,parentId:i,msg:e})):t.resolve(!0),this.pendingHookRemovals.has(e.header.msg_id)){let o=this.pendingHookRemovals.get(e.header.msg_id);this.pendingHookRemovals.delete(e.header.msg_id),this.removeMessageHook(o)}return t.promise}handleMessageHookResponse(e){let t=this.messageHookRequests.get(e.requestId);t&&(this.messageHookRequests.delete(e.requestId),t.resolve(e.msgType.includes("comm")?!0:e.result))}};var uL=class{constructor(e,t){this.baseMulticaster=e;this.oldMessages=t;this._postMessageEmitter=new MG.EventEmitter;this.disposables=[];e.postMessage(this.raisePostMessage,this,this.disposables)}get postMessage(){return this._postMessageEmitter.event}dispose(){for(;this.disposables.length;)this.disposables.shift()?.dispose()}initialize(){return this.baseMulticaster.initialize()}receiveMessage(e){this.baseMulticaster.receiveMessage(e)}raisePostMessage(e){this.oldMessages.forEach(t=>{this._postMessageEmitter.fire(t)}),this.oldMessages=[],this._postMessageEmitter.fire(e)}},Cu=class{constructor(e,t){this.kernelProvider=t;this.messageDispatchers=new WeakMap;this.messagesPerNotebook=new WeakMap;this.disposed=!1;this.disposables=[];e.push(this),t.onDidDisposeKernel(this.trackDisposingOfKernels,this,e)}dispose(){for(this.disposed=!0;this.disposables.length;)this.disposables.shift()?.dispose()}create(e){let t=this.messageDispatchers.get(e);t||(t=new MT(this.kernelProvider,e),this.messageDispatchers.set(e,t),this.disposables.push(t.postMessage(o=>this.onMessage(o,e),this)));let n=[];e&&this.messagesPerNotebook.get(e)&&(n=this.messagesPerNotebook.get(e)||[]);let i=new uL(t,n);return this.disposables.push(i),i}trackDisposingOfKernels(e){if(this.disposed)return;let t=e.notebook,n=this.messageDispatchers.get(t);this.messageDispatchers.delete(t),n?.dispose()}onMessage(e,t){t&&(this.messagesPerNotebook.set(t,this.messagesPerNotebook.get(t)||[]),(e.message==="IPyWidgets_kernelOptions"||e.message==="IPyWidgets_registerCommTarget")&&this.messagesPerNotebook.get(t).push(e))}};Cu=y([(0,$C.injectable)(),m(0,(0,$C.inject)(O)),m(1,(0,$C.inject)(Te))],Cu);var KG=require("vscode");var OG=require("vscode");var cb=class cb extends tr{constructor(t,n,i,o,s,a){super();this.kernel=t;this.localResourceUriConverter=n;this.configurationSettings=i;this.sourceProviderFactory=o;this.isWebViewOnline=s;this.cdnScriptProvider=a;this.id="all";this.scriptProviders=this.sourceProviderFactory.getProviders(this.kernel,this.localResourceUriConverter),this.scriptProviders.forEach(l=>this._register(l)),this.monitorKernel()}get configuredScriptSources(){return this.configurationSettings.getSettings(void 0).widgetScriptSources}static{this.trackedWidgetModuleNames=new Set}async getBaseUrl(){let t=this.scriptProviders.find(n=>n.getBaseUrl);if(t)return t.getBaseUrl()}async getWidgetScriptSources(){let t=[];return await Promise.all(this.scriptProviders.map(async n=>{n.getWidgetScriptSources&&t.push(...await n.getWidgetScriptSources())})),t}async getWidgetScriptSource(t,n){let i=await this.isWebViewOnline,o=this.scriptProviders.slice(),s={moduleName:t};for(;o.length;){let a=o.shift();if(!a)continue;let l=await a.getWidgetScriptSource(t,n,i);if(l.scriptUri){s=l;break}else d.warn(`Widget Script Source not found for ${t}@${n} from ${a.id}`)}return this.sendTelemetryForWidgetModule(t,n,"",s.source).catch(h),s.scriptUri?d.trace(`Script source for Widget ${t}@${n} was found from source ${s.source} and ${s.scriptUri}`):d.error(`Script source for Widget ${t}@${n} not found in ${this.scriptProviders.map(a=>a.id).join(", ")}`),s}async sendTelemetryForWidgetModule(t,n,i,o){let s=`${t}.${t}@${n}`;if(cb.trackedWidgetModuleNames.has(s))return;cb.trackedWidgetModuleNames.add(s);let a=t.toLowerCase().startsWith("@jupyter-widgets"),l=o==="cdn"||a||await this.cdnScriptProvider.isOnCDN(t),c=l?t.replace(/\//g,"_").replace(/\\/g,"_").replace(/@/g,"_at_"):void 0,u=l?i.replace(/\//g,"_").replace(/\\/g,"_").replace(/@/g,"_at_"):void 0;A("DS_INTERNAL.IPYWIDGET_USED_BY_USER",void 0,{hashedName:await mt(t),moduleName:c,modelName:u,source:o,moduleVersion:l?n:void 0,cdnSearched:this.configuredScriptSources.length>0})}monitorKernel(){this.hookKernelEvents(),this._register(this.kernel.onStarted(this.hookKernelEvents,this)),this._register(this.kernel.onRestarted(this.hookKernelEvents,this)),this._register(this.kernel.onDidKernelSocketChange(()=>this.hookKernelEvents(),this))}hookKernelEvents(){let t=this.kernel.session?.kernel;t&&(t.anyMessage.connect(this.onAnyMessage,this),this._register(new OG.Disposable(()=>t.anyMessage.disconnect(this.onAnyMessage,this))))}onAnyMessage(t,n){if(n.direction==="recv"&&n.msg.header.msg_type==="comm_open"){let o=n.msg.content.data;o.state?._model_module&&o.state._model_name&&this.sendTelemetryForWidgetModule(o.state?._model_module,o.state?._model_module_version||"",o.state?._model_name).catch(h)}}};y([zr()],cb.prototype,"sendTelemetryForWidgetModule",1),y([zr()],cb.prototype,"onAnyMessage",1);var KT=cb;var FT=class{constructor(e,t){this.isWebExtension=e;this.converter=t}async asWebviewUri(e){return this.isWebExtension?e:this.converter(e)}};var LT=class{constructor(e,t,n,i,o,s){this.document=e;this.kernelProvider=t;this.configurationSettings=i;this.sourceProviderFactory=o;this.cdnScriptProvider=s;this.postEmitter=new KG.EventEmitter;this.disposables=[];this.isWebViewOnline=oe();this.widgetSources=new Map;this.pendingModuleRequests=new Map;this.uriTranslationRequests=new So;this.uriConverter=new FT(ln(),a=>(this.uriTranslationRequests.has(a)||this.uriTranslationRequests.set(a,oe()),this.postEmitter.fire({message:"ConvertUriForUseInWebViewRequest",payload:a}),this.uriTranslationRequests.get(a).promise)),this.isWebViewOnline.promise.catch(h),n.push(this),this.kernelProvider.onDidStartKernel(a=>{a.notebook===this.document&&this.initialize()},this,this.disposables)}get postMessage(){return this.postEmitter.event}dispose(){for(;this.disposables.length;)this.disposables.shift()?.dispose()}onMessage(e,t){if(e==="ConvertUriForUseInWebViewResponse"){let n=t;n&&this.uriTranslationRequests.has(n.request)&&this.uriTranslationRequests.get(n.request).resolve(n.response)}else if(e==="IPyWidgets_Ready")this.sendBaseUrl(),this.sendWidgetScriptSources().catch(h);else if(e==="IPyWidgets_IsOnline"){let n=t.isOnline;this.isWebViewOnline.resolve(n)}else e==="IPyWidgets_WidgetScriptSourceRequest"&&t&&this.onRequestWidgetScript(t).catch(h)}initialize(){this.jupyterLab||(this.jupyterLab=require("@jupyterlab/services")),this.kernel||(this.kernel=this.kernelProvider.get(this.document)),this.kernel?.session&&(this.scriptProvider&&!this.scriptProvider.isDisposed||(this.scriptProvider=new KT(this.kernel,this.uriConverter,this.configurationSettings,this.sourceProviderFactory,this.isWebViewOnline.promise,this.cdnScriptProvider),this.kernel.onDisposed(()=>this.dispose()),this.handlePendingRequests(),this.sendBaseUrl(),d.trace("IPyWidgetScriptSource.initialize")))}sendBaseUrl(){this.scriptProvider&&this.scriptProvider.getBaseUrl().then(e=>{e&&this.postEmitter.fire({message:"IPyWidgets_BaseUrl_Response",payload:e.toString()})}).catch(e=>d.error("Failed to get baseUrl",e))}async sendWidgetScriptSources(){if(this.scriptProvider&&!this.allWidgetScriptsSent)try{(await this.scriptProvider.getWidgetScriptSources()).forEach(t=>{this.widgetSources.get(t.moduleName)?.source!=="cdn"&&this.widgetSources.set(t.moduleName,t),this.postEmitter.fire({message:"IPyWidgets_WidgetScriptSource_Response",payload:t})})}catch(e){d.warn("Failed to fetch script sources",e)}finally{this.allWidgetScriptsSent=!0}}async onRequestWidgetScript(e){let{moduleName:t,moduleVersion:n,requestId:i}=e;if(d.trace(`\x1B[32mFetch Script for ${JSON.stringify(e)}`),await this.sendWidgetSource(t,n,i).catch(o=>d.error("Failed to send widget sources upon ready",o)),this.scriptProvider&&!this.allWidgetScriptsSent)try{await this.sendWidgetScriptSources()}finally{this.sendWidgetSource(t,n,i).catch(o=>d.error("Failed to send widget sources upon ready",o))}}async sendWidgetSource(e,t="*",n){if(!e||e.startsWith("@jupyter"))return;if(!this.kernel||!this.scriptProvider){this.pendingModuleRequests.set(e,{moduleVersion:t,requestId:n});return}let i={moduleName:e,requestId:n};try{d.trace(`\x1B[32mFetch Script for ${e}`),i=await this.scriptProvider.getWidgetScriptSource(e,t),this.widgetSources.get(i.moduleName)?.source!=="cdn"&&this.widgetSources.set(i.moduleName,i)}catch(o){d.error("Failed to get widget source due to an error",o),A("DS_INTERNAL.IPYWIDGET_DISCOVERY_ERRORED")}finally{d.trace(`\x1B[32mScript for ${e}, is ${i.scriptUri} from ${i.source}`),this.postEmitter.fire({message:"IPyWidgets_WidgetScriptSource_Response",payload:i})}}handlePendingRequests(){let e=Array.from(this.pendingModuleRequests.keys());for(;e.length;){let t=e.shift();if(t){let{moduleVersion:n,requestId:i}=this.pendingModuleRequests.get(t);this.pendingModuleRequests.delete(t),this.sendWidgetSource(t,n,i).catch(o=>d.error(`Failed to send WidgetScript for ${t}`,o))}}}};var jT=Symbol("IWidgetScriptSourceProviderFactory"),WT=Symbol("INbExtensionsPathProvider"),VT=Symbol("IIPyWidgetScriptManagerFactory"),Elt=Symbol("IIPyWidgetScriptManager");var kf=P(M()),Mo=require("vscode");var UG="https://unpkg.com/",dL="https://cdn.jsdelivr.net/npm/",BT="IPYWidgetCDNConfigured",FG="IPYWidgetNotFoundOnCDN",LG="IPYWidgetNoNetWorkAccess";function Gye(r,e,t){let n=e,i="index",o=e.indexOf("/");return o!==-1&&e[0]==="@"&&(o=e.indexOf("/",o+1)),o!==-1&&(i=e.substr(o+1),n=e.substr(0,o)),r===dL&&(t.startsWith("^")&&(t=t.slice(1)),i.endsWith(".js")||(i=i.concat(".js"))),`${r}${n}@${t}/dist/${i}`}function zye(r){switch(r){case"unpkg.com":return UG;case"jsdelivr.com":return dL;default:break}}var Fa=class{constructor(e,t){this.globalMemento=e;this.configurationSettings=t;this.id="cdn";this.cache=new Map;this.isOnCDNCache=new Map;this.notifiedUserAboutWidgetScriptNotFound=new Set}get cdnProviders(){return this.configurationSettings.getSettings(void 0).widgetScriptSources}dispose(){this.cache.clear()}async isOnCDN(e){let t=`MODULE_VERSION_ON_CDN_${e}`;if(this.isOnCDNCache.has(t))return this.isOnCDNCache.get(t);if(this.globalMemento.get(t,!1))return!0;let n=(async()=>{let i=new Ql,o=Is(i.exists(`${UG}${e}`)),s=Is(i.exists(`${dL}${e}`));return await Promise.race([o.promise,s.promise]),o.value||s.value?!0:(await Promise.all([o.promise,s.promise]),!!(o.value||s.value))})();return n.then(i=>{if(i)return this.globalMemento.update(t,!0)}).then(h,h),this.isOnCDNCache.set(t,n),n}async getWidgetScriptSource(e,t,n){if(n===!1)return d.ci(`Webview is offline, cannot use CDN for ${e}`),this.warnIfNoAccessToInternetFromWebView(e).catch(h),{moduleName:e};if(this.cdnProviders.length===0&&this.globalMemento.get(BT,!1))return d.ci("No CDN providers and user configured CDN"),{moduleName:e};let i=this.getModuleKey(e,t);return this.cache.get(i)||this.cache.set(i,this.getWidgetScriptSourceImplementation(e,t)),this.cache.get(i)}async generateDownloadUri(e,t,n){let i=zye(n);if(i)return Gye(i,e,t)}getModuleKey(e,t){return`${e}${t}`}async getWidgetScriptSourceImplementation(e,t){if(d.trace(`\x1B[32mSearching for Widget Script ${e}#${t} using cdns ${this.cdnProviders.join(" ")}`),await this.configureWidgets(),this.cdnProviders.length===0)return{moduleName:e};let i=(await Promise.all(this.cdnProviders.map(o=>this.getValidUri(e,t,o)))).find(o=>o);return i?(d.trace(`\x1B[32mWidget Script ${e}#${t} found at URI: ${i}`),{moduleName:e,scriptUri:i,source:"cdn"}):(d.error(`Widget Script ${e}#${t} was not found on on any cdn`),this.handleWidgetSourceNotFound(e,t).catch(h),{moduleName:e})}async getValidUri(e,t,n){try{let i=await this.generateDownloadUri(e,t,n),o=new Ql;if(i&&await o.exists(i))return i}catch{d.trace(`Failed downloading ${e}:${t} from ${n}`);return}}async warnIfNoAccessToInternetFromWebView(e){if(this.globalMemento.get(LG,!1)||this.notifiedUserAboutWidgetScriptNotFound.has(e)||this.cdnProviders.length===0)return;switch(this.notifiedUserAboutWidgetScriptNotFound.add(e),await Mo.window.showWarningMessage(I.cdnWidgetScriptNotAccessibleWarningMessage(e,JSON.stringify(this.cdnProviders)),me.ok,me.doNotShowAgain,me.moreInfo)){case me.doNotShowAgain:return this.globalMemento.update(LG,!0);case me.moreInfo:return Mo.env.openExternal(Mo.Uri.parse("https://aka.ms/PVSCIPyWidgets"));default:}}async configureWidgets(){if(this.cdnProviders.length!==0||this.globalMemento.get(BT,!1))return;if(this.configurationPromise)return this.configurationPromise.promise;this.configurationPromise=oe(),A("DS_INTERNAL.IPYWIDGET_PROMPT_TO_USE_CDN");let e=await Mo.window.showInformationMessage(I.useCDNForWidgetsNoInformation,{modal:!0},me.ok,me.doNotShowAgain,me.moreInfo),t="dismissed";switch(e){case me.ok:{t="ok",await Promise.all([this.updateScriptSources(["jsdelivr.com","unpkg.com"]),this.globalMemento.update(BT,!0)]);break}case me.doNotShowAgain:{t="doNotShowAgain",await Promise.all([this.updateScriptSources([]),this.globalMemento.update(BT,!0)]);break}case me.moreInfo:{Mo.env.openExternal(Mo.Uri.parse("https://aka.ms/PVSCIPyWidgets"));break}default:t=e===me.cancel?"cancel":"dismissed";break}A("DS_INTERNAL.IPYWIDGET_PROMPT_TO_USE_CDN_SELECTION",void 0,{selection:t}),this.configurationPromise.resolve()}async updateScriptSources(e){let t="widgetScriptSources";await this.configurationSettings.updateSetting(t,e,void 0,Mo.ConfigurationTarget.Global)}async handleWidgetSourceNotFound(e,t){if(this.globalMemento.get(FG,!1)||this.notifiedUserAboutWidgetScriptNotFound.has(e)||this.cdnProviders.length===0)return;switch(this.notifiedUserAboutWidgetScriptNotFound.add(e),await Mo.window.showWarningMessage(I.widgetScriptNotFoundOnCDNWidgetMightNotWork(e,t,JSON.stringify(this.cdnProviders)),me.ok,me.doNotShowAgain,me.reportThisIssue)){case me.doNotShowAgain:return this.globalMemento.update(FG,!0);case me.reportThisIssue:return Mo.env.openExternal(Mo.Uri.parse("https://aka.ms/CreatePVSCDataScienceIssue"));default:}}};Fa=y([(0,kf.injectable)(),m(0,(0,kf.inject)(Ve)),m(0,(0,kf.named)(ft)),m(1,(0,kf.inject)(le))],Fa);var HC=class{constructor(e,t){this.document=e;this.serviceContainer=t;this.cachedMessages=[];this.postEmitter=new Oo.EventEmitter;this.attachedWebviews=new WeakSet;this.modulesForWhichWeHaveDisplayedWidgetErrorMessage=new Set;this.queuedMessages=[];this.disposables=this.serviceContainer.get(O),this.jupyterOutput=this.serviceContainer.get(Wo,Ju),this.configService=this.serviceContainer.get(le),this.initialize()}get postMessage(){return this.listeningToPostMessageEvent=!0,this.postEmitter.event}dispose(){this.cachedMessages=[],this.ipyWidgetMessageDispatcher?.dispose(),this.ipyWidgetScriptSource?.dispose()}attach(e){if(this.attachedWebviews.has(e))return;this.attachedWebviews.add(e),this.postMessage(i=>{if(d.ci(`\x1B[32mWidget Coordinator sent ${i.message}`),i.message==="ConvertUriForUseInWebViewRequest")this.onMessage(e,"ConvertUriForUseInWebViewResponse",{request:i.payload,response:e.asWebviewUri(i.payload)});else{if(!this.readyMessageReceived){this.queuedMessages.push({type:i.message,payload:i.payload});return}this.sendPendingWebViewMessages(e),e.postMessage({type:i.message,payload:i.payload}).then(h,h)}},this,this.disposables);let t=oe(),n=async()=>{let i=new We;if(!t.completed){let s=[],a=this.serviceContainer.get(Te),l=oe();a.get(this.document)?l.resolve(a.get(this.document)):a.onDidCreateKernel(u=>{u.notebook===this.document&&l.resolve(u)},this,s);let c=await l.promise;c&&(vt(c.kernelConnectionMetadata)?c.ipywidgetsVersion?t.completed||t.resolve(c.ipywidgetsVersion):c.onIPyWidgetVersionResolved(()=>{c.ipywidgetsVersion&&(t.completed||t.resolve(c.ipywidgetsVersion),z(s))},this,s):t.completed||t.resolve(OS)),s.length&&this.disposables.push(...s)}let o=await t.promise;d.trace(`Version of IPyWidgets ${o} determined after ${i.elapsedTime/1e3}s`),e.postMessage({type:"IPyWidgets_Reply_Widget_Version",payload:o}).then(h,h)};e.onDidReceiveMessage(async i=>{d.ci(`\x1B[32mWidget Coordinator received ${i.type}`),this.onMessage(e,i.type,i.payload),i.type==="IPyWidgets_Request_Widget_Version"&&await n(),i.type==="IPyWidgets_Window_Alert"&&Oo.window.showInformationMessage(i.message),i.type==="IPyWidgets_Window_Open"&&Oo.env.openExternal(Oo.Uri.parse(i.url)),i.type==="IPyWidgets_Ready"&&(d.trace("Web view is ready to receive widget messages"),this.readyMessageReceived=!0,this.sendPendingWebViewMessages(e))},this,this.disposables),e.postMessage({type:"IPyWidgets_IsReadyRequest",payload:void 0}).then(h,h),n().catch(h)}onMessage(e,t,n){t==="ipywidget_load_success"?this.sendLoadSucceededTelemetry(n).catch(h):t==="ipywidget_load_failure"?this.handleWidgetLoadFailure(e,n).catch(h):t==="ipywidget_widget_version_not_supported"?this.sendUnsupportedWidgetVersionFailureTelemetry(n).catch(h):t==="ipywidget_render_failure"?this.sendRenderFailureTelemetry(n):t==="ipywidget_unhandled_kernel_message"&&this.handleUnhandledMessage(n),this.getIPyWidgetMessageDispatcher().receiveMessage({message:t,payload:n}),this.getIPyWidgetScriptSource().onMessage(t,n)}sendPendingWebViewMessages(e){if(this.readyMessageReceived)for(;this.queuedMessages.length;)e.postMessage(this.queuedMessages.shift()).then(h,h)}initialize(){this.getIPyWidgetScriptSource().initialize(),this.getIPyWidgetMessageDispatcher().initialize()}async sendLoadSucceededTelemetry(e){try{A("DS_INTERNAL.IPYWIDGET_LOAD_SUCCESS",0,{moduleHash:await mt(e.moduleName),moduleVersion:e.moduleVersion})}catch{}}async handleWidgetLoadFailure(e,t){try{let n=t.error.toString(),i=this.configService.getSettings(void 0).widgetScriptSources,o=i.length>0,s=`${t.moduleName}:${t.moduleVersion}`;if(!t.isOnline)n=I.loadClassFailedWithNoInternet(t.moduleName,t.moduleVersion),Oo.window.showErrorMessage(n).then(h,h);else if(!o&&!this.modulesForWhichWeHaveDisplayedWidgetErrorMessage.has(s)){this.modulesForWhichWeHaveDisplayedWidgetErrorMessage.add(s);let a=me.moreInfo,l=I.enableCDNForWidgetsButton;n=I.enableCDNForWidgetsSetting(t.moduleName,t.moduleVersion),Oo.window.showErrorMessage(n,{modal:!0},l,a).then(c=>{switch(c){case a:Oo.env.openExternal(Oo.Uri.parse("https://aka.ms/PVSCIPyWidgets"));break;case l:this.enableCDNForWidgets(e).catch(h);break;default:break}},h)}d.error(`Widget load failure ${n}`,i,t),A("DS_INTERNAL.IPYWIDGET_LOAD_FAILURE",0,{isOnline:t.isOnline,moduleHash:await mt(t.moduleName),moduleVersion:t.moduleVersion,timedout:t.timedout})}catch{}}async enableCDNForWidgets(e){await Oo.commands.executeCommand(q.EnableLoadingWidgetsFrom3rdPartySource),await e.postMessage({type:"IPyWidgets_AttemptToDownloadFailedWidgetsAgain"})}async sendUnsupportedWidgetVersionFailureTelemetry(e){try{A("DS_INTERNAL.IPYWIDGET_WIDGET_VERSION_NOT_SUPPORTED_LOAD_FAILURE",0,{moduleHash:await mt(e.moduleName),moduleVersion:e.moduleVersion})}catch{}}sendRenderFailureTelemetry(e){try{d.error("Error rendering a widget: ",e),A("DS_INTERNAL.IPYWIDGET_RENDER_FAILURE")}catch{}}handleUnhandledMessage(e){if(e.header.msg_type!=="status")try{if(e.header.msg_type==="error"){let t=e;t.content.traceback=t.content.traceback.map(ac)}d.trace(`Unhandled widget kernel message: ${e.header.msg_type} ${e.content}`),this.jupyterOutput.appendLine(I.unhandledMessage(e.header.msg_type,JSON.stringify(e.content))),A("DS_INTERNAL.IPYWIDGET_UNHANDLED_MESSAGE",void 0,{msg_type:e.header.msg_type})}catch{}}getIPyWidgetMessageDispatcher(){return this.ipyWidgetMessageDispatcher||(this.ipyWidgetMessageDispatcher=this.serviceContainer.get(Cu).create(this.document),this.disposables.push(this.ipyWidgetMessageDispatcher.postMessage(this.cacheOrSend,this))),this.ipyWidgetMessageDispatcher}getIPyWidgetScriptSource(){return this.ipyWidgetScriptSource||(this.ipyWidgetScriptSource=new LT(this.document,this.serviceContainer.get(Te),this.serviceContainer.get(O),this.serviceContainer.get(le),this.serviceContainer.get(jT),this.serviceContainer.get(Fa)),this.disposables.push(this.ipyWidgetScriptSource.postMessage(this.cacheOrSend,this))),this.ipyWidgetScriptSource}cacheOrSend(e){if(!this.listeningToPostMessageEvent){d.ci("\x1B[32mQueuing messages (no listeners)"),this.cachedMessages.push(e);return}this.cachedMessages.forEach(t=>this.postEmitter.fire(t)),this.cachedMessages=[],this.postEmitter.fire(e)}};y([zr()],HC.prototype,"enableCDNForWidgets",1);var mL=class{constructor(e,t){this.editor=e;this.pendingMessages=[];this.disposables=[];this._onDidReceiveMessage=new xd.EventEmitter;this.changeController(t)}get controller(){if(!this._controller)throw new Error("No controller defined");return this._controller.controller}changeController(e){this._controller?.id!==e.id&&(this.controllerMessageHandler?.dispose(),this._controller=e,this.controllerMessageHandler=e.onDidReceiveMessage(t=>{t.editor===this.editor&&this.controller?.id===e.id&&(this.eventHandlerListening?(this.sendPendingMessages(),this._onDidReceiveMessage.fire(t.message)):this.pendingMessages.push(t.message))},this,this.disposables))}dispose(){z(this.disposables)}get onDidReceiveMessage(){return this.eventHandlerListening=!0,setTimeout(()=>this.sendPendingMessages(),0),this._onDidReceiveMessage.event}postMessage(e){return this.controller.postMessage(e,this.editor)}asWebviewUri(e){return this.controller.asWebviewUri(e)}sendPendingMessages(){if(this.pendingMessages.length){let e=this.pendingMessages.shift();for(;e;)this._onDidReceiveMessage.fire(e),e=this.pendingMessages.shift()}}},Sd=class{constructor(e,t,n){this.serviceContainer=e;this.disposableRegistry=t;this.controllerManager=n;this.messageCoordinators=new WeakMap;this.notebookDisposables=new WeakMap;this.notebookCommunications=new WeakMap;this.notebookEditors=new WeakMap}activate(){xd.window.onDidChangeVisibleNotebookEditors(this.onDidChangeVisibleNotebookEditors,this,this.disposableRegistry),xd.workspace.onDidCloseNotebookDocument(this.onDidCloseNotebookDocument,this,this.disposableRegistry),this.controllerManager.onControllerSelected(this.onDidSelectController,this,this.disposableRegistry)}onDidSelectController(e){let t=this.messageCoordinators.get(e.notebook);t&&(this.messageCoordinators.delete(e.notebook),xd.window.visibleNotebookEditors.filter(n=>n.notebook===e.notebook).forEach(n=>{let i=this.notebookCommunications.get(n);this.notebookCommunications.delete(n),i&&i.controller!==e.controller.controller&&(this.notebookCommunications.delete(n),i&&i.dispose())}),t?.dispose()),xd.window.visibleNotebookEditors.filter(n=>n.notebook===e.notebook).forEach(n=>this.initializeNotebookCommunication(n,e.controller))}initializeNotebookCommunication(e,t){if(e.notebook.isClosed||!Dt(e.notebook))return;let n=e.notebook;if(!t){d.trace(`No controller, hence notebook communications cannot be initialized for editor ${B(e.notebook.uri)}`);return}if(this.notebookCommunications.has(e))return;let i=new mL(e,t);this.addNotebookDisposables(n,[i]),this.notebookCommunications.set(e,i);let o=this.messageCoordinators.get(n);o||(o=new HC(n,this.serviceContainer),this.messageCoordinators.set(n,o)),o.attach(i)}addNotebookDisposables(e,t){let n=this.notebookDisposables.get(e)||[];n.push(...t),this.notebookDisposables.set(e,n)}async onDidChangeVisibleNotebookEditors(e){e.forEach(t=>{let n=this.controllerManager.getSelected(t.notebook);this.initializeNotebookCommunication(t,n)})}onDidCloseNotebookDocument(e){let t=this.notebookEditors.get(e)||[];z(this.notebookDisposables.get(e)||[]),t.forEach(n=>this.notebookCommunications.get(n)?.dispose()),this.messageCoordinators.get(e)?.dispose(),this.messageCoordinators.delete(e)}};Sd=y([(0,ub.injectable)(),m(0,(0,ub.inject)(at)),m(1,(0,ub.inject)(O)),m(2,(0,ub.inject)(pt))],Sd);var Cd=P(M());var pb=class{constructor(e,t,n,i,o){this.disposables=e;this.kernelProvider=t;this.controllers=n;this.liveKernelTracker=i;this.preferredRemoteKernelIdProvider=o}activate(){this.kernelProvider.onDidStartKernel(this.onDidStartKernel,this,this.disposables),this.controllers.onControllerSelectionChanged(this.onNotebookControllerSelectionChanged,this,this.disposables)}onNotebookControllerSelectionChanged({selected:e,notebook:t,controller:n}){t.isClosed||(n.connection.kind==="connectToLiveRemoteKernel"&&n.connection.kernelModel.id&&(e?this.liveKernelTracker.trackKernelIdAsUsed(t.uri,n.connection.serverProviderHandle,n.connection.kernelModel.id):this.liveKernelTracker.trackKernelIdAsNotUsed(t.uri,n.connection.serverProviderHandle,n.connection.kernelModel.id)),ht(n.connection)&&this.preferredRemoteKernelIdProvider.clearPreferredRemoteKernelId(t.uri).catch(h))}onDidStartKernel(e){if(!e.resourceUri)return;let t=e.resourceUri;if(e.kernelConnectionMetadata.kind!=="startUsingRemoteKernelSpec")return;let n=e.kernelConnectionMetadata.serverProviderHandle,i=()=>{let o=e.session?.kernel?.id;!e.disposed&&!e.disposing&&o&&(d.debug(`Updating preferred kernel for remote notebook ${o}`),this.preferredRemoteKernelIdProvider.storePreferredRemoteKernelId(t,o).catch(h),this.liveKernelTracker.trackKernelIdAsUsed(t,n,o))};i(),e.onDidKernelSocketChange(i,this,this.disposables)}};pb=y([(0,Cd.injectable)(),m(0,(0,Cd.inject)(O)),m(1,(0,Cd.inject)(Te)),m(2,(0,Cd.inject)(pt)),m(3,(0,Cd.inject)(_m)),m(4,(0,Cd.inject)(ns))],pb);var Df=P(M());var jG=require("vscode");var Pf=class{constructor(e,t,n,i){this.disposables=e;this.uriStorage=t;this.controllers=n;this.serverProviderRegistry=i;this.handledServerProviderChanges=new WeakSet}activate(){this.serverProviderRegistry.jupyterCollections.forEach(e=>this.checkExpiredServersInJupyterCollection(e)),this.serverProviderRegistry.onDidChangeCollections(({added:e,removed:t})=>{e.forEach(n=>this.checkExpiredServersInJupyterCollection(n)),t.forEach(n=>this.removeControllersBelongingToDisposedProvider(n.extensionId,n.id))},this,this.disposables)}async checkExpiredServersInJupyterCollection(e){!this.handledServerProviderChanges.has(e.serverProvider)&&e.serverProvider.onDidChangeServers&&(this.handledServerProviderChanges.add(e.serverProvider),e.serverProvider.onDidChangeServers(()=>this.checkExpiredServersInJupyterCollection(e).catch(h),this,this.disposables));let t=new jG.CancellationTokenSource;this.disposables.push(t);try{let n=await Promise.resolve(e.serverProvider.provideJupyterServers(t.token));await this.removeControllersAndUriStorageBelongingToInvalidServers(e.extensionId,e.id,(n||[]).map(i=>i.id))}finally{t.dispose()}}async removeControllersAndUriStorageBelongingToInvalidServers(e,t,n){let i=this.uriStorage.all;await Promise.all(i.filter(o=>o.provider.extensionId===e&&o.provider.id===t).map(async o=>{n.includes(o.provider.handle)||await this.uriStorage.remove(o.provider)})),this.controllers.registered.forEach(o=>{let s=o.connection;ht(s)||s.serverProviderHandle.extensionId!==e||s.serverProviderHandle.id!==t||n.includes(s.serverProviderHandle.handle)||(d.warn(`Deleting controller ${o.id} as it is associated with a server Id that has been removed`),o.dispose())})}removeControllersBelongingToDisposedProvider(e,t){this.controllers.registered.forEach(n=>{let i=n.connection;ht(i)||i.serverProviderHandle.extensionId!==e||i.serverProviderHandle.id!==t||(d.warn(`Deleting controller ${n.id} as it is associated with a Provider Id that has been removed`),n.dispose())})}};y([zr("Failed to check what servers were shutdown in Controller Watcher")],Pf.prototype,"checkExpiredServersInJupyterCollection",1),Pf=y([(0,Df.injectable)(),m(0,(0,Df.inject)(O)),m(1,(0,Df.inject)(zt)),m(2,(0,Df.inject)(pt)),m(3,(0,Df.inject)($t))],Pf);var _f=P(M());var WG=require("vscode");var qT=class{constructor(e,t,n,i,o,s){this.label=e;this._description=t;this.detail=n;this.category=i;this.serverDisplayName=o;this.getDescription=s;this._onDidChange=new WG.EventEmitter;this.onDidChange=this._onDidChange.event}get description(){return this.getDescription?.()||this._description}set description(e){this._description=e}dispose(){this._onDidChange.dispose()}triggerChange(){this._onDidChange.fire(this)}};function VG(r){switch(r.kind){case"connectToLiveRemoteKernel":return I.kernelCategoryForJupyterSession;case"startUsingRemoteKernelSpec":return I.kernelCategoryForRemoteJupyterKernel;default:return JT(r)}}function JT(r){switch(r.kind){case"startUsingLocalKernelSpec":return I.kernelCategoryForJupyterKernel;case"startUsingPythonInterpreter":{if(Vn(r.kernelSpec)==="registeredByNewVersionOfExtForCustomKernelSpec")return I.kernelCategoryForJupyterKernel;switch(Be(r.interpreter)){case"Conda":return Hr(r.interpreter)?I.kernelCategoryForCondaWithoutPython:I.kernelCategoryForConda;case"PipEnv":return I.kernelCategoryForPipEnv;case"Poetry":return I.kernelCategoryForPoetry;case"Pyenv":return I.kernelCategoryForPyEnv;case"Venv":case"VirtualEnv":case"VirtualEnvWrapper":return I.kernelCategoryForVirtual;default:return I.kernelCategoryForGlobal}}default:return""}}var db=class{constructor(e,t,n,i){this.platform=e;this.jupyterUriProviderRegistration=t;this.disposables=n;this.interpreters=i;this.details=new Map}getDisplayData(e){if(!this.details.get(e.id)){let i=ct(e),o=XN(e,this.platform);e.kind==="connectToLiveRemoteKernel"&&(o=YN(e));let s=JT(e),a=e.kind==="connectToLiveRemoteKernel"?()=>YN(e):void 0,l=new qT(i,o,"",s,void 0,a);if(this.disposables.push(l),this.details.set(e.id,l),e.kind==="startUsingPythonInterpreter"&&Hr(e.interpreter)){let c=u=>{let p=u.find(g=>g.id===e.interpreter?.id),f=Ai(ho().find(g=>g.id===p?.id));if(e.kind==="startUsingPythonInterpreter"&&f){e.updateInterpreter(f);let g=ct(e),v=XN(e,this.platform),b=JT(e),C=!1;g!==l.label&&(l.label=g,C=!0),v!==l.description&&(l.description=v,C=!0),b!==l.category&&(l.category=b,C=!0),C&&l.triggerChange()}};this.interpreters.onDidChangeInterpreter(u=>u?c([u]):void 0,this,this.disposables)}}let t=this.details.get(e.id);if(this.details.set(e.id,t),e.kind==="connectToLiveRemoteKernel"||e.kind==="startUsingRemoteKernelSpec"){let i=ay(e.serverProviderHandle,this.jupyterUriProviderRegistration,I.kernelDefaultRemoteDisplayName);t.serverDisplayName!==i&&(t.serverDisplayName=i,t.triggerChange())}let n=VG(e);return t.category!==n&&(t.category=n,t.triggerChange()),t}};db=y([(0,_f.injectable)(),m(0,(0,_f.inject)(wr)),m(1,(0,_f.inject)($t)),m(2,(0,_f.inject)(O)),m(3,(0,_f.inject)(rt))],db);var wu=P(M()),Eu=require("vscode");var wd=P(M()),JG=require("vscode");var BG=require("vscode");function $T(r){try{return Kk(yo(r))||r.getCells().find(t=>t.kind===BG.NotebookCellKind.Code)?.document.languageId}catch(e){d.warn("Failed to determine language of first cell",e)}}var qG="DATASCIENCE.LAST_SAVED_CELL_LANGUAGE",us=class{constructor(e,t,n){this.disposables=e;this.globalMemento=t;this.pythonExtensionChecker=n}getPreferredLanguage(e){let t=e?.language_info?.name||e?.kernelspec?.language||this.lastSavedNotebookCellLanguage,n=this.pythonExtensionChecker.isPythonExtensionInstalled?ye:"plaintext";return Cl(t||n)}activate(){JG.workspace.onDidSaveNotebookDocument(this.onDidSaveNotebookDocument,this,this.disposables)}getSupportedLanguages(e){if(vt(e))return zj;{let t=Cl(Io(e)||"");return t&&MS.includes(t.toLowerCase())?[t,"raw"]:[]}}get lastSavedNotebookCellLanguage(){return this.globalMemento.get(qG)}async onDidSaveNotebookDocument(e){if(!Dt(e))return;let t=$T(e);t&&t!==this.lastSavedNotebookCellLanguage&&await this.globalMemento.update(qG,t)}};y([zr("Saving last saved cell language")],us.prototype,"onDidSaveNotebookDocument",1),us=y([(0,wd.injectable)(),m(0,(0,wd.inject)(O)),m(1,(0,wd.inject)(Ve)),m(1,(0,wd.named)(ft)),m(2,(0,wd.inject)($e))],us);function $G(r){let e={kernelSpecCount:0,localKernelSpecCount:0,remoteKernelSpecCount:0,kernelInterpreterCount:0,kernelLiveCount:0};r.forEach(t=>{switch(t.kind){case"connectToLiveRemoteKernel":e.kernelLiveCount+=1;break;case"startUsingRemoteKernelSpec":e.localKernelSpecCount+=1,e.kernelSpecCount+=1;break;case"startUsingLocalKernelSpec":e.remoteKernelSpecCount+=1,e.kernelSpecCount+=1;break;case"startUsingPythonInterpreter":{e.kernelInterpreterCount+=1;break}default:break}}),A("DS_INTERNAL.KERNEL_COUNT",{...e})}var Mt=require("vscode");var lc=require("vscode");var bi=Symbol("INotebookEditorProvider");var HG=require("vscode");async function GG(r,e){let t=e?.findNotebookEditor(r);return t?HG.commands.executeCommand("notebook.selectKernel",{notebookEditor:t}):(d.error("Unable to select kernel as the Notebook document could not be identified"),!1)}var zG=require("vscode");var HT=class extends Pl{constructor(e){super(I.failedToStartAnUntrustedKernelSpec(ct(e),e.kernelSpec.specFile?B(zG.Uri.file(e.kernelSpec.specFile)):""),void 0,e)}};var ta=class r{static async switchController(e,t){let i=t.get(bi).findNotebookEditor(e),o=t.get(pt),s,a=oe(),l=o.onControllerSelected(u=>a.resolve(u.controller));return await GG(e,t.get(bi))&&i&&(s=await a.promise),l.dispose(),s?{controller:s.controller,metadata:s.connection}:void 0}static async notifyAndRestartDeadKernel(e){let t=await lc.window.showErrorMessage(I.cannotRunCellKernelIsDead(ct(e.kernelConnectionMetadata)),{modal:!0},I.showJupyterLogs,I.restartKernel),n=!1;switch(t){case I.restartKernel:{await e.restart(),n=!0;break}case I.showJupyterLogs:lc.commands.executeCommand(q.ViewJupyterOutput).then(h,h)}return n}static async handleKernelError(e,t,n,i,o,s,a,l){let c=e.get(Ve,ft),u=e.get(Zr);a.interpreter&&n==="start"&&q8(c,19,a.interpreter.uri).catch(h);let p=await u.handleKernelError(t,n,a,i,l),f=ht(a);switch(e.tryGet(hi)?.isSupported&&f&&n==="start"&&_t(i,"DS_INTERNAL.RAWKERNEL_SESSION_NO_IPYKERNEL",{reason:p}),o.dispose().catch(h),p){case 1:case 2:throw t;case 3:{let b=await r.switchController(i,e);if(!b)throw t;s=b.controller,a=b.metadata;break}}return{controller:s,metadata:a}}static convertContextToFunction(e,t){switch(e){case"start":case"execution":return n=>n.start(t);case"interrupt":return n=>n.interrupt();case"restart":return n=>n.restart()}}static{this.connectionsByNotebook=new WeakMap}static{this.connectionsByUri=new Map}static async verifyKernelState(e,t,n,i,o,s,a){let{kernel:l,deadKernelAction:c}=await i;if(Y_(l)){if(this.deleteKernelInfo(t,i),c==="deadKernelWasNoRestarted")throw new od(l.kernelConnectionMetadata);return c==="deadKernelWasRestarted"?l:r.wrapKernelMethod(l.kernelConnectionMetadata,"start",o,e,t,n,a,s)}return l}static async wrapKernelMethod(e,t,n,i,o,s,a,l=()=>void 0){let c=this.getKernelInfo(o);if(!s.disableUI&&c?.options.disableUI&&(c.options.disableUI=!1),!s.disableUI&&c?.kernel.resolved&&(c?.kernel.value?.kernel?.disposed||c?.kernel.value?.kernel?.disposing)&&(this.deleteKernelInfo(o),c=void 0),c&&t!=="restart"&&t!=="interrupt")return r.verifyKernelState(i,o,s,c.kernel.promise,n,l,a);d.debug(`${t} the kernel, options.disableUI=${s.disableUI} for ${B("notebook"in o?o.notebook.uri:o.resource)}`);let u=r.wrapKernelMethodImpl(e,t,i,o,s,n,l),p=Is(u);return p.promise.catch(h),u.then(f=>{f.kernel.onDisposed(()=>{this.deleteKernelInfo(o,p.promise)},void 0,a)}).catch(()=>{this.deleteKernelInfo(o,p.promise)}),this.setKernelInfo(o,p,s),r.verifyKernelState(i,o,s,p.promise,n,l,a)}static getKernelInfo(e){return"notebook"in e?r.connectionsByNotebook.get(e.notebook):r.connectionsByUri.get(e.resource.toString())}static setKernelInfo(e,t,n){"notebook"in e?r.connectionsByNotebook.set(e.notebook,{kernel:t,options:n}):r.connectionsByUri.set(e.resource.toString(),{kernel:t,options:n})}static deleteKernelInfo(e,t){if(!t){"notebook"in e?r.connectionsByNotebook.delete(e.notebook):r.connectionsByUri.delete(e.resource.toString());return}"notebook"in e&&r.connectionsByNotebook.get(e.notebook)?.kernel.promise===t?r.connectionsByNotebook.delete(e.notebook):e.resource&&r.connectionsByUri.get(e.resource.toString())?.kernel.promise===t&&r.connectionsByUri.delete(e.resource.toString())}static verifyWeCanStartKernel(e,t){if(!ht(e)||!e.kernelSpec.specFile)return;if(!t.get(gd).isTrusted(lc.Uri.file(e.kernelSpec.specFile)))throw new HT(e)}static async wrapKernelMethodImpl(e,t,n,i,o,s,a){let l=n.get(Te),c=n.get(Em),u,p=r.convertContextToFunction(t,o),f=t,g="controller"in i?i.controller:void 0;for(t==="start"&&r.verifyWeCanStartKernel(e,n);u===void 0;){if("notebook"in i&&i.notebook.isClosed)throw new lc.CancellationError;u="notebook"in i?l.getOrCreate(i.notebook,{metadata:e,controller:g||i.controller,resourceUri:i.resource}):c.getOrCreate(i.resource,{metadata:e,resourceUri:i.resource});try{if(t!=="restart"&&Y_(u)&&!o.disableUI){let v=await r.notifyAndRestartDeadKernel(u);return{kernel:u,deadKernelAction:v?"deadKernelWasRestarted":"deadKernelWasNoRestarted"}}else{if(a(f,u),await p(u),"notebook"in i&&i.notebook.isClosed)throw new lc.CancellationError;Y_(u)&&!o.disableUI&&f!=="interrupt"&&await r.notifyAndRestartDeadKernel(u)}}catch(v){if(pr(v)||d.warn(`Error occurred while trying to ${f} the kernel, options.disableUI=${o.disableUI}`,v),o.disableUI)throw v;if("notebook"in i&&i.notebook.isClosed)throw new lc.CancellationError;let b=await r.handleKernelError(n,v,f,i.resource,u,g,e,s);if(g=b.controller,e=b.metadata,p=C=>C.start(o),f="start",s==="3rdPartyExtension")throw v;u=void 0}}return{kernel:u}}static async connectToNotebookKernel(e,t,n,i,o,s="jupyterExtension",a=()=>void 0){return r.wrapKernelMethod(e,"start",s,t,n,i,o,a)}static async connectToKernel(e,t,n,i,o,s="jupyterExtension",a=()=>void 0){return r.wrapKernelMethod(e,"start",s,t,n,i,o,a)}};var Tf=class{constructor(e){this.controller=e}get id(){return this.controller.id}createNotebookCellExecution(e){return this.controller.createNotebookCellExecution(e)}};var zT=require("vscode");var GT=class extends tr{constructor(t,n,i){super();this.kernel=t;this.controller=n;this.notebook=i}initialize(){let t=this.kernel,n=this.controller,i=this.notebook;if(t.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"||t.status!=="busy"&&t.status!=="unknown"||!n.createNotebookExecution)return;this._register(zT.workspace.onDidCloseNotebookDocument(s=>{s===i&&this.dispose()},this)),this._register(n.onDidChangeSelectedNotebooks(s=>{s.notebook===i&&s.selected===!1&&this.dispose()},this)),this._register(t.onStatusChanged(s=>{s!=="busy"&&s!=="unknown"&&this.dispose()},this));let o=n.createNotebookExecution(i);o.start(),this._register(new zT.Disposable(()=>o.end()))}};var QT=class r{constructor(e,t,n,i,o,s,a,l,c,u,p){this.kernelConnection=e;this._viewType=n;this.kernelProvider=i;this.context=o;this.languageService=a;this.configuration=l;this.extensionChecker=c;this.serviceContainer=u;this.displayDataProvider=p;this._onNotebookControllerSelectionChanged=new Mt.EventEmitter;this._onConnecting=new Mt.EventEmitter;this.pendingCellAdditions=new WeakMap;this._onDidDispose=new Mt.EventEmitter;this.disposables=[];this.notebookKernels=new WeakMap;this.isDisposed=!1;this.runningCellExecutions=new WeakMap;this.associatedDocuments=new WeakMap;this.restoredConnections=new WeakSet;d9(e.id,e.interpreter?.id),s.push(this),this._onNotebookControllerSelected=new Mt.EventEmitter,this.displayData=this.displayDataProvider.getDisplayData(this.connection),this.controller=Mt.notebooks.createNotebookController(t,n,this.displayData.label,this.handleExecution.bind(this),this.getRendererScripts()),this.displayData.onDidChange(this.updateDisplayData,this,this.disposables),this.updateDisplayData(),this.controller.interruptHandler=this.handleInterrupt.bind(this),this.controller.supportsExecutionOrder=!0,this.controller.supportedLanguages=this.languageService.getSupportedLanguages(e),this.controller.onDidChangeSelectedNotebooks(this.onDidChangeSelectedNotebooks,this,this.disposables),Mt.workspace.onDidCloseNotebookDocument(f=>{this.associatedDocuments.delete(f)},this,this.disposables)}get id(){return this.controller.id}get label(){return this.controller.label}get connection(){return this.kernelConnection}get viewType(){return this._viewType}get onNotebookControllerSelected(){return this._onNotebookControllerSelected.event}get onNotebookControllerSelectionChanged(){return this._onNotebookControllerSelectionChanged.event}get onConnecting(){return this._onConnecting.event}get onDidReceiveMessage(){return this.controller.onDidReceiveMessage}get onDidDispose(){return this._onDidDispose.event}isAssociatedWithDocument(e){return this.associatedDocuments.has(e)}static create(e,t,n,i,o,s,a,l,c,u,p,f){let g=new r(e,t,n,i,o,s,a,l,c,u,p);try{g.controller.variableProvider=f}catch(v){d.warn("Failed to attach variable provider",v)}return g}async restoreConnection(e){if(this.restoredConnections.has(e))return;this.restoredConnections.add(e);let t=await this.connectToKernel(e,new Ht(!0));if(this.kernelConnection.kind==="connectToLiveRemoteKernel"){let u=new GT(t,this.controller,e);this.disposables.push(u),u.initialize()}let n=this.kernelProvider.getKernelExecution(t),o=await this.serviceContainer.get(Ka).getLastTrackedCellExecution(e,t);if(!t.session?.kernel||n.pendingCells.length||!o||e.cellCount<o.cellIndex||e.cellAt(o.cellIndex).kind!==Mt.NotebookCellKind.Code)return;let s=!1,a=[],l,c=(u,p)=>{if(!(p.direction==="send"||s)&&hu(p.msg)===o.msg_id){if("msg_type"in p.msg&&p.msg.msg_type==="status"&&"execution_state"in p.msg.content&&p.msg.content.execution_state==="idle")return;s=!0,n.resumeCellExecution(e.cellAt(o.cellIndex),{msg_id:o.msg_id,startTime:o.startTime,executionCount:o.executionCount}).catch(h),z(a)}};t.session.kernel.anyMessage.connect(c),l=new Mt.Disposable(()=>{ai(()=>t.session?.kernel?.anyMessage.disconnect(c))}),a.push(l),this.disposables.push(l)}updateConnection(e){e.kind!=="connectToLiveRemoteKernel"&&(this.controller.label=ct(e))}asWebviewUri(e){return this.controller.asWebviewUri(e)}postMessage(e,t){let n=e&&"message"in e?e.message:"";return d.ci(`\x1B[32mPosting message to Notebook UI ${n}`),this.controller.postMessage(e,t)}setPendingCellAddition(e,t){if(this.viewType!==yt)throw new Error("setPendingCellAddition only applies to the Interactive Window");this.pendingCellAdditions.set(e,t)}dispose(){if(this.isDisposed)return;let e=Mt.workspace.notebookDocuments.filter(t=>this.associatedDocuments.has(t)).map(t=>t.uri.toString());d.debug(`Disposing controller ${this.id} associated with connection ${this.connection.id} ${e.length?"and documents "+e.join(", "):""}`),d.ci(`Disposing controller ${this.id} associated with connection ${this.connection.id} ${e.length?"and documents "+e.join(", "):""} called from ${new Error("").stack}`),this.isDisposed=!0,this._onNotebookControllerSelected.dispose(),this._onNotebookControllerSelectionChanged.dispose(),this._onConnecting.dispose(),this.controller.dispose(),this._onDidDispose.fire(),this._onDidDispose.dispose(),z(this.disposables)}updateDisplayData(){this.controller.label=this.displayData.label;let e=this.connection.kind==="connectToLiveRemoteKernel"?"":this.displayData.description;this.controller.description=e,this.displayData.serverDisplayName&&(this.controller.description=e?`${e} (${this.displayData.serverDisplayName})`:this.displayData.serverDisplayName)}async handleExecution(e,t){if(e.length<1)return;let n=Nn(t);n?.cellExecutionCount(e.length);let i=n?.preExecuteCellTelemetry();this.pendingCellAdditions.has(t)&&await this.pendingCellAdditions.get(t),e=e.filter(o=>o.index<0?(d.warn(`Attempting to run a cell with index ${o.index}, kind ${o.kind}, text = ${o.document.getText()}`),!1):!0),Mt.workspace.isTrusted&&(d.debug(`Handle Execution of Cells ${e.map(o=>o.index)} for ${B(t.uri)}`),await Qs(t.uri,this.connection),i?.stop(),await Promise.all(e.map(o=>this.executeCell(t,o))))}async onDidChangeSelectedNotebooks(e){if(d.ci(`NotebookController selection event called for notebook ${e.notebook.uri.toString()} & controller ${this.connection.kind}:${this.id}. Selected ${e.selected} `),this.associatedDocuments.has(e.notebook)&&e.selected)return;if(!e.selected){let n=this.kernelProvider.get(e.notebook);n?.kernelConnectionMetadata.id===this.kernelConnection.id&&(d.info(`Disposing kernel ${this.kernelConnection.id} for notebook ${B(e.notebook.uri)} due to selection of another kernel or closing of the notebook`),n.dispose().catch(h)),this.associatedDocuments.delete(e.notebook),this._onNotebookControllerSelectionChanged.fire(e);return}if(!Dt(e.notebook)&&e.notebook.notebookType!==yt||!Mt.workspace.isTrusted)return;Nn(e.notebook)?.kernelSelected(this.kernelConnection.id,this.kernelConnection.interpreter?.id),Qye(this.kernelConnection);let t=oe();d.ci(`Controller ${this.connection.kind}:${this.id} associated with nb ${B(e.notebook.uri)}`),this.associatedDocuments.set(e.notebook,t.promise),await this.onDidSelectController(e.notebook),await this.updateCellLanguages(e.notebook),this._onNotebookControllerSelected.fire({notebook:e.notebook,controller:this}),this._onNotebookControllerSelectionChanged.fire(e),d.debug("Controller selection change completed"),t.resolve()}async updateCellLanguages(e){let t=this.controller.supportedLanguages;if(!t||t?.length===0)return;let i=vt(this.kernelConnection)?ye:t[0];await Promise.all(e.getCells().filter(o=>o.kind===Mt.NotebookCellKind.Code).map(async o=>{t.includes(o.document.languageId)||await Mt.languages.setTextDocumentLanguage(o.document,i).then(h,h)}))}getRendererScripts(){return this.context.extensionMode===Mt.ExtensionMode.Development||this.context.extensionMode===Mt.ExtensionMode.Test?[new Mt.NotebookRendererScript(Mt.Uri.joinPath(this.context.extensionUri,"dist","webviews","webview-side","widgetTester","widgetTester.js"))]:[]}handleInterrupt(e){d.debug(`VS Code interrupted kernel for ${B(e.uri)}`),e.getCells().forEach(t=>gt(t,"Cell cancellation requested")),Mt.commands.executeCommand(q.InterruptKernel,{notebookEditor:{notebookUri:e.uri}}).then(h,t=>d.error("Failed to interrupt",t))}createCellExecutionIfNecessary(e,t){let n=this.runningCellExecutions.get(e.notebook);if(!n||n.cell===e){n?.end(void 0,void 0),n=Mi.getOrCreate(e,t,!0),this.runningCellExecutions.set(e.notebook,n);let i=n.end.bind(n);n.end=(o,s)=>{this.runningCellExecutions.delete(e.notebook),i(o,s)}}return n}async executeCell(e,t,n){let i=new $r,o=i.add(new Mt.CancellationTokenSource);i.add(Mt.workspace.onDidCloseNotebookDocument(f=>f===e?o.cancel():void 0));let s=this.createCellExecutionIfNecessary(t,new Tf(this.controller)),a="start",l,c=new Tf(this.controller),u=!1,p=this.serviceContainer.get(Ka);try{if(l=await this.connectToKernel(e,new Ht(!1)),l.disposing)throw new Mt.CancellationError;let f=Nn(e)?.executeCell();f&&i.add(new Mt.Disposable(()=>f.stop())),u=!0,l&&l.controller.id!==c.id&&(c=l.controller,s=this.createCellExecutionIfNecessary(t,l.controller)),a="execution",l.controller.id===this.id&&this.updateKernelInfoInNotebookWhenAvailable(l,e),p.trackCellExecution(t,l);let v=this.kernelProvider.getKernelExecution(l).executeCell(t,n);return v.then(()=>{if(l&&!TS.isExiting)return p.deleteTrackedCellExecution(t,l)}).catch(h),await v}catch(f){if(f instanceof hd)return;pr(f)||d.error("Error in execution",f),u||(s.start(),s.clearOutput(t).then(h,h));let g=this.serviceContainer.get(Zr);f=cn.unwrap(f);let v=pr(f)||f instanceof od;await vp(t,c,await g.getErrorMessageForDisplayInCell(f,a,e.uri),v)}finally{i.dispose()}}async connectToKernel(e,t){let n=Nn(e)?.startKernel();return this._onConnecting.fire(),ta.connectToNotebookKernel(this.kernelConnection,this.serviceContainer,{resource:e.uri,notebook:e,controller:this.controller},t,this.disposables).finally(()=>n?.stop())}updateKernelInfoInNotebookWhenAvailable(e,t){if(this.notebookKernels.get(t)===e)return;this.notebookKernels.set(t,e);let n=[];Mt.workspace.onDidCloseNotebookDocument(s=>{s===t&&z(n)},this,n);let i=e.onDisposed(()=>z(n)),o=e.onStatusChanged(async()=>{e.disposed||!e.info||this.associatedDocuments.has(t)&&(await QG(t,e.kernelConnectionMetadata,e.info),e.info.status==="ok"&&z(n))});n.push({dispose:()=>o.dispose()}),n.push({dispose:()=>i?.dispose()})}async onDidSelectController(e){let t=this.connection,n=this.kernelProvider.get(e);if(n&&$9(n.kernelConnectionMetadata,t)){d.info("Switch kernel did not change kernel.");return}if(_t(e.uri,"DS_INTERNAL.SWITCH_KERNEL"),n&&Mt.window.visibleNotebookEditors.filter(s=>s.notebook===e).forEach(s=>this.postMessage({message:"IPyWidgets_onKernelChanged",payload:void 0},s)),await QG(e,t),e.notebookType===yt)return;let i=this.kernelProvider.getOrCreate(e,{metadata:t,controller:this.controller,resourceUri:e.uri});if(d.debug(`KernelProvider switched kernel to id = ${i.kernelConnectionMetadata.id}`),vt(this.kernelConnection)&&!this.extensionChecker.isPythonExtensionInstalled)return;let o=this.serviceContainer.get(gd);!this.configuration.getSettings(void 0).disableJupyterAutoStart&&ht(this.kernelConnection)&&this.kernelConnection.kernelSpec.specFile&&o.isTrusted(Mt.Uri.file(this.kernelConnection.kernelSpec.specFile))&&this.connectToKernel(e,new Ht(!0))}};async function QG(r,e,t){let n=yo(r)||{},{changed:i}=await j9(n,e,t);i&&await t9(r,n)}async function Qye(r){let e=await ap(r.interpreter,!0),t=e?.major||0,n=e?.minor||0;!e||t>=4||t<=0||n<=-1||r.kind!=="startUsingLocalKernelSpec"&&r.kind!=="startUsingPythonInterpreter"||(t<3||t===3&&n<=5)&&Mt.window.showWarningMessage(I.warnWhenSelectingKernelWithUnSupportedPythonVersion,me.learnMore).then(i=>{if(i===me.learnMore)return Fp("https://aka.ms/jupyterUnSupportedPythonKernelVersions")},h)}var mb=class{constructor(e,t,n,i,o,s){this.disposables=e;this.pythonEnvFilter=t;this.extensionChecker=n;this.serviceContainer=i;this.serverUriStorage=o;this.kernelFinder=s;this.registeredControllers=new Map;this.changeEmitter=new Eu.EventEmitter;this.registeredMetadatas=new Map;this.selectedEmitter=new Eu.EventEmitter;this.selectionChangedEmitter=new Eu.EventEmitter;this.selectedControllers=new WeakMap;this._activeInterpreterControllerIds=new Set}get onDidChange(){return this.changeEmitter.event}get registered(){return[...this.registeredControllers.values()]}get all(){return this.metadatas}get metadatas(){return[...this.registeredMetadatas.values()]}get onControllerSelected(){return this.selectedEmitter.event}get onControllerSelectionChanged(){return this.selectionChangedEmitter.event}activate(){this.kernelFinder.onDidChangeKernels(()=>this.loadControllers(),this,this.disposables),this.kernelFinder.registered.forEach(e=>this.monitorDeletionOfConnections(e)),this.kernelFinder.onDidChangeRegistrations(e=>e.added.forEach(t=>this.monitorDeletionOfConnections(t)),this,this.disposables),this.pythonEnvFilter.onDidChange(this.onDidChangeFilter,this,this.disposables),this.serverUriStorage.onDidChange(this.onDidChangeFilter,this,this.disposables),this.serverUriStorage.onDidChange(this.onDidChangeUri,this,this.disposables),this.serverUriStorage.onDidRemove(this.onDidRemoveServers,this,this.disposables),this.onDidChange(({added:e})=>{e.forEach(t=>{t.onNotebookControllerSelectionChanged(n=>{!n.selected&&this.isFiltered(t.connection)&&this.canControllerBeDisposed(t)&&(d.warn(`Removing controller ${t.id} for ${t.connection.kind} from kernel list`),t.dispose())},this,this.disposables)})},this,this.disposables),Eu.workspace.onDidOpenNotebookDocument(this.onDidOpenNotebookDocument,this,this.disposables),Eu.workspace.notebookDocuments.forEach(e=>this.onDidOpenNotebookDocument(e).catch(h)),this.loadControllers()}loadControllers(){this.controllersPromise=this.loadControllersImpl(),$G(this.registered.map(e=>e.connection)),d.ci(`Providing notebook controllers with length ${this.registered.length}.`)}get loaded(){return this.controllersPromise}async onDidOpenNotebookDocument(e){e.notebookType!==Et&&e.notebookType!==yt||Eu.workspace.isTrusted}async loadControllersImpl(){let e=this.kernelFinder.kernels;this.createNotebookControllers(e),Array.from(this.registered).filter(n=>{let i=e.some(o=>o.id===n.connection.id)||wi&&this._activeInterpreterControllerIds.has(n.id);return!i&&n.connection.kind==="connectToLiveRemoteKernel"?!0:this.canControllerBeDisposed(n)?(i||d.debug(`Controller ${n.connection.kind}:'${n.id}' for view = '${n.viewType}' is no longer a valid`),!i):!1}).forEach(n=>{d.warn(`Disposing old controller ${n.connection.kind}:'${n.id}' for view = '${n.viewType}'`),n.dispose()})}createNotebookControllers(e){if(e.length!==0)try{this.batchAdd(e,[Et,yt])}catch(t){if(!pr(t,!0))throw t}}async monitorDeletionOfConnections(e){let t=e.onDidChangeKernels(({removed:n})=>{let i=new Set((n||[]).map(o=>o.id));this.registered.filter(o=>i.has(o.connection.id)).forEach(o=>{d.warn(`Deleting controller ${o.id} as it is associated with a connection that has been deleted ${o.connection.kind}:${o.id}`),o.dispose()})},this,this.disposables);this.kernelFinder.onDidChangeRegistrations(n=>{n.removed.includes(e)&&t.dispose()})}onDidChangeUri(){this.onDidChangeFilter()}async onDidRemoveServers(e){e.forEach(t=>{this.registered.forEach(n=>{Nt(n.connection)&&n.connection.serverProviderHandle.id===t.id&&n.connection.serverProviderHandle.handle===t.handle&&(d.warn(`Deleting controller ${n.id} as it is associated with a connection that has been removed`),n.dispose())})}),this.onDidChangeFilter()}onDidChangeFilter(){this.all.filter(t=>!this.isFiltered(t)).forEach(t=>this.addOrUpdate(t,[Et,yt])),this.registered.forEach(t=>{this.isFiltered(t.connection)&&this.canControllerBeDisposed(t)&&(d.warn(`Deleting controller ${t.id} as it is associated with a connection that has been hidden`),t.dispose())})}batchAdd(e,t){let n=[];e.forEach(i=>{let{added:o}=this.addImpl(i,t,!1);n.push(...o)}),n.length&&this.changeEmitter.fire({added:n,removed:[]})}trackActiveInterpreterControllers(e){e.forEach(t=>this._activeInterpreterControllerIds.add(t.id))}canControllerBeDisposed(e){return!this._activeInterpreterControllerIds.has(e.id)&&!this.isControllerAttachedToADocument(e)}getSelected(e){return this.selectedControllers.get(e)}addOrUpdate(e,t){let{added:n,existing:i}=this.addImpl(e,t,!0);return n.concat(i)}addImpl(e,t,n){let i=[],o=[];d.ci(`Create Controller for ${e.kind} and id '${e.id}' for view ${t.join(", ")}`);try{t.map(s=>{let a=this.getControllerId(e,s);return this.registeredMetadatas.set(e.id,e),[a,s]}).filter(([s])=>{let a=this.registeredControllers.get(s);return a?(a.updateConnection(e),o.push(a),d.ci(`Found existing controller '${a.id}', not creating a new one just updating it`),!1):this.isFiltered(e)?(d.ci(`Existing controller '${s}' will be excluded as it is filtered`),!1):(d.ci(`Existing controller not found for '${s}', hence creating a new one`),!0)}).forEach(([s,a])=>{let l=QT.create(e,s,a,this.serviceContainer.get(Te),this.serviceContainer.get(ot),this.disposables,this.serviceContainer.get(us),this.serviceContainer.get(le),this.extensionChecker,this.serviceContainer,this.serviceContainer.get(bp),this.serviceContainer.get(AT)),c=[];l.onDidDispose(()=>{d.ci(`Deleting controller '${l.id}' associated with view ${a} from registration as it was disposed`),this.registeredControllers.delete(l.id),c.forEach(u=>u.dispose())},this,this.disposables),this.disposables.push(l),this.registeredControllers.set(l.id,l),i.push(l),l.onNotebookControllerSelected(u=>{d.ci(`Controller ${u.controller?.id} selected for ${u.notebook.uri.toString()}`),this.selectedControllers.set(u.notebook,u.controller),this.selectedEmitter.fire(u)},this,c),l.onNotebookControllerSelectionChanged(u=>this.selectionChangedEmitter.fire({...u,controller:l}),this,c)}),n&&i.length&&this.changeEmitter.fire({added:i,removed:[]})}catch(s){if(pr(s,!0))return{added:i,existing:o};d.error(`Failed to create notebook controller for ${e.id}`,s)}return{added:i,existing:o}}get(e,t){let n=this.getControllerId(e,t);return this.registeredControllers.get(n)}isFiltered(e){return!1}getControllerId(e,t){return t===Et?e.id:`${e.id}${i3}`}isControllerAttachedToADocument(e){return Eu.workspace.notebookDocuments.some(t=>e.isAssociatedWithDocument(t))}};mb=y([(0,wu.injectable)(),m(0,(0,wu.inject)(O)),m(1,(0,wu.inject)(di)),m(2,(0,wu.inject)($e)),m(3,(0,wu.inject)(at)),m(4,(0,wu.inject)(zt)),m(5,(0,wu.inject)(Rr))],mb);var Ed=P(M());var YT=class{constructor(e,t,n){this.kernel=e;this.localResourceUriConverter=t;this.scriptManagerFactory=n;this.id="local"}async getWidgetScriptSource(e){return(await this.getWidgetScriptSources()).find(i=>i.moduleName.toLowerCase()===e.toLowerCase())||{moduleName:e}}dispose(){}async getWidgetScriptSources(){let t=await this.scriptManagerFactory.getOrCreate(this.kernel).getWidgetModuleMappings();return t&&Object.keys(t).length?await Promise.all(Object.keys(t).map(async i=>{let o=(await this.localResourceUriConverter.asWebviewUri(t[i])).toString();return{moduleName:i,scriptUri:o,source:"local"}})):[]}async getBaseUrl(){let e=this.scriptManagerFactory.getOrCreate(this.kernel);if(!e.getBaseUrl)return;let t=await e.getBaseUrl();if(t)return this.localResourceUriConverter.asWebviewUri(t)}};var YG=require("vscode"),XT=class{constructor(e,t){this.id="remote";if(e.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"&&e.kernelConnectionMetadata.kind!=="startUsingRemoteKernelSpec")throw new Error("Invalid usage of this class, can only be used with remtoe kernels");this.kernelConnection=e.kernelConnectionMetadata,this.scriptManager=t.getOrCreate(e)}static{this.validUrls=new Map}dispose(){}async getBaseUrl(){return YG.Uri.parse(this.kernelConnection.baseUrl)}async getWidgetScriptSource(e){let n=(await this.getWidgetScriptSources()).find(i=>i.moduleName.toLowerCase()===e.toLowerCase());if(!n&&e.includes("/")){let i=await this.getBaseUrl();return{moduleName:e,scriptUri:`${i.toString()}${e}`,source:"remote"}}return n||{moduleName:e}}async getWidgetScriptSources(){let e=await this.scriptManager.getWidgetModuleMappings();return e&&Object.keys(e).length?await Promise.all(Object.keys(e).map(async n=>({moduleName:n,scriptUri:e[n].toString(),source:"remote"}))):[]}};var fb=class{constructor(e,t,n){this.configurationSettings=e;this.widgetScriptManagerFactory=t;this.globalMemento=n}getProviders(e,t){let n=[];switch(n.push(new Fa(this.globalMemento,this.configurationSettings)),e.kernelConnectionMetadata.kind){case"connectToLiveRemoteKernel":case"startUsingRemoteKernelSpec":n.push(new XT(e,this.widgetScriptManagerFactory));break;default:n.push(new YT(e,t,this.widgetScriptManagerFactory))}return n}};fb=y([(0,Ed.injectable)(),m(0,(0,Ed.inject)(le)),m(1,(0,Ed.inject)(VT)),m(2,(0,Ed.inject)(Ve)),m(2,(0,Ed.named)(ft))],fb);var XG=P(M()),ZT=require("vscode");var hb=class{async getNbExtensionsParentPath(e){switch(e.kernelConnectionMetadata.kind){case"connectToLiveRemoteKernel":case"startUsingRemoteKernelSpec":return ZT.Uri.parse(e.kernelConnectionMetadata.baseUrl);case"startUsingPythonInterpreter":{let t=await ya(e.kernelConnectionMetadata.interpreter);return t?ZT.Uri.joinPath(ZT.Uri.file(t),"share","jupyter"):void 0}default:return}}};hb=y([(0,XG.injectable)()],hb);var ku=P(M());var Rf=require("vscode");var gL=require("vscode");var pz=P(cz());var uz=["require.config({","requirejs?.config({","window.requirejs?.config({","requirejs.config({",'["require"].config({',"['require'].config({",'["requirejs"].config({',"['requirejs'].config({",'["require"]["config"]({',"['require']['config']({",'["requirejs"]["config"]({',"['requirejs']['config']({"];async function ebe(r,e,t){let n=[...uz],i=await mt(e),o=0,s;for(;o<=0&&n.length&&(s=n.pop(),!!s);)o=t.indexOf(s);if(o<0){let f=[...uz].map(g=>g.substring(0,g.length-2));for(;o<=0&&f.length&&(s=f.pop(),!!s);)o=t.indexOf(s)}if(o<0){A("DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO",void 0,{widgetFolderNameHash:i,failed:!0,patternUsedToRegisterRequireConfig:s,failure:"couldNotLocateRequireConfigStart"});return}let a=t.indexOf(")",o);if(a<=0||!s){A("DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO",void 0,{widgetFolderNameHash:i,failed:!0,patternUsedToRegisterRequireConfig:s,failure:"couldNotLocateRequireConfigEnd"});return}let l=t.indexOf("{",o),c=t.substring(l,a);c=(0,pz.default)(c,{language:"javascript"}),c=Fe(c,{trim:!0,removeEmptyEntries:!0}).join("");let u=c.split("{")[c.split("{").length-1].split("}")[0].split(",").map(f=>f.trim()).filter(f=>f.length&&f.includes(":")),p={};if(u.forEach(f=>{let g=f.split(":"),v=cm(g[0].replace(/\\r/g,"").replace(/\\n/g,"").trim()).trim(),b=cm(f.substring(f.indexOf(":")+1).replace(/\\r/g,"").replace(/\\n/g,"").trim()).trim();p[v]=b.startsWith("http")?gL.Uri.parse(b):gL.Uri.joinPath(r,b)}),!p||!Object.keys(p).length){A("DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO",void 0,{widgetFolderNameHash:i,failed:!0,patternUsedToRegisterRequireConfig:s,failure:"noRequireConfigEntries"});return}return A("DS_INTERNAL.IPYWIDGET_EXTENSIONJS_INFO",{requireEntryPointCount:Object.keys(p).length},{widgetFolderNameHash:i,patternUsedToRegisterRequireConfig:s}),p}var gb=class{constructor(e){this.kernel=e;this.disposables=[];e.onRestarted(this.onKernelRestarted,this,this.disposables)}dispose(){z(this.disposables)}async getWidgetModuleMappings(){return this.widgetModuleMappings||(this.widgetModuleMappings=this.getWidgetModuleMappingsImpl()),this.widgetModuleMappings}onKernelRestarted(){this.widgetModuleMappings=void 0}async getConfigFromWidget(e,t,n){let i=await this.getWidgetScriptSource(t);try{let o=await ebe(e,n,i);if(!o){let s=`Failed to extract require.config from widget for ${n} from ${B(t)}`;wi&&(s+=`with contents ${i}`),d.warn(s)}return o}catch(o){d.error(`Failed to extract require.config entry for ${n} from ${B(t)}`,o)}}async getWidgetModuleMappingsImpl(){let e=new We,[t,n]=await Promise.all([this.getWidgetEntryPoints(),this.getNbExtensionsParentPath()]);if(!n)return;let o=(await Promise.all(t.map(s=>this.getConfigFromWidget(n,s.uri,s.widgetFolderName)))).reduce((s,a)=>Object.assign(s||{},a),{});return o&&Object.keys(o).length&&(delete o["jupyter-js-widgets"],delete o["@jupyter-widgets/base"],delete o["@jupyter-widgets/controls"],delete o["@jupyter-widgets/output"]),A("DS_INTERNAL.IPYWIDGET_DISCOVER_WIDGETS_NB_EXTENSIONS",{duration:e.elapsedTime},{type:ht(this.kernel.kernelConnectionMetadata)?"local":"remote"}),o&&Object.keys(o).length?o:void 0}};var n0=class extends gb{constructor(t,n,i,o){super(t);this.context=n;this.fs=i;this.connection=o;if(t.kernelConnectionMetadata.kind!=="connectToLiveRemoteKernel"&&t.kernelConnectionMetadata.kind!=="startUsingRemoteKernelSpec")throw new Error("Invalid usage, can only be used for remote kernels");this.kernelConnection=t.kernelConnectionMetadata,this.getWidgetEntryPoints().catch(h)}getBaseUrl(){return this.getNbExtensionsParentPath()}async getNbExtensionsParentPath(){return Rf.Uri.parse(this.kernelConnection.baseUrl)}onKernelRestarted(){this.widgetEntryPointsPromise=void 0,super.onKernelRestarted()}async getWidgetEntryPoints(){return this.widgetEntryPointsPromise||(this.widgetEntryPointsPromise=this.getWidgetEntryPointsImpl()),this.widgetEntryPointsPromise}getCodeToExecute(){return this.code||(this.code=this.fs.readFile(Rf.Uri.joinPath(this.context.extensionUri,"pythonFiles","printJupyWidgetEntryPoints.py"))),this.code}async getWidgetEntryPointsImpl(){if(!vt(this.kernelConnection))return[];let t=await this.getCodeToExecute();if(!this.kernel.session?.kernel)return d.ci("No Kernel session to get list of widget entry points"),[];let n=[];n.push(bn(this.kernel.session.kernel,t,{traceErrors:!0,traceErrorsMessage:"Failed to get widget entry points from remote kernel"})),!wi&&this.context.extensionMode===Rf.ExtensionMode.Production&&n.push(Ei(1e4).then(()=>[])),n.forEach(s=>s.catch(h));let i=await Promise.race(n);if(i.length===0)return d.ci("Unable to get widget entry points, no outputs after running the code"),[];let o=i[0];if(o.output_type!=="stream"||o.name!=="stdout")return d.ci("Unable to get widget entry points, no stream/stdout outputs after running the code"),[];try{return d.trace(`Widget Outputs include, ${o.text}`),o.text.trim().substring(1).slice(0,-1).split(",").map(a=>cm(a.trim()).replace(/\\\\/g,"/").replace(/\\/g,"/")).map(a=>({uri:Rf.Uri.joinPath(Rf.Uri.parse(this.kernelConnection.baseUrl),"nbextensions",a),widgetFolderName:lt(a)}))}catch(s){return d.error(`Failed to parse output to get list of IPyWidgets, output is ${o.text}`,s),[]}}async getWidgetScriptSource(t){let n=this.getWidgetScriptSourceUsingHttpClient(t),i=this.getWidgetScriptSourceUsingFetch(t),o=n.catch(()=>i);return o.catch(s=>{n.catch(a=>d.error(`Failed to download widget script source from ${t.toString(!0)}`,a)),d.error(`Failed to download widget script source from ${t.toString(!0)}`,s)}),o}async getWidgetScriptSourceUsingHttpClient(t){let n=t.toString(!0),o=await new Ql().downloadFile(n);if(o.status===200)return o.text();throw new Error(`Error downloading from ${n}: ${o.statusText}`)}async getWidgetScriptSourceUsingFetch(t){let n=await this.connection.createConnectionInfo(this.kernelConnection.serverProviderHandle),i=t.toString(!0),s=await new Ql(n.settings.fetch).downloadFile(i);if(s.status===200)return s.text();throw new Error(`Error downloading from ${i} using custom fetch: ${s.statusText}`)}};var vb=require("vscode");var i0=class r extends gb{constructor(t,n,i,o,s){super(t);this.fs=n;this.nbExtensionsPathProvider=i;this.context=o;this.jupyterPaths=s;this.overwriteExistingFiles=!0;this.overwriteExistingFiles=!r.nbExtensionsCopiedKernelConnectionList.has(t.kernelConnectionMetadata.id)}static{this.nbExtensionsCopiedKernelConnectionList=new Set}getBaseUrl(){return this.getNbExtensionsParentPath()}onKernelRestarted(){this.nbExtensionsParentPath=void 0,this.overwriteExistingFiles=!0,super.onKernelRestarted()}async getNbExtensionsParentPath(){return this.nbExtensionsParentPath||(this.nbExtensionsParentPath=this.getNbExtensionsParentPathImpl()),this.nbExtensionsParentPath}async getNbExtensionsParentPathImpl(){let t=this.overwriteExistingFiles;try{let n=new We;if(this.sourceNbExtensionsPath=await this.nbExtensionsPathProvider.getNbExtensionsParentPath(this.kernel),!this.sourceNbExtensionsPath){d.warn(`No nbextensions folder found for kernel ${this.kernel.kernelConnectionMetadata.id}`);return}let i=await mt(this.kernel.kernelConnectionMetadata.id),o=vb.Uri.joinPath(this.context.extensionUri,"temp","scripts",i,"jupyter"),s=vb.Uri.joinPath(o,"nbextensions"),[a]=await Promise.all([this.jupyterPaths.getDataDirs({resource:this.kernel.resourceUri,interpreter:this.kernel.kernelConnectionMetadata.interpreter}),this.fs.createDirectory(s)]),l=a.map(c=>vb.Uri.joinPath(c,"nbextensions"));l.reverse();for(let c of l)await this.fs.exists(c)&&await this.fs.copy(c,s,{overwrite:t});return this.overwriteExistingFiles=!1,r.nbExtensionsCopiedKernelConnectionList.add(this.kernel.kernelConnectionMetadata.id),A("DS_INTERNAL.IPYWIDGET_TIME_TO_COPY_NBEXTENSIONS_DIR",{duration:n.elapsedTime}),o}catch(n){throw A("DS_INTERNAL.IPYWIDGET_TIME_TO_COPY_NBEXTENSIONS_DIR",void 0,void 0,n),n}}async getWidgetEntryPoints(){let t=await this.getNbExtensionsParentPath();if(!t)return[];let n=vb.Uri.joinPath(t,"nbextensions");return(await this.fs.searchLocal("**/extension.js",n.fsPath,!0)).map(o=>({uri:vb.Uri.joinPath(n,o),widgetFolderName:lt(o)}))}getWidgetScriptSource(t){return this.fs.readFile(t)}};var yb=class{constructor(e,t,n,i,o,s){this.nbExtensionsPathProvider=e;this.fs=t;this.context=n;this.jupyterPaths=i;this.disposables=o;this.connection=s;this.managers=new WeakMap}getOrCreate(e){if(!this.managers.has(e))if(e.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel"||e.kernelConnectionMetadata.kind==="startUsingRemoteKernelSpec"){let t=new n0(e,this.context,this.fs,this.connection);this.managers.set(e,t),e.onDisposed(()=>t.dispose(),this,this.disposables)}else{let t=new i0(e,this.fs,this.nbExtensionsPathProvider,this.context,this.jupyterPaths);this.managers.set(e,t),e.onDisposed(()=>t.dispose(),this,this.disposables)}return this.managers.get(e)}};yb=y([(0,ku.injectable)(),m(0,(0,ku.inject)(WT)),m(1,(0,ku.inject)(mr)),m(2,(0,ku.inject)(ot)),m(3,(0,ku.inject)(jr)),m(4,(0,ku.inject)(O)),m(5,(0,ku.inject)(pn))],yb);var o0=P(M()),La=require("vscode");var ra=class{constructor(e){this.disposables=[];e.push(this)}dispose(){z(this.disposables)}activate(){let e=new bs(1e3);this.disposables.push(e),La.workspace.onDidChangeNotebookDocument(t=>{e.trigger(()=>this.onDidChangeNotebookDocument(t))},this,this.disposables)}onDidChangeNotebookDocument(e){Dt(e.notebook)&&e.cellChanges.some(t=>t.outputs&&t.outputs.some(n=>n.items&&n.items.some(i=>i.mime===Hi)))&&this.checkRendererExtensionVersion()}checkRendererExtensionVersion(){if(!La.workspace.isTrusted)return;let e=La.extensions.getExtension(Sh);if(!e){this.displayNotInstalledMessage();return}let t=e.packageJSON.version;if(!t){this.displayUpdateMessage();return}let n=t.split("."),i=parseInt(n[0],10),o=parseInt(n[1],10),s=parseInt(n[2],10);(i<1||i===1&&o===0&&s<15)&&this.displayUpdateMessage()}displayNotInstalledMessage(){ra.messageDisplayed||(ra.messageDisplayed=!0,La.window.showInformationMessage(I.rendererExtensionRequired,{modal:!0},me.bannerLabelYes).then(e=>{e===me.bannerLabelYes&&La.commands.executeCommand("extension.open",Sh).then(h,h)}).then(h,h))}displayUpdateMessage(){ra.messageDisplayed||(ra.messageDisplayed=!0,La.window.showInformationMessage(I.rendererExtension1015Required,{modal:!0},me.bannerLabelYes).then(e=>{e===me.bannerLabelYes&&La.commands.executeCommand("extension.open",Sh).then(h,h)}).then(h,h))}};ra.messageDisplayed=!1,ra=y([(0,o0.injectable)(),m(0,(0,o0.inject)(O))],ra);function dz(r,e){r.addSingleton(Cu,Cu),r.addSingleton(jT,fb),r.addSingleton(VT,yb),r.addSingleton(WT,hb),r.addSingleton(Fa,Fa),r.addSingleton(ge,ra)}var Pd=P(M()),Wr=require("vscode");var bb=class{constructor(e,t,n,i,o){this.controllerRegistration=e;this.kernelFinder=t;this.notebookEditorProvider=n;this.kernelDependency=i;this.localDisposables=[];this.providerMappings=new Map;this.kernelSpecsSourceRegistered=!1;o.push(this)}dispose(){z(this.localDisposables)}activate(){if(!ln()){this.localDisposables.push(Wr.notebooks.registerKernelSourceActionProvider(Et,{provideNotebookKernelSourceActions:()=>[{label:I.localPythonEnvironments,documentation:Wr.Uri.parse("https://aka.ms/vscodeJupyterExtKernelPickerPythonEnv"),command:"jupyter.kernel.selectLocalPythonEnvironment"}]})),this.localDisposables.push(Wr.notebooks.registerKernelSourceActionProvider(yt,{provideNotebookKernelSourceActions:()=>[{label:I.localPythonEnvironments,documentation:Wr.Uri.parse("https://aka.ms/vscodeJupyterExtKernelPickerPythonEnv"),command:"jupyter.kernel.selectLocalPythonEnvironment"}]}));let t=[],n=new Wr.EventEmitter;this.localDisposables.push(Wr.notebooks.registerKernelSourceActionProvider(Et,{onDidChangeNotebookKernelSourceActions:n.event,provideNotebookKernelSourceActions:()=>t})),this.localDisposables.push(Wr.notebooks.registerKernelSourceActionProvider(yt,{onDidChangeNotebookKernelSourceActions:n.event,provideNotebookKernelSourceActions:()=>t}));let i=()=>{this.kernelSpecsSourceRegistered||this.kernelFinder.kernels.some(o=>Ig(o))&&(this.kernelSpecsSourceRegistered=!0,t=[{label:I.localKernelSpecs,documentation:Wr.Uri.parse("https://aka.ms/vscodeJupyterExtKernelPickerJupyterKernels"),command:"jupyter.kernel.selectLocalKernelSpec"}],n.fire())};i(),this.kernelFinder.onDidChangeKernels(()=>i(),this,this.localDisposables),this.localDisposables.push(Wr.commands.registerCommand("jupyter.kernel.selectLocalKernelSpec",this.onSelectLocalKernel.bind(this,"localKernelSpec"),this)),this.localDisposables.push(Wr.commands.registerCommand("jupyter.kernel.selectLocalPythonEnvironment",this.onSelectLocalKernel.bind(this,"localPythonEnvironment"),this))}this.localDisposables.push(Wr.commands.registerCommand("jupyter.kernel.selectJupyterServerKernel",this.onSelectRemoteKernel,this)),xe.instance.get($t).onDidChangeCollections(this.registerUriCommands,this,this.localDisposables),this.registerUriCommands()}registerUriCommands(){let e=xe.instance.get($t),t=new Set;e.jupyterCollections.map(n=>{let i=`${n.extensionId}:${n.id}`;if(n.id===Hw||(t.add(i),this.providerMappings.has(i)))return;let o=Wr.notebooks.registerKernelSourceActionProvider(Et,{provideNotebookKernelSourceActions:()=>[{get label(){return n.label},get documentation(){return n.documentation},command:{command:"jupyter.kernel.selectJupyterServerKernel",arguments:[n.extensionId,n.id],title:n.label}}]}),s=Wr.notebooks.registerKernelSourceActionProvider(yt,{provideNotebookKernelSourceActions:()=>[{get label(){return n.label},get documentation(){return n.documentation},command:{command:"jupyter.kernel.selectJupyterServerKernel",arguments:[n.extensionId,n.id],title:n.label}}]});this.localDisposables.push(o),this.localDisposables.push(s),this.providerMappings.set(i,{disposables:[o,s],provider:n})}),this.providerMappings.forEach(({disposables:n},i)=>{t.has(i)||(z(n),this.providerMappings.delete(i))})}async onSelectLocalKernel(e,t){if(t=t||Wr.window.activeNotebookEditor?.notebook,!!t)if(e==="localPythonEnvironment"){let i=await xe.instance.get(Dm).selectLocalKernel(t);return this.getSelectedController(t,i)}else{let i=await xe.instance.get(Bk).selectLocalKernel(t);return this.getSelectedController(t,i)}}async onSelectRemoteKernel(e,t,n){if(n=n||Wr.window.activeNotebookEditor?.notebook,!n&&Wr.window.activeTextEditor&&(n=this.notebookEditorProvider.findNotebookEditor(Wr.window.activeTextEditor.document.uri)?.notebook),!n)return;let i=`${e}:${t}`,o=this.providerMappings.get(i)?.provider;if(!o)return;let a=await xe.instance.get(Vk).selectRemoteKernel(n,o);return this.getSelectedController(n,a)}async getSelectedController(e,t){if(!t)return;let n=this.controllerRegistration.addOrUpdate(t,[e.notebookType]);if(!Array.isArray(n)||n.length===0){d.warn(`No controller created for selected kernel connection ${t.kind}:${t.id}`);return}Qs(e.uri,t).finally(()=>_t(e.uri,"DS_INTERNAL.SWITCH_KERNEL",void 0,{newKernelPicker:!0})).catch(h),n.find(o=>o.viewType===e.notebookType)?.controller.updateNotebookAffinity(e,Wr.NotebookControllerAffinity.Preferred);let i=n[0];return await this.onControllerSelected(e,i),i.controller.id}async onControllerSelected(e,t){if(c9(e),ht(t.connection)&&vt(t.connection)&&Hr(t.connection.interpreter)&&!ln()){let n=[];try{let i=new Wr.CancellationTokenSource;n.push(i);let o=new Ht(!1);n.push(o),await this.kernelDependency.installMissingDependencies({resource:e.uri,kernelConnection:t.connection,token:i.token,ui:o,cannotChangeKernels:!0,ignoreCache:!0,installWithoutPrompting:!0})}catch(i){d.error(`Failed to install missing dependencies for Conda kernel ${t.connection.id}`,i)}finally{z(n)}}}};bb=y([(0,Pd.injectable)(),m(0,(0,Pd.inject)(pt)),m(1,(0,Pd.inject)(Rr)),m(2,(0,Pd.inject)(bi)),m(3,(0,Pd.inject)(Ms)),m(4,(0,Pd.inject)(O))],bb);var Af=P(M()),c0=require("vscode");var cc=require("vscode");var s0=require("vscode");var Dd=class{constructor(e){this.jupyterConnection=e;this.disposables=[]}dispose(){z(this.disposables)}async findPreferredRemoteKernelConnection(e,t,n){return this.findPreferredRemoteKernelConnectionImpl(e,t,n,!1)}async findPreferredRemoteKernelConnectionImpl(e,t,n,i){let o=await xe.instance.get(ns).getPreferredRemoteKernelId(e),s=async()=>{let l=t.kernels.find(u=>u.kind==="connectToLiveRemoteKernel"&&u.id===o);if(l)return l;if(t.status==="idle")return;let c=await new Promise(u=>t.onDidChangeKernels(()=>{let p=t.kernels.find(f=>f.kind==="connectToLiveRemoteKernel"&&f.id===o);p&&u(p),(t.status==="idle"||n.isCancellationRequested)&&u(void 0)},this,this.disposables));if(c)return c};if(o){let l=await s();if(l||i)return l}let a=t.kernels.find(l=>Nt(l))?.serverProviderHandle;if(a){let l=await this.jupyterConnection.createConnectionInfo(a),c=(e.uri,void 0),u=c&&t.kernels.find(p=>Nt(p)&&p.kind==="connectToLiveRemoteKernel"&&p.kernelModel.model&&p.kernelModel.model.path===c.path&&p.kernelModel.model.name===c.name);if(u)return u}return this.findPreferredKernelSpecConnection(e,t,n,i)}async findPreferredLocalKernelSpecConnection(e,t,n){return this.findPreferredKernelSpecConnection(e,t,n,!1)}async findPreferredKernelSpecConnection(e,t,n,i){let s=yo(e)?.kernelspec?.name,a=()=>{let u=s?t.kernels.filter(f=>(f.kind==="startUsingLocalKernelSpec"||f.kind==="startUsingRemoteKernelSpec")&&f.kernelSpec.name===s):[];if(u.length||i)return u;let p=$T(e);if(p)return t.kernels.filter(f=>(f.kind==="startUsingLocalKernelSpec"||f.kind==="startUsingRemoteKernelSpec")&&f.kernelSpec.language&&(f.kernelSpec.language===p||Cl(f.kernelSpec.language)===Cl(p)))},l=a();if(Array.isArray(l)&&l.length)return i&&l.length>1?void 0:l[0];if(t.status==="idle")return;let c=[];return new Promise(u=>t.onDidChangeKernels(()=>{if(n.isCancellationRequested)return u(void 0);let p=a();if(Array.isArray(p)&&p.length)return i&&p.length>1?u(void 0):u(p[0]);t.status==="idle"&&u(void 0)},this,this.disposables)).finally(()=>z(c))}async findPreferredPythonKernelConnection(e,t,n){return this.findPreferredPythonKernelConnectionImpl(e,t,n)}async findPreferredPythonKernelConnectionImpl(e,t,n){t=t||xe.instance.get(Rr).registered.find(c=>c.kind==="localPythonEnvironment");let i=xe.instance.get(rt),o=vL(e,t);if(o)return o;let s=await i.getActiveInterpreter(e.uri);if(!s)return;let a=()=>{if(!n.isCancellationRequested)return t.kernels.filter(c=>c.kind==="startUsingPythonInterpreter").map(c=>c).find(c=>c.interpreter.id===s.id)},l=a();if(l)return l;if(t.status==="discovering")return await new Promise(c=>{t.onDidChangeStatus(()=>t.status==="idle"&&c(),this,this.disposables),t.onDidChangeKernels(()=>(vL(e,t)||a())&&c(),this,this.disposables)}),vL(e,t)||a()}};function vL(r,e){let t=s0.workspace.getWorkspaceFolder(r.uri)?.uri||(s0.workspace.workspaceFolders?.length===1?s0.workspace.workspaceFolders[0].uri:void 0),n=mz(Pi(r.uri),e);if(n)return n;if(t)return mz(t,e)}function mz(r,e){let n=e.kernels.filter(a=>a.kind==="startUsingPythonInterpreter").map(a=>a).filter(a=>nv(Tr(a.interpreter)?.environment?.folderUri?.fsPath||a.interpreter.uri.fsPath,r.fsPath)),i=n.find(a=>Be(a.interpreter)==="Venv"&&jo(a.interpreter)?.toLowerCase()===".venv");if(i)return i;let o=n.find(a=>Be(a.interpreter)==="Conda"&&jo(a.interpreter)?.toLowerCase()===".venv");if(o)return o;let s=n.find(a=>jo(a.interpreter)?.toLowerCase()===".venv");return s||(n.length?n[0]:void 0)}var a0=class{constructor(e,t,n,i,o){this.notebook=e;this.pythonEnvFilter=i;this.connection=o;this._onDidRefresh=new cc.EventEmitter;this.onDidRefresh=this._onDidRefresh.event;this._onDidChange=new cc.EventEmitter;this.onDidChange=this._onDidChange.event;this.kernels=[];this._onDidChangeStatus=new cc.EventEmitter;this.onDidChangeStatus=this._onDidChangeStatus.event;this._onDidChangeRecommended=new cc.EventEmitter;this.onDidChangeRecommended=this._onDidChangeRecommended.event;this._onDidFailToListKernels=new cc.EventEmitter;this.onDidFailToListKernels=this._onDidFailToListKernels.event;this.status="idle";this.disposables=[];this.refresh=async()=>{this.refreshInvoked=!0},this.title=I.kernelPickerSelectKernelTitle,this.kind=t,this.disposables.push(this._onDidRefresh),Hu(n)?n.then(s=>this.setupFinder(s)).catch(s=>d.error(`Failed to setup finder for ${this.title}`,s)):this.setupFinder(n)}dispose(){z(this.disposables)}setupFinder(e){switch(this.refresh=async()=>e.refresh(),this.status!==e.status&&!this.refreshInvoked&&(this.status=e.status,this._onDidChangeStatus.fire()),this.refreshInvoked?e.refresh().catch(i=>d.error(`Failed to refresh finder for ${this.title}`,i)):e.kind==="remote"&&e.status==="idle"&&this.filteredKernels(e.kernels).length===0&&e.refresh().catch(i=>d.error(`Failed to refresh finder for ${this.title}`,i)),e.kind){case"localKernelSpec":this.title=I.kernelPickerSelectLocalKernelSpecTitle;break;case"localPythonEnvironment":this.title=I.quickPickSelectPythonEnvironmentTitle;break;default:this.title=I.kernelPickerSelectKernelFromRemoteTitle(e.displayName);break}e.onDidChangeKernels(()=>{this.kernels.length=0,this.kernels.push(...this.filteredKernels(e.kernels)),this._onDidChange.fire()},this,this.disposables),e.onDidChangeStatus(()=>{this.status=e.status,this._onDidChangeStatus.fire(),this.status==="idle"&&e.lastError&&this.filteredKernels(e.kernels).length===0&&(this.kernels.length=0,this._onDidFailToListKernels.fire(e.lastError))}),this.kernels.length=0,this.kernels.push(...this.filteredKernels(e.kernels)),this._onDidChange.fire(),this._onDidChangeStatus.fire();let t=new cc.CancellationTokenSource;this.disposables.push(new cc.Disposable(()=>t.cancel())),this.disposables.push(t);let n=new Dd(this.connection);this.disposables.push(n),e.kind==="remote"?this.computePreferredRemoteKernel(e,n,t.token):this.computePreferredLocalKernel(e,n,t.token)}filteredKernels(e){let t=this.pythonEnvFilter;return t?e.filter(n=>n.kind!=="startUsingPythonInterpreter"||!t.isPythonEnvironmentExcluded(n.interpreter)):e}computePreferredRemoteKernel(e,t,n){t.findPreferredRemoteKernelConnection(this.notebook,e,n).then(i=>{this.recommended=i,this._onDidChangeRecommended.fire()}).catch(i=>d.error(`Preferred connection failure ${B(this.notebook.uri)}`,i))}computePreferredLocalKernel(e,t,n){let i=()=>{this.recommended&&!this.kernels.find(s=>s.id===this.recommended?.id)&&(this.recommended=void 0),(e.kind==="localKernelSpec"?t.findPreferredLocalKernelSpecConnection.bind(t):t.findPreferredPythonKernelConnection.bind(t))(this.notebook,e,n).then(s=>{this.recommended?.id!==s?.id&&(this.recommended=s,this._onDidChangeRecommended.fire())}).catch(s=>d.error(`Preferred connection failure ${B(this.notebook?.uri)}`,s))};i(),e.onDidChangeKernels(i,this,this.disposables)}};var _d=require("vscode");function uc(r){return"connection"in r}function tbe(r){return"command"in r}function rbe(r,e,t){let n=t?[t]:r.activeItems.length?[r.activeItems[0]]:[];if(n.length&&!e.includes(n[0])){let i=n[0],o=uc(i)&&e.find(s=>uc(s)&&s.connection.id===i.connection.id);o?n[0]=o:n.length=0}r.items=e,r.activeItems=n}var yL=class extends Error{},l0=class extends tr{constructor(t,n){super();this.provider=t;this.token=n;this.recommendedItems=[];this.existingItems=new Set;this.quickPickItems=[];this.displayDataProvider=xe.instance.get(bp)}async selectKernel(t){return this.selectKernelImpl(t,{quickPick:void 0})}async selectKernelImpl(t,n){if(this.token.isCancellationRequested)return;let i=this.provider.kernels.map(o=>this.connectionToQuickPick(o));return this.quickPickItems.push({kind:_d.QuickPickItemKind.Separator,label:I.kernelCategoryForJupyterKernel}),i.sort((o,s)=>o.label.localeCompare(s.label)),this.quickPickItems.push(...i),this.existingItems=new Set(i),this.selectKernelImplInternal(t,n)}async selectKernelImplInternal(t,n){let i={iconPath:new _d.ThemeIcon("refresh"),tooltip:me.refresh},o={iconPath:new _d.ThemeIcon("loading~spin"),tooltip:me.refreshing},{quickPick:s,selection:a}=t({title:this.provider.title,items:this.quickPickItems,buttons:[i],onDidTriggerButton:async u=>{if(u===i){let p=s.buttons;s.buttons=p.filter(f=>f!==i).concat(o),await this.provider.refresh().catch(h),s.buttons=p}}});n.quickPick=s,this.provider.status==="discovering"&&(s.busy=!0);let l;this._register(this.provider.onDidChangeStatus(()=>{switch(l&&clearTimeout(l),this.provider.status){case"discovering":s.busy=!0;break;case"idle":l=setTimeout(()=>s.busy=!1,500),this._register(new _d.Disposable(()=>l&&clearTimeout(l)));break}},this)),this.updateRecommended(s),this.updateQuickPickItems(s),this._register(this.provider.onDidChangeRecommended(()=>this.updateRecommended(s),this)),this._register(this.provider.onDidChange(()=>this.updateQuickPickItems(s),this));let c=await a;if(!this.token.isCancellationRequested){if(tbe(c))try{let u=await c.command();return u?{selection:"controller",connection:u}:void 0}catch(u){if(u instanceof yL)return{selection:"userPerformedSomeOtherAction"};if(u===Re.back)return this.selectKernelImplInternal(t,n);throw u}if(c&&"connection"in c)return{selection:"controller",connection:c.connection};if(c&&"error"in c)throw Re.back}}updateQuickPickItems(t){t.title=this.provider.title;let n=new Set(t.items.filter(u=>uc(u)).map(u=>u).map(u=>u.connection.id)),i=this.provider.kernels.filter(u=>!n.has(u.id)).map(u=>this.connectionToQuickPick(u));this.updateQuickPickWithLatestConnection(t),this.removeMissingKernels(t),this.updateRecommended(t),i.sort((u,p)=>u.label.localeCompare(p.label));let o=0,s=this.existingItems,a=new Map(Array.from(s).map(u=>[u.connection.id,u])),l=s.size;i.forEach(u=>{let p=a.get(u.connection.id);p&&s.delete(p),s.add(u)});let c=Array.from(s);c.sort((u,p)=>u.label.localeCompare(p.label)),this.quickPickItems.splice(o+1,l,...c),this.rebuildQuickPickItems(t)}rebuildQuickPickItems(t){let n=this.recommendedItems.find(a=>uc(a)),i=new Set(this.recommendedItems.filter(uc).map(a=>a.connection.id)),o=this.quickPickItems.filter(a=>!uc(a)||!i.has(a.connection.id)),s=t.activeItems.length?t.activeItems[0]:void 0;n&&uc(n)&&s&&(uc(s)?s.connection.id!==n.connection.id&&(n=void 0):n=void 0),rbe(t,this.recommendedItems.concat(o),n)}removeMissingKernels(t){let n=t.items.filter(s=>uc(s)).map(s=>s).map(s=>s.connection.id),i=new Map(this.provider.kernels.map(s=>[s.id,s])),o=n.filter(s=>!i.has(s));if(o.length){let s=[];this.existingItems.forEach(a=>{o.includes(a.connection.id)&&(this.existingItems.delete(a),s.push(a))}),this.quickPickItems=this.quickPickItems.filter(a=>!s.includes(a)),this.rebuildQuickPickItems(t)}}updateRecommended(t){if(!this.provider.recommended){this.recommendedItems.length=0;return}this.recommendedItems.length||this.recommendedItems.push({label:I.recommendedItemCategoryInQuickPick,kind:_d.QuickPickItemKind.Separator});let n=this.connectionToQuickPick(this.provider.recommended,!0);this.recommendedItems.length===2?this.recommendedItems[1]=n:this.recommendedItems.push(n),this.rebuildQuickPickItems(t)}updateQuickPickWithLatestConnection(t){let n=new Map(this.provider.kernels.map(i=>[i.id,i]));this.recommendedItems.concat(this.quickPickItems).forEach(i=>{if(!uc(i)||!n.has(i.connection.id))return;let o=n.get(i.connection.id);o&&(i.label=this.connectionToQuickPick(o,i.isRecommended).label,i.tooltip=this.connectionToQuickPick(o,i.isRecommended).tooltip,i.detail=this.connectionToQuickPick(o,i.isRecommended).detail,i.description=this.connectionToQuickPick(o,i.isRecommended).description,i.isRecommended=this.connectionToQuickPick(o,i.isRecommended).isRecommended,i.connection=o)}),this.rebuildQuickPickItems(t)}connectionToQuickPick(t,n=!1){let i=n?"$(star-full) ":"",o=(l,c,u)=>{l.label=`${i}${c.label}`,l.detail=c.detail,l.description=c.description,this.quickPickItems.forEach(p=>{"connection"in p&&p.connection.id===u.id&&(p.label=c.label,p.detail=c.detail,p.description=c.description)})},s=this.displayDataProvider.getDisplayData(t),a={label:"",detail:"",description:"",isRecommended:n,connection:t};return o(a,s,t),this._register(s.onDidChange(l=>o(a,l,t),this)),a}};var Ib=class{constructor(e,t,n,i){this.kernelFinder=e;this.multiStepFactory=t;this.pythonEnvFilter=n;this.jupyterConnection=i;this.localDisposables=[]}async selectLocalKernel(e){if(e.notebookType!==Et&&e.notebookType!==yt)return;this.localDisposables.forEach(o=>o.dispose()),this.localDisposables=[],this.cancellationTokenSource?.cancel(),this.cancellationTokenSource?.dispose(),this.cancellationTokenSource=new c0.CancellationTokenSource;let t=this.multiStepFactory.create(),n={disposables:[],notebook:e},i=this.kernelFinder.registered.find(o=>o.id==="localKernelSpec");try{if(await t.run(this.selectKernelFromKernelFinder.bind(this,i,this.cancellationTokenSource.token,t,n),n)===Re.cancel||n.selection?.type==="userPerformedSomeOtherAction")throw new c0.CancellationError;if(this.cancellationTokenSource.token.isCancellationRequested){z(n.disposables);return}if(n.selection?.type==="connection")return n.selection.connection}finally{z(n.disposables)}}selectKernelFromKernelFinder(e,t,n,i){let o=new a0(i.notebook,e.kind,e,this.pythonEnvFilter,this.jupyterConnection);return i.disposables.push(o),this.selectKernel(o,t,n,i)}async selectKernel(e,t,n,i){if(t.isCancellationRequested)return;let o=new l0(e,t);i.disposables.push(o);let s=l=>{let{quickPick:c,selection:u}=n.showLazyLoadQuickPick({...l,placeholder:"",matchOnDescription:!0,matchOnDetail:!0,supportBackInFirstStep:!0,activeItem:void 0,ignoreFocusOut:!1});return{quickPick:c,selection:u}},a=await o.selectKernel(s);a?.selection==="controller"?i.selection={type:"connection",connection:a.connection}:a?.selection==="userPerformedSomeOtherAction"&&(i.selection={type:"userPerformedSomeOtherAction"})}};Ib=y([(0,Af.injectable)(),m(0,(0,Af.inject)(Rr)),m(1,(0,Af.inject)(Yg)),m(2,(0,Af.inject)(di)),m(3,(0,Af.inject)(pn))],Ib);var Pu=P(M()),Mf=require("vscode");var Nf=require("vscode");var Sb=require("vscode");var u0=class{constructor(e,t){this.notebook=e;this.disposables=[];xe.instance.get(pt).onControllerSelected(i=>{i.notebook===this.notebook&&(i.controller.connection.kind!=="startUsingPythonInterpreter"||!i.controller.connection.interpreter||i.controller.connection.interpreter.id!==this.createdEnvId)&&this.cancelTokeSource.cancel()},this,this.disposables),this.cancelTokeSource=kg(t)}dispose(){this.cancelTokeSource.dispose(),z(this.disposables)}async createPythonEnvFromKernelPicker(){let e,t=await this.createPythonEnvironment();if(this.cancelTokeSource.token.isCancellationRequested||t.action)return A("DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",void 0,{failed:!0,reason:"cancelled"}),{action:t.action||"Cancel"};if(!t.interpreter)return A("DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",void 0,{failed:!0,reason:"cancelled"}),{action:"Cancel"};e=t.interpreter,d.debug(`Python Environment created ${e.id}`);let n=await this.waitForPythonKernel(t.interpreter);if(this.cancelTokeSource.token.isCancellationRequested)return A("DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",void 0,{failed:!0,reason:"cancelled"}),{action:"Cancel"};if(!n)return A("DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",void 0,{failed:!0,reason:"kernelConnectionNotCreated"}),d.debug(`Python Environment ${e.id} not found as a kernel`),{action:"Cancel"};d.debug(`Python Environment ${e.id} found as a kernel ${n.kind}:${n.id}`);let o=await xe.instance.get(Ms).installMissingDependencies({resource:this.notebook.uri,kernelConnection:n,ui:new Ht(!1),token:this.cancelTokeSource.token,ignoreCache:!0,cannotChangeKernels:!0,installWithoutPrompting:!0}),s=!0;return o!==0&&(s=!1,d.warn(`Dependencies not installed for new Python Env ${B(e.uri)} for notebook ${B(this.notebook.uri)}`)),A("DATASCIENCE.CREATE_PYTHON_ENVIRONMENT",void 0,{dependenciesInstalled:s,envType:Be(t.interpreter)}),{kernelConnection:n}}async waitForPythonKernel(e){let n=xe.instance.get(Rr).registered.find(i=>i.kind==="localPythonEnvironment");if(n)return this.waitForPythonKernelFromFinder(e,n)}async waitForPythonKernelFromFinder(e,t){let n=t.kernels.find(i=>i.interpreter.id===e.id);return n||new Promise(i=>{let o=[];o.push(t.onDidChangeKernels(()=>{if(this.cancelTokeSource.token.isCancellationRequested)return;let s=t.kernels.find(a=>a.interpreter.id===e.id);if(s)return z(o),i(s)},this,this.disposables)),o.push(this.cancelTokeSource.token.onCancellationRequested(()=>{z(o)}))}).then(i=>{if(!this.cancelTokeSource.token.isCancellationRequested)return i||d.warn(`New Python Environment ${B(e.uri)} not found as a kernel`),i})}async createPythonEnvironment(){let e=xe.instance.get(rt),t=new Sb.CancellationTokenSource;try{let n=await Sb.commands.executeCommand("python.createEnvironment",{showBackButton:!0,selectEnvironment:!0});if(n?.action==="Cancel")return{action:"Cancel"};if(n?.action==="Back")return{action:"Back"};let i=n?.path;if(this.cancelTokeSource.token.isCancellationRequested)return{action:"Cancel"};if(!i)return d.warn("Python Environment not created, either user cancelled the creation or there was an error in the Python Extension"),{action:"Cancel"};this.createdEnvId=i,d.debug(`Python Environment created ${i}`);let o=await e.getInterpreterDetails({path:i});return this.cancelTokeSource.token.isCancellationRequested?{action:"Cancel"}:(o||d.warn(`No interpreter details for New Python Environment ${B(Sb.Uri.file(i))}`),this.createdEnvId=o?.id,{interpreter:o})}finally{t.cancel(),t.dispose()}}};var p0=require("vscode");function hz(r,e){let t=nbe(r,e.environments.known);return t||(()=>{let i=e.environments.getActiveEnvironmentPath(r.uri);return i&&e.environments.known.find(o=>o.id===i.id)})()}function nbe(r,e){let t=p0.workspace.getWorkspaceFolder(r.uri)?.uri||(p0.workspace.workspaceFolders?.length===1?p0.workspace.workspaceFolders[0].uri:void 0),n=fz(Pi(r.uri),e);if(n)return n;if(t)return fz(t,e)}function fz(r,e){let t=e.filter(n=>nv(n.environment?.folderUri?.fsPath||n.executable.uri?.fsPath||n.path,r.fsPath));return t.find(n=>Be(n)==="Venv"&&n.environment?.name?.toLowerCase()===".venv")||t.find(n=>Be(n)==="Conda"&&n.environment?.name?.toLowerCase()===".conda")||t.find(n=>["VirtualEnv","VirtualEnvWrapper"].includes(Be(n))&&n.environment?.name?.toLowerCase()===".venv")||t.find(n=>n.environment?.name?.toLowerCase()===".venv"||n.environment?.name?.toLowerCase()===".conda")||t.length?t[0]:void 0}var d0=class extends tr{constructor(t,n){super();this.notebook=t;this.token=n;let i=xe.instance.get(di),o=xe.instance.get($e),s=xe.instance.get(Yt);this.provider=xe.instance.get(qs).withFilter(g=>!i.isPythonEnvironmentExcluded(g)),this.pythonEnvPicker=this._register(new rd(Promise.resolve(this.provider),zD,QD,{supportsBack:!0},void 0,I.quickPickSelectPythonEnvironmentTitle));let a=!1,l=()=>{a||(a=!0,this.pythonEnvPicker.addCommand({label:`$(add) ${I.createPythonEnvironmentInQuickPick}`},this.createNewEnvironment.bind(this)))};this.provider.items.length&&l();let c={dispose:h},u=this._register(this.provider.onDidChange(()=>{this.provider.items.length&&(l(),c.dispose(),u.dispose())}));this.provider.refresh().finally(()=>{this.provider.items.length||(c=this.pythonEnvPicker.addCommand({label:I.installPythonQuickPickTitle,tooltip:I.installPythonQuickPickToolTip,description:I.pleaseReloadVSCodeOncePythonHasBeenInstalled},()=>{throw setTimeout(()=>Nf.commands.executeCommand(q.InstallPythonViaKernelPicker).then(h,h)),new Nf.CancellationError}))}).catch(h);let p=()=>{!this.pythonApi||n.isCancellationRequested||(this.pythonEnvPicker.recommended=hz(this.notebook,this.pythonApi))},f=g=>{g&&(this.pythonApi=g,p(),this._register(g.environments.onDidChangeActiveEnvironmentPath(p)),this._register(g.environments.onDidChangeEnvironments(p)))};o.isPythonExtensionInstalled?s.getNewApi().then(f).catch(h):this._register(o.onPythonExtensionInstallationStatusChanged(()=>s.getNewApi().then(f),this)),p()}async selectKernel(){let t=oe();Nf.extensions.getExtension(si)||Nf.commands.executeCommand(q.InstallPythonExtensionViaKernelPicker).then(l=>{l===!0?this.provider.refresh().catch(h):t.resolve()},l=>{d.error("Failed to install the Python extension",l),t.resolve()});let n=await Promise.race([this.pythonEnvPicker.selectItem(this.token),t.promise]);if(!n||n instanceof Re)return n||Re.cancel;let i=xe.instance.get(rt),o=xe.instance.get(jr),s=await i.getInterpreterDetails(n.path);if(!s)return Re.cancel;let a=await Os(s,await o.getKernelSpecTempRegistrationFolder());return qo.create({kernelSpec:a,interpreter:s,id:Oi(a,s)})}async createNewEnvironment(){let t=xe.instance.get(Yt);if(!xe.instance.get($e).isPythonExtensionInstalled)return;let o=await this._register(new u0(this.notebook,this.token)).createPythonEnvFromKernelPicker();return o?"action"in o?o.action==="Back"?Re.back:Re.cancel:(await t.getNewApi())?.environments.known.find(a=>a.id===o.kernelConnection.interpreter.id):Re.cancel}};var xb=class extends Yn{constructor(t,n,i,o,s,a){super();this.pythonApi=n;this.filter=i;this.jupyterPaths=o;this.checker=s;this.kind="localPythonEnvironment";this.id="localPythonEnvironment";this.displayName=I.localPythonEnvironments;this._onDidChangeKernels=this._register(new Mf.EventEmitter);this.onDidChangeKernels=this._onDidChangeKernels.event;this._kernels=new Map;this._onDidChangeStatus=this._register(new Mf.EventEmitter);this._status="idle";this.promiseMonitor=new vo;this.onDidChangeStatus=this._onDidChangeStatus.event;this.previousCancellationTokens=[];this.apiHooked=!1;t.push(this),a.registerKernelFinder(this)}get status(){return this._status}set status(t){this._status=t,this._onDidChangeStatus.fire()}get kernels(){return Array.from(this._kernels.values())}activate(){this._register(this.promiseMonitor.onStateChange(()=>this.status=this.promiseMonitor.isComplete?"idle":"discovering",this)),this.checker.isPythonExtensionInstalled?(this.getKernelSpecsDir().catch(h),this.hookupPythonApi().catch(h)):this._register(this.checker.onPythonExtensionInstallationStatusChanged(()=>{this.checker.isPythonExtensionInstalled&&(this.getKernelSpecsDir().catch(h),this.hookupPythonApi().catch(h))},this))}async selectLocalKernel(t){let n=new Mf.CancellationTokenSource,i=[n];try{let o=new d0(t,n.token);i.push(o);let s=await o.selectKernel();if(s instanceof Error){if(s instanceof Re&&s===Re.back)return;throw new Mf.CancellationError}return this.addUpdateKernel(s),s}finally{z(i)}}async getKernelConnection(t){let n=xe.instance.get(rt),i=xe.instance.get(jr),o=await n.getInterpreterDetails(t.path);if(!o){d.warn(`Python Env ${B(t.id)} not found}`);return}if(!o||this.filter.isPythonEnvironmentExcluded(o)){d.warn(`Python Env hidden via filter: ${B(o.id)}`);return}let s=await Os(o,await i.getKernelSpecTempRegistrationFolder()),a=qo.create({kernelSpec:s,interpreter:o,id:Oi(s,o)}),l=this._kernels.get(a.id);return l||(this.addUpdateKernel(a),a)}addUpdateKernel(t){let n=this._kernels.get(t.id);n?(n.updateInterpreter(t.interpreter),this._kernels.set(t.id,Object.assign(n,t)),this._onDidChangeKernels.fire({})):(this._kernels.set(t.id,t),this._onDidChangeKernels.fire({}))}async refresh(){this.previousCancellationTokens.forEach(t=>t.cancel()),z(this.previousCancellationTokens),this.previousCancellationTokens=[],this._kernels.clear(),this.pythonApi.getNewApi().then(t=>{t&&(this.promiseMonitor.push(t.environments.refreshEnvironments({forceRefresh:!0}).catch(h)),t.environments.known.forEach(n=>this.buildDummyEnvironment(n).catch(h)))}).catch(h)}getKernelSpecsDir(){return this.tempDirForKernelSpecs||(this.tempDirForKernelSpecs=this.jupyterPaths.getKernelSpecTempRegistrationFolder()),this.tempDirForKernelSpecs}async hookupPythonApi(){if(this.apiHooked)return;this.apiHooked=!0;let t=await this.pythonApi.getNewApi();t&&(t.environments.known.map(n=>this.buildDummyEnvironment(n).catch(h)),this._register(t.environments.onDidChangeEnvironments(n=>{if(n.type==="remove"){let i=this._kernels.get(n.env.id);i&&(this._kernels.delete(n.env.id),this._onDidChangeKernels.fire({removed:[i]}))}else this.buildDummyEnvironment(n.env).catch(h)},this)))}async buildDummyEnvironment(t){let n=h9(t);if(!n||this.filter.isPythonEnvironmentExcluded(n))return;let i=await Os(n,await this.getKernelSpecsDir()),o=qo.create({kernelSpec:i,interpreter:n,id:Oi(i,n)});this._kernels.get(t.id)||(this._kernels.set(t.id,o),this._onDidChangeKernels.fire({}))}};xb=y([(0,Pu.injectable)(),m(0,(0,Pu.inject)(O)),m(1,(0,Pu.inject)(Yt)),m(2,(0,Pu.inject)(di)),m(3,(0,Pu.inject)(jr)),m(4,(0,Pu.inject)($e)),m(5,(0,Pu.inject)(Rr))],xb);var pc=P(M()),Jn=require("vscode");function m0(r){return r===Ue||r===yh}var Cb=class{constructor(e,t,n,i,o,s,a){this.kernelFinder=e;this.serverUriStorage=t;this.serverSelector=n;this.jupyterConnection=i;this.displayDataProvider=o;this.kernelFinderController=s;this.jupyterServerRegistry=a;this.localDisposables=[]}async selectRemoteKernel(e,t){if(e.notebookType!==Et&&e.notebookType!==yt)return;this.localDisposables.forEach(o=>o.dispose()),this.localDisposables=[],this.cancellationTokenSource?.cancel(),this.cancellationTokenSource?.dispose(),this.cancellationTokenSource=new Jn.CancellationTokenSource;let n=new Wx,i={disposables:[],notebook:e};try{if(await n.run(this.getRemoteServersFromProvider.bind(this,t,this.cancellationTokenSource.token),i)===Re.cancel||i.selection?.type==="userPerformedSomeOtherAction")throw new Jn.CancellationError;if(this.cancellationTokenSource.token.isCancellationRequested){z(i.disposables);return}if(i.selection?.type==="connection")return i.selection.connection}finally{z(i.disposables)}}async getRemoteServersFromProvider(e,t,n,i){let o=this.kernelFinder.registered.filter(_=>_.kind==="remote"),s=[],a=[],l=[],c=this.jupyterServerRegistry.jupyterCollections.find(_=>_.extensionId===e.extensionId&&_.id===e.id)?.serverProvider,u=c?.provideJupyterServers?Promise.resolve(c.provideJupyterServers.bind(c)(t)).then(_=>_||[]):Promise.resolve([]),p=new Set,f=await u,g=new Set(f.map(_=>_.id));if(o.filter(_=>_.serverProviderHandle.id===e.id).filter(_=>g.has(_.serverProviderHandle.id)).map(_=>{let L=this.serverUriStorage.all.find(te=>Lt(te.provider)===Lt(_.serverProviderHandle));p.add(Lt(_.serverProviderHandle)),l.push({server:_,time:L?.time})}),l.sort((_,L)=>!_.time&&!L.time?_.server.displayName.localeCompare(L.server.displayName):!_.time&&L.time?1:_.time&&!L.time||(_.time||0)>(L.time||0)?-1:1),l.filter(({time:_})=>(_||0)>0).forEach(({server:_,time:L})=>{s.push({type:"finder",kernelFinderInfo:_,idAndHandle:_.serverProviderHandle,label:_.displayName,description:L?I.jupyterServerLastConnectionForQuickPickDescription(new Date(L)):void 0,buttons:c?.removeJupyterServer&&m0(e.extensionId)?[{iconPath:new Jn.ThemeIcon("close"),tooltip:I.removeRemoteJupyterServerEntryInQuickPick}]:[]})}),l.filter(({time:_})=>!_).forEach(({server:_})=>{s.push({type:"finder",kernelFinderInfo:_,idAndHandle:_.serverProviderHandle,label:_.displayName,buttons:c?.removeJupyterServer&&m0(e.extensionId)?[{iconPath:new Jn.ThemeIcon("close"),tooltip:I.removeRemoteJupyterServerEntryInQuickPick}]:[]})}),f.sort((_,L)=>_.label.localeCompare(L.label)).forEach(_=>{let L=Lt({extensionId:e.extensionId,id:e.id,handle:_.id});p.has(L)||s.push({type:"jupyterServer",label:_.label,idAndHandle:{extensionId:e.extensionId,id:e.id,handle:_.id},server:_,buttons:c?.removeJupyterServer&&m0(e.extensionId)?[{iconPath:new Jn.ThemeIcon("close"),tooltip:I.removeRemoteJupyterServerEntryInQuickPick}]:[]})}),e.commandProvider){let _=(await Promise.resolve(e.commandProvider.provideCommands(void 0,t))||[]).map(L=>({...L,provider:e,type:"uriProviderQuickPick",command:L}));s.length>0&&_.length&&a.push({label:"",kind:Jn.QuickPickItemKind.Separator}),a.push(..._)}let v=s.concat(a),b=new Jn.EventEmitter,C=v.length===1&&"command"in v[0]&&v[0].command.canBeAutoSelected?v[0]:void 0;if(c){let _=v.filter(L=>"type"in L);_.length===1&&_.every(L=>L.type!=="uriProviderQuickPick")?C=_[0]:_.every(L=>L.type==="uriProviderQuickPick")&&_.filter(L=>L.picked).length===1&&(C=v.filter(L=>L.picked)[0])}let E,R;if(C)R=C;else{let{quickPick:_,selection:L}=n.showLazyLoadQuickPick({items:v,placeholder:e.extensionId===Ue||e.extensionId===yh?I.enterOrSelectRemoteJupyterPlaceholder:I.selectRemoteJupyterPlaceholder,title:I.quickPickTitleForSelectionOfJupyterServer,supportBackInFirstStep:!0,onDidTriggerItemButton:async te=>{if("type"in te.item&&(te.item.type==="finder"||te.item.type==="jupyterServer")){let $=te.item.idAndHandle.handle,se=f.find(ae=>ae.id===$);c?.removeJupyterServer&&se&&m0(e.extensionId)&&(_.busy=!0,this.serverUriStorage.remove({extensionId:e.extensionId,id:e.id,handle:$}).catch(h),await c.removeJupyterServer(se),_.busy=!1,v.splice(v.indexOf(te.item),1),b.fire(v.concat([])))}},onDidChangeItems:b.event});_.onDidChangeValue(async te=>{if(!e.commandProvider?.provideCommands)return;let $=[];s.length>0&&$.push({label:"",kind:Jn.QuickPickItemKind.Separator});let ae=(await Promise.resolve(e.commandProvider.provideCommands(te,t))||[]).map(X=>({...X,provider:e,type:"uriProviderQuickPick",command:X}));_.items=s.concat($).concat(ae)},this),E=_,R=await L}if(!t.isCancellationRequested&&R&&"type"in R)switch(R.type){case"finder":{let _=await this.selectRemoteKernelFromPicker(i.notebook,Promise.resolve(R.kernelFinderInfo),t).catch(L=>d.error("Failed to select a kernel",L));if(_&&_===Re.back){if(R===C)throw Re.back;return this.getRemoteServersFromProvider(e,t,n,i)}if(!_||_ instanceof Re)throw new Jn.CancellationError;i.selection={type:"connection",connection:_};return}case"jupyterServer":{let _=(async()=>{let te={id:e.id,handle:R.server.id,extensionId:e.extensionId};return e.extensionId.toLowerCase()===Xa.toLowerCase()&&await ir(t,this.serverSelector.addJupyterServer(te)),this.kernelFinderController.getOrCreateRemoteKernelFinder(te,R.server.label)})(),L=await this.selectRemoteKernelFromPicker(i.notebook,_,t).catch(te=>d.error("Failed to select a kernel",te));if(L&&L===Re.back){if(R===C)throw Re.back;return this.getRemoteServersFromProvider(e,t,n,i)}if(!L||L instanceof Re)throw new Jn.CancellationError;i.selection={type:"connection",connection:L};return}case"uriProviderQuickPick":{let _=Jn.notebooks.createNotebookControllerDetectionTask(Et);try{E&&(E.busy=!0);let L=await this.selectRemoteServerFromRemoteKernelFinder(R,i,t);return E&&(E.busy=!1),L}catch(L){if(L===Re.back&&!C)return this.getRemoteServersFromProvider(e,t,n,i);throw L}finally{_.dispose()}}default:break}}async selectRemoteServerFromRemoteKernelFinder(e,t,n){if(!e.provider.commandProvider?.handleCommand||n.isCancellationRequested)return;let i=await Promise.resolve(e.provider.commandProvider.handleCommand(e.command,n));if(!i)throw Re.back;if(n.isCancellationRequested)throw new Jn.CancellationError;let o=(async()=>{let a={id:e.provider.id,handle:i.id,extensionId:e.provider.extensionId};return a.extensionId.toLowerCase()===Xa.toLowerCase()&&await ir(n,this.serverSelector.addJupyterServer(a)),this.kernelFinderController.getOrCreateRemoteKernelFinder(a,i.label)})(),s=await this.selectRemoteKernelFromPicker(t.notebook,o,n).catch(a=>d.error("Failed to select a kernel",a));if(s&&s===Re.back)throw Re.back;if(!s||s instanceof Re)throw new Jn.CancellationError;t.selection={type:"connection",connection:s}}async selectRemoteKernelFromPicker(e,t,n){let i,o=u=>{let p=this.displayDataProvider.getDisplayData(u);return{label:`${u===i?"$(star-full) ":""}${p.label}`,description:p.description,detail:p.detail}},s=u=>({label:this.displayDataProvider.getDisplayData(u).category||"Other"}),a=u=>({label:I.failedToFetchKernelSpecsRemoteErrorMessageForQuickPickLabel,detail:I.failedToFetchKernelSpecsRemoteErrorMessageForQuickPickDetail}),l=new rd(t,o,s,{supportsBack:!0},a),c=new Dd(this.jupyterConnection);return t.then(u=>c.findPreferredRemoteKernelConnection(e,u,n)).then(u=>{i=u,u?.kind==="startUsingRemoteKernelSpec"&&(l.recommended=u),l.selected=u}).catch(u=>d.error("Failed to determine preferred remote kernel",u)),l.selectItem(n)}};Cb=y([(0,pc.injectable)(),m(0,(0,pc.inject)(Rr)),m(1,(0,pc.inject)(zt)),m(2,(0,pc.inject)(Sa)),m(3,(0,pc.inject)(pn)),m(4,(0,pc.inject)(bp)),m(5,(0,pc.inject)(AC)),m(6,(0,pc.inject)($t))],Cb);function gz(r,e){r.addSingleton(pt,mb),r.addBinding(pt,ge),r.addSingleton(bp,db),r.addSingleton(Vk,Cb),r.addSingleton(Bk,Ib),r.addSingleton(Dm,xb),r.addBinding(Dm,ge),r.addSingleton(ge,bb),dz(r,e)}var zC=P(M()),Of=require("vscode");var Ua=Symbol("IJupyterDebugService"),Td=Symbol("INotebookDebuggingManager");var f0=Symbol("IDebugLocationTrackerFactory"),h0=Symbol("IDebugLocationTracker");var wb=class{constructor(e,t){this.debuggingManager=e;this.disposables=t}activate(){this.disposables.push(Of.commands.registerCommand(q.RunByLine,this.runByLine,this)),this.disposables.push(Of.commands.registerCommand(q.RunByLineNext,this.runByLineNext,this)),this.disposables.push(Of.commands.registerCommand(q.RunByLineStop,this.runByLineStop,this)),this.disposables.push(Of.commands.registerCommand(q.RunAndDebugCell,this.runAndDebugCell,this))}async runByLine(e){A("DATASCIENCE.DEBUGGING.CLICKED_RUNBYLINE"),e??=this.getCellFromActiveEditor(),e&&await this.debuggingManager.tryToStartDebugging(0,e)}async runByLineNext(e){e??=this.getCellFromActiveEditor(),e&&this.debuggingManager.runByLineNext(e)}async runByLineStop(e){e??=this.getCellFromActiveEditor(),e&&this.debuggingManager.runByLineStop(e)}async runAndDebugCell(e){A("DATASCIENCE.DEBUGGING.CLICKED_RUN_AND_DEBUG_CELL"),e??=this.getCellFromActiveEditor(),e&&await this.debuggingManager.tryToStartDebugging(1,e)}getCellFromActiveEditor(){let e=Of.window.activeNotebookEditor;if(e){let t=e.selections[0];if(t)return e.notebook.cellAt(t.start)}}dispose(){this.disposables.forEach(e=>e.dispose())}};wb=y([(0,zC.injectable)(),m(0,(0,zC.inject)(Td)),m(1,(0,zC.inject)(O))],wb);var Du=P(M());var Eb=class{constructor(e,t,n){this.debugService=e;this.disposables=t;this.debugVariables=n}activate(){this.disposables.push(this.debugService.registerDebugAdapterTrackerFactory(ye,this)),this.disposables.push(this.debugService.registerDebugAdapterTrackerFactory("debugpy",this)),this.disposables.push(this.debugService.registerDebugAdapterTrackerFactory(rx,this)),this.disposables.push(this.debugService.registerDebugAdapterTrackerFactory(nx,this))}createDebugAdapterTracker(e){return this.debugVariables}};Eb=y([(0,Du.injectable)(),m(0,(0,Du.inject)(Ua)),m(0,(0,Du.named)(qe.MULTIPLEXING_DEBUGSERVICE)),m(1,(0,Du.inject)(O)),m(2,(0,Du.inject)(kn)),m(2,(0,Du.named)(qe.DEBUGGER_VARIABLES))],Eb);var ja=P(M());var QC=require("vscode");var bL=new Set(["DataFrame","list","dict","ndarray","Series","Tensor","EagerTensor","DataArray"]);function v0(r){return{name:r.evaluateName??r.name,type:r.type,count:0,shape:"",size:0,supportsDataExplorer:bL.has(r.type||""),value:r.value,truncated:!0,frameId:r.variablesReference}}function y0(r){let e=r.index,t=r.columns;return{data:r.data.map((o,s)=>{let a={index:e[s]};return t.forEach((l,c)=>{a[l]=o[c]}),a})}}var IL=require("vscode"),kb=class{constructor(e){this._sessionId=e;this.topMostFrameId=0;this.sequenceNumbersOfRequestsPendingResponses=new Set;this.waitingForStackTrace=!1;this.debugLocationUpdatedEvent=new IL.EventEmitter;this.sessionEndedEmitter=new IL.EventEmitter;this.DebugLocation=void 0}get sessionId(){return this._sessionId}get sessionEnded(){return this.sessionEndedEmitter.event}get debugLocationUpdated(){return this.debugLocationUpdatedEvent.event}get debugLocation(){return this._debugLocation}onDidSendMessage(e){if(this.isResponseForRequestToFetchAllFrames(e)){let t=e.body?.stackFrames[0];this.topMostFrameId=t?.id,this.sequenceNumbersOfRequestsPendingResponses.delete(e.request_seq),this.waitingForStackTrace&&(this.DebugLocation={lineNumber:t?.line,fileName:this.normalizeFilePath(t?.source?.path),column:t.column},this.waitingForStackTrace=!1)}this.isStopEvent(e)&&(this.waitingForStackTrace=!0),this.isContinueEvent(e)&&(this.DebugLocation=void 0,this.waitingForStackTrace=!1)}onWillStopSession(){this.sessionEndedEmitter.fire(this)}onWillReceiveMessage(e){this.isRequestToFetchAllFrames(e)&&this.sequenceNumbersOfRequestsPendingResponses.add(e.seq)}set DebugLocation(e){let t=this._debugLocation;this._debugLocation=e,this._debugLocation!==t&&this.debugLocationUpdatedEvent.fire()}normalizeFilePath(e){return process.platform!=="win32"?e.replace(/\\/g,"/"):e}isStopEvent(e){return e.type==="event"&&e.event==="stopped"}isContinueEvent(e){if(e.type==="event"){if(e.event==="continue")return!0}else if(e.type==="response"&&e.command==="continue")return!0;return!1}isResponseForRequestToFetchAllFrames(e){return e.type==="response"&&e.command==="stackTrace"&&e.body?.stackFrames[0]&&this.sequenceNumbersOfRequestsPendingResponses.has(e.request_seq)}isRequestToFetchAllFrames(e){return e.type==="request"&&e.command==="stackTrace"&&(e.arguments.startFrame===0||e.arguments.startFrame===void 0)}};var ibe=new Set(["In","Out","exit","quit"]),b0=100,Pb=class extends kb{constructor(t,n,i,o,s,a){super(void 0);this.debugService=t;this.debuggingManager=n;this.configService=i;this.varScriptGenerator=o;this.dfScriptGenerator=s;this.kernelProvider=a;this.refreshEventEmitter=new QC.EventEmitter;this.lastKnownVariables=[];this.importedGetVariableInfoScriptsIntoKernel=new Set;this.watchedNotebooks=new Map;this.debuggingStarted=!1;this.currentVariablesReference=0;this.currentSeqNumsForVariables=new Set;this.debuggingManager.onDoneDebugging(()=>this.refreshEventEmitter.fire(),this)}get refreshRequired(){return this.refreshEventEmitter.event}get active(){return(this.debugService.activeDebugSession!==void 0||this.activeNotebookIsDebugging())&&this.debuggingStarted}getAllVariableDiscriptions(){throw new Error("Method not implemented.")}async getVariables(t,n){n&&this.watchKernel(n);let i=n&&this.kernelProvider.getKernelExecution(n),o={executionCount:i?i.executionCount:t.executionCount,pageStartIndex:0,pageResponse:[],totalCount:0,refreshCount:t.refreshCount};if(this.active){let s=t.sortColumn,a=(u,p)=>{let f=u[s]?u[s]:"",g=p[s]?p[s]:"";return t.sortAscending?f.localeCompare(g,void 0,{sensitivity:"base"}):g.localeCompare(f,void 0,{sensitivity:"base"})};this.lastKnownVariables.sort(a);let l=t.startIndex?t.startIndex:0,c=t.pageSize?t.pageSize:b0;o.pageStartIndex=l;for(let u=l;u<l+c&&u<this.lastKnownVariables.length;u+=1){let p=this.lastKnownVariables[u].truncated?await this.getFullVariable(this.lastKnownVariables[u]):this.lastKnownVariables[u];this.lastKnownVariables[u]=p,o.pageResponse.push(p)}o.totalCount=this.lastKnownVariables.length}return o}async getMatchingVariable(t,n){if(this.active){let i=this.lastKnownVariables.find(o=>o.name===t);return i&&n?.resourceUri&&rp(n?.resourceUri).toLowerCase()===".ipynb"&&A("DATASCIENCE.RUN_BY_LINE_VARIABLE_HOVER"),i}}async getVariableValueSummary(t){}async getDataFrameInfo(t,n,i,o){if(!this.active)return t;o&&(t=await this.getFullVariable(t)),n&&this.watchKernel(n);let s=t.name;i&&(s=`${t.name}${i}`);let{cleanupCode:a,initializeCode:l,code:c}=await this.dfScriptGenerator.generateCodeToGetDataFrameInfo({isDebugging:!0,variableName:s}),u=await this.evaluate({code:c,cleanupCode:a,initializeCode:l,frameId:t.frameId}),p=n?.notebook,f=p?Ee(p.uri.path):"";return!f&&this.debugLocation?.fileName&&(f=Ee(this.debugLocation.fileName)),u?{...t,...JSON.parse(u.result),maximumRowChunkSize:b0,fileName:f}:t}async getDataFrameRows(t,n,i,o,s){if(i-n>b0)throw new Error(`Debugger cannot provide more than ${b0} rows at once`);if(!this.debugService.activeDebugSession||t.columns===void 0)return{data:[]};o&&this.watchKernel(o);let a=t.name;s&&(a=`${t.name}${s}`);let{cleanupCode:l,initializeCode:c,code:u}=await this.dfScriptGenerator.generateCodeToGetDataFrameRows({isDebugging:!0,variableName:a,startIndex:n,endIndex:i}),p=await this.evaluate({code:u,cleanupCode:l,initializeCode:c,frameId:t.frameId});return y0(JSON.parse(p.result))}onWillReceiveMessage(t){super.onWillReceiveMessage(t),t.type==="request"&&t.command==="variables"&&t.arguments&&this.currentVariablesReference===t.arguments.variablesReference&&this.currentSeqNumsForVariables.add(t.seq)}onDidSendMessage(t){if(super.onDidSendMessage(t),t.type==="response"&&t.command==="initialize")this.debuggingStarted=!0;else if(t.type==="event"&&t.event==="stopped"&&this.activeNotebookIsDebugging())this.handleNotebookVariables(t).catch(h);else if(t.type==="response"&&t.command==="scopes"&&t.body&&t.body.scopes){let i=t.body.scopes[0].variablesReference;i!==this.currentVariablesReference&&(this.currentVariablesReference=i,this.currentSeqNumsForVariables.clear())}else if(t.type==="response"&&t.command==="variables"&&t.body)this.currentSeqNumsForVariables.has(t.request_seq)&&this.updateVariables(void 0,t),this.monkeyPatchDataViewableVariables(t);else if(t.type==="event"&&t.event==="terminated"){this.lastKnownVariables=[],this.topMostFrameId=0,this.debuggingStarted=!1,this.refreshEventEmitter.fire();let n=this.debugService.activeDebugSession?.id;n&&this.importedGetVariableInfoScriptsIntoKernel.delete(n)}}watchKernel(t){let n=t.notebook?.uri.toString();if(n&&!this.watchedNotebooks.has(n)){let i=[];i.push(t.onRestarted(this.resetImport.bind(this,n))),i.push(t.onDisposed(()=>{this.resetImport(n),i.forEach(o=>o.dispose()),this.watchedNotebooks.delete(n)})),this.watchedNotebooks.set(n,i)}}resetImport(t){this.importedGetVariableInfoScriptsIntoKernel.delete(t)}async evaluate({code:t,cleanupCode:n,frameId:i,initializeCode:o}){if(this.debugService.activeDebugSession){i=this.topMostFrameId||i;let s={frameId:i,context:"repl",format:{rawString:!0}};d.debug(`Evaluating in debugger : ${this.debugService.activeDebugSession.id}: ${t}`);try{o&&await this.debugService.activeDebugSession.customRequest("evaluate",{...s,expression:o});let a=await this.debugService.activeDebugSession.customRequest("evaluate",{...s,expression:t});if(a&&a.result!=="None")return a;d.error(`Cannot evaluate ${t}`);return}finally{n&&await this.debugService.activeDebugSession.customRequest("evaluate",{...s,expression:n})}}throw Error("Debugger is not active, cannot evaluate.")}async getFullVariable(t){let{initializeCode:n,code:i,cleanupCode:o}=await this.varScriptGenerator.generateCodeToGetVariableInfo({isDebugging:!0,variableName:t.name}),s=await this.evaluate({code:i,initializeCode:n,cleanupCode:o,frameId:t.frameId});return s&&s.result?{...t,truncated:!1,...JSON.parse(s.result)}:t}monkeyPatchDataViewableVariables(t){t.body.variables.forEach(n=>{n.type&&bL.has(n.type)&&(n.__vscodeVariableMenuContext="viewableInDataViewer")})}updateVariables(t,n){let i=this.configService.getSettings(t).variableExplorerExclude?this.configService.getSettings().variableExplorerExclude?.split(";"):[],o=n.body.variables.filter(s=>!(!s.name||!s.type||!s.value||i&&i.includes(s.type)||s.name.startsWith("_")||ibe.has(s.name)||s.type==="NoneType"));this.lastKnownVariables=o.map(s=>v0(s)),this.refreshEventEmitter.fire()}activeNotebookIsDebugging(){let t=QC.window.activeNotebookEditor;return!!t&&this.debuggingManager.isDebugging(t.notebook)}async handleNotebookVariables(t){let n=QC.window.activeNotebookEditor?.notebook,i=t.body.threadId;if(n){let o=this.debuggingManager.getDebugSession(n);if(o){let s=await o.customRequest("stackTrace",{threadId:i,startFrame:0,levels:1});if(s&&s.stackFrames[0]){let a=s.stackFrames[0],l=this.debuggingManager.getDebugMode(n),c;if(l===0){let u=this.debuggingManager.getDebugCell(n);a.source&&u&&a.source.path===u.document.uri.toString()&&(c=await o.customRequest("scopes",{frameId:a.id}))}else{let u=Ee(n.uri.toString());a.source&&a.source.path&&a.source.path.includes(u)&&(c=await o.customRequest("scopes",{frameId:a.id}))}c&&(c.scopes.forEach(u=>{o.customRequest("variables",{variablesReference:u.variablesReference}).then(h,h)}),this.refreshEventEmitter.fire())}}}}};Pb=y([(0,ja.injectable)(),m(0,(0,ja.inject)(Ua)),m(0,(0,ja.named)(qe.MULTIPLEXING_DEBUGSERVICE)),m(1,(0,ja.inject)(Td)),m(2,(0,ja.inject)(le)),m(3,(0,ja.inject)(Jh)),m(4,(0,ja.inject)($h)),m(5,(0,ja.inject)(Te))],Pb);var _u=P(M()),Rd=require("vscode");var vz=require("vscode"),sr=class{constructor(e){this.name=e}get value(){return this.lastValue}async set(e){this.lastValue!==e&&(this.lastValue=e,await vz.commands.executeCommand("setContext",this.name,this.lastValue))}};var Cz=require("vscode");var YC=(o=>(o[o.Unknown=0]="Unknown",o[o.Ok=1]="Ok",o[o.Outdated=2]="Outdated",o[o.NotInstalled=3]="NotInstalled",o[o.ControllerNotSelected=4]="ControllerNotSelected",o))(YC||{});async function yz(r){let e="5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d",t=`import builtins
|
||
import ipykernel
|
||
builtins.print("${e}" + ipykernel.__version__ + "${e}")`,n=await r.executeHidden(t),i=/^(\d+)\.\d+\.\d+$/;for(let o of n){if(o.output_type!=="stream")continue;let s=o.text?.toString().trim()??"";if(!s.includes(e))continue;let a=s.split(e)[1].trim().match(i);if(a){let l=a[1];return Number(l)>=6?1:2}}return 0}function XC(r){let e=r;if(typeof e.__notebookUri>"u"||typeof e.__mode>"u"||(e.__mode===1||e.__mode===2||e.__mode===0)&&typeof e.__cellIndex>"u")throw new Error("Invalid launch configuration")}function bz(r){if(XC(r),r.__mode!==2)throw new Error("Invalid launch configuration")}function I0(r,e){switch(r.type){case"event":let t=r;switch(t.event){case"output":e(t.body);break;case"loadedSource":e(t.body);break;case"breakpoint":e(t.body.breakpoint);break;default:break}break;case"request":let n=r;switch(n.command){case"setBreakpoints":let o=n.arguments,s=o.breakpoints;if(s&&s.length){let a=s[0].line;s.forEach(c=>{e(c,{...o.source})});let l={source:o.source,line:a};e(l),o.source=l.source}break;case"breakpointLocations":e(n.arguments);break;case"source":e(n.arguments);break;case"gotoTargets":e(n.arguments);break;default:break}break;case"response":let i=r;if(i.success&&i.body)switch(i.command){case"stackTrace":i.body.stackFrames.forEach(o=>{e(o)});break;case"loadedSources":i.body.sources.forEach(o=>{let s={source:o};e(s),o.path=s.source.path});break;case"scopes":i.body.scopes.forEach(o=>{e(o)});break;case"setFunctionBreakpoints":i.body.breakpoints.forEach(o=>{e(o)});break;case"setBreakpoints":i.body.breakpoints.forEach(o=>{e(o)});break;default:break}break}}function Iz(r){return/~\d+\\/.test(r)}function Sz(r,e){return new RegExp(r.replace(/\\/g,"\\\\").replace(/~\d+\\\\/g,"[^\\\\]+\\\\"),"i").test(e)}async function Kf(r,e){let t=`import debugpy
|
||
debugpy.debug_this_thread()`;await r.executeHidden(t),await e.dumpAllCells()}function xz(r){return!!r.header&&r.header.msg_type==="debug_event"}function ZC(r){return r.includes("Frame skipped from debugging during step-in")}function SL(r){return r.event==="debugpyAttach"}var S0=class{constructor(e,t,n){this.debugAdapter=e;this.debugCell=t;this.execution=n;A("DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_RUN_AND_DEBUG_CELL")}trace(e,t){d.debug(`[Debug-Cell] ${e}: ${t}`)}async willSendEvent(e){return SL(e)?(this.trace("intercept","debugpyAttach request for subprocess, not supported"),!0):e.event==="output"&&ZC(e.body.output)?(this.trace("intercept","justMyCode notification"),!0):!1}async willSendRequest(e){e.command==="configurationDone"&&(await Kf(this.execution,this.debugAdapter),Cz.commands.executeCommand("notebook.cell.execute",{ranges:[{start:this.debugCell.index,end:this.debugCell.index+1}],document:this.debugCell.notebook.uri}).then(h,h))}};var ew=class{constructor(e,t,n,i){this.mode=e;this.debugAdapter=t;this.debugCell=n;this.serviceContainer=i;this.debuggingManager=this.serviceContainer.get(Td)}trace(e,t){d.debug(`[Debug-Restart] ${e}: ${t}`)}error(e,t){d.error(`[Debug-Restart] ${e}: ${t}`)}async willSendResponse(e){e.command==="initialize"&&e.body&&(e.body.supportsRestartRequest=!0)}async willSendRequest(e){if(e.command==="restart")return this.trace("restart","Handling restart request"),setTimeout(()=>{this.debugAdapter.disconnect().then(()=>(this.trace("restart","doRestart"),this.debuggingManager.tryToStartDebugging(this.mode,this.debugCell,!0))).catch(t=>{this.error("restart",`Error restarting: ${t}`)})},0),{command:e.command,request_seq:e.seq,seq:e.seq,success:!0,type:"response"}}};var tw=require("vscode");var x0=class{constructor(e,t,n,i){this.debugAdapter=e;this.debugCell=t;this.execution=n;this.settings=i;A("DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_RUNBYLINE")}continue(){if(typeof this.lastPausedThreadId!="number"){d.debug("No paused thread, can't do RBL"),this.stop();return}this.debugAdapter.stepIn(this.lastPausedThreadId).then(h,h)}stop(){d.ci("RunbylineController::stop()"),this.execution.executeHidden("pass").then(h,h),this.debugAdapter.disconnect().then(h,h)}getMode(){return this.debugAdapter.getConfiguration().__mode}async willSendEvent(e){return e.event==="stopped"&&(this.lastPausedThreadId=e.body.threadId,await this.handleStoppedEvent(this.lastPausedThreadId))?(this.trace("intercepted","handled stop event"),!0):e.event==="output"&&ZC(e.body.output)?(this.trace("intercept","justMyCode notification"),!0):!1}async willSendRequest(e){d.ci(`willSendRequest: ${e.command}`),e.command==="configurationDone"&&await this.initializeExecute()}async handleStoppedEvent(e){return await this.shouldStepIn(e)?(this.debugAdapter.stepIn(e).then(h,h),!0):!1}async shouldStepIn(e){let t=await this.debugAdapter.stackTrace({threadId:e,startFrame:0,levels:1});if(t&&t.stackFrames[0]){let n=t.stackFrames[0],i=new tw.Position(n.line,n.column);return this.lastPausePosition?.isEqual(i)?(this.trace("intercept","working around duplicate stop event"),!0):(this.lastPausePosition=i,!!n.source&&n.source.path!==this.debugCell.document.uri.toString())}return!1}trace(e,t){d.debug(`[Debug-RBL] ${e}: ${t}`)}async initializeExecute(){await Kf(this.execution,this.debugAdapter);let e=Fe(this.debugCell.document.getText(),{trim:!1,removeEmptyEntries:!1}),t=[];if(xm(e,()=>void 0,(n,i)=>{n.trim().length!==0&&t.push(i)}),t.sort(),t.length!==0){let n={line:t[0]+1};await this.debugAdapter.setBreakpoints({source:{name:Ee(this.debugCell.notebook.uri.path),path:this.debugCell.document.uri.toString()},breakpoints:[n],sourceModified:!1}),this.settings.getSettings(this.debugCell.notebook.uri).showVariableViewWhenDebugging&&tw.commands.executeCommand(q.OpenVariableView).then(h,h)}tw.commands.executeCommand("notebook.cell.execute",{ranges:[{start:this.debugCell.index,end:this.debugCell.index+1}],document:this.debugCell.notebook.uri}).then(h,h)}};var Db=class{constructor(e,t,n){this.document=e;this.config=t;this.session=n}};var $n=require("vscode");var _b=class{constructor(e,t,n){this.kernelProvider=e;this.controllerRegistration=t;this.serviceContainer=n;this.notebookToDebugger=new Map;this.notebookToDebugAdapter=new Map;this.notebookInProgress=new Set;this.disposables=[];this._doneDebugging=new $n.EventEmitter}activate(){this.disposables.push($n.debug.onDidTerminateDebugSession(this.endSession.bind(this)),$n.workspace.onDidCloseNotebookDocument(async e=>{let t=this.notebookToDebugger.get(e);t&&(await $n.debug.stopDebugging(t.session),this.onDidStopDebugging(e))}))}getDebugCell(e){return this.notebookToDebugAdapter.get(e)?.debugCell}get onDoneDebugging(){return this._doneDebugging.event}dispose(){this.disposables.forEach(e=>e.dispose())}isDebugging(e){return this.notebookToDebugger.has(e)}getDebugSession(e){let t=this.notebookToDebugger.get(e);if(t)return t.session}getDebugAdapter(e){return this.notebookToDebugAdapter.get(e)}onDidStopDebugging(e){}async startDebuggingConfig(e,t){d.ci(`Attempting to start debugging with config ${JSON.stringify(e)}`);try{await $n.debug.startDebugging(void 0,e,t)}catch(n){d.error(`Can't start debugging (${n})`),$n.window.showErrorMessage(I.cantStartDebugging).then(h,h)}}trackDebugAdapter(e,t){this.notebookToDebugAdapter.set(e,t),this.disposables.push(t.onDidEndSession(this.endSession.bind(this)))}async endSession(e){d.info(`Ending debug session ${e.id}`),this._doneDebugging.fire();for(let[t,n]of this.notebookToDebugger.entries())if(n&&e.id===n.session.id){this.notebookToDebugger.delete(t),this.notebookToDebugAdapter.delete(t),this.onDidStopDebugging(t);break}}getDebuggerByUri(e){for(let[t,n]of this.notebookToDebugger.entries())if(e===t)return n}async ensureKernelIsRunning(e){let t=this.controllerRegistration.getSelected(e),n=this.kernelProvider.get(e);return t&&(!n||n&&n.status==="unknown")&&(n=await ta.connectToNotebookKernel(t.connection,this.serviceContainer,{notebook:e,controller:t.controller,resource:e.uri},new Ht(!1),this.disposables,"jupyterExtension")),n}findEditorForCell(e){let t=e.notebook.uri.toString();return $n.window.visibleNotebookEditors.find(n=>n.notebook.uri.toString()===t)}async checkIpykernelAndPrompt(e,t=!0){let n=this.findEditorForCell(e);if(!n)return $n.window.showErrorMessage(I.noNotebookToDebug).then(h,h),0;let i=await this.checkForIpykernel6(n.notebook);switch(i){case 3:break;case 2:case 0:{this.promptInstallIpykernel6().then(h,h);break}case 4:if(t)return await $n.commands.executeCommand("notebook.selectKernel",{notebookEditor:n}),await this.checkIpykernelAndPrompt(e,!1)}return i}async checkForIpykernel6(e){try{let t=this.kernelProvider.get(e);if(!t){let s=this.controllerRegistration.getSelected(e);if(!s)return 4;t=this.kernelProvider.getOrCreate(e,{metadata:s.connection,controller:s?.controller,resourceUri:e.uri})}let n=t.kernelConnectionMetadata;if(Nt(n)){if(n.kind==="startUsingRemoteKernelSpec"&&n.kernelSpec.metadata?.debugger)return 1;if(n.kind==="connectToLiveRemoteKernel"&&n.kernelModel.metadata?.debugger)return 1}let i=this.kernelProvider.getKernelExecution(t),o=await yz(i);return A("DATASCIENCE.DEBUGGING.IPYKERNEL6_STATUS",void 0,{status:o===1?"installed":"notInstalled"}),o}catch(t){d.error("Debugging: Could not check for ipykernel 6",t)}return 0}async promptInstallIpykernel6(){await $n.window.showInformationMessage(I.needIpykernel6,{modal:!0},I.setup)===I.setup?(A("DATASCIENCE.DEBUGGING.CLICKED_ON_SETUP"),$n.env.openExternal($n.Uri.parse("https://github.com/microsoft/vscode-jupyter/wiki/Setting-Up-Run-by-Line-and-Debugging-for-Notebooks"))):A("DATASCIENCE.DEBUGGING.CLOSED_MODAL")}};var Wa=require("vscode");var C0=class{constructor(e){this.debugAdapter=e}trace(e,t){d.debug(`[Debug-Reset] ${e}: ${t}`)}async willSendRequest(e){e.command==="attach"&&(this.trace("attach","Continuing paused kernel threads if needed"),(await this.debugAdapter.debugInfo()).stoppedThreads.forEach(n=>this.debugAdapter.continueDirect(n)))}};var Tb=class{constructor(e,t,n,i,o,s){this.session=e;this.notebookDocument=t;this.jupyterSession=n;this.kernel=i;this.platformService=o;this.debugService=s;this.fileToCell=new Map;this.sendMessage=new Wa.EventEmitter;this.endSession=new Wa.EventEmitter;this.disposables=[];this.delegates=[];this.onDidSendMessage=this.sendMessage.event;this.onDidEndSession=this.endSession.event;this.disconnected=!1;d.ci("Creating kernel debug adapter for debugging notebooks");let a=this.session.configuration;XC(a),this.configuration=a,this.debugCell=t.cellAt(a.__cellIndex),this.addDebuggingDelegates([new C0(this)]),this.jupyterSession.kernel?.iopubMessage.connect(this.onIOPubMessage,this),this.disposables.push(new Wa.Disposable(()=>this.jupyterSession.kernel?.iopubMessage.disconnect(this.onIOPubMessage,this))),this.kernel&&(this.kernel.addHook("willRestart",()=>this.disconnect(),this,this.disposables),this.kernel.addHook("interruptCompleted",()=>this.disconnect(),this,this.disposables),this.disposables.push(this.kernel.onDisposed(()=>{this.disconnected||(Wa.debug.stopDebugging(this.session).then(h,h),this.disconnect().catch(h),A("DATASCIENCE.DEBUGGING.ENDED_SESSION",void 0,{reason:"onKernelDisposed"}))}))),this.disposables.push(or.onDidChangeNotebookCellExecutionState(l=>{this.configuration.__cellIndex===l.cell.index&&l.state===1&&!this.disconnected&&(A("DATASCIENCE.DEBUGGING.ENDED_SESSION",void 0,{reason:"normally"}),this.disconnect().catch(h))},this,this.disposables)),this.disposables.push(Wa.workspace.onDidChangeNotebookDocument(l=>{l.contentChanges.forEach(c=>{c.removedCells.forEach(u=>{u===this.debugCell&&this.disconnect().catch(h)})})},this,this.disposables)),this.disposables.push(this.debugService.onDidTerminateDebugSession(l=>{(l===this.session||l===this.session)&&this.disconnect().catch(h)}))}addDebuggingDelegates(e){this.delegates.push(...e)}trace(e,t){d.debug(`[Debug] ${e}: ${t}`)}async onIOPubMessage(e,t){if(d.ci(`Debug IO Pub message: ${JSON.stringify(t)}`),xz(t)){this.trace("event",JSON.stringify(t));for(let n of this.delegates??[])if(await n?.willSendEvent?.(t.content))return;this.sendMessage.fire(t.content)}}handleMessage(e){this.handleClientMessageAsync(e).catch(h)}async handleClientMessageAsync(e){try{if(d.ci(`KernelDebugAdapter::handleMessage ${JSON.stringify(e,void 0," ")}`),e.type==="request"&&e.command==="setBreakpoints"){let t=e.arguments;if(t.source&&t.source.path&&t.source.path.indexOf("vscode-notebook-cell:")===0){let n=this.notebookDocument.getCells().find(i=>i.document.uri.toString()===t.source.path);n&&await this.dumpCell(n.index)}}if(e.type==="request")for(let t of this.delegates??[]){let n=await t?.willSendRequest?.(e);if(n){this.trace("response",JSON.stringify(n)),this.sendMessage.fire(n);return}}await this.sendMessageToJupyterSession(e)}catch(t){d.error(`KernelDebugAdapter::handleMessage failure: ${t}`)}}getConfiguration(){return this.configuration}stepIn(e){return this.session.customRequest("stepIn",{threadId:e})}async debugInfo(){return await this.session.customRequest("debugInfo")}continueDirect(e){if(!this.jupyterSession.kernel)throw new yn;this.jupyterSession.kernel.requestDebug({seq:0,type:"request",command:"continue",arguments:{threadId:e}})}async disconnect(){if(!this.disconnected){if(this.disconnected=!0,this.debugService.activeDebugSession===this.session||this.debugService.activeDebugSession?.id===this.session.id)try{await Promise.all([this.deleteDumpedFiles().catch(e=>d.warn("Error deleting temporary debug files.",e)),this.session.customRequest("disconnect",{restart:!1})])}catch(e){d.error("Failed to disconnect debug session",e)}this.endSession.fire(this.session)}}dispose(){this.disposables.forEach(e=>e.dispose())}stackTrace(e){return this.session.customRequest("stackTrace",e)}setBreakpoints(e){return this.session.customRequest("setBreakpoints",e)}async dumpAllCells(){await Promise.all(this.notebookDocument.getCells().map(async e=>{e.kind===Wa.NotebookCellKind.Code&&await this.dumpCell(e.index)}))}lookupCellByLongName(e){if(this.platformService.isWindows){e=Cn(e);for(let[t,n]of this.fileToCell.entries())if(Iz(t)&&Sz(t,e))return n}}async sendMessageToJupyterSession(e){if(this.jupyterSession.isDisposed||this.jupyterSession.status==="dead"||!this.jupyterSession.kernel){d.info(`Skipping sending message ${e.type} because session is disposed`);return}if(this.trace("to kernel",JSON.stringify(e)),e.type==="request"){let t=await this.sendRequestToJupyterSession(e);t&&this.sendMessage.fire(t)}else if(e.type==="response"){I0(e,this.translateRealLocationToDebuggerLocation.bind(this));let t=e;return this.jupyterSession.kernel.requestDebug({seq:t.seq,type:"request",command:t.command},!0).done}else d.error(`Unknown message type to send ${e.type}`)}async sendRequestToJupyterSession(e){if(I0(e,this.translateRealLocationToDebuggerLocation.bind(this)),!this.jupyterSession.kernel)throw new yn;this.trace("to kernel, mapped",JSON.stringify(e));let t=e,o=(await this.jupyterSession.kernel.requestDebug({seq:t.seq,type:"request",command:t.command,arguments:t.arguments},!0).done).content;I0(o,this.translateDebuggerLocationToRealLocation.bind(this));for(let s of this.delegates??[])await s?.willSendResponse?.(o);return this.trace("response",JSON.stringify(o)),o}translateDebuggerLocationToRealLocation(e,t){if(t=e?.source??t,t&&t.path){let n=this.fileToCell.get(t.path)??this.lookupCellByLongName(t.path);n&&(t.name=Ee(n.path),t.path=n.toString())}}async deleteDumpedFiles(){let e=this.getDumpFilesForDeletion();if(this.jupyterSession.kernel&&e.length){let n=`import os as _VSCODE_os
|
||
_VSCODE_fileList = [${e.map(i=>'"'+i.replace(/\\/g,"\\\\")+'"').join(",")}]
|
||
for file in _VSCODE_fileList:
|
||
try:
|
||
_VSCODE_os.remove(file)
|
||
except:
|
||
pass
|
||
del _VSCODE_fileList
|
||
del _VSCODE_os`;await bn(this.jupyterSession.kernel,n,{traceErrors:!0,traceErrorsMessage:"Error deleting temporary debugging files"})}}};var w0=class extends Tb{constructor(){super(...arguments);this.cellToFile=new Map}async dumpCell(t){let n=this.notebookDocument.cellAt(t);try{let i=await this.session.customRequest("dumpCell",{code:n.document.getText().replace(/\r\n/g,`
|
||
`)}),o=Cn(i.sourcePath);this.fileToCell.set(o,n.document.uri),this.cellToFile.set(n.document.uri.toString(),o)}catch(i){d.error(i)}}translateRealLocationToDebuggerLocation(t){let n=t.source;if(n&&n.path){let i=this.cellToFile.get(n.path);i&&(n.path=i)}}getDumpFilesForDeletion(){return Array.from(this.cellToFile.values())}};var Rb=class extends _b{constructor(t,n,i,o,s,a){super(t,n,a);this.configurationService=i;this.platform=o;this.debugService=s;this.notebookToRunByLineController=new Map;this.runByLineCells=new sr(yr.RunByLineCells),this.runByLineDocuments=new sr(yr.RunByLineDocuments),this.debugDocuments=new sr(yr.DebugDocuments)}activate(){super.activate(),this.disposables.push(Rd.debug.registerDebugAdapterDescriptorFactory(rx,{createDebugAdapterDescriptor:async t=>this.createDebugAdapterDescriptor(t)}))}getDebugMode(t){return this.notebookToRunByLineController.get(t)?.getMode()}onDidStopDebugging(t){super.onDidStopDebugging(t),this.notebookToRunByLineController.delete(t),this.updateRunByLineContextKeys(),this.updateDebugContextKey()}updateRunByLineContextKeys(){let t=[],n=[];this.notebookToRunByLineController.forEach(i=>{t.push(i.debugCell.document.uri),n.push(i.debugCell.notebook.uri)}),this.runByLineCells.set(t).catch(h),this.runByLineDocuments.set(n).catch(h)}updateDebugContextKey(){let t=new Nl;this.notebookToDebugAdapter.forEach((n,i)=>t.add(i.uri)),this.notebookInProgress.forEach(n=>t.add(n.uri)),this.debugDocuments.set(Array.from(t.values())).catch(h)}async tryToStartDebugging(t,n,i=!1){if(d.info(`Starting debugging with mode ${t}`),!i){let o=await this.checkIpykernelAndPrompt(n);if(o!==1){d.info(`Ipykernel check failed: ${YC[o]}`);return}}(t===0||t===1)&&await this.startDebuggingCell(t,n)}runByLineNext(t){let n=this.notebookToRunByLineController.get(t.notebook);n&&n.debugCell.document.uri.toString()===t.document.uri.toString()&&n.continue()}runByLineStop(t){let n=this.notebookToRunByLineController.get(t.notebook);n&&(A("DATASCIENCE.DEBUGGING.ENDED_SESSION",void 0,{reason:"withKeybinding"}),n.stop())}async startDebuggingCell(t,n){let i=n.notebook,o=this.configurationService.getSettings(i.uri),s={type:rx,name:Ee(i.uri.toString()),request:"attach",justMyCode:t===1?o.debugJustMyCode:!0,__mode:t,__cellIndex:n.index,__notebookUri:i.uri.toString()},a=t===0?{suppressDebugStatusbar:!0,suppressDebugToolbar:!0,suppressDebugView:!0,suppressSaveBeforeStart:!0}:{suppressSaveBeforeStart:!0};return this.startDebuggingConfig(s,a)}async createDebugAdapterDescriptor(t){let n=t.configuration;XC(n);let i=n.__notebookUri,o=Rd.workspace.notebookDocuments.find(s=>s.uri.toString()===i);if(!o){d.info(`Cannot start debugging. Notebook ${i} not found.`);return}if(this.notebookInProgress.has(o)){d.info("Cannot start debugging. Already debugging this notebook");return}if(this.isDebugging(o)){d.info("Cannot start debugging. Already debugging this notebook document.");return}this.notebookToDebugger.set(o,new Db(o,n,t));try{return this.notebookInProgress.add(o),this.updateDebugContextKey(),await this.doCreateDebugAdapterDescriptor(n,t,o)}finally{this.notebookInProgress.delete(o),this.updateDebugContextKey()}}async doCreateDebugAdapterDescriptor(t,n,i){let o=await this.ensureKernelIsRunning(i);if(o?.session){let s=new w0(n,i,o.session,o,this.platform,this.debugService);if(t.__mode===0&&typeof t.__cellIndex=="number"){let a=i.cellAt(t.__cellIndex),l=new x0(s,a,this.kernelProvider.getKernelExecution(o),this.configurationService);s.addDebuggingDelegates([l,new ew(0,s,a,this.serviceContainer)]),this.notebookToRunByLineController.set(i,l),this.updateRunByLineContextKeys()}else if(t.__mode===1&&typeof t.__cellIndex=="number"){let a=i.cellAt(t.__cellIndex),l=new S0(s,a,this.kernelProvider.getKernelExecution(o));s.addDebuggingDelegates([l,new ew(1,s,a,this.serviceContainer)])}return this.trackDebugAdapter(i,s),this.updateDebugContextKey(),new Rd.DebugAdapterInlineImplementation(s)}else Rd.window.showInformationMessage(I.kernelWasNotStarted).then(h,h)}};Rb=y([(0,_u.injectable)(),m(0,(0,_u.inject)(Te)),m(1,(0,_u.inject)(pt)),m(2,(0,_u.inject)(le)),m(3,(0,_u.inject)(wr)),m(4,(0,_u.inject)(Li)),m(5,(0,_u.inject)(at))],Rb);var rw=P(M()),wz=require("vscode");var Ab=class{constructor(e,t){this.disposableRegistry=t;this.activeTrackers=new WeakMap;this.activeTrackersById=new Map;this.updatedEmitter=new wz.EventEmitter;t.push(e.registerDebugAdapterTrackerFactory("python",this))}createDebugAdapterTracker(e){let t=new kb(e.id);return this.activeTrackers.set(e,t),this.activeTrackersById.set(e.id,t),t.sessionEnded(()=>{this.activeTrackers.delete(e),this.activeTrackersById.delete(e.id)},this,this.disposableRegistry),t.debugLocationUpdated(this.onLocationUpdated,this,this.disposableRegistry),this.onLocationUpdated(),t}get updated(){return this.updatedEmitter.event}getLocation(e){let t=this.activeTrackers.get(e)||this.activeTrackersById.get(e.id);if(t)return t.debugLocation}onLocationUpdated(){this.updatedEmitter.fire()}};Ab=y([(0,rw.injectable)(),m(0,(0,rw.inject)(Li)),m(1,(0,rw.inject)(O))],Ab);var k0=P(M()),Pz=P(require("net"));var Dz=P(To()),Ff=require("vscode");var kz=require("events"),Ez=`\r
|
||
\r
|
||
`,E0=class{constructor(){this.rawData=Buffer.concat([]);this.contentLength=-1;this.disposed=!1;this.dataCallbackHandler=e=>{this.handleData(e)};this.events=new kz.EventEmitter}dispose(){this.stream&&(this.stream.removeListener("data",this.dataCallbackHandler),this.stream=void 0)}connect(e){this.stream=e,e.addListener("data",this.dataCallbackHandler)}on(e,t){return this.events.on(e,t),this}once(e,t){return this.events.once(e,t),this}dispatch(e){let t=JSON.parse(e);switch(t.type){case"event":{let n=t;typeof n.event=="string"&&this.events.emit(`${t.type}_${n.event}`,n);break}case"request":{let n=t;typeof n.command=="string"&&this.events.emit(`${t.type}_${n.command}`,n);break}case"response":{let n=t;typeof n.command=="string"&&this.events.emit(`${t.type}_${n.command}`,n);break}default:this.events.emit(`${t.type}`,t)}this.events.emit("data",t)}handleData(e){if(!this.disposed)for(this.rawData=Buffer.concat([this.rawData,e]);;){if(this.contentLength>=0){if(this.rawData.length>=this.contentLength){let t=this.rawData.toString("utf8",0,this.contentLength);this.rawData=this.rawData.slice(this.contentLength),this.contentLength=-1,t.length>0&&this.dispatch(t);continue}}else{let t=this.rawData.indexOf(Ez);if(t!==-1){let i=this.rawData.toString("utf8",0,t).split(`\r
|
||
`);for(let o of i){let s=o.split(/: +/);s[0]==="Content-Length"&&(this.contentLength=+s[1])}this.rawData=this.rawData.slice(t+Ez.length);continue}}break}}};var xL=class{constructor(e,t,n){this._id=e;this._configuration=t;this.customRequestHandler=n;this._name="JupyterDebugSession";}get id(){return this._id}get type(){return"python"}get name(){return this._name}get workspaceFolder(){}get configuration(){return this._configuration}customRequest(e,t){return this.customRequestHandler(e,t)}getDebugProtocolBreakpoint(e){return Promise.resolve(void 0)}},Nb=class{constructor(e){this.sequence=1;this.breakpointEmitter=new Ff.EventEmitter;this.debugAdapterTrackerFactories=[];this.debugAdapterTrackers=[];this.sessionChangedEvent=new Ff.EventEmitter;this.sessionStartedEvent=new Ff.EventEmitter;this.sessionTerminatedEvent=new Ff.EventEmitter;this.sessionCustomEvent=new Ff.EventEmitter;this.breakpointsChangedEvent=new Ff.EventEmitter;this._breakpoints=[];e.push(this),this.protocolParser=new E0}dispose(){this.socket&&(this.socket.end(),this.socket=void 0)}get activeDebugSession(){return this.session}get activeDebugConsole(){return{append(e){},appendLine(e){}}}get breakpoints(){return this._breakpoints}get onDidChangeActiveDebugSession(){return this.sessionChangedEvent.event}get onDidStartDebugSession(){return this.sessionStartedEvent.event}get onDidReceiveDebugSessionCustomEvent(){return this.sessionCustomEvent.event}get onDidTerminateDebugSession(){return this.sessionTerminatedEvent.event}get onDidChangeBreakpoints(){return this.breakpointsChangedEvent.event}registerDebugConfigurationProvider(e,t){return{dispose:()=>{}}}registerDebugAdapterTrackerFactory(e,t){return this.debugAdapterTrackerFactories.push(t),{dispose:()=>{this.debugAdapterTrackerFactories=this.debugAdapterTrackerFactories.filter(n=>n!==t)}}}startRunByLine(e){return this.startDebugging(void 0,e)}startDebugging(e,t,n){let i=t;return i.port?(this.session=new xL((0,Dz.default)(),i,this.sendCustomRequest.bind(this)),this.sessionChangedEvent.fire(this.session),this.debugAdapterTrackers=this.debugAdapterTrackerFactories.map(o=>o.createDebugAdapterTracker(this.session)),this.socket=Pz.createConnection(i.port),this.protocolParser.connect(this.socket),this.protocolParser.on("event_stopped",this.onBreakpoint.bind(this)),this.protocolParser.on("event_output",this.onOutput.bind(this)),this.protocolParser.on("event_terminated",this.sendToTrackers.bind(this)),this.socket.on("error",this.onError.bind(this)),this.socket.on("close",this.onClose.bind(this)),this.sendStartSequence(i,this.session.id).then(()=>!0)):Promise.resolve(!0)}addBreakpoints(e){this._breakpoints=this._breakpoints.concat(e)}removeBreakpoints(e){}get onBreakpointHit(){return this.breakpointEmitter.event}async continue(){await this.sendMessage("continue",{threadId:0}),this.sendToTrackers({type:"event",event:"continue"})}async step(){await this.sendMessage("stepIn",{threadId:this._stoppedThreadId?this._stoppedThreadId:1}),this.sendToTrackers({type:"event",event:"stepIn"})}async getStack(){let e=oe();return this.protocolParser.once("response_stackTrace",t=>{this.sendToTrackers(t);let n=t,i=n.body.stackFrames?n.body.stackFrames:[];e.resolve(i),this._topFrameId=i[0]?.id}),await this.emitMessage("stackTrace",{threadId:this._stoppedThreadId?this._stoppedThreadId:1,startFrame:0,levels:1}),e.promise}async requestVariables(){await this.getStack();let e=oe(),t=0;return this.protocolParser.once("response_scopes",n=>{this.sendToTrackers(n);let i=n;i&&(t=i.body.scopes[0].variablesReference),this.emitMessage("variables",{threadId:this._stoppedThreadId?this._stoppedThreadId:1,variablesReference:t}).catch(h)}),this.protocolParser.once("response_variables",n=>{this.sendToTrackers(n),e.resolve()}),await this.emitMessage("scopes",{frameId:this._topFrameId?this._topFrameId:1}),e.promise}stop(){this.onClose()}sendToTrackers(e){switch(e.type){case"request":this.debugAdapterTrackers.forEach(t=>{t.onWillReceiveMessage&&t.onWillReceiveMessage(e)});break;default:this.debugAdapterTrackers.forEach(t=>t.onDidSendMessage(e));break}}sendCustomRequest(e,t){return this.sendMessage(e,t)}async sendStartSequence(e,t){d.info("Sending debugger initialize..."),await this.sendInitialize(),this._breakpoints.length>0&&(d.info("Sending breakpoints"),await this.sendBreakpoints()),d.info("Sending debugger attach...");let n=this.sendAttach(e,t);return d.info("Sending configuration done"),await this.sendConfigurationDone(),d.info("Session started."),n.then(()=>{this.sessionStartedEvent.fire(this.session)})}sendBreakpoints(){let e=this._breakpoints.map(n=>n),t=e[0].location.uri.fsPath;return this.sendMessage("setBreakpoints",{source:{name:Ee(t),path:t},lines:e.map(n=>n.location.range.start.line),breakpoints:e.map(n=>({line:n.location.range.start.line})),sourceModified:!0})}sendAttach(e,t){return this.sendMessage("attach",{debugOptions:["RedirectOutput","FixFilePathCase","WindowsClient","ShowReturnValue"],workspaceFolder:Xo,__sessionId:t,...e})}sendConfigurationDone(){return this.sendMessage("configurationDone")}sendInitialize(){return this.sendMessage("initialize",{clientID:"vscode",clientName:"Visual Studio Code",adapterID:"python",pathFormat:"path",linesStartAt1:!0,columnsStartAt1:!0,supportsVariableType:!0,supportsVariablePaging:!0,supportsRunInTerminalRequest:!0,locale:"en-us"})}sendDisconnect(){return this.sendMessage("disconnect",{})}sendMessage(e,t){let n=oe(),i=this.sessionTerminatedEvent.event(()=>{n.resolve({body:{}})}),o=this.sequence;return this.protocolParser.on(`response_${e}`,s=>{s.request_seq===o&&(this.sendToTrackers(s),d.info(`Received response from debugger: ${JSON.stringify(t)}`),i.dispose(),n.resolve(s.body))}),this.socket?.on("error",s=>n.reject(s)),this.emitMessage(e,t).catch(s=>{d.error(`Exception attempting to emit ${e} to debugger: `,s)}),n.promise}emitMessage(e,t){return new Promise((n,i)=>{try{if(this.socket){let o={command:e,arguments:t,type:"request",seq:this.sequence};this.sequence+=1;let s=JSON.stringify(o);d.info(`Sending request to debugger: ${s}`);let a=`Content-Length: ${s.length}\r
|
||
\r
|
||
${s}`;this.socket.write(a,l=>{this.sendToTrackers(o),n()})}}catch(o){i(o)}})}onBreakpoint(e){this._stoppedThreadId=e.body.threadId,this.sendToTrackers(e),this.breakpointEmitter.fire()}onOutput(e){this.sendToTrackers(e),d.info(JSON.stringify(e))}onError(e){this.sendToTrackers(e),d.info(JSON.stringify(e))}onClose(){this.socket&&(this.sessionTerminatedEvent.fire(this.activeDebugSession),this.session=void 0,this.sessionChangedEvent.fire(void 0),this.debugAdapterTrackers.forEach(e=>e.onExit?e.onExit(0,void 0):void 0),this.debugAdapterTrackers=[],this.sendDisconnect().catch(h),this.socket.destroy(),this.socket=void 0)}};Nb=y([(0,k0.injectable)(),m(0,(0,k0.inject)(O))],Nb);var dc=P(M()),Lf=require("vscode");var Mb=class{constructor(e,t,n){this.vscodeDebugService=t;this.jupyterDebugService=n;this.sessionChangedEvent=new Lf.EventEmitter;this.sessionStartedEvent=new Lf.EventEmitter;this.sessionTerminatedEvent=new Lf.EventEmitter;this.sessionCustomEvent=new Lf.EventEmitter;e.push(t.onDidTerminateDebugSession(this.endedDebugSession.bind(this))),e.push(t.onDidStartDebugSession(this.startedDebugSession.bind(this))),e.push(t.onDidChangeActiveDebugSession(this.changedDebugSession.bind(this))),e.push(t.onDidReceiveDebugSessionCustomEvent(this.gotCustomEvent.bind(this))),n&&(e.push(n.onDidTerminateDebugSession(this.endedDebugSession.bind(this))),e.push(n.onDidStartDebugSession(this.startedDebugSession.bind(this))),e.push(n.onDidChangeActiveDebugSession(this.changedDebugSession.bind(this))),e.push(n.onDidReceiveDebugSessionCustomEvent(this.gotCustomEvent.bind(this))))}get activeDebugSession(){return this.activeService.activeDebugSession}get activeDebugConsole(){return this.activeService.activeDebugConsole}get breakpoints(){return this.activeService.breakpoints}get onDidChangeActiveDebugSession(){return this.sessionChangedEvent.event}get onDidStartDebugSession(){return this.sessionStartedEvent.event}get onDidReceiveDebugSessionCustomEvent(){return this.sessionCustomEvent.event}get onDidTerminateDebugSession(){return this.sessionTerminatedEvent.event}get onDidChangeBreakpoints(){return this.activeService.onDidChangeBreakpoints}get onBreakpointHit(){if(!this.jupyterDebugService)throw new Error("No jupyter debugger service");return this.jupyterDebugService.onBreakpointHit}startRunByLine(e){if(this.lastStartedService=this.jupyterDebugService,!this.jupyterDebugService)throw new Error("No jupyter debugger service");return this.jupyterDebugService.startRunByLine(e)}registerDebugConfigurationProvider(e,t){let n=this.vscodeDebugService.registerDebugConfigurationProvider(e,t);if(this.jupyterDebugService){let i=this.jupyterDebugService.registerDebugConfigurationProvider(e,t);return this.combineDisposables(n,i)}return n}registerDebugAdapterTrackerFactory(e,t){let n=this.vscodeDebugService.registerDebugAdapterTrackerFactory(e,t);if(this.jupyterDebugService){let i=this.jupyterDebugService.registerDebugAdapterTrackerFactory(e,t);return this.combineDisposables(n,i)}return n}startDebugging(e,t,n){return this.lastStartedService=this.vscodeDebugService,this.vscodeDebugService.startDebugging(e,t,n)}addBreakpoints(e){return this.activeService.addBreakpoints(e)}removeBreakpoints(e){return this.activeService.removeBreakpoints(e)}getStack(){if(!this.jupyterDebugService)throw new Error("No jupyter debugger service");if(this.lastStartedService===this.jupyterDebugService)return this.jupyterDebugService.getStack();throw new Error("Requesting jupyter specific stack when not debugging.")}step(){if(!this.jupyterDebugService)throw new Error("No jupyter debugger service");if(this.lastStartedService===this.jupyterDebugService)return this.jupyterDebugService.step();throw new Error("Requesting jupyter specific step when not debugging.")}continue(){if(!this.jupyterDebugService)throw new Error("No jupyter debugger service");if(this.lastStartedService===this.jupyterDebugService)return this.jupyterDebugService.continue();throw new Error("Requesting jupyter specific step when not debugging.")}requestVariables(){if(!this.jupyterDebugService)throw new Error("No jupyter debugger service");if(this.lastStartedService===this.jupyterDebugService)return this.jupyterDebugService.requestVariables();throw new Error("Requesting jupyter specific variables when not debugging.")}stop(){this.jupyterDebugService&&this.lastStartedService===this.jupyterDebugService?this.jupyterDebugService.stop():Lf.commands.executeCommand("workbench.action.debug.stop").then(h,h)}get activeService(){return this.lastStartedService?this.lastStartedService:this.vscodeDebugService}combineDisposables(e,t){return{dispose:()=>{e.dispose(),t.dispose()}}}endedDebugSession(e){this.sessionTerminatedEvent.fire(e),this.lastStartedService=void 0}startedDebugSession(e){this.sessionStartedEvent.fire(e)}changedDebugSession(e){this.sessionChangedEvent.fire(e)}gotCustomEvent(e){this.sessionCustomEvent.fire(e)}};Mb=y([(0,dc.injectable)(),m(0,(0,dc.inject)(O)),m(1,(0,dc.inject)(Li)),m(2,(0,dc.optional)()),m(2,(0,dc.inject)(Ua)),m(2,(0,dc.named)(qe.RUN_BY_LINE_DEBUGSERVICE))],Mb);var Ru=P(M());var T0=require("vscode");var Ob=Symbol("IFileConverter"),Ad=Symbol("IExportBase"),TSt=Symbol("IExport"),Nd=Symbol("IExportUtil");var _0=P(M()),_z=P(require("os"));var Tz=P(To());var Kb=require("vscode");var nw=require("vscode");var obe={PDF:["pdf"]},sbe={HTML:["html","htm"]},abe={Python:["py"]},Va=class{async showDialog(e,t,n){let i={},o;switch(e){case"python":i=abe,o=".py";break;case"pdf":o=".pdf",i=obe;break;case"html":o=".html",i=sbe;break;case"ipynb":o=".ipynb";let l=I.exportDialogFilter;i[l]=["ipynb"];break;default:return}let s=n||!t?n||"":`${Ee(t.path,Gi(t.path))}${o}`,a={defaultUri:await this.getDefaultUri(t,s),saveLabel:I.exportButtonTitle,filters:i};return nw.window.showSaveDialog(a)}async getDefaultUri(e,t){if(e&&e.scheme==="untitled"&&ln())return;if(!e||e.scheme==="file"||e.scheme==="untitled"||e.scheme==="vscode-interactive"){let i=xe.instance.get(oP);return nw.Uri.file(je(await i.computeWorkingDirectory(e),t))}let n=je(lt(e.path),t);return nw.Uri.parse(`${e.scheme}://${n}`).with({authority:e.authority})}};var P0=class{async getContent(e){let t=Kb.extensions.getExtension("vscode.ipynb");if(!t)throw new Error("Unable to export notebook as the built-in vscode.ipynb extension is currently unavailable.");t.isActive||await t.activate();let i=e.getCells().map(s=>{let a=new Kb.NotebookCellData(s.kind,s.document.getText(),s.document.languageId);return a.metadata=s.metadata,a.mime=s.mime,a.outputs=[...s.outputs],a}),o=new Kb.NotebookData(i);return o.metadata=JSON.parse(JSON.stringify(e.metadata)),t.exports.exportNotebook(o)}async getTargetFile(e,t,n){return await new Va().showDialog(e,t,n)}};var D0=require("vscode");var Fb=class extends P0{constructor(t){super();this.fs=t}async getTargetFile(t,n,i){let o;return t!=="python"?o=await new Va().showDialog(t,n,i):o=D0.Uri.file((await this.fs.createTemporaryLocalFile(".py")).filePath),o}};Fb=y([(0,_0.injectable)(),m(0,(0,_0.inject)(mr))],Fb);var iw=class{async generateTempDir(){let e=D0.Uri.file(je(_z.tmpdir(),(0,Tz.default)())),t=xe.instance.get(mr);return await t.createDirectory(e),{path:De(e),dispose:async()=>{let n=0;for(;n<10;)try{await t.delete(e),n=10}catch{await Ei(3e3),n+=1}}}}async makeFileInDirectory(e,t,n){let i=je(n,t);return await xe.instance.get(mr).writeFile(D0.Uri.file(i),e),i}};async function Rz(r){let e=JSON.parse(r);for(let t of e.cells){let n="outputs"in t?t.outputs:void 0;n&&Array.isArray(n)&&lbe(n)}return JSON.stringify(e,void 0,4)}function lbe(r){let e="image/svg+xml",t="image/png";for(let n of r)if("data"in n){let i=n.data;if(!(e in i))continue;t in i&&delete i[e]}}var Lb=P(M());var Tu=class{constructor(e,t,n){this.dependencyManager=e;this.nbConvertDependencyChecker=t;this.jupyterInterpreterService=n}async getExportInterpreter(e){if(e&&await this.checkNotebookInterpreter(e))return e;let t=await this.jupyterInterpreterService.getSelectedInterpreter();if(t||await this.jupyterInterpreterService.selectInterpreter(),t){if(await this.checkNotebookInterpreter(t))return t;if(await this.dependencyManager.installMissingDependencies(),await this.checkNotebookInterpreter(t))return t}throw new Error(I.jupyterNbConvertNotSupported)}async checkNotebookInterpreter(e){return this.nbConvertDependencyChecker.isNbConvertInstalled(e)}};Tu=y([(0,Lb.injectable)(),m(0,(0,Lb.inject)(Sp)),m(1,(0,Lb.inject)(Cg)),m(2,(0,Lb.inject)(fi))],Tu);var Uf=class{constructor(e,t,n,i,o,s){this.pythonExecutionFactory=e;this.jupyterService=t;this.fs=n;this.exportUtil=i;this.importer=o;this.exportInterpreterFinder=s}async export(e,t,n,i){}async executeCommand(e,t,n,i,o){if(o.isCancellationRequested)return;if(i=await this.exportInterpreterFinder.getExportInterpreter(i),n==="python"){let g=await this.importer.importFromFile(e.uri,i);await this.fs.writeFile(t,g);return}let s=await this.exportUtil.getContent(e);n==="pdf"&&(s=await Rz(s));let a=await new iw().generateTempDir(),l=await this.makeSourceFile(t,s,a),c=await this.getExecutionService(l,i);if(!c||o.isCancellationRequested)return;let u=await this.fs.createTemporaryLocalFile(Gi(t.fsPath)),p=[l.fsPath,"--to",n,"--output",Ee(u.filePath),"--output-dir",lt(u.filePath),"--debug"],f=await c.execModule("jupyter",["nbconvert"].concat(p),{throwOnStdErr:!1,encoding:"utf8",token:o});if(o.isCancellationRequested){u.dispose();return}try{if((await this.fs.stat(T0.Uri.file(u.filePath))).size>1)await this.fs.copy(T0.Uri.file(u.filePath),t);else throw new Error("File size is zero during conversion. Outputting error.")}catch{throw new Error(f.stderr)}finally{u.dispose()}}async makeSourceFile(e,t,n){let i=Ee(e.fsPath,Gi(e.fsPath)),o=await new iw().makeFileInDirectory(t,`${i}.ipynb`,n.path);return T0.Uri.file(o)}async getExecutionService(e,t){return this.pythonExecutionFactory.createActivatedEnvironment({resource:e,interpreter:t})}};y([Kv("PerformingExport")],Uf.prototype,"executeCommand",1),Uf=y([(0,Ru.injectable)(),m(0,(0,Ru.inject)(Ur)),m(1,(0,Ru.inject)(td)),m(2,(0,Ru.inject)(mr)),m(3,(0,Ru.inject)(Nd)),m(4,(0,Ru.inject)(Jk)),m(5,(0,Ru.inject)(Tu))],Uf);var jf=P(M());var Au=require("vscode");var Ub=class{constructor(){this.fs=xe.instance.get(st)}async openFile(e,t,n=!1){if(e==="python")await this.openPythonFile(t,n),A("DATASCIENCE.EXPORT_NOTEBOOK_AS",void 0,{format:e,successful:!0,opened:!0});else{let i=await this.askOpenFile(t,n);A("DATASCIENCE.EXPORT_NOTEBOOK_AS",void 0,{format:e,successful:!0,opened:i})}}async openPythonFile(e,t){let n;if(t)n=await Au.window.showTextDocument(e);else{let i=await this.fs.readFile(e);await this.fs.delete(e);let o=await Au.workspace.openTextDocument({language:ye,content:i});n=await Au.window.showTextDocument(o)}await n.edit(i=>{i.insert(new Au.Position(n.document.lineCount,0),`
|
||
`)})}async askOpenFile(e,t){let n=I.openExportFileYes,i=I.openExportFileNo,o=[n,i];return await Au.window.showInformationMessage(I.openExportedFileMessage,...o).then(a=>a)===n?(t?Au.window.showTextDocument(e).then(h,h):Fp(e.toString()),!0):!1}};var O0=P(M()),K0=require("vscode");var R0=class{async export(e,t,n,i){await xe.instance.get(Ad).executeCommand(e,t,"python",n,i)}};var A0=class{async export(e,t,n,i){await xe.instance.get(Ad).executeCommand(e,t,"pdf",n,i)}};var N0=class{async export(e,t,n,i){await xe.instance.get(Ad).executeCommand(e,t,"html",n,i)}};var CL=require("vscode");var M0=class{constructor(){this.fs=xe.instance.get(st),this.configuration=xe.instance.get(le),this.platform=xe.instance.get(wr)}async writeFile(e,t){await this.fs.writeFile(e,t)}getEOL(){return this.platform.isWindows?`\r
|
||
`:`
|
||
`}async export(e,t,n){if(n.isCancellationRequested)return;let i=this.exportDocument(e);await this.writeFile(t,i)}exportDocument(e){return e.getCells().filter(t=>!t.metadata?.isInteractiveWindowMessageCell).reduce((t,n)=>t+this.exportCell(n),"")}exportCell(e){if(e.document.lineCount){let t=this.cellMarker(e),n=this.getEOL();switch(e.kind){case CL.NotebookCellKind.Code:return`${t}${n}${this.exportCodeCell(e)}${n}${n}`;case CL.NotebookCellKind.Markup:return`${t} [markdown]${n}${this.exportMarkdownCell(e)}${n}${n}`}}return""}exportCodeCell(e){let t=Fe(e.document.getText(),{trim:!1,removeEmptyEntries:!1}),n=this.configuration.getSettings(e.notebook.uri).pythonExportMethod==="commentMagics";return ag(t,this.getEOL(),n?cbe:void 0).join("")}exportMarkdownCell(e){let t=Fe(e.document.getText(),{trim:!1,removeEmptyEntries:!1});return ag(t,this.getEOL(),ube).join("")}cellMarker(e){let t=this.configuration.getSettings(e.notebook.uri);return e.metadata.interactiveWindowCellMarker??t.defaultCellMarker}};function cbe(r){return/^\s*!/.test(r)||/^\s*%/.test(r)?`# ${r}`:r}function ube(r){return`# ${r}`}var jb=class{constructor(e,t,n){this.exportUtil=e;this.progressReporter=t;this.configuration=n}async importIpynb(e){let t=this.progressReporter.createProgressIndicator(I.importingIpynb,!0);try{let n=await K0.workspace.openNotebookDocument(e);await this.exportImpl("python",n,void 0,t.token)}finally{t.dispose()}}async export(e,t,n,i){let o=this.progressReporter.createProgressIndicator(I.exportingToFormat(e.toString()),!0);try{await this.exportImpl(e,t,n,o.token,i)}finally{o.dispose()}if(o.token.isCancellationRequested){A("DATASCIENCE.EXPORT_NOTEBOOK_AS",void 0,{format:e,cancelled:!0});return}}async exportImpl(e,t,n,i,o){try{let s=await this.exportUtil.getTargetFile(e,t.uri,n);if(!s)return;await this.performExport(e,t,s,i,o)}catch(s){d.error("Export failed",s),A("DATASCIENCE.EXPORT_NOTEBOOK_AS_FAILED",void 0,{format:e}),e==="pdf"&&d.error(I.exportToPDFDependencyMessage),this.showExportFailed(I.exportFailedGeneralMessage)}}async performExport(e,t,n,i,o){e==="python"&&this.configuration.getSettings(t.uri).pythonExportMethod!=="nbconvert"?await this.performPlainExport(e,t,n,i):await this.performNbConvertExport(t,e,n,o,i),n&&this.openExportedFile(e,n).catch(h)}async openExportedFile(e,t){await new Ub().openFile(e,t,!0).catch(h)}async performPlainExport(e,t,n,i){if(n)switch(e){case"python":await new M0().export(t,n,i);break}return n}async performNbConvertExport(e,t,n,i,o){try{return await this.exportToFormat(e,n,t,i,o)}finally{}}async exportToFormat(e,t,n,i,o){switch(n){case"python":return new R0().export(e,t,i,o);case"pdf":return new A0().export(e,t,i,o);case"html":return new N0().export(e,t,i,o);default:break}}showExportFailed(e){K0.window.showErrorMessage(`${I.failedExportMessage} ${e}`)}};jb=y([m(0,(0,O0.inject)(Nd)),m(1,(0,O0.inject)(ts)),m(2,(0,O0.inject)(le))],jb);var Wb=class extends jb{constructor(t,n,i,o){super(t,i,o);this.exportUtil=t;this.fs=n}async openExportedFile(t,n){await new Ub().openFile(t,n).catch(h)}};Wb=y([(0,jf.injectable)(),m(0,(0,jf.inject)(Nd)),m(1,(0,jf.inject)(mr)),m(2,(0,jf.inject)(ts)),m(3,(0,jf.inject)(le))],Wb);var sw=P(M()),Wf=require("vscode");var ow=require("vscode");var wL=new WeakMap;async function fc(r,e){let t=r;if(r.isClosed)return!0;let n=wL.has(t)?wL.get(t):Promise.resolve(),i=oe(),o=n.finally(async()=>{let s=new ow.WorkspaceEdit,a=e(s);Hu(a)&&await a,await ow.workspace.applyEdit(s).then(l=>i.resolve(l),l=>i.reject(l))}).catch(h);return wL.set(t,o),i.promise}var Vb=class{constructor(e,t){this.disposables=e;this.controllerRegistration=t}activate(){this.controllerRegistration.onControllerSelected(this.onDidChangeNotebookController,this,this.disposables)}async onDidChangeNotebookController(e){let t=e.notebook,n=e.controller.connection;if(!Dt(t))return;let i=Wf.window.visibleNotebookEditors.find(u=>u.notebook===t);if(!i)return;let o=t.getCells().filter(u=>u.kind===Wf.NotebookCellKind.Code&&u.document.getText().trim().length===0),s=t.getCells().filter(u=>u.kind===Wf.NotebookCellKind.Code).length;if(o.length===0||o.length!==s)return;let a,l=n.kind;switch(n.kind){case"connectToLiveRemoteKernel":{a=n.kernelModel.language;break}case"startUsingRemoteKernelSpec":case"startUsingLocalKernelSpec":{a=n.kernelSpec.language;break}case"startUsingPythonInterpreter":{a=ye;break}default:{d.error(`Unsupported kernel kind encountered ${l}`);return}}if(!a)return;let c=Cl(a);fc(i.notebook,async()=>{await o.map(async u=>{if(c.toLowerCase()!==u.document.languageId)return Wf.languages.setTextDocumentLanguage(u.document,c).then(h,h)})}).then(h,h)}};Vb=y([(0,sw.injectable)(),m(0,(0,sw.inject)(O)),m(1,(0,sw.inject)(pt))],Vb);var Ba=P(M()),gr=require("vscode");var Bb=class{constructor(e,t,n,i,o,s,a,l){this.disposableRegistry=e;this.languageService=t;this.configurationService=n;this.kernelProvider=i;this.controllerRegistration=o;this.errorHandler=s;this.notebookEditorProvider=a;this.serviceContainer=l;this.kernelInterruptedDontAskToRestart=!1;this.pendingRestartInterrupt=new WeakMap}register(){this.disposableRegistry.push(gr.commands.registerCommand(q.NotebookEditorRemoveAllCells,()=>this.removeAllCells())),this.disposableRegistry.push(gr.commands.registerCommand(q.NotebookEditorRunAllCells,()=>this.runAllCells())),this.disposableRegistry.push(gr.commands.registerCommand(q.NotebookEditorAddCellBelow,()=>this.addCellBelow())),this.disposableRegistry.push(gr.commands.registerCommand(q.RestartKernelAndRunUpToSelectedCell,()=>this.restartKernelAndRunUpToSelectedCell())),this.disposableRegistry.push(gr.commands.registerCommand(q.RestartKernel,e=>e&&"notebookEditor"in e?this.restartKernel(e?.notebookEditor?.notebookUri).catch(h):this.restartKernel(e).catch(h))),this.disposableRegistry.push(gr.commands.registerCommand(q.InterruptKernel,e=>this.interruptKernel(e?.notebookEditor?.notebookUri))),this.disposableRegistry.push(gr.commands.registerCommand(q.RestartKernelAndRunAllCells,e=>{e&&"notebookEditor"in e?this.restartKernelAndRunAllCells(e?.notebookEditor?.notebookUri).catch(h):this.restartKernelAndRunAllCells(e).catch(h)}))}runAllCells(){gr.window.activeNotebookEditor&&gr.commands.executeCommand("notebook.execute").then(h,h)}addCellBelow(){gr.window.activeNotebookEditor&&gr.commands.executeCommand("notebook.cell.insertCodeCellBelow").then(h,h)}removeAllCells(){let e=gr.window.activeNotebookEditor?.notebook;if(!e)return;let t=this.languageService.getPreferredLanguage(yo(e));fc(e,n=>{let i=gr.NotebookEdit.replaceCells(new gr.NotebookRange(0,e.cellCount),[new gr.NotebookCellData(gr.NotebookCellKind.Code,"",t)]);n.set(e.uri,[i])}).then(h,h)}async interruptKernel(e){let t=e??this.notebookEditorProvider.activeNotebookEditor?.notebook.uri,n=gr.workspace.notebookDocuments.find(o=>o.uri.toString()===t?.toString());if(n===void 0)return;d.debug(`Command interrupted kernel for ${B(n.uri)}`);let i=this.kernelProvider.get(n);if(!i){d.info("Interrupt requested & no kernel.");return}await this.wrapKernelMethod("interrupt",i)}async restartKernelAndRunAllCells(e){await this.restartKernel(e),this.runAllCells()}async restartKernelAndRunUpToSelectedCell(){let e=this.notebookEditorProvider.activeNotebookEditor;e&&(await this.restartKernel(e.notebook.uri),gr.commands.executeCommand("notebook.cell.execute",{ranges:[{start:0,end:e.selection.end}],document:e.notebook.uri}).then(h,h))}async restartKernel(e){let t=e??this.notebookEditorProvider.activeNotebookEditor?.notebook.uri,n=gr.workspace.notebookDocuments.find(o=>o.uri.toString()===t?.toString());if(n===void 0)return;let i=this.kernelProvider.get(n);if(i)if(d.debug(`Restart kernel command handler for ${B(n.uri)}`),await this.shouldAskForRestart(n.uri)){let o=I.restartKernelMessage,s=I.restartKernelMessageYes,a=I.restartKernelMessageDontAskAgain,l=await gr.window.showInformationMessage(o,{modal:!0},s,a);l===a?(await this.disableAskForRestart(n.uri),this.wrapKernelMethod("restart",i).catch(h)):l===s&&this.wrapKernelMethod("restart",i).catch(h)}else this.wrapKernelMethod("restart",i).catch(h)}async wrapKernelMethod(e,t){let n=t.notebook,i=this.pendingRestartInterrupt.get(t);if(i)return i;let o=(async()=>{let s=this.kernelProvider.getKernelExecution(t).pendingCells[0],a=this.controllerRegistration.getSelected(n);try{if(!a)throw new Error("No kernel associated with the notebook");await ta.wrapKernelMethod(a.connection,e,t.creator,this.serviceContainer,{resource:t.resourceUri,notebook:n,controller:a.controller},new Ht(!1),this.disposableRegistry)}catch(l){s?await vp(s,t.controller,await this.errorHandler.getErrorMessageForDisplayInCell(l,e,t.resourceUri),!1):gr.window.showErrorMessage(l.toString()).then(h,h)}})();return o.finally(()=>{this.pendingRestartInterrupt.get(t)===o&&this.pendingRestartInterrupt.delete(t)}).catch(h),this.pendingRestartInterrupt.set(t,o),o}async shouldAskForRestart(e){if(this.kernelInterruptedDontAskToRestart)return!1;let t=this.configurationService.getSettings(e);return t&&t.askForKernelRestart===!0}async disableAskForRestart(e){this.configurationService.getSettings(e)&&this.configurationService.updateSetting("askForKernelRestart",!1,void 0,gr.ConfigurationTarget.Global).catch(h)}};Bb=y([(0,Ba.injectable)(),m(0,(0,Ba.inject)(O)),m(1,(0,Ba.inject)(us)),m(2,(0,Ba.inject)(le)),m(3,(0,Ba.inject)(Te)),m(4,(0,Ba.inject)(pt)),m(5,(0,Ba.inject)(Zr)),m(6,(0,Ba.inject)(bi)),m(7,(0,Ba.inject)(at))],Bb);var Az=P(M()),Md=require("vscode");var qb=class{constructor(){this.providers=new Set}registerEmbedNotebookProvider(e){this.providers.add(e)}findNotebookEditor(e){let t=e?gn(e,!0):"false",n=Zi(e)==="notebook"?Md.workspace.notebookDocuments.find(o=>gn(o.uri,!0)===t):void 0,i=n&&Md.window.activeNotebookEditor?.notebook===n?Md.window.activeNotebookEditor:void 0;if(i)return i;for(let o of this.providers){let s=o.findNotebookEditor(e);if(s)return s}}get activeNotebookEditor(){return this.findNotebookEditor(Md.window.activeNotebookEditor?.notebook.uri)||this.findNotebookEditor(Md.window.activeTextEditor?.document.uri)}findAssociatedNotebookDocument(e){let t=Fr()==="Windows",n=Md.workspace.notebookDocuments.find(i=>t?i.uri.path.toLowerCase()===e.path.toLowerCase():i.uri.path===e.path);if(n)return n;for(let i of this.providers){let o=i.findAssociatedNotebookDocument(e);if(o)return o}}};qb=y([(0,Az.injectable)()],qb);var F0=P(M()),$b=require("vscode");var Jb=class{constructor(e){this.sentMimeTypes=new Set;this.disposables=[];e.push(this)}activate(){this.isTelemetryDisabled=rk(),$b.workspace.onDidOpenNotebookDocument(this.onDidOpenCloseDocument,this,this.disposables),$b.workspace.onDidCloseNotebookDocument(this.onDidOpenCloseDocument,this,this.disposables),$b.workspace.onDidSaveNotebookDocument(this.onDidOpenCloseDocument,this,this.disposables),or.onDidChangeNotebookCellExecutionState(this.onDidChangeNotebookCellExecutionState,this,this.disposables),this.disposables.push(nk(e=>this.isTelemetryDisabled=e))}dispose(){z(this.disposables)}async onDidChangeNotebookCellExecutionState(e){!Dt(e.cell.notebook)||this.isTelemetryDisabled||e.state!==1||this.checkCell(e.cell,"onExecution")}onDidOpenCloseDocument(e){!Dt(e)||this.isTelemetryDisabled||e.getCells().forEach(t=>this.checkCell(t,"onOpenCloseOrSave"))}checkCell(e,t){if(e.kind===$b.NotebookCellKind.Markup||e.document.languageId==="raw")return;let n=e.notebook.notebookType===Et?"notebook":"interactive";e.outputs.map(i=>i.items.map(o=>o.mime)).flat().map(i=>this.sendTelemetry(i,t,n))}sendTelemetry(e,t,n){let i=`${e}-${t}`;this.sentMimeTypes.has(i)||(this.sentMimeTypes.add(i),e=e.replace(/\//g,"_").replace(/\\/g,"_"),A("DS_INTERNAL.CELL_OUTPUT_MIME_TYPE",void 0,{mimeType:e,when:t,resourceType:n}))}};Jb=y([(0,F0.injectable)(),m(0,(0,F0.inject)(O))],Jb);var L0=P(M());var pbe=/(;32m[ ->]*?)(\d+)(.*)/g,Hb=class{constructor(e){this.configurationService=e}format(e,t){return e.notebook.notebookType!==Et?t:t.map(n=>this.modifyTracebackFrameIPython(e,n))}modifyTracebackFrameIPython(e,t){return(this.configurationService.getSettings(e.document.uri)?.formatStackTraces??!1)&&/^[Cell|Input|File].*?\n.*/.test(t)?this.modifyTracebackFrameIPython8(e,t):t}modifyTracebackFrameIPython8(e,t){t=t.replace(/\u001b\[4\dm/g,""),t=t.replace(/\u001b\[38;.*?\d+m/g,"\x1B[39m"),t=t.replace(/(;32m[ ->]*?)(\d+)(.*)\n/g,(s,a,l,c)=>(c=c.replace(/\u001b\[3\d+m/g,"\x1B[39m"),`${a}${l}${c}
|
||
`)),d.ci(`Trace frame to match: ${t}`);let n=(s,a)=>{let l=s.replace(pbe,(u,p,f,g)=>{let v=parseInt(f,10);return`${p}<a href='${e.document.uri.toString()}?line=${v-1}'>${v}</a>${g}`}),c=I.cellAtFormat(De(e.document.uri),e.index+1);return l.replace(/.*?\n/,`\x1B[1;32m${c}\x1B[0m line \x1B[0;36m${a}
|
||
`)},i=/^Input.*?\[.*32mIn\s+\[(\d+).*?0;36m(.*?)\n.*/.exec(t);if(i&&i.length>1)return n(t,i[2]);let o=/Cell.*?\[.*32mIn\s*\[(\d+)\]\,\s+line\s+([(\d+)])(.*?)\n.*/gm.exec(t);return o&&o.length>1?n(t,o[2]):t}};Hb=y([(0,L0.injectable)(),m(0,(0,L0.inject)(le))],Hb);var qa=P(M());var Gb=class{constructor(e,t,n,i,o,s){this.packages=e;this.installer=t;this.pythonExtensionChecker=n;this.disposables=i;this.interpreterService=o;this.notebookControllerManager=s}activate(){this.notebookControllerManager.onControllerSelected(this.onNotebookControllerSelected,this,this.disposables),this.installer?.onInstalled(this.onDidInstallPackage,this,this.disposables)}async onNotebookControllerSelected(e){e.controller.connection.interpreter&&(await io(e.notebook.uri,{kernelConnection:e.controller.connection}),await this.packages.trackPackages(e.controller.connection.interpreter))}async onDidInstallPackage(e){if(this.pythonExtensionChecker.isPythonExtensionActive)if(Gu(e.resource)){let t=await this.interpreterService.getActiveInterpreter(e.resource);await this.packages.trackPackages(t,!0)}else await this.packages.trackPackages(e.resource,!0)}};Gb=y([(0,qa.injectable)(),m(0,(0,qa.inject)(Gp)),m(1,(0,qa.inject)(Vi)),m(1,(0,qa.optional)()),m(2,(0,qa.inject)($e)),m(3,(0,qa.inject)(O)),m(4,(0,qa.inject)(rt)),m(5,(0,qa.inject)(pt))],Gb);function Nz(r,e){gz(r,e),r.addSingleton(ge,wf),r.addSingleton(qh,Bb),r.addSingleton(bi,qb),r.addSingleton(ge,Pf),r.addSingleton(mg,Hb),r.addSingleton(Ua,Nb,qe.RUN_BY_LINE_DEBUGSERVICE),r.addSingleton(Sd,Sd),r.addBinding(Sd,ge),r.addSingleton(ge,pb),r.addSingleton(ge,Gb),r.addSingleton(ge,ab),r.addSingleton(us,us),r.addBinding(us,ge),r.addSingleton(ge,Vb),r.addSingleton(Td,Rb,void 0,[ge]),r.addSingleton(ge,Eb),r.addSingleton(kn,Pb,qe.DEBUGGER_VARIABLES),r.addSingleton(Ua,Mb,qe.MULTIPLEXING_DEBUGSERVICE),r.addSingleton(h0,Ab,void 0,[f0]),r.addSingleton(ge,wb),r.addSingleton(ge,Jb),r.addSingleton(Ob,Wb),r.addSingleton(Tu,Tu),r.addSingleton(Ad,Uf),r.addSingleton(Nd,Fb)}var Pn=P(M()),Qe=require("vscode");var Od=Symbol("IDataScienceCodeLensProvider"),U0=Symbol("ICodeWatcher"),j0=Symbol("ICodeLensFactory"),wEt=Symbol("IGeneratedCodeStore"),na=Symbol("IGeneratedCodeStorageFactory"),zb=Symbol("ICodeGeneratorFactory");var W0=Symbol("IInteractiveWindowDebugger"),qi=Symbol("IInteractiveWindowProvider"),V0=Symbol("IInteractiveControllerHelper"),B0=Symbol("IInteractiveWindowDebuggingManager");var q0=require("vscode");async function J0(r){let e=await q0.workspace.openNotebookDocument(r);await q0.window.showNotebookDocument(e)}var ia=require("vscode");var so=class{constructor(e){this.codeMatchRegEx=this.createRegExp(e?e.codeRegularExpression:void 0,am.PythonCellMarker),this.markdownMatchRegEx=this.createRegExp(e?e.markdownRegularExpression:void 0,am.PythonMarkdownCellMarker),this.codeExecRegEx=new RegExp(`${this.codeMatchRegEx.source}(.*)`),this.markdownExecRegEx=new RegExp(`${this.markdownMatchRegEx.source}(.*)`),this.defaultCellMarker=e?.defaultCellMarker?e.defaultCellMarker:"# %%"}isCell(e){return this.isCode(e)||this.isMarkdown(e)}isMarkdown(e){return this.markdownMatchRegEx.test(e.trim())}isCode(e){return this.codeMatchRegEx.test(e.trim())||e.trim()===this.defaultCellMarker}getCellType(e){return this.isMarkdown(e)?"markdown":"code"}isEmptyCell(e){return this.stripFirstMarker(e).trim().length===0}stripFirstMarker(e){let t=Fe(e,{trim:!1,removeEmptyEntries:!1});return t.length>0&&(this.isCode(t[0])||this.isMarkdown(t[0]))?t.slice(1).join(`
|
||
`):e}stripFirstMarkerNoConcat(e){return e.length>0&&(this.isCode(e[0])||this.isMarkdown(e[0]))?e.slice(1):e}getFirstMarker(e){let t=Fe(e,{trim:!1,removeEmptyEntries:!1});if(t.length>0&&(this.isCode(t[0])||this.isMarkdown(t[0])))return t[0]}createRegExp(e,t){try{if(e)return new RegExp(e)}catch{}return t}};var ps=require("vscode");function Mz(r,e){let t=ct(r);return t?e==1?I.restartingKernelCustomHeader(t):I.startingNewKernelCustomHeader(t):e==1?I.restartingKernelHeader:I.startingNewKernelHeader}function Oz(r,e){let t=ct(r);return e==1?I.restartedKernelHeader(t||""):I.connectedKernelHeader(t||"")}function aw(r){return r.kind===ps.NotebookCellKind.Markup&&r.metadata?.isInteractiveWindowMessageCell===!0}var $0=class{constructor(e,t){this.notebookDocument=e;this.isDeleted=!1;if(e.cellCount){let n=e.cellAt(e.cellCount);aw(n)&&(this.sysInfoCellPromise=Promise.resolve(n),this.sysInfoCellPromise=this.updateMessage(t))}this.sysInfoCellPromise===void 0&&(this.sysInfoCellPromise=this.createCell(t))}async createCell(e){let t;return await fc(this.notebookDocument,n=>{let i=new ps.NotebookCellData(ps.NotebookCellKind.Markup,e,RS);i.metadata={isInteractiveWindowMessageCell:!0},t=this.notebookDocument.cellCount;let o=ps.NotebookEdit.insertCells(t,[i]);n.set(this.notebookDocument.uri,[o])}),t=t??this.notebookDocument.cellCount-1,this.notebookDocument.cellAt(t)}async updateMessage(e){let t=await this.sysInfoCellPromise;return await fc(this.notebookDocument,n=>{if(t.index>=0&&!this.isDeleted&&aw(t)){n.replace(t.document.uri,new ps.Range(0,0,t.document.lineCount,0),e),n.set(this.notebookDocument.uri,[ps.NotebookEdit.updateCellMetadata(t.index,{isInteractiveWindowMessageCell:!0})]);return}}),t}async deleteCell(){this.isDeleted=!0;let e=await this.sysInfoCellPromise;await fc(this.notebookDocument,t=>{if(e.index>=0&&aw(e)){let n=ps.NotebookEdit.deleteCells(new ps.NotebookRange(e.index,e.index+1));t.set(this.notebookDocument.uri,[n]);return}})}};function H0(r){return/^#\s*!/.test(r)?/^#\s*!\s*%%?/.test(r)?r.replace(/^#\s*!\s*/,""):r.replace(/^#\s*/,""):r}function Kz(r){return new ia.NotebookCellData(ia.NotebookCellKind.Code,r.join(`
|
||
`),"python")}function Fz(r){return new ia.NotebookCellData(ia.NotebookCellKind.Markup,yk(r).join(`
|
||
`),"markdown")}function mbe(r,e,t){let n=Fe(e,{trim:!1}),i=n[0];if(new so(r).isMarkdown(i)){let s=-1;return xm(n,(a,l)=>void 0,(a,l)=>{a&&a.length>0&&s===-1&&(s=t?l:-1)}),s>=0?[Fz(n.slice(0,s)),Kz(n.slice(s))]:[Fz(n)]}else return[Kz(n)]}function Lz(r,e){let t=new so(e);for(let n=0;n<r.lineCount;n+=1){let i=r.lineAt(n);if(t.isCell(i.text))return!0}return!1}function lw(r,e){let t=new so(e),n=[];for(let i=0;i<r.lineCount;i+=1){let o=r.lineAt(i);if(t.isCell(o.text)){if(n.length>0){let s=n[n.length-1];s.range=new ia.Range(s.range.start,r.lineAt(i-1).range.end)}n.push({range:o.range,cell_type:t.getCellType(o.text)})}}if(n.length>=1){let i=r.lineAt(r.lineCount-1),o=n[n.length-1];o.range=new ia.Range(o.range.start,i.range.end)}return n}function EL(r,e){let t=lw(r,e);return Array.prototype.concat(...t.map(n=>{let i=r.getText(n.range);return mbe(e,i,!1)}))}function Uz(r){return r.getCells().filter(e=>!aw(e)).map(e=>{let t=Fe(e.document.getText(),{trim:!1,removeEmptyEntries:!1});e.metadata.interactiveWindowCellMarker!==void 0&&t.unshift(e.metadata.interactiveWindowCellMarker+`
|
||
`);let n=new ia.NotebookCellData(e.kind,t.join(`
|
||
`),e.kind===ia.NotebookCellKind.Code?e.document.languageId:"markdown");return e.kind===ia.NotebookCellKind.Code&&(n.outputs=[...e.outputs]),n.metadata=dp(e),n})}var cw=require("vscode");var kL=class{constructor(e,t,n){this.disposed=!1;this.dispose=()=>{this.disposed||(this.disposed=!0,this.timeout&&(clearTimeout(this.timeout),this.timeout=void 0),this.disposeCallback(),this.deferred.completed||this.deferred.resolve())};this.promise=()=>this.deferred.promise;this.reject=()=>{this.deferred.reject(),this.dispose()};this.deferred=oe(),this.disposeCallback=t,n&&(this.timeout=setTimeout(this.dispose,n))}},G0=class{constructor(){this.statusCount=0;this.incrementCount=()=>{this.statusCount+=1};this.decrementCount=()=>{let e=this.statusCount-1;this.statusCount=Math.max(e,0)}}set(e,t,n){this.incrementCount();let i=new kL(e,()=>this.decrementCount(),t),o={location:n?cw.ProgressLocation.Notification:cw.ProgressLocation.Window,title:e,cancellable:n!==void 0};return cw.window.withProgress(o,(s,a)=>(a&&n&&a.onCancellationRequested(()=>{n(),i.reject()}),i.promise())).then(h,h),i}async waitWithStatus(e,t,n,i){let o=this.set(t,n,i),s;try{s=await e()}finally{o.dispose()}return s}};var Ko=class{constructor(e,t,n,i,o,s,a,l,c,u,p,f,g){this.disposables=e;this.jupyterExporter=t;this.jupyterServerHelper=n;this.fileSystem=i;this.configuration=o;this.dataScienceCodeLensProvider=s;this.debugService=a;this.configService=l;this.interactiveWindowProvider=c;this.kernelProvider=u;this.dataScienceErrorHandler=p;this.ipynbProvider=f;this.fileConverter=g;this.statusProvider=new G0,Qe.workspace.isTrusted||Qe.workspace.onDidGrantWorkspaceTrust(this.registerCommandsIfTrusted,this,this.disposables)}activate(){this.registerCommandsIfTrusted(),this.registerCommand(q.InsertCellBelowPosition,this.insertCellBelowPosition),this.registerCommand(q.InsertCellBelow,this.insertCellBelow),this.registerCommand(q.InsertCellAbove,this.insertCellAbove),this.registerCommand(q.DeleteCells,this.deleteCells),this.registerCommand(q.SelectCell,this.selectCell),this.registerCommand(q.SelectCellContents,this.selectCellContents),this.registerCommand(q.ExtendSelectionByCellAbove,this.extendSelectionByCellAbove),this.registerCommand(q.ExtendSelectionByCellBelow,this.extendSelectionByCellBelow),this.registerCommand(q.MoveCellsUp,this.moveCellsUp),this.registerCommand(q.MoveCellsDown,this.moveCellsDown),this.registerCommand(q.ChangeCellToMarkdown,this.changeCellToMarkdown),this.registerCommand(q.ChangeCellToCode,this.changeCellToCode),this.registerCommand(q.GotoNextCellInFile,this.gotoNextCellInFile),this.registerCommand(q.GotoPrevCellInFile,this.gotoPrevCellInFile),this.registerCommand(q.AddCellBelow,this.addCellBelow),this.registerCommand(q.CreateNewNotebook,this.createNewNotebook),this.registerCommand(q.LatestExtension,this.openPythonExtensionPage),this.registerCommand(q.EnableLoadingWidgetsFrom3rdPartySource,this.enableLoadingWidgetScriptsFromThirdParty),this.registerCommand(q.CreateNewInteractive,e=>this.createNewInteractiveWindow(e)),this.registerCommand(q.ImportNotebook,(e,t="commandpalette")=>this.listenForErrors(()=>e?this.importNotebookOnFile(e):this.importNotebook())),this.registerCommand(q.ImportNotebookFile,(e,t="commandpalette")=>this.listenForErrors(()=>e?this.importNotebookOnFile(e):this.importNotebook())),Qe.commands.registerCommand(q.ExportFileAsNotebook,(e,t="commandpalette")=>this.listenForErrors(()=>{if(e)return this.exportFile(e);{let n=Qe.window.activeTextEditor;if(n&&n.document.languageId===ye)return this.exportFile(n.document.uri)}return Promise.resolve()})),this.registerCommand(q.ExportFileAndOutputAsNotebook,(e,t="commandpalette")=>this.listenForErrors(()=>{if(e)return this.exportFileAndOutput(e);{let n=Qe.window.activeTextEditor;if(n&&n.document.languageId===ye)return this.exportFileAndOutput(n.document.uri)}return Promise.resolve()})),this.registerCommand(q.ExpandAllCells,async e=>this.expandAllCells(e?.notebookEditor?.notebookUri)),this.registerCommand(q.CollapseAllCells,async e=>this.collapseAllCells(e?.notebookEditor?.notebookUri)),this.registerCommand(q.ExportOutputAsNotebook,()=>this.exportCells()),this.registerCommand(q.InteractiveExportAsNotebook,e=>this.export(e?.notebookEditor?.notebookUri)),this.registerCommand(q.InteractiveExportAs,e=>this.exportAs(e?.notebookEditor?.notebookUri)),this.registerCommand(q.ScrollToCell,(e,t)=>this.scrollToCell(e,t)),this.registerCommand(q.InteractiveClearAll,this.clearAllCellsInInteractiveWindow),this.registerCommand(q.InteractiveGoToCode,this.goToCodeInInteractiveWindow),Qe.commands.registerCommand(q.InteractiveCopyCell,this.copyCellInInteractiveWindow)}dispose(){this.disposables.forEach(e=>e.dispose())}registerCommandsIfTrusted(){Qe.workspace.isTrusted&&(this.registerCommand(q.RunAllCells,this.runAllCells),this.registerCommand(q.RunCell,this.runCell),this.registerCommand(q.RunCurrentCell,this.runCurrentCell),this.registerCommand(q.RunCurrentCellAdvance,this.runCurrentCellAndAdvance),this.registerCommand(q.ExecSelectionInInteractiveWindow,e=>{this.runSelectionOrLine(e).catch(h)}),this.registerCommand(q.RunAllCellsAbove,this.runAllCellsAbove),this.registerCommand(q.RunCellAndAllBelow,this.runCellAndAllBelow),this.registerCommand(q.RunAllCellsAbovePalette,this.runAllCellsAboveFromCursor),this.registerCommand(q.RunCellAndAllBelowPalette,this.runCellAndAllBelowFromCursor),this.registerCommand(q.RunCurrentCellAndAddBelow,this.runCurrentCellAndAddBelow),this.registerCommand(q.DebugCell,this.debugCell),this.registerCommand(q.DebugStepOver,this.debugStepOver),this.registerCommand(q.DebugContinue,this.debugContinue),this.registerCommand(q.DebugStop,this.debugStop),this.registerCommand(q.DebugCurrentCellPalette,this.debugCurrentCellFromCursor),this.registerCommand(q.OpenVariableView,this.openVariableView),this.registerCommand(q.OpenOutlineView,this.openOutlineView),this.registerCommand(q.RunToLine,this.runToLine),this.registerCommand(q.RunFromLine,this.runFromLine),this.registerCommand(q.RunFileInInteractiveWindows,this.runFileInteractive),this.registerCommand(q.DebugFileInInteractiveWindows,this.debugFileInteractive))}registerCommand(e,t){let n=Qe.commands.registerCommand(e,t,this);this.disposables.push(n)}getCodeWatcher(e){if(e&&this.dataScienceCodeLensProvider){let t=Qe.workspace.textDocuments.filter(n=>ki(n.uri,e));if(t&&t.length===1)return this.dataScienceCodeLensProvider.getCodeWatcher(t[0]);if(t&&t.length>1)throw new Error(I.documentMismatch(De(e)))}}async enableLoadingWidgetScriptsFromThirdParty(){this.configService.getSettings(void 0).widgetScriptSources.length>0||await this.configService.updateSetting("widgetScriptSources",["jsdelivr.com","unpkg.com"],void 0,Qe.ConfigurationTarget.Global).catch(h)}async runAllCells(e){let t=this.getCodeWatcher(e);if(t||(t=this.getCurrentCodeWatcher()),t)return t.runAllCells()}async runFileInteractive(e){let t=this.getCodeWatcher(e);if(t||(t=this.getCurrentCodeWatcher()),t)return t.runFileInteractive()}async debugFileInteractive(e){let t=this.getCodeWatcher(e);if(t||(t=this.getCurrentCodeWatcher()),t)return t.debugFileInteractive()}async runCell(e,t,n,i,o){let s=this.getCodeWatcher(e);if(s)return s.runCell(new Qe.Range(t,n,i,o))}async runAllCellsAbove(e,t,n){if(e){let i=this.getCodeWatcher(e);if(i)return i.runAllCellsAbove(t,n)}}async runCellAndAllBelow(e,t,n){if(e){let i=this.getCodeWatcher(e);if(i)return i.runCellAndAllBelow(t,n)}}async runToLine(){let e=this.getCurrentCodeWatcher(),t=Qe.window.activeTextEditor;if(e&&t&&t.selection)return e.runToLine(t.selection.start.line)}async runFromLine(){let e=this.getCurrentCodeWatcher(),t=Qe.window.activeTextEditor;if(e&&t&&t.selection)return e.runFromLine(t.selection.start.line)}async runCurrentCell(){let e=this.getCurrentCodeWatcher();if(e)return e.runCurrentCell()}async runCurrentCellAndAdvance(){let e=this.getCurrentCodeWatcher();if(e)return e.runCurrentCellAndAdvance()}async runSelectionOrLine(e){let t=this.getCurrentCodeWatcher();if(t)return t.runSelectionOrLine(Qe.window.activeTextEditor,xn(e)?void 0:e)}async debugCell(e,t,n,i,o){if(e){let s=this.getCodeWatcher(e);if(s)return s.debugCell(new Qe.Range(t,n,i,o))}}async debugStepOver(){this.debugService?.activeDebugSession&&Qe.commands.executeCommand("workbench.action.debug.stepOver").then(h,h)}async debugStop(e){if(this.debugService?.activeDebugSession&&this.interactiveWindowProvider){let t=this.interactiveWindowProvider.get(e);if(t&&t.notebookDocument){let n=this.kernelProvider.get(t.notebookDocument);n&&(d.debug(`Interrupt kernel due to debug stop of IW ${e.toString()}`),await n.interrupt())}Qe.commands.executeCommand("workbench.action.debug.stop").then(h,h)}}async debugContinue(){this.debugService?.activeDebugSession&&Qe.commands.executeCommand("workbench.action.debug.continue").then(h,h)}async addCellBelow(){await this.getCurrentCodeWatcher()?.addEmptyCellToBottom()}async runCurrentCellAndAddBelow(){this.getCurrentCodeWatcher()?.runCurrentCellAndAddBelow()}async insertCellBelowPosition(){this.getCurrentCodeWatcher()?.insertCellBelowPosition()}async insertCellBelow(){this.getCurrentCodeWatcher()?.insertCellBelow()}async insertCellAbove(){this.getCurrentCodeWatcher()?.insertCellAbove()}async deleteCells(){this.getCurrentCodeWatcher()?.deleteCells()}async selectCell(){this.getCurrentCodeWatcher()?.selectCell()}async selectCellContents(){this.getCurrentCodeWatcher()?.selectCellContents()}async extendSelectionByCellAbove(){this.getCurrentCodeWatcher()?.extendSelectionByCellAbove()}async extendSelectionByCellBelow(){this.getCurrentCodeWatcher()?.extendSelectionByCellBelow()}async moveCellsUp(){this.getCurrentCodeWatcher()?.moveCellsUp()}async moveCellsDown(){this.getCurrentCodeWatcher()?.moveCellsDown()}async changeCellToMarkdown(){this.getCurrentCodeWatcher()?.changeCellToMarkdown()}async changeCellToCode(){this.getCurrentCodeWatcher()?.changeCellToCode()}async gotoNextCellInFile(){this.getCurrentCodeWatcher()?.gotoNextCell()}async gotoPrevCellInFile(){this.getCurrentCodeWatcher()?.gotoPreviousCell()}async runAllCellsAboveFromCursor(){let e=this.getCurrentCodeLens();if(e){let t=this.getCurrentCodeWatcher();if(t)return t.runAllCellsAbove(e.range.start.line,e.range.start.character)}else return}async runCellAndAllBelowFromCursor(){let e=this.getCurrentCodeLens();if(e){let t=this.getCurrentCodeWatcher();if(t)return t.runCellAndAllBelow(e.range.start.line,e.range.start.character)}else return}async debugCurrentCellFromCursor(){if(this.getCurrentCodeLens()){let t=this.getCurrentCodeWatcher();if(t)return t.debugCurrentCell()}else return}async createNewNotebook(){Qe.window.showInformationMessage('This command has been deprecated and will eventually be removed, please use ["Create: New Jupyter Notebook"](command:workbench.action.openGlobalKeybindings?%5B%22@command:ipynb.newUntitledIpynb%22%5D) instead.').then(h,h),await Qe.commands.executeCommand("ipynb.newUntitledIpynb")}getCurrentCodeLens(){let e=Qe.window.activeTextEditor,t=this.getCurrentCodeWatcher();if(e&&t)return t.getCodeLenses().find(n=>n.range.end.line>=e.selection.anchor.line&&n.range.start.line<=e.selection.anchor.line)}getCurrentCodeWatcher(){let e=Qe.window.activeTextEditor;if(!(!e||!e.document||!this.dataScienceCodeLensProvider))return this.dataScienceCodeLensProvider.getCodeWatcher(e.document)}openPythonExtensionPage(){Qe.env.openExternal(Qe.Uri.parse("https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter")).then(h,h)}async openVariableView(){return Qe.commands.executeCommand("jupyterViewVariables.focus")}async openOutlineView(){return Qe.commands.executeCommand("outline.focus")}async listenForErrors(e){let t;try{return t=await e(),t}catch(n){d.error("listenForErrors",n),this.dataScienceErrorHandler.handleError(n).then(h,h)}return t}async exportFile(e){let t=De(e);if(t&&t.length>0&&this.jupyterExporter){let n=Qe.window.activeTextEditor;if(n&&this.fileSystem.arePathsSame(n.document.uri,e)){let i=EL(n.document,this.configuration.getSettings(n.document.uri));if(i){let o=await new Va().showDialog("ipynb",e);if(await this.waitForStatus(async()=>{if(o){let s=await this.jupyterExporter?.serialize(i);await this.fileSystem.writeFile(o,s||"")}},I.exportingFormat,B(e)),o&&t){let s=I.exportOpenQuestion1;await Qe.window.showInformationMessage(I.exportDialogComplete(B(e)),s)===s&&await J0(o)}}}}}async exportFileAndOutput(e){let t=De(e);if(t&&t.length>0&&this.jupyterExporter&&this.jupyterServerHelper&&await this.jupyterServerHelper.isJupyterServerSupported()){let n=Qe.window.activeTextEditor;if(n&&n.document&&this.fileSystem.arePathsSame(n.document.uri,e)){let i=EL(n.document,this.configuration.getSettings(n.document.uri));if(i){let o=await new Va().showDialog("ipynb",e);return o?(await this.waitForStatus(async()=>{if(o){let s=await this.jupyterExporter?.serialize(i);await this.fileSystem.writeFile(o,s||"")}},I.exportingFormat,B(e)),await Qe.workspace.openNotebookDocument(o).then(s=>Qe.window.showNotebookDocument(s)),await Qe.commands.executeCommand("notebook.execute"),o):void 0}}}else this.jupyterServerHelper&&await this.dataScienceErrorHandler.handleError(new no(I.jupyterNotSupported(await this.jupyterServerHelper.getJupyterServerError())))}async expandAllCells(e){let t=this.interactiveWindowProvider.getInteractiveWindowWithNotebook(e);d.info(`Expanding all cells in interactive window with uri ${t?.notebookUri}`),t&&await t.expandAllCells()}async collapseAllCells(e){let t=this.interactiveWindowProvider.getInteractiveWindowWithNotebook(e);d.info(`Collapsing all cells in interactive window with uri ${t?.notebookUri}`),t&&await t.collapseAllCells()}exportCells(){let e=this.interactiveWindowProvider?.activeWindow;e&&e.export()}exportAs(e){let t=this.interactiveWindowProvider.getInteractiveWindowWithNotebook(e);t&&t.exportAs()}export(e){let t=this.interactiveWindowProvider.getInteractiveWindowWithNotebook(e);t&&t.export()}async createNewInteractiveWindow(e){await this.interactiveWindowProvider?.getOrCreate(void 0,e)}waitForStatus(e,t,n,i){let o=t(n||"");return this.statusProvider.waitWithStatus(e,o,void 0,i)}async importNotebook(){let e=I.importDialogFilter,t={};t[e]=["ipynb"];let n=await Qe.window.showOpenDialog({openLabel:I.importDialogTitle,filters:t});n&&n.length>0&&await this.waitForStatus(async()=>{await this.fileConverter.importIpynb(n[0])},I.importingFormat,B(n[0]))}async importNotebookOnFile(e){let t=De(e);t&&t.length>0&&await this.waitForStatus(async()=>{await this.fileConverter.importIpynb(e)},I.importingFormat,B(e))}async scrollToCell(e,t){if(t&&e){let n=this.interactiveWindowProvider.getInteractiveWindowsWithSubmitter(e);for(let i=0;i<n.length;i+=1)if(await n[i].hasCell(t)){n[i].scrollToCell(t);break}}}async clearAllCellsInInteractiveWindow(e){let t=this.interactiveWindowProvider.getInteractiveWindowWithNotebook(e?.notebookEditor?.notebookUri)?.notebookUri;if(!t)return;let n=Qe.workspace.notebookDocuments.find(s=>s.uri.toString()===t.toString());if(!n)return;let i=new Qe.WorkspaceEdit,o=Qe.NotebookEdit.deleteCells(new Qe.NotebookRange(0,n.cellCount));i.set(n.uri,[o]),await Qe.workspace.applyEdit(i)}async goToCodeInInteractiveWindow(e){if(e&&e.metadata?.interactive){let t=Qe.Uri.parse(e.metadata.interactive.uristring),n=e.metadata.interactive.lineIndex,i=await Qe.window.showTextDocument(t,{viewColumn:Qe.ViewColumn.One});i&&(i.revealRange(new Qe.Range(n,0,n,0)),i.selection=new Qe.Selection(new Qe.Position(n,0),new Qe.Position(n,0)))}}async copyCellInInteractiveWindow(e){if(e){let t=this.configuration.getSettings(e.notebook.uri),n=[e.metadata.interactiveWindowCellMarker??t.defaultCellMarker,e.document.getText()].join(`
|
||
`);await Qe.env.clipboard.writeText(n)}}};y([Xr("DATASCIENCE.DEBUG_STEP_OVER")],Ko.prototype,"debugStepOver",1),y([Xr("DATASCIENCE.DEBUG_STOP")],Ko.prototype,"debugStop",1),y([Xr("DATASCIENCE.DEBUG_CONTINUE")],Ko.prototype,"debugContinue",1),y([ur("DATASCIENCE.ADD_CELL_BELOW")],Ko.prototype,"addCellBelow",1),y([Xr("DATASCIENCE.EXPORT_PYTHON_FILE")],Ko.prototype,"exportFile",1),y([Xr("DATASCIENCE.EXPORT_PYTHON_FILE_AND_OUTPUT")],Ko.prototype,"exportFileAndOutput",1),y([Xr("DATASCIENCE.IMPORT_NOTEBOOK",{scope:"command"})],Ko.prototype,"importNotebook",1),y([Xr("DATASCIENCE.IMPORT_NOTEBOOK",{scope:"file"})],Ko.prototype,"importNotebookOnFile",1),Ko=y([(0,Pn.injectable)(),m(0,(0,Pn.inject)(O)),m(1,(0,Pn.inject)(xg)),m(1,(0,Pn.optional)()),m(2,(0,Pn.inject)(Ip)),m(2,(0,Pn.optional)()),m(3,(0,Pn.inject)(st)),m(4,(0,Pn.inject)(le)),m(5,(0,Pn.inject)(Od)),m(5,(0,Pn.optional)()),m(6,(0,Pn.inject)(Li)),m(6,(0,Pn.optional)()),m(7,(0,Pn.inject)(le)),m(8,(0,Pn.inject)(qi)),m(9,(0,Pn.inject)(Te)),m(10,(0,Pn.inject)(Zr)),m(11,(0,Pn.inject)(bi)),m(12,(0,Pn.inject)(Ob))],Ko);var Yb=P(M());var hc=require("vscode");var z0=class{constructor(e,t,n,i){this.configService=e;this.storage=t;this.notebook=n;this.executionCount=0;this.cellIndexesCounted={};this.disposables=[];i.push(this),hc.workspace.onDidChangeTextDocument(this.onChangedDocument,this,this.disposables),or.onDidChangeNotebookCellExecutionState(this.onDidCellStateChange,this,this.disposables)}dispose(){this.disposed||(this.disposed=!0,this.storage.clear(),this.disposables.forEach(e=>e.dispose()))}reset(){this.storage.clear(),this.executionCount=0}async generateCode(e,t,n,i){let{executableLines:o}=this.extractExecutableLines(e);if(this.executionCount+=1,this.cellIndexesCounted[t]=!0,o.length>0&&o.find(s=>s.trim().length>0))return this.generateCodeImpl(e,this.executionCount,n,i)}extractExecutableLines(e){let t=e.interactive.originalSource,n=this.configService.getSettings(this.notebook.uri),i=new so(n),o=sg(t);if(n.magicCommandsAsComments&&o.forEach((s,a)=>o[a]=H0(s)),e.interactiveWindowCellMarker&&o.length&&o[0].trim()===e.interactiveWindowCellMarker.trim()){let s=o.slice(1).filter(a=>a.trim().length>0);if(s.length>0&&s[0].trim().startsWith("%%")){let a=o.slice(o.indexOf(s[0]));return{lines:a,executableLines:a}}}return o.length>0&&(i.isCode(o[0])||i.isMarkdown(o[0]))?{lines:o,executableLines:o.slice(1)}:{lines:o,executableLines:o}}onDidCellStateChange(e){e.state===1&&(e.state!==1||e.cell.notebook!==this.notebook||!e.cell.executionSummary?.executionOrder||this.cellIndexesCounted[e.cell.index]||(this.executionCount+=1,this.cellIndexesCounted[e.cell.index]=!0))}async generateCodeImpl(e,t,n,i){let{lineIndex:o,uristring:s}=e.interactive,a=hc.workspace.textDocuments.find(X=>X.uri.toString()===s);if(!a)return;let{stripped:l,trueStartLine:c}=this.extractStrippedLines(e),u=a.lineAt(c),p=a.lineAt(Math.min(c+l.length-1,a.lineCount-1)),f=0;for(;f<l.length&&l[f].trim().length===0;)f+=1;let g=f+c,v=a.offsetAt(new hc.Position(o,0)),b=a.offsetAt(p.rangeIncludingLineBreak.end),C=(e.interactiveWindowCellMarker||"").length>0,{runtimeLine:E,debuggerStartLine:R}=this.addHiddenLines(n,l,c,g,C,i),_=l.join(""),L=a.getText(new hc.Range(new hc.Position(o,0),p.rangeIncludingLineBreak.end)),te=(await va(_,"SHA-1")).substring(0,12),$=this.getRuntimeFile(te,t),se=n?-1:0,ae={line:u?u.lineNumber+1:1,endLine:p?p.lineNumber+1:1,firstNonBlankLineIndex:g,debuggerStartLine:R,executionCount:t,startOffset:v,endOffset:b,deleted:!1,code:_,trimmedRightCode:l.map(X=>X.replace(/[ \t\r]+\n$/g,`
|
||
`)).join(""),realCode:L,runtimeLine:E,runtimeFile:$,id:e.id,timestamp:Date.now(),lineOffsetRelativeToIndexOfFirstLineInCell:se,hasCellMarker:C};return d.info(`Generated code for ${t} = ${$} with ${l.length} lines`),this.storage.store(hc.Uri.parse(e.interactive.uristring),ae),ae}getRuntimeFile(e,t){return`<ipython-input-${t}-${e}>`}onChangedDocument(e){let t=this.storage.getFileGeneratedCode(e.document.uri);if(t){let n=e.document.getText();e.contentChanges.forEach(i=>{this.handleContentChange(n,i,t)})}}extractStrippedLines(e){let t=sg(e.interactive.originalSource),{lines:n}=this.extractExecutableLines(e),i=e.interactive.lineIndex+1;if(!e.interactiveWindowCellMarker){i=e.interactive.lineIndex;for(let l=0;l<n.length;l+=1)if(n[l]!==t[l]){i+=l+1;break}}let o=0;for(;o<n.length&&n[o].trim().length===0;)o+=1;let s=n.length-1,a=n.length-2;for(;a>0;){let l=n[s],c=n[a];if((l.length===0||l===`
|
||
`)&&(c.length===0||c===`
|
||
`))n.splice(s,1),s-=1,a-=1;else break}!n[s].endsWith(`
|
||
`)&&n[s].length>0&&(n[s]=`${n[s]}
|
||
`);for(let l=0;l<n.length;l++)n[l]=n[l].replace(/\r\n/g,`
|
||
`);return{stripped:n,trueStartLine:i}}handleContentChange(e,t,n){let i=t.range.start.line-t.range.end.line+t.text.split(`
|
||
`).length-1,o=t.text.length-t.rangeLength,s=t.rangeLength<=0?t.rangeOffset:t.rangeOffset+t.rangeLength-1;n.forEach(a=>{a.endOffset<t.rangeOffset||(a.startOffset>s?(a.line+=i,a.endLine+=i,a.startOffset+=o,a.endOffset+=o):a.startOffset===s?a.deleted||t.rangeLength>0||i===0?a.deleted=e.substr(a.startOffset,a.endOffset-a.startOffset)!==a.realCode:(a.line+=i,a.endLine+=i,a.startOffset+=o,a.endOffset+=o):a.deleted=e.substr(a.startOffset,a.endOffset-a.startOffset)!==a.realCode)})}addHiddenLines(e,t,n,i,o,s){let a=s||this.configService.getSettings(void 0).forceIPyKernelDebugger===!0;return e&&this.configService.getSettings(this.notebook.uri).stopOnFirstLineWhileDebugging?a?(t.splice(0,0,`breakpoint()
|
||
`),{runtimeLine:1,debuggerStartLine:n+1}):(t.splice(0,0,`breakpoint()
|
||
`),{runtimeLine:2,debuggerStartLine:n}):{runtimeLine:1,debuggerStartLine:o?i:i+1}}};var jz=require("vscode");var Qb=class{constructor(e,t,n){this.configService=e;this.storageFactory=t;this.disposables=n;this.codeGenerators=new WeakMap}activate(){jz.workspace.onDidCloseNotebookDocument(this.onDidCloseNotebook,this,this.disposables)}getOrCreate(e){let t=this.get(e);if(t)return t;let n=new z0(this.configService,this.storageFactory.getOrCreate(e),e,this.disposables);return this.codeGenerators.set(e,n),n}get(e){return this.codeGenerators.get(e)}onDidCloseNotebook(e){this.codeGenerators.get(e)?.dispose(),this.codeGenerators.delete(e)}};Qb=y([(0,Yb.injectable)(),m(0,(0,Yb.inject)(le)),m(1,(0,Yb.inject)(na)),m(2,(0,Yb.inject)(O))],Qb);var Vf=P(M()),Kd=require("vscode");function ds(r){if(r.metadata.interactive!==void 0)return r.metadata}function Wz(r,e,t){let n=Fe(r,{trim:!1,removeEmptyEntries:!1}),i=t.stripFirstMarkerNoConcat(n),o=n9(i),s=ag(o,`
|
||
`,e.magicCommandsAsComments?H0:void 0);return Ph(s.join(""))}function uw(r){let e=r;return e&&e.input&&xn(e.input.uri)&&xn(e.input.inputBoxUri)}var fbe=I.runCurrentCellAndAddBelow,hbe=I.addCellBelowCommandTitle,gbe=I.debugCellCommandTitle,vbe=I.debugCellCommandTitle,ybe=I.debugStepOverCommandTitle,bbe=I.debugContinueCommandTitle,Ibe=I.debugStopCommandTitle,Sbe=I.runCellLensCommandTitle,xbe=I.runAllCellsLensCommandTitle,Cbe=I.runAllCellsAboveLensCommandTitle,Vz=I.runCellAndAllBelowLensCommandTitle,wbe=I.scrollToCellTitleFormatMessage,Xb=class{constructor(e,t,n,i){this.configService=e;this.generatedCodeStorageFactory=n;this.updateEvent=new Kd.EventEmitter;this.notebookData=new Map;this.codeLensCache=new Map;this.totalCodeLensUpdateTimeInMs=0;this.codeLensUpdateCount=0;this.maxCellCount=0;Kd.workspace.onDidCloseTextDocument(this.onClosedDocument,this,t),Kd.workspace.onDidGrantWorkspaceTrust(()=>this.codeLensCache.clear(),this,t),this.configService.getSettings(void 0).onDidChange(this.onChangedSettings,this,t),or.onDidChangeNotebookCellExecutionState(this.onDidChangeNotebookCellExecutionState,this,t),i.onDidDisposeKernel(o=>{this.notebookData.delete(o.notebook.uri.toString())},this,t)}getPerfMeasures(){return{totalCodeLensUpdateTimeInMs:this.totalCodeLensUpdateTimeInMs,codeLensUpdateCount:this.codeLensUpdateCount,maxCellCount:this.maxCellCount}}get updateRequired(){return this.updateEvent.event}createCodeLenses(e){let t=this.getCodeLensCacheData(e);return[...t.documentLenses,...t.gotoCellLens]}getCellRanges(e){return this.getCodeLensCacheData(e).cellRanges}getCodeLensCacheData(e){let t=new We,n=!1,i=e.uri.toString(),o=this.codeLensCache.get(i),s=!1;o||(o={cachedDocumentVersion:void 0,cachedExecutionCounts:new Set,documentLenses:[],cellRanges:[],gotoCellLens:[]},s=!0,this.codeLensCache.set(i,o)),o.cachedDocumentVersion!==e.version&&(o.cellRanges=lw(e,this.configService.getSettings(e.uri)),o.documentLenses=[],o.gotoCellLens=[],o.cachedDocumentVersion=e.version,s=!0);let a=this.getDocumentExecutionCounts(i);if((a.length!==o.cachedExecutionCounts.size||a.find(l=>!o?.cachedExecutionCounts.has(l)))&&(o.gotoCellLens=[],o.cachedExecutionCounts=new Set(a),s=!0),o.documentLenses.length===0&&s&&o.cellRanges.length){n=!0;let l=this.enumerateCommands(e.uri);d.debug(`CodeLensFactory: Generating new code lenses for version ${e.version} of document ${e.uri} for commands ${l.join(", ")}`);let c=!0;o.cellRanges.forEach(u=>{l.forEach(p=>{let f=this.createCodeLens(e,u,p,c);f&&o.documentLenses.push(f)}),c=!1})}else d.ci(`NOT Generating new code lenses for version ${e.version} of document ${e.uri} - needUpdate: ${s}, cellRanges.length: ${o.cellRanges.length}`);if(s&&o.gotoCellLens.length===0&&o.cellRanges.length&&this.configService.getSettings(e.uri).addGotoCodeLenses){let l=this.generatedCodeStorageFactory.get({fileUri:e.uri}),c=l?l.all.find(u=>u.uri.toString()===e.uri.toString())?.generatedCodes:void 0;c&&c.length&&o.cellRanges.forEach(u=>{let p=this.createExecutionLens(e,u.range,c);p&&o?.gotoCellLens.push(p)})}return n&&(this.totalCodeLensUpdateTimeInMs+=t.elapsedTime,this.codeLensUpdateCount+=1,this.maxCellCount=Math.max(this.maxCellCount,o.cellRanges.length)),o}getDocumentExecutionCounts(e){return[...this.notebookData.values()].map(t=>t.documentExecutionCounts.get(e)).filter(t=>t!==void 0)}onDidChangeNotebookCellExecutionState(e){if(e.cell.notebook.notebookType!==yt||e.state!==1||!e.cell.executionSummary?.executionOrder)return;let t=ds(e.cell),n=this.notebookData.get(e.cell.notebook.uri.toString());n||(n={cellExecutionCounts:new Map,documentExecutionCounts:new Map},this.notebookData.set(e.cell.notebook.uri.toString(),n)),n!==void 0&&t!==void 0&&(n.cellExecutionCounts.set(t.id,e.cell.executionSummary.executionOrder),n.documentExecutionCounts.set(t.interactive.uristring,e.cell.executionSummary.executionOrder),this.updateEvent.fire())}onClosedDocument(e){this.codeLensCache.delete(e.uri.toString())}onChangedSettings(){this.codeLensCache.clear(),this.updateEvent.fire()}enumerateCommands(e){let t,n=this.configService.getSettings(e).codeLenses;n?t=n.split(",").map(s=>s.trim()):t=$u.DefaultDesignLenses;let i=this.configService.getSettings(e).debugCodeLenses;i?t=t.concat(i.split(",").map(s=>s.trim())):t=t.concat($u.DefaultDebuggingLenses);let o=[];return Kd.workspace.isTrusted||(o=[...$u.DebuggerCommands,...$u.DebuggerCommands,q.RunAllCells,q.RunAllCellsAbove,q.RunAllCellsAbovePalette,q.RunCellAndAllBelowPalette,q.RunCurrentCell,q.RunCurrentCellAdvance,q.RunCurrentCellAndAddBelow,q.RunFileInInteractiveWindows,q.InterruptKernel,q.RunToLine,q.RunCell,q.DebugCell,q.DebugContinue,q.DebugStepOver,q.DebugStop,q.RunCellAndAllBelowPalette]),o&&(t=t.filter(s=>!o.includes(s))),t}createCodeLens(e,t,n,i){let{range:o,cell_type:s}=t;switch(n){case q.RunCurrentCellAndAddBelow:return this.generateCodeLens(o,q.RunCurrentCellAndAddBelow,fbe);case q.AddCellBelow:return this.generateCodeLens(o,q.AddCellBelow,hbe,[e.uri,o.start.line]);case q.DebugCurrentCellPalette:return this.generateCodeLens(o,q.DebugCurrentCellPalette,gbe);case q.DebugCell:if(s!=="code")break;return this.generateCodeLens(o,q.DebugCell,vbe,[e.uri,o.start.line,o.start.character,o.end.line,o.end.character]);case q.DebugStepOver:if(s!=="code")break;return this.generateCodeLens(o,q.DebugStepOver,ybe,[e.uri]);case q.DebugContinue:if(s!=="code")break;return this.generateCodeLens(o,q.DebugContinue,bbe,[e.uri]);case q.DebugStop:if(s!=="code")break;return this.generateCodeLens(o,q.DebugStop,Ibe,[e.uri]);case q.RunCurrentCell:case q.RunCell:return this.generateCodeLens(o,q.RunCell,Sbe,[e.uri,o.start.line,o.start.character,o.end.line,o.end.character]);case q.RunAllCells:return this.generateCodeLens(o,q.RunAllCells,xbe,[e.uri,o.start.line,o.start.character]);case q.RunAllCellsAbovePalette:case q.RunAllCellsAbove:return i?this.generateCodeLens(o,q.RunCellAndAllBelow,Vz,[e.uri,o.start.line,o.start.character]):this.generateCodeLens(o,q.RunAllCellsAbove,Cbe,[e.uri,o.start.line,o.start.character]);case q.RunCellAndAllBelowPalette:case q.RunCellAndAllBelow:return this.generateCodeLens(o,q.RunCellAndAllBelow,Vz,[e.uri,o.start.line,o.start.character]);default:d.warn(`Invalid command for code lens ${n}`);break}}findMatchingCellExecutionCount(e){return[...this.notebookData.values()].find(n=>n.cellExecutionCounts.get(e))?.cellExecutionCounts.get(e)}createExecutionLens(e,t,n){if(n){let i=n.filter(o=>o.line-2===t.start.line).sort((o,s)=>o.timestamp-s.timestamp);if(i&&i.length){let o=i[i.length-1],s=this.findMatchingCellExecutionCount(o.id);if(s!==void 0)return this.generateCodeLens(t,q.ScrollToCell,wbe(s),[e.uri,o.id])}}}generateCodeLens(e,t,n,i){return new Kd.CodeLens(e,Ebe(t,n,i))}};Xb=y([(0,Vf.injectable)(),m(0,(0,Vf.inject)(le)),m(1,(0,Vf.inject)(O)),m(2,(0,Vf.inject)(na)),m(3,(0,Vf.inject)(Te))],Xb);function Ebe(r,e,t){return{arguments:t,title:e,command:r}}var gc=P(M()),Ja=P(require("vscode"));var Zb=class{constructor(e,t,n,i,o){this.serviceContainer=e;this.debugLocationTracker=t;this.configuration=n;this.debugService=o;this.totalExecutionTimeInMs=0;this.totalGetCodeLensCalls=0;this.activeCodeWatchers=[];this.didChangeCodeLenses=new Ja.EventEmitter;i.push(this),i.push(Ja.workspace.onDidGrantWorkspaceTrust(()=>{this.activeCodeWatchers=z(this.activeCodeWatchers),this.didChangeCodeLenses.fire()})),i.push(this.debugService.onDidChangeActiveDebugSession(this.onChangeDebugSession.bind(this))),i.push(Ja.workspace.onDidCloseTextDocument(this.onDidCloseTextDocument.bind(this))),this.debugLocationTracker&&i.push(this.debugLocationTracker.updated(this.onDebugLocationUpdated.bind(this)))}dispose(){this.totalGetCodeLensCalls>0&&A("DS_INTERNAL.CODE_LENS_ACQ_TIME",{duration:this.totalExecutionTimeInMs/this.totalGetCodeLensCalls}),z(this.activeCodeWatchers)}get onDidChangeCodeLenses(){return this.didChangeCodeLenses.event}provideCodeLenses(e,t){return[Mc,zw].includes(e.uri.scheme)?[]:this.getCodeLensTimed(e)}getCodeWatcher(e){return this.matchWatcher(e.uri)}onDebugLocationUpdated(){this.didChangeCodeLenses.fire()}onChangeDebugSession(e){this.didChangeCodeLenses.fire()}onDidCloseTextDocument(e){let t=this.activeCodeWatchers.findIndex(n=>n.uri&&n.uri.toString()===e.uri.toString());t>=0&&this.activeCodeWatchers.splice(t,1)[0].dispose()}getCodeLensTimed(e){let t=new We,n=this.getCodeLens(e);return this.totalExecutionTimeInMs+=t.elapsedTime,this.totalGetCodeLensCalls+=1,new sr(yr.HasCodeCells).set(n&&n.length>0).catch(h),this.configuration.getSettings(e.uri).enableCellCodeLens?this.adjustDebuggingLenses(e,n):[]}adjustDebuggingLenses(e,t){let n=$u.DebuggerCommands;if(this.debugLocationTracker&&this.debugService.activeDebugSession){let i=this.debugLocationTracker.getLocation(this.debugService.activeDebugSession),o;try{o=i?Ja.Uri.parse(i.fileName):void 0}catch{}if(i&&(ki(Ja.Uri.file(i.fileName),e.uri,!0)||o&&ki(o,e.uri,!0)))return t.filter(a=>{let l=new Ja.Position(i.lineNumber-1,i.column-1);return a.range.contains(l)}).filter(a=>a.command?n.includes(a.command.command):!1);d.ci(`Detected debugging context because activeDebugSession is name:"${this.debugService.activeDebugSession.name}", type: "${this.debugService.activeDebugSession.type}", but fell through with debugLocation: ${JSON.stringify(i)}, and document.uri: ${e.uri.toString()}`)}else return t.filter(i=>i.command?!n.includes(i.command.command):!1);return[]}getCodeLens(e){let t=this.matchWatcher(e.uri);return t?t.getCodeLenses():(d.debug(`Creating a new watcher for document ${e.uri}`),this.createNewCodeWatcher(e).getCodeLenses())}matchWatcher(e){let t=this.activeCodeWatchers.findIndex(i=>i.uri&&i.uri.toString()==e.toString());if(t>=0)return this.activeCodeWatchers[t];let n=Ja.workspace.textDocuments.filter(i=>i.uri.toString()===e.toString());if(n&&n.length>0)return d.debug(`creating new code watcher with matching document ${e}`),this.createNewCodeWatcher(n[0])}createNewCodeWatcher(e){let t=this.serviceContainer.get(U0);return t.setDocument(e),t.codeLensUpdated(this.onWatcherUpdated.bind(this)),this.activeCodeWatchers.push(t),t}onWatcherUpdated(){this.didChangeCodeLenses.fire()}};Zb=y([(0,gc.injectable)(),m(0,(0,gc.inject)(at)),m(1,(0,gc.inject)(h0)),m(1,(0,gc.optional)()),m(2,(0,gc.inject)(le)),m(3,(0,gc.inject)(O)),m(4,(0,gc.inject)(Li))],Zb);var Fd=P(M()),ve=require("vscode");var Bf=class extends Error{constructor(t){super("Cell failed to execute");this.cell=t}};function kbe(r,e){if(e<=0)throw new RangeError(`Length must be > 0 not ${e}`);return r<0&&(r+=e),r<0?0:r>=e?e-1:r}var Qt=class{constructor(e,t,n,i,o){this.interactiveWindowProvider=e;this.configService=t;this.executionHelper=n;this.dataScienceErrorHandler=i;this.codeLensFactory=o;this.version=-1;this.codeLenses=[];this.cells=[];this.codeLensUpdatedEvent=new ve.EventEmitter;this.disposables=[this.codeLensUpdatedEvent]}setDocument(e){this.document=e,this.version=e.version,this.codeLenses=this.codeLensFactory.createCodeLenses(e),this.cells=this.codeLensFactory.getCellRanges(e),this.disposables.push(this.codeLensFactory.updateRequired(this.onCodeLensFactoryUpdated.bind(this))),this.disposables.push(ve.workspace.onDidCloseTextDocument(this.onDocumentClosed.bind(this))),this.disposables.push(ve.workspace.onDidCloseNotebookDocument(this.ondidCloseNotebook.bind(this)))}get codeLensUpdated(){return this.codeLensUpdatedEvent.event}get uri(){return this.document?.uri}getVersion(){return this.version}getCodeLenses(){let e=this.document;return e&&e.version!=this.version&&(this.codeLenses=this.codeLensFactory.createCodeLenses(e),this.cells=this.codeLensFactory.getCellRanges(e),this.version=e.version),this.codeLenses}async debugCurrentCell(){if(!(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document))return this.runMatchingCell(ve.window.activeTextEditor.selection,!1,!0)}dispose(){let e=this.codeLensFactory.getPerfMeasures();e&&e.codeLensUpdateCount>0&&A("DS_INTERNAL.DOCUMENT_WITH_CODE_CELLS",{codeLensUpdateTime:e.totalCodeLensUpdateTimeInMs/e.codeLensUpdateCount,maxCellCount:e.maxCellCount}),z(this.disposables)}async runAllCells(e){let t=await this.getActiveInteractiveWindow(),n=this.codeLenses.filter(s=>s.command&&s.command.command===q.RunCell&&s.command.arguments&&s.command.arguments.length>=5),i=n.length,o=Promise.resolve(!0);for(let s of n){let a=new ve.Range(s.command.arguments[1],s.command.arguments[2],s.command.arguments[3],s.command.arguments[4]);if(this.document){i===n.length&&(a=new ve.Range(new ve.Position(0,0),a.end));let l=this.document.getText(a);i-=1,o=this.addCode(t,l,this.document.uri,a.start.line,e)}}if(await o,n.length===0)return this.runFileAsOneCell(e??!1)}async runFileInteractive(){if(this.document&&this.configService.getSettings(this.document?.uri).splitRunFileIntoCells)return this.runAllCells();if(this.document)return this.runFileAsOneCell(!1)}async debugFileInteractive(){if(this.document&&this.configService.getSettings(this.document?.uri).splitRunFileIntoCells)return this.runAllCells(!0);if(this.document)return this.runFileAsOneCell(!0)}async runAllCellsAbove(e,t){let n=await this.getActiveInteractiveWindow(),i=this.codeLenses.filter(l=>l.command&&l.command.command===q.RunCell),o=i.findIndex(l=>l.range.start.line>=e&&l.range.start.character>=t);o<0&&(o=i.length);let s=o,a=Promise.resolve(!0);for(let l of i)if(o>0&&this.document){let c=new ve.Range(l.range.start,l.range.end);o===s&&(c=new ve.Range(new ve.Position(0,0),c.end)),o-=1;let u=this.document.getText(c);a=this.addCode(n,u,this.document.uri,l.range.start.line)}else break;await a}async runCellAndAllBelow(e,t){let n=await this.getActiveInteractiveWindow(),i=this.codeLenses.filter(l=>l.command&&l.command.command===q.RunCell),o=i.findIndex(l=>l.range.start.line>=e&&l.range.start.character>=t),s=o>0?i.length-o:i.length,a=Promise.resolve(!0);for(let l=o;l>=0&&l<i.length;l+=1)if(s>0&&this.document){let c=i[l];s-=1;let u=this.document.getText(c.range);a=this.addCode(n,u,this.document.uri,c.range.start.line)}await a}async runSelectionOrLine(e,t){if(this.document&&e&&ki(e.document.uri,this.document.uri)){let n=await this.getActiveInteractiveWindow(),i;if(t===void 0||xn(t)?i=this.executionHelper.getSelectedTextToExecute(e):i=t,!i)return;let s=this.configService.getSettings(e.document.uri).normalizeSelectionForInteractiveWindow??!0?await this.executionHelper.normalizeLines(i):i;if(!s||s.trim().length===0)return;await this.addCode(n,s,this.document.uri,e.selection.start.line)}}async runToLine(e){if(this.document&&e>0){let t=await this.getActiveInteractiveWindow(),n=this.document.lineAt(e-1),i=this.document.getText(new ve.Range(0,0,n.range.end.line,n.range.end.character));i&&i.trim().length&&await this.addCode(t,i,this.document.uri,0)}}async runFromLine(e){if(this.document&&e<this.document.lineCount){let t=await this.getActiveInteractiveWindow(),n=this.document.lineAt(this.document.lineCount-1),i=this.document.getText(new ve.Range(e,0,n.range.end.line,n.range.end.character));i&&i.trim().length&&await this.addCode(t,i,this.document.uri,e)}}async runCell(e){if(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document)return;let t=e.contains(ve.window.activeTextEditor.selection.start)&&this.configService.getSettings(ve.window.activeTextEditor.document.uri).enableAutoMoveToNextCell;return this.runMatchingCell(e,t)}async debugCell(e){if(!(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document))return this.runMatchingCell(e,!1,!0)}async runCurrentCell(){if(!(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document))return this.runMatchingCell(ve.window.activeTextEditor.selection,!1)}async runCurrentCellAndAdvance(){if(!(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document))return this.runMatchingCell(ve.window.activeTextEditor.selection,!0)}async addEmptyCellToBottom(){let e=ve.window.activeTextEditor;e&&this.insertCell(e,e.document.lineCount+1)}async runCurrentCellAndAddBelow(){if(!ve.window.activeTextEditor||!ve.window.activeTextEditor.document)return;let e=ve.window.activeTextEditor,t=new so(this.configService.getSettings(e.document.uri)),n=0,i=this.getDefaultCellMarker(e.document.uri);e&&e.edit(s=>{let a=!0;for(let l=e.selection.end.line+1;l<e.document.lineCount;l+=1)if(t.isCell(e.document.lineAt(l).text)){a=!1,n=l,s.insert(new ve.Position(l,0),`${i}
|
||
|
||
`);break}a&&(n=e.document.lineCount,s.insert(new ve.Position(e.document.lineCount,0),`
|
||
${i}
|
||
`))}).then(h,h);let o=new ve.Position(n+1,0);return this.runMatchingCell(e.selection,!1).then(()=>this.advanceToRange(new ve.Range(o,o)))}insertCellBelowPosition(){let e=ve.window.activeTextEditor;e&&e.selection&&this.insertCell(e,e.selection.end.line+1)}insertCellBelow(){let e=ve.window.activeTextEditor;if(e&&e.selection){let t=this.getCellFromPosition(e.selection.end);t?this.insertCell(e,t.range.end.line+1):this.insertCell(e,e.selection.end.line+1)}}insertCellAbove(){let e=ve.window.activeTextEditor;if(e&&e.selection){let t=this.getCellFromPosition(e.selection.start);t?this.insertCell(e,t.range.start.line):this.insertCell(e,e.selection.start.line)}}deleteCells(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=this.getStartEndCells(e.selection);if(!t)return;let n=t[0],i=t[1],o=0,s=0,a=i.range.end.line+1,l=0;n.range.start.line>0&&(o=n.range.start.line-1,s=e.document.lineAt(o).range.end.character,a=i.range.end.line,l=i.range.end.character);let c=new ve.Range(new ve.Position(o,s),new ve.Position(a,l));e.edit(u=>{u.replace(c,""),this.codeLensUpdatedEvent.fire()}).then(h,h)}selectCell(){let e=ve.window.activeTextEditor;if(e&&e.selection){let t=this.getStartEndCells(e.selection);if(t){let n=t[0],i=t[1];e.selection.anchor.isBeforeOrEqual(e.selection.active)?e.selection=new ve.Selection(n.range.start,i.range.end):e.selection=new ve.Selection(i.range.end,n.range.start)}}}selectCellContents(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=this.getStartEndCellIndex(e.selection);if(!t)return;let n=t[0],i=t[1],o=e.selection.anchor.isBeforeOrEqual(e.selection.active),s=this.cells,a=[];for(let l=n;l<=i;l+=1){let c=s[l],u=c.range.start.line+1,p=0,f=c.range.end.line,g=c.range.end.character;c.range.start.line===c.range.end.line&&(u=c.range.start.line,p=e.document.lineAt(u).range.end.character,f=u,g=p),o?a.push(new ve.Selection(u,p,f,g)):a.push(new ve.Selection(f,g,u,p))}e.selections=a}extendSelectionByCellAbove(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=e.selection,n=this.getStartEndCellIndex(e.selection);if(!n)return;let i=e.selection.anchor.isBefore(e.selection.active),o=this.cells,s=n[0],a=n[1],l=o[s],c=o[a];if(!l.range.start.isEqual(t.start)||!c.range.end.isEqual(t.end)){let u;i?s<a?u=new ve.Selection(l.range.start,o[a-1].range.end):u=new ve.Selection(l.range.end,l.range.start):u=new ve.Selection(c.range.end,l.range.start),e.selection=u}else{let u;i&&s<a?(u=o[a-1],e.selection=new ve.Selection(l.range.start,u.range.end)):s>0&&(u=o[s-1],e.selection=new ve.Selection(c.range.end,u.range.start)),u&&e.revealRange(u.range,ve.TextEditorRevealType.Default)}}extendSelectionByCellBelow(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=e.selection,n=this.getStartEndCellIndex(e.selection);if(!n)return;let i=e.selection.anchor.isBeforeOrEqual(e.selection.active),o=this.cells,s=n[0],a=n[1],l=o[s],c=o[a];if(!l.range.start.isEqual(t.start)||!c.range.end.isEqual(t.end)){let u;i?u=new ve.Selection(l.range.start,c.range.end):s<a?u=new ve.Selection(o[s+1].range.start,c.range.end):u=new ve.Selection(c.range.start,c.range.end),e.selection=u}else{let u;i||s===a?a<o.length-1&&(u=o[a+1],e.selection=new ve.Selection(l.range.start,u.range.end)):s<a&&(u=o[s+1],e.selection=new ve.Selection(c.range.end,u.range.start)),u&&e.revealRange(u.range,ve.TextEditorRevealType.Default)}}async moveCellsUp(){await this.moveCellsDirection(!0)}async moveCellsDown(){await this.moveCellsDirection(!1)}changeCellToMarkdown(){this.applyToCells((e,t,n)=>this.changeCellTo(e,t,"markdown"))}changeCellToCode(){this.applyToCells((e,t,n)=>this.changeCellTo(e,t,"code"))}gotoNextCell(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=e.selection,n=this.getCurrentCellLens(t.start),i=this.getNextCellLens(t.start);n&&i&&this.advanceToRange(i.range)}gotoPreviousCell(){let e=ve.window.activeTextEditor;if(!e||!e.selection)return;let t=e.selection,n=this.getCurrentCellLens(t.start),i=this.getPreviousCellLens(t.start);n&&i&&this.advanceToRange(i.range)}applyToCells(e){let t=ve.window.activeTextEditor,n=this.getStartEndCellIndex(t?.selection);if(!t||!n)return;let i=this.cells,o=n[0],s=n[1];for(let a=o;a<=s;a+=1)e(t,i[a],a)}changeCellTo(e,t,n){if(n==="raw")throw Error("Cell Type raw not implemented");if(t.cell_type===n)return;let i=new so(this.configService.getSettings(e.document.uri)),o=e.document.lineAt(t.range.start.line),s=e.document.getText(o.range),a=this.getDefaultCellMarker(e.document.uri),l=n==="markdown"?i.codeExecRegEx.exec(s):i.markdownExecRegEx.exec(s);if(!l)return;let c=l[l.length-1],u=n==="markdown"?`${a} [markdown]${c}`:`${a}${c}`;e.edit(async p=>{p.replace(o.range,u),t.cell_type=n,t.range.start.line<t.range.end.line&&(e.selection=new ve.Selection(t.range.start.line+1,0,t.range.end.line,t.range.end.character),ve.commands.executeCommand("editor.action.removeCommentLine").then(h,h),n==="markdown"&&ve.commands.executeCommand("editor.action.addCommentLine").then(h,h))}).then(h,h)}async moveCellsDirection(e){let t=ve.window.activeTextEditor;if(!t||!t.selection)return!1;let n=this.getStartEndCellIndex(t.selection);if(!n)return!1;let i=n[0],o=n[1],s=this.cells,a=s[i],l=s[o];if(!a||!l)return!1;let c=new ve.Range(a.range.start,l.range.end),u=new ve.Range(t.selection.start.line-c.start.line,t.selection.start.character,t.selection.end.line-c.start.line,t.selection.end.character),p=t.selection.active.isBefore(t.selection.anchor),f;if(e){if(i===0)return!1;{let g=s[i-1];f=this.exchangeTextLines(t,g.range,c).then(b=>(b&&(t.selection=new ve.Selection(g.range.start.line+u.start.line,u.start.character,g.range.start.line+u.end.line,u.end.character)),b))}}else{if(o===s.length-1)return!1;{let g=s[o+1],v=this.exchangeTextLines(t,c,g.range),b=g.range.end.line-g.range.start.line,C=c.end.line-c.start.line,E=b-C;f=v.then(R=>(R&&(t.selection=new ve.Selection(g.range.start.line+E+u.start.line,u.start.character,g.range.start.line+E+u.end.line,u.end.character)),R))}}return f.then(g=>(g&&p&&(t.selection=new ve.Selection(t.selection.active,t.selection.anchor)),!0))}exchangeTextLines(e,t,n){let i=t.start.line,o=t.end.line,s=n.start.line,a=n.end.line;if(o>=s)throw RangeError(`Above lines must be fully above not ${o} <= ${s}`);let l=new ve.Range(i,0,o,e.document.lineAt(o).range.end.character),c=e.document.getText(l),u=new ve.Range(s,0,a,e.document.lineAt(a).range.end.character),p=e.document.getText(u),f="";if(o+1<s){let b=o+1,C=s-1,E=new ve.Range(b,0,C,e.document.lineAt(C).range.end.character);f=`${e.document.getText(E)}
|
||
`}let g=`${p}
|
||
${f}${c}`,v=new ve.Range(l.start,u.end);return e.edit(b=>{b.replace(v,g),this.codeLensUpdatedEvent.fire()})}getStartEndCells(e){let t=this.getStartEndCellIndex(e);if(t){let n=this.getCellFromIndex(t[0]),i=this.getCellFromIndex(t[1]);return[n,i]}}getStartEndCellIndex(e){if(!e)return;let t=this.getCellIndex(e.start),n=t;if(e.start.line!==e.end.line&&(n=this.getCellIndex(e.end)),t===-1){if(n===-1)return;{t=0;let i=this.getCellFromIndex(0);if(e.start.line>i.range.start.line)throw RangeError(`Should not be able to pick a range with an end in a cell and start after a cell. ${e.start.line} > ${i.range.end.line}`)}}if(t>=0&&n>=0)return[t,n]}insertCell(e,t){let n=this.getDefaultCellMarker(e.document.uri),i=t>=e.document.lineCount?`
|
||
${n}
|
||
`:`${n}
|
||
|
||
`,o=new ve.Position(t,0),s=new ve.Position(t+1,0);e.edit(a=>{a.insert(o,i),this.codeLensUpdatedEvent.fire()}).then(h,h),e.selection=new ve.Selection(s,s)}getDefaultCellMarker(e){return this.configService.getSettings(e).defaultCellMarker||qe.DefaultCodeCellMarker}onCodeLensFactoryUpdated(){this.document&&(this.codeLenses=this.codeLensFactory.createCodeLenses(this.document),this.cells=this.codeLensFactory.getCellRanges(this.document)),this.codeLensUpdatedEvent.fire()}onDocumentClosed(e){this.document&&ki(e.uri,this.document.uri)&&z(this.disposables)}ondidCloseNotebook(e){e.notebookType===yt&&this.configService.getSettings(this.document?.uri).addGotoCodeLenses&&this.onCodeLensFactoryUpdated()}getActiveInteractiveWindow(){return this.interactiveWindowProvider.getOrCreate(this.document?.uri)}async addCode(e,t,n,i,o){let s=!1;try{o?s=await e.debugCode(t,n,i):s=await e.addCode(t,n,i)}catch(a){a instanceof Bf||await this.dataScienceErrorHandler.handleError(a)}return s}async runMatchingCell(e,t,n){let i=this.getCurrentCellLens(e.start),o=this.getNextCellLens(e.start);if(i&&this.document){let s=Ph(this.document.getText(i.range));if(t){let l=ve.window.activeTextEditor,{newCellOnRunLast:c}=this.configService.getSettings(this.document.uri),u=new so(this.configService.getSettings(this.document.uri));o?this.advanceToRange(o.range):c&&l&&!u.isEmptyCell(s)&&this.insertCell(l,i.range.end.line+1)}let a=await this.getActiveInteractiveWindow();await this.addCode(a,s,this.document.uri,i.range.start.line,n)}}getCellIndex(e){return this.cells.findIndex(t=>e&&t.range.contains(e))}getCellFromIndex(e){let t=this.cells,n=kbe(e,t.length);return t[n]}getCellFromPosition(e){if(!e){let t=ve.window.activeTextEditor;t&&t.selection&&(e=t.selection.active)}if(e){let t=this.getCellIndex(e);if(t>=0)return this.cells[t]}}getCurrentCellLens(e){return this.codeLenses.find(t=>t.range.contains(e)&&t.command!==void 0&&t.command.command===q.RunCell)}getNextCellLens(e){let t=this.codeLenses.findIndex(n=>n.range.contains(e)&&n.command!==void 0&&n.command.command===q.RunCell);if(t>=0)return this.codeLenses.find((n,i)=>n.command!==void 0&&n.command.command===q.RunCell&&i>t)}getPreviousCellLens(e){let t=this.codeLenses.findIndex(n=>n.range.contains(e)&&n.command!==void 0&&n.command.command===q.RunCell);if(t>=1)return this.codeLenses.find((n,i)=>n.command!==void 0&&i<t&&i+1===t)}async runFileAsOneCell(e){if(this.document){let t=await this.getActiveInteractiveWindow(),n=this.document.getText();await this.addCode(t,n,this.document.uri,0,e)}}advanceToRange(e){let t=ve.window.activeTextEditor,n=new ve.Selection(e.start,e.start);t&&(t.selection=n,t.revealRange(e,ve.TextEditorRevealType.Default))}};y([Xr("DATASCIENCE.DEBUG_CURRENT_CELL")],Qt.prototype,"debugCurrentCell",1),y([Xr("DATASCIENCE.RUN_ALL_CELLS")],Qt.prototype,"runAllCells",1),y([Xr("DATASCIENCE.RUN_FILE_INTERACTIVE")],Qt.prototype,"runFileInteractive",1),y([Xr("DATASCIENCE.DEBUG_FILE_INTERACTIVE")],Qt.prototype,"debugFileInteractive",1),y([Xr("DATASCIENCE.RUN_ALL_CELLS_ABOVE")],Qt.prototype,"runAllCellsAbove",1),y([Xr("DATASCIENCE.RUN_CELL_AND_ALL_BELOW")],Qt.prototype,"runCellAndAllBelow",1),y([Xr("DATASCIENCE.RUN_SELECTION_OR_LINE")],Qt.prototype,"runSelectionOrLine",1),y([Xr("DATASCIENCE.RUN_TO_LINE")],Qt.prototype,"runToLine",1),y([Xr("DATASCIENCE.RUN_FROM_LINE")],Qt.prototype,"runFromLine",1),y([li("CodeWatcher::runCell",4)],Qt.prototype,"runCell",1),y([Xr("DATASCIENCE.DEBUG_CURRENT_CELL")],Qt.prototype,"debugCell",1),y([Xr("DATASCIENCE.RUN_CURRENT_CELL")],Qt.prototype,"runCurrentCell",1),y([Xr("DATASCIENCE.RUN_CURRENT_CELL_AND_ADVANCE")],Qt.prototype,"runCurrentCellAndAdvance",1),y([ur("DATASCIENCE.RUN_CURRENT_CELL_AND_ADD_BELOW")],Qt.prototype,"runCurrentCellAndAddBelow",1),y([ur("DATASCIENCE.RUN_INSERT_CELL_BELOW_POSITION")],Qt.prototype,"insertCellBelowPosition",1),y([ur("DATASCIENCE.RUN_INSERT_CELL_BELOW")],Qt.prototype,"insertCellBelow",1),y([ur("DATASCIENCE.RUN_INSERT_CELL_ABOVE")],Qt.prototype,"insertCellAbove",1),y([ur("DATASCIENCE.RUN_DELETE_CELLS")],Qt.prototype,"deleteCells",1),y([ur("DATASCIENCE.RUN_SELECT_CELL")],Qt.prototype,"selectCell",1),y([ur("DATASCIENCE.RUN_SELECT_CELL_CONTENTS")],Qt.prototype,"selectCellContents",1),y([ur("DATASCIENCE.RUN_EXTEND_SELECTION_BY_CELL_ABOVE")],Qt.prototype,"extendSelectionByCellAbove",1),y([ur("DATASCIENCE.RUN_EXTEND_SELECTION_BY_CELL_BELOW")],Qt.prototype,"extendSelectionByCellBelow",1),y([ur("DATASCIENCE.RUN_MOVE_CELLS_UP")],Qt.prototype,"moveCellsUp",1),y([ur("DATASCIENCE.RUN_MOVE_CELLS_DOWN")],Qt.prototype,"moveCellsDown",1),y([ur("DATASCIENCE.RUN_CHANGE_CELL_TO_MARKDOWN")],Qt.prototype,"changeCellToMarkdown",1),y([ur("DATASCIENCE.RUN_CHANGE_CELL_TO_CODE")],Qt.prototype,"changeCellToCode",1),y([ur("DATASCIENCE.GOTO_NEXT_CELL_IN_FILE")],Qt.prototype,"gotoNextCell",1),y([ur("DATASCIENCE.GOTO_PREV_CELL_IN_FILE")],Qt.prototype,"gotoPreviousCell",1),Qt=y([(0,Fd.injectable)(),m(0,(0,Fd.inject)(qi)),m(1,(0,Fd.inject)(le)),m(2,(0,Fd.inject)(mD)),m(3,(0,Fd.inject)(Zr)),m(4,(0,Fd.inject)(j0))],Qt);var tI=P(M()),ni=P(require("vscode"));var Ld=require("vscode");var eI=class{constructor(e,t,n){this.configuration=t;this.extensionChecker=n;this.computeDecorations(),e.push(this),e.push(this.configuration.getSettings(void 0).onDidChange(this.settingsChanged,this)),e.push(ni.window.onDidChangeActiveTextEditor(this.changedEditor,this)),e.push(ni.window.onDidChangeTextEditorSelection(this.changedSelection,this)),e.push(ni.workspace.onDidChangeTextDocument(this.changedDocument,this)),this.settingsChanged()}activate(){}dispose(){this.timer&&clearTimeout(this.timer)}settingsChanged(){ni.window.activeTextEditor&&this.triggerUpdate(ni.window.activeTextEditor)}changedEditor(){this.triggerUpdate(void 0)}changedDocument(e){ni.window.activeTextEditor&&e.document===ni.window.activeTextEditor.document&&this.triggerUpdate(Ld.window.activeTextEditor)}changedSelection(e){e.textEditor&&e.textEditor.selection.anchor&&this.triggerUpdate(e.textEditor)}triggerUpdate(e){this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>this.update(e),100)}computeDecorations(){this.currentCellTopUnfocused=Ld.window.createTextEditorDecorationType({borderColor:new ni.ThemeColor("interactive.inactiveCodeBorder"),borderWidth:"2px 0px 0px 0px",borderStyle:"solid",isWholeLine:!0}),this.currentCellBottomUnfocused=Ld.window.createTextEditorDecorationType({borderColor:new ni.ThemeColor("interactive.inactiveCodeBorder"),borderWidth:"0px 0px 1px 0px",borderStyle:"solid",isWholeLine:!0}),this.currentCellTop=Ld.window.createTextEditorDecorationType({borderColor:new ni.ThemeColor("interactive.activeCodeBorder"),borderWidth:"2px 0px 0px 0px",borderStyle:"solid",isWholeLine:!0}),this.currentCellBottom=Ld.window.createTextEditorDecorationType({borderColor:new ni.ThemeColor("interactive.activeCodeBorder"),borderWidth:"0px 0px 1px 0px",borderStyle:"solid",isWholeLine:!0})}cellDecorationEnabled(e){return e.decorateCells===!1?!1:e.decorateCells==="currentCell"||e.decorateCells==="allCells"}update(e){let t=e===void 0?Ld.window.visibleTextEditors:[e];for(let n of t)if(n&&n.document&&n.document.languageId===ye&&!og(n.document)&&this.currentCellTop&&this.currentCellBottom&&this.currentCellTopUnfocused&&this.currentCellBottomUnfocused&&this.extensionChecker.isPythonExtensionInstalled){let i=this.configuration.getSettings(n.document.uri);if(this.cellDecorationEnabled(i)){let o=lw(n.document,i),s=o.map(u=>u.range).filter(u=>u.contains(n.selection.anchor)),a=s.length>0?[new ni.Range(s[0].start,s[0].start)]:[],l=i.decorateCells!=="allCells"&&s.length>0?[new ni.Range(s[0].end,s[0].end)]:[],c=[];i.decorateCells==="allCells"&&o.forEach(u=>{let p=u.range.start;p!==s[0].start&&c.push(new ni.Range(p,p))}),Ld.window.activeTextEditor===n?(n.setDecorations(this.currentCellTop,a),n.setDecorations(this.currentCellBottom,l),n.setDecorations(this.currentCellTopUnfocused,c),n.setDecorations(this.currentCellBottomUnfocused,[])):(n.setDecorations(this.currentCellTop,[]),n.setDecorations(this.currentCellBottom,[]),n.setDecorations(this.currentCellTopUnfocused,[...c,...a]),n.setDecorations(this.currentCellBottomUnfocused,l))}else n.setDecorations(this.currentCellTop,[]),n.setDecorations(this.currentCellBottom,[]),n.setDecorations(this.currentCellTopUnfocused,[]),n.setDecorations(this.currentCellBottomUnfocused,[])}}};eI=y([(0,tI.injectable)(),m(0,(0,tI.inject)(O)),m(1,(0,tI.inject)(le)),m(2,(0,tI.inject)($e))],eI);var Bz=P(M()),qz=require("vscode");var Q0=class{constructor(){this.codeGeneratorsByFile=new So}clear(){this.codeGeneratorsByFile.clear()}get all(){return[...this.codeGeneratorsByFile.entries()].map(e=>({uri:e[0],generatedCodes:e[1].filter(t=>!t.deleted)})).filter(e=>e.generatedCodes.length>0)}getFileGeneratedCode(e){return this.codeGeneratorsByFile.get(e)||[]}store(e,t){let n=this.codeGeneratorsByFile.get(e)||[],i=!1;for(let o=0;o<n.length&&!i;o+=1){let s=n[o];t.line>=s.line&&t.line<=s.endLine?(n.splice(o,1,t),i=!0):s.line>t.line&&(n.splice(o,0,t),i=!0)}i||n.push(t),this.codeGeneratorsByFile.set(e,n)}};var rI=class{constructor(){this.storages=new WeakMap}getOrCreate(e){return this.storages.has(e)||this.storages.set(e,new Q0),this.storages.get(e)}get(e){if("notebook"in e)return this.storages.get(e.notebook);{let t=qz.workspace.notebookDocuments.find(n=>this.storages.get(n)?.all.find(o=>o.uri.toString()===e.fileUri.toString()));return t?this.storages.get(t):void 0}}};rI=y([(0,Bz.injectable)()],rI);var Nu=P(M()),iI=P(require("vscode"));var nI=class{constructor(e,t,n,i){this.variableProvider=e;this.interactiveProvider=t;this.disposables=n;this.kernelProvider=i;this.runFiles=new Set;this.stopWatch=new We;this.delayer=new bs(300)}activate(){this.onDidChangeNotebookCellExecutionStateHandler=or.onDidChangeNotebookCellExecutionState(e=>this.delayer.trigger(()=>this.onDidChangeNotebookCellExecutionState(e)).catch(h),this),this.kernelProvider.onDidRestartKernel(()=>this.runFiles.clear(),this,this.disposables)}dispose(){this.delayer.dispose(),this.onDidChangeNotebookCellExecutionStateHandler.dispose(),this.hoverProviderRegistration&&this.hoverProviderRegistration.dispose()}async onDidChangeNotebookCellExecutionState(e){try{if(e.cell.notebook.notebookType!==yt)return;let t=this.runFiles.size,n=ds(e.cell);n!==void 0&&this.runFiles.add(n.interactive.uristring),t!==this.runFiles.size&&(this.initializeHoverProvider(),this.onDidChangeNotebookCellExecutionStateHandler.dispose())}catch(t){d.error(t)}}async provideHover(e,t,n){this.stopWatch.reset();let i=await br(300,this.getVariableHover(e,t,n));return A("DS_INTERNAL.INTERACTIVE_FILE_TOOLTIPS_PERF",{duration:this.stopWatch.elapsedTime},{isResultNull:!!i}),i}initializeHoverProvider(){this.hoverProviderRegistration||(this.hoverProviderRegistration=iI.languages.registerHoverProvider($j,this))}async getVariableHover(e,t,n){let i=e.getWordRangeAtPosition(t);if(i){let o=e.getText(i);if(o){let s=this.getMatchingKernels(e);if(s.length){let a=await nr(n,{},...s.map(c=>this.variableProvider.getVariableProperties(o,c,n))),l=Object.entries(a||{});if(l.length>0){let c=l.reduce((p,f)=>p+`${f[0]}: ${f[1]}
|
||
`,"```\n")+"```";return{contents:[new iI.MarkdownString(c)]}}}}}}getMatchingKernels(e){let t=this.interactiveProvider.get(e.uri)?.notebookUri;if(!t)return[];let n=new Set;return iI.workspace.notebookDocuments.filter(i=>t?.toString()===i.uri.toString()).forEach(i=>{let o=this.kernelProvider.get(i);o&&n.add(o)}),Array.from(n)}};nI=y([(0,Nu.injectable)(),m(0,(0,Nu.inject)(kn)),m(0,(0,Nu.named)(qe.KERNEL_VARIABLES)),m(1,(0,Nu.inject)(qi)),m(2,(0,Nu.inject)(O)),m(3,(0,Nu.inject)(Te))],nI);var Fo=P(M()),Mr=require("vscode");var Ot=require("vscode");var Jz=P(To());var qf=class{constructor(e,t,n,i,o){this.serviceContainer=e;this._owner=t;this.controllerFactory=n;this.inputUri=o;this._onDidChangeViewState=new Ot.EventEmitter;this.closedEvent=new Ot.EventEmitter;this._submitters=[];this.internalDisposables=[];this.fs=this.serviceContainer.get(st),this.configuration=this.serviceContainer.get(le),this.jupyterExporter=this.serviceContainer.get(xg),this.interactiveWindowDebugger=this.serviceContainer.tryGet(W0),this.errorHandler=this.serviceContainer.get(Zr),this.codeGeneratorFactory=this.serviceContainer.get(zb),this.storageFactory=this.serviceContainer.get(na),this.kernelProvider=this.serviceContainer.get(Te),this.debuggingManager=this.serviceContainer.get(B0),this.notebookUri=uw(i)?i.input.uri:i.notebook.uri,this._owner&&this._submitters.push(this._owner),Ot.window.onDidChangeActiveNotebookEditor(s=>{s?.notebook.uri.toString()===this.notebookUri.toString()&&this._onDidChangeViewState.fire()},this.internalDisposables),Ot.workspace.onDidCloseNotebookDocument(s=>{s.uri.toString()===this.notebookUri.toString()&&this.closedEvent.fire()},this.internalDisposables),Ot.window.activeNotebookEditor?.notebook.uri.toString()===this.notebookUri.toString()&&this._onDidChangeViewState.fire(),this.cellMatcher=new so(this.configuration.getSettings(this.owningResource)),this.notebookDocument&&this.codeGeneratorFactory.getOrCreate(this.notebookDocument)}get onDidChangeViewState(){return this._onDidChangeViewState.event}get closed(){return this.closedEvent.event}get owner(){return this._owner}get submitters(){return this._submitters}get notebookDocument(){return this._notebookDocument||(this._notebookDocument=Ot.workspace.notebookDocuments.find(e=>e.uri.toString()===this.notebookUri.toString())),this._notebookDocument}get kernelConnectionMetadata(){return this.controller?.metadata}notifyConnectionReset(){if(this.notebookDocument)this.controller||(this.controller=this.initController(this.notebookDocument)),this.controller.setInfoMessageCell(I.noKernelConnected);else{let e=Ot.workspace.onDidOpenNotebookDocument(t=>{t.uri.toString()===this.notebookUri.toString()&&(this._notebookDocument=t,this.controller=this.initController(t),this.internalDisposables.push(this.controller.listenForControllerSelection()),this.controller.setInfoMessageCell(I.noKernelConnected),e.dispose())})}}initController(e){let t=this.controllerFactory.create(e,this.errorHandler,this.kernelProvider,this._owner);return this.internalDisposables.push(t.listenForControllerSelection()),t}async ensureInitialized(){if(!this.notebookDocument&&(d.debug("Showing Interactive editor to initialize codeGenerator from notebook document"),await this.showInteractiveEditor(),!this.notebookDocument))throw new Error("Could not open notebook document for Interactive Window");this.codeGeneratorFactory.get(this.notebookDocument)||this.codeGeneratorFactory.getOrCreate(this.notebookDocument),this.controller||(this.controller=this.initController(this.notebookDocument)),this.controller.controller?this.controller.startKernel().catch(h):(d.info("No controller selected for Interactive Window initialization"),this.controller.setInfoMessageCell(I.selectKernelForEditor))}async showInteractiveEditor(){let e;Ot.window.tabGroups.all.find(i=>{i.tabs.find(o=>{uw(o)&&o.input.uri.toString()==this.notebookUri.toString()&&(e=o)})});let t=this.notebookDocument||await this.openNotebookDocument();return await Ot.window.showNotebookDocument(t,{preserveFocus:!0,viewColumn:e?.group.viewColumn})}async openNotebookDocument(){return d.debug(`Opening notebook document ${this.notebookUri}`),await Ot.workspace.openNotebookDocument(this.notebookUri)}dispose(){this.internalDisposables.forEach(e=>e.dispose()),this.controller?.disconnect()}async showErrorForCell(e,t){let n=this.controller?.controller,i=zh(e);if(n&&i&&t){let o=Mi.getOrCreate(t,new Tf(n));try{await o.appendOutput(i)}catch(s){d.warn(`Could not append error message "${i}" to cell: ${s}`)}finally{o.end(!1,t.executionSummary?.timing?.endTime)}}else d.info(`Could not append error message to cell "${i}"`)}changeMode(e){this.controller?.updateMode(e)}async addCode(e,t,n){return this.submitCode(e,t,n,!1)}useNewDebugMode(){return!!(this.configuration.getSettings(this.owner).forceIPyKernelDebugger||this.controller?.metadata&&!ht(this.controller.metadata))}async debugCode(e,t,n){let i=!0,o=Ot.workspace.textDocuments.find(a=>this.fs.arePathsSame(a.uri,t));if(!this.useNewDebugMode()&&o&&o.isUntitled){let a=[...Ot.workspace.textDocuments];if(i=await o.save(),i){let l=Ot.workspace.textDocuments.filter(c=>a.indexOf(c)===-1);l&&l.length>0&&(t=(l.find(u=>u.languageId==="python")||l.find(u=>!u.fileName.endsWith(".interactive"))||l[0]).uri,await Ot.workspace.openTextDocument(t))}}let s=!0;return i?this.submitCode(e,t,n,!0):s}async submitCode(e,t,n,i){if(this.cellMatcher.isEmptyCell(e)||!this.controller?.controller)return!0;this.updateOwners(t);let o=Fe(e,{trim:!1}),s=new so(this.configuration.getSettings(t)),a=-1;s.isMarkdown(o[0])&&xm(o,(u,p)=>void 0,(u,p)=>{u&&u.length>0&&a===-1&&(a=p)});let c=(a>0?[o.slice(0,a).join(`
|
||
`),o.slice(a).join(`
|
||
`)]:[e]).map(u=>{let p=oe();this.controller.setPendingCellAdd(p.promise);let f=this.addNotebookCell(u,t,n),g=this.createExecutionPromise(f,i);return g.catch(v=>{v instanceof Bf?f.then(b=>{v.cell!==b&&this.showErrorForCell(I.cellStopOnErrorMessage,b).then(h,h)}).catch(h):f.then(b=>this.errorHandler.getErrorMessageForDisplayInCell(v,"execution",this.owningResource).then(C=>this.showErrorForCell(C,b))).catch(h)}).finally(()=>{p?.resolve()}),g});return c[c.length-1]}async createExecutionPromise(e,t){if(!this.controller||!this.notebookDocument)return!1;d.ci("InteractiveWindow.ts.createExecutionPromise.start");let n=this.controller.startKernel(),i=await e,o=!0,s=async()=>void 0;try{let a=await n;await this.generateCodeAndAddMetadata(i,t,a),t&&this.useNewDebugMode()?await this.debuggingManager.start(this.notebookDocument,i):t&&ht(a.kernelConnectionMetadata)&&this.interactiveWindowDebugger&&(s=async()=>this.interactiveWindowDebugger?.detach(a),await this.interactiveWindowDebugger.attach(a),await this.interactiveWindowDebugger.updateSourceMaps(this.storageFactory.get({notebook:i.notebook})?.all||[]),this.interactiveWindowDebugger.enable(a)),d.ci("InteractiveWindow.ts.createExecutionPromise.kernel.executeCell");let l=ds(i);o=await this.kernelProvider.getKernelExecution(a).executeCell(i,l?.generatedCode?.code).then(()=>!0,()=>!1),d.ci("InteractiveWindow.ts.createExecutionPromise.kernel.executeCell.finished")}finally{await s(),d.ci("InteractiveWindow.ts.createExecutionPromise.end")}if(!o)throw new Bf(i);return o}async expandAllCells(){this.notebookDocument&&await Promise.all(this.notebookDocument.getCells().map(async(e,t)=>{await Ot.commands.executeCommand("notebook.cell.expandCellInput",{ranges:[{start:t,end:t+1}],document:this.notebookUri})}))}async collapseAllCells(){this.notebookDocument&&await Promise.all(this.notebookDocument.getCells().map(async(e,t)=>{e.kind===Ot.NotebookCellKind.Code&&await Ot.commands.executeCommand("notebook.cell.collapseCellInput",{ranges:[{start:t,end:t+1}],document:this.notebookUri})}))}async scrollToCell(e){let t=await this.showInteractiveEditor(),n=t.notebook.getCells().find(i=>ds(i)?.id===e);if(n){let i=new Ot.NotebookRange(n.index,n.index+1);t.revealRange(i,Ot.NotebookEditorRevealType.Default),t.selection=i}}async hasCell(e){let t=this.notebookDocument;return!!t&&t.getCells().some(n=>ds(n)?.id===e)}get owningResource(){if(this.owner)return this.owner;let e=xl();if(e)return e}updateOwners(e){this._owner||(this._owner=e,this.controller?.updateOwners(e)),this._submitters.find(t=>t.toString()==e.toString())||this._submitters.push(e)}async addNotebookCell(e,t,n){let i=this.notebookDocument;if(!i)throw new Error("No notebook document");let o=this.configuration.getSettings(this.owningResource),s=this.cellMatcher.getCellType(e)===RS,a=s?yk(Fe(e)).join(""):Wz(e,o,this.cellMatcher),l=this.cellMatcher.getFirstMarker(e),c=Ot.workspace.textDocuments.find(v=>v.uri.toString()===this.owner?.toString())?.languageId??ye,u=new Ot.NotebookCellData(s?Ot.NotebookCellKind.Markup:Ot.NotebookCellKind.Code,a,s?RS:c),p={uristring:t.toString(),lineIndex:n,originalSource:e},f={interactiveWindowCellMarker:l,interactive:p,id:(0,Jz.default)()};u.metadata=f,await fc(i,v=>{let b=Ot.NotebookEdit.insertCells(i.cellCount,[u]);v.set(i.uri,[b])});let g=i.cellCount-1;return i.cellAt(g)}async generateCodeAndAddMetadata(e,t,n){let i=ds(e);if(!i)return;let o=!ht(n.kernelConnectionMetadata)||this.configuration.getSettings(void 0).forceIPyKernelDebugger,s=await this.codeGeneratorFactory.getOrCreate(this.notebookDocument).generateCode(i,e.index,t,o),a={...i,generatedCode:s},l=new Ot.WorkspaceEdit,c=Ot.NotebookEdit.updateCellMetadata(e.index,a);l.set(e.notebook.uri,[c]),await Ot.workspace.applyEdit(l)}async export(){if(!this.notebookDocument)throw new Error("no notebook to export.");let e=Uz(this.notebookDocument),t=await new Va().showDialog("ipynb",this.owningResource);t&&await this.jupyterExporter?.exportToFile(e,De(t))}async exportAs(){if(await this.ensureInitialized(),!this.controller)throw new Error("An active kernel is required to export the notebook.");let e=this.controller.kernel?.value,t;if(this.submitters&&this.submitters.length){let n=this.submitters[this.submitters.length-1];t=Ee(n.path,Gi(n.path))}ln()?Ot.commands.executeCommand(q.ExportAsPythonScript,this.notebookDocument,e?.kernelConnectionMetadata.interpreter).then(h,h):Ot.commands.executeCommand(q.Export,this.notebookDocument,t,e?.kernelConnectionMetadata.interpreter).then(h,h)}};y([fA()],qf.prototype,"showErrorForCell",1),y([fA()],qf.prototype,"createExecutionPromise",1);function $z(r){return I.interactiveWindowTitleFormat(Ee(r.path))}var PL=class{constructor(e,t,n,i,o,s,a){this.controllerService=e;this.mode=t;this.notebook=n;this.errorHandler=i;this.kernelProvider=o;this.owner=s;this.disposables=[];this.controller=a?.controller,this.metadata=a?.connection}updateMode(e){this.mode=e}updateOwners(e){this.owner=e}async startKernel(){if(this.connectingListener?.dispose(),this.kernel)return this.kernel.promise;if(!this.controller||!this.metadata)throw new Error("Interactive Window kernel not selected");this.setInfoMessage(this.metadata,0);try{let e=await this.createKernel(),t=async()=>{this.notebook&&this.metadata&&(this.systemInfoCell=void 0,this.setInfoMessage(this.metadata,1))};return this.disposables.push(e.addHook("willRestart",t)),e.onRestarted(async()=>{d.debug("Restart event handled in IW"),this.fileInKernel=void 0;try{await this.setFileInKernel(e)}catch{d.error("Failed to run initialization after restarting")}finally{this.finishSysInfoMessage(e,1)}},this,this.disposables),this.fileInKernel=void 0,await this.setFileInKernel(e),this.finishSysInfoMessage(e,0),e}catch(e){throw this.owner?this.deleteSysInfoCell():await this.finishSysInfoWithFailureMessage(e),e}}async createKernel(){if(this.kernel)return this.kernel.promise;if(!this.controller||!this.metadata)throw new Error("Controller not selected");let e=oe();e.promise.catch(h),this.kernel=e;try{let{kernel:t,actualController:n}=await this.controllerService.createKernel(this.metadata,this.controller,this.owner,this.notebook,this.disposables);return this.metadata=t.kernelConnectionMetadata,this.controller=n,this.disposables.push(t),e.resolve(t),t}catch(t){throw e.reject(t),this.disconnect(),t}}async setFileInKernel(e){let t=this.owner;if(!t){d.ci("Unable to run initialization for IW");return}let n=De(t),i=this.kernelProvider.getKernelExecution(e);this.mode==="perFile"&&!this.fileInKernel?(d.debug(`Initializing __file__ in setFileInKernel with ${t} for mode ${this.mode}`),this.fileInKernel=t,await i.executeHidden(`__file__ = '${n.replace(/\\/g,"\\\\")}'`)):(!this.fileInKernel||this.fileInKernel.toString()!==t.toString())&&this.mode!=="perFile"?(d.debug(`Initializing __file__ in setFileInKernel with ${t} for mode ${this.mode}`),this.fileInKernel=t,await i.executeHidden(`__file__ = '${n.replace(/\\/g,"\\\\")}'`)):d.debug(`Not Initializing __file__ in setFileInKernel with ${n} for mode ${this.mode} currently ${this.fileInKernel}`)}setPendingCellAdd(e){this.metadata&&this.notebook&&this.controllerService.getRegisteredController(this.metadata)?.setPendingCellAddition(this.notebook,e)}listenForControllerSelection(){return this.controllerService.onControllerSelected(e=>{if(!(!this.notebook||e.notebook.uri.toString()!==this.notebook?.uri?.toString())&&e.controller.id!==this.controller?.id){let t=!!this.kernel;this.disconnect(),this.controller=e.controller.controller,this.metadata=e.controller.connection,t?this.startKernel().catch(h):(this.connectingListener?.dispose(),this.connectingListener=e.controller.onConnecting(()=>{this.startKernel().catch(h)}),this.disposables.push(this.connectingListener))}},this)}setInfoMessageCell(e){this.systemInfoCell?this.systemInfoCell.updateMessage(e).catch(t=>d.warn(`could not update info cell with message: "${e}", error: ${t}`)):this.systemInfoCell=new $0(this.notebook,e)}setInfoMessage(e,t){let n=Mz(e,t);this.setInfoMessageCell(n)}finishSysInfoMessage(e,t){let n=Oz(e.kernelConnectionMetadata,t);this.systemInfoCell?.updateMessage(n).catch(i=>d.warn(`System info message was not updated: "${n}" because of error: ${i}`)),this.systemInfoCell=void 0}async finishSysInfoWithFailureMessage(e){let t=await this.errorHandler.getErrorMessageForDisplayInCell(e,"start",this.owner);t=t.split(`
|
||
`).join(`
|
||
`),this.systemInfoCell?.updateMessage(t).catch(n=>d.warn(`System info message was not updated: "${t}" because of error: ${n}`)),this.systemInfoCell=void 0}deleteSysInfoCell(){this.systemInfoCell?.deleteCell().then(h,h),this.systemInfoCell=void 0}disconnect(){this.disposables.forEach(e=>e.dispose()),this.disposables=[],this.kernel=void 0}},pw=class{constructor(e,t,n){this.controllerService=e;this.mode=t;this.initialController=n}create(e,t,n,i){let o=this.initialController,s=this.controllerService.getSelectedController(e);return s&&(o=s),new PL(this.controllerService,this.mode,e,t,n,i,o)}};var Hz="ds_asked_per_file_interactive",Gz="ds_interactive_window_cache",oI=class{constructor(e,t,n,i,o,s,a,l){this.serviceContainer=e;this.disposables=t;this.fs=n;this.configService=i;this.globalMemento=o;this.workspaceMemento=s;this.notebookEditorProvider=a;this.controllerHelper=l;this._onDidChangeActiveInteractiveWindow=new Mr.EventEmitter;this._windows=[];this.notebookEditorProvider.registerEmbedNotebookProvider(this),this.restoreWindows()}get onDidChangeActiveInteractiveWindow(){return this._onDidChangeActiveInteractiveWindow.event}get activeWindow(){let e=Mr.window.activeNotebookEditor?.notebook.uri.toString();return e?this._windows.find(t=>t.notebookUri?.toString()===e):void 0}restoreWindows(){let e=new Map;Mr.window.tabGroups.all.forEach(t=>{t.tabs.forEach(n=>{uw(n)&&n.input.uri&&e.set(n.input.uri.toString(),n)})}),this.workspaceMemento.get(Gz,[]).forEach(t=>{if(!t.uriString||!e.get(t.uriString))return;let n=e.get(t.uriString);if(!n)return;let i=this.configService.getSettings(n.input.uri).interactiveWindowMode,o=new qf(this.serviceContainer,Mr.Uri.parse(t.owner),new pw(this.controllerHelper,i),n,Mr.Uri.parse(t.inputBoxUriString));this.updateExecuteConfigSetting().catch(a=>d.warn("Failed to update executeWithShiftEnter setting",a)),o.notifyConnectionReset(),this._windows.push(o),A("DS_INTERNAL.CREATED_INTERACTIVE_WINDOW",{windowCount:this._windows.length},{hasKernel:!1,hasOwner:!!t.owner,mode:i,restored:!0});let s=o.closed(this.onInteractiveWindowClosed.bind(this,o));this.disposables.push(o),this.disposables.push(s),this.disposables.push(o.onDidChangeViewState(this.raiseOnDidChangeActiveInteractiveWindow.bind(this)))}),this._updateWindowCache()}async getOrCreate(e,t){if(!Mr.workspace.isTrusted)throw new Error("Workspace not trusted");let n=await this.getInteractiveMode(e);this.pendingCreations&&await this.pendingCreations.catch(h);let i=this.getExisting(e,n,t);return i||(i=await this.create(e,n,t)),await i.ensureInitialized(),this.updateExecuteConfigSetting().catch(o=>d.warn("Failed to update executeWithShiftEnter setting",o)),i}async updateExecuteConfigSetting(){let e="updatedExecuteInteractiveConfig";if(this.globalMemento.get(e))return;let n=Mr.workspace.getConfiguration("interactiveWindow"),i=n.inspect("executeWithShiftEnter");i?.workspaceValue===void 0&&i?.workspaceFolderValue===void 0&&i?.globalValue===void 0&&(await n.update("executeWithShiftEnter",!0,Mr.ConfigurationTarget.Global),await this.globalMemento.update(e,void 0))}get(e){let t=this.configService.getSettings(e).interactiveWindowMode;return this.getExisting(e,t)}async create(e,t,n){let i=oe();this.pendingCreations=i.promise;try{let o=await this.controllerHelper.getInitialController(e,n);d.info(`Starting interactive window for resource '${B(e)}' with controller '${o?.id}'`);let[s,a]=await this.createEditor(o,e,t);o&&o.controller.updateNotebookAffinity(a.notebook,Mr.NotebookControllerAffinity.Preferred),d.debug(`Interactive Window Editor Created: ${a.notebook.uri.toString()} with input box: ${s.toString()}`);let l=new qf(this.serviceContainer,e,new pw(this.controllerHelper,t,o),a,s);this._windows.push(l),A("DS_INTERNAL.CREATED_INTERACTIVE_WINDOW",{windowCount:this._windows.length},{hasKernel:!!o,hasOwner:!!e,mode:t,restored:!1}),this._updateWindowCache(),this.lastActiveInteractiveWindow=l;let c=l.closed(this.onInteractiveWindowClosed.bind(this,l));return this.disposables.push(l),this.disposables.push(c),this.disposables.push(l.onDidChangeViewState(this.raiseOnDidChangeActiveInteractiveWindow.bind(this))),l}finally{i.resolve()}}async createEditor(e,t,n){let i=e?`${Ue}/${e.id}`:void 0,o=t!==void 0,s=this.getInteractiveViewColumn(t),{inputUri:a,notebookEditor:l}=await Mr.commands.executeCommand("interactive.open",{viewColumn:s,preserveFocus:o},void 0,i,t&&n==="perFile"?$z(t):void 0);if(!l)throw new Error("Failed to request creation of interactive window from VS Code.");return[a,l]}getInteractiveViewColumn(e){if(e)return Mr.ViewColumn.Beside;let t=this.configService.getSettings(e).interactiveWindowViewColumn;return t==="secondGroup"?Mr.ViewColumn.One:t==="active"?Mr.ViewColumn.Active:Mr.ViewColumn.Beside}async getInteractiveMode(e){let t=this.configService.getSettings(e).interactiveWindowMode;if(t==="multiple"&&e&&!this.globalMemento.get(Hz)&&this._windows.length===1&&(!this._windows[0].owner||!this.fs.arePathsSame(this._windows[0].owner,e))){this.globalMemento.update(Hz,!0).then(h,h);let n=[I.interactiveWindowModeBannerSwitchYes,I.interactiveWindowModeBannerSwitchNo];await Mr.window.showInformationMessage(I.interactiveWindowModeBannerTitle,...n)===n[0]&&(t="perFile",this._windows[0].changeMode(t),await this.configService.updateSetting("interactiveWindow.creationMode",t,e,Mr.ConfigurationTarget.Global))}return t}_updateWindowCache(){let e=this._windows.map(t=>({owner:t.owner?.toString(),uriString:t.notebookUri.toString(),inputBoxUriString:t.inputUri.toString()}));this.workspaceMemento.update(Gz,e).then(h,h)}getExisting(e,t,n){return t==="single"?this._windows.length>0?this._windows[0]:void 0:t==="multiple"?e?this.activeWindow||this.lastActiveInteractiveWindow||this._windows[0]:void 0:this._windows.find(i=>!e&&!i.owner&&!n?!0:e&&i.owner&&this.fs.arePathsSame(e,i.owner)?!n||i.kernelConnectionMetadata?.id===n.id:!1)}raiseOnDidChangeActiveInteractiveWindow(){this.lastActiveInteractiveWindow=this.activeWindow?this.activeWindow:this.lastActiveInteractiveWindow,this._onDidChangeActiveInteractiveWindow.fire(this.activeWindow)}onInteractiveWindowClosed(e){d.debug(`Closing interactive window: ${e.notebookUri?.toString()}`),e.dispose(),this._windows=this._windows.filter(t=>t!==e),this._updateWindowCache(),this.lastActiveInteractiveWindow===e&&(this.lastActiveInteractiveWindow=this._windows[0]),this.raiseOnDidChangeActiveInteractiveWindow()}getActiveOrAssociatedInteractiveWindow(){if(this.activeWindow)return this.activeWindow;if(Mr.window.activeTextEditor===void 0)return;let e=Mr.window.activeTextEditor.document.uri;if(e.scheme!==Mc)return this.get(e)}findNotebookEditor(e){let t;if(e&&e.path.endsWith(".interactive"))t=this.get(e)?.notebookDocument;else{let n=this.configService.getSettings(e).interactiveWindowMode;t=this.getExisting(e,n)?.notebookDocument}return t?Mr.window.visibleNotebookEditors.find(n=>n.notebook===t):void 0}findAssociatedNotebookDocument(e){return this._windows.find(i=>i.inputUri?.toString()===e.toString())?.notebookDocument}getInteractiveWindowWithNotebook(e){let t;return e!==void 0?t=this._windows.find(n=>n.notebookUri?.toString()===e.toString()):t=this.getActiveOrAssociatedInteractiveWindow(),t}getInteractiveWindowsWithSubmitter(e){return this._windows.filter(t=>t.submitters.find(n=>this.fs.arePathsSame(e,n)))}};oI=y([(0,Fo.injectable)(),m(0,(0,Fo.inject)(at)),m(1,(0,Fo.inject)(O)),m(2,(0,Fo.inject)(st)),m(3,(0,Fo.inject)(le)),m(4,(0,Fo.inject)(Ve)),m(4,(0,Fo.named)(ft)),m(5,(0,Fo.inject)(Ve)),m(5,(0,Fo.named)(ci)),m(6,(0,Fo.inject)(bi)),m(7,(0,Fo.inject)(V0))],oI);var Ud=P(M());var sI=class{constructor(e,t,n,i,o){this.kernelProvider=e;this.codeGeneratorFactory=n;this.storageFactory=i;this.controllers=o;this.disposables=[];t.push(this)}dispose(){z(this.disposables)}activate(){this.kernelProvider.onDidCreateKernel(this.onDidCreateKernel,this,this.disposables),this.controllers.onControllerSelected(this.onNotebookControllerSelected,this,this.disposables)}onNotebookControllerSelected({notebook:e}){this.storageFactory.get({notebook:e})?.clear(),this.codeGeneratorFactory.get(e)?.reset()}onDidCreateKernel(e){let t=e.notebook;e.creator!=="jupyterExtension"||t.notebookType!==yt||(this.storageFactory.get({notebook:t})?.clear(),e.onRestarted(()=>{this.storageFactory.get({notebook:t})?.clear(),this.codeGeneratorFactory.getOrCreate(t).reset()},this,this.disposables))}};sI=y([(0,Ud.injectable)(),m(0,(0,Ud.inject)(Te)),m(1,(0,Ud.inject)(O)),m(2,(0,Ud.inject)(zb)),m(3,(0,Ud.inject)(na)),m(4,(0,Ud.inject)(pt))],sI);var lI=P(M()),TQ=require("vscode");var _Q=DQ(),X0=/(;32m[ ->]*?)(\d+)(.*)/g,aI=class{constructor(e,t,n){this.storageFactory=e;this.platformService=t;this.configurationService=n}format(e,t){if(e.notebook.notebookType!==yt)return t;let n=this.storageFactory.get({notebook:e.notebook}),i=t.some(a=>/^[Input|Cell|File].*?\n.*/.test(a));if(!i&&!n)return t;let s=this.configurationService.getSettings(e.document.uri)?.formatStackTraces??!1;return t.map(a=>i?this.modifyTracebackFrameIPython8(a,n?.all,s):s?this.modifyTracebackFrameIPython7(a,n.all):a)}modifyTracebackFrameIPython8(e,t,n){e=e.replace(/\u001b\[4\dm/g,""),e=e.replace(/\u001b\[38;.*?\d+m/g,"\x1B[39m"),e=e.replace(/(;32m[ ->]*?)(\d+)(.*)\n/g,(u,p,f,g)=>(g=g.replace(/\u001b\[3\d+m/g,"\x1B[39m"),`${p}${f}${g}
|
||
`)),d.ci(`Trace frame to match: ${e}`);let i,o,s=/Cell\s+(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\],\s*line (?<lineNumber>\d+).*/,l=/Input\s+?(?:\u001b\[.+?m)?In\s*\[(?<executionCount>\d+)\].*line: (?<lineNumber>\d).*/.exec(e),c=s.exec(e);if(l&&l.groups?.executionCount&&l.groups?.lineNumber?(i=parseInt(l.groups.executionCount),o=l.groups?.lineNumber):c&&c.groups?.executionCount&&c.groups?.lineNumber&&(i=parseInt(c.groups.executionCount),o=c.groups.lineNumber),t&&i){let u,p;for(let f of t)if(p=f.generatedCodes.find(g=>g.executionCount===i),p){u=f.uri;break}if(p&&u){let f=e;return n&&(f=f.replace(X0,(g,v,b,C)=>{let E=parseInt(b,10),L=(p.hasCellMarker?p.line-1:p.line)-1+p.lineOffsetRelativeToIndexOfFirstLineInCell+E;return`${v}<a href='${u?.toString()}?line=${L-1}'>${L}</a>${C}`})),f.replace(/.*?\n/,`File \x1B[1;32m${De(u)}:${o}\x1B[0m
|
||
`)}}if(n){let u=/^File.*?\[\d;32m(.*):\d+.*\u001b.*\n/.exec(e);if(u&&u.length>1){let p=_h(u[1],De(this.platformService.homeDir)),f=TQ.Uri.file(p);return e.replace(X0,(g,v,b,C)=>{let E=parseInt(b,10);return`${v}<a href='${f?.toString()}?line=${E-1}'>${E}</a>${C}`})}}return e}modifyTracebackFrameIPython7(e,t){return t.map(i=>i.uri).forEach(i=>{let o=De(i),s=B(i),a=this.storageFactory.get({fileUri:i});if(a){if(e.includes(o)&&new RegExp(`\\[.*?;32m${_Q(o)}`).test(e)||e.includes(s)&&new RegExp(`\\[.*?;32m${_Q(s)}`).test(e)){let l="",c=/(;32m[ ->]*?)(\d+)(.*)/g;for(let p=c.exec(e);p&&p.length>3;p=c.exec(e)){let f=ac(p[3]).substr(1);l=`${l}${f}
|
||
`}let u=this.findCellOffset(a.getFileGeneratedCode(i),l);u!==void 0&&(e=e.replace(X0,(p,f,g,v)=>{let b=parseInt(g,10),C=u+b-1;return`${f}<a href='${i.toString()}?line=${C}'>${C+1}</a>${v}`}))}if(e.includes(o)){let l=this.findCellOffset(a.getFileGeneratedCode(i),e);if(l)return e.replace(X0,(c,u,p,f)=>{let g=parseInt(p,10),v=l+g-1;return`${u}<a href='${i.toString()}?line=${v}'>${v+1}</a>${f}`})}}}),e}findCellOffset(e,t){if(e){for(let n of e)if(n.trimmedRightCode.indexOf(t)>=0)return n.firstNonBlankLineIndex}}};aI=y([(0,lI.injectable)(),m(0,(0,lI.inject)(na)),m(1,(0,lI.inject)(wr)),m(2,(0,lI.inject)(le))],aI);var Mu=P(M());var mw=class extends On{constructor(e,t,n){let i=t||I.jupyterDebuggerNotInstalledError(e);super("notinstalled",i,n)}};function Z0(r){let e={source:{path:De(r.uri)},pydevdSourceMaps:[]};return e.pydevdSourceMaps=r.generatedCodes.map(t=>({line:t.debuggerStartLine,endLine:t.endLine,runtimeSource:{path:t.runtimeFile},runtimeLine:t.runtimeLine})),e}var cI=class{constructor(e,t,n,i){this.apiProvider=e;this.configService=t;this.debugService=n;this.platform=i;this.configs=new WeakMap;this.debuggingActive=!1;this.debuggerPackage="debugpy",this.enableDebuggerCode="import debugpy;debugpy.listen(('localhost', 0))",this.waitForDebugClientCode="import debugpy;debugpy.wait_for_client()",this.tracingEnableCode="from debugpy import trace_this_thread;trace_this_thread(True)",this.tracingDisableCode="from debugpy import trace_this_thread;trace_this_thread(False)"}async attach(e){if(!e.session)throw new Error("Notebook not initialized");let t=this.configService.getSettings(e.resourceUri),n=e.kernelConnectionMetadata.interpreter?.uri;return this.startDebugSession(i=>this.debugService.startDebugging(void 0,i),e,{justMyCode:t.debugJustMyCode,python:n})}async detach(e){if(!e.session)return;let t=e.notebook;this.configs.get(t)&&(d.info("stop debugging"),this.debuggingActive=!1,this.debugService.stop(),e.status!=="dead"&&e.status!=="unknown"&&this.disable(e))}async updateSourceMaps(e){this.debugService.activeDebugSession&&this.debuggingActive&&(d.ci("Sending debug request for source map"),await Promise.all(e.map(async t=>{if(this.debuggingActive)return this.debugService.activeDebugSession.customRequest("setPydevdSourceMap",Z0(t))})))}enable(e){e.session?.kernel&&bn(e.session.kernel,this.tracingEnableCode,{traceErrors:!0,traceErrorsMessage:"Execute_request failure enabling tracing code for IW",telemetryName:"DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE"}).catch(h)}disable(e){e.session?.kernel&&bn(e.session.kernel,this.tracingDisableCode,{traceErrors:!0,traceErrorsMessage:"Execute_request failure disabling tracing code for IW",telemetryName:"DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE"}).catch(h)}async startDebugSession(e,t,n){if(d.info("start debugging"),!t.session?.kernel)return;let i=await this.connect(t,n);if(i&&(d.info("connected to notebook during debugging"),this.debuggingActive=await e(i),this.debuggingActive)){this.debugService.removeBreakpoints([]);let o=await bn(t.session.kernel,this.waitForDebugClientCode,{traceErrors:!0,traceErrorsMessage:"Execute_request failure starting debug session for IW",telemetryName:"DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE"});o.some(s=>s.output_type==="error")?d.warn(`${this.debuggerPackage} not found in path.`):d.info(`import startup: ${X_(o)}`),await this.disable(t)}}async connect(e,t){let n=e.notebook,i=n,o=this.configs.get(i);if(o)return{...o,...t};d.info("enable debugger attach"),await this.appendDebuggerPaths(e),o={type:"python",name:"IPython",request:"attach",...t};let{host:s,port:a}=await this.connectToLocal(e);if(o.host=s,o.port=a,o.port){this.configs.set(n,o);let l=[],c=()=>{this.configs.delete(i),l.forEach(u=>u.dispose())};l.push(e.onDisposed(c)),l.push(e.onRestarted(c))}return o}async calculateDebuggerPathList(e){let t=[],n=this.configService.getSettings(e.resourceUri).debugpyDistPath;if(n&&(this.platform.isWindows&&(n=n.replace(/\\/g,"\\\\")),t.push(n)),ht(e.kernelConnectionMetadata)){let i=await this.getDebuggerPath();this.platform.isWindows&&(i=i.replace(/\\/g,"\\\\")),t.push(i)}if(t&&t.length>0)return t.reduce((i,o)=>(i.length===0?i=`'${o}'`:i=`${i}, '${o}'`,i),"")}getDebuggerPath(){return this.apiProvider.getApi().then(e=>e.getDebuggerPath())}async appendDebuggerPaths(e){let t=await this.calculateDebuggerPathList(e);if(t&&t.length>0){let n=e.session?.kernel?await bn(e.session.kernel,`import sys as _VSCODE_sys\r
|
||
_VSCODE_sys.path.extend([${t}])\r
|
||
_VSCODE_sys.path\r
|
||
del _VSCODE_sys`,{traceErrors:!0,traceErrorsMessage:"Execute_request failure appending debugger paths for IW",telemetryName:"DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE"}):[];d.info(`Appending paths: ${X_(n)}`)}}async connectToLocal(e){let t=e.session?.kernel?await bn(e.session.kernel,this.enableDebuggerCode,{traceErrors:!0,traceErrorsMessage:"Execute_request failure enabling debugging for IW",telemetryName:"DATASCIENCE.INTERACTIVE_WINDOW_DEBUG_SETUP_CODE_FAILURE"}):[];if(t.length>0)for(let n of t){let i=X_([n]);if(i){i=cm(i);let s=/\('(.*?)', ([0-9]*)\)/.exec(i);if(s)return{port:parseInt(s[2],10),host:s[1]}}}if(t.length>0&&t[0].output_type==="error"){let n=t[0];throw new mw(this.debuggerPackage,n.ename,e.kernelConnectionMetadata)}throw new mw(I.jupyterDebuggerOutputParseError(this.debuggerPackage),void 0,e.kernelConnectionMetadata)}};cI=y([(0,Mu.injectable)(),m(0,(0,Mu.inject)(Yt)),m(1,(0,Mu.inject)(le)),m(2,(0,Mu.inject)(Ua)),m(2,(0,Mu.named)(qe.MULTIPLEXING_DEBUGSERVICE)),m(3,(0,Mu.inject)(wr))],cI);var vc=P(M()),jd=require("vscode");var e1=class{constructor(e,t,n){this.debugAdapter=e;this.debugCell=t;this.execution=n;this._ready=oe();this.ready=this._ready.promise;A("DATASCIENCE.DEBUGGING.SUCCESSFULLY_STARTED_RUN_AND_DEBUG_CELL")}trace(e,t){d.debug(`[Debug-IW] ${e}: ${t}`)}async willSendEvent(e){return SL(e)?(this.trace("intercept","debugpyAttach request for subprocess, not supported"),!0):e.event==="output"&&ZC(e.body.output)?(this.trace("intercept","justMyCode notification"),!0):!1}async willSendRequest(e){let t=ds(this.debugCell);e.command==="setBreakpoints"&&t&&t.generatedCode&&!this.cellDumpInvoked&&(this.debugCellDumped||(this.debugCellDumped=Kf(this.execution,this.debugAdapter)),await this.debugCellDumped),e.command==="configurationDone"&&t&&t.generatedCode&&(this.debugCellDumped||(this.debugCellDumped=Kf(this.execution,this.debugAdapter)),await this.debugCellDumped,this._ready.resolve())}};var t1=class extends Db{constructor(){super(...arguments);this._ready=oe();this.ready=this._ready.promise}resolve(){this._ready.resolve()}};var DL=require("vscode");var r1=class extends Tb{constructor(t,n,i,o,s,a,l){super(t,n,i,o,s,a);this.cellToDebugFileSortedInReverseOrderByLineNumber=[];l&&(this.debugLocationTracker=l.createDebugAdapterTracker(t),this.debugLocationTracker.onWillStartSession&&this.debugLocationTracker.onWillStartSession(),this.onDidSendMessage(c=>{this.debugLocationTracker?.onDidSendMessage&&this.debugLocationTracker.onDidSendMessage(c)},this,this.disposables),this.onDidEndSession(()=>{this.debugLocationTracker?.onWillStopSession&&this.debugLocationTracker.onWillStopSession()},this,this.disposables))}handleClientMessageAsync(t){return d.ci(`KernelDebugAdapter::handleMessage ${JSON.stringify(t,void 0," ")}`),t.type==="request"&&this.debugLocationTracker?.onWillReceiveMessage&&this.debugLocationTracker.onWillReceiveMessage(t),t.type==="response"&&this.debugLocationTracker?.onDidSendMessage&&this.debugLocationTracker.onDidSendMessage(t),super.handleClientMessageAsync(t)}async dumpCell(t){let n=this.notebookDocument.cellAt(t),i=ds(n);if(!i)throw new Error("Not an interactive window cell");try{let o=(i.generatedCode?.code||n.document.getText()).replace(/\r\n/g,`
|
||
`),s=await this.session.customRequest("dumpCell",{code:o}),a=Cn(s.sourcePath);this.fileToCell.set(a,DL.Uri.parse(i.interactive.uristring));let l=0;i.generatedCode&&!i.generatedCode.hasCellMarker&&(l=i.generatedCode.firstNonBlankLineIndex),this.cellToDebugFileSortedInReverseOrderByLineNumber.push({debugFilePath:a,interactiveWindow:DL.Uri.parse(i.interactive.uristring),metadata:i,lineOffset:l+i.interactive.lineIndex+(i.generatedCode?.lineOffsetRelativeToIndexOfFirstLineInCell||0)}),this.cellToDebugFileSortedInReverseOrderByLineNumber.sort((c,u)=>u.metadata.interactive.lineIndex-c.metadata.interactive.lineIndex)}catch(o){d.error(`Failed to dump cell for ${n.index} with code ${i.interactive.originalSource}`,o)}}translateDebuggerLocationToRealLocation(t,n){if(n=t?.source??n,!n||!n.path)return;let i=this.cellToDebugFileSortedInReverseOrderByLineNumber.find(o=>o.debugFilePath===n.path);i&&(n.name=Ee(i.interactiveWindow.path),n.path=i.interactiveWindow.toString(),typeof t?.endLine=="number"&&(t.endLine=t.endLine+(i.lineOffset||0)),typeof t?.line=="number"&&(t.line=t.line+(i.lineOffset||0)))}translateRealLocationToDebuggerLocation(t,n){let i=t.line;if(n=t?.source??n,!n||!n.path||typeof i!="number")return;let o=this.cellToDebugFileSortedInReverseOrderByLineNumber.find(s=>i>=s.metadata.interactive.lineIndex+1);!o||o.interactiveWindow.path!==n.path||(n.path=o.debugFilePath,typeof t?.endLine=="number"&&(t.endLine=t.endLine-(o.lineOffset||0)),typeof t?.line=="number"&&(t.line=t.line-(o.lineOffset||0)))}async sendRequestToJupyterSession(t){if(t.command==="setBreakpoints"){let n=t.arguments;if(delete n.lines,n.source.path!==this.cellToDebugFileSortedInReverseOrderByLineNumber[0]?.interactiveWindow.path)return super.sendRequestToJupyterSession(t);let i,o=[],s=[],a=()=>{if(o.length){let u=JSON.parse(JSON.stringify(t));u.arguments.breakpoints=o,s.push(super.sendRequestToJupyterSession(u))}};for(let u of t.arguments.breakpoints??[]){let p=this.cellToDebugFileSortedInReverseOrderByLineNumber.find(f=>u.line>=f.metadata.generatedCode.line&&u.line<=f.metadata.generatedCode.endLine);if(p&&p.metadata.interactive.lineIndex!==i)a(),i=p.metadata.interactive.lineIndex,o=[u];else if(p)o.push(u);else{let f={...u,verified:!0};s.push(Promise.resolve({body:{breakpoints:[f]}}))}}a();let l=await Promise.all(s),c=JSON.parse(JSON.stringify(l[0]));return l.slice(1).forEach(u=>{c.body.breakpoints=c.body.breakpoints.concat(u.body.breakpoints??[])}),c.command="setBreakpoints",c.type="response",c.success=!0,c.request_seq=t.seq,c}return super.sendRequestToJupyterSession(t)}getDumpFilesForDeletion(){return this.cellToDebugFileSortedInReverseOrderByLineNumber.map(t=>t.debugFilePath)}};var RQ=require("vscode");var n1=class{constructor(e){this.debugCell=e}trace(e,t){d.debug(`[Debug-IWRestart] ${e}: ${t}`)}async willSendResponse(e){e.command==="initialize"&&e.body&&(e.body.supportsRestartRequest=!0)}async willSendRequest(e){if(e.command==="restart")return this.trace("restart","Showing warning for unsupported restart request"),RQ.window.showWarningMessage(I.restartNotSupported,{modal:!0}).then(h,h),{command:e.command,request_seq:e.seq,seq:e.seq,success:!0,type:"response"}}};var uI=class extends _b{constructor(t,n,i,o,s,a,l){super(t,n,l);this.platform=i;this.debugLocationTrackerFactory=o;this.configService=s;this.debugService=a}activate(){super.activate(),this.disposables.push(jd.debug.registerDebugAdapterDescriptorFactory(nx,{createDebugAdapterDescriptor:async t=>this.createDebugAdapterDescriptor(t)}))}getDebugMode(t){return 2}async start(t,n){d.ci("Starting debugging IW"),await this.checkIpykernelAndPrompt(n)===1&&await this.startDebuggingCell(t,n)}async startDebuggingCell(t,n){let i=this.configService.getSettings(t.uri),o={type:nx,name:Ee(t.uri.toString()),request:"attach",justMyCode:i.debugJustMyCode,__notebookUri:t.uri.toString(),__mode:2,__cellIndex:n.index},s={suppressSaveBeforeStart:!0};await this.startDebuggingConfig(o,s);let a=this.notebookToDebugger.get(t);if(!a){d.error("Debugger not found, could not start debugging.");return}await a.ready}async createDebugAdapterDescriptor(t){let n=t.configuration;bz(n);let i=jd.workspace.notebookDocuments.find(s=>s.uri.toString()===n.__notebookUri);if(!i||typeof n.__cellIndex!="number"){d.error("Invalid debug session for debugging of IW using Jupyter Protocol");return}if(this.notebookInProgress.has(i)){d.info("Cannot start debugging. Already debugging this notebook");return}if(this.isDebugging(i)){d.info("Cannot start debugging. Already debugging this notebook document. Toolbar should update");return}let o=new t1(i,n,t);this.notebookToDebugger.set(i,o);try{return this.notebookInProgress.add(i),await this.doCreateDebugAdapterDescriptor(n,t,i,o)}finally{this.notebookInProgress.delete(i)}}async doCreateDebugAdapterDescriptor(t,n,i,o){let s=await this.ensureKernelIsRunning(i);if(!s?.session){jd.window.showInformationMessage(I.kernelWasNotStarted).then(h,h);return}let a=new r1(n,i,s.session,s,this.platform,this.debugService,this.debugLocationTrackerFactory);this.disposables.push(a.onDidEndSession(this.endSession.bind(this)));let l=i.cellAt(t.__cellIndex),c=new e1(a,l,this.kernelProvider.getKernelExecution(s));return a.addDebuggingDelegates([c,new n1(l)]),c.ready.then(()=>o.resolve()).catch(u=>console.error("Failed waiting for controller to be ready",u)),this.trackDebugAdapter(i,a),new jd.DebugAdapterInlineImplementation(a)}async updateSourceMaps(t,n){let i=this.getDebugSession(t.notebook);i&&(d.ci("Sending debug request for source map"),await Promise.all(n.map(async o=>{if(i)return i.customRequest("setPydevdSourceMap",Z0(o))})))}};uI=y([(0,vc.injectable)(),m(0,(0,vc.inject)(Te)),m(1,(0,vc.inject)(pt)),m(2,(0,vc.inject)(wr)),m(3,(0,vc.inject)(f0)),m(4,(0,vc.inject)(le)),m(5,(0,vc.inject)(Li)),m(6,(0,vc.inject)(at))],uI);var fw=P(M()),hw=require("vscode");var AQ="InteractiveShiftEnterBanner";var Wd=class{constructor(e,t){this.persistentState=e;this.configuration=t;this.disabledInCurrentSession=!1;this.bannerMessage=pN.bannerMessage;this.bannerLabels=[me.bannerLabelYes,me.bannerLabelNo];this.initialize()}initialize(){this.initialized||(this.initialized=!0,this.isEnabled())}isEnabled(){return this.persistentState.createGlobalPersistentState("InteractiveShiftEnterBanner",!0).value}async showBanner(){if(!this.isEnabled()||!await this.shouldShowBanner())return;switch(A("DS_INTERNAL.SHIFTENTER_BANNER_SHOWN"),await hw.window.showInformationMessage(this.bannerMessage,...this.bannerLabels)){case this.bannerLabels[0]:{await this.enableInteractiveShiftEnter();break}case this.bannerLabels[1]:{await this.disableInteractiveShiftEnter();break}default:this.disabledInCurrentSession=!0}}async shouldShowBanner(){let e=this.configuration.getSettings();return Promise.resolve(this.isEnabled()&&!this.disabledInCurrentSession&&!e.sendSelectionToInteractiveWindow)}async disableInteractiveShiftEnter(){await this.configuration.updateSetting("interactiveWindow.textEditor.executeSelection",!1,void 0,hw.ConfigurationTarget.Global),await this.disableBanner()}async enableInteractiveShiftEnter(){await this.configuration.updateSetting("interactiveWindow.textEditor.executeSelection",!0,void 0,hw.ConfigurationTarget.Global),await this.disableBanner()}async disableBanner(){await this.persistentState.createGlobalPersistentState("InteractiveShiftEnterBanner",!1).updateValue(!1)}};y([Xr("DATASCIENCE.DISABLE_INTERACTIVE_SHIFT_ENTER")],Wd.prototype,"disableInteractiveShiftEnter",1),y([Xr("DATASCIENCE.ENABLE_INTERACTIVE_SHIFT_ENTER")],Wd.prototype,"enableInteractiveShiftEnter",1),Wd=y([(0,fw.injectable)(),m(0,(0,fw.inject)(yl)),m(1,(0,fw.inject)(le))],Wd);var Jf=P(M()),NQ=require("vscode");var pI=class{constructor(e,t,n,i){this.configService=e;this.fs=t;this.context=n;this.registry=i;this.priority=5}activate(){this.registry.register(this,yt)}async getCode(e){if(!vt(e.kernelConnectionMetadata))return[];if(!ln()){if(this.configService.getSettings(void 0).forceIPyKernelDebugger===!0)return[];if(!ht(e.kernelConnectionMetadata))return[]}if(e.notebook?.notebookType===yt){if(!ht(e.kernelConnectionMetadata))return[];this.addRunCellHookContents||(this.addRunCellHookContents=this.fs.readFile(NQ.Uri.joinPath(this.context.extensionUri,"pythonFiles","vscode_datascience_helpers","kernel","addRunCellHook.py")));let t=await this.addRunCellHookContents;return Fe(t,{trim:!1})}return[]}};pI=y([(0,Jf.injectable)(),m(0,(0,Jf.inject)(le)),m(1,(0,Jf.inject)(st)),m(2,(0,Jf.inject)(ot)),m(3,(0,Jf.inject)(Wc))],pI);var mI=P(M()),fI=require("vscode");var dI=class{constructor(e,t,n){this.dataScienceCodeLensProvider=e;this.extensionContext=t;this.configurationService=n}activate(){this.configurationService.getSettings().pythonCellFolding&&this.extensionContext.subscriptions.push(fI.languages.registerFoldingRangeProvider([Gw],this))}provideFoldingRanges(e,t,n){if([Mc,zw].includes(e.uri.scheme))return;let i=this.dataScienceCodeLensProvider.getCodeWatcher(e);if(i){let o=i.getCodeLenses();return n.isCancellationRequested||o.length==0?void 0:o.map(s=>new fI.FoldingRange(s.range.start.line,s.range.end.line,fI.FoldingRangeKind.Region))}}};dI=y([(0,mI.injectable)(),m(0,(0,mI.inject)(Od)),m(1,(0,mI.inject)(ot)),m(2,(0,mI.inject)(le))],dI);var gw=P(M());var MQ=require("vscode");var hI=class{constructor(e,t){this.dataScienceCodeLensProvider=e;this.extensionContext=t}activate(){this.extensionContext.subscriptions.push(MQ.languages.registerCodeLensProvider([Gw],this.dataScienceCodeLensProvider))}};hI=y([(0,gw.injectable)(),m(0,(0,gw.inject)(Od)),m(1,(0,gw.inject)(ot))],hI);var oa=P(M());var _L="LastInteractiveKernelSelected",gI=class{constructor(e,t,n,i,o){this.controllerRegistration=e;this.interpreterService=t;this.disposables=n;this.workspaceMemento=i;this.serviceContainer=o;this.onControllerSelected=this.controllerRegistration.onControllerSelected}async getInitialController(e,t){if(t){let n=this.controllerRegistration.get(t,yt);if(n)return n}if(this.workspaceMemento.get(_L)){let n=this.workspaceMemento.get(_L),i=n?this.controllerRegistration.get(n,yt):void 0;if(i)return i}if(this.interpreterService)return await sIe(yt,e,this.interpreterService,this.controllerRegistration)}getSelectedController(e){return this.controllerRegistration.getSelected(e)}getRegisteredController(e){return this.controllerRegistration.get(e,"interactive")}async createKernel(e,t,n,i,o){await Qs(n,e);let s=(u,p)=>{u!=="start"&&u!=="restart"||d.ci(`(onStart) Looking for controller ${p.controller.id} in ${this.controllerRegistration.all.map(f=>`${f.kind}:${f.id}`).join(", ")}`)},a=await ta.connectToNotebookKernel(e,this.serviceContainer,{resource:n||i.uri,notebook:i,controller:t},new Ht(!1),o,"jupyterExtension",s),l=this.controllerRegistration.registered.find(u=>u.id===a.controller.id);if(!l)throw Error(`Controller ${a.controller.id} not found or not yet created`);let c=l.controller;return this.interpreterService&&aIe(a.kernelConnectionMetadata,n,this.interpreterService).then(async u=>{await this.workspaceMemento.update(_L,u?void 0:a.kernelConnectionMetadata)}).catch(u=>{d.warn("Failed to store kernel connection metadata",u)}),{kernel:a,actualController:c}}};gI=y([(0,oa.injectable)(),m(0,(0,oa.inject)(pt)),m(1,(0,oa.inject)(rt)),m(1,(0,oa.optional)()),m(2,(0,oa.inject)(O)),m(3,(0,oa.inject)(Ve)),m(3,(0,oa.named)(ci)),m(4,(0,oa.inject)(at))],gI);async function sIe(r,e,t,n){let i=await t.getActiveInterpreter(e);if(i){let o=await Os(i),s=qo.create({kernelSpec:o,interpreter:i,id:Oi(o,i)}),a=n.addOrUpdate(s,[r]),l=a[0];return n.trackActiveInterpreterControllers(a),d.ci(`Active Interpreter Controller ${l.connection.kind}:${l.id} created for View ${r} with resource ${B(e)}`),l}}async function aIe(r,e,t){return(await t.getActiveInterpreter(e))?.id===r.interpreter?.id}function OQ(r){r.addSingleton(qi,oI),r.addSingleton(V0,gI),r.addSingleton(ge,Ko),r.addSingleton(ge,nI),r.add(U0,Qt),r.addSingleton(j0,Xb),r.addSingleton(Od,Zb),r.addSingleton(ge,hI),r.addSingleton(ge,dI),r.addSingleton(ge,eI),r.addSingleton(ge,sI),r.addSingleton(ge,pI),r.addSingleton(zb,Qb,void 0,[ge]),r.addSingleton(na,rI),r.addSingleton(mg,aI),r.addSingleton(W0,cI),r.addSingleton(B0,uI,void 0,[ge]),r.addSingleton(xV,Wd,AQ)}var Vd=P(M()),yc=require("vscode");var vI=class{constructor(e,t,n){this.jupyterServerHelper=e;this.fileSystem=t;this.errorHandler=n;this.extractPythonMainVersion=async()=>{if(!this.jupyterServerHelper)return 3;let e=await this.jupyterServerHelper.getUsableJupyterPython(),t=await ap(e);return e&&t&&t.major||3}}async exportToFile(e,t,n=!0){let i=await this.serialize(e);try{if(await this.fileSystem.writeFile(yc.Uri.file(t),i||""),!n)return;let o=I.exportOpenQuestion1;yc.window.showInformationMessage(I.exportDialogComplete(t),o).then(async s=>{try{s===o&&await J0(yc.Uri.file(t))}catch(a){await this.errorHandler.handleError(a)}},h)}catch(o){d.error("Error in exporting notebook file"),yc.window.showInformationMessage(I.exportDialogFailed(o)).then(h,h)}}async serialize(e,t){let n=await this.extractPythonMainVersion(),i={language_info:{codemirror_mode:{name:"ipython",version:n},file_extension:".py",mimetype:"text/x-python",name:"python",nbconvert_exporter:"python",pygments_lexer:`ipython${n}`,version:n},kernelspec:t},o=yc.extensions.getExtension("vscode.ipynb")?.exports;if(!o)throw new Error("vscode.ipynb extension not found");let s=new yc.NotebookData(e);return s.metadata={metadata:i,nbformat:pA.major,nbformat_minor:pA.minor},o.exportNotebook(s)}};vI=y([(0,Vd.injectable)(),m(0,(0,Vd.inject)(Ip)),m(0,(0,Vd.optional)()),m(1,(0,Vd.inject)(st)),m(2,(0,Vd.inject)(Zr))],vI);var Bd=P(M()),KQ=require("vscode");var yI=class{constructor(e,t,n,i,o){this.fs=e;this.disposableRegistry=t;this.configuration=n;this.nbConvertDependencyChecker=i;this.exportToPythonService=o;this.isDisposed=!1;this.nbconvertBaseTemplateFormat=`{%- extends '{0}' -%}
|
||
{% block codecell %}
|
||
{1}
|
||
{{ super() }}
|
||
{% endblock codecell %}
|
||
{% block in_prompt %}{% endblock in_prompt %}
|
||
{% block input %}{{ cell.source | ipython2python }}{% endblock input %}
|
||
{% block markdowncell scoped %}{1} [markdown]
|
||
{{ cell.source | comment_lines }}
|
||
{% endblock markdowncell %}`;this.nbconvert5Null="null.tpl";this.nbconvert6Null="base/null.j2";this.dispose=()=>{this.isDisposed=!0};this.addInstructionComments=e=>I.instructionComments(this.defaultCellMarker).concat(e);this.addIPythonImport=e=>jS(bh.ImportIPython,this.defaultCellMarker,e)}async importFromFile(e,t){let n=await this.nbConvertDependencyChecker.getNbConvertVersion(t);if(n){let i;n.major>=6?(this.template6Promise||(this.template6Promise=this.createTemplateFile(!0)),i=await this.template6Promise):(this.template5Promise||(this.template5Promise=this.createTemplateFile(!1)),i=await this.template5Promise);let o=await this.exportToPythonService.exportNotebookToPython(e,t,i);return o.includes("get_ipython()")&&(o=this.addIPythonImport(o)),this.addInstructionComments(o)}throw new Error(I.jupyterNbConvertNotSupported)}get defaultCellMarker(){return this.configuration.getSettings().defaultCellMarker||qe.DefaultCodeCellMarker}async createTemplateFile(e){let t=await this.fs.createTemporaryLocalFile(".tpl");if(t)try{return this.disposableRegistry.push(t),await this.fs.writeFile(KQ.Uri.file(t.filePath),jS(this.nbconvertBaseTemplateFormat,e?this.nbconvert6Null:this.nbconvert5Null,this.defaultCellMarker)),t.filePath}catch{}}};yI=y([(0,Bd.injectable)(),m(0,(0,Bd.inject)(mr)),m(1,(0,Bd.inject)(O)),m(2,(0,Bd.inject)(le)),m(3,(0,Bd.inject)(Cg)),m(4,(0,Bd.inject)($k))],yI);var sa=P(M());var ms=require("vscode");var i1=class{constructor(e,t,n,i,o,s){this.fileConverter=e;this.fs=t;this.interactiveProvider=n;this.controllerRegistration=i;this.preferredKernel=o;this.kernelFinder=s;this.disposables=[]}register(){this.registerCommand(q.ExportAsPythonScript,(e,t)=>this.export(e,"python",void 0,t)),this.registerCommand(q.ExportToHTML,(e,t,n)=>this.export(e,"html",t,n)),this.registerCommand(q.ExportToPDF,(e,t,n)=>this.export(e,"pdf",t,n)),this.registerCommand(q.Export,(e,t,n)=>this.export(e,void 0,t,n)),this.registerCommand(q.NativeNotebookExport,e=>this.nativeNotebookExport(e))}dispose(){this.disposables.forEach(e=>e.dispose())}registerCommand(e,t){let n=ms.commands.registerCommand(e,t,this);this.disposables.push(n)}async nativeNotebookExport(e){let t=xn(e)?e:e?.notebookEditor?.notebookUri,n=t?ms.workspace.notebookDocuments.find(i=>this.fs.arePathsSame(i.uri,t)):ms.window.activeNotebookEditor?.notebook;if(n){let i,o=this.kernelFinder.registered.find(l=>l.kind==="localPythonEnvironment"),s=new ms.CancellationTokenSource;try{i=o?await this.preferredKernel.findPreferredLocalKernelSpecConnection(n,o,s.token).then(l=>l?.interpreter):void 0}finally{s.dispose()}let a=this.controllerRegistration.getSelected(n)?.connection.interpreter||i;return this.export(n,void 0,void 0,a)}else return this.export(void 0,void 0,void 0,void 0)}async export(e,t,n,i){if(!e){if(e=ms.window.activeNotebookEditor?.notebook||this.interactiveProvider?.getActiveOrAssociatedInteractiveWindow()?.notebookDocument,!e){d.info("Export called without a valid exportable document active");return}i=i||this.controllerRegistration.getSelected(e)?.connection.interpreter,t&&A("DATASCIENCE.EXPORT_NOTEBOOK_AS_COMMAND",void 0,{format:t})}if(t)await this.fileConverter.export(t,e,n,i);else{let o=await this.showExportQuickPickMenu(e,n,i).then(s=>s);o!==void 0?o.handler():A("DATASCIENCE.CLICKED_EXPORT_NOTEBOOK_AS_QUICK_PICK")}}getExportQuickPickItems(e,t,n){let i=[];return(n||e.metadata&&Mk(yo(e)))&&i.push({label:I.exportPythonQuickPickLabel,picked:!0,handler:()=>{A("DATASCIENCE.CLICKED_EXPORT_NOTEBOOK_AS_QUICK_PICK",void 0,{format:"python"}),ms.commands.executeCommand(q.ExportAsPythonScript,e,n).then(h,h)}}),i.push({label:I.exportHTMLQuickPickLabel,picked:!1,handler:()=>{A("DATASCIENCE.CLICKED_EXPORT_NOTEBOOK_AS_QUICK_PICK",void 0,{format:"html"}),ms.commands.executeCommand(q.ExportToHTML,e,t,n).then(h,h)}},{label:I.exportPDFQuickPickLabel,picked:!1,handler:()=>{A("DATASCIENCE.CLICKED_EXPORT_NOTEBOOK_AS_QUICK_PICK",void 0,{format:"pdf"}),ms.commands.executeCommand(q.ExportToPDF,e,t,n).then(h,h)}}),i}async showExportQuickPickMenu(e,t,n){let i=this.getExportQuickPickItems(e,t,n),o={ignoreFocusOut:!1,matchOnDescription:!0,matchOnDetail:!0,placeHolder:I.exportAsQuickPickPlaceholder};return ms.window.showQuickPick(i,o)}};var o1=require("vscode");var bI=class{constructor(e,t,n,i,o,s,a){this.disposables=e;this.fileConverter=t;this.fs=n;this.interactiveProvider=i;this.controllerSelection=o;this.kernelFinder=s;this.jupyterConnection=a;this.exportCommand=new i1(this.fileConverter,this.fs,this.interactiveProvider,o,new Dd(a),s),o1.workspace.isTrusted||o1.workspace.onDidGrantWorkspaceTrust(this.registerCommandsIfTrusted,this,this.disposables)}activate(){this.registerCommandsIfTrusted()}registerCommandsIfTrusted(){o1.workspace.isTrusted&&this.exportCommand?.register()}};bI=y([(0,sa.injectable)(),m(0,(0,sa.inject)(O)),m(1,(0,sa.inject)(Ob)),m(2,(0,sa.inject)(st)),m(3,(0,sa.inject)(qi)),m(3,(0,sa.optional)()),m(4,(0,sa.inject)(pt)),m(5,(0,sa.inject)(Rr)),m(6,(0,sa.inject)(pn))],bI);var qd=P(M()),SI=require("vscode");var FQ=require("vscode");var TL="JVSC_NEVER_PROMPT_EXTENSIONS_LIST",lIe=new Map([["ms-dotnettools.dotnet-interactive-vscode",{displayName:".NET Interactive Notebooks Preview",extensionLink:"https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.dotnet-interactive-vscode"}]]),cIe=new Map([["c#","ms-dotnettools.dotnet-interactive-vscode"],["csharp","ms-dotnettools.dotnet-interactive-vscode"],["f#","ms-dotnettools.dotnet-interactive-vscode"],["fsharp","ms-dotnettools.dotnet-interactive-vscode"],["powershell","ms-dotnettools.dotnet-interactive-vscode"]]),II=class{constructor(e,t,n){this.controllerManager=e;this.globalMemento=n;this.disposables=[];this.recommendedInSession=new Set;t.push(this)}dispose(){z(this.disposables)}activate(){SI.workspace.onDidOpenNotebookDocument(this.onDidOpenNotebookDocument,this,this.disposables),this.controllerManager.onControllerSelected(this.onNotebookControllerSelected,this,this.disposables)}onDidOpenNotebookDocument(e){if(!Dt(e))return;let t=Kk(yo(e));t&&this.recommendExtensionForLanguage(t).catch(h)}onNotebookControllerSelected({controller:e}){if(e.connection.kind!=="startUsingLocalKernelSpec"&&e.connection.kind!=="startUsingRemoteKernelSpec"||vt(e.connection))return;let t=Io(e.connection);t&&this.recommendExtensionForLanguage(t).catch(h)}async recommendExtensionForLanguage(e){let t=cIe.get(e.toLowerCase());if(!t||FQ.extensions.getExtension(t))return;let n=lIe.get(t);if(!n||this.globalMemento.get(TL,[]).includes(t)||this.recommendedInSession.has(t))return;this.recommendedInSession.add(t);let i=I.recommendExtensionForNotebookLanguage(`[${n.displayName}](${n.extensionLink})`,e);switch(A("DATASCIENCE.RECOMMENT_EXTENSION",void 0,{extensionId:t,action:"displayed"}),await SI.window.showInformationMessage(i,me.bannerLabelYes,me.bannerLabelNo,me.doNotShowAgain)){case me.bannerLabelYes:{A("DATASCIENCE.RECOMMENT_EXTENSION",void 0,{extensionId:t,action:"ok"}),SI.commands.executeCommand("extension.open",t).then(h,h);break}case me.bannerLabelNo:{A("DATASCIENCE.RECOMMENT_EXTENSION",void 0,{extensionId:t,action:"cancel"});break}case me.doNotShowAgain:{A("DATASCIENCE.RECOMMENT_EXTENSION",void 0,{extensionId:t,action:"doNotShowAgain"});let s=this.globalMemento.get(TL,[]);s.includes(t)||(s.push(t),await this.globalMemento.update(TL,s));break}default:A("DATASCIENCE.RECOMMENT_EXTENSION",void 0,{extensionId:t,action:"dismissed"})}}};II=y([(0,qd.injectable)(),m(0,(0,qd.inject)(pt)),m(1,(0,qd.inject)(O)),m(2,(0,qd.inject)(Ve)),m(2,(0,qd.named)(ft))],II);var bc=P(M()),Ji=require("vscode");var xI=class{constructor(e,t,n,i,o){this.interactiveProvider=e;this.kernelProvider=n;this.controllers=i;this.jupyterUriProviderRegistration=o;this.disposables=[];this.isPythonFileActive=!1;t.push(this),this.nativeContext=new sr(yr.IsNativeActive),this.canRestartNotebookKernelContext=new sr(yr.CanRestartNotebookKernel),this.canInterruptNotebookKernelContext=new sr(yr.CanInterruptNotebookKernel),this.canRestartInteractiveWindowKernelContext=new sr(yr.CanRestartInteractiveWindowKernel),this.canInterruptInteractiveWindowKernelContext=new sr(yr.CanInterruptInteractiveWindowKernel),this.interactiveContext=new sr(yr.IsInteractiveActive),this.interactiveOrNativeContext=new sr(yr.IsInteractiveOrNativeActive),this.pythonOrNativeContext=new sr(yr.IsPythonOrNativeActive),this.pythonOrInteractiveContext=new sr(yr.IsPythonOrInteractiveActive),this.pythonOrInteractiveOrNativeContext=new sr(yr.IsPythonOrInteractiveOrNativeActive),this.hasNativeNotebookCells=new sr(yr.HaveNativeCells),this.isPythonNotebook=new sr(yr.IsPythonNotebook),this.isJupyterKernelSelected=new sr(yr.IsJupyterKernelSelected),this.hasNativeNotebookOrInteractiveWindowOpen=new sr(yr.HasNativeNotebookOrInteractiveWindowOpen),this.kernelSourceContext=new sr(yr.KernelSource)}dispose(){this.disposables.forEach(e=>e.dispose())}activate(){Ji.window.onDidChangeActiveTextEditor(this.onDidChangeActiveTextEditor,this,this.disposables),this.kernelProvider.onKernelStatusChanged(this.onDidKernelStatusChange,this,this.disposables),this.interactiveProvider&&(this.interactiveProvider.onDidChangeActiveInteractiveWindow(this.onDidChangeActiveInteractiveWindow,this,this.disposables),this.interactiveProvider.activeWindow&&this.onDidChangeActiveInteractiveWindow()),Ji.window.activeNotebookEditor&&this.onDidChangeActiveNotebookEditor(Ji.window.activeNotebookEditor),Ji.window.onDidChangeActiveNotebookEditor(this.onDidChangeActiveNotebookEditor,this,this.disposables),Ji.window.activeTextEditor?.document.languageId===ye&&this.onDidChangeActiveTextEditor(Ji.window.activeTextEditor),Ji.window.onDidChangeNotebookEditorSelection(this.updateNativeNotebookInteractiveWindowOpenContext,this,this.disposables),Ji.workspace.onDidOpenNotebookDocument(this.updateNativeNotebookInteractiveWindowOpenContext,this,this.disposables),Ji.workspace.onDidCloseNotebookDocument(this.updateNativeNotebookInteractiveWindowOpenContext,this,this.disposables),this.controllers.onControllerSelectionChanged(()=>this.updateSelectedKernelContext(),this,this.disposables),this.updateSelectedKernelContext()}updateNativeNotebookCellContext(){let e=(Ji.window.activeNotebookEditor?.notebook.cellCount||0)>0;this.hasNativeNotebookCells.set(e).catch(h)}onDidChangeActiveInteractiveWindow(e){this.interactiveContext.set(!!e).catch(h),this.updateNativeNotebookInteractiveWindowOpenContext(),this.updateMergedContexts(),this.updateContextOfActiveInteractiveWindowKernel()}onDidChangeActiveNotebookEditor(e){let t=e?e.notebook.notebookType===Et:!1;this.nativeContext.set(t).catch(h),this.isPythonNotebook.set(e&&t?Mk(yo(e.notebook)):!1).catch(h),this.updateContextOfActiveNotebookKernel(e),this.updateContextOfActiveInteractiveWindowKernel(),this.updateNativeNotebookInteractiveWindowOpenContext(),this.updateNativeNotebookCellContext(),this.updateMergedContexts()}updateNativeNotebookInteractiveWindowOpenContext(){this.hasNativeNotebookOrInteractiveWindowOpen.set(Ji.workspace.notebookDocuments.some(e=>e.notebookType===Et||e.notebookType===yt)).catch(h)}updateContextOfActiveNotebookKernel(e){let t=e&&e.notebook.notebookType===Et?this.kernelProvider.get(e.notebook):void 0;if(t){let n=this.kernelProvider.getKernelExecution(t),i=t.status!=="unknown"||n.executionCount>0||t.startedAtLeastOnce;this.canRestartNotebookKernelContext.set(!!i).catch(h);let o=t.status==="busy";this.canInterruptNotebookKernelContext.set(!!o).catch(h)}else this.canRestartNotebookKernelContext.set(!1).catch(h),this.canInterruptNotebookKernelContext.set(!1).catch(h);this.updateKernelSourceContext(t).catch(h),this.updateSelectedKernelContext()}async updateKernelSourceContext(e){if(!e||!Nt(e.kernelConnectionMetadata)){this.kernelSourceContext.set("").catch(h);return}let t=e.kernelConnectionMetadata,n=await this.jupyterUriProviderRegistration.jupyterCollections.find(i=>i.extensionId===t.serverProviderHandle.extensionId&&i.id===t.serverProviderHandle.id);if(!n){this.kernelSourceContext.set("").catch(h);return}this.kernelSourceContext.set(n.id).catch(h)}updateSelectedKernelContext(){let e=Ji.window.activeNotebookEditor?.notebook||this.interactiveProvider?.getActiveOrAssociatedInteractiveWindow()?.notebookDocument;e&&Dt(e)&&this.controllers.getSelected(e)?this.isJupyterKernelSelected.set(!0).catch(h):this.isJupyterKernelSelected.set(!1).catch(h)}updateContextOfActiveInteractiveWindowKernel(){let e=this.interactiveProvider?.getActiveOrAssociatedInteractiveWindow()?.notebookDocument,t=e?this.kernelProvider.get(e):void 0;if(t){let n=t.status!=="unknown";this.canRestartInteractiveWindowKernelContext.set(!!n).catch(h);let i=t.status==="busy";this.canInterruptInteractiveWindowKernelContext.set(!!i).catch(h)}else this.canRestartInteractiveWindowKernelContext.set(!1).catch(h),this.canInterruptInteractiveWindowKernelContext.set(!1).catch(h);this.updateSelectedKernelContext()}onDidKernelStatusChange({kernel:e}){let t=e.notebook;t.notebookType===yt?this.updateContextOfActiveInteractiveWindowKernel():t.notebookType===Et&&t===Ji.window.activeNotebookEditor?.notebook&&this.updateContextOfActiveNotebookKernel(Ji.window.activeNotebookEditor)}onDidChangeActiveTextEditor(e){this.isPythonFileActive=e?.document.languageId===ye&&!r2(e.document.uri),this.updateNativeNotebookCellContext(),this.updateMergedContexts(),this.updateContextOfActiveInteractiveWindowKernel()}updateMergedContexts(){this.interactiveOrNativeContext.set(this.nativeContext.value===!0||this.interactiveContext.value===!0).catch(h),this.pythonOrNativeContext.set(this.nativeContext.value===!0||this.isPythonFileActive===!0).catch(h),this.pythonOrInteractiveContext.set(this.interactiveContext.value===!0||this.isPythonFileActive===!0).catch(h),this.pythonOrInteractiveOrNativeContext.set(this.nativeContext.value===!0||this.interactiveContext.value===!0&&this.isPythonFileActive===!0).catch(h)}};xI=y([(0,bc.injectable)(),m(0,(0,bc.inject)(qi)),m(0,(0,bc.optional)()),m(1,(0,bc.inject)(O)),m(2,(0,bc.inject)(Te)),m(3,(0,bc.inject)(pt)),m(4,(0,bc.inject)($t))],xI);var s1=P(M()),Ic=require("vscode");var uIe=/^\s*(from (?<fromImport>\w+)(?:\.\w+)* import \w+(?:, \w+)*(?: as \w+)?|import (?<importImport>\w+(?:, \w+)*)(?: as \w+)?)$/,pIe=1e3,dIe=_r(),CI=class{constructor(e,t=1e3){this.pendingChecks=new So;this.disposables=new $r;this.sentMatches=new Set;this.processedNotebookCells=new WeakMap;e.push(this.disposables),this.disposables.add(new Ic.Disposable(()=>z(this.pendingChecks.values()))),this.isTelemetryDisabled=rk(),this.disposables.add(Ic.workspace.onDidOpenNotebookDocument(i=>this.onOpenedOrClosedNotebookDocument(i,"onOpenCloseOrSave"))),this.disposables.add(Ic.workspace.onDidCloseNotebookDocument(i=>this.onOpenedOrClosedNotebookDocument(i,"onOpenCloseOrSave"))),this.disposables.add(Ic.workspace.onDidSaveNotebookDocument(i=>this.onOpenedOrClosedNotebookDocument(i,"onOpenCloseOrSave")));let n=this.disposables.add(new bs(t));this.disposables.add(or.onDidChangeNotebookCellExecutionState(i=>{n.trigger(()=>{i.state==2&&!this.isTelemetryDisabled&&this.checkNotebookCell(i.cell,"onExecution").catch(h)})},this)),this.disposables.add(nk(i=>this.isTelemetryDisabled=i))}activate(){Ic.workspace.notebookDocuments.forEach(e=>this.checkNotebookDocument(e,"onOpenCloseOrSave"))}getDocumentLines(e){let t=[];for(let n=0;n<Math.min(pIe,e.lineCount);n++){let i=e.lineAt(n);i.isEmptyOrWhitespace||t.push(i.text.trim())}return t}onOpenedOrClosedNotebookDocument(e,t){!Dt(e)||this.isTelemetryDisabled||this.scheduleCheck(e.uri,this.checkNotebookDocument.bind(this,e,t))}scheduleCheck(e,t){let n=this.pendingChecks.get(e);if(n&&(n.dispose(),this.pendingChecks.delete(e)),dIe)t();else{let i=setTimeout(t,5e3);this.pendingChecks.set(e,new Ic.Disposable(()=>clearTimeout(i)))}}async checkNotebookDocument(e,t){!Dt(e)||this.isTelemetryDisabled||await Promise.all(e.getCells().map(async n=>this.checkNotebookCell(n,t)))}async checkNotebookCell(e,t){if(!(!Dt(e.notebook)||e.kind!==Ic.NotebookCellKind.Code||e.document.languageId!==ye||this.processedNotebookCells.get(e)===e.document.version))try{this.processedNotebookCells.set(e,e.document.version);let n=e.notebook.notebookType===Et?"notebook":"interactive";await this.sendTelemetryForImports(this.getDocumentLines(e.document),n,t)}catch(n){if(!wi)throw n}}lookForImports(e){let t=[];try{for(let n of e){if(!n.includes("import")&&!n.includes("from"))continue;let i=n?uIe.exec(n):null;i!==null&&i.groups!==void 0&&(i.groups.fromImport!==void 0?t.push(i.groups.fromImport):i.groups.importImport!==void 0&&t.push(...i.groups.importImport.split(",").map(o=>o.trim())))}}catch{}return t}async sendTelemetryForImports(e,t,n){await Promise.all(this.lookForImports(e).map(async i=>{let o=`${i}_${t||""}_${n}`;if(this.sentMatches.has(o))return;this.sentMatches.add(o);let s=await mt(i);A("HASHED_PACKAGE_NAME",void 0,{hashedNamev2:s,resourceType:t,when:n})}))}};CI=y([(0,s1.injectable)(),m(0,(0,s1.inject)(O))],CI);var Sc=P(M());var RL=require("vscode");var wI=class{constructor(e,t,n,i){this.disposableRegistry=e;this.configuration=t;this.rawSupported=n;this.commandListeners=i;this.isDisposed=!1;this.startTime=Date.now();this.onSettingsChanged=()=>{let t=this.configuration.getSettings(void 0).sendSelectionToInteractiveWindow;new sr(yr.OwnsSelection).set(t).catch(h)}}get activationStartTime(){return this.startTime}activate(){this.onSettingsChanged(),this.changeHandler=this.configuration.getSettings(void 0).onDidChange(this.onSettingsChanged.bind(this)),this.disposableRegistry.push(this),this.disposableRegistry.push(RL.window.onDidChangeActiveTextEditor(()=>this.onChangedActiveTextEditor())),this.onChangedActiveTextEditor(),this.computeZmqAvailable(),this.commandListeners&&this.commandListeners.forEach(e=>e.register())}async dispose(){this.changeHandler&&(this.changeHandler.dispose(),this.changeHandler=void 0)}computeZmqAvailable(){new sr(yr.ZmqAvailable).set(this.rawSupported?this.rawSupported.isSupported:!1).then(h,h)}onChangedActiveTextEditor(){let e=new sr(yr.HasCodeCells),t=RL.window.activeTextEditor;t&&t.document.languageId===ye?e.set(Lz(t.document,this.configuration.getSettings())).catch(h):e.set(!1).catch(h)}};wI=y([(0,Sc.injectable)(),m(0,(0,Sc.inject)(O)),m(1,(0,Sc.inject)(le)),m(2,(0,Sc.inject)(hi)),m(2,(0,Sc.optional)()),m(3,(0,Sc.multiInject)(qh))],wI);var Ii=P(M()),a1=require("vscode");var Hf=P(M()),$f=require("vscode");var UQ=require("vscode");var AL="JUPYTER_API_ACCESS_INFORMATION",LQ=new Set([Ue.split(".")[0],"rchiodo","donjayamanne","SynapseVSCode"]),NL=new Set(["rchiodo","nuant"]),Ou=class{constructor(e,t){this.globalState=e;this.context=t;this.extensionAccess=new Map;this.promiseChain=new Ch}async getAccessInformation(e){let t=!e.extensionId||e.extensionId===xh?"":e.extensionId.split(".")[0]||"";if(this.context.extensionMode===$f.ExtensionMode.Test||!t||js()==="insiders"){if(!LQ.has(t)&&!NL.has(t)){d.warn(`Publisher ${t} is allowed to access the Kernel API with a message.`);let s=UQ.extensions.getExtension(e.extensionId)?.packageJSON?.displayName||"",a=s&&e.extensionId?`${s} (${e.extensionId})`:e.extensionId||t;$f.window.showErrorMessage(I.thanksForUsingJupyterKernelApiPleaseRegisterWithUs(a)).then(h,h)}if(!NL.has(t)||!t||this.context.extensionMode===$f.ExtensionMode.Test)return{extensionId:e.extensionId,accessAllowed:!0}}if(LQ.has(t))return{extensionId:e.extensionId,accessAllowed:!0};if(!NL.has(t))return $f.window.showErrorMessage(`Please contact the Jupyter Extension to get access to the Kernel API. Publisher ${t}`).then(h,h),d.error(`Publisher ${t} is not allowed to access the Kernel API.`),{extensionId:e.extensionId,accessAllowed:!1};let i=this.globalState.get(AL)?.find(s=>s.extensionId===e.extensionId);if(i)return A("DATASCIENCE.JUPYTER_KERNEL_API_ACCESS",void 0,{extensionId:e.extensionId,allowed:i.allowed}),{extensionId:e.extensionId,accessAllowed:i.allowed==="yes"};if(this.extensionAccess.get(e.extensionId))return this.extensionAccess.get(e.extensionId);let o=(async()=>{let s=I.allowExtensionToUseJupyterKernelApi(`${e.displayName} (${e.extensionId})`,me.bannerLabelYes),l=await $f.window.showInformationMessage(s,{modal:!0},me.bannerLabelYes,me.bannerLabelNo)===me.bannerLabelYes;return this.promiseChain.chainFinally(async()=>{let c=[...this.globalState.get(AL,[])];return c=c.filter(u=>u.extensionId!==e.extensionId),c.push({allowed:l?"yes":"no",extensionId:e.extensionId}),this.globalState.update(AL,c)}).then(h,h),A("DATASCIENCE.JUPYTER_KERNEL_API_ACCESS",void 0,{extensionId:e.extensionId,allowed:l?"yes":"no"}),{extensionId:e.extensionId,accessAllowed:l}})();return this.extensionAccess.set(e.extensionId,o),o}};Ou=y([(0,Hf.injectable)(),m(0,(0,Hf.inject)(Ve)),m(0,(0,Hf.named)(ft)),m(1,(0,Hf.inject)(ot))],Ou);var jQ=new WeakMap;function ML(r){let e=jQ.get(r);return e||(e=mIe(r),jQ.set(r,e)),e}function mIe(r){return new Proxy(r,{get(e,t){return t==="kernel"?e.kernel?fIe(e.kernel):void 0:Reflect.get(e,t)}})}var WQ=new WeakMap;function fIe(r){let e=WQ.get(r);return e||(e=hIe(r),WQ.set(r,e)),e}function hIe(r){return new Proxy(r,{get(e,t){return t==="registerCommTarget"?(n,i)=>(AG(r,n),Reflect.get(e,t).apply(e,[n,i])):t==="removeCommTarget"?(n,i)=>(NG(r,n),Reflect.get(e,t).apply(e,[n,i])):Reflect.get(e,t)}})}var EI=class{constructor(e,t,n,i,o,s,a,l){this.kernelProvider=e;this.kernelFinder=t;this.thirdPartyKernelProvider=n;this.disposables=i;this.controllerRegistration=o;this.apiAccess=s;this.extensions=a;this.serviceContainer=l;this.chainedApiAccess=new Ch;this.extensionApi=new Map}async getService(){let e=this.extensions.determineExtensionFromCallStack(),t=await this.chainedApiAccess.chainFinally(()=>this.apiAccess.getAccessInformation(e));if(!t.accessAllowed)return;if(this.extensionApi.get(t.extensionId))return this.extensionApi.get(t.extensionId);let n=new vw(t.extensionId,this.kernelProvider,this.kernelFinder,this.thirdPartyKernelProvider,this.disposables,this.controllerRegistration,this.serviceContainer);return this.extensionApi.set(t.extensionId,n),n}};EI=y([(0,Ii.injectable)(),m(0,(0,Ii.inject)(Te)),m(1,(0,Ii.inject)(Rr)),m(2,(0,Ii.inject)(Em)),m(3,(0,Ii.inject)(O)),m(4,(0,Ii.inject)(pt)),m(5,(0,Ii.inject)(Ou)),m(6,(0,Ii.inject)(ba)),m(7,(0,Ii.inject)(at))],EI);var vw=class{constructor(e,t,n,i,o,s,a){this.callingExtensionId=e;this.kernelProvider=t;this.kernelFinder=n;this.thirdPartyKernelProvider=i;this.disposables=o;this.controllerRegistration=s;this.serviceContainer=a;this._onDidChangeKernelSpecifications=new a1.EventEmitter;this._onDidChangeKernels=new a1.EventEmitter;this.translatedConnections=new WeakMap;this._onDidChangeStatus=new a1.EventEmitter;this._status=this.kernelFinder.status,this.kernelFinder.onDidChangeStatus(()=>{this._status=this.kernelFinder.status,this._onDidChangeStatus.fire()},this,o),this.kernelProvider.onDidDisposeKernel(l=>{d.ci(`Kernel ${l.kernelConnectionMetadata.id}, ${l.kernelConnectionMetadata.interpreter?.uri.toString()} disposed`),this._onDidChangeKernels.fire()},this,o),this.kernelProvider.onDidStartKernel(l=>{d.ci(`Kernel ${l.kernelConnectionMetadata.id}, ${l.kernelConnectionMetadata.interpreter?.uri.toString()} started`),this._onDidChangeKernels.fire()},this,o),this.thirdPartyKernelProvider.onDidDisposeKernel(l=>{d.ci(`Third party Kernel ${l.kernelConnectionMetadata.id}, ${l.kernelConnectionMetadata.interpreter?.uri.toString()} disposed`),this._onDidChangeKernels.fire()},this,o),this.thirdPartyKernelProvider.onDidStartKernel(l=>{d.ci(`Third party Kernel ${l.kernelConnectionMetadata.id}, ${l.kernelConnectionMetadata.interpreter?.uri.toString()} started`),this._onDidChangeKernels.fire()},this,o),this.controllerRegistration.onDidChange(()=>this._onDidChangeKernelSpecifications.fire(),this,o)}get onDidChangeKernelSpecifications(){return A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"onDidChangeKernelSpecifications"}),d.debug(`API called from ${this.callingExtensionId}`),this._onDidChangeKernelSpecifications.event}get onDidChangeKernels(){return A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"onDidChangeKernels"}),this._onDidChangeKernels.event}get status(){return this._status}get onDidChangeStatus(){return this._onDidChangeStatus.event}async getKernelSpecifications(){return A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"getKernelSpecifications"}),this.kernelFinder.kernels.map(e=>this.translateKernelConnectionMetadataToExportedType(e))}getActiveKernels(){A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"getActiveKernels"});let e=[],t=new Set;return this.kernelProvider.kernels.filter(n=>n.startedAtLeastOnce||n.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel").forEach(n=>{let i=this.kernelProvider.get(n.notebook);i&&i.session?.kernel?.id&&t.add(i.session.kernel.id),e.push({metadata:this.translateKernelConnectionMetadataToExportedType(n.kernelConnectionMetadata),uri:n.uri,id:n.id})}),this.thirdPartyKernelProvider.kernels.filter(n=>n.startedAtLeastOnce||n.kernelConnectionMetadata.kind==="connectToLiveRemoteKernel").forEach(n=>{let i=this.thirdPartyKernelProvider.get(n.uri);i&&i.session?.kernel?.id&&t.add(i.session.kernel.id),e.push({metadata:this.translateKernelConnectionMetadataToExportedType(n.kernelConnectionMetadata),uri:n.uri,id:n.id})}),this.controllerRegistration.registered.forEach(n=>{n.controller.notebookType===Et&&n.connection.kind==="connectToLiveRemoteKernel"&&(!n.connection.kernelModel.id||t.has(n.connection.kernelModel.id)||e.push({metadata:n.connection,uri:void 0,id:n.id}))}),e}getKernel(e){A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"getKernel"});let t=this.thirdPartyKernelProvider.get(e)??this.kernelProvider.get(e);if(t?.session)return{metadata:this.translateKernelConnectionMetadataToExportedType(t.kernelConnectionMetadata),connection:ML(t.session)}}async startKernel(e,t){return A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"startKernel"}),this.startOrConnect(e,t)}async connect(e,t){return A("DATASCIENCE.JUPYTER_KERNEL_API_USAGE",void 0,{extensionId:this.callingExtensionId,pemUsed:"connect"}),this.startOrConnect(e,t)}async startOrConnect(e,t){let n=this.kernelFinder.kernels.find(o=>o.id===e.id);if(!n)throw new Error("Not found");let i=await ta.connectToKernel(n,this.serviceContainer,{resource:t},new Ht(!1),this.disposables,"3rdPartyExtension");if(!i?.session)throw new Error("Not found");return ML(i.session)}translateKernelConnectionMetadataToExportedType(e){if(!this.translatedConnections.has(e)){let t=Object.freeze(Ns.fromJSON(e.toJSON()));this.translatedConnections.set(e,t)}return this.translatedConnections.get(e)}};vw=y([m(1,(0,Ii.inject)(Te)),m(2,(0,Ii.inject)(Rr)),m(3,(0,Ii.inject)(Em)),m(4,(0,Ii.inject)(O)),m(5,(0,Ii.inject)(pt)),m(6,(0,Ii.inject)(at))],vw);var l1=P(M()),xc=require("vscode");var VQ=require("vscode");var Gf=class{constructor(e){this.fileSystem=e;this.activatedWorkspaces=new Set;this.disposables=[]}activate(){this.addHandlers(),this.addRemoveDocOpenedHandlers(),this.activateWorkspace(this.getActiveResource()).catch(h)}getActiveResource(){let e=VQ.window.activeTextEditor;return e&&!e.document.isUntitled?e.document.uri:Array.isArray(xc.workspace.workspaceFolders)&&xc.workspace.workspaceFolders.length>0?xc.workspace.workspaceFolders[0].uri:void 0}async activateWorkspace(e){let t=this.getWorkspaceKey(e);this.activatedWorkspaces.has(t)||(this.activatedWorkspaces.add(t),await m8(this.fileSystem,e))}onDocOpened(e){if(e.languageId!==ye)return;let t=this.getWorkspaceKey(e.uri);if(t===""||(xc.workspace.workspaceFolders||[]).length===0||this.activatedWorkspaces.has(t))return;let n=xc.workspace.getWorkspaceFolder(e.uri);this.activateWorkspace(n?n.uri:void 0).catch(h)}addHandlers(){this.disposables.push(xc.workspace.onDidChangeWorkspaceFolders(this.onWorkspaceFoldersChanged,this))}addRemoveDocOpenedHandlers(){if(this.hasMultipleWorkspaces()){this.docOpenedHandler||(this.docOpenedHandler=xc.workspace.onDidOpenTextDocument(this.onDocOpened,this));return}this.docOpenedHandler&&(this.docOpenedHandler.dispose(),this.docOpenedHandler=void 0)}onWorkspaceFoldersChanged(){let e=(xc.workspace.workspaceFolders||[]).map(i=>this.getWorkspaceKey(i.uri)),n=Array.from(this.activatedWorkspaces.keys()).filter(i=>e.indexOf(i)<0);if(n.length>0)for(let i of n)this.activatedWorkspaces.delete(i);this.addRemoveDocOpenedHandlers()}hasMultipleWorkspaces(){return(xc.workspace.workspaceFolders||[]).length>1}getWorkspaceKey(e){return _s(e,"")}};y([Vh("Failed to activate a workspace")],Gf.prototype,"activateWorkspace",1),Gf=y([(0,l1.injectable)(),m(0,(0,l1.inject)(st))],Gf);var PI=P(M());var kI=class{constructor(e){this.syncActivationServices=e}activate(){this.syncActivationServices.map(e=>{try{e.activate()}catch(t){d.error(`Error in activating extension, failed in ${e.constructor.name}`,t)}})}};kI=y([(0,PI.injectable)(),m(0,(0,PI.optional)()),m(0,(0,PI.multiInject)(ge))],kI);var yw=P(M()),Jd=require("vscode");var OL=Symbol("ISurveyBanner");var Cc=class{constructor(e,t){this.persistentState=e;this.disposables=t;this.disabledInCurrentSession=!1;this.bannerLabels=[JE.bannerLabelYes,JE.bannerLabelNo];this.showBannerState=new Map;this.NotebookExecutionThreshold=250;this.setPersistentState(0,"ShowInsidersNotebookSurveyBanner"),this.setPersistentState(1,"ShowExperimentNotebookSurveyBanner");let n=setTimeout(()=>{Cc.surveyDelay=!0},10*60*1e3);this.disposables.push(new Jd.Disposable(()=>clearTimeout(n)))}isEnabled(e){switch(e){case 0:if(js()==="insiders")return this.isEnabledInternal(e);break;case 1:if(js()==="stable")return this.isEnabledInternal(e);break;default:return d.error("Invalid Banner Type"),!1}return!1}isEnabledInternal(e){return Jd.env.uiKind!==Jd.UIKind.Desktop?!1:this.showBannerState.get(e).value.expiry?this.showBannerState.get(e).value.expiry<Date.now():!0}activate(){this.onDidChangeNotebookCellExecutionStateHandler=or.onDidChangeNotebookCellExecutionState(this.onDidChangeNotebookCellExecutionState,this,this.disposables)}async showBanner(e){let t=this.shouldShowBanner(e);if(this.onDidChangeNotebookCellExecutionStateHandler?.dispose(),!t)return;switch(this.disabledInCurrentSession=!0,await Jd.window.showInformationMessage(this.getBannerMessage(e),...this.bannerLabels)){case this.bannerLabels[0]:{await this.launchSurvey(e),await this.disable(0,e);break}default:{await this.disable(1,e);break}}}shouldShowBanner(e){return om()||!this.isEnabled(e)||this.disabledInCurrentSession||!Cc.surveyDelay?!1:this.getExecutionCount(e)>=this.NotebookExecutionThreshold}setPersistentState(e,t){this.showBannerState.set(e,this.persistentState.createGlobalPersistentState(t,{data:!0}))}async launchSurvey(e){Fp(this.getSurveyLink(e))}async disable(e,t){let n=e===0?6:4;n&&await this.showBannerState.get(t).updateValue({expiry:n*31*864e5+Date.now(),data:!0})}getExecutionCount(e){switch(e){case 0:return this.getPersistentState("DS_InsidersNotebookExecutionCount");case 1:return this.getPersistentState("DS_ExperimentNotebookExecutionCount");default:return d.error("Invalid Banner type"),-1}}getPersistentState(e){return this.persistentState.createGlobalPersistentState(e,0).value}async onDidChangeNotebookCellExecutionState(e){Dt(e.cell.notebook)&&e.state===3&&(this.updateStateAndShowBanner("DS_InsidersNotebookExecutionCount",0).catch(h),this.updateStateAndShowBanner("DS_ExperimentNotebookExecutionCount",1).catch(h))}async updateStateAndShowBanner(e,t){if(!this.shouldShowBanner(t)){this.onDidChangeNotebookCellExecutionStateHandler?.dispose();return}let n=this.persistentState.createGlobalPersistentState(e,0);await n.updateValue(n.value+1),this.showBanner(t).catch(h)}getBannerMessage(e){switch(e){case 0:case 1:return dN.bannerMessage;default:return d.error("Invalid Banner type"),""}}getSurveyLink(e){switch(e){case 0:return"https://aka.ms/vscjupyternb";case 1:return"https://aka.ms/vscnbexp";default:return d.error("Invalid Banner type"),""}}};Cc.surveyDelay=!1,Cc=y([(0,yw.injectable)(),m(0,(0,yw.inject)(yl)),m(1,(0,yw.inject)(O))],Cc);var $a=require("vscode");function BQ(r,e){e&&$a.commands.registerCommand("dataScience.ClearCache",async()=>{let t=[];for(let n of r.globalState.keys())t.push(r.globalState.update(n,void 0).then(h,h));for(let n of r.workspaceState.keys())t.push(r.workspaceState.update(n,void 0).then(h,h));t.push($a.commands.executeCommand(q.ClearSavedJupyterUris).then(h,h)),await Promise.all(t).catch(h),await Promise.all([$a.workspace.fs.delete($a.Uri.joinPath(r.globalStorageUri,"lastExecutedRemoteCell.json")).then(h,h),$a.workspace.fs.delete($a.Uri.joinPath(r.globalStorageUri,"remoteServersMRUList.json")).then(h,h),$a.workspace.fs.delete($a.Uri.joinPath(r.globalStorageUri,_y)).then(h,h)]),d.info("Cache cleared")})}function qQ(r,e){BQ(r,e)}var p1=P(M()),Bt=require("vscode");var c1=I.percentPipCondaInstallInsteadOfBang("pip"),KL=I.percentPipCondaInstallInsteadOfBang("conda"),JQ=I.matplotlibWidgetInsteadOfOther,u1="Jupyter",DI=class{constructor(e){this.disposables=[];this.notebooksProcessed=new WeakMap;this.cellsToProcess=new Set;this.problems=Bt.languages.createDiagnosticCollection(u1),this.disposables.push(this.problems),e.push(this)}dispose(){z(this.disposables),this.problems.dispose()}activate(){this.disposables.push(Bt.languages.registerCodeActionsProvider(ye,this)),this.disposables.push(Bt.languages.registerHoverProvider(ye,this)),Bt.workspace.onDidChangeTextDocument(t=>{let n=og(t.document);if(!n)return;let i=n.getCells().find(o=>o.document===t.document);i&&this.analyzeNotebookCell(i)},this,this.disposables),Bt.workspace.onDidCloseNotebookDocument(t=>{this.problems.delete(t.uri);let n=this.notebooksProcessed.get(t);this.notebooksProcessed.delete(t),n&&n.forEach((i,o)=>this.problems.delete(Bt.Uri.parse(o)))},this,this.disposables),Bt.workspace.onDidOpenNotebookDocument(t=>this.analyzeNotebook(t),this,this.disposables);let e=new bs(300);this.disposables.push(e),Bt.workspace.onDidChangeNotebookDocument(t=>{e.trigger(()=>{let n=this.notebooksProcessed.get(t.notebook);t.contentChanges.forEach(i=>{i.removedCells.forEach(o=>{n?.delete(o.document.uri.toString())}),i.addedCells.forEach(o=>this.queueCellForProcessing(o))}),t.cellChanges.forEach(i=>this.queueCellForProcessing(i.cell))})},this,this.disposables),Bt.workspace.notebookDocuments.map(t=>this.analyzeNotebook(t))}provideHover(e,t,n){if(og(e)?.notebookType!==Et)return;let o=this.problems.get(e.uri);if(!o)return;let s=o.find(l=>l.message===c1||l.message===KL);if(!s||!s.range.contains(t))return;let a=s.message===c1?"pip":"conda";return new Bt.Hover(I.pipCondaInstallHoverWarning(a,"https://aka.ms/jupyterCellMagicBangInstall"),s.range)}provideCodeActions(e,t,n,i){if(!og(e))return[];let o=[];return n.diagnostics.forEach(s=>{switch(s.message){case c1:o.push(this.createReplaceCodeAction(e,"pip",s));break;case KL:o.push(this.createReplaceCodeAction(e,"conda",s));break;case JQ:o.push(this.createGotoWikiAction(e,Bt.Uri.parse("https://aka.ms/vscodejupytermatplotlibwidget"),s));break;default:break}}),o}createReplaceCodeAction(e,t,n){let i=new Bt.CodeAction(I.replacePipCondaInstallCodeAction(t),Bt.CodeActionKind.QuickFix);i.isPreferred=!0,i.diagnostics=[n];let o=new Bt.WorkspaceEdit;return o.replace(e.uri,new Bt.Range(n.range.start,new Bt.Position(n.range.start.line,n.range.start.character+1)),"%"),i.edit=o,i}createGotoWikiAction(e,t,n){let i=new Bt.CodeAction(I.matplotlibWidgetCodeActionTitle,Bt.CodeActionKind.QuickFix);return i.isPreferred=!0,i.diagnostics=[n],i.command={title:I.matplotlibWidgetCodeActionTitle,command:"vscode.open",arguments:[t]},i}analyzeNotebook(e){e.notebookType===Et&&e.getCells().forEach((t,n)=>n<100?this.queueCellForProcessing(t):void 0)}queueCellForProcessing(e){this.cellsToProcess.add(e),this.analyzeNotebookCells()}analyzeNotebookCells(){if(this.cellsToProcess.size===0)return;let e=this.cellsToProcess.values().next().value;this.cellsToProcess.delete(e),this.analyzeNotebookCell(e),setTimeout(()=>this.analyzeNotebookCells(),0)}analyzeNotebookCell(e){if(e.kind!==Bt.NotebookCellKind.Code||e.document.languageId!==ye||e.notebook.isClosed||e.document.isClosed||this.notebooksProcessed.get(e.notebook)?.get(e.document.uri.toString())===e.document.version)return;this.problems.delete(e.document.uri);let t=this.notebooksProcessed.get(e.notebook)||new Map;t.set(e.document.uri.toString(),e.document.version),this.notebooksProcessed.set(e.notebook,t);for(let n=0;n<Math.min(e.document.lineCount,50);n++){let i=e.document.lineAt(n),o=i.text;if(o.trim().startsWith("!pip install")){let s=o.indexOf("!"),a=o.indexOf("l"),l=new Bt.Range(i.lineNumber,s,i.lineNumber,a+2);this.problems.set(e.document.uri,[{message:c1,range:l,severity:Bt.DiagnosticSeverity.Error,source:u1}])}else if(o.trim().startsWith("!conda install")){let s=o.indexOf("!"),a=o.indexOf("l"),l=new Bt.Range(i.lineNumber,s,i.lineNumber,a+2);this.problems.set(e.document.uri,[{message:KL,range:l,severity:Bt.DiagnosticSeverity.Error,source:u1}])}else if(o.trim().startsWith("%matplotlib")&&!o.trim().endsWith("widget")&&!o.trim().endsWith("inline")){let s=o.indexOf("%"),a=o.length,l=new Bt.Range(i.lineNumber,s,i.lineNumber,a);this.problems.set(e.document.uri,[{message:JQ,range:l,severity:Bt.DiagnosticSeverity.Warning,source:u1}])}}}};DI=y([(0,p1.injectable)(),m(0,(0,p1.inject)(O))],DI);var g1=P(M()),vr=require("vscode");var $Q=new Map([["method",0],["function",1],["constructor",2],["field",3],["variable",4],["class",5],["struct",6],["interface",7],["module",8],["property",9],["event",10],["operator",11],["unit",12],["value",13],["constant",14],["enum",15],["enumMember",16],["keyword",17],["text",18],["color",19],["file",20],["reference",21],["customcolor",22],["folder",23],["typeParameter",24],["snippet",25],["<unknown>",3]]);function d1(r){if(r>=300)return"ZZZZZZZ";if(r<=25)return`A${String.fromCharCode(65+r)}`;let e=String.fromCharCode(65+Math.ceil(r/25)),t=String.fromCharCode(65+r%25);return`${e}${t}`}var ZQ=require("vscode");var zf=require("vscode");var vIe=new Map([["julia",SIe],["python",bIe],["r",xIe]]);function HQ(r,e){let t=vIe.get(e.toLowerCase());return t?t(r):r}var yIe=["Docstring:","Options:","Parameters","Returns","See Also","Notes","Examples","Usage:","Subclasses:"];function bIe(r){let e=Fe(r,{trim:!1,removeEmptyEntries:!1}),t=-1,n=!1,i=!1,o=[],s=new Set,a=!1,l="",c=!1,u=!1;if(e.map((f,g)=>{if(g===0){let b=["Signature:","Init signature:"].find(C=>f.toLowerCase().startsWith(C.toLowerCase()));if(b){n=!0,f=f.substring(b.length).trim(),o.push("```python"),f.trim().length&&(o.push(f),c=!0);return}}if(f.startsWith("File:")&&g===e.length-1||f.startsWith("Type:")&&g===0)return;if(!a&&f.toLowerCase().startsWith("String form:".toLowerCase())){i=!0;return}let v=yIe.find(b=>f.trim().toLowerCase().startsWith(b.toLowerCase()));if(v&&!s.has(v)){l=v.toLowerCase(),s.add(v),a=!0,t=g,i=!1,n&&o.push("```","----------"),n=!1,u=!1,l!=="docstring:"&&o.push(`## ${v}`);let b=f.includes(":")?f.split(":")[1].replace("<no docstring>","").trim():"";b.length&&(o.push(b),c=!0);return}if(!i){if(t+1===g&&f.replace(/-/g,"").replace(/:/g,"").replace("<no docstring>","").trim().length===0){t=g,i=!1,n=!1,u=!1;return}if(l==="parameters"||l==="see also"){f.trim().length&&f.includes(":")&&f.substring(0,1)===f.trim().substring(0,1)?o.push(`* ${f}`):o.push(f),c=c||f.trim().length>0;return}if(l==="options:"){f.startsWith("-")&&f.trim().length&&f.includes(":")&&f.substring(0,1)===f.trim().substring(0,1)?o.push(`* ${f}`):o.push(f),c=c||f.trim().length>0;return}if(l==="returns"){f.trim().length&&f.substring(0,1)===f.trim().substring(0,1)?o.push(`* ${f}`):o.push(f),c=c||f.trim().length>0;return}if(l==="examples"&&!n&&(t+1===g||t+2===g))return i=!1,n=!0,c=c||f.trim().length>0,o.push("```python",f);if(!n&&f.startsWith("class ")&&f.trim().endsWith("):")){n=!0,u=!0,o.push("```python",f),c=c||f.trim().length>0;return}if(n&&u&&f.trim().length>0&&f.substring(0,1)!==" "&&f.substring(0,1)!==" ")return n=!1,u=!1,o.push(f,"```");c=c||f.trim().length>0,o.push(f)}}),!c)return"";let p=o.join(`
|
||
`);return n?new zf.MarkdownString(p+" \n```"):new zf.MarkdownString(p)}var IIe=[{section:"Examples:",header:"Examples",nextLine:/≡/g},{section:"Usage note",header:"Usage note",nextLine:/≡/g},{section:"Note:",header:"\u2502 Note",nextLine:"\u2502"},{section:"Note:",header:"\u2502 Note",nextLine:String.fromCharCode(9474)}];function SIe(r){let e=Fe(r,{trim:!1,removeEmptyEntries:!1}),t=!1,n=[],i=new Set,o="",s=!1,a=!1;e.every(c=>c.trim().length===0||c.startsWith(" "))&&e.forEach((c,u)=>e[u]=c.trim().length?c.substring(2):c),e.map((c,u)=>{if(c.trim()==="\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")return a=!1,n.push(c);if(!a)return o="signature",t=!0,a=!0,c.trim().length?(s=!0,n.push("```julia",c)):n.push("```julia");o==="signature"&&c.trim()===""&&(o="",t=!1,s=!1,n.push("```"));let p=IIe.find(f=>c.trim().toLowerCase().startsWith(f.header.toLowerCase()));if(p&&(typeof p.nextLine=="string"?e[u+1].trim()===p.nextLine.trim():e[u+1].trim().replace(p.nextLine,"").length===0)){e[u+1]="",o=p.section.toLowerCase(),i.add(p.header),t&&n.push("```"),t=!1,n.push(`## ${p.section}`),o==="note:"&&!e.slice(u+1).every(f=>f.trim().length===0||f.trim().startsWith("|")||f.trim().startsWith(String.fromCharCode(9474)))&&(o="");return}if(o==="examples:"&&!t)return t=!0,c.trim().length?(s=!0,n.push("```julia",c)):n.push("```julia");if(o==="note:"){n.push(c.trim()?c.trim().substring(1):"");return}t&&!s&&c.trim().length===0||n.push(c)});let l=n.join(`
|
||
`);return t?new zf.MarkdownString(l+" \n```"):new zf.MarkdownString(l)}function xIe(r){let e=Fe(r,{trim:!1,removeEmptyEntries:!1}),t=[];e.forEach((a,l)=>e[l]=a.indexOf(" ")===0?a.substring(5):a);let n="",i=!1,o=!1;e.map(a=>{let l=a.replace(/_/g,"").trim();if(a.startsWith("_")&&a.includes(String.fromCharCode(8))&&a.split("_").length===a.split(String.fromCharCode(8)).length&&l){i&&t.push("```"),i=!1,n=l.trim().toLowerCase(),t.push(`## ${l}`);return}if((n==="examples"||n==="examples:"||n==="usage"||n==="usage:")&&!i)return i=!0,a.trim().length?(o=!0,t.push("```r",a)):t.push("```r");if(n==="note:"){t.push(a.trim()?a.trim().substring(1):"");return}i&&!o&&a.trim().length===0||t.push(a)});let s=t.join(`
|
||
`);return i?new zf.MarkdownString(s+" \n```"):new zf.MarkdownString(s)}var GQ=new WeakMap;async function Ku(r,e,t){let n=GQ.get(r)||0;GQ.set(r,n+1);let i=qk(Ue,r),o=`application/vnd.vscode.bg.execution.${n}`,s=`application/vnd.vscode.bg.execution.${n}.result`,a=`application/vnd.vscode.bg.execution.${n}.error`,l="",c=`
|
||
def __jupyter_exec_background__():
|
||
from IPython.display import display
|
||
from threading import Thread
|
||
from traceback import format_exc
|
||
|
||
# First send a dummy response to get the display id.
|
||
# Later we'll send the real response with the actual data.
|
||
# And that can happen much later even after the execution completes,
|
||
# as that response will be sent from a bg thread.
|
||
output = display({"${o}": ""}, raw=True, display_id=True)
|
||
|
||
def do_implementation():
|
||
${e.map((f,g)=>g===0?f:` ${f}`).join(`
|
||
`)}
|
||
|
||
def bg_main():
|
||
try:
|
||
output.update({"${s}": do_implementation()}, raw=True)
|
||
except Exception as e:
|
||
output.update({"${a}": format_exc()}, raw=True)
|
||
|
||
|
||
Thread(target=bg_main, daemon=True).start()
|
||
|
||
|
||
__jupyter_exec_background__()
|
||
del __jupyter_exec_background__
|
||
`.trim(),u=new $r;u.add(t.onCancellationRequested(()=>u.dispose()));let p=nr(t,new Promise((f,g)=>{u.add(i.onDidReceiveDisplayUpdate(async v=>{if(t.isCancellationRequested)return f(void 0);let b=km(v);if(!l||b?.transient?.display_id!==l)return;let C=v.items.find(E=>E.mime===s);if(C)try{return f(JSON.parse(new TextDecoder().decode(C.data)))}catch(E){return g(new Error("Failed to parse the result",E))}}))})).finally(()=>{r.session&&X9(r.session,l),u.dispose()});for await(let f of i.executeCode(c,t)){if(t.isCancellationRequested)return;let g=km(f);if(!g?.transient?.display_id)continue;if(f.items.find(b=>b.mime===o)){l=g.transient.display_id;continue}if(l===g.transient.display_id){let b=f.items.find(C=>C.mime===s||C.mime===a);if(b?.mime===s)return JSON.parse(new TextDecoder().decode(b.data));if(b?.mime===a){d.warn(`Error in background execution:
|
||
`,new TextDecoder().decode(b.data));return}}}if(!t.isCancellationRequested){if(!l){d.warn("Failed to get display id for completions");return}return p}}var CIe=1,$d=oi.IntellisenseResolveTimeout,zQ=5,FL=new WeakSet,m1=class extends Error{constructor(){super("Request timed out")}};async function eY(r,e,t,n,i,o,s,a){if(!r.range||!n.session?.kernel||FL.has(n)||!vt(n.kernelConnectionMetadata)&&n.status!=="idle")return r;let l=NIe(e||r,s,a),c=AIe(l,n,t),u=kg(t);try{let p=await wh($d,new m1,nr(u.token,c));if(!t.isCancellationRequested&&p?.status==="ok"&&p?.found){let f=wIe(p);r.documentation=HQ(f,o)}}catch(p){if(p instanceof ZQ.CancellationError)return r;p instanceof m1&&(u.cancel(),EIe(n,o,i))}finally{u.dispose()}return r}function wIe(r){return!r||r.status!=="ok"||!r.found?";":!r.data||typeof r.data!="object"?"":"text/plain"in r.data?ac(r.data["text/plain"]):""}var QQ=new WeakSet;function EIe(r,e,t){vt(r.kernelConnectionMetadata)||FL.has(r)||(FL.add(r),d.warn(`Failed to inspect code in kernel ${ct(r.kernelConnectionMetadata)}`),QQ.has(r)||(QQ.add(r),A("DATASCIENCE.JUPYTER_KERNEL_CODE_COMPLETION_CANNOT_RESOLVE",void 0,{kernelId:t,kernelConnectionType:r.kernelConnectionMetadata.kind,kernelLanguage:e})))}var LL=new WeakMap,UL=new WeakMap;async function kIe(r,e,t){let n=`return get_ipython().kernel.do_inspect("${Cx(e.code)}", ${e.cursor_pos}, ${e.detail_level})`;return{content:await Ku(r,[n],t)}}var YQ={data:{},found:!1,status:"ok",metadata:{}};function PIe(r,e){if(!r.session?.kernel)return;let t=JSON.stringify(e);return LL.get(r.session.kernel)?.get(t)}function DIe(r,e,t){if(!r.session?.kernel||t.status!=="ok"||!t.found)return;let n=JSON.stringify(e),i=LL.get(r.session.kernel)||new Map;LL.set(r.session.kernel,i),i.size>100&&i.clear(),i.set(n,t)}function _Ie(r){if(!r.session?.kernel)return!1;let e=UL.get(r.session.kernel)||{maxTime:0,lastRequestTime:0,numberOfTimesMaxedOut:0};return!vt(r.kernelConnectionMetadata)&&e.maxTime>$d?(d.warn(`Not sending inspect request as previous requests took over ${$d}s.`),!1):e.numberOfTimesMaxedOut>zQ?(d.warn(`Not sending inspect request as there have been at least ${zQ} requests that took over ${$d}s.`),!1):e.maxTime>$d&&Date.now()-e.lastRequestTime<3e4?(d.warn(`Not sending inspect request as previous requests took over ${$d}s.`),!1):!0}async function TIe(r,e){if(!r.session?.kernel||!XQ(r))return;d.info(`Too many pending requests ${tY(r)} for kernel ${r.id}, waiting for it to be ready.`);let t=r.session.kernel,n=new $r;await nr(e,new Promise(i=>{let o=()=>{if(e.isCancellationRequested)return;if(!XQ(r)){i(),z(n);return}let s=setTimeout(o,100);n.add({dispose:()=>clearTimeout(s)})};n.add(Ia(e.onCancellationRequested)(()=>{i(),t.statusChanged.disconnect(o)})),t.statusChanged.connect(o),n.add({dispose:()=>{t.statusChanged.disconnect(o)}})})).finally(()=>z(n))}function RIe(r,e){if(!r.session?.kernel)return;let t=UL.get(r.session.kernel)||{maxTime:0,lastRequestTime:0,numberOfTimesMaxedOut:0};t.maxTime=Math.max(t.maxTime,e),t.lastRequestTime=Date.now(),e>$d&&(t.numberOfTimesMaxedOut+=1),UL.set(r.session.kernel,t)}async function AIe(r,e,t){if(!e.session?.kernel)return;let n=PIe(e,r);if(n)return n;if(!_Ie(e)||(await TIe(e,t),t.isCancellationRequested))return YQ;let i=MIe(e),o=new We,s=Fe(r.code).reverse()[0].slice(-50);d.trace(`Inspecting code ${s}`);let a=vt(e.kernelConnectionMetadata)?kIe(e,r,t):e.session.kernel.requestInspect(r);return a.finally(()=>i.dispose()),a.then(({content:l})=>{if(!e.session?.kernel)return;DIe(e,r,l),RIe(e,o.elapsedTime);let c=o.elapsedTime>$d?d.warn:d.debug;return t.isCancellationRequested?c(`Inspected code ${s} in ${o.elapsedTime}ms (but cancelled)`):c(`Inspected code ${s} in ${o.elapsedTime}ms`),l})}function NIe(r,e,t){let n=e.getText(),i=(typeof r.insertText=="string"?r.insertText:r.insertText?.value)||(typeof r.label=="string"?r.label:r.label.label)||"",o=n.substring(0,t.character)+i,s=t.character+i.length;return{code:o,cursor_pos:s,detail_level:0}}var bw=new WeakMap;function XQ(r){return r.session?.kernel?tY(r)>=CIe:!1}function tY(r){return r.session?.kernel?(bw.has(r.session?.kernel)||bw.set(r.session?.kernel,{count:0}),bw.get(r.session?.kernel)?.count||0):0}function MIe(r){if(!r.session?.kernel)return{dispose:h};let e=bw.get(r.session?.kernel)||{count:0};return bw.set(r.session?.kernel,e),e.count+=1,{dispose:()=>{e.count-=1}}}var h1=class extends Error{constructor(){super("Request timed out")}},jL=class{constructor(e,t,n){this.kernelId=e;this.kernel=t;this.monacoLanguage=n;this.pendingCompletionRequest=new WeakMap;this.previousCompletionItems=new WeakMap}async provideCompletionItems(e,t,n,i){if(!this.kernel.session?.kernel)return[];let o=e.version;if(this.pendingCompletionRequest.has(e))return[];this.pendingCompletionRequest.set(e,{position:t,version:o});let s=new vr.Disposable(()=>{this.pendingCompletionRequest.get(e)?.position.isEqual(t)&&this.pendingCompletionRequest.get(e)?.version===o&&this.pendingCompletionRequest.delete(e)});try{let a=Is(nr(n,Promise.resolve(vr.commands.executeCommand("vscode.executeCompletionItemProvider",e.uri,t)).then(f=>f?.items||[]))),l=new We;if(await Ei(50),n.isCancellationRequested)return[];let c=await wh(oi.IntellisenseTimeout,new h1,this.provideCompletionItemsFromKernel(e,t,n,i));if(n.isCancellationRequested||!c||!c.length)return[];let u=await br(0,a.promise);vt(this.kernel.kernelConnectionMetadata)&&!a.completed&&l.elapsedTime<oi.IntellisenseTimeout+50&&(u=await br(oi.IntellisenseTimeout-l.elapsedTime,a.promise));let p=new Set((u||[]).map(f=>typeof f.label=="string"?f.label:f.label.label));return c.filter(f=>!p.has(typeof f.label=="string"?f.label:f.label.label))}catch(a){if(a instanceof h1)return[];throw a instanceof vr.CancellationError||d.debug("Completions failed",a),a}finally{s.dispose()}}async provideCompletionItemsFromKernel(e,t,n,i){if(n.isCancellationRequested||!this.kernel.session?.kernel)return[];let o=new We,s={duration:0,timesExceededTimeout:0,requestDuration:0,completionItems:0},a={kernelId:this.kernelId,kernelConnectionType:this.kernel.kernelConnectionMetadata.kind,kernelLanguage:y1(this.kernel),monacoLanguage:this.monacoLanguage,cancelled:!1,kernelStatusBeforeRequest:this.kernel.status,completed:!1,requestSent:!1};if(!vt(this.kernel.kernelConnectionMetadata)&&this.kernel.status!=="idle")return[];let l=e.getText(),c=e.offsetAt(t);a.requestSent=!0;let u=await nr(n,this.getKernelCompletion(l,c,n));if(d.debug(`Jupyter completion time: ${o.elapsedTime}`),a.cancelled=n.isCancellationRequested,a.completed=!n.isCancellationRequested,a.kernelStatusAfterRequest=this.kernel.status,s.requestDuration=n.isCancellationRequested?0:o.elapsedTime,n.isCancellationRequested)return[];if(u?.content?.status!=="ok"||(u?.content?.matches?.length??0)===0)return nY(this.kernel,s,a),[];let p={matches:u.content.matches,cursor:{start:u.content.cursor_start,end:u.content.cursor_end},metadata:u.content.metadata},f=p.metadata?p.metadata._jupyter_types_experimental:[];s.completionItems=p.matches.length,nY(this.kernel,s,a);let g={code:l,cursor:p.cursor,documentRef:new WeakRef(e),position:e.positionAt(p.cursor.start)},v=new vr.Range(e.positionAt(p.cursor.start),e.positionAt(p.cursor.end)),b=[];return Array.isArray(f)&&f.length>=p.matches.length&&f.every(C=>C&&typeof C.text=="string")?b=u.content.matches.map((C,E)=>{let R=f[E],_=R.type?$Q.get(R.type):vr.CompletionItemKind.Field,L=new vr.CompletionItem(C,_);return typeof R.start=="number"&&typeof R.end=="number"?L.range=new vr.Range(e.positionAt(R.start),e.positionAt(R.end)):L.range=v,L.insertText=R.text,L.sortText=d1(E),vt(this.kernel.kernelConnectionMetadata)&&(C.startsWith("%")||C.startsWith("!"))&&(L.sortText=`ZZZ${L.sortText}`),this.previousCompletionItems.set(L,{...g,originalCompletionItem:JSON.parse(JSON.stringify(L))}),L}):b=p.matches.map((C,E)=>{let R=new vr.CompletionItem(C);return R.range=v,R.sortText=d1(E),vt(this.kernel.kernelConnectionMetadata)&&(C.startsWith("%")||C.startsWith("!"))&&(R.sortText=`ZZZ${R.sortText}`),this.previousCompletionItems.set(R,{...g,originalCompletionItem:R}),R}),vt(this.kernel.kernelConnectionMetadata)?LIe(i.triggerCharacter,this.allowStringFilterForPython,b,e,t):b}async resolveCompletionItem(e,t){if(!e.range||!this.kernel.session?.kernel)return e;let n=this.previousCompletionItems.get(e);if(!n)return e;let{documentRef:i,position:o,originalCompletionItem:s}=n,a=i.deref();return a?eY(e,s,t,this.kernel,this.kernelId,this.monacoLanguage,a,o):e}async getKernelCompletion(e,t,n){if(this.kernel.session?.kernel)return vt(this.kernel.kernelConnectionMetadata)?this.getPythonKernelCompletion(e,t,n):nr(n,this.kernel.session.kernel.requestComplete({code:e,cursor_pos:t}))}async getPythonKernelCompletion(e,t,n){let i=`return get_ipython().kernel.do_complete("${Cx(e)}", ${t})`;return{content:await Ku(this.kernel,[i],n)}}},rY=new WeakMap,f1=new WeakMap;function nY(r,e,t){let n=rY.get(r),i=f1.get(r)?.count||0;e.duration>=oi.IntellisenseTimeout&&f1.set(r,{count:i+1,measures:e,properties:t}),e.timesExceededTimeout=i,n?n.elapsedTime>6e4&&(A("DATASCIENCE.JUPYTER_KERNEL_CODE_COMPLETION",e,t),n.reset(),f1.delete(r)):(A("DATASCIENCE.JUPYTER_KERNEL_CODE_COMPLETION",e,t),n=new We,rY.set(r,new We),f1.delete(r))}var WL=class extends tr{constructor(t,n){super();this.kernel=t;this.notebookEditorProvider=n;this.cellCompletionProviders=new WeakMap;this.completionItemsSent=new WeakMap;this.monacoLanguage=v1(this.kernel);this.registerCompletionProvider(),this._register(vr.workspace.onDidChangeConfiguration(i=>{if(i.affectsConfiguration("jupyter.enableKernelCompletions"))if(iY(this.kernel.notebook.uri))this.completionProvider||this.registerCompletionProvider();else{this.completionProvider?.dispose(),this.completionProvider=void 0;return}!i.affectsConfiguration("jupyter.completionTriggerCharacters")&&!i.affectsConfiguration("jupyter.pythonCompletionTriggerCharacters")||this.registerCompletionProvider()}))}registerCompletionProvider(){if(!iY(this.kernel.notebook.uri))return;let t=OIe(this.kernel);if(t.length===0){KIe(this.kernel);return}d.trace(`Registering Kernel Completion Provider from kernel ${ct(this.kernel.kernelConnectionMetadata)} for language ${this.monacoLanguage}`),this.allowStringFilterForPython=t.includes("'")||t.includes('"'),this.completionProvider?.dispose(),this.completionProvider=void 0,this.completionProvider=vr.languages.registerCompletionItemProvider(this.monacoLanguage,this,...t)}dispose(){super.dispose(),this.completionProvider?.dispose()}async provideCompletionItems(t,n,i,o){if(this.notebookEditorProvider.findAssociatedNotebookDocument(t.uri)!==this.kernel.notebook)return[];let s=this.cellCompletionProviders.get(t);if(!s){let a=await mt(this.kernel.kernelConnectionMetadata.id);s=new jL(a,this.kernel,this.monacoLanguage),this.cellCompletionProviders.set(t,s)}return s.allowStringFilterForPython=this.allowStringFilterForPython,s.provideCompletionItems(t,n,i,o).then(a=>(a.forEach(l=>this.completionItemsSent.set(l,s)),a))}async resolveCompletionItem(t,n){let i=this.completionItemsSent.get(t);return i?i.resolveCompletionItem(t,n):t}},Hd=class extends tr{constructor(t){super();this.kernelCompletionProviders=new WeakMap;t.push(this)}activate(){let t=xe.instance.get(Te);this._register(t.onDidStartKernel(async n=>{if(n.session?.kernel&&vt(n.kernelConnectionMetadata)&&n.session.kernel.requestComplete({code:"__file__.",cursor_pos:9}),!v1(n)||this.kernelCompletionProviders.has(n))return;let o=xe.instance.get(bi),s=this._register(new WL(n,o));this.kernelCompletionProviders.set(n,s)})),this._register(t.onDidDisposeKernel(n=>{this.kernelCompletionProviders.get(n)?.dispose()}))}};Hd=y([(0,g1.injectable)(),m(0,(0,g1.inject)(O))],Hd);function v1(r){return Cl(y1(r))}function y1(r){let e="";switch(r.kernelConnectionMetadata.kind){case"connectToLiveRemoteKernel":e=r.kernelConnectionMetadata.kernelModel.language;break;case"startUsingRemoteKernelSpec":e=r.kernelConnectionMetadata.kernelSpec.language;break;case"startUsingLocalKernelSpec":e=r.kernelConnectionMetadata.kernelSpec.language;break;default:e=r.kernelConnectionMetadata.kernelSpec.language;break}return(e||"").toLowerCase()}function iY(r){return vr.workspace.getConfiguration("jupyter",r).get("enableKernelCompletions",!1)}function OIe(r){let e=vr.workspace.getConfiguration("jupyter",r.notebook.uri).get("completionTriggerCharacters");if(!e||typeof e!="object")return[];let t=y1(r),n=v1(r);return t in e?Array.isArray(e[t])?e[t]:[]:n in e?Array.isArray(e[n])?e[n]:[]:[]}function KIe(r){let e=y1(r),t=v1(r);e.toLowerCase()===t.toLowerCase()?d.warn(vr.l10n.t(`Kernel completions not enabled for '{0}'.
|
||
To enable Kernel completion for this language please add the following setting
|
||
jupyter.completionTriggerCharacters = {1}: [<List of characters that will trigger completions>]}.
|
||
For more information please see https://aka.ms/vscodeJupyterCompletion`,ct(r.kernelConnectionMetadata),`{${e}`)):d.warn(vr.l10n.t(`Kernel completions not enabled for '{0}'.
|
||
To enable Kernel completion for this language please add the following setting
|
||
jupyter.completionTriggerCharacters = {1}: [<List of characters that will trigger completions>]}.
|
||
or the following:
|
||
jupyter.completionTriggerCharacters = {2}: [<List of characters that will trigger completions>]}.
|
||
For more information please see https://aka.ms/vscodeJupyterCompletion`,ct(r.kernelConnectionMetadata),`{${e}`,`{${t}`))}function FIe(r,e){let t=r.indexOf('"'),n=r.indexOf("'"),i=r.lastIndexOf('"'),o=r.lastIndexOf("'"),s=t>=0?t:n,a=i>=0?i:o;return s>=0&&e.character>s&&e.character<=a}function LIe(r,e,t,n,i){let o=t,s=i.character===0?void 0:new vr.Range(i.line,i.character-1,i.line,i.character),l=(s?n.getText(s):void 0)===".",c=n.getWordRangeAtPosition(l||r==="."?new vr.Position(i.line,i.character-1):i),u=c&&s?c.union(s):void 0,p=n.lineAt(i.line).text,f=u?n.getText(u):p,g=f.endsWith(".")||l,v=e&&(r=="'"||r=='"'||FIe(p,i));return d.ci(`Jupyter completions filtering applied: ${v} on ${p}`),o=o.map((b,C)=>{let E=typeof b.label=="string"?b.label:b.label.label,R=typeof b.label=="string"?b.label:b.label.label;if(R.startsWith("%")||R.startsWith("!"))return{...b,sortText:`ZZZ${b.sortText}`};if(v)return b;let _=f?R.indexOf(f):-1,L,te,$;if(f&&g&&R.includes(f)){L=R.substring(R.indexOf(f)+(g?f.length:0)),te=R.substring(R.indexOf(f)+f.length);let se=(typeof b.label=="string"?b.label.length:b.label.label.length)-te.length;$=b.range&&"start"in b.range?new vr.Range(new vr.Position(b.range.start.line,b.range.start.character+se),b.range.end):b.range}if(!te&&_>0){L=R.substring(R.indexOf(f)+(g?f.length:0)),te=R.substring(R.indexOf(f)+f.length);let se=(typeof b.label=="string"?b.label.length:b.label.label.length)-te.length;$=b.range&&"start"in b.range?new vr.Range(new vr.Position(b.range.start.line,b.range.start.character+se),b.range.end):b.range}return L&&te&&$&&(b.label=L,E=te,b.insertText=te,b.filterText=g?`.${te}`:te,b.range=$,b.sortText=d1(C)),E.endsWith("/")?{...b,command:{command:"editor.action.triggerSuggest",title:""}}:(E.includes(" ")&&(E=E.replace(/\\ /g," "),typeof b.label=="string"?b.label=b.label.replace(/\\ /g," "):b.label.label=b.label.label.replace(/\\ /g," ")),v||!E.includes(".")&&!E.endsWith("/")?b:void 0)}).filter(b=>b!==void 0),d.ci(`Jupyter completions for ${f} at pos ${i.line}:${i.character} with trigger: ${r}
|
||
${t.map(b=>b.label).join(",")}`),d.ci(`Jupyter results for ${f} at pos ${i.line}:${i.character} with trigger: ${r}
|
||
${o.map(b=>b.label).join(",")}`),o}var Gd=P(M()),VL=require("vscode");var sY=P(Wl());var oY=require("vscode");function b1(){let e=oY.workspace.getConfiguration("python")?.get("languageServer");return!(e!=="Pylance"&&e!=="Default")}var zd=class{constructor(e,t,n,i,o){this.apiProvider=e;this.extensionChecker=t;this.notebookEditorProvider=n;this.controllerRegistration=i;this.kernelProvider=o;this._isPylanceExtensionInstalled()||(this.extensionChangeHandler=VL.extensions.onDidChange(this.extensionsChangeHandler.bind(this)))}activate(){!this.isUsingPylance()||!this.extensionChecker.isPythonExtensionInstalled||this.apiProvider.getApi().then(e=>{e.registerJupyterPythonPathFunction!==void 0&&e.registerJupyterPythonPathFunction(t=>this._jupyterPythonPathFunction(t))}).catch(h)}async reset(){this._isEnabled=void 0,await this.activate()}_isPylanceExtensionInstalled(){return VL.extensions.getExtension(sm)!==void 0}async extensionsChangeHandler(){this._isPylanceExtensionInstalled()&&this.extensionChangeHandler&&(this.extensionChangeHandler.dispose(),this.extensionChangeHandler=void 0,await this.reset())}isUsingPylance(){return this._isEnabled===void 0&&(this._isEnabled=b1()),this._isEnabled}async _jupyterPythonPathFunction(e){let t=this.notebookEditorProvider.findAssociatedNotebookDocument(e);if(!t)return;let n=this.controllerRegistration.getSelected(t);if(n&&Nt(n.connection)){let o=this.kernelProvider.get(t);if(!o)return;let s=[];if(!o.startedAtLeastOnce){let v=new Promise(b=>o.onStarted(b,void 0,s));await br(5e3,void 0,v)}if(!o.startedAtLeastOnce)return;let a=this.kernelProvider.getKernelExecution(o),l=`
|
||
import os as _VSCODE_os
|
||
import sys as _VSCODE_sys
|
||
import builtins as _VSCODE_builtins
|
||
|
||
if _VSCODE_os.path.exists("${__filename}"):
|
||
_VSCODE_builtins.print(f"EXECUTABLE{_VSCODE_sys.executable}EXECUTABLE")
|
||
|
||
del _VSCODE_os, _VSCODE_sys, _VSCODE_builtins
|
||
`,u=(await a.executeHidden(l).catch(h)||[]).find(v=>v.output_type==="stream"&&v.name==="stdout");if(!u||!(u.text||"").toString().includes("EXECUTABLE"))return;let p=(u.text||"").toString();p=p.substring(p.indexOf("EXECUTABLE"));let f=p.split("EXECUTABLE").filter(v=>v.trim().length),g=f.length?f[0].trim():"";return!g||!await sY.pathExists(g)?void 0:(d.debug(`Remote Interpreter for Pylance for Notebook URI "${B(t.uri)}" is ${B(g)}`),g)}let i=n?.connection?.interpreter;return i?(d.debug(`Interpreter for Pylance for Notebook URI "${B(t.uri)}" is ${B(i.uri)}`),De(i.uri)):(d.debug(`No interpreter for Pylance for Notebook URI "${B(t.uri)}"`),"")}};zd=y([(0,Gd.injectable)(),m(0,(0,Gd.inject)(Yt)),m(1,(0,Gd.inject)($e)),m(2,(0,Gd.inject)(bi)),m(3,(0,Gd.inject)(pt)),m(4,(0,Gd.inject)(Te))],zd);function aY(r){r.addSingleton(ge,DI),r.addSingleton(Hd,Hd),r.addBinding(Hd,ge),r.addSingleton(zd,zd),r.addBinding(zd,ge)}var TI=P(M());var lY=require("vscode");var _I=class{constructor(e,t,n){this.extensionChecker=e;this.disposables=t;this.kernelProvider=n}activate(){this.extensionChecker.onPythonExtensionInstallationStatusChanged(this.onPythonExtensionInstallationStatusChanged,this,this.disposables)}async onPythonExtensionInstallationStatusChanged(e){e==="installed"&&this.anyKernelsAreActive()&&lY.window.showInformationMessage(I.pythonExtensionInstalled,me.ok).then(h,h)}anyKernelsAreActive(){return this.kernelProvider.kernels.length>0}};_I=y([(0,TI.injectable)(),m(0,(0,TI.inject)($e)),m(1,(0,TI.inject)(O)),m(2,(0,TI.inject)(Te))],_I);var Vr=P(M()),pY=P(To()),St=require("vscode");var wc=require("vscode");var I1=class{constructor(e,t,n,i,o){this.configService=e;this.agentCreator=t;this.requestCreator=n;this.serverUriStorage=i;this.disposables=o;this.savedConnectInfo=new Map;this.serverUriStorage.onDidRemove(this.onDidRemoveServers,this,this.disposables)}getPasswordConnectionInfo(e){if(!e.url||e.url.length<1)throw new Error("Invalid URL");let t=RI(e.url),n=e.disposables||[],i=!Array.isArray(e.disposables),o=this.savedConnectInfo.get(e.handle);return o||(o=this.getJupyterConnectionInfo({url:t,isTokenEmpty:e.isTokenEmpty,disposables:n,validationErrorMessage:e.validationErrorMessage}).then(s=>((!s||s.requiresPassword&&Object.keys(s).length===1)&&(d.warn(`Password for ${t} was invalid.`),this.savedConnectInfo.delete(e.handle)),s)),o.catch(()=>this.savedConnectInfo.delete(e.handle)),o.finally(()=>{i&&z(n)}).catch(h),this.savedConnectInfo.set(e.handle,o)),o}async getJupyterConnectionInfo(e){let t,n,i,o,s=await this.needPassword(e.url);if(s||e.isTokenEmpty){if(s&&e.isTokenEmpty){let a=wc.window.createInputBox();e.disposables.push(a),a.title=I.jupyterSelectPasswordTitle,a.placeholder=I.jupyterSelectPasswordPrompt,a.ignoreFocusOut=!0,a.password=!0,a.validationMessage=e.validationErrorMessage||"",a.show(),a.buttons=[wc.QuickInputButtons.Back],o=await new Promise((l,c)=>{a.onDidTriggerButton(u=>{u===wc.QuickInputButtons.Back&&c(Re.back)},this,e.disposables),a.onDidChangeValue(()=>a.validationMessage="",this,e.disposables),a.onDidAccept(()=>l(a.value),this,e.disposables),a.onDidHide(()=>c(Re.cancel),this,e.disposables)})}if(typeof o===void 0&&!o&&e.isTokenEmpty)throw new wc.CancellationError;if(o||e.isTokenEmpty)if(t=await this.getXSRFToken(e.url,""),t){let a=await this.getSessionCookie(e.url,t,o||"");n=a.sessionCookieName,i=a.sessionCookieValue}else n="authservice_session",i=o,t=await this.getXSRFToken(e.url,`${n}=${i}`);else return{requiresPassword:s}}else return{requiresPassword:s};return t&&n&&(i||e.isTokenEmpty)?(A("DS_INTERNAL.GET_PASSWORD_SUCCESS"),{requestHeaders:{Cookie:`_xsrf=${t}; ${n}=${i||""}`,"X-XSRFToken":t},requiresPassword:s}):(A("DS_INTERNAL.GET_PASSWORD_FAILURE"),{requiresPassword:s})}addAllowUnauthorized(e,t,n){if(e.startsWith("https")&&t&&this.agentCreator){let i=this.agentCreator.createHttpRequestAgent();return{...n,agent:i}}return n}async getXSRFToken(e,t){let n,i,o=new URL("login?",RI(e)).toString();t!=""?(o=new URL("tree",RI(e)).toString(),i={Connection:"keep-alive",Cookie:t}):i={Connection:"keep-alive"};let s=await this.makeRequest(o,{method:"get",redirect:"manual",headers:i});if(s!==void 0&&s.ok){let a=this.getCookies(s);a.has("_xsrf")&&(n=a.get("_xsrf")?.split(";")[0])}return n}async needPassword(e){let t=await this.makeRequest(RI(e),{method:"get",redirect:"follow",headers:{Connection:"keep-alive"}});if(t.status===200&&t.redirected){if(t.url.toLowerCase().includes("/login?"))return!0;if(t.url.toLowerCase().includes("/lab?"))return!1}let n=new URL("tree?",RI(e)).toString();return t=await this.makeRequest(n,{method:"get",redirect:"manual",headers:{Connection:"keep-alive"}}),t.status===404?(d.error(`Jupyter Server not found at ${e}, got 404 for ${n}`),!1):t.status!==200}async makeRequest(e,t){let n=this.configService.getSettings(void 0).allowUnauthorizedRemoteConnection;try{return await this.requestCreator.getFetchMethod()(e,this.addAllowUnauthorized(e,!!n,t))}catch(i){if(i.message.indexOf("reason: self signed certificate")>=0){let o=I.jupyterSelfCertEnable,s=I.jupyterSelfCertClose,a=await wc.window.showErrorMessage(I.jupyterSelfCertFail(i.message),{modal:!0},o,s);if(a===o)return A("DATASCIENCE.SELFCERTSMESSAGEENABLED"),await this.configService.updateSetting("allowUnauthorizedRemoteConnection",!0,void 0,wc.ConfigurationTarget.Workspace),this.requestCreator.getFetchMethod()(e,this.addAllowUnauthorized(e,!0,t));a===s&&A("DATASCIENCE.SELFCERTSMESSAGECLOSE")}throw i}}async getSessionCookie(e,t,n){let i,o,s=new URLSearchParams;s.append("_xsrf",t),s.append("password",n);let a=await this.makeRequest(new URL("login?",RI(e)).toString(),{method:"post",headers:{Cookie:`_xsrf=${t}`,Connection:"keep-alive","content-type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s.toString(),redirect:"manual"});if(a.status===302){let l=this.getCookies(a);l.size>0&&(i=l.entries().next().value[0],o=l.entries().next().value[1])}return{sessionCookieName:i,sessionCookieValue:o}}getCookies(e){let t=new Map,i=(e.headers.raw?e.headers.raw():e.headers)["set-cookie"];return i&&i.forEach(o=>{let s=o.substring(0,o.indexOf("=")),a=o.substring(o.indexOf("=")+1);t.set(s,a)}),t}onDidRemoveServers(e){e.forEach(t=>{t.id.startsWith("_builtin")&&this.savedConnectInfo.delete(t.handle)})}};function RI(r){let e=r;return e[e.length-1]!=="/"&&(e=`${e}/`),e}var x1=require("vscode");var S1=class{constructor(e,t,n,i,o,s,a){this.multiStepFactory=e;this.asyncDisposableRegistry=t;this.configService=n;this.agentCreator=i;this.requestCreator=o;this.serverUriStorage=s;this.disposables=a;this.savedConnectInfo=new Map;this.serverUriStorage.onDidRemove(this.onDidRemoveServers,this,this.disposables)}async getPasswordConnectionInfo(e){if(!e.url||e.url.length<1)throw new Error("Invalid URL");if(!await this.isJupyterHub(e.url))throw new Error("Not a Jupyter Hub Url");let t=cY(e.url),n=e.disposables||[],i=!Array.isArray(e.disposables),o=this.savedConnectInfo.get(e.handle);return o||(o=this.getJupyterHubConnectionInfo(t,e.validationErrorMessage).then(s=>((!s||s.requiresPassword&&Object.keys(s).length===1)&&(d.warn(`Password for ${t} was invalid.`),this.savedConnectInfo.delete(e.handle)),s)),o.catch(()=>this.savedConnectInfo.delete(e.handle)),o.finally(()=>{i&&z(n)}).catch(h),this.savedConnectInfo.set(e.handle,o)),o}async isJupyterHub(e){try{if(e.toLowerCase().includes("/user/")&&e.includes("token="))return!1;if(e.toLowerCase().includes("/user/")&&!e.includes("token="))return!0;let t=await this.makeRequest(new URL("hub/api",cY(e)).toString(),{method:"get"});if(t.status!==200)return!1;try{let n=await t.json();return d.trace(`JupyterHub version is ${n&&n.version} for url ${e}`),n&&n.version}catch{}return!1}catch(t){return d.debug(`Error in detecting whether url is isJupyterHub: ${t}`),!1}}async getJupyterHubConnectionInfo(e,t){try{let n=await this.getUserNameAndPassword(t);if(n.username||n.password){let i=await this.getJupyterHubConnectionInfoFromLogin(e,n.username,n.password);if(i){let o=Object.keys(i||{}).length===0,s=o?"emptyResponseFromLogin":"gotResponseFromLogin";A("DS_INTERNAL.JUPYTER_HUB_PASSWORD",void 0,{failed:o,info:s})}else{A("DS_INTERNAL.JUPYTER_HUB_PASSWORD",void 0,{failed:!0,info:"emptyResponseFromLogin"}),i=await this.getJupyterHubConnectionInfoFromApi(e,n.username,n.password);let o=Object.keys(i||{}).length===0,s=o?"emptyResponseFromApi":"gotResponseFromApi";A("DS_INTERNAL.JUPYTER_HUB_PASSWORD",void 0,{failed:o,info:s})}return i}return A("DS_INTERNAL.JUPYTER_HUB_PASSWORD",void 0,{failed:!1,info:"passwordNotRequired"}),{requiresPassword:!1}}catch(n){throw A("DS_INTERNAL.JUPYTER_HUB_PASSWORD",void 0,{failed:!0,info:"failure"}),n}}async getJupyterHubConnectionInfoFromLogin(e,t,n){let i=new URL(e),o=`${i.protocol}//${i.host}`,s=new URLSearchParams;s.append("username",t||""),s.append("password",n||"");let a=await this.makeRequest(`${o}/hub/login?next=`,{method:"POST",headers:{Connection:"keep-alive",Referer:`${o}/hub/login`,"content-type":"application/x-www-form-urlencoded;charset=UTF-8"},body:s.toString(),redirect:"manual"});if(a&&a.status===302){let c=[...this.getCookies(a).entries()].reduce((u,p)=>`${u};${p[0]}=${p[1]}`,"");if(a=await this.makeRequest(`${o}/hub/api/users/${t}/tokens`,{method:"POST",headers:{Connection:"keep-alive",Cookie:c,Referer:`${o}/hub/login`}}),a.ok&&a.status===200){let u=await a.json();if(u&&u.token&&u.id)return await this.makeRequest(`${o}/hub/api/users/${t}/server`,{method:"POST",headers:{Connection:"keep-alive",Cookie:c,Referer:`${o}/hub/login`}}),this.asyncDisposableRegistry.push({dispose:async()=>{this.makeRequest(`${o}/hub/api/users/${t}/tokens/${u.id}`,{method:"DELETE",headers:{Connection:"keep-alive",Cookie:c,Referer:`${o}/hub/login`}}).catch(h)}}),{requestHeaders:{},remappedBaseUrl:`${o}/user/${t}`,remappedToken:u.token,requiresPassword:!0}}}}async getJupyterHubConnectionInfoFromApi(e,t,n){let i=new URL(e),o=`${i.protocol}//${i.host}`,s=await this.makeRequest(`${o}/hub/api/authorizations/token`,{method:"POST",headers:{Connection:"keep-alive","content-type":"application/json;charset=UTF-8"},body:`{ "username": "${t||""}", "password": "${n||""}" }`,redirect:"manual"});if(s.ok&&s.status===200){let a=await s.json();if(a&&a.user&&a.user.server&&a.token)return{requestHeaders:{},remappedBaseUrl:`${o}${a.user.server}`,remappedToken:a.token,requiresPassword:!0}}return{requiresPassword:!1}}addAllowUnauthorized(e,t,n){if(e.startsWith("https")&&t&&this.agentCreator){let i=this.agentCreator.createHttpRequestAgent();return{...n,agent:i}}return n}async getUserNameAndPassword(e){let t=this.multiStepFactory.create(),n={username:"",password:"",validationMessage:e};return await t.run(this.getUserNameMultiStep.bind(this),n),n}async getUserNameMultiStep(e,t){if(t.username=await e.showInputBox({title:I.jupyterSelectUserAndPasswordTitle,prompt:I.jupyterSelectUserPrompt,validate:this.validateUserNameOrPassword,validationMessage:t.validationMessage,value:""}),t.username)return this.getPasswordMultiStep.bind(this)}async validateUserNameOrPassword(e){}async getPasswordMultiStep(e,t){t.password=await e.showInputBox({title:I.jupyterSelectUserAndPasswordTitle,prompt:I.jupyterSelectPasswordPrompt,validate:this.validateUserNameOrPassword,value:"",password:!0})}async makeRequest(e,t){let n=this.configService.getSettings(void 0).allowUnauthorizedRemoteConnection;try{return await this.requestCreator.getFetchMethod()(e,this.addAllowUnauthorized(e,!!n,t))}catch(i){if(i.message.indexOf("reason: self signed certificate")>=0){let o=I.jupyterSelfCertEnable,s=I.jupyterSelfCertClose,a=await x1.window.showErrorMessage(I.jupyterSelfCertFail(i.message),{modal:!0},o,s);if(a===o)return A("DATASCIENCE.SELFCERTSMESSAGEENABLED"),await this.configService.updateSetting("allowUnauthorizedRemoteConnection",!0,void 0,x1.ConfigurationTarget.Workspace),this.requestCreator.getFetchMethod()(e,this.addAllowUnauthorized(e,!0,t));a===s&&A("DATASCIENCE.SELFCERTSMESSAGECLOSE")}throw i}}getCookies(e){let t=new Map,i=(e.headers.raw?e.headers.raw():e.headers)["set-cookie"];return i&&i.forEach(o=>{let s=o.substring(0,o.indexOf("=")),a=o.substring(o.indexOf("=")+1);t.set(s,a)}),t}onDidRemoveServers(e){e.forEach(t=>{t.id.startsWith("_builtin")&&this.savedConnectInfo.delete(t.handle)})}};function cY(r){let e=r;return e[e.length-1]!=="/"&&(e=`${e}/`),e}var C1="user-jupyter-server-uri-list-version2";var UIe="DataScienceAllowInsecureConnections",AI=class extends tr{constructor(t,n,i,o,s,a,l,c,u,p,f,g,v,b=cA){super();this.jupyterConnection=n;this.context=f;this.fs=g;this.jupyterServerProviderRegistry=v;this.id=b;this.extensionId=Ue;this.documentation=St.Uri.parse("https://aka.ms/vscodeJuptyerExtKernelPickerExistingServer");this.displayName=I.UserJupyterServerUrlProviderDisplayName;this.detail=I.UserJupyterServerUrlProviderDetail;this._onDidChangeHandles=this._register(new St.EventEmitter);this.onDidChangeHandles=this._onDidChangeHandles.event;this._onDidChangeServers=this._register(new St.EventEmitter);this.onDidChangeServers=this._onDidChangeServers.event;a.push(this),this.newStorage=new xw(i),this.secureConnectionValidator=new Sw(s),this.jupyterServerUriInput=new Iw(p),this.jupyterServerUriDisplayName=new BL,this.jupyterPasswordConnect=new I1(t,u,p,o,a),this.jupyterHubPasswordConnect=new S1(l,c,t,u,p,o,a)}activate(){let t=this._register(this.jupyterServerProviderRegistry.createJupyterServerCollection(Ue,this.id,this.displayName,this));t.commandProvider=this,t.documentation=this.documentation,this._register(this.onDidChangeHandles(()=>this._onDidChangeServers.fire(),this)),this._register(St.commands.registerCommand("dataScience.ClearUserProviderJupyterServerCache",async()=>{await Promise.all([this.newStorage.clear().catch(h),this.fs.delete(St.Uri.joinPath(this.context.globalStorageUri,_y)).catch(h)]),this._onDidChangeHandles.fire()})),this.initializeServers().catch(h)}async resolveJupyterServer(t,n){let i=await this.getServerUri(t.id);return{...t,connectionInformation:{id:t.id,label:t.label,baseUrl:St.Uri.parse(i.baseUrl),token:i.token,headers:i.authorizationHeader,mappedRemoteNotebookDir:i.mappedRemoteNotebookDir?St.Uri.file(i.mappedRemoteNotebookDir):void 0}}}async handleCommand(t,n){let i=new St.CancellationTokenSource;this._register(new St.Disposable(()=>{i.cancel(),i.dispose()}));try{let o="url"in t?t.url:void 0,s=await this.captureRemoteJupyterUrl(i.token,o);if(!s||s===Re.cancel)throw new St.CancellationError;if(s&&s instanceof Re)return;let l=(await this.provideJupyterServers(i.token)).find(c=>c.id===s);if(!l)throw new Error(`Server ${s} not found`);return l}catch(o){if(o instanceof St.CancellationError)throw o;d.error("Failed to select a Jupyter Server",o);return}finally{i.cancel(),i.dispose()}}async provideCommands(t,n){let i="";try{t=(t||"").trim(),["http:","https:"].includes(new URL(t.trim()).protocol.toLowerCase())&&(i=t)}catch{}return i?[{label:I.connectToToTheJupyterServer(i),url:i}]:[{label:I.jupyterSelectUriCommandLabel,canBeAutoSelected:!0}]}async provideJupyterServers(t){return await this.initializeServers(),(await this.newStorage.getServers(!1)).map(i=>({id:i.handle,label:i.serverInfo.displayName}))}async removeJupyterServer(t){await this.initializeServers(),await this.newStorage.remove(t.id),this._onDidChangeHandles.fire()}initializeServers(){if(this._cachedServerInfoInitialized)return this._cachedServerInfoInitialized;let t=oe();return this._cachedServerInfoInitialized=t.promise,(async()=>{this.newStorage.getServers(!1).catch(h),t.resolve()})().then(()=>t.resolve(),n=>t.reject(n)).catch(h),this._cachedServerInfoInitialized}recommendInstallingJupyterHubExtension(){if(!St.workspace.getConfiguration("jupyter").get("bypassJupyterHubExtensionCheck"))throw St.extensions.getExtension(yh)?St.window.showInformationMessage(I.useJupyterHubExtension,{modal:!0,detail:I.useJupyterHubExtensionDetail}).then(()=>{St.commands.executeCommand("notebook.selectKernel",{notebookEditor:St.window.activeNotebookEditor}).then(h,h)},h):St.window.showInformationMessage(I.installJupyterHub,{modal:!0,detail:I.installJupyterHubDetail},me.install,me.moreInfo).then(t=>{t===me.install?St.commands.executeCommand("workbench.extensions.installExtension",yh,{context:{skipWalkthrough:!0}}).then(h,h):t===me.moreInfo&&St.env.openExternal(St.Uri.parse("https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter-hub")).then(h,h)},h),new St.CancellationError}async captureRemoteJupyterUrl(t,n=""){await this.initializeServers();let i=[],o={baseUrl:"",displayName:"",token:""},s="",a=!1,l=!1,c,u="Get Url",p="Get Url",f=n,g=!1;if(n){let v=await this.jupyterServerUriInput.parseUserUriAndGetValidationError(n);typeof v.validationError=="string"?(s=v.validationError,u="Get Url"):(g=!0,o=v.jupyterServerUri,u="Check Passwords")}try{let v=!1,b=!1;for(;;)try{if(c=(0,pY.default)(),u==="Get Url"){g=!1,u="Check Passwords",p=void 0;let E=s;s="";let R=await this.jupyterServerUriInput.getUrlFromUser(f||n,E,i);o=R.jupyterServerUri,f=R.url}if(t.isCancellationRequested)return Re.cancel;let C=[];if(u==="Check Passwords"){u="Check Insecure Connections",p=g&&n?void 0:"Get Url";try{let E=s;s="",v=await this.jupyterHubPasswordConnect.isJupyterHub(o.baseUrl),v&&this.recommendInstallingJupyterHubExtension();let R=v?await this.jupyterHubPasswordConnect.getPasswordConnectionInfo({url:o.baseUrl,handle:c,displayName:o.displayName,validationErrorMessage:E,disposables:C}):await this.jupyterPasswordConnect.getPasswordConnectionInfo({url:o.baseUrl,isTokenEmpty:o.token.length===0,handle:c,validationErrorMessage:E,disposables:C});a=R.requiresPassword,o.authorizationHeader=R.requestHeaders,b=!1}catch(E){if(b=!1,E instanceof St.CancellationError||E==Re.back||E==Re.cancel)throw E;if(!Jo.isSelfCertsError(E)){if(!kl.isSelfCertsExpiredError(E)){Qf(c,o.baseUrl,v,"ConnectionFailure");let R=/(https?:\/\/[^\s]+)/g,_=(E.message||E.toString()).replace(R,L=>`[${L}](${L})`);if(s=(ln()?I.remoteJupyterConnectionFailedWithoutServerWithErrorWeb:I.remoteJupyterConnectionFailedWithoutServerWithError)(_),o.token.length>0&&(E.message||"").toLowerCase()==="Failed to fetch".toLowerCase())b=!0;else{u="Get Url";continue}}}}finally{C.forEach(E=>this._register(E))}}if(t.isCancellationRequested)return Re.cancel;if(u==="Check Insecure Connections"&&(u="Verify Connection",p=a&&o.token.length===0?"Check Passwords":"Get Url",p==="Get Url"&&(p=g&&n?void 0:"Get Url"),!a&&o.token.length===0&&new URL(o.baseUrl).protocol.toLowerCase()==="http:"&&(l=!0,z(C),!await this.secureConnectionValidator.promptToUseInsecureConnections())))return Qf(c,o.baseUrl,v,"InsecureHTTP"),Re.cancel;if(t.isCancellationRequested)return Re.cancel;if(u==="Verify Connection")try{u="Get Display Name",await this.jupyterConnection.validateRemoteUri({id:this.id,handle:c,extensionId:Ue},o,!0)}catch(E){if(d.warn("Uri verification error",E),b&&s){u="Get Url";continue}if(E instanceof St.CancellationError||E==Re.back||E==Re.cancel)throw E;if(Jo.isSelfCertsError(E)){s=I.jupyterSelfCertFailErrorMessageOnly,u="Get Url",Qf(c,o.baseUrl,v,"SelfCert");continue}else if(kl.isSelfCertsExpiredError(E)){s=I.jupyterSelfCertExpiredErrorMessageOnly,u="Get Url",Qf(c,o.baseUrl,v,"ExpiredCert");continue}else if(a&&o.token.length===0){s=I.passwordFailure,u="Check Passwords",Qf(c,o.baseUrl,v,"AuthFailure");continue}else{Qf(c,o.baseUrl,v,"ConnectionFailure");let R=/(https?:\/\/[^\s]+)/g,_=(E.message||E.toString()).replace(R,L=>`[${L}](${L})`);s=(ln()?I.remoteJupyterConnectionFailedWithoutServerWithErrorWeb:I.remoteJupyterConnectionFailedWithoutServerWithError)(_),u="Get Url";continue}}finally{z(C)}if(t.isCancellationRequested)return Re.cancel;if(u==="Get Display Name"){z(C),p=l?"Check Insecure Connections":a&&o.token.length===0?"Check Passwords":"Get Url",p==="Get Url"&&(p=g&&n?void 0:"Get Url"),o.displayName=await this.jupyterServerUriDisplayName.getDisplayName(c,o.displayName||new URL(o.baseUrl).hostname);break}}catch(C){if(C instanceof St.CancellationError||C===Re.cancel)return Re.cancel;if(C===Re.back){if(!p)return Re.back;u=p;continue}throw C}return t.isCancellationRequested?Re.cancel:(await this.addNewServer({handle:c,uri:f,serverInfo:o}),s_({extensionId:this.extensionId,id:this.id,handle:c},o.displayName),Qf(c,o.baseUrl,v),c)}catch(v){if(v instanceof St.CancellationError)return Re.cancel;throw v}finally{z(i)}}async addNewServer(t){await this.newStorage.add(t),this._onDidChangeHandles.fire()}async getServerUri(t){let i=(await this.newStorage.getServers(!1)).find(c=>c.handle===t);if(!i)throw new Error("Server not found");let o=i.serverInfo,s=this.jupyterServerUriDisplayName.displayNamesOfHandles.get(t);s&&(o.displayName=s);let a=await this.jupyterHubPasswordConnect.isJupyterHub(o.baseUrl),l=Object.assign({},o);try{let c=a?await this.jupyterHubPasswordConnect.getPasswordConnectionInfo({url:o.baseUrl,handle:t,displayName:o.displayName}):await this.jupyterPasswordConnect.getPasswordConnectionInfo({url:o.baseUrl,isTokenEmpty:o.token.length===0,handle:t});l=Object.assign({},o,{authorizationHeader:c.requestHeaders||o.authorizationHeader}),a&&c.remappedBaseUrl&&(l.baseUrl=c.remappedBaseUrl),a&&c.remappedToken&&(l.token=c.remappedToken)}catch(c){d.error("Failed to validate Password info",c)}return l}};AI=y([(0,Vr.injectable)(),m(0,(0,Vr.inject)(le)),m(1,(0,Vr.inject)(pn)),m(2,(0,Vr.inject)(_x)),m(3,(0,Vr.inject)(zt)),m(4,(0,Vr.inject)(Ve)),m(4,(0,Vr.named)(ft)),m(5,(0,Vr.inject)(O)),m(6,(0,Vr.inject)(Yg)),m(7,(0,Vr.inject)(Vo)),m(8,(0,Vr.inject)(xp)),m(8,(0,Vr.optional)()),m(9,(0,Vr.inject)(Bc)),m(10,(0,Vr.inject)(ot)),m(11,(0,Vr.inject)(st)),m(12,(0,Vr.inject)($t)),m(13,(0,Vr.optional)()),m(13,(0,Vr.inject)(Date.now().toString()))],AI);var Iw=class{constructor(e){this.requestCreator=e}async getUrlFromUser(e,t="",n){if(!e&&!iE)try{let s=await St.env.clipboard.readText(),a=s.trim().startsWith("https://github.com/")?void 0:St.Uri.parse(s.trim(),!0);e=s&&a&&a.scheme.toLowerCase().startsWith("http")?s:""}catch{e=""}let i=St.window.createInputBox();n.push(i),i.title=I.jupyterSelectUriInputTitle,i.placeholder=I.jupyterSelectUriInputPlaceholder,i.value=e,i.validationMessage=t,i.buttons=[St.QuickInputButtons.Back],i.ignoreFocusOut=!0,i.show();let o=oe();return i.onDidChangeValue(()=>i.validationMessage="",this,n),i.onDidHide(()=>o.reject(Re.cancel),this,n),i.onDidTriggerButton(s=>{s===St.QuickInputButtons.Back&&o.reject(Re.back)},this,n),i.onDidAccept(async()=>{let s=await this.parseUserUriAndGetValidationError(i.value);if(typeof s.validationError=="string"){i.validationMessage=s.validationError;return}o.resolve(s)}),o.promise}async parseUserUriAndGetValidationError(e){let t=e.trim().replace(/\/(lab|tree)(\??)$/,""),n=qL(t,"");return n?(n.baseUrl=await jIe(t,this.requestCreator)||n.baseUrl,!t.toLowerCase().startsWith("http:")&&!t.toLowerCase().startsWith("https:")?{validationError:I.jupyterSelectURIMustBeHttpOrHttps}:{jupyterServerUri:n,url:t,validationError:void 0}):{validationError:I.jupyterSelectURIInvalidURI}}};Iw=y([m(0,(0,Vr.inject)(Bc))],Iw);async function jIe(r,e){try{if(r=qL(r,"")?.baseUrl||r,new URL(r).pathname==="/")return r;let t=r.indexOf("token=")>0?r.substring(0,r.indexOf("token=")):r,o=(await e.getFetchMethod()(t,{method:"GET",redirect:"manual"})).headers.get("location");if(o&&o.includes("login?"))return o.substring(0,o.indexOf("login?"))}catch(t){d.debug("Unable to identify the baseUrl of the Jupyter Server",t)}}function Qf(r,e,t,n){e=e.trim().toLowerCase();let i=Lt({handle:r,extensionId:Ue,id:cA});Promise.all([mt(e.toLowerCase()),mt(i.toLowerCase())]).then(([o,s])=>{A("DATASCIENCE.ENTER_REMOTE_JUPYTER_URL",void 0,{serverIdHash:s,failed:!!n,baseUrlHash:o,isJupyterHub:t,isLocalHost:["localhost","127.0.0.1","::1"].includes(new URL(e).hostname),reason:n})}).catch(o=>d.error(`Failed to hash remote url ${e}`,o))}var BL=class{constructor(){this.displayNamesOfHandles=new Map}async getDisplayName(e,t){let n=[];try{let i=St.window.createInputBox();n.push(i),i.ignoreFocusOut=!0,i.title=I.jupyterRenameServer,i.value=t,i.placeholder=I.jupyterServerUriDisplayNameInputPlaceholder,i.buttons=[St.QuickInputButtons.Back],i.show();let o=oe();return n.push(i.onDidHide(()=>o.reject(Re.cancel))),i.onDidTriggerButton(s=>{s===St.QuickInputButtons.Back&&o.reject(Re.back)},this,n),i.onDidAccept(()=>{let s=i.value.trim()||t;this.displayNamesOfHandles.set(e,s),o.resolve(s)},this,n),await o.promise}finally{z(n)}}},Sw=class{constructor(e){this.globalMemento=e}async promptToUseInsecureConnections(){if(this.globalMemento.get(UIe,!1))return!0;let e=[],t=oe();try{let n=St.window.createQuickPick();return e.push(n),n.canSelectMany=!1,n.ignoreFocusOut=!0,n.title=I.insecureSessionMessage,n.buttons=[St.QuickInputButtons.Back],n.items=[{label:me.bannerLabelYes},{label:me.bannerLabelNo}],n.show(),e.push(n.onDidHide(()=>t.reject(Re.cancel))),n.onDidTriggerButton(i=>{i===St.QuickInputButtons.Back&&t.reject(Re.back)},this,e),n.onDidAccept(()=>t.resolve(n.selectedItems.some(i=>i.label===me.bannerLabelYes)),this,e),await t.promise}finally{z(e)}}};Sw=y([m(0,(0,Vr.inject)(Ve)),m(0,(0,Vr.named)(ft))],Sw);function qL(r,e){if(!r.startsWith(qe.REMOTE_URI))try{let t=new URL(r);return{baseUrl:`${t.protocol}//${t.host}${t.pathname==="/lab"||t.pathname==="/tree"?"":t.pathname}`,token:t.searchParams.get("token")||"",displayName:e||t.hostname}}catch(t){d.error(`Failed to parse URI ${r}`,t);return}}function uY(r){return r.map(e=>({handle:e.handle,uri:e.uri,displayName:e.serverInfo.displayName}))}function WIe(r){let e=[];return r.forEach(t=>{let n=qL(t.uri,t.displayName);n&&e.push({handle:t.handle,uri:t.uri,serverInfo:n})}),e}var xw=class{constructor(e){this.encryptedStorage=e;this.updatePromise=Promise.resolve()}async getServers(e){if(this.servers&&!e)return this.servers;let t=await this.encryptedStorage.retrieve(oi.JupyterServerRemoteLaunchService,C1);if(!t||t==="[]")return[];try{return this.servers=WIe(JSON.parse(t))}catch{return[]}}async add(e){this.servers&&(this.servers=this.servers.filter(t=>t.handle!==e.handle).concat(e)),await(this.updatePromise=this.updatePromise.then(async()=>{let t=(await this.getServers(!0)).concat(e);this.servers=t,await this.encryptedStorage.store(oi.JupyterServerRemoteLaunchService,C1,JSON.stringify(uY(t)))}).catch(h))}async remove(e){this.servers&&(this.servers=this.servers.filter(t=>t.handle!==e)),await(this.updatePromise=this.updatePromise.then(async()=>{let t=(await this.getServers(!0)).filter(n=>n.handle!==e);return this.servers=t,this.encryptedStorage.store(oi.JupyterServerRemoteLaunchService,C1,JSON.stringify(uY(t)))}).catch(h))}async clear(){this.servers=[],await(this.updatePromise=this.updatePromise.then(async()=>{this.servers=[],await this.encryptedStorage.store(oi.JupyterServerRemoteLaunchService,C1,void 0)}).catch(h))}};xw=y([m(0,(0,Vr.inject)(_x))],xw);var Cw=P(M()),MI=require("vscode");var NI=class extends tr{constructor(t,n){super();this.uriProviderRegistration=t;this.serverUriStorage=n;this.handleMappings=new Map;this._onDidChangeHandles=this._register(new MI.EventEmitter);this.extensionId=Ue;this.id=Hw;this.displayName="Jupyter Server for Testing";this.onDidChangeServers=this._onDidChangeHandles.event}async provideJupyterServers(t){return Array.from(this.handleMappings.values()).map(n=>n.server)}async resolveJupyterServer(t,n){return t}activate(){this._register(this.uriProviderRegistration.createJupyterServerCollection(Ue,this.id,this.displayName,this)),this._register(MI.commands.registerCommand("jupyter.selectjupyteruri",this.selectJupyterUri,this))}async selectJupyterUri(t){d.info(`Setting Jupyter Server URI to remote: ${t}`);let n=t.toString(!0),i=new URL(n),o=MI.Uri.parse(`${i.protocol}//${i.host}${i.pathname==="/lab"?"":i.pathname}`),s=i.searchParams.get("token")??"",a=await va(t.toString(!0),"SHA-1"),l={label:this.displayName,id:a,connectionInformation:{baseUrl:o,token:s}};this.handleMappings.set(a,{uri:t,server:l}),await this.serverUriStorage.add({id:this.id,handle:a,extensionId:Ue}),this._onDidChangeHandles.fire()}};NI=y([(0,Cw.injectable)(),m(0,(0,Cw.inject)($t)),m(1,(0,Cw.inject)(zt))],NI);var w1=P(M());var ww=require("vscode");var OI=class{constructor(e){this.disposables=e}activate(){this.registerCommandsIfTrusted()}dispose(){this.disposables.forEach(e=>e.dispose())}registerCommandsIfTrusted(){ww.workspace.isTrusted&&this.registerCommand(q.ContinueEditSessionInCodespace,this.continueEditSessionInCodespace)}registerCommand(e,t){let n=ww.commands.registerCommand(e,t,this);this.disposables.push(n)}async continueEditSessionInCodespace(){await ww.commands.executeCommand("_workbench.editSessions.actions.continueEditSession.github.codespaces.continueEditSessionInCodespaceWithJupyterServer")}};OI=y([(0,w1.injectable)(),m(0,(0,w1.inject)(O))],OI);var dY=P(M());var mY=require("vscode");var KI=class{activate(){this.eagerlyActivateOtherExtensions().catch(h)}async eagerlyActivateOtherExtensions(){await Promise.all(mY.extensions.all.filter(e=>e.packageJSON?.contributes?.pythonRemoteServerProvider).map(e=>e.isActive?Promise.resolve():e.activate().then(h,h)))}};KI=y([(0,dY.injectable)()],KI);var E1=P(M()),fY=require("vscode");var FI=class{constructor(e){this.uriStorage=e}activate(){fY.commands.registerCommand("jupyter.getUsedAzMLServerHandles",()=>{let e=[];return this.uriStorage.all.forEach(n=>{n.provider.extensionId.toLowerCase()==="ms-toolsai.vscode-ai".toLowerCase()&&e.push(n.provider)}),e})}};FI=y([(0,E1.injectable)(),m(0,(0,E1.inject)(zt))],FI);var Fu=require("vscode");var hY=P(M());var LI=class{activate(){let e=xe.instance.get(O),t=new $r;e.push(t),e.push(Fu.commands.registerCommand("jupyter.manageAccessToKernels",()=>VIe(t)))}};LI=y([(0,hY.injectable)()],LI);async function VIe(r){let e=await r3(),t=[];Array.from(e.entries()).forEach(([s])=>{let a=Fu.extensions.getExtension(s)?.packageJSON?.displayName;a&&t.push({label:a,description:s,extensionId:s})});let n=[];r.add({dispose:()=>{n=z(n)}});let i=Fu.window.createQuickPick();i.title=Fu.l10n.t("Manage Access To Jupyter Kernels"),i.placeholder=Fu.l10n.t("Choose which extensions can access Jupyter Kernels"),i.items=t,i.selectedItems=t.filter(s=>e.get(s.extensionId)===!0),i.canSelectMany=!0,i.ignoreFocusOut=!1;let o=!1;n.push(i),i.show(),await Promise.race([mx(i.onDidAccept,void 0,n).then(()=>o=!0),mx(i.onDidHide,void 0,n)]),o&&(await n3(i.selectedItems.map(s=>s.extensionId)),n=z(n))}var yY=require("vscode");var k1=class{constructor(){this.cache=new Map;this.executionCount=0}getResults(e,t){return this.executionCount!==e&&(this.cache.clear(),this.executionCount=e),this.cache.get(t)}setResults(e,t,n){if(this.executionCount<e)this.cache.clear(),this.executionCount=e;else if(this.executionCount>e)return;this.cache.set(t,n)}},gY=k1,vY=k1;var Yf=P(M());var UI=class{constructor(e,t){this.variables=e;this.kernelProvider=t;this.variableResultCache=new gY;this.variableSummaryCache=new vY;this.runningKernels=new Set;this._onDidChangeVariables=new yY.EventEmitter;this.onDidChangeVariables=this._onDidChangeVariables.event;this.kernelProvider.onKernelStatusChanged(this.onKernelStatusChanged,this)}onKernelStatusChanged({kernel:e}){if("variableProvider"in e.controller&&e.controller.variableProvider!==this)return;let t=e.notebook.uri.toString(),n=this.runningKernels.has(t);e.status==="idle"&&!n?this.runningKernels.add(t):e.status!=="busy"&&e.status!=="idle"&&n&&(this.runningKernels.delete(t),this._onDidChangeVariables.fire(e.notebook))}_getVariableResultCacheKey(e,t,n){let i="",o=t;return o&&(i=`${o.name}.${o.propertyChain.join(".")}[[${n}`),`${e}:${i}`}async*provideVariables(e,t,n,i,o){if(o.isCancellationRequested)return;let s=this.kernelProvider.get(e);if(!s||s.status==="dead"||s.status==="terminating")return;let a=this.kernelProvider.getKernelExecution(s).executionCount,l=this._getVariableResultCacheKey(e.uri.toString(),t,i),c=this.variableResultCache.getResults(a,l);if(t){let u=t;if(!c&&u.getChildren)c=(await u.getChildren(i,o)).map(f=>this.createVariableResult(f,s)),this.variableResultCache.setResults(a,l,c);else if(!c)return;for(let p of c)yield p;if(n===2&&u.count&&c.length>0&&u.count>i+c.length)for await(let p of this.provideVariables(e,t,n,i+c.length,o))yield p}else{c||(c=(await this.variables.getAllVariableDiscriptions(s,void 0,i,o)).map(p=>this.createVariableResult(p,s)),this.variableResultCache.setResults(a,l,c));for(let u of c)yield u}}_getVariableSummaryCacheKey(e,t){return`${e}:${t.name}`}async*provideVariablesWithSummarization(e,t,n,i,o){let s=this.kernelProvider.get(e),a=this.provideVariables(e,t,n,i,o);for await(let l of a)if(s&&s.status!=="dead"&&s.status!=="terminating"){let c=this._getVariableSummaryCacheKey(e.uri.toString(),l.variable),u=this.kernelProvider.getKernelExecution(s).executionCount,p=this.variableSummaryCache.getResults(u,c);p==null&&l.variable.type==="pandas.core.frame.DataFrame"&&(p=await this.variables.getVariableValueSummary({name:l.variable.name,value:l.variable.value,supportsDataExplorer:!1,type:l.variable.type??"",size:0,count:0,shape:"",truncated:!0},s,o),this.variableSummaryCache.setResults(u,c,p??null)),yield{hasNamedChildren:l.hasNamedChildren,indexedChildrenCount:l.indexedChildrenCount,variable:{name:l.variable.name,value:l.variable.value,expression:l.variable.expression,type:l.variable.type,language:l.variable.language,summary:p??""}}}}createVariableResult(e,t){let n=e.count??0,i=!!e.hasNamedChildren,o={getChildren:(s,a)=>this.getChildren(o,s,t,a),expression:BIe(e.root,e.propertyChain),...e};return{variable:o,hasNamedChildren:i,indexedChildrenCount:n}}async getChildren(e,t,n,i){let o=e;return await this.variables.getAllVariableDiscriptions(n,o,t,i)}};UI=y([(0,Yf.injectable)(),m(0,(0,Yf.inject)(kn)),m(0,(0,Yf.named)(qe.KERNEL_VARIABLES)),m(1,(0,Yf.inject)(Te))],UI);function BIe(r,e){let t=r;for(let n of e)typeof n=="string"?t+=`.${n}`:t+=`[${n}]`;return t}var Lu=P(M()),P1=require("vscode");var qIe=/Type:\s*(\w+)/,JIe=/Value:\s*(.*)/,$Ie=/String form:\s*([\s\S]+?)\n/,HIe=/Docstring:\s*(.*)/,GIe=/Length:\s+(.*)/,zIe=/^\s+\[(\d+) rows x (\d+) columns\]/m,QIe=new Set(["DataFrame","list","dict","ndarray","Series","Tensor","EagerTensor","DataArray"]),jI=class{constructor(e,t,n,i){this.configService=e;this.disposables=n;this.kernelProvider=i;this.variableRequesters=new Map;this.cachedVariables=new Map;this.refreshEventEmitter=new P1.EventEmitter;this.variableRequesters.set(ye,t)}get refreshRequired(){return this.refreshEventEmitter.event}async getAllVariableDiscriptions(e,t,n,i){let o=Io(e.kernelConnectionMetadata)||ye,s=this.variableRequesters.get(o);return s?s.getAllVariableDiscriptions(e,t,n,i):[]}async getVariables(e,t){return this.getVariablesBasedOnKernel(t,e)}async getMatchingVariable(e,t,n){let i=this.cachedVariables.get(t.uri.toString());if(i){let o=i.variables.find(s=>s.name===e);return o&&!o.value&&(o=await this.getVariableValueFromKernel(o,t,n)),o}else{let o=await this.getVariableNamesAndTypesFromKernel(t,n);if(o){let s=o.find(a=>a.name===e);if(s)return this.getVariableValueFromKernel({name:e,value:void 0,supportsDataExplorer:!1,type:s.type,fullType:s.fullType,size:0,count:0,shape:"",truncated:!0},t,n)}}}async getVariableValueSummary(e,t,n){if(!t)return;let i=Io(t?.kernelConnectionMetadata)||ye,o=this.variableRequesters.get(i);if(o)return o.getVariableValueSummary(e,t,n)}async getDataFrameInfo(e,t,n,i){if(!t)return e;let o=Io(t?.kernelConnectionMetadata)||ye,s=this.variableRequesters.get(o);if(s){i&&(e=await this.getFullVariable(e,t));let a=e.name;return n&&(a=`${e.name}${n}`),s.getDataFrameInfo(e,t,a)}return e}async getDataFrameRows(e,t,n,i,o){let s=Io(i?.kernelConnectionMetadata)||ye,a=this.variableRequesters.get(s);if(a){let l=e.name;return o&&(l=`${e.name}${o}`),a.getDataFrameRows(t,n,i,l)}return{data:[]}}async getFullVariable(e,t,n){let i=Io(t?.kernelConnectionMetadata)||ye,o=this.variableRequesters.get(i);return o?o.getFullVariable(e,t,n):e}async getVariablesBasedOnKernel(e,t){let n=this.cachedVariables.get(e.uri.toString()),i=this.kernelProvider.getKernelExecution(e).pendingCells.length>0,o=this.kernelProvider.getKernelExecution(e);(!n||!i&&(n.currentExecutionCount!==t.executionCount||n.currentExecutionCount!==o.executionCount))&&(n={currentExecutionCount:o.executionCount,variables:(await this.getVariableNamesAndTypesFromKernel(e)).map(l=>({name:l.name,value:void 0,supportsDataExplorer:!1,type:l.type,fullType:l.fullType,size:0,shape:"",count:0,truncated:!0,fileName:e.notebook.uri}))});let s=this.configService.getSettings(e.resourceUri).variableExplorerExclude?this.configService.getSettings().variableExplorerExclude?.split(";"):[],a={executionCount:o.executionCount,pageStartIndex:-1,pageResponse:[],totalCount:0,refreshCount:t.refreshCount};if(n){let l=t.sortColumn,c=(f,g)=>{let v=f[l]?f[l]:"",b=g[l]?g[l]:"";return t.sortAscending?v.localeCompare(b,void 0,{sensitivity:"base"}):b.localeCompare(v,void 0,{sensitivity:"base"})};n.variables.sort(c);let u=t.startIndex?t.startIndex:0,p=t.pageSize?t.pageSize:100;a.pageStartIndex=u;for(let f=u;f<u+p&&f<n.variables.length;){if(s&&s.indexOf(n.variables[f].type)>=0){n.variables.splice(f,1);continue}let g=typeof n.variables[f].value=="string"?n.variables[f]:await this.getVariableValueFromKernel(n.variables[f],e);n.variables[f]=g,a.pageResponse.push(g),f+=1}this.cachedVariables.set(e.uri.toString(),n),a.totalCount=n.variables.length}return a}async getVariableProperties(e,t,n){let i=await this.getMatchingVariable(e,t,n),o=Io(t.kernelConnectionMetadata)||ye,s=this.variableRequesters.get(o);return s?s.getVariableProperties(e,n,i):{}}async getVariableNamesAndTypesFromKernel(e,t){let n=Io(e.kernelConnectionMetadata)||ye,i=this.variableRequesters.get(n);return i?i.getVariableNamesAndTypesFromKernel(e,t):[]}inspect(e,t,n=0,i){let o=oe();try{e.requestInspect({code:t,cursor_pos:n,detail_level:0}).then(s=>{s&&s.content.status==="ok"?o.resolve(s.content.data):o.resolve(void 0)}).catch(s=>{o.reject(s)})}catch(s){o.reject(s)}return i&&this.disposables.push(i.onCancellationRequested(()=>o.reject(new P1.CancellationError))),o.promise}async getVariableValueFromKernel(e,t,n){let i={...e};if(!t.disposed&&t.session?.kernel){let o=await this.inspect(t.session.kernel,e.name,0,n);if(o&&o.hasOwnProperty("text/plain")){let s=ac(o["text/plain"].toString()),a=qIe.exec(s),l=GIe.exec(s),c=zIe.exec(s);a&&(i.type=a[1]),i.value=[JIe,$Ie,HIe].reduce((u,p)=>u||p.exec(s)?.[1]||"",""),l&&(i.count=parseInt(l[1],10)),c&&(i.shape=`(${c[1]}, ${c[2]})`)}o&&o.type&&(i.type=o.type.toString()),o&&o.value&&(i.value=o.value.toString()),QIe.has(i.type)&&(i.supportsDataExplorer=!0)}return i.type&&i.count&&!i.shape&&vt(t.kernelConnectionMetadata)&&i.supportsDataExplorer&&i.type!=="list"&&(i=await this.getFullVariable(i,t)),i}};jI=y([(0,Lu.injectable)(),m(0,(0,Lu.inject)(le)),m(1,(0,Lu.inject)(RT)),m(1,(0,Lu.named)(qe.PYTHON_VARIABLES_REQUESTER)),m(2,(0,Lu.inject)(O)),m(3,(0,Lu.inject)(Te))],jI);var Ew=P(M());var WI=class extends ze{constructor(){super("unknown",I.jupyterDataRateExceeded)}};async function D1(r,{code:e,initializeCode:t,cleanupCode:n},i){if(r.disposed||r.disposing||!r.session?.kernel||!r.session.kernel||r.session.isDisposed)return[];try{return t&&await bn(r.session.kernel,t,i),await bn(r.session.kernel,e,i)}catch(o){if(o instanceof yn)return[];throw o}finally{n&&await bn(r.session.kernel,n,i)}}var VI=class{constructor(e,t){this.varScriptGenerator=e;this.dfScriptGenerator=t}async getDataFrameInfo(e,t,n){let{code:i,cleanupCode:o,initializeCode:s}=await this.dfScriptGenerator.generateCodeToGetDataFrameInfo({isDebugging:!1,variableName:n}),a=await D1(t,{code:i,cleanupCode:o,initializeCode:s},{traceErrors:!0,traceErrorsMessage:"Failure in execute_request for getDataFrameInfo",telemetryName:"DATASCIENCE.PYTHON_VARIABLE_FETCHING_CODE_FAILURE"}),l=t.notebook?.uri||t.resourceUri||t.uri;return{...e,...this.deserializeJupyterResult(a),fileName:l}}async getDataFrameRows(e,t,n,i){let{code:o,cleanupCode:s,initializeCode:a}=await this.dfScriptGenerator.generateCodeToGetDataFrameRows({isDebugging:!1,variableName:i,startIndex:e,endIndex:t}),l=await D1(n,{code:o,cleanupCode:s,initializeCode:a},{traceErrors:!0,traceErrorsMessage:"Failure in execute_request for getDataFrameRows",telemetryName:"DATASCIENCE.PYTHON_VARIABLE_FETCHING_CODE_FAILURE"});return l.length===0?{data:[]}:y0(this.deserializeJupyterResult(l))}async getVariableProperties(e,t,n){let i={};return n&&n.value&&(i[`${e}`]=n.value),i}async getVariableValueSummary(e,t,n){let i=await this.varScriptGenerator.generateCodeToGetVariableValueSummary(e.name);try{return(await Ku(t,i.split(/\r?\n/),n))?.summary}catch(o){d.warn(`Exception when getting variable summary for variable "${e.name}": ${o.message}`);return}}async getAllVariableDiscriptions(e,t,n,i){if(!e.session)return[];let o=t?{root:t.root,propertyChain:t.propertyChain,startIndex:n}:void 0,s=await this.varScriptGenerator.generateCodeToGetAllVariableDescriptions(o),a=await Ku(e,s.split(/\r?\n/),i);if(e.disposed||e.disposing||i?.isCancellationRequested||!a)return[];try{return a}catch(l){return d.error(l),[]}}async getVariableNamesAndTypesFromKernel(e,t){if(e.session){let{code:n,cleanupCode:i,initializeCode:o}=await this.varScriptGenerator.generateCodeToGetVariableTypes({isDebugging:!1}),s=await D1(e,{code:n,cleanupCode:i,initializeCode:o},{traceErrors:!0,traceErrorsMessage:"Failure in execute_request for getVariableNamesAndTypesFromKernel",telemetryName:"DATASCIENCE.PYTHON_VARIABLE_FETCHING_CODE_FAILURE"});if(e.disposed||e.disposing)return[];let a=this.deserializeJupyterResult(s),l=[];for(let c of a){let u={...c,value:void 0,supportsDataExplorer:!1,size:0,shape:"",count:0,truncated:!0};l.push(u)}return l}return[]}async getFullVariable(e,t,n){let{code:i,cleanupCode:o,initializeCode:s}=await this.varScriptGenerator.generateCodeToGetVariableInfo({isDebugging:!1,variableName:e.name}),a=await D1(t,{code:i,cleanupCode:o,initializeCode:s},{traceErrors:!0,traceErrorsMessage:"Failure in execute_request for getFullVariable",telemetryName:"DATASCIENCE.PYTHON_VARIABLE_FETCHING_CODE_FAILURE"});return{...e,...this.deserializeJupyterResult(a)}}extractJupyterResultText(e){if(e.length>0){let t=e[0];if(t&&t.output_type==="stream"&&t.name==="stderr"&&t.hasOwnProperty("text")){let n=t.text;if(n.includes("iopub_data_rate_limit"))throw new WI;{let i=I.jupyterGetVariablesExecutionError(n);throw d.error(i),new Error(i)}}if(t&&t.output_type==="execute_result"){let n=t.data;if(n&&n.hasOwnProperty("text/plain"))return n["text/plain"]}if(t&&t.output_type==="stream"&&t.hasOwnProperty("text"))return t.text;if(t&&t.output_type==="error"&&t.hasOwnProperty("traceback")){let i=t.traceback.map(ac).join(`\r
|
||
`),o=I.jupyterGetVariablesExecutionError(i);throw d.error(o),new Error(o)}}throw new Error(I.jupyterGetVariablesBadResults)}deserializeJupyterResult(e){let t=this.extractJupyterResultText(e);return JSON.parse(t)}};VI=y([(0,Ew.injectable)(),m(0,(0,Ew.inject)(Jh)),m(1,(0,Ew.inject)($h))],VI);var Ec=P(M());var BI=class{constructor(e,t,n,i,o,s,a){this.activationService=e;this.jupyterInterpreterService=t;this.disposables=n;this.extensionChecker=i;this.apiProvider=o;this.rawNotebookSupported=s;this.condaService=a}activate(){this.rawNotebookSupported.isSupported||(this.disposables.push(this.jupyterInterpreterService.onDidChangeInterpreter(()=>this.preWarmInterpreterVariables().catch(h))),this.preWarmInterpreterVariables().catch(h),this.apiProvider.onDidActivatePythonExtension(this.preWarmInterpreterVariables,this,this.disposables)),this.extensionChecker.isPythonExtensionInstalled&&(this.condaService.getCondaFile().catch(h),this.condaService.getCondaVersion().catch(h))}async preWarmInterpreterVariables(){if(!this.extensionChecker.isPythonExtensionActive)return;let e=await this.jupyterInterpreterService.getSelectedInterpreter();e&&this.activationService.getActivatedEnvironmentVariables(void 0,e).catch(h)}};BI=y([(0,Ec.injectable)(),m(0,(0,Ec.inject)(Ks)),m(1,(0,Ec.inject)(fi)),m(2,(0,Ec.inject)(O)),m(3,(0,Ec.inject)($e)),m(4,(0,Ec.inject)(Yt)),m(5,(0,Ec.inject)(hi)),m(6,(0,Ec.inject)(Vs))],BI);function bY(r,e,t){e.addSingleton(ge,wI),e.addSingleton(ge,Gf),e.addSingleton(ge,II),e.addSingleton(ge,xI),e.addSingleton(ge,CI),e.addSingleton(ge,KI),e.addSingleton(ge,NI),e.add(xg,vI),e.add(Jk,yI),e.addSingleton(ge,bI),e.addSingleton(ge,OI),e.addSingleton(OL,Cc),e.addBinding(OL,ge),e.add(Xk,kI),e.addSingleton(Yk,EI),e.addSingleton(Ou,Ou),e.addSingleton(ge,_I),aY(e),qQ(r,t),e.addSingleton(ge,AI),e.addSingleton(ge,FI),e.addSingleton(ge,LI),e.addSingleton(AT,UI),e.addSingleton(kn,jI,qe.KERNEL_VARIABLES),e.addSingleton(RT,VI,qe.PYTHON_VARIABLES_REQUESTER),e.addSingleton(ge,BI)}var kc=P(M()),la=require("vscode");var _1=class{constructor(e,t,n){this.disposedCallback=n,this.callback=e,this.viewChanged=t}dispose(){this.disposedCallback()}onMessage(e,t){this.callback(e,t)}onChangeViewState(e){this.viewChanged(e)}};var IY=1e3,YIe;(t=>(t.Fetching="fetching",t.Skipped="skipped"))(YIe||={});var aa;(p=>(p.Started="started",p.UpdateSettings="update_settings",p.InitializeData="init",p.GetAllRowsRequest="get_all_rows_request",p.GetAllRowsResponse="get_all_rows_response",p.GetRowsRequest="get_rows_request",p.GetRowsResponse="get_rows_response",p.CompletedData="complete",p.GetSliceRequest="get_slice_request",p.RefreshDataViewer="refresh_data_viewer",p.SliceEnablementStateChanged="slice_enablement_state_changed"))(aa||={});var qI=Symbol("IDataViewerFactory"),T1=Symbol("IDataViewer"),R1=Symbol("IJupyterVariableDataProvider"),A1=Symbol("IJupyterVariableDataProviderFactory"),JI=Symbol("IDataViewerDependencyService");var $L;function HL(r,e){return $L&&$L.hasOwnProperty(r)?$L[r]:e}function GL(r,...e){return r.replace(/{(\d+)}/g,(t,n)=>e[n]===void 0?t:e[n])}var XIe=/^\s*((?<StartRange>-?\d+:)|(?<StopRange>-?:\d+)|(?:(?<Start>-?\d+)(?::(?<Stop>-?\d+))?(?::(?<Step>-?\d+))?))\s*$/;function zL(r){let e=r.length-2;return"["+r.map(()=>e>0?(e-=1,"0"):":").join(", ")+"]"}function ZIe(r,e){if(r.startsWith("[")&&r.endsWith("]")){let t,n=r.substring(1,r.length-1).split(",").map((i,o)=>{let s=XIe.exec(i);if(s?.groups?.Start&&!s.groups.Stop){let a=parseInt(s.groups.Start),l=e[o];return(a>=0&&a>=l||a<0&&a<-l)&&(t={shapeIndex:o,value:a}),a}});if(t){let{shapeIndex:i,value:o}=t,s=HL("sliceIndexError","Index {0} out of range for axis {1} with {2} elements");return GL(s,o.toString(),i.toString(),e[i].toString())}else if(n&&n.length!==e.length){let i=HL("sliceMismatchedAxesError","Expected {0} axes, got {1} in slice expression");return GL(i,e.length.toString(),n.length.toString())}}return""}function SY(r,e){return ZIe(r,e)===""}var ju=require("vscode");var Uu=class{constructor(e,t,n){this.configService=e;this.rootPath=t;this.scripts=n;this.disposed=!1;this.themeIsDarkPromise=oe();this.webviewInit=oe();this._disposables=[];this.onMessageListeners=[];this._onDidDisposeWebviewPanel=new ju.EventEmitter;this.onDataScienceSettingsChanged=async()=>{let e=JSON.stringify(await this.generateDataScienceExtraSettings());this.postMessageInternal("update_settings",e).catch(h)};this.onWebViewLoadFailed=async()=>{this.dispose()};this.onPossibleSettingsChange=async e=>{if(e.affectsConfiguration("workbench.colorTheme")||e.affectsConfiguration("editor.fontSize")||e.affectsConfiguration("editor.fontFamily")||e.affectsConfiguration("editor.cursorStyle")||e.affectsConfiguration("editor.cursorBlinking")||e.affectsConfiguration("editor.autoClosingBrackets")||e.affectsConfiguration("editor.autoClosingQuotes")||e.affectsConfiguration("editor.autoSurround")||e.affectsConfiguration("editor.autoIndent")||e.affectsConfiguration("editor.scrollBeyondLastLine")||e.affectsConfiguration("editor.fontLigatures")||e.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")||e.affectsConfiguration("editor.scrollbar.horizontalScrollbarSize")||e.affectsConfiguration("files.autoSave")||e.affectsConfiguration("files.autoSaveDelay")||e.affectsConfiguration("jupyter.widgetScriptSources")){let t=await this.generateDataScienceExtraSettings();if(t){let n=JSON.stringify(t);this.postMessageInternal("update_settings",n).catch(h)}}};this._disposables.push(ju.workspace.onDidChangeConfiguration(this.onPossibleSettingsChange,this)),this._disposables.push(this.configService.getSettings(void 0).onDidChange(this.onDataScienceSettingsChanged.bind(this)))}get onDidDispose(){return this._onDidDisposeWebviewPanel.event}dispose(){this.disposed||(this.disposed=!0,this._disposables.forEach(e=>e.dispose())),this.webviewInit=void 0,this._onDidDisposeWebviewPanel.fire()}getHTMLById(e){if(!this.activeHTMLRequest)this.activeHTMLRequest=oe(),this.postMessageInternal("get_html_by_id_request",e).catch(h);else throw new Error("getHTMLById request already in progress");return this.activeHTMLRequest.promise}addMessageListener(e){this.onMessageListeners.push(e)}removeMessageListener(e){let t=this.onMessageListeners.indexOf(e);t>=0&&this.onMessageListeners.splice(t,1)}asWebviewUri(e){if(!this.webview)throw new Error("asWebViewUri called too early");return this.webview?.asWebviewUri(e)}postMessage(e,t){return this.postMessageInternal(e.toString(),t)}onMessage(e,t){switch(e){case"started":this.webViewRendered();break;case"get_html_by_id_response":this.activeHTMLRequest&&(this.activeHTMLRequest.resolve(t),this.activeHTMLRequest=void 0);break;default:break}this.onMessageListeners.forEach(n=>{n(e,t)})}async loadWebview(e,t){if(this.disposed=!1,this.webviewInit=this.webviewInit||oe(),this.webview===void 0){let n=await this.generateDataScienceExtraSettings(),i=ju.workspace.getWorkspaceFolder(e)?.uri;this.webview=await this.provideWebview(e,n,i,t),this._disposables.push(this.webview.loadFailed(this.onWebViewLoadFailed,this))}this.onDataScienceSettingsChanged().catch(h),this.sendLocStrings().catch(h)}async generateDataScienceExtraSettings(){let e=this.owningResource,t=ju.workspace.getConfiguration("editor"),n=ju.workspace.getConfiguration("workbench"),i=n?n.get("colorTheme",uA):uA,o=ju.extensions.getExtension(si);return{...JSON.parse(JSON.stringify(this.configService.getSettings(e))),extraSettings:{editor:{cursor:this.getValue(t,"cursorStyle","line"),cursorBlink:this.getValue(t,"cursorBlinking","blink"),autoClosingBrackets:this.getValue(t,"autoClosingBrackets","languageDefined"),autoClosingQuotes:this.getValue(t,"autoClosingQuotes","languageDefined"),autoSurround:this.getValue(t,"autoSurround","languageDefined"),autoIndent:this.getValue(t,"autoIndent",!1),fontLigatures:this.getValue(t,"fontLigatures",!1),scrollBeyondLastLine:this.getValue(t,"scrollBeyondLastLine",!0),verticalScrollbarSize:this.getValue(t,"scrollbar.verticalScrollbarSize",14),horizontalScrollbarSize:this.getValue(t,"scrollbar.horizontalScrollbarSize",10),fontSize:this.getValue(t,"fontSize",14),fontFamily:this.getValue(t,"fontFamily","Consolas, 'Courier New', monospace")},theme:i,hasPythonExtension:o!==void 0,isWeb:Fr()==="Unknown"}}}async sendLocStrings(){let e={collapseSingle:Wt.collapseSingle,expandSingle:Wt.expandSingle,openExportFileYes:I.openExportFileYes,openExportFileNo:I.openExportFileNo,noRowsInDataViewer:Wt.noRowsInDataViewer,sliceIndexError:Wt.sliceIndexError,sliceMismatchedAxesError:Wt.sliceMismatchedAxesError,filterRowsTooltip:Wt.sliceMismatchedAxesError,fetchingDataViewer:Wt.fetchingDataViewer,dataViewerHideFilters:Wt.dataViewerHideFilters,dataViewerShowFilters:Wt.dataViewerShowFilters,refreshDataViewer:Wt.refreshDataViewer,clearFilters:Wt.refreshDataViewer,sliceSummaryTitle:Wt.sliceSummaryTitle,sliceData:Wt.sliceData,sliceSubmitButton:Wt.sliceSubmitButton,sliceDropdownAxisLabel:Wt.sliceDropdownAxisLabel,sliceDropdownIndexLabel:Wt.sliceDropdownIndexLabel,variableExplorerNameColumn:Wt.variableExplorerNameColumn,variableExplorerTypeColumn:Wt.variableExplorerTypeColumn,variableExplorerCountColumn:Wt.variableExplorerCountColumn,variableExplorerValueColumn:Wt.variableExplorerValueColumn,collapseVariableExplorerLabel:Wt.collapseVariableExplorerLabel,variableLoadingValue:Wt.variableLoadingValue,showDataExplorerTooltip:Wt.showDataExplorerTooltip,noRowsInVariableExplorer:Wt.noRowsInVariableExplorer,loadingRowsInVariableExplorer:Wt.loadingRowsInVariableExplorer,previousPlot:Wt.previousPlot,nextPlot:Wt.nextPlot,panPlot:Wt.panPlot,zoomInPlot:Wt.zoomInPlot,zoomOutPlot:Wt.zoomOutPlot,exportPlot:Wt.exportPlot,deletePlot:Wt.deletePlot,selectedImageListLabel:Wt.selectedImageListLabel,selectedImageLabel:Wt.selectedImageLabel};this.postMessageInternal("loc_init",JSON.stringify(e)).catch(h)}async postMessageInternal(e,t){this.webviewInit&&(await this.webviewInit.promise,this.webview?.postMessage({type:e.toString(),payload:t}))}webViewRendered(){this.webviewInit&&!this.webviewInit.resolved&&this.webviewInit.resolve(),this.sendLocStrings().catch(h),this.onDataScienceSettingsChanged().catch(h)}getValue(e,t,n){return e?e.get(t,n):n}};y([Eh()],Uu.prototype,"getHTMLById",1),y([Eh()],Uu.prototype,"addMessageListener",1),y([Eh()],Uu.prototype,"removeMessageListener",1);var $I=class extends Uu{constructor(t,n,i,o,s,a,l){super(t,o,s);this.configService=t;this.provider=n;this._title=a;this.viewColumn=l;this.viewState={visible:!1,active:!1};this.webPanelViewStateChanged=t=>{let n=t.isVisible(),i=t.isActive(),o={visible:n,active:i},s={visible:this.viewState.visible,active:this.viewState.active};this.viewState.visible=n,this.viewState.active=i,this.onViewStateChanged({current:o,previous:s})};this.messageListener=i(this.onMessage.bind(this),this.webPanelViewStateChanged.bind(this),this.dispose.bind(this))}get isDisposed(){return this.disposed}get webPanel(){if(this.webview)return this.webview}async show(t){this.isDisposed||this.webPanel&&await this.webPanel.show(t)}dispose(){this.isDisposed||this.webPanel&&this.webPanel.close(),super.dispose()}get title(){return this._title}setTitle(t){this._title=t,!this.isDisposed&&this.webPanel&&this.webPanel.setTitle(t)}onViewStateChanged(t){}async provideWebview(t,n,i,o){return this.provider.create({viewColumn:this.viewColumn,listener:this.messageListener,title:this.title,rootPath:this.rootPath,scripts:this.scripts,settings:n,cwd:t,webviewHost:o,additionalPaths:i?[i]:[]})}};var xY="JupyterDataViewerPreferredViewColumn",Xf=class extends $I{constructor(t,n,i,o,s){let a=er(s.extensionUri,"dist","webviews","webview-side","viewers");super(n,t,(l,c,u)=>new _1(l,c,u),a,[er(a,"dataExplorer.js")],I.dataExplorerTitle,i.get(xY)??la.ViewColumn.One);this.globalMemento=i;this.errorHandler=o;this.context=s;this.pendingRowsCount=0;this.sentDataViewerSliceDimensionalityTelemetry=!1;this._onDidDisposeDataViewer=new la.EventEmitter;this._onDidChangeDataViewerViewState=new la.EventEmitter;this.onDidDispose(this.dataViewerDisposed,this)}get active(){return!!this.webPanel?.isActive()}get refreshPending(){return this.pendingRowsCount>0}get onDidDisposeDataViewer(){return this._onDidDisposeDataViewer.event}get onDidChangeDataViewerViewState(){return this._onDidChangeDataViewerViewState.event}async showData(t,n){if(!this.isDisposed){this.dataProvider=t,await super.loadWebview(la.Uri.file(process.cwd())).catch(d.error),super.setTitle(n),await super.show(!0);let i=await this.prepDataFrameInfo();if(i.shape&&i.shape.length>2){this.maybeSendSliceDataDimensionalityTelemetry(i.shape.length);let o=zL(i.shape);i=await this.getDataFrameInfo(o)}this.postMessage(aa.InitializeData,i).catch(h)}}get kernel(){if(this.dataProvider&&"kernel"in this.dataProvider)return this.dataProvider.kernel}dataViewerDisposed(){this._onDidDisposeDataViewer.fire(this)}async refreshData(){let t=this.currentSliceExpression;this.dataFrameInfoPromise=void 0;let n=await this.getDataFrameInfo(void 0,!0);if(t!==void 0&&n.shape!==void 0)if(SY(t,n.shape))n=await this.getDataFrameInfo(t);else{let i=zL(n.shape);n=await this.getDataFrameInfo(i)}d.info(`Refreshing data viewer for variable ${n.name}`),this.postMessage(aa.InitializeData,n).catch(h)}dispose(){super.dispose(),this.dataProvider&&(this.dataProvider.dispose(),this.dataProvider=void 0)}async onViewStateChanged(t){t.current.active&&t.current.visible&&t.previous.active&&t.current.visible&&await this.globalMemento.update(xY,this.webPanel?.viewColumn),this._onDidChangeDataViewerViewState.fire()}get owningResource(){}onMessage(t,n){switch(t){case aa.GetAllRowsRequest:this.getAllRows(n).catch(h);break;case aa.GetRowsRequest:this.getRowChunk(n).catch(h);break;case aa.GetSliceRequest:this.getSlice(n).catch(h);break;case aa.RefreshDataViewer:this.refreshData().catch(h),A("DATASCIENCE.REFRESH_DATA_VIEWER");break;case aa.SliceEnablementStateChanged:A("DATASCIENCE.DATA_VIEWER_SLICE_ENABLEMENT_STATE_CHANGED",void 0,{newState:n.newState?"checked":"unchecked"});break;default:break}super.onMessage(t,n)}getDataFrameInfo(t,n){return(!this.dataFrameInfoPromise||t!==this.currentSliceExpression)&&(this.dataFrameInfoPromise=this.dataProvider?this.dataProvider.getDataFrameInfo(t,n):Promise.resolve({}),this.currentSliceExpression=t),this.dataFrameInfoPromise}async prepDataFrameInfo(){this.rowsTimer=new We;let t=await this.getDataFrameInfo();try{A("DATASCIENCE.SHOW_DATA_EXPLORER",void 0,{rows:t.rowCount?t.rowCount:0,columns:t.columns?t.columns.length:0}),this.pendingRowsCount=t.rowCount?t.rowCount:0}catch{}return t}async getAllRows(t){return this.wrapRequest(async()=>{if(this.dataProvider){let n=await this.dataProvider.getAllRows(t);return this.pendingRowsCount=0,this.postMessage(aa.GetAllRowsResponse,n)}})}getSlice(t){return this.wrapRequest(async()=>{if(this.dataProvider){let n=await this.getDataFrameInfo(t.slice);return n.shape?.length&&this.maybeSendSliceDataDimensionalityTelemetry(n.shape.length),A("DATASCIENCE.DATA_VIEWER_SLICE_OPERATION",void 0,{source:t.source}),this.postMessage(aa.InitializeData,n)}})}getRowChunk(t){return this.wrapRequest(async()=>{if(this.dataProvider){let n=await this.getDataFrameInfo(t.sliceExpression),i=await this.dataProvider.getRows(t.start,Math.min(t.end,n.rowCount?n.rowCount:0),t.sliceExpression);return this.pendingRowsCount=Math.max(0,this.pendingRowsCount-i.length),this.postMessage(aa.GetRowsResponse,{rows:i,start:t.start,end:t.end})}})}async wrapRequest(t){try{return await t()}catch(n){if(n instanceof WI){d.error(n.message);let i=I.pythonInteractiveHelpLink;la.window.showErrorMessage(I.jupyterDataRateExceeded,i).then(o=>{o===i&&la.env.openExternal(la.Uri.parse(AS.JupyterDataRateHelpLink))},h),this.dispose()}d.error(n),this.errorHandler.handleError(n).then(h,h)}finally{this.sendElapsedTimeTelemetry()}}sendElapsedTimeTelemetry(){this.rowsTimer&&this.pendingRowsCount===0&&A("DATASCIENCE.SHOW_DATA_EXPLORER_ROWS_LOADED",void 0,{rowsTimer:this.rowsTimer.elapsedTime})}maybeSendSliceDataDimensionalityTelemetry(t){this.sentDataViewerSliceDimensionalityTelemetry||(A("DATASCIENCE.DATA_VIEWER_DATA_DIMENSIONALITY",{numberOfDimensions:t}),this.sentDataViewerSliceDimensionalityTelemetry=!0)}};y([ur("DATAVIEWER.WEBVIEW_LOADED")],Xf.prototype,"showData",1),Xf=y([(0,kc.injectable)(),m(0,(0,kc.inject)(Dp)),m(1,(0,kc.inject)(le)),m(2,(0,kc.inject)(Ve)),m(2,(0,kc.named)(ft)),m(3,(0,kc.inject)(Zr)),m(4,(0,kc.inject)(ot))],Xf);var Pr=P(M()),Lo=require("vscode");var M1=require("vscode");var N1=class{constructor(e){this.configuration=e}async isRequestedColumnSizeAllowed(e,t){if(e>IY&&await this.shouldAskForLargeData(t)){let n=I.tooManyColumnsMessage,i=I.tooManyColumnsYes,o=I.tooManyColumnsNo,s=I.tooManyColumnsDontAskAgain,a=await M1.window.showWarningMessage(n,i,o,s);return a===s&&await this.disableAskForLargeData(),a===i}return!0}async shouldAskForLargeData(e){let t=e?this.configuration.getSettings(e):this.configuration.getSettings();return t&&t.askForLargeDataFrames===!0}async disableAskForLargeData(e){let t=e?this.configuration.getSettings(e):this.configuration.getSettings();t&&(t.askForLargeDataFrames=!1,this.configuration.updateSetting("askForLargeDataFrames",!1,void 0,M1.ConfigurationTarget.Global).catch(h))}};var Ha=require("vscode");var O1=P(M());var Ga=class{constructor(e){this.experiments=e}async showContributedDataViewer(e){try{if(this.experiments.inExperiment("DataViewerContribution")){let t=this.getMatchingVariableViewers(e);if(t.length===0)return Ha.commands.executeCommand("workbench.extensions.search","@tag:jupyterVariableViewers");if(t.length===1){let n=t[0].jupyterVariableViewers.command;return Ha.commands.executeCommand(n,e)}else{let n=t.filter(o=>o.extension.id!==Ue);if(n.length===1){let o=n[0].jupyterVariableViewers.command;return Ha.commands.executeCommand(o,e)}let i=Ha.window.createQuickPick();i.title="Select DataFrame Viewer",i.items=t.map(o=>({label:o.jupyterVariableViewers.title,detail:o.extension.packageJSON?.displayName??o.extension.id,command:o.jupyterVariableViewers.command})),i.onDidAccept(async()=>{let o=i.selectedItems[0];if(o)return i.hide(),Ha.commands.executeCommand(o.command,e)}),i.show()}}else return Ha.commands.executeCommand(q.ShowJupyterDataViewer,e)}catch(t){d.error(t),A("DATASCIENCE.FAILED_SHOW_DATA_EXPLORER"),Ha.window.showErrorMessage(I.showDataViewerFail).then(h,h)}}getMatchingVariableViewers(e){return this.getVariableViewers().filter(n=>n.jupyterVariableViewers.dataTypes.includes(e.type))}getVariableViewers(){return Ha.extensions.all.filter(t=>t.packageJSON?.contributes?.jupyterVariableViewers&&t.packageJSON?.contributes?.jupyterVariableViewers.length).map(t=>{let n=t.packageJSON?.contributes;return n?.jupyterVariableViewers?n.jupyterVariableViewers.map(i=>({extension:t,jupyterVariableViewers:i})):[]}).flat()}};Ga=y([(0,O1.injectable)(),m(0,(0,O1.inject)(ks))],Ga);var CY="ds_prompt_about_deprecation",HI=class{constructor(e,t,n,i,o,s,a,l,c,u,p,f,g,v,b){this.disposables=e;this.debugService=t;this.jupyterVariableDataProviderFactory=i;this.dataViewerFactory=o;this.variableProvider=s;this.errorHandler=a;this.dataViewerDependencyService=l;this.interpreterService=c;this.platformService=u;this.kernelProvider=p;this.interactiveWindowProvider=f;this.experimentService=g;this.globalMemento=v;this.dataViewerDelegator=b;this.dataViewerChecker=new N1(n),Lo.workspace.isTrusted||Lo.workspace.onDidGrantWorkspaceTrust(this.registerCommandsIfTrusted,this,this.disposables)}activate(){this.registerCommandsIfTrusted()}registerCommandsIfTrusted(){Lo.workspace.isTrusted&&(this.registerCommand(q.ShowDataViewer,this.delegateDataViewer),this.registerCommand(q.ShowJupyterDataViewer,this.showJupyterVariableView))}registerCommand(e,t){let n=Lo.commands.registerCommand(e,t,this);this.disposables.push(n)}async delegateDataViewer(e){let t="variable"in e?await this.getVariableFromRequest(e):e;if(t)return this.dataViewerDelegator.showContributedDataViewer(t)}async getVariableFromRequest(e){if(this.variableProvider){let t=v0(e.variable);return this.variableProvider.getFullVariable(t)}}async showJupyterVariableView(e){A("OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_REQUEST_EX");let t=this.experimentService.inExperiment("DataViewerDeprecation");if(!this.globalMemento.get(CY)&&t&&(this.globalMemento.update(CY,!0).then(h,h),Lo.window.showInformationMessage(I.dataViewerDeprecationMessage,I.dataViewerDeprecationRecommendationActionMessage).then(n=>{n===I.dataViewerDeprecationRecommendationActionMessage&&Lo.commands.executeCommand("workbench.extensions.search","@tag:jupyterVariableViewers").then(h,h)},h)),this.debugService?.activeDebugSession&&this.variableProvider&&this.jupyterVariableDataProviderFactory&&this.dataViewerFactory)try{if(this.debugService.activeDebugSession.configuration&&this.dataViewerDependencyService&&this.interpreterService){let s=await this.getDebugAdapterPython(this.debugService.activeDebugSession.configuration);s&&await this.dataViewerDependencyService.checkAndInstallMissingDependencies(s)}let n=await this.jupyterVariableDataProviderFactory.create(e),o=(await n.getDataFrameInfo())?.columns?.length;if(o&&await this.dataViewerChecker.isRequestedColumnSizeAllowed(o)){let s=`${I.dataExplorerTitle} - ${e.name}`,a=await this.dataViewerFactory.create(n,s);return A("OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_SUCCESS_EX"),a}}catch(n){A("OPEN_DATAVIEWER_FROM_VARIABLE_WINDOW_ERROR_EX",void 0,void 0,n),d.error(n),this.errorHandler.handleError(n).then(h,h)}else try{let n=this.getActiveKernel();if(n&&this.jupyterVariableDataProviderFactory&&this.dataViewerFactory){let i=await this.jupyterVariableDataProviderFactory.create(e,n),o=`${I.dataExplorerTitle} - ${e.name}`;return await this.dataViewerFactory.create(i,o)}}catch(n){d.error(n),A("DATASCIENCE.FAILED_SHOW_DATA_EXPLORER"),Lo.window.showErrorMessage(I.showDataViewerFail).then(h,h)}}getActiveKernel(){let e=Lo.window.activeNotebookEditor?.notebook,t=e?.notebookType==Et?this.kernelProvider.get(e):void 0;if(t)return t;let n=this.getActiveInteractiveWindowDocument(),i=n?this.kernelProvider.get(n):void 0;if(i)return i;let o=this.dataViewerFactory?.activeViewer;return o?this.kernelProvider.kernels.find(s=>s===o.kernel):void 0}getActiveInteractiveWindowDocument(){let e=this.interactiveWindowProvider.getActiveOrAssociatedInteractiveWindow();if(e)return Lo.workspace.notebookDocuments.find(t=>t===e?.notebookDocument)}async getDebugAdapterPython(e){if(!this.interpreterService){d.info("Interpreter Service missing when trying getDebugAdapterPython");return}let t="";if(e.debugAdapterPython!==void 0?(d.info("Found debugAdapterPython on Debug Configuration to use"),t=e.debugAdapterPython):e.pythonPath&&(d.info("Found pythonPath on Debug Configuration to use"),t=e.pythonPath),t){let n=t;return n.startsWith("~")&&this.platformService.homeDir&&(n=_h(n,this.platformService.homeDir.path)),this.interpreterService.getInterpreterDetails(Lo.Uri.file(n))}else return this.interpreterService.getActiveInterpreter()}};HI=y([(0,Pr.injectable)(),m(0,(0,Pr.inject)(O)),m(1,(0,Pr.inject)(Li)),m(1,(0,Pr.optional)()),m(2,(0,Pr.inject)(le)),m(3,(0,Pr.inject)(A1)),m(3,(0,Pr.optional)()),m(4,(0,Pr.inject)(qI)),m(4,(0,Pr.optional)()),m(5,(0,Pr.inject)(kn)),m(5,(0,Pr.optional)()),m(5,(0,Pr.named)(qe.DEBUGGER_VARIABLES)),m(6,(0,Pr.inject)(Zr)),m(7,(0,Pr.inject)(JI)),m(7,(0,Pr.optional)()),m(8,(0,Pr.inject)(rt)),m(8,(0,Pr.optional)()),m(9,(0,Pr.inject)(wr)),m(10,(0,Pr.inject)(Te)),m(11,(0,Pr.inject)(qi)),m(12,(0,Pr.inject)(ks)),m(13,(0,Pr.inject)(Ve)),m(13,(0,Pr.named)(ft)),m(14,(0,Pr.inject)(Ga))],HI);var zI=P(M());var K1="0.20.0";var F1=require("vscode");var Zf=class{async getVersion(e,t){try{let n=await this._getVersion(e,t);return typeof n=="string"?bk(n):n}catch(n){d.warn(I.failedToGetVersionOfPandas,n.message);return}}async promptInstall(e,t,n){let i=n?I.pandasTooOldForViewingFormat(n,K1):I.pandasRequiredForViewing(K1);if((om()?me.install:await F1.window.showErrorMessage(i,{modal:!0},me.install))===me.install)await this._doInstall(e,t);else throw A("DATASCIENCE.USER_DID_NOT_INSTALL_PANDAS"),new Error(i)}async checkOrInstall(e){let t=new F1.CancellationTokenSource;try{let n=await this.getVersion(e,t.token);if(t.token.isCancellationRequested){A("DS_INTERNAL.SHOW_DATA_PANDAS_INSTALL_CANCELED");return}if(n){if(n.compare(K1)>0){A("DS_INTERNAL.SHOW_DATA_PANDAS_OK");return}A("DS_INTERNAL.SHOW_DATA_PANDAS_TOO_OLD");let i=`${n.major}.${n.minor}.${n.build}`;await this.promptInstall(e,t,i)}A("DS_INTERNAL.SHOW_DATA_NO_PANDAS"),await this.promptInstall(e,t)}finally{t.dispose()}}};y([ur("DS_INTERNAL.PYTHON_MODULE_INSTALL",{action:"displayed",moduleName:dr.get(23)})],Zf.prototype,"promptInstall",1);var QL="5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d",eSe=`import pandas;print(pandas.__version__);print("${QL}")`,L1=class extends Zf{constructor(t,n,i){super();this.installer=t;this.pythonFactory=n;this.interpreterService=i}async _getVersion(t,n){let s=(await(await this.pythonFactory.createActivatedEnvironment({resource:void 0,interpreter:t})).exec(["-c",eSe],{token:n})).stdout;if(!s?.includes(QL))return d.warn(I.failedToGetVersionOfPandas,`Output is ${s}`),"";let a=Fe(s.trim()),l=a.indexOf(QL);return l>=0?a[l-1]:""}async _doInstall(t,n){let i=t||await this.interpreterService.getActiveInterpreter();if(n.token.isCancellationRequested)return;await nr(n.token,2,this.installer.install(23,i,n))===0&&A("DATASCIENCE.USER_INSTALLED_PANDAS")}async checkAndInstallMissingDependencies(t){A("DATAVIEWER.USING_INTERPRETER"),await this.checkOrInstall(t)}};var YL="5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d",tSe=`import pandas as _VSCODE_pandas;print(_VSCODE_pandas.__version__);print("${YL}"); del _VSCODE_pandas`;function rSe(r){return(r.kernelConnectionMetadata.interpreter&&Be(r.kernelConnectionMetadata.interpreter))==="Conda"?"%conda":"%pip"}var U1=class extends Zf{async execute(e,t){if(!t.session?.kernel)throw new yn;let n=await bn(t.session.kernel,e),i=n.find(o=>o.output_type==="error");return i&&d.warn(I.failedToGetVersionOfPandas,i.message),n.map(o=>o.text?.toString())}async _getVersion(e){let n=(await this.execute(tSe,e)).map(s=>s?s.toString():void 0).find(s=>s);if(!n?.includes(YL))return d.warn(I.failedToGetVersionOfPandas,`Output is ${n}`),"";let i=Fe(n.trim()),o=i.indexOf(YL);return o>=0?i[o-1]:""}async _doInstall(e){let t=`${rSe(e)} install pandas`;try{await this.execute(t,e),A("DATASCIENCE.USER_INSTALLED_PANDAS")}catch(n){throw A("DATASCIENCE.USER_INSTALLED_PANDAS",void 0,void 0,n),new Error(I.failedToInstallPandas)}}async checkAndInstallMissingDependencies(e){if(A("DATAVIEWER.USING_KERNEL"),!e.session?.kernel)throw A("DATASCIENCE.NO_ACTIVE_KERNEL_SESSION"),new Error("No no active kernel session.");await this.checkOrInstall(e)}};var GI=class{constructor(e,t,n){this.withKernel=new U1,this.withInterpreter=new L1(e,t,n)}async checkAndInstallMissingDependencies(e){return"controller"in e?this.withKernel.checkAndInstallMissingDependencies(e):this.withInterpreter.checkAndInstallMissingDependencies(e)}};GI=y([(0,zI.injectable)(),m(0,(0,zI.inject)(Vi)),m(1,(0,zI.inject)(Ur)),m(2,(0,zI.inject)(rt))],GI);var kw=P(M());var wY=require("vscode");var Qd=class{constructor(e,t){this.serviceContainer=e;this.disposables=t;this.knownViewers=new Set;t.push(this),this.viewContext=new sr(yr.IsDataViewerActive),this.disposables.push(wY.commands.registerCommand(q.RefreshDataViewer,this.refreshDataViewer,this))}dispose(){for(let e of this.knownViewers)e.dispose()}async create(e,t){let n,i=this.serviceContainer.get(T1);try{this.knownViewers.add(i),i.onDidDisposeDataViewer(this.updateOpenDataViewers,this,this.disposables),i.onDidChangeDataViewerViewState(this.updateViewStateContext,this,this.disposables),await i.showData(e,t),n=i}finally{n||i.dispose()}return n}get activeViewer(){return[...this.knownViewers.values()].find(e=>e.active)}updateOpenDataViewers(e){this.knownViewers.delete(e)}async updateViewStateContext(){let e=!1;this.knownViewers.forEach(t=>{t.active&&(e=!0)}),await this.viewContext.set(e)}refreshDataViewer(){for(let e of this.knownViewers)e.active&&e.refreshData().then(h,h)}};y([ur("DATASCIENCE.START_SHOW_DATA_EXPLORER")],Qd.prototype,"create",1),y([Uv(1e3)],Qd.prototype,"refreshDataViewer",1),Qd=y([(0,kw.injectable)(),m(0,(0,kw.inject)(at)),m(1,(0,kw.inject)(O))],Qd);var Vu=P(M());var Wu=class{constructor(e,t){this.variableManager=e;this.dependencyService=t;this.initialized=!1}get kernel(){return this._kernel}static getNormalizedColumns(e){return e.map(t=>{let n;switch(t.type){case"bool":n="bool";break;case"integer":case"int32":case"int64":case"float":case"float32":case"float64":case"number":n="number";break;default:n="string"}return{key:t.key,type:n}})}static parseShape(e){try{if(e.startsWith("(")&&e.endsWith(")"))return e.substring(1,e.length-1).split(",").map(t=>parseInt(t))}catch{d.error(`Could not parse IJupyterVariable with malformed shape: ${e}`)}}dispose(){}setDependencies(e,t){this._kernel=t,this.variable=e}async getDataFrameInfo(e,t){let n={};await this.ensureInitialized();let i=this.variable;return i&&((e||t)&&(i=await this.variableManager.getDataFrameInfo(i,this._kernel,e,t)),n={columns:i.columns?Wu.getNormalizedColumns(i.columns):i.columns,indexColumn:i.indexColumn,rowCount:i.rowCount,dataDimensionality:i.dataDimensionality,shape:Wu.parseShape(i.shape),sliceExpression:e,type:i.type,maximumRowChunkSize:i.maximumRowChunkSize,name:i.name,fileName:De(i.fileName)}),t&&(this.variable=i),n}async getAllRows(e){let t=[];return await this.ensureInitialized(),this.variable&&this.variable.rowCount&&(t=(await this.variableManager.getDataFrameRows(this.variable,0,this.variable.rowCount,this._kernel,e)).data),t}async getRows(e,t,n){let i=[];return await this.ensureInitialized(),this.variable&&this.variable.rowCount&&(i=(await this.variableManager.getDataFrameRows(this.variable,e,t,this._kernel,n)).data),i}async ensureInitialized(){!this.initialized&&this.variable&&(this.initialized=!0,this._kernel?.kernelConnectionMetadata&&this.dependencyService&&await this.dependencyService.checkAndInstallMissingDependencies(zu()?this._kernel:this._kernel?.kernelConnectionMetadata.interpreter||this._kernel),this.variable=await this.variableManager.getDataFrameInfo(this.variable,this._kernel))}};Wu=y([(0,Vu.injectable)(),m(0,(0,Vu.inject)(kn)),m(0,(0,Vu.named)(qe.ALL_VARIABLES)),m(1,(0,Vu.inject)(JI)),m(1,(0,Vu.optional)())],Wu);var j1=P(M());var QI=class{constructor(e){this.serviceContainer=e}async create(e,t){let n=this.serviceContainer.get(R1);return n.setDependencies(e,t),n}};QI=y([(0,j1.injectable)(),m(0,(0,j1.inject)(at))],QI);var Pw=P(M()),W1=require("vscode");var YI=class{constructor(e,t){this.kernelProvider=e;this.controllers=t;this.disposables=[];this.widgetOutputsPerNotebook=new WeakMap}dispose(){z(this.disposables)}activate(){let e=W1.notebooks.createRendererMessaging("jupyter-ipywidget-renderer");e.onDidReceiveMessage(this.onDidReceiveMessage.bind(this,e),this,this.disposables),this.kernelProvider.onDidStartKernel(this.onDidStartKernel,this,this.disposables)}onDidStartKernel(e){this.hookupKernel(e),e.onStarted(()=>this.hookupKernel(e),this,this.disposables),e.onRestarted(()=>this.hookupKernel(e),this,this.disposables)}hookupKernel(e){this.widgetOutputsPerNotebook.delete(e.notebook);let t=e.session?.kernel,n=e.session?.kernel?.iopubMessage;if(!n)return;let i=require("@jupyterlab/services"),o=(s,a)=>{s===t&&(i.KernelMessage.isDisplayDataMsg(a)||i.KernelMessage.isUpdateDisplayDataMsg(a)||i.KernelMessage.isExecuteReplyMsg(a)||i.KernelMessage.isExecuteResultMsg(a))&&this.trackModelId(e.notebook,a)};n.connect(o),this.disposables.push(new W1.Disposable(()=>n.disconnect(o)))}trackModelId(e,t){let n=t.content;if(n.data&&typeof n.data=="object"&&Hi in n.data){let i=n.data[Hi];if(i&&"model_id"in i){let o=this.widgetOutputsPerNotebook.get(e)||new Set;o.add(i.model_id),this.widgetOutputsPerNotebook.set(e,o)}}}onDidReceiveMessage(e,{editor:t,message:n}){n&&typeof n=="object"&&n.command==="query-widget-state"&&this.queryWidgetState(e,t,n),n&&typeof n=="object"&&n.command==="ipywidget-renderer-loaded"&&this.sendWidgetVersionAndState(e,t)}queryWidgetState(e,t,n){let i=this.widgetOutputsPerNotebook.get(t.notebook),o=!!this.controllers.getSelected(t.notebook),s=!!i?.has(n.model_id);e.postMessage({command:"query-widget-state",model_id:n.model_id,hasWidgetState:s,kernelSelected:o},t).then(h,h)}sendWidgetVersionAndState(e,t){let n=this.kernelProvider.get(t.notebook),i=n?.ipywidgetsVersion;n?.ipywidgetsVersion&&d.trace(`IPyWidget version in Kernel is ${n?.ipywidgetsVersion}.`);let o=!!this.controllers.getSelected(t.notebook);e.postMessage({command:"ipywidget-renderer-init",version:i,widgetState:void 0,kernelSelected:o},t).then(h,h)}};YI=y([(0,Pw.injectable)(),m(0,(0,Pw.inject)(Te)),m(1,(0,Pw.inject)(pt))],YI);var th=P(M());var XL=require("vscode");var eh=P(M());var Pc=require("vscode");var V1=class{constructor(e,t,n){this.disposedCallback=n,this.callback=e,this.viewChanged=t}dispose(){this.disposedCallback()}onMessage(e,t){this.callback(e,t)}onChangeViewState(e){this.viewChanged&&this.viewChanged(e)}};var ca;(s=>(s.Started="started",s.UpdateSettings="update_settings",s.SendPlot="send_plot",s.CopyPlot="copy_plot",s.ExportPlot="export_plot",s.RemovePlot="remove_plot"))(ca||={});var EY=class{static{ca.Started,ca.UpdateSettings,ca.SendPlot,ca.CopyPlot,ca.ExportPlot,ca.RemovePlot}},B1=Symbol("IPlotViewerProvider"),q1=Symbol("IPlotViewer");var XI=class extends $I{constructor(t,n,i,o){let s=new We,a=er(o.extensionUri,"dist","webviews","webview-side","viewers");super(n,t,(l,c,u)=>new V1(l,c,u),a,[er(a,"plotViewer.js")],I.plotViewerTitle,Pc.ViewColumn.One);this.fs=i;this.context=o;this.closedEvent=new Pc.EventEmitter;this.removedEvent=new Pc.EventEmitter;this.addPlot=async t=>{this.isDisposed||(await super.show(!1),this.postMessage(ca.SendPlot,t).catch(h))};super.loadWebview(Pc.Uri.file(process.cwd())).catch(d.error).finally(()=>{A("PLOTVIEWER.WEBVIEW_LOADED",{duration:s.elapsedTime})})}get closed(){return this.closedEvent.event}get removed(){return this.removedEvent.event}async show(){if(!this.isDisposed)return super.show(!0)}dispose(){super.dispose(),this.removedEvent.dispose(),this.closedEvent&&this.closedEvent.fire(this)}get owningResource(){}onMessage(t,n){switch(t){case ca.CopyPlot:this.copyPlot(n.toString()).catch(h);break;case ca.ExportPlot:this.exportPlot(n).catch(h);break;case ca.RemovePlot:this.removePlot(n);break;default:break}super.onMessage(t,n)}removePlot(t){this.removedEvent.fire(t)}copyPlot(t){return Promise.resolve()}async exportPlot(t){d.info("exporting plot...");let n={};n[I.pngFilter]=["png"],n[I.svgFilter]=["svg"];let i=await Pc.window.showSaveDialog({saveLabel:I.exportPlotTitle,filters:n});try{if(i)switch(Gi(i.path).toLowerCase()){case".png":let s=fg(t.png.replace("data:image/png;base64",""));await this.fs.writeFile(i,s);break;default:case".svg":await this.fs.writeFile(i,t.svg);break}}catch(o){d.error(o),Pc.window.showErrorMessage(I.exportImageFailed(o.toString())).then(h,h)}}};XI=y([(0,eh.injectable)(),m(0,(0,eh.inject)(Dp)),m(1,(0,eh.inject)(le)),m(2,(0,eh.inject)(st)),m(3,(0,eh.inject)(ot))],XI);var ZI=class extends XI{constructor(t,n,i,o){super(t,n,i,o);this.fsNode=i}async exportPlot(t){d.info("exporting plot...");let n={};n[I.pdfFilter]=["pdf"],n[I.pngFilter]=["png"],n[I.svgFilter]=["svg"];let i=await XL.window.showSaveDialog({saveLabel:I.exportPlotTitle,filters:n});try{if(i)switch(Gi(i.fsPath).toLowerCase()){case".pdf":await ZL(t.svg,this.fsNode,i);break;case".png":let s=fg(t.png.replace("data:image/png;base64",""));await this.fs.writeFile(i,s);break;default:case".svg":await this.fs.writeFile(i,t.svg);break}}catch(o){d.error(o),XL.window.showErrorMessage(I.exportImageFailed(o)).then(h,h)}}};ZI=y([(0,th.injectable)(),m(0,(0,th.inject)(Dp)),m(1,(0,th.inject)(le)),m(2,(0,th.inject)(mr)),m(3,(0,th.inject)(ot))],ZI);async function ZL(r,e,t){d.info("Attempting pdf write...");let n=(await import("svg-to-pdfkit")).default,i=oe(),o=require("pdfkit/js/pdfkit.standalone"),s=new o,a=e.createLocalWriteStream(t.fsPath);d.info(`Writing pdf to ${t.fsPath}`),a.on("finish",()=>i.resolve),n(s,r,0,0,{preserveAspectRatio:"xMinYMin meet"}),s.pipe(a),s.end(),d.info(`Finishing pdf to ${t.fsPath}`),await i.promise,d.info(`Completed pdf to ${t.fsPath}`)}var Dw=P(M());var eS=class{constructor(e,t){this.serviceContainer=e;this.imageList=[];this.closedViewer=()=>{this.currentViewer&&(this.currentViewer=void 0),this.currentViewerClosed&&(this.currentViewerClosed.dispose(),this.currentViewerClosed=void 0)};this.removedPlot=e=>{this.imageList.splice(e,1)};t.push(this)}dispose(){this.currentViewer&&this.currentViewer.dispose()}async showPlot(e){this.imageList.push(e);let t=this.currentViewer?[e]:this.imageList,n=await this.getOrCreate();await Promise.all(t.map(n.addPlot))}async getOrCreate(){return this.currentViewer||(this.currentViewer=this.serviceContainer.get(q1),this.currentViewerClosed=this.currentViewer.closed(this.closedViewer),this.currentViewer.removed(this.removedPlot),A("DATASCIENCE.OPEN_PLOT_VIEWER"),await this.currentViewer.show()),this.currentViewer}};eS=y([(0,Dw.injectable)(),m(0,(0,Dw.inject)(at)),m(1,(0,Dw.inject)(O))],eS);var G1=P(M());var $1=P(M()),Yd=require("vscode");var H1="image/svg+xml",J1={"image/png":"png","image/jpeg":"jpeg","image/gif":"gif",[H1]:"svg"},tS=class{constructor(e){this.fs=e}async savePlot(e,t,n){if(e.isClosed)return;let i=nSe(e,t,n);if(!i)return d.error(`No plot to save ${B(e.uri)}, id: ${t} for ${n}`);if(!(n.toLowerCase()in J1))return d.error(`Unsupported MimeType ${B(e.uri)}, id: ${t} for ${n}`);let o=await this.getSaveTarget(i,n);o&&(o.path.toLowerCase().endsWith("pdf")?await this.saveAsPdf(i,o):await this.saveAsImage(i,o))}getSaveTarget(e,t){let n=J1[t.toLowerCase()],i={};e.items.find(l=>l.mime.toLowerCase()===H1)&&(i[I.pdfFilter]=["pdf"],i[I.svgFilter]=["svg"]),n==="png"&&(i[I.pngFilter]=["png"]),Object.keys(i).length===0&&(i.Images=[n]);let o=(Yd.workspace.workspaceFolders?.length||0)>0?Yd.workspace.workspaceFolders[0].uri:void 0,s="output",a=o?Yd.Uri.joinPath(o,s):Yd.Uri.file(s);return Yd.window.showSaveDialog({defaultUri:a,saveLabel:I.exportPlotTitle,filters:i})}async saveAsImage(e,t){let n=Gi(t.path).substring(1),i=Object.keys(J1).find(s=>J1[s]===n),o=e.items.find(s=>s.mime===i);if(!o)throw new Error(`Unsupported MimeType ${t.toString()}, available mime Types: ${e.items.map(s=>s.mime).join(", ")}`);await this.fs.writeFile(t,o.data)}async saveAsPdf(e,t){return d.error("Save as PDF is not yet supported on the web.")}};tS=y([(0,$1.injectable)(),m(0,(0,$1.inject)(st))],tS);function nSe(r,e,t){for(let n of r.getCells())for(let i of n.outputs)if(i.id===e&&i.items.find(o=>o.mime===t))return i}var rS=class extends tS{constructor(t){super(t);this.fsNode=t}async saveAsPdf(t,n){let i=Buffer.from(t.items.find(o=>o.mime===H1).data).toString();await ZL(i,this.fsNode,n)}};rS=y([(0,G1.injectable)(),m(0,(0,G1.inject)(mr))],rS);var z1=P(M());var iSe="image/svg+xml",oSe="image/png",Bu=class{constructor(e){this.plotViewProvider=e}async openPlot(e,t){if(e.isClosed)return;let n=kY(e,t,iSe),i;if(n)i=new TextDecoder().decode(n.data);else{let o=kY(e,t,oSe);if(!o)return d.error(`No SVG or PNG Plot to open ${B(e.uri)}, id: ${t}`);i=sSe(o)}i&&await this.plotViewProvider.showPlot(i)}};Bu=y([(0,z1.injectable)(),m(0,(0,z1.inject)(B1))],Bu);function kY(r,e,t){for(let n of r.getCells())for(let i of n.outputs)if(i.id===e)return i.items.find(o=>o.mime===t)}function sSe(r){let e=r.data,t=Rk(e),n=aSe(e);return`<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||
<svg height="${n.height}" width="${n.width}" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||
<g>
|
||
<image xmlns="http://www.w3.org/2000/svg" x="0" y="0" height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="data:image/png;base64,${t}"/>
|
||
</g>
|
||
</svg>`}function aSe(r){if(!lSe(r))throw new Error("The buffer is not a valid png");let e=new DataView(new Uint8Array(r).buffer);return{width:e.getUint32(16,!1),height:e.getUint32(20,!1)}}function lSe(r){return r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71&&r[4]===13&&r[5]===10&&r[6]===26&&r[7]===10&&r.length>8+21}var _w=P(M()),Y1=require("vscode");var Q1=Symbol("IPlotSaveHandler");var nS=class{constructor(e,t){this.plotSaveHandler=e;this.plotViewHandler=t;this.disposables=[]}dispose(){z(this.disposables)}activate(){this.activateImpl().catch(h)}async activateImpl(){let e=Y1.extensions.getExtension(Sh);if(!e)return;e.isActive||await e.activate(),e.exports.onDidReceiveMessage(({editor:n,message:i})=>{let o=n.notebook||Y1.window.activeNotebookEditor?.notebook;o&&(i.type==="saveImageAs"?this.plotSaveHandler.savePlot(o,i.outputId,i.mimeType).catch(h):i.type==="openImageInPlotViewer"&&this.plotViewHandler.openPlot(o,i.outputId).catch(h))},this,this.disposables)}};nS=y([(0,_w.injectable)(),m(0,(0,_w.inject)(Q1)),m(1,(0,_w.inject)(Bu))],nS);var rh=P(M()),Dc=require("vscode");var iS=class{constructor(e,t,n,i){this.interactiveWindowProvider=e;this.kernelProvider=t;this.dataViewerFactory=n;this.disposables=i;this._onDidFinisheExecutingActiveNotebook=new Dc.EventEmitter;this._onDidChangeActiveNotebook=new Dc.EventEmitter;this._onDidRestartActiveNotebook=new Dc.EventEmitter;this._executionCountTracker=new WeakMap;Dc.window.onDidChangeActiveNotebookEditor(this.activeEditorChanged,this,this.disposables),Dc.workspace.onDidCloseNotebookDocument(this.notebookEditorClosed,this,this.disposables),this.kernelProvider.onDidRestartKernel(o=>{this.handleRestart({state:1,notebook:o.notebook})},this,this.disposables),or.onDidChangeNotebookCellExecutionState(this.onDidChangeNotebookCellExecutionState,this,this.disposables)}get onDidChangeActiveNotebook(){return this._onDidChangeActiveNotebook.event}get onDidFinishExecutingActiveNotebook(){return this._onDidFinisheExecutingActiveNotebook.event}get onDidRestartActiveNotebook(){return this._onDidRestartActiveNotebook.event}get activeKernel(){let e=Dc.window.activeNotebookEditor?.notebook,t=e?.notebookType==Et?this.kernelProvider.get(e):void 0;if(t)return t;let n=this.getActiveInteractiveWindowDocument(),i=n?this.kernelProvider.get(n):void 0;if(i)return i;let o=this.dataViewerFactory.activeViewer;return o?this.kernelProvider.kernels.find(s=>s===o.kernel):void 0}get activeNotebookExecutionCount(){let e=this.activeKernel?.notebook;return e?this._executionCountTracker.get(e):void 0}getActiveInteractiveWindowDocument(){let e=this.interactiveWindowProvider.getActiveOrAssociatedInteractiveWindow();if(e)return Dc.workspace.notebookDocuments.find(t=>t===e?.notebookDocument)}onDidChangeNotebookCellExecutionState(e){Dt(e.cell.notebook)&&e.state===1&&this.handleExecute({notebook:e.cell.notebook,state:0,cell:e.cell})}handleExecute(e){this.isNonSilentExecution(e)&&(e.cell?.executionSummary?.executionOrder!==void 0&&this._executionCountTracker.set(e.notebook,e.cell.executionSummary?.executionOrder),this.isActiveNotebookEvent(e)&&e.cell?.executionSummary?.executionOrder!==void 0&&this.activeKernel&&this.kernelProvider.getKernelExecution(this.activeKernel).pendingCells.length===0&&this._onDidFinisheExecutingActiveNotebook.fire({executionCount:e.cell.executionSummary?.executionOrder}))}handleRestart(e){this._executionCountTracker.delete(e.notebook),this.isActiveNotebookEvent(e)&&this._onDidRestartActiveNotebook.fire()}notebookEditorClosed(e){this._executionCountTracker.delete(e)}activeEditorChanged(e){let t={};if(e&&Dt(e.notebook)){let n=this._executionCountTracker.get(e.notebook);n&&(t.executionCount=n)}this._onDidChangeActiveNotebook.fire(t)}isNonSilentExecution(e){return!!(e.state===0&&e.cell&&e.cell.executionSummary?.executionOrder)}isActiveNotebookEvent(e){return this.activeKernel?.notebook===e.notebook}};iS=y([(0,rh.injectable)(),m(0,(0,rh.inject)(qi)),m(1,(0,rh.inject)(Te)),m(2,(0,rh.inject)(qI)),m(3,(0,rh.inject)(O))],iS);var PY=class{static{"force_variable_refresh","settings_updated","activate","show_data_explorer","get_variables_request","get_variables_response","variable_explorer_toggle","set_variable_explorer_height","variable_explorer_height_response","open_link","variables_complete","update_settings","loc_init","update_variable_view_execution_count","get_html_by_id_request","get_html_by_id_response","restart_kernel"}},X1=Symbol("INotebookWatcher"),Z1=Symbol("IVariableViewProvider");var Tw=P(M()),DY=require("vscode");var oS=class{constructor(e,t){this.extensionContext=e;this.variableViewProvider=t}activate(){this.extensionContext.subscriptions.push(DY.window.registerWebviewViewProvider(this.variableViewProvider.viewType,this.variableViewProvider,{webviewOptions:{retainContextWhenHidden:!1}}))}};oS=y([(0,Tw.injectable)(),m(0,(0,Tw.inject)(ot)),m(1,(0,Tw.inject)(Z1))],oS);var fs=P(M());var rR=require("vscode");var eR=class{constructor(e,t){this.disposedCallback=t,this.callback=e}dispose(){this.disposedCallback()}onMessage(e,t){this.callback(e,t)}};var tR=class extends Uu{constructor(t,n,i,o,s){super(t,o,s);this.configService=t;this.provider=i;this.messageListener=n(this.onMessage.bind(this),this.dispose.bind(this))}get isDisposed(){return this.disposed}get webviewView(){return this.webview&&this.webview}async provideWebview(t,n,i,o){if(!o)throw new Error("WebviewViews must be passed an initial VS Code Webview");return this.provider.create({additionalPaths:i?[i]:[],rootPath:this.rootPath,cwd:t,listener:this.messageListener,scripts:this.scripts,settings:n,webviewHost:o})}};var nh=class extends tR{constructor(t,n,i,o,s,a,l,c){let u=er(i.extensionUri,"dist","webviews","webview-side","viewers");super(t,(p,f)=>new eR(p,f),n,u,[er(u,"variableView.js")]);this.variables=o;this.disposables=s;this.notebookWatcher=a;this.experiments=l;this.dataViewerDelegator=c;this.notebookWatcher.onDidFinishExecutingActiveNotebook(this.activeNotebookExecuted,this,this.disposables),this.notebookWatcher.onDidChangeActiveNotebook(this.activeNotebookChanged,this,this.disposables),this.notebookWatcher.onDidRestartActiveNotebook(this.activeNotebookRestarted,this,this.disposables),this.variables.refreshRequired(this.sendRefreshMessage,this,this.disposables),rR.window.onDidChangeActiveTextEditor(this.activeTextEditorChanged,this,this.disposables)}get owningResource(){}async load(t){await super.loadWebview(rR.Uri.file(process.cwd()),t).catch(d.error),this.webviewView&&this.disposables.push(this.webviewView.onDidChangeVisibility(()=>{this.handleVisibilityChanged()})),this.handleVisibilityChanged()}get title(){return"variableView"}onMessage(t,n){switch(t){case"get_variables_request":this.handleMessage(t,n,this.requestVariables);break;case"show_data_explorer":this.handleMessage(t,n,this.showDataViewer);break;default:break}super.onMessage(t,n)}handleMessage(t,n,i){let o=n;i.bind(this)(o)}handleVisibilityChanged(){let t=new sr("jupyter.variableViewVisible"),n=!1;this.webviewView&&(n=this.webviewView.visible),t.set(n).catch(h),n&&(A("DS_INTERNAL.NATIVE_VARIABLE_VIEW_MADE_VISIBLE"),this.notebookWatcher.activeNotebookExecutionCount!==void 0?this.postMessage("update_variable_view_execution_count",{executionCount:this.notebookWatcher.activeNotebookExecutionCount}).catch(h):this.postMessage("force_variable_refresh").catch(h))}async showDataViewer(t){return t.variable.fileName=t.variable.fileName??this.notebookWatcher.activeKernel?.notebook.uri,this.dataViewerDelegator.showContributedDataViewer(t.variable)}postProcessSupportsDataExplorer(t){let n=this.dataViewerDelegator.getVariableViewers();return t.pageResponse.forEach(i=>{this.experiments.inExperiment("DataViewerContribution")&&(i.supportsDataExplorer=n.some(o=>o.jupyterVariableViewers.dataTypes.includes(i.type)))}),t}async requestVariables(t){let n=this.notebookWatcher.activeKernel;if(n){let i=await this.variables.getVariables(t,n);this.postMessage("get_variables_response",this.postProcessSupportsDataExplorer(i)).catch(h),A("DS_INTERNAL.VARIABLE_EXPLORER_VARIABLE_COUNT",{variableCount:i.totalCount})}else{let i={executionCount:t.executionCount,pageStartIndex:-1,pageResponse:[],totalCount:0,refreshCount:t.refreshCount};this.postMessage("get_variables_response",i).catch(h)}}async activeNotebookExecuted(t){this.postMessage("update_variable_view_execution_count",{executionCount:t.executionCount}).catch(h)}async activeNotebookChanged(t){t.executionCount?this.postMessage("update_variable_view_execution_count",{executionCount:t.executionCount}).catch(h):this.postMessage("update_variable_view_execution_count",{executionCount:0}).catch(h),this.postMessage("force_variable_refresh").catch(h)}activeTextEditorChanged(){this.postMessage("force_variable_refresh").catch(h)}async activeNotebookRestarted(){this.postMessage("restart_kernel").catch(h)}async sendRefreshMessage(){this.postMessage("force_variable_refresh").catch(h)}};y([ur("DS_INTERNAL.NATIVE_VARIABLE_VIEW_LOADED")],nh.prototype,"load",1),y([zr()],nh.prototype,"showDataViewer",1),y([zr()],nh.prototype,"requestVariables",1);var sS=class{constructor(e,t,n,i,o,s,a,l){this.configuration=e;this.webviewViewProvider=t;this.context=n;this.variables=i;this.disposables=o;this.notebookWatcher=s;this.experiments=a;this.dataViewerDelegator=l;this.viewType="jupyterViewVariables"}get activeVariableView(){if(!_r())throw new Error("activeVariableView only for test code");return this.variableView?Promise.resolve(this.variableView):(this.activeVariableViewPromise=oe(),this.activeVariableViewPromise.promise)}async resolveWebviewView(e,t,n){e.webview.options={enableScripts:!0},this.variableView=new nh(this.configuration,this.webviewViewProvider,this.context,this.variables,this.disposables,this.notebookWatcher,this.experiments,this.dataViewerDelegator),this.activeVariableViewPromise&&this.activeVariableViewPromise.resolve(this.variableView),await this.variableView.load(e)}};sS=y([(0,fs.injectable)(),m(0,(0,fs.inject)(le)),m(1,(0,fs.inject)(sP)),m(2,(0,fs.inject)(ot)),m(3,(0,fs.inject)(kn)),m(3,(0,fs.named)(qe.ALL_VARIABLES)),m(4,(0,fs.inject)(O)),m(5,(0,fs.inject)(X1)),m(6,(0,fs.inject)(ks)),m(7,(0,fs.inject)(Ga))],sS);function _Y(r){r.addSingleton(ge,nS),r.add(T1,Xf),r.addSingleton(qI,Qd),r.addSingleton(JI,GI),r.addSingleton(ge,HI),r.addSingleton(Ga,Ga),r.add(q1,ZI),r.addSingleton(B1,eS),r.addSingleton(Q1,rS),r.addSingleton(Bu,Bu),r.addSingleton(X1,iS),r.addSingleton(ge,oS),r.addSingleton(ge,YI),r.addSingleton(Z1,sS),r.add(R1,Wu),r.addSingleton(A1,QI)}var Xd=require("os");var Uo=P(require("vscode"));var AY=P(require("vscode"));var ih=P(require("vscode")),eU;(t=>{function r(n){return n.start.line===n.end.line&&n.start.character===n.end.character}t.isEmpty=r;function e(n,i){let o=n.start.line,s=n.start.character,a=n.end.line,l=n.end.character,c=i.start.line,u=i.start.character,p=i.end.line,f=i.end.character;return o<c?(o=c,s=u):o===c&&(s=Math.max(s,u)),a>p?(a=p,l=f):a===p&&(l=Math.min(l,f)),!(o>a||o===a&&s>l)}t.intersects=e})(eU||={});function tU(r){r.sort((t,n)=>t-n);let e=r.shift();return e===void 0?[]:r.reduce(function(t,n){return n<=t[0][1]?t[0][1]=n+1:t.unshift([n,n+1]),t},[[e,e+1]]).reverse().map(t=>new ih.NotebookRange(t[0],t[1]))}function TY(r){return r.reduce((t,n)=>{for(let i=n.start;i<n.end;i++)t.push(i);return t},[])}function cSe(r){return ih.workspace.notebookDocuments.find(e=>e.uri.authority===r.uri.authority&&e.uri.path===r.uri.path)}function Rw(r){let e=ih.workspace.textDocuments.find(o=>o.uri.toString()===r?.document.uri.toString())??ih.window.activeTextEditor?.document;if(!e)return;let t=cSe(e);if(!t)return;let i=t.getCells().find(o=>o.document.uri.toString()===e.uri.toString());if(i)return{notebook:t,cell:i}}function rU(r,e){return r.start.line===e.start.line&&r.start.character===e.start.character&&r.end.line===e.end.line&&r.end.character===e.end.character}function Si(){}var RY="ms-python.vscode-pylance";async function uSe(r){return await r.activate()}var nU;async function NY(){let r=AY.extensions.getExtension(RY);if(r)return nU||new Promise((e,t)=>{uSe(r).then(async n=>{if(!n){console.error("Could not start Pylance"),t();return}n.client&&await n.client.start(),nU=n.notebook,e(n.notebook)}).then(Si,Si)})}var Or=P(require("vscode"));var pSe=Or.window.createTextEditorDecorationType({after:{contentText:"write",margin:"0 0 0 1em",backgroundColor:"red"}}),dSe=Or.window.createTextEditorDecorationType({after:{contentText:"read",margin:"0 0 0 1em",backgroundColor:"green"}}),nR=class{constructor(e,t,n){this._notebookDocument=e;this._cellExecution=t;this._cellRefs=n}_getVirtualCellList(e){return this._cellExecution.findIndex(n=>n.cell.document.uri.toString()===e.document.uri.toString())===-1?this._notebookDocument.getCells():this._cellExecution.map(n=>n.cell)}getPredecessorCells(e,t=!1){let n=t?this._notebookDocument.getCells():this._getVirtualCellList(e);var i;for(i=n.length-1;i>=0&&n[i].document.uri.toString()!==e.document.uri.toString();i--);if(i===-1)return[];let o=i,s=n.slice(0,o+1),a=new Array(s.length).fill(!1);a[o]=!0;let l=new Map;for(let[p,f]of this._cellRefs.entries()){let g=f.filter(v=>v.kind==="write").map(v=>v.uri.fragment);f.forEach(v=>{let b=v.uri.fragment;l.has(b)?l.get(b)?.push(p):l.set(b,[p])}),f.forEach(v=>{let b=v.uri.fragment;l.has(b)?l.get(b)?.push(...g):l.set(b,g)})}let c=e.document.uri.fragment;this._resolveDependencies(l,a,c,s,t);let u=[];for(let p=0;p<a.length;p++)a[p]&&u.push(s[p]);return u}getSuccessorCells(e){let t=this._getVirtualCellList(e),n=t.findIndex(a=>a.document.uri.fragment===e.document.uri.fragment);if(n===-1)return[];let i=new Array(t.length).fill(!1);i[n]=!0;let o=new Map;this._cellRefs.forEach(a=>{a.forEach(l=>{if(l.kind==="write"){let c=l.uri.fragment,u=o.get(c)??[];u.push(...a.filter(p=>p!==l)),o.set(c,u)}})});for(let a=n;a<t.length;a++)if(i[a]){let l=this._cellRefs.get(t[a].document.uri.fragment)||[],c=o.get(t[a].document.uri.fragment)||[];[...l,...c].forEach(p=>{let f=t.findIndex(g=>g.document.uri.fragment===p.uri.fragment);f!==-1&&f>=a&&(i[f]=!0)})}let s=[];for(let a=0;a<i.length;a++)i[a]&&s.push(t[a]);return s}_resolveDependencies(e,t,n,i,o=!1){if(e.has(n))for(let s of e.get(n)){let a=i.findIndex(l=>l.document.uri.fragment===s);if(a===-1){if(o)continue;throw new Error(`Dependency ${s} is not in the execution list.`)}t[a]||(t[a]=!0,this._resolveDependencies(e,t,s,i,o))}}};var iR=class{constructor(e,t){this._notebookEditor=e;this._client=t;this._pendingRequests=new Map;this._cellRefs=new Map;this._staleCellRefs=new Map;this._cellExecution=[];this._disposables=[];this._notebookEditor.notebook.getCells().forEach(n=>{this._requestCellSymbols(n,!1).then(Si,Si)}),this._disposables.push(Or.workspace.onDidChangeNotebookDocument(n=>{n.notebook===this._notebookEditor.notebook&&(n.contentChanges.forEach(i=>{i.removedCells.forEach(o=>{this._pendingRequests.delete(o.document.uri.fragment),this._cellRefs.delete(o.document.uri.fragment)}),i.addedCells.forEach(o=>{this._requestCellSymbols(o,!1).then(Si,Si)})}),n.cellChanges.forEach(i=>{i.document&&(this._requestCellSymbols(i.cell,!1).then(Si,Si),this._updateCellStatus(i.cell,0))}))})),this._disposables.push(or.onDidChangeNotebookCellExecutionState(n=>{n.state===3&&n.cell.document.languageId==="python"&&this._updateCellStatus(n.cell,1),n.state===1&&n.cell.document.languageId==="python"&&(this._cellExecution.push({cell:n.cell,executionCount:n.cell.executionSummary?.executionOrder??0}),this._updateCellStatus(n.cell,2))}))}_updateCellStatus(e,t){this._staleCellRefs.set(e.document.uri.fragment,t)}async _requestCellSymbolsSync(){let e=[...this._pendingRequests.keys()];this._pendingRequests.forEach(t=>t.cancel()),this._pendingRequests.clear();for(let t of e){let n=this._notebookEditor.notebook.getCells().find(i=>i.document.uri.fragment===t);n&&await this._requestCellSymbols(n,!0)}}async getCellSymbolRefs(e){let t=this._cellRefs.get(e.document.uri.fragment);if(t)return t}async selectPrecedentCells(e){let t=await this.getPrecedentCells(e);this._notebookEditor.selections=t}async selectSuccessorCells(e){let t=await this.getSuccessorCells(e);this._notebookEditor.selections=t}async runPrecedentCells(e){let t=await this.getPrecedentCells(e);await Or.commands.executeCommand("notebook.cell.execute",{ranges:t.map(n=>({start:n.start,end:n.end})),document:this._notebookEditor.notebook.uri}).then(Si,Si)}async runSuccessorCells(e){let t=await this.getSuccessorCells(e);await Or.commands.executeCommand("notebook.cell.execute",{ranges:t.map(n=>({start:n.start,end:n.end})),document:this._notebookEditor.notebook.uri}).then(Si,Si)}async getPrecedentCells(e){await this._requestCellSymbolsSync();let t=new nR(this._notebookEditor.notebook,this._cellExecution,this._cellRefs),n=[];try{n=t.getPredecessorCells(e)}catch{try{n=t.getPredecessorCells(e,!0)}catch{throw new Error("No precedent cells found")}}let i=n.findIndex(s=>(this._staleCellRefs.get(s.document.uri.fragment)??0)===0);return tU((i===-1?n:n.slice(i)).map(s=>s.index))}async getSuccessorCells(e){await this._requestCellSymbolsSync();let n=new nR(this._notebookEditor.notebook,this._cellExecution,this._cellRefs).getSuccessorCells(e);return tU(n.map(o=>o.index))}async debugSymbols(){let e=[];await this._requestCellSymbolsSync(),console.log(JSON.stringify(Array.from(this._cellRefs.entries())));for(let n of Or.window.visibleTextEditors){let i=n.document;if(i.uri.scheme==="vscode-notebook-cell"&&i.uri.path===this._notebookEditor.notebook.uri.path){let o=this._cellRefs.get(i.uri.fragment);o&&e.push(...o)}}let t=new Map;e.forEach(n=>{let i=n.uri.fragment;t.has(i)||t.set(i,[]),t.get(i)?.push(n)}),t.forEach((n,i)=>{let o=Or.window.visibleTextEditors.find(s=>s.document.uri.path===this._notebookEditor.notebook.uri.path&&s.document.uri.fragment===i);if(o){let s=[],a=[];n.reduce((c,u)=>c.find(f=>rU(f.range,u.range))?c:c.concat([u]),[]).forEach(c=>{let u=new Or.Position(c.range.end.line,c.range.end.character),p=new Or.Range(u,u);c.kind==="write"?s.push(p):c.kind==="read"&&a.push(p)}),o.setDecorations(pSe,s),o.setDecorations(dSe,a)}})}async _requestCellSymbols(e,t){let n=this._pendingRequests.get(e.document.uri.fragment);if(n&&n.cancel(),t){let o=new Or.CancellationTokenSource;await this._doRequestCellSymbols(e,o.token),o.dispose();return}let i=new Or.CancellationTokenSource;this._pendingRequests.set(e.document.uri.fragment,i),setTimeout(()=>{this._pendingRequests.get(e.document.uri.fragment)===i&&(this._pendingRequests.delete(e.document.uri.fragment),!i.token.isCancellationRequested&&this._doRequestCellSymbols(e,i.token).then(Si,Si))},500)}async _getDocumentSymbols(e){if(this._client.getDocumentSymbols){let t=new Or.CancellationTokenSource,n=await this._client.getDocumentSymbols(e.document,t.token);if(n&&n.length>0)return t.dispose(),n}if(e.document.lineCount>1||e.document.lineAt(0).text.length>0)return Or.commands.executeCommand("vscode.executeDocumentSymbolProvider",e.document.uri)}async _doRequestCellSymbols(e,t){let n=await this._getDocumentSymbols(e);if(!n)return;let i=[];for(let o of n){let s=await this._client.getReferences(e.document,o.selectionRange.start,{includeDeclaration:!0},t);s&&i.push(...s.filter(a=>a.uri.scheme==="vscode-notebook-cell").map(a=>({...a,associatedSymbol:o})))}i.length&&this._cellRefs.set(e.document.uri.fragment,i.map(o=>({range:o.range,uri:o.uri,kind:rU(o.range,o.associatedSymbol.selectionRange)?"write":o.kind,associatedSymbol:o.associatedSymbol})))}dispose(){this._pendingRequests.forEach(e=>e.cancel()),this._pendingRequests.clear(),this._disposables.forEach(e=>e.dispose()),this._disposables=[]}},oR=class{constructor(e){this._client=e;this._disposables=[];this._notebookDocumentSymbolTrackers=new Map;Or.window.visibleNotebookEditors.forEach(t=>{this._notebookDocumentSymbolTrackers.set(t.notebook.uri.toString(),new iR(t,this._client))}),this._disposables.push(Or.window.onDidChangeVisibleNotebookEditors(t=>{t.forEach(n=>{this._notebookDocumentSymbolTrackers.has(n.notebook.uri.toString())||this._notebookDocumentSymbolTrackers.set(n.notebook.uri.toString(),new iR(n,this._client))}),this._notebookDocumentSymbolTrackers.forEach((n,i)=>{Or.window.visibleNotebookEditors.find(o=>o.notebook.uri.toString()===i)||(n.dispose(),this._notebookDocumentSymbolTrackers.delete(i))})}))}getNotebookDocumentSymbolTracker(e){return this._notebookDocumentSymbolTrackers.get(e.toString())}async debugSymbols(e){let t=this._notebookDocumentSymbolTrackers.get(e.uri.toString());t&&await t.debugSymbols()}async runSuccessorCells(e,t){let n=this._notebookDocumentSymbolTrackers.get(e.uri.toString());n&&await n.runSuccessorCells(t)}async runPrecedentCells(e,t){let n=this._notebookDocumentSymbolTrackers.get(e.uri.toString());n&&await n.runPrecedentCells(t)}async selectSuccessorCells(e,t){let n=this._notebookDocumentSymbolTrackers.get(e.uri.toString());n&&await n.selectSuccessorCells(t)}async selectPrecedentCells(e,t){let n=this._notebookDocumentSymbolTrackers.get(e.uri.toString());n&&await n.selectPrecedentCells(t)}dispose(){this._disposables.forEach(e=>e.dispose()),this._disposables=[]}},sR=class{constructor(e){this.symbolsTracker=e}async provideCodeActions(e,t,n,i){let o=Or.workspace.notebookDocuments.filter(v=>v.uri.path===e.uri.path),s,a;for(let v of o)if(s=v.getCells().find(b=>b.document.uri.toString()===e.uri.toString()),s){a=v;break}if(!s||!a)return[];let l=this.symbolsTracker.getNotebookDocumentSymbolTracker(a.uri);if(!l)return[];let c=n.diagnostics.find(v=>v.source==="Cell Execution Error"&&v.message.startsWith("NameError")&&v.message.endsWith("is not defined"));if(!c)return[];let u=c.message.match(/NameError: name '(.+)' is not defined/);if(!u)return[];let p=u[1],f=await l.getPrecedentCells(s),g=await Promise.all(TY(f).map(async v=>{let b=a?.cellAt(v);if(!b)return!1;let C=await l.getCellSymbolRefs(b);if(!C||C.length<=0)return!1;let E=C.filter(R=>R.associatedSymbol?.name===p).find(R=>R.uri.toString()===s?.document.uri.toString());if(!E)return!1;if(eU.intersects(E.range,t))return!0}));if(i.isCancellationRequested)return[];if(g.some(v=>v)){let v=new Or.CodeAction("Run Precedent Cells",Or.CodeActionKind.QuickFix);return v.command={command:"jupyter.runPrecedentCells",title:"Run Precedent Cells",arguments:[s]},[v]}return[]}};async function MY(r){if(!Uo.workspace.getConfiguration("jupyter").get("executionAnalysis.enabled"))return;let t=await NY();if(!t)return;let n=new oR(t);r.subscriptions.push(n),r.subscriptions.push(Uo.commands.registerCommand("jupyter.selectDependentCells",async i=>{let o=Rw(i);if(!o)return;let{notebook:s,cell:a}=o;await n.selectSuccessorCells(s,a)})),r.subscriptions.push(Uo.commands.registerCommand("jupyter.runPrecedentCells",async i=>{let o=Rw(i);if(!o)return;let{notebook:s,cell:a}=o;await n.runPrecedentCells(s,a)})),r.subscriptions.push(Uo.commands.registerCommand("jupyter.runDependentCells",async i=>{let o=Rw(i);if(!o)return;let{notebook:s,cell:a}=o;await n.runSuccessorCells(s,a)})),r.subscriptions.push(Uo.commands.registerCommand("jupyter.selectPrecedentCells",async i=>{let o=Rw(i);if(!o)return;let{notebook:s,cell:a}=o;await n.selectPrecedentCells(s,a)})),r.subscriptions.push(Uo.commands.registerCommand("jupyter.debugCellSymbols",async()=>{let i=Uo.window.activeNotebookEditor;i&&await n.debugSymbols(i.notebook)})),r.subscriptions.push(Uo.languages.registerCodeActionsProvider({language:"python",notebookType:"jupyter-notebook"},new sR(n),{providedCodeActionKinds:[Uo.CodeActionKind.QuickFix]}))}function OY(){}var hs=P(require("vscode"));async function KY(r){r.subscriptions.push(hs.commands.registerCommand("jupyter.listPipPackages",async e=>{let t=e??hs.window.activeNotebookEditor?.notebook.uri;if(t){let i=await xe.instance.get(Te).get(t);if(i){let o=new hs.CancellationTokenSource().token;try{let s=await mSe(i,o);if(Array.isArray(s.content))return s.content}catch(s){d.warn("Failed to get pip packages",s)}}}return[]})),r.subscriptions.push(hs.commands.registerCommand("jupyter.listVariables",async e=>{let t=e??hs.window.activeNotebookEditor?.notebook.uri;if(!t)return[];let n=hs.workspace.notebookDocuments.find(u=>u.uri.toString()===t.toString());if(!n)return[];let o=xe.instance.get(pt).getSelected(n);if(!o)return[];let s=o.controller.variableProvider;if(!s)return[];let a=new hs.CancellationTokenSource().token,l=s.provideVariablesWithSummarization(n,void 0,hs.NotebookVariablesRequestKind.Named,0,a),c=[];for await(let u of l)c.push(u);return c}))}async function mSe(r,e){let t=`import subprocess
|
||
proc = subprocess.Popen(["pip", "list", "--format", "json"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||
stdout, stderr = proc.communicate()
|
||
return stdout
|
||
`.split(`
|
||
`);try{return{content:await Ku(r,t,e)}}catch(n){throw n}}var WY=P(rN());var FY=P(M());var oh=class{constructor(e){this.container=e}getContainer(){return this.container}add(e,t,n,i){n?this.container.bind(e).to(t).whenTargetNamed(n):this.container.bind(e).to(t),i&&i.forEach(o=>{this.addBinding(e,o)})}addFactory(e,t){this.container.bind(e).toFactory(t)}addBinding(e,t){this.container.bind(t).toService(e)}addSingleton(e,t,n,i){n?this.container.bind(e).to(t).inSingletonScope().whenTargetNamed(n):this.container.bind(e).to(t).inSingletonScope(),i&&i.forEach(o=>{this.addBinding(e,o)})}addSingletonInstance(e,t,n){n?this.container.bind(e).toConstantValue(t).whenTargetNamed(n):this.container.bind(e).toConstantValue(t)}get(e,t){return t?this.container.getNamed(e,t):this.container.get(e)}tryGet(e,t){try{return t?this.container.getNamed(e,t):this.container.get(e)}catch{}}getAll(e,t){return t?this.container.getAllNamed(e,t):this.container.getAll(e)}rebind(e,t,n){n?this.container.rebind(e).to(t).whenTargetNamed(n):this.container.rebind(e).to(t)}rebindSingleton(e,t,n){n?this.container.rebind(e).to(t).inSingletonScope().whenTargetNamed(n):this.container.rebind(e).to(t).inSingletonScope()}rebindInstance(e,t,n){n?this.container.rebind(e).toConstantValue(t).whenTargetNamed(n):this.container.rebind(e).toConstantValue(t)}dispose(){this.container.unbindAll(),this.container.unload()}};y([Eh()],oh.prototype,"getContainer",1),oh=y([(0,FY.injectable)()],oh);var Sn=require("vscode");var UY=require("vscode");function jY(r){let e=UY.window.createOutputChannel(I.jupyterServerConsoleOutputChannel,"log");r.push(e);let t={get(n,i){let o=n[i];if(typeof o=="function"){if(i==="append")return(...s)=>{e.append(...s),LY(...s)};if(i==="appendLine")return(...s)=>{e.appendLine(...s),LY(...s)}}return o}};return new Proxy(e,t)}function LY(...r){r.length===1?d.debug(Fe(r[0]).map((e,t)=>t===0?e:` ${e}`).join(`
|
||
`)):d.debug(...r)}function VY(r,e){let t=hV(e);t.appendLine(`${Sn.env.appName} (${Sn.version}, ${Sn.env.remoteName}, ${Sn.env.appHost})`),t.appendLine(`Jupyter Extension Version: ${r.extension.packageJSON.version}.`);let n=Sn.extensions.getExtension(si);n?t.appendLine(`Python Extension Version: ${n.packageJSON.version}.`):t.appendLine("Python Extension not installed.");let i=Sn.extensions.getExtension(sm);return i?t.appendLine(`Pylance Extension Version${b1()?"":" (Not Used) "}: ${i.packageJSON.version}.`):t.appendLine("Pylance Extension not installed."),e?.platform&&t.appendLine(`Platform: ${e.platform} (${e.arch}).`),!Sn.workspace.workspaceFolders||Sn.workspace.workspaceFolders.length===0?t.appendLine("No workspace folder opened."):Sn.workspace.workspaceFolders.length===1?t.appendLine(`Workspace folder ${B(Sn.workspace.workspaceFolders[0].uri)}, Home = ${e?.homePath}`):t.appendLine(`Multiple Workspace folders opened ${Sn.workspace.workspaceFolders.map(o=>B(o.uri)).join(", ")}`),t}function BY(r,e){let t=new WY.Container({skipBaseClassChecks:!0}),n=new oh(t),i=new xe(t);return n.addSingletonInstance(at,i),n.addSingletonInstance(J6,n),n.addSingletonInstance(O,r.subscriptions),n.addSingletonInstance(Ve,r.globalState,ft),n.addSingletonInstance(Ve,r.workspaceState,ci),n.addSingletonInstance(ot,r),n.addSingletonInstance(Wo,e,Ju),n.addSingletonInstance(Wo,jY(r.subscriptions),Ih),[n,i]}function qY(){let r=oe(),e={location:Sn.ProgressLocation.Window,title:me.loadingExtension};return Sn.window.withProgress(e,()=>r.promise).then(h,h),{dispose:()=>r.resolve()}}function JY(r,e,t){fSe(me.handleExtensionActivationError),console.error("extension activation failed",r),d.error("extension activation failed",r),w3(r,e,t)}function fSe(r){try{Sn.window.showErrorMessage(r).then(h,h)}catch(e){d.error("failed to notify user",e)}}async function $Y(r,e){let t=e.get(ks),n=new We;await t.activate();let i=n.elapsedTime;A("DS_INTERNAL.EXPERIMENT_LOAD",{duration:i}),Sn.commands.executeCommand("setContext","jupyter.vscode.channel",js()).then(h,h),e.get(Xk).activate();let o=e.get(QE);o.initialize(),r.subscriptions.push(o)}var iU=class{constructor(){this.started=Date.now()}get elapsedTime(){return Date.now()-this.started}reset(){this.started=Date.now()}},sh=new iU,aS={totalActivateTime:0,codeLoadingTime:0,startActivateTime:0,endActivateTime:0,workspaceFolderCount:0};aS.codeLoadingTime=sh.elapsedTime;var oU;async function hSe(r){aS.startActivateTime=sh.elapsedTime;let e=VY(r,{addConsoleLogger:!!process.env.VSC_JUPYTER_FORCE_LOGGING,userNameRegEx:ySe(),homePathRegEx:bSe(),arch:(0,Xd.arch)(),platform:(0,Xd.platform)(),homePath:rD.fsPath});l9(sh),_2(r.subscriptions),Bj(za.env.uiKind==za.UIKind.Web),Jj(!1),r.subscriptions.push({dispose:()=>TS.isExiting=!0});try{let[t,n]=vSe(r,e);return await n,aS.endActivateTime=sh.elapsedTime,C3(aS,sh),t}catch(t){return aS.endActivateTime=sh.elapsedTime,JY(t,aS,sh),d.error("Failed to active the Jupyter Extension",t),{ready:Promise.resolve(),registerPythonApi:h,registerRemoteServerProvider:()=>({dispose:h}),getKernelService:()=>Promise.resolve(void 0),addRemoteJupyterServer:()=>Promise.resolve(void 0),openNotebook:()=>Promise.reject(),createJupyterServerCollection:()=>{throw new Error("Not Implemented")},kernels:{getKernel:()=>Promise.resolve(void 0)}}}}function gSe(){if(TS.isExiting=!0,oU){let r=oU.get(Vo);if(r)return r.dispose()}return OY(),Promise.resolve()}function vSe(r,e){let t=qY();try{let[n,i]=BY(r,e);oU=i,i9(a=>i.get(Gp).getPackageVersions(a));let o=ISe(r,n,i);return MY(r).then(h,h),KY(r).then(h,h),[I3(o,n,i,r),o,i]}finally{t.dispose()}}function HY(r){return r.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function ySe(){try{let r=HY((0,Xd.userInfo)().username);return new RegExp(r,"ig")}catch(r){console.info(`jupyter extension failed to get username info with ${r}
|
||
username will not be obfuscated in local logs`)}}function bSe(){try{let r=HY(ov().fsPath);return new RegExp(r,"ig")}catch(r){console.info(`jupyter extension failed to get home directory path with ${r}
|
||
home Path will not be obfuscated in local logs`)}}async function ISe(r,e,t){let n=!_r()&&(r.extensionMode===za.ExtensionMode.Development||za.workspace.getConfiguration("jupyter").get("development",!1));e.addSingletonInstance(IV,n),n&&za.commands.executeCommand("setContext","jupyter.development",!0).then(h,h),za.commands.executeCommand("setContext","jupyter.webExtension",!1).then(h,h),gV((0,Xd.homedir)()),j$(e),kG(e,n),Nz(e,n),OQ(e),bY(r,e,n),_Y(e),await $Y(r,t)}0&&(module.exports={activate,deactivate});
|
||
/*! Bundled license information:
|
||
|
||
reflect-metadata/Reflect.js:
|
||
(*! *****************************************************************************
|
||
Copyright (C) Microsoft. All rights reserved.
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||
this file except in compliance with the License. You may obtain a copy of the
|
||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||
|
||
See the Apache Version 2.0 License for specific language governing permissions
|
||
and limitations under the License.
|
||
***************************************************************************** *)
|
||
|
||
mime-db/index.js:
|
||
(*!
|
||
* mime-db
|
||
* Copyright(c) 2014 Jonathan Ong
|
||
* Copyright(c) 2015-2022 Douglas Christopher Wilson
|
||
* MIT Licensed
|
||
*)
|
||
|
||
mime-types/index.js:
|
||
(*!
|
||
* mime-types
|
||
* Copyright(c) 2014 Jonathan Ong
|
||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||
* MIT Licensed
|
||
*)
|
||
|
||
tmp/lib/tmp.js:
|
||
(*!
|
||
* Tmp
|
||
*
|
||
* Copyright (c) 2011-2015 KARASZI Istvan <github@spam.raszi.hu>
|
||
*
|
||
* MIT Licensed
|
||
*)
|
||
|
||
strip-comments/index.js:
|
||
(*!
|
||
* strip-comments <https://github.com/jonschlinkert/strip-comments>
|
||
* Copyright (c) 2014-present, Jon Schlinkert.
|
||
* Released under the MIT License.
|
||
*)
|
||
*/
|