Select a pattern to edit
-or create a new one with the + button
-=0&&f>=0&&t(a[x],c[f],u);)x--,f--;let y=x+1-h,w=h===f+1?void 0:c.slice(h,f+1);return w!==void 0?{start:h,deleteCount:y,cells:w}:{start:h,deleteCount:y}}else return h
i.document.uri.toString()))}}n.create=e})(Eu||(Eu={}));var qs=class{constructor(e,t){this.client=e,this.options=t,this.notebookSyncInfo=new Map,this.notebookDidOpen=new Set,this.disposables=[],this.selector=e.protocol2CodeConverter.asDocumentSelector(Tu.asDocumentSelector(t)),Wt.workspace.onDidOpenNotebookDocument(i=>{this.notebookDidOpen.add(i.uri.toString()),this.didOpen(i)},void 0,this.disposables);for(let i of Wt.workspace.notebookDocuments)this.notebookDidOpen.add(i.uri.toString()),this.didOpen(i);Wt.workspace.onDidChangeNotebookDocument(i=>this.didChangeNotebookDocument(i),void 0,this.disposables),this.options.save===!0&&Wt.workspace.onDidSaveNotebookDocument(i=>this.didSave(i),void 0,this.disposables),Wt.workspace.onDidCloseNotebookDocument(i=>{this.didClose(i),this.notebookDidOpen.delete(i.uri.toString())},void 0,this.disposables)}getState(){for(let e of Wt.workspace.notebookDocuments)if(this.getMatchingCells(e)!==void 0)return{kind:"document",id:"$internal",registrations:!0,matches:!0};return{kind:"document",id:"$internal",registrations:!0,matches:!1}}get mode(){return"notebook"}handles(e){return Wt.languages.match(this.selector,e)>0}didOpenNotebookCellTextDocument(e,t){if(Wt.languages.match(this.selector,t.document)===0||!this.notebookDidOpen.has(e.uri.toString()))return;let i=this.notebookSyncInfo.get(e.uri.toString()),r=this.cellMatches(e,t);if(i!==void 0){let s=i.uris.has(t.document.uri.toString());if(r&&s||!r&&!s)return;if(r){let o=this.getMatchingCells(e);if(o!==void 0){let a=this.asNotebookDocumentChangeEvent(e,void 0,i,o);a!==void 0&&this.doSendChange(a,o).catch(()=>{})}}}else r&&this.doSendOpen(e,[t]).catch(()=>{})}didChangeNotebookCellTextDocument(e,t){Wt.languages.match(this.selector,t.document)!==0&&this.doSendChange({notebook:e,cells:{textContent:[t]}},void 0).catch(()=>{})}didCloseNotebookCellTextDocument(e,t){let i=this.notebookSyncInfo.get(e.uri.toString());if(i===void 0)return;let r=t.document.uri,s=i.cells.findIndex(o=>o.document.uri.toString()===r.toString());if(s!==-1)if(s===0&&i.cells.length===1)this.doSendClose(e,i.cells).catch(()=>{});else{let o=i.cells.slice(),a=o.splice(s,1);this.doSendChange({notebook:e,cells:{structure:{array:{start:s,deleteCount:1},didClose:a}}},o).catch(()=>{})}}dispose(){for(let e of this.disposables)e.dispose()}didOpen(e,t=this.getMatchingCells(e),i=this.notebookSyncInfo.get(e.uri.toString())){if(i!==void 0)if(t!==void 0){let r=this.asNotebookDocumentChangeEvent(e,void 0,i,t);r!==void 0&&this.doSendChange(r,t).catch(()=>{})}else this.doSendClose(e,[]).catch(()=>{});else{if(t===void 0)return;this.doSendOpen(e,t).catch(()=>{})}}didChangeNotebookDocument(e){let t=e.notebook,i=this.notebookSyncInfo.get(t.uri.toString());if(i===void 0){if(e.contentChanges.length===0)return;let r=this.getMatchingCells(t);if(r===void 0)return;this.didOpen(t,r,i)}else{let r=this.getMatchingCells(t);if(r===void 0){this.didClose(t,i);return}let s=this.asNotebookDocumentChangeEvent(e.notebook,e,i,r);s!==void 0&&this.doSendChange(s,r).catch(()=>{})}}didSave(e){this.notebookSyncInfo.get(e.uri.toString())!==void 0&&this.doSendSave(e).catch(()=>{})}didClose(e,t=this.notebookSyncInfo.get(e.uri.toString())){if(t===void 0)return;let i=e.getCells().filter(r=>t.uris.has(r.document.uri.toString()));this.doSendClose(e,i).catch(()=>{})}async sendDidOpenNotebookDocument(e){let t=this.getMatchingCells(e);if(t!==void 0)return this.doSendOpen(e,t)}async doSendOpen(e,t){let i=async(s,o)=>{let a=Os.c2p.asNotebookDocument(s,o,this.client.code2ProtocolConverter),c=o.map(u=>this.client.code2ProtocolConverter.asTextDocumentItem(u.document));try{await this.client.sendNotification(Ei.DidOpenNotebookDocumentNotification.type,{notebookDocument:a,cellTextDocuments:c})}catch(u){throw this.client.error("Sending DidOpenNotebookDocumentNotification failed",u),u}},r=this.client.middleware?.notebooks;return this.notebookSyncInfo.set(e.uri.toString(),Eu.create(t)),r?.didOpen!==void 0?r.didOpen(e,t,i):i(e,t)}async sendDidChangeNotebookDocument(e){return this.doSendChange(e,void 0)}async doSendChange(e,t=this.getMatchingCells(e.notebook)){let i=async s=>{try{await this.client.sendNotification(Ei.DidChangeNotebookDocumentNotification.type,{notebookDocument:Os.c2p.asVersionedNotebookDocumentIdentifier(s.notebook,this.client.code2ProtocolConverter),change:Os.c2p.asNotebookDocumentChangeEvent(s,this.client.code2ProtocolConverter)})}catch(o){throw this.client.error("Sending DidChangeNotebookDocumentNotification failed",o),o}},r=this.client.middleware?.notebooks;return e.cells?.structure!==void 0&&this.notebookSyncInfo.set(e.notebook.uri.toString(),Eu.create(t??[])),r?.didChange!==void 0?r?.didChange(e,i):i(e)}async sendDidSaveNotebookDocument(e){return this.doSendSave(e)}async doSendSave(e){let t=async r=>{try{await this.client.sendNotification(Ei.DidSaveNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(r.uri)}})}catch(s){throw this.client.error("Sending DidSaveNotebookDocumentNotification failed",s),s}},i=this.client.middleware?.notebooks;return i?.didSave!==void 0?i.didSave(e,t):t(e)}async sendDidCloseNotebookDocument(e){return this.doSendClose(e,this.getMatchingCells(e)??[])}async doSendClose(e,t){let i=async(s,o)=>{try{await this.client.sendNotification(Ei.DidCloseNotebookDocumentNotification.type,{notebookDocument:{uri:this.client.code2ProtocolConverter.asUri(s.uri)},cellTextDocuments:o.map(a=>this.client.code2ProtocolConverter.asTextDocumentIdentifier(a.document))})}catch(a){throw this.client.error("Sending DidCloseNotebookDocumentNotification failed",a),a}},r=this.client.middleware?.notebooks;return this.notebookSyncInfo.delete(e.uri.toString()),r?.didClose!==void 0?r.didClose(e,t,i):i(e,t)}asNotebookDocumentChangeEvent(e,t,i,r){if(t!==void 0&&t.notebook!==e)throw new Error("Notebook must be identical");let s={notebook:e};t?.metadata!==void 0&&(s.metadata=Os.c2p.asMetadata(t.metadata));let o;if(t?.cellChanges!==void 0&&t.cellChanges.length>0){let a=[];o=new Set(r.map(c=>c.document.uri.toString()));for(let c of t.cellChanges)o.has(c.cell.document.uri.toString())&&(c.executionSummary!==void 0||c.metadata!==void 0)&&a.push(c.cell);a.length>0&&(s.cells=s.cells??{},s.cells.data=a)}if((t?.contentChanges!==void 0&&t.contentChanges.length>0||t===void 0)&&i!==void 0&&r!==void 0){let a=i.cells,c=r,u=$h.computeDiff(a,c,!1),l,p;if(u!==void 0){l=u.cells===void 0?new Map:new Map(u.cells.map(f=>[f.document.uri.toString(),f])),p=u.deleteCount===0?new Map:new Map(a.slice(u.start,u.start+u.deleteCount).map(f=>[f.document.uri.toString(),f]));for(let f of Array.from(p.keys()))l.has(f)&&(p.delete(f),l.delete(f));s.cells=s.cells??{};let h=[],x=[];if(l.size>0||p.size>0){for(let f of l.values())h.push(f);for(let f of p.values())x.push(f)}s.cells.structure={array:u,didOpen:h,didClose:x}}}return Object.keys(s).length>1?s:void 0}getMatchingCells(e,t=e.getCells()){if(this.options.notebookSelector!==void 0){for(let i of this.options.notebookSelector)if(i.notebook===void 0||Hh.matchNotebook(i.notebook,e)){let r=this.filterCells(e,t,i.cells);return r.length===0?void 0:r}}}cellMatches(e,t){let i=this.getMatchingCells(e,[t]);return i!==void 0&&i[0]===t}filterCells(e,t,i){let r=i!==void 0?t.filter(s=>{let o=s.document.languageId;return i.some(a=>a.language==="*"||o===a.language)}):t;return typeof this.client.clientOptions.notebookDocumentOptions?.filterCells=="function"?this.client.clientOptions.notebookDocumentOptions.filterCells(e,r):r}},Pu=class n{constructor(e){this.client=e,this.registrations=new Map,this.registrationType=Ei.NotebookDocumentSyncRegistrationType.type,Wt.workspace.onDidOpenTextDocument(t=>{if(t.uri.scheme!==n.CellScheme)return;let[i,r]=this.findNotebookDocumentAndCell(t);if(!(i===void 0||r===void 0))for(let s of this.registrations.values())s instanceof qs&&s.didOpenNotebookCellTextDocument(i,r)}),Wt.workspace.onDidChangeTextDocument(t=>{if(t.contentChanges.length===0)return;let i=t.document;if(i.uri.scheme!==n.CellScheme)return;let[r]=this.findNotebookDocumentAndCell(i);if(r!==void 0)for(let s of this.registrations.values())s instanceof qs&&s.didChangeNotebookCellTextDocument(r,t)}),Wt.workspace.onDidCloseTextDocument(t=>{if(t.uri.scheme!==n.CellScheme)return;let[i,r]=this.findNotebookDocumentAndCell(t);if(!(i===void 0||r===void 0))for(let s of this.registrations.values())s instanceof qs&&s.didCloseNotebookCellTextDocument(i,r)})}getState(){if(this.registrations.size===0)return{kind:"document",id:this.registrationType.method,registrations:!1,matches:!1};for(let e of this.registrations.values()){let t=e.getState();if(t.kind==="document"&&t.registrations===!0&&t.matches===!0)return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!0}}return{kind:"document",id:this.registrationType.method,registrations:!0,matches:!1}}fillClientCapabilities(e){let t=nR(nR(e,"notebookDocument"),"synchronization");t.dynamicRegistration=!0,t.executionSummarySupport=!0}preInitialize(e){let t=e.notebookDocumentSync;t!==void 0&&(this.dedicatedChannel=this.client.protocol2CodeConverter.asDocumentSelector(Tu.asDocumentSelector(t)))}initialize(e){let t=e.notebookDocumentSync;if(t===void 0)return;let i=t.id??LA.generateUuid();this.register({id:i,registerOptions:t})}register(e){let t=new qs(this.client,e.registerOptions);this.registrations.set(e.id,t)}unregister(e){let t=this.registrations.get(e);t&&t.dispose()}clear(){for(let e of this.registrations.values())e.dispose();this.registrations.clear()}handles(e){if(e.uri.scheme!==n.CellScheme)return!1;if(this.dedicatedChannel!==void 0&&Wt.languages.match(this.dedicatedChannel,e)>0)return!0;for(let t of this.registrations.values())if(t.handles(e))return!0;return!1}getProvider(e){for(let t of this.registrations.values())if(t.handles(e.document))return t}findNotebookDocumentAndCell(e){let t=e.uri.toString();for(let i of Wt.workspace.notebookDocuments)for(let r of i.getCells())if(r.document.uri.toString()===t)return[i,r];return[void 0,void 0]}};ku.NotebookDocumentSyncFeature=Pu;Pu.CellScheme="vscode-notebook-cell"});var sR=T(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});pr.SyncConfigurationFeature=pr.toJSONObject=pr.ConfigurationFeature=void 0;var Fs=require("vscode"),Mo=ue(),MA=qn(),UA=tt(),rR=Ce(),Bh=class{constructor(e){this._client=e}getState(){return{kind:"static"}}fillClientCapabilities(e){e.workspace=e.workspace||{},e.workspace.configuration=!0}initialize(){let e=this._client;e.onRequest(Mo.ConfigurationRequest.type,(t,i)=>{let r=o=>{let a=[];for(let c of o.items){let u=c.scopeUri!==void 0&&c.scopeUri!==null?this._client.protocol2CodeConverter.asUri(c.scopeUri):void 0;a.push(this.getConfiguration(u,c.section!==null?c.section:void 0))}return a},s=e.middleware.workspace;return s&&s.configuration?s.configuration(t,i,r):r(t,i)})}getConfiguration(e,t){let i=null;if(t){let r=t.lastIndexOf(".");if(r===-1)i=Or(Fs.workspace.getConfiguration(void 0,e).get(t));else{let s=Fs.workspace.getConfiguration(t.substr(0,r),e);s&&(i=Or(s.get(t.substr(r+1))))}}else{let r=Fs.workspace.getConfiguration(void 0,e);i={};for(let s of Object.keys(r))r.has(s)&&(i[s]=Or(r.get(s)))}return i===void 0&&(i=null),i}clear(){}};pr.ConfigurationFeature=Bh;function Or(n){if(n){if(Array.isArray(n))return n.map(Or);if(typeof n=="object"){let e=Object.create(null);for(let t in n)Object.prototype.hasOwnProperty.call(n,t)&&(e[t]=Or(n[t]));return e}}return n}pr.toJSONObject=Or;var Wh=class{constructor(e){this._client=e,this.isCleared=!1,this._listeners=new Map}getState(){return{kind:"workspace",id:this.registrationType.method,registrations:this._listeners.size>0}}get registrationType(){return Mo.DidChangeConfigurationNotification.type}fillClientCapabilities(e){(0,rR.ensure)((0,rR.ensure)(e,"workspace"),"didChangeConfiguration").dynamicRegistration=!0}initialize(){this.isCleared=!1;let e=this._client.clientOptions.synchronize?.configurationSection;e!==void 0&&this.register({id:UA.generateUuid(),registerOptions:{section:e}})}register(e){let t=Fs.workspace.onDidChangeConfiguration(i=>{this.onDidChangeConfiguration(e.registerOptions.section,i)});this._listeners.set(e.id,t),e.registerOptions.section!==void 0&&this.onDidChangeConfiguration(e.registerOptions.section,void 0)}unregister(e){let t=this._listeners.get(e);t&&(this._listeners.delete(e),t.dispose())}clear(){for(let e of this._listeners.values())e.dispose();this._listeners.clear(),this.isCleared=!0}onDidChangeConfiguration(e,t){if(this.isCleared)return;let i;if(MA.string(e)?i=[e]:i=e,i!==void 0&&t!==void 0&&!i.some(a=>t.affectsConfiguration(a)))return;let r=async o=>o===void 0?this._client.sendNotification(Mo.DidChangeConfigurationNotification.type,{settings:null}):this._client.sendNotification(Mo.DidChangeConfigurationNotification.type,{settings:this.extractSettingsInformation(o)}),s=this._client.middleware.workspace?.didChangeConfiguration;(s?s(i,r):r(i)).catch(o=>{this._client.error(`Sending notification ${Mo.DidChangeConfigurationNotification.type.method} failed`,o)})}extractSettingsInformation(e){function t(s,o){let a=s;for(let c=0;c=er)return function(e,t,r,n){e||(e=new c);for(var o=new Bt(e,he(r),[r,n]),i=0;i>>r&i,u=e&&l5;y-=5){var S=h>>>y&i;v=v.array[S]=fr(v.array[S],n)}v.array[h>>>5&i]=g}if(l=f)a-=f,l-=f,u=5,d=null,m=m&&m.removeBefore(n,0,a);else if(a>o||f=0&&t.splice(r,1)}}},5518(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ChannelSource=t.QualifiedChannelId=t.readSubstream=t.writeSubstream=t.MultiplexingStream=t.FullDuplexStream=t.Channel=void 0;var n=r(4409);Object.defineProperty(t,"Channel",{enumerable:!0,get:function(){return n.Channel}});var o=r(443);Object.defineProperty(t,"FullDuplexStream",{enumerable:!0,get:function(){return o.FullDuplexStream}});var i=r(6164);Object.defineProperty(t,"MultiplexingStream",{enumerable:!0,get:function(){return i.MultiplexingStream}});var s=r(5426);Object.defineProperty(t,"writeSubstream",{enumerable:!0,get:function(){return s.writeSubstream}}),Object.defineProperty(t,"readSubstream",{enumerable:!0,get:function(){return s.readSubstream}});var a=r(7900);Object.defineProperty(t,"QualifiedChannelId",{enumerable:!0,get:function(){return a.QualifiedChannelId}}),Object.defineProperty(t,"ChannelSource",{enumerable:!0,get:function(){return a.ChannelSource}})},3904(e,t,r){const n=Symbol("SemVer ANY");class o{static get ANY(){return n}constructor(e,t){if(t=i(t),e instanceof o){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),l("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===n?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const t=this.options.loose?s[a.COMPARATORLOOSE]:s[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new u(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===n||e===n)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return c(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(c(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(c(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=o;const i=r(8587),{safeRe:s,t:a}=r(9718),c=r(2111),l=r(7272),u=r(3908),d=r(8311)},8311(e,t,r){class n{constructor(e,t){if(t=i(t),e instanceof n)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new n(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter(e=>!m(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&v(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&g))+":"+e,r=o.get(t);if(r)return r;const n=this.options.loose,i=n?l[u.HYPHENRANGELOOSE]:l[u.HYPHENRANGE];e=e.replace(i,N(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(l[u.COMPARATORTRIM],d),a("comparator trim",e),e=e.replace(l[u.TILDETRIM],p),a("tilde trim",e),e=e.replace(l[u.CARETTRIM],h),a("caret trim",e);let c=e.split(" ").map(e=>S(e,this.options)).join(" ").split(/\s+/).map(e=>O(e,this.options));n&&(c=c.filter(e=>(a("loose invalid filter",e,this.options),!!e.match(l[u.COMPARATORLOOSE])))),a("range list",c);const v=new Map,y=c.map(e=>new s(e,this.options));for(const e of y){if(m(e))return[e];v.set(e.value,e)}v.size>1&&v.has("")&&v.delete("");const w=[...v.values()];return o.set(t,w),w}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Range is required");return this.set.some(r=>y(r,t)&&e.set.some(e=>y(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}for(let t=0;t