@codingame/monaco-vscode-ipynb-default-extension 26.2.2 → 27.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,8 @@
1
- var serverExportVar;(()=>{"use strict";var e={179:(e,t,a)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createJupyterCellFromNotebookCell=u,t.sortObjectPropertiesRecursively=d,t.getCellMetadata=s,t.getVSCodeCellLanguageId=function(e){return e.metadata?.vscode?.languageId},t.setVSCodeCellLanguageId=i,t.removeVSCodeCellLanguageId=c,t.createMarkdownCellFromNotebookCell=g,t.pruneCell=b,t.serializeNotebookToString=function(e){const t=O(e),a=t.metadata?.language_info?.name??e.cells.find(e=>2===e.kind)?.languageId;t.cells=e.cells.map(e=>u(e,a)).map(b);return function(e,t){const a=d(e);return JSON.stringify(a,void 0,t)+"\n"}(t,e.metadata&&"string"==typeof e.metadata.indentAmount?e.metadata.indentAmount:" ")},t.getNotebookMetadata=O;const o=a(377),n=a(951),r=new TextDecoder;function u(e,t){let a;return a=e.kind===n.NotebookCellKindMarkup?g(e):"raw"===e.languageId?function(e){const t=s({cell:e}),a={cell_type:"raw",source:l(e.value),metadata:t?.metadata||{}};return t?.attachments&&(a.attachments=t.attachments),t?.id&&(a.id=t.id),a}(e):function(e,t){const a=JSON.parse(JSON.stringify(s({cell:e})));a.metadata=a.metadata||{},e.languageId!==t?i(a,e.languageId):c(a);const o={cell_type:"code",execution_count:a.execution_count??null,source:l(e.value),outputs:(e.outputs||[]).map(p),metadata:a.metadata};return a?.id&&(o.id=a.id),o}(e,t),a}function d(e){return Array.isArray(e)?e.map(d):null!=e&&"object"==typeof e&&Object.keys(e).length>0?Object.keys(e).sort().reduce((t,a)=>(t[a]=d(e[a]),t),{}):e}function s(e){if((0,o.hasKey)(e,{cell:!0})){const t=e.cell,a={execution_count:null,...t.metadata??{}};return t.kind===n.NotebookCellKindMarkup&&delete a.execution_count,a}return{...e.metadata??{}}}function i(e,t){e.metadata=e.metadata||{},e.metadata.vscode={languageId:t}}function c(e){e.metadata?.vscode&&delete e.metadata.vscode}function l(e){return m(e.replace(/\r\n/g,"\n"))}function m(e){if(Array.isArray(e))return e;const t=e.toString();if(t.length>0){const e=t.split("\n");return e.map((t,a)=>a<e.length-1?`${t}\n`:t).filter(e=>e.length>0)}return[]}function p(e){const t=e.metadata;let a;const o=t?.outputType;switch(o){case"error":a=f(e);break;case"stream":a=y(e);break;case"display_data":a={output_type:"display_data",data:e.items.reduce((e,t)=>(e[t.mime]=_(t.mime,t.data),e),{}),metadata:t?.metadata||{}};break;case"execute_result":a={output_type:"execute_result",data:e.items.reduce((e,t)=>(e[t.mime]=_(t.mime,t.data),e),{}),metadata:t?.metadata||{},execution_count:"number"==typeof t?.executionCount?t?.executionCount:null};break;case"update_display_data":a={output_type:"update_display_data",data:e.items.reduce((e,t)=>(e[t.mime]=_(t.mime,t.data),e),{}),metadata:t?.metadata||{}};break;default:{const o=1===e.items.length&&e.items.every(e=>e.mime===n.CellOutputMimeTypes.error),r=e.items.every(e=>e.mime===n.CellOutputMimeTypes.stderr||e.mime===n.CellOutputMimeTypes.stdout);if(o)return f(e);const u=t?.outputType||(r?"stream":"display_data");let d;d="stream"===u?y(e):"display_data"===u?{data:{},metadata:{},output_type:"display_data"}:{output_type:u},t?.metadata&&(d.metadata=t.metadata),e.items.length>0&&(d.data=e.items.reduce((e,t)=>(e[t.mime]=_(t.mime,t.data),e),{})),a=d;break}}return a&&t&&t.transient&&(a.transient=t.transient),a}function f(e){const t=e.items[0];if(!t.data)return{output_type:"error",ename:"",evalue:"",traceback:[]};const a=e.metadata?.originalError,o=JSON.parse(r.decode(t.data));return{output_type:"error",ename:o.name,evalue:o.message,traceback:a?.traceback||m(o.stack||o.message||"")}}function y(e){const t=[];e.items.filter(e=>e.mime===n.CellOutputMimeTypes.stderr||e.mime===n.CellOutputMimeTypes.stdout).map(e=>r.decode(e.data)).forEach(e=>{const a=e.split("\n");t.length&&a.length&&a[0].length>0&&(t[t.length-1]=`${t[t.length-1]}${a.shift()}`);for(const e of a)t.push(e)});for(let e=0;e<t.length-1;e++)t[e]=`${t[e]}\n`;t.length&&0===t[t.length-1].length&&t.pop();const a=function(e){if(e.items.length>0)return e.items[0].mime===n.CellOutputMimeTypes.stderr?"stderr":"stdout"}(e)||"stdout";return{output_type:"stream",name:a,text:t}}function _(e,t){if(!t)return"";try{if(e===n.CellOutputMimeTypes.error){const e=r.decode(t);return JSON.parse(e)}if(e.startsWith("text/")||n.textMimeTypes.includes(e))return m(r.decode(t));if(e.startsWith("image/")&&"image/svg+xml"!==e)return"undefined"!=typeof Buffer&&"function"==typeof Buffer.from?Buffer.from(t).toString("base64"):btoa(t.reduce((e,t)=>e+String.fromCharCode(t),""));if(e.toLowerCase().includes("json")){const e=r.decode(t);return e.length>0?JSON.parse(e):e}return"image/svg+xml"===e?m(r.decode(t)):r.decode(t)}catch(e){return""}}function g(e){const t=s({cell:e}),a={cell_type:"markdown",source:l(e.value),metadata:t?.metadata||{}};return t?.attachments&&(a.attachments=t.attachments),t?.id&&(a.id=t.id),a}function b(e){const t={...e,source:m(e.source)};return"code"!==t.cell_type?(delete t.outputs,delete t.execution_count):t.outputs=t.outputs?t.outputs.map(C):[],t}const k={stream:new Set(Object.keys({output_type:"stream",name:"stdout",text:""})),error:new Set(Object.keys({output_type:"error",ename:"",evalue:"",traceback:[""]})),display_data:new Set(Object.keys({output_type:"display_data",data:{},metadata:{}})),execute_result:new Set(Object.keys({output_type:"execute_result",name:"",execution_count:0,data:{},metadata:{}}))};function C(e){let t;switch(e.output_type){case"stream":case"error":case"execute_result":case"display_data":t=k[e.output_type];break;default:return e}const a={...e};for(const o of Object.keys(e))t.has(o)||delete a[o];return a}function O(e){const t=e.metadata||{},a={};return a.cells=t.cells||[],a.nbformat=t.nbformat||n.defaultNotebookFormat.major,a.nbformat_minor=t.nbformat_minor??n.defaultNotebookFormat.minor,a.metadata=t.metadata||{},a}},377:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hasKey=function(e,t){for(const a in t)if(!(a in e))return!1;return!0}},951:(e,t)=>{var a;Object.defineProperty(t,"__esModule",{value:!0}),t.textMimeTypes=t.CellOutputMimeTypes=t.NotebookCellKindCode=t.NotebookCellKindMarkup=t.JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR=t.ATTACHMENT_CLEANUP_COMMANDID=t.defaultNotebookFormat=void 0,t.defaultNotebookFormat={major:4,minor:5},t.ATTACHMENT_CLEANUP_COMMANDID="ipynb.cleanInvalidImageAttachment",t.JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR={notebookType:"jupyter-notebook",language:"markdown"},t.NotebookCellKindMarkup=1,t.NotebookCellKindCode=2,function(e){e.error="application/vnd.code.notebook.error",e.stderr="application/vnd.code.notebook.stderr",e.stdout="application/vnd.code.notebook.stdout"}(a||(t.CellOutputMimeTypes=a={})),t.textMimeTypes=["text/plain","text/markdown","text/latex",a.stderr,a.stdout]}},t={};function a(o){var n=t[o];if(void 0!==n)return n.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,a),r.exports}var o={};(()=>{var e=o;Object.defineProperty(e,"__esModule",{value:!0});const t=a(179);onmessage=e=>{const a=e.data,o=(0,t.serializeNotebookToString)(a.data),n=(new TextEncoder).encode(o);postMessage({id:a.id,data:n})}})(),serverExportVar=o})();
2
- //# sourceMappingURL=notebookSerializerWorker.js.map
1
+ "use strict";function C(t,e){for(let a in e)if(!(a in t))return!1;return!0}var f={major:4,minor:5};var y=1;var x=["text/plain","text/markdown","text/latex","application/vnd.code.notebook.stderr","application/vnd.code.notebook.stdout"];var l=new TextDecoder;function I(t,e){let a;return t.kind===y?a=E(t):t.languageId==="raw"?a=S(t):a=M(t,e),a}function b(t){return Array.isArray(t)?t.map(b):t!=null&&typeof t=="object"&&Object.keys(t).length>0?Object.keys(t).sort().reduce((e,a)=>(e[a]=b(t[a]),e),{}):t}function g(t){if(C(t,{cell:!0})){let e=t.cell,a={execution_count:null,...e.metadata??{}};return e.kind===y&&delete a.execution_count,a}else return{...t.metadata??{}}}function N(t,e){t.metadata=t.metadata||{},t.metadata.vscode={languageId:e}}function h(t){t.metadata?.vscode&&delete t.metadata.vscode}function M(t,e){let a=JSON.parse(JSON.stringify(g({cell:t})));a.metadata=a.metadata||{},t.languageId!==e?N(a,t.languageId):h(a);let n={cell_type:"code",execution_count:a.execution_count??null,source:k(t.value),outputs:(t.outputs||[]).map(w),metadata:a.metadata};return a?.id&&(n.id=a.id),n}function S(t){let e=g({cell:t}),a={cell_type:"raw",source:k(t.value),metadata:e?.metadata||{}};return e?.attachments&&(a.attachments=e.attachments),e?.id&&(a.id=e.id),a}function k(t){return u(t.replace(/\r\n/g,`
2
+ `))}function u(t){if(Array.isArray(t))return t;let e=t.toString();if(e.length>0){let a=e.split(`
3
+ `);return a.map((n,o)=>o<a.length-1?`${n}
4
+ `:n).filter(n=>n.length>0)}return[]}function w(t){let e=t.metadata,a;switch(e?.outputType){case"error":{a=O(t);break}case"stream":{a=_(t);break}case"display_data":{a={output_type:"display_data",data:t.items.reduce((o,r)=>(o[r.mime]=d(r.mime,r.data),o),{}),metadata:e?.metadata||{}};break}case"execute_result":{a={output_type:"execute_result",data:t.items.reduce((o,r)=>(o[r.mime]=d(r.mime,r.data),o),{}),metadata:e?.metadata||{},execution_count:typeof e?.executionCount=="number"?e?.executionCount:null};break}case"update_display_data":{a={output_type:"update_display_data",data:t.items.reduce((o,r)=>(o[r.mime]=d(r.mime,r.data),o),{}),metadata:e?.metadata||{}};break}default:{let o=t.items.length===1&&t.items.every(s=>s.mime==="application/vnd.code.notebook.error"),r=t.items.every(s=>s.mime==="application/vnd.code.notebook.stderr"||s.mime==="application/vnd.code.notebook.stdout");if(o)return O(t);let m=e?.outputType||(r?"stream":"display_data"),i;m==="stream"?i=_(t):m==="display_data"?i={data:{},metadata:{},output_type:"display_data"}:i={output_type:m},e?.metadata&&(i.metadata=e.metadata),t.items.length>0&&(i.data=t.items.reduce((s,c)=>(s[c.mime]=d(c.mime,c.data),s),{})),a=i;break}}return a&&e&&e.transient&&(a.transient=e.transient),a}function O(t){let e=t.items[0];if(!e.data)return{output_type:"error",ename:"",evalue:"",traceback:[]};let a=t.metadata?.originalError,n=JSON.parse(l.decode(e.data));return{output_type:"error",ename:n.name,evalue:n.message,traceback:a?.traceback||u(n.stack||n.message||"")}}function D(t){if(t.items.length>0)return t.items[0].mime==="application/vnd.code.notebook.stderr"?"stderr":"stdout"}function _(t){let e=[];t.items.filter(n=>n.mime==="application/vnd.code.notebook.stderr"||n.mime==="application/vnd.code.notebook.stdout").map(n=>l.decode(n.data)).forEach(n=>{let o=n.split(`
5
+ `);e.length&&o.length&&o[0].length>0&&(e[e.length-1]=`${e[e.length-1]}${o.shift()}`);for(let r of o)e.push(r)});for(let n=0;n<e.length-1;n++)e[n]=`${e[n]}
6
+ `;return e.length&&e[e.length-1].length===0&&e.pop(),{output_type:"stream",name:D(t)||"stdout",text:e}}function d(t,e){if(!e)return"";try{if(t==="application/vnd.code.notebook.error"){let a=l.decode(e);return JSON.parse(a)}else if(t.startsWith("text/")||x.includes(t)){let a=l.decode(e);return u(a)}else{if(t.startsWith("image/")&&t!=="image/svg+xml")return typeof Buffer<"u"&&typeof Buffer.from=="function"?Buffer.from(e).toString("base64"):btoa(e.reduce((a,n)=>a+String.fromCharCode(n),""));if(t.toLowerCase().includes("json")){let a=l.decode(e);return a.length>0?JSON.parse(a):a}else return t==="image/svg+xml"?u(l.decode(e)):l.decode(e)}}catch{return""}}function E(t){let e=g({cell:t}),a={cell_type:"markdown",source:k(t.value),metadata:e?.metadata||{}};return e?.attachments&&(a.attachments=e.attachments),e?.id&&(a.id=e.id),a}function A(t){let e={...t,source:u(t.source)};return e.cell_type!=="code"?(delete e.outputs,delete e.execution_count):e.outputs=e.outputs?e.outputs.map(U):[],e}var K={output_type:"stream",name:"stdout",text:""},R={output_type:"error",ename:"",evalue:"",traceback:[""]},J={output_type:"display_data",data:{},metadata:{}},v={output_type:"execute_result",name:"",execution_count:0,data:{},metadata:{}},j={stream:new Set(Object.keys(K)),error:new Set(Object.keys(R)),display_data:new Set(Object.keys(J)),execute_result:new Set(Object.keys(v))};function U(t){let e;switch(t.output_type){case"stream":case"error":case"execute_result":case"display_data":e=j[t.output_type];break;default:return t}let a={...t};for(let n of Object.keys(t))e.has(n)||delete a[n];return a}function T(t){let e=L(t),a=e.metadata?.language_info?.name??t.cells.find(o=>o.kind===2)?.languageId;e.cells=t.cells.map(o=>I(o,a)).map(A);let n=t.metadata&&typeof t.metadata.indentAmount=="string"?t.metadata.indentAmount:" ";return F(e,n)}function F(t,e){let a=b(t);return JSON.stringify(a,void 0,e)+`
7
+ `}function L(t){let e=t.metadata||{},a={};return a.cells=e.cells||[],a.nbformat=e.nbformat||f.major,a.nbformat_minor=e.nbformat_minor??f.minor,a.metadata=e.metadata||{},a}onmessage=t=>{let e=t.data,a=T(e.data),n=new TextEncoder().encode(a);postMessage({id:e.id,data:n})};
8
+ //# sourceMappingURL=notebookSerializerWorker.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"notebookSerializerWorker.js","mappings":"6GAYA,sCAqBA,oCAiBA,oBAuBA,mCAAwCA,GACvC,OAAOA,EAASA,UAAUC,QAAQC,UACnC,EACA,4BAIA,+BAuSA,uCAgBA,cAsEA,qCAA0CC,GACzC,MAAMC,EAAkBC,EAAoBF,GAEtCG,EAAwBF,EAAgBJ,UAAUO,eAAeC,MAAQL,EAAKM,MAAMC,KAAKC,GAAsB,IAAdA,EAAKC,OAAaV,WAEzHE,EAAgBK,MAAQN,EAAKM,MAC3BI,IAAIF,GAAQG,EAAkCH,EAAML,IACpDO,IAAIE,GAMN,OAED,SAAiCX,EAAqDY,GAErF,MAAMC,EAASC,EAAgCd,GAE/C,OAAOe,KAAKC,UAAUH,OAAQI,EAAWL,GAAgB,IAC1D,CAPQM,CAAwBlB,EAJVD,EAAKH,UAAkD,iBAA/BG,EAAKH,SAASgB,aAC1Db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KAAKS,GACV,OAAO,EAGT,OAAO,CACR,C,cClFA,IAAYpD,E,0OAVC,EAAAgD,sBAAwB,CAAEC,MAAO,EAAGE,MAAO,GAC3C,EAAAG,6BAA+B,oCAE/B,EAAAC,mCAAuD,CAAEC,aAAc,mBAAoBC,SAAU,YAGrG,EAAAlH,uBAAyB,EAEzB,EAAAmH,qBAAuB,EAEpC,SAAY1D,GACX,8CACA,gDACA,+CACA,CAJD,CAAYA,IAAmB,sBAAnBA,EAAmB,KAMlB,EAAA4B,cAAgB,CAAC,aAAc,gBAAiB,aAAc5B,EAAoBG,OAAQH,EAAoBI,O,GCtBvHuD,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqB5H,IAAjB6H,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,CAAC,GAOX,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,OACf,C,wECjBA,eAGAG,UAAaC,IACZ,MAAMpJ,EAAOoJ,EAAEpJ,KACTqJ,GAAO,IAAAC,2BAA0BtJ,EAAKA,MACtCuJ,GAAQ,IAAIC,aAAcC,OAAOJ,GACvCK,YAAY,CAAExH,GAAIlC,EAAKkC,GAAIlC,KAAMuJ,I","sources":["webpack://serverExportVar/./src/serializers.ts","webpack://serverExportVar/./src/common.ts","webpack://serverExportVar/./src/constants.ts","webpack://serverExportVar/webpack/bootstrap","webpack://serverExportVar/./src/notebookSerializerWorker.web.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as nbformat from '@jupyterlab/nbformat';\nimport type { NotebookCell, NotebookCellData, NotebookCellOutput, NotebookData, NotebookDocument } from 'vscode';\nimport { CellOutputMetadata, hasKey, type CellMetadata } from './common';\nimport { textMimeTypes, NotebookCellKindMarkup, CellOutputMimeTypes, defaultNotebookFormat } from './constants';\n\nconst textDecoder = new TextDecoder();\n\nexport function createJupyterCellFromNotebookCell(\n\tvscCell: NotebookCellData,\n\tpreferredLanguage: string | undefined,\n): nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell {\n\tlet cell: nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell;\n\tif (vscCell.kind === NotebookCellKindMarkup) {\n\t\tcell = createMarkdownCellFromNotebookCell(vscCell);\n\t} else if (vscCell.languageId === 'raw') {\n\t\tcell = createRawCellFromNotebookCell(vscCell);\n\t} else {\n\t\tcell = createCodeCellFromNotebookCell(vscCell, preferredLanguage);\n\t}\n\treturn cell;\n}\n\n\n/**\n * Sort the JSON to minimize unnecessary SCM changes.\n * Jupyter notbeooks/labs sorts the JSON keys in alphabetical order.\n * https://github.com/microsoft/vscode-python/issues/13155\n */\nexport function sortObjectPropertiesRecursively(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(sortObjectPropertiesRecursively);\n\t}\n\tif (obj !== undefined && obj !== null && typeof obj === 'object' && Object.keys(obj).length > 0) {\n\t\treturn (\n\t\t\tObject.keys(obj)\n\t\t\t\t.sort()\n\t\t\t\t.reduce<Record<string, unknown>>((sortedObj, prop) => {\n\t\t\t\t\tsortedObj[prop] = sortObjectPropertiesRecursively(obj[prop]);\n\t\t\t\t\treturn sortedObj;\n\t\t\t\t}, {})\n\t\t);\n\t}\n\treturn obj;\n}\n\nexport function getCellMetadata(options: { cell: NotebookCell | NotebookCellData } | { metadata?: { [key: string]: any } }): CellMetadata {\n\tif (hasKey(options, { cell: true })) {\n\t\tconst cell = options.cell;\n\t\tconst metadata = {\n\t\t\texecution_count: null,\n\t\t\t// it contains the cell id, and the cell metadata, along with other nb cell metadata\n\t\t\t...(cell.metadata ?? {})\n\t\t} satisfies CellMetadata;\n\t\tif (cell.kind === NotebookCellKindMarkup) {\n\t\t\tdelete (metadata as Record<string, unknown>).execution_count;\n\t\t}\n\t\treturn metadata;\n\t} else {\n\t\tconst cell = options;\n\t\tconst metadata = {\n\t\t\t// it contains the cell id, and the cell metadata, along with other nb cell metadata\n\t\t\t...(cell.metadata ?? {})\n\t\t};\n\n\t\treturn metadata as CellMetadata;\n\t}\n}\n\nexport function getVSCodeCellLanguageId(metadata: CellMetadata): string | undefined {\n\treturn metadata.metadata?.vscode?.languageId;\n}\nexport function setVSCodeCellLanguageId(metadata: CellMetadata, languageId: string) {\n\tmetadata.metadata = metadata.metadata || {};\n\tmetadata.metadata.vscode = { languageId };\n}\nexport function removeVSCodeCellLanguageId(metadata: CellMetadata) {\n\tif (metadata.metadata?.vscode) {\n\t\tdelete metadata.metadata.vscode;\n\t}\n}\n\nfunction createCodeCellFromNotebookCell(cell: NotebookCellData, preferredLanguage: string | undefined): nbformat.ICodeCell {\n\tconst cellMetadata: CellMetadata = JSON.parse(JSON.stringify(getCellMetadata({ cell })));\n\tcellMetadata.metadata = cellMetadata.metadata || {}; // This cannot be empty.\n\tif (cell.languageId !== preferredLanguage) {\n\t\tsetVSCodeCellLanguageId(cellMetadata, cell.languageId);\n\t} else {\n\t\t// cell current language is the same as the preferred cell language in the document, flush the vscode custom language id metadata\n\t\tremoveVSCodeCellLanguageId(cellMetadata);\n\t}\n\n\tconst codeCell: nbformat.ICodeCell = {\n\t\tcell_type: 'code',\n\t\t// Metadata should always contain the execution_count.\n\t\t// When ever execution summary data changes we will update the metadata to contain the execution count.\n\t\t// Failing to do so means we have a problem.\n\t\t// Also do not read the value of executionSummary here, as its possible user reverted changes to metadata\n\t\t// & in that case execution summary could contain the data, but metadata will not.\n\t\t// In such cases we do not want to re-set the metadata with the value from execution summary (remember, user reverted that).\n\t\texecution_count: cellMetadata.execution_count ?? null,\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\toutputs: (cell.outputs || []).map(translateCellDisplayOutput),\n\t\tmetadata: cellMetadata.metadata\n\t};\n\tif (cellMetadata?.id) {\n\t\tcodeCell.id = cellMetadata.id;\n\t}\n\treturn codeCell;\n}\n\nfunction createRawCellFromNotebookCell(cell: NotebookCellData): nbformat.IRawCell {\n\tconst cellMetadata = getCellMetadata({ cell });\n\tconst rawCell: any = {\n\t\tcell_type: 'raw',\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\tmetadata: cellMetadata?.metadata || {} // This cannot be empty.\n\t};\n\tif (cellMetadata?.attachments) {\n\t\trawCell.attachments = cellMetadata.attachments;\n\t}\n\tif (cellMetadata?.id) {\n\t\trawCell.id = cellMetadata.id;\n\t}\n\treturn rawCell;\n}\n\n/**\n * Splits the source of a cell into an array of strings, each representing a line.\n * Also normalizes line endings to use LF (`\\n`) instead of CRLF (`\\r\\n`).\n * Same is done in deserializer as well.\n */\nfunction splitCellSourceIntoMultilineString(source: string): string[] {\n\treturn splitMultilineString(source.replace(/\\r\\n/g, '\\n'));\n}\n\nfunction splitMultilineString(source: nbformat.MultilineString): string[] {\n\tif (Array.isArray(source)) {\n\t\treturn source as string[];\n\t}\n\tconst str = source.toString();\n\tif (str.length > 0) {\n\t\t// Each line should be a separate entry, but end with a \\n if not last entry\n\t\tconst arr = str.split('\\n');\n\t\treturn arr\n\t\t\t.map((s, i) => {\n\t\t\t\tif (i < arr.length - 1) {\n\t\t\t\t\treturn `${s}\\n`;\n\t\t\t\t}\n\t\t\t\treturn s;\n\t\t\t})\n\t\t\t.filter(s => s.length > 0); // Skip last one if empty (it's the only one that could be length 0)\n\t}\n\treturn [];\n}\n\nfunction translateCellDisplayOutput(output: NotebookCellOutput): JupyterOutput {\n\tconst customMetadata = output.metadata as CellOutputMetadata | undefined;\n\tlet result: JupyterOutput;\n\t// Possible some other extension added some output (do best effort to translate & save in ipynb).\n\t// In which case metadata might not contain `outputType`.\n\tconst outputType = customMetadata?.outputType as nbformat.OutputType;\n\tswitch (outputType) {\n\t\tcase 'error': {\n\t\t\tresult = translateCellErrorOutput(output);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'stream': {\n\t\t\tresult = convertStreamOutput(output);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'display_data': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'display_data',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {} // This can never be undefined.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'execute_result': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'execute_result',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {}, // This can never be undefined.\n\t\t\t\texecution_count:\n\t\t\t\t\ttypeof customMetadata?.executionCount === 'number' ? customMetadata?.executionCount : null // This can never be undefined, only a number or `null`.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'update_display_data': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'update_display_data',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {} // This can never be undefined.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst isError =\n\t\t\t\toutput.items.length === 1 && output.items.every((item) => item.mime === CellOutputMimeTypes.error);\n\t\t\tconst isStream = output.items.every(\n\t\t\t\t(item) => item.mime === CellOutputMimeTypes.stderr || item.mime === CellOutputMimeTypes.stdout\n\t\t\t);\n\n\t\t\tif (isError) {\n\t\t\t\treturn translateCellErrorOutput(output);\n\t\t\t}\n\n\t\t\t// In the case of .NET & other kernels, we need to ensure we save ipynb correctly.\n\t\t\t// Hence if we have stream output, save the output as Jupyter `stream` else `display_data`\n\t\t\t// Unless we already know its an unknown output type.\n\t\t\tconst outputType: nbformat.OutputType =\n\t\t\t\t<nbformat.OutputType>customMetadata?.outputType || (isStream ? 'stream' : 'display_data');\n\t\t\tlet unknownOutput: nbformat.IUnrecognizedOutput | nbformat.IDisplayData | nbformat.IStream;\n\t\t\tif (outputType === 'stream') {\n\t\t\t\t// If saving as `stream` ensure the mandatory properties are set.\n\t\t\t\tunknownOutput = convertStreamOutput(output);\n\t\t\t} else if (outputType === 'display_data') {\n\t\t\t\t// If saving as `display_data` ensure the mandatory properties are set.\n\t\t\t\tconst displayData: nbformat.IDisplayData = {\n\t\t\t\t\tdata: {},\n\t\t\t\t\tmetadata: {},\n\t\t\t\t\toutput_type: 'display_data'\n\t\t\t\t};\n\t\t\t\tunknownOutput = displayData;\n\t\t\t} else {\n\t\t\t\tunknownOutput = {\n\t\t\t\t\toutput_type: outputType\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (customMetadata?.metadata) {\n\t\t\t\tunknownOutput.metadata = customMetadata.metadata;\n\t\t\t}\n\t\t\tif (output.items.length > 0) {\n\t\t\t\tunknownOutput.data = output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {});\n\t\t\t}\n\t\t\tresult = unknownOutput;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Account for transient data as well\n\t// `transient.display_id` is used to update cell output in other cells, at least thats one use case we know of.\n\tif (result && customMetadata && customMetadata.transient) {\n\t\tresult.transient = customMetadata.transient;\n\t}\n\treturn result;\n}\n\nfunction translateCellErrorOutput(output: NotebookCellOutput): nbformat.IError {\n\t// it should have at least one output item\n\tconst firstItem = output.items[0];\n\t// Bug in VS Code.\n\tif (!firstItem.data) {\n\t\treturn {\n\t\t\toutput_type: 'error',\n\t\t\tename: '',\n\t\t\tevalue: '',\n\t\t\ttraceback: []\n\t\t};\n\t}\n\tconst originalError: undefined | nbformat.IError = output.metadata?.originalError;\n\tconst value: Error = JSON.parse(textDecoder.decode(firstItem.data));\n\treturn {\n\t\toutput_type: 'error',\n\t\tename: value.name,\n\t\tevalue: value.message,\n\t\t// VS Code needs an `Error` object which requires a `stack` property as a string.\n\t\t// Its possible the format could change when converting from `traceback` to `string` and back again to `string`\n\t\t// When .NET stores errors in output (with their .NET kernel),\n\t\t// stack is empty, hence store the message instead of stack (so that somethign gets displayed in ipynb).\n\t\ttraceback: originalError?.traceback || splitMultilineString(value.stack || value.message || '')\n\t};\n}\n\n\nfunction getOutputStreamType(output: NotebookCellOutput): string | undefined {\n\tif (output.items.length > 0) {\n\t\treturn output.items[0].mime === CellOutputMimeTypes.stderr ? 'stderr' : 'stdout';\n\t}\n\n\treturn;\n}\n\ntype JupyterOutput =\n\t| nbformat.IUnrecognizedOutput\n\t| nbformat.IExecuteResult\n\t| nbformat.IDisplayData\n\t| nbformat.IStream\n\t| nbformat.IError;\n\nfunction convertStreamOutput(output: NotebookCellOutput): JupyterOutput {\n\tconst outputs: string[] = [];\n\toutput.items\n\t\t.filter((opit) => opit.mime === CellOutputMimeTypes.stderr || opit.mime === CellOutputMimeTypes.stdout)\n\t\t.map((opit) => textDecoder.decode(opit.data))\n\t\t.forEach(value => {\n\t\t\t// Ensure each line is a separate entry in an array (ending with \\n).\n\t\t\tconst lines = value.split('\\n');\n\t\t\t// If the last item in `outputs` is not empty and the first item in `lines` is not empty, then concate them.\n\t\t\t// As they are part of the same line.\n\t\t\tif (outputs.length && lines.length && lines[0].length > 0) {\n\t\t\t\toutputs[outputs.length - 1] = `${outputs[outputs.length - 1]}${lines.shift()!}`;\n\t\t\t}\n\t\t\tfor (const line of lines) {\n\t\t\t\toutputs.push(line);\n\t\t\t}\n\t\t});\n\n\tfor (let index = 0; index < (outputs.length - 1); index++) {\n\t\toutputs[index] = `${outputs[index]}\\n`;\n\t}\n\n\t// Skip last one if empty (it's the only one that could be length 0)\n\tif (outputs.length && outputs[outputs.length - 1].length === 0) {\n\t\toutputs.pop();\n\t}\n\n\tconst streamType = getOutputStreamType(output) || 'stdout';\n\n\treturn {\n\t\toutput_type: 'stream',\n\t\tname: streamType,\n\t\ttext: outputs\n\t};\n}\n\nfunction convertOutputMimeToJupyterOutput(mime: string, value: Uint8Array) {\n\tif (!value) {\n\t\treturn '';\n\t}\n\ttry {\n\t\tif (mime === CellOutputMimeTypes.error) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn JSON.parse(stringValue);\n\t\t} else if (mime.startsWith('text/') || textMimeTypes.includes(mime)) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn splitMultilineString(stringValue);\n\t\t} else if (mime.startsWith('image/') && mime !== 'image/svg+xml') {\n\t\t\t// Images in Jupyter are stored in base64 encoded format.\n\t\t\t// VS Code expects bytes when rendering images.\n\t\t\tif (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {\n\t\t\t\treturn Buffer.from(value).toString('base64');\n\t\t\t} else {\n\t\t\t\treturn btoa(value.reduce((s: string, b: number) => s + String.fromCharCode(b), ''));\n\t\t\t}\n\t\t} else if (mime.toLowerCase().includes('json')) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn stringValue.length > 0 ? JSON.parse(stringValue) : stringValue;\n\t\t} else if (mime === 'image/svg+xml') {\n\t\t\treturn splitMultilineString(textDecoder.decode(value));\n\t\t} else {\n\t\t\treturn textDecoder.decode(value);\n\t\t}\n\t} catch (ex) {\n\t\treturn '';\n\t}\n}\n\nexport function createMarkdownCellFromNotebookCell(cell: NotebookCellData): nbformat.IMarkdownCell {\n\tconst cellMetadata = getCellMetadata({ cell });\n\tconst markdownCell: any = {\n\t\tcell_type: 'markdown',\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\tmetadata: cellMetadata?.metadata || {} // This cannot be empty.\n\t};\n\tif (cellMetadata?.attachments) {\n\t\tmarkdownCell.attachments = cellMetadata.attachments;\n\t}\n\tif (cellMetadata?.id) {\n\t\tmarkdownCell.id = cellMetadata.id;\n\t}\n\treturn markdownCell;\n}\n\nexport function pruneCell(cell: nbformat.ICell): nbformat.ICell {\n\t// Source is usually a single string on input. Convert back to an array\n\tconst result: nbformat.ICell = {\n\t\t...cell,\n\t\tsource: splitMultilineString(cell.source)\n\t};\n\n\t// Remove outputs and execution_count from non code cells\n\tif (result.cell_type !== 'code') {\n\t\tdelete (result as Record<string, unknown>).outputs;\n\t\tdelete (result as Record<string, unknown>).execution_count;\n\t} else {\n\t\t// Clean outputs from code cells\n\t\tresult.outputs = result.outputs ? (result.outputs as nbformat.IOutput[]).map(fixupOutput) : [];\n\t}\n\n\treturn result;\n}\nconst dummyStreamObj: nbformat.IStream = {\n\toutput_type: 'stream',\n\tname: 'stdout',\n\ttext: ''\n};\nconst dummyErrorObj: nbformat.IError = {\n\toutput_type: 'error',\n\tename: '',\n\tevalue: '',\n\ttraceback: ['']\n};\nconst dummyDisplayObj: nbformat.IDisplayData = {\n\toutput_type: 'display_data',\n\tdata: {},\n\tmetadata: {}\n};\nconst dummyExecuteResultObj: nbformat.IExecuteResult = {\n\toutput_type: 'execute_result',\n\tname: '',\n\texecution_count: 0,\n\tdata: {},\n\tmetadata: {}\n};\nconst AllowedCellOutputKeys = {\n\t['stream']: new Set(Object.keys(dummyStreamObj)),\n\t['error']: new Set(Object.keys(dummyErrorObj)),\n\t['display_data']: new Set(Object.keys(dummyDisplayObj)),\n\t['execute_result']: new Set(Object.keys(dummyExecuteResultObj))\n};\n\nfunction fixupOutput(output: nbformat.IOutput): nbformat.IOutput {\n\tlet allowedKeys: Set<string>;\n\tswitch (output.output_type) {\n\t\tcase 'stream':\n\t\tcase 'error':\n\t\tcase 'execute_result':\n\t\tcase 'display_data':\n\t\t\tallowedKeys = AllowedCellOutputKeys[output.output_type];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn output;\n\t}\n\tconst result = { ...output };\n\tfor (const k of Object.keys(output)) {\n\t\tif (!allowedKeys.has(k)) {\n\t\t\tdelete result[k];\n\t\t}\n\t}\n\treturn result;\n}\n\n\nexport function serializeNotebookToString(data: NotebookData): string {\n\tconst notebookContent = getNotebookMetadata(data);\n\t// use the preferred language from document metadata or the first cell language as the notebook preferred cell language\n\tconst preferredCellLanguage = notebookContent.metadata?.language_info?.name ?? data.cells.find(cell => cell.kind === 2)?.languageId;\n\n\tnotebookContent.cells = data.cells\n\t\t.map(cell => createJupyterCellFromNotebookCell(cell, preferredCellLanguage))\n\t\t.map(pruneCell);\n\n\tconst indentAmount = data.metadata && typeof data.metadata.indentAmount === 'string' ?\n\t\tdata.metadata.indentAmount :\n\t\t' ';\n\n\treturn serializeNotebookToJSON(notebookContent, indentAmount);\n}\nfunction serializeNotebookToJSON(notebookContent: Partial<nbformat.INotebookContent>, indentAmount: string): string {\n\t// ipynb always ends with a trailing new line (we add this so that SCMs do not show unnecessary changes, resulting from a missing trailing new line).\n\tconst sorted = sortObjectPropertiesRecursively(notebookContent);\n\n\treturn JSON.stringify(sorted, undefined, indentAmount) + '\\n';\n}\n\nexport function getNotebookMetadata(document: NotebookDocument | NotebookData) {\n\tconst existingContent: Partial<nbformat.INotebookContent> = document.metadata || {};\n\tconst notebookContent: Partial<nbformat.INotebookContent> = {};\n\tnotebookContent.cells = existingContent.cells || [];\n\tnotebookContent.nbformat = existingContent.nbformat || defaultNotebookFormat.major;\n\tnotebookContent.nbformat_minor = existingContent.nbformat_minor ?? defaultNotebookFormat.minor;\n\tnotebookContent.metadata = existingContent.metadata || {};\n\treturn notebookContent;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as nbformat from '@jupyterlab/nbformat';\n\n/**\n * Metadata we store in VS Code cell output items.\n * This contains the original metadata from the Jupyter outputs.\n */\nexport interface CellOutputMetadata {\n\t/**\n\t * Cell output metadata.\n\t */\n\tmetadata?: any;\n\n\t/**\n\t * Transient data from Jupyter.\n\t */\n\ttransient?: {\n\t\t/**\n\t\t * This is used for updating the output in other cells.\n\t\t * We don't know of other properties, but this is definitely used.\n\t\t */\n\t\tdisplay_id?: string;\n\t} & any;\n\n\t/**\n\t * Original cell output type\n\t */\n\toutputType: nbformat.OutputType | string;\n\n\texecutionCount?: nbformat.IExecuteResult['ExecutionCount'];\n\n\t/**\n\t * Whether the original Mime data is JSON or not.\n\t * This properly only exists in metadata for NotebookCellOutputItems\n\t * (this is something we have added)\n\t */\n\t__isJson?: boolean;\n}\n\n\n/**\n * Metadata we store in VS Code cells.\n * This contains the original metadata from the Jupyter cells.\n */\nexport interface CellMetadata {\n\t/**\n\t * Cell id for notebooks created with the new 4.5 version of nbformat.\n\t*/\n\tid?: string;\n\t/**\n\t * Stores attachments for cells.\n\t */\n\tattachments?: nbformat.IAttachments;\n\t/**\n\t * Stores cell metadata.\n\t */\n\tmetadata?: Partial<nbformat.ICellMetadata> & { vscode?: { languageId?: string } };\n\t/**\n\t * The code cell's prompt number. Will be null if the cell has not been run.\n\t */\n\texecution_count?: number | null;\n}\n\n\n\ntype KeysOfUnionType<T> = T extends T ? keyof T : never;\ntype FilterType<T, TTest> = T extends TTest ? T : never;\ntype MakeOptionalAndBool<T extends object> = { [K in keyof T]?: boolean };\n\n/**\n * Type guard that checks if an object has specific keys and narrows the type accordingly.\n *\n * @param x - The object to check\n * @param key - An object with boolean values indicating which keys to check for\n * @returns true if all specified keys exist in the object, false otherwise\n *\n * @example\n * ```typescript\n * type A = { a: string };\n * type B = { b: number };\n * const obj: A | B = getObject();\n *\n * if (hasKey(obj, { a: true })) {\n * // obj is now narrowed to type A\n * console.log(obj.a);\n * }\n * ```\n */\nexport function hasKey<T extends object, TKeys>(x: T, key: TKeys & MakeOptionalAndBool<T>): x is FilterType<T, { [K in KeysOfUnionType<T> & keyof TKeys]: unknown }> {\n\tfor (const k in key) {\n\t\tif (!(k in x)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { DocumentSelector } from 'vscode';\n\nexport const defaultNotebookFormat = { major: 4, minor: 5 };\nexport const ATTACHMENT_CLEANUP_COMMANDID = 'ipynb.cleanInvalidImageAttachment';\n\nexport const JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR: DocumentSelector = { notebookType: 'jupyter-notebook', language: 'markdown' };\n\n// Copied from NotebookCellKind.Markup as we cannot import it from vscode directly in worker threads.\nexport const NotebookCellKindMarkup = 1;\n// Copied from NotebookCellKind.Code as we cannot import it from vscode directly in worker threads.\nexport const NotebookCellKindCode = 2;\n\nexport enum CellOutputMimeTypes {\n\terror = 'application/vnd.code.notebook.error',\n\tstderr = 'application/vnd.code.notebook.stderr',\n\tstdout = 'application/vnd.code.notebook.stdout'\n}\n\nexport const textMimeTypes = ['text/plain', 'text/markdown', 'text/latex', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { serializeNotebookToString } from './serializers';\nimport type { NotebookData } from 'vscode';\n\nonmessage = (e) => {\n\tconst data = e.data as { id: string; data: NotebookData };\n\tconst json = serializeNotebookToString(data.data);\n\tconst bytes = new TextEncoder().encode(json);\n\tpostMessage({ id: data.id, data: bytes });\n};\n"],"names":["metadata","vscode","languageId","data","notebookContent","getNotebookMetadata","preferredCellLanguage","language_info","name","cells","find","cell","kind","map","createJupyterCellFromNotebookCell","pruneCell","indentAmount","sorted","sortObjectPropertiesRecursively","JSON","stringify","undefined","serializeNotebookToJSON","textDecoder","TextDecoder","vscCell","preferredLanguage","NotebookCellKindMarkup","createMarkdownCellFromNotebookCell","cellMetadata","getCellMetadata","rawCell","cell_type","source","splitCellSourceIntoMultilineString","value","attachments","id","createRawCellFromNotebookCell","parse","setVSCodeCellLanguageId","removeVSCodeCellLanguageId","codeCell","execution_count","outputs","translateCellDisplayOutput","createCodeCellFromNotebookCell","obj","Array","isArray","Object","keys","length","sort","reduce","sortedObj","prop","options","hasKey","splitMultilineString","replace","str","toString","arr","split","s","i","filter","output","customMetadata","result","outputType","translateCellErrorOutput","convertStreamOutput","output_type","items","prev","curr","mime","convertOutputMimeToJupyterOutput","executionCount","isError","every","item","CellOutputMimeTypes","error","isStream","stderr","stdout","unknownOutput","transient","firstItem","ename","evalue","traceback","originalError","decode","message","stack","opit","forEach","lines","shift","line","push","index","pop","streamType","getOutputStreamType","text","stringValue","startsWith","textMimeTypes","includes","Buffer","from","btoa","b","String","fromCharCode","toLowerCase","ex","markdownCell","fixupOutput","AllowedCellOutputKeys","Set","allowedKeys","k","has","document","existingContent","nbformat","defaultNotebookFormat","major","nbformat_minor","minor","x","key","ATTACHMENT_CLEANUP_COMMANDID","JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR","notebookType","language","NotebookCellKindCode","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__","onmessage","e","json","serializeNotebookToString","bytes","TextEncoder","encode","postMessage"],"sourceRoot":""}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/common.ts", "../../src/constants.ts", "../../src/serializers.ts", "../../src/notebookSerializerWorker.web.ts"],
4
+ "sourcesContent": ["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as nbformat from '@jupyterlab/nbformat';\n\n/**\n * Metadata we store in VS Code cell output items.\n * This contains the original metadata from the Jupyter outputs.\n */\nexport interface CellOutputMetadata {\n\t/**\n\t * Cell output metadata.\n\t */\n\tmetadata?: any;\n\n\t/**\n\t * Transient data from Jupyter.\n\t */\n\ttransient?: {\n\t\t/**\n\t\t * This is used for updating the output in other cells.\n\t\t * We don't know of other properties, but this is definitely used.\n\t\t */\n\t\tdisplay_id?: string;\n\t} & any;\n\n\t/**\n\t * Original cell output type\n\t */\n\toutputType: nbformat.OutputType | string;\n\n\texecutionCount?: nbformat.IExecuteResult['ExecutionCount'];\n\n\t/**\n\t * Whether the original Mime data is JSON or not.\n\t * This properly only exists in metadata for NotebookCellOutputItems\n\t * (this is something we have added)\n\t */\n\t__isJson?: boolean;\n}\n\n\n/**\n * Metadata we store in VS Code cells.\n * This contains the original metadata from the Jupyter cells.\n */\nexport interface CellMetadata {\n\t/**\n\t * Cell id for notebooks created with the new 4.5 version of nbformat.\n\t*/\n\tid?: string;\n\t/**\n\t * Stores attachments for cells.\n\t */\n\tattachments?: nbformat.IAttachments;\n\t/**\n\t * Stores cell metadata.\n\t */\n\tmetadata?: Partial<nbformat.ICellMetadata> & { vscode?: { languageId?: string } };\n\t/**\n\t * The code cell's prompt number. Will be null if the cell has not been run.\n\t */\n\texecution_count?: number | null;\n}\n\n\n\ntype KeysOfUnionType<T> = T extends T ? keyof T : never;\ntype FilterType<T, TTest> = T extends TTest ? T : never;\ntype MakeOptionalAndBool<T extends object> = { [K in keyof T]?: boolean };\n\n/**\n * Type guard that checks if an object has specific keys and narrows the type accordingly.\n *\n * @param x - The object to check\n * @param key - An object with boolean values indicating which keys to check for\n * @returns true if all specified keys exist in the object, false otherwise\n *\n * @example\n * ```typescript\n * type A = { a: string };\n * type B = { b: number };\n * const obj: A | B = getObject();\n *\n * if (hasKey(obj, { a: true })) {\n * // obj is now narrowed to type A\n * console.log(obj.a);\n * }\n * ```\n */\nexport function hasKey<T extends object, TKeys>(x: T, key: TKeys & MakeOptionalAndBool<T>): x is FilterType<T, { [K in KeysOfUnionType<T> & keyof TKeys]: unknown }> {\n\tfor (const k in key) {\n\t\tif (!(k in x)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { DocumentSelector } from 'vscode';\n\nexport const defaultNotebookFormat = { major: 4, minor: 5 };\nexport const ATTACHMENT_CLEANUP_COMMANDID = 'ipynb.cleanInvalidImageAttachment';\n\nexport const JUPYTER_NOTEBOOK_MARKDOWN_SELECTOR: DocumentSelector = { notebookType: 'jupyter-notebook', language: 'markdown' };\n\n// Copied from NotebookCellKind.Markup as we cannot import it from vscode directly in worker threads.\nexport const NotebookCellKindMarkup = 1;\n// Copied from NotebookCellKind.Code as we cannot import it from vscode directly in worker threads.\nexport const NotebookCellKindCode = 2;\n\nexport enum CellOutputMimeTypes {\n\terror = 'application/vnd.code.notebook.error',\n\tstderr = 'application/vnd.code.notebook.stderr',\n\tstdout = 'application/vnd.code.notebook.stdout'\n}\n\nexport const textMimeTypes = ['text/plain', 'text/markdown', 'text/latex', CellOutputMimeTypes.stderr, CellOutputMimeTypes.stdout];\n\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport type * as nbformat from '@jupyterlab/nbformat';\nimport type { NotebookCell, NotebookCellData, NotebookCellOutput, NotebookData, NotebookDocument } from 'vscode';\nimport { CellOutputMetadata, hasKey, type CellMetadata } from './common';\nimport { textMimeTypes, NotebookCellKindMarkup, CellOutputMimeTypes, defaultNotebookFormat } from './constants';\n\nconst textDecoder = new TextDecoder();\n\nexport function createJupyterCellFromNotebookCell(\n\tvscCell: NotebookCellData,\n\tpreferredLanguage: string | undefined,\n): nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell {\n\tlet cell: nbformat.IRawCell | nbformat.IMarkdownCell | nbformat.ICodeCell;\n\tif (vscCell.kind === NotebookCellKindMarkup) {\n\t\tcell = createMarkdownCellFromNotebookCell(vscCell);\n\t} else if (vscCell.languageId === 'raw') {\n\t\tcell = createRawCellFromNotebookCell(vscCell);\n\t} else {\n\t\tcell = createCodeCellFromNotebookCell(vscCell, preferredLanguage);\n\t}\n\treturn cell;\n}\n\n\n/**\n * Sort the JSON to minimize unnecessary SCM changes.\n * Jupyter notbeooks/labs sorts the JSON keys in alphabetical order.\n * https://github.com/microsoft/vscode-python/issues/13155\n */\nexport function sortObjectPropertiesRecursively(obj: any): any {\n\tif (Array.isArray(obj)) {\n\t\treturn obj.map(sortObjectPropertiesRecursively);\n\t}\n\tif (obj !== undefined && obj !== null && typeof obj === 'object' && Object.keys(obj).length > 0) {\n\t\treturn (\n\t\t\tObject.keys(obj)\n\t\t\t\t.sort()\n\t\t\t\t.reduce<Record<string, unknown>>((sortedObj, prop) => {\n\t\t\t\t\tsortedObj[prop] = sortObjectPropertiesRecursively(obj[prop]);\n\t\t\t\t\treturn sortedObj;\n\t\t\t\t}, {})\n\t\t);\n\t}\n\treturn obj;\n}\n\nexport function getCellMetadata(options: { cell: NotebookCell | NotebookCellData } | { metadata?: { [key: string]: any } }): CellMetadata {\n\tif (hasKey(options, { cell: true })) {\n\t\tconst cell = options.cell;\n\t\tconst metadata = {\n\t\t\texecution_count: null,\n\t\t\t// it contains the cell id, and the cell metadata, along with other nb cell metadata\n\t\t\t...(cell.metadata ?? {})\n\t\t} satisfies CellMetadata;\n\t\tif (cell.kind === NotebookCellKindMarkup) {\n\t\t\tdelete (metadata as Record<string, unknown>).execution_count;\n\t\t}\n\t\treturn metadata;\n\t} else {\n\t\tconst cell = options;\n\t\tconst metadata = {\n\t\t\t// it contains the cell id, and the cell metadata, along with other nb cell metadata\n\t\t\t...(cell.metadata ?? {})\n\t\t};\n\n\t\treturn metadata as CellMetadata;\n\t}\n}\n\nexport function getVSCodeCellLanguageId(metadata: CellMetadata): string | undefined {\n\treturn metadata.metadata?.vscode?.languageId;\n}\nexport function setVSCodeCellLanguageId(metadata: CellMetadata, languageId: string) {\n\tmetadata.metadata = metadata.metadata || {};\n\tmetadata.metadata.vscode = { languageId };\n}\nexport function removeVSCodeCellLanguageId(metadata: CellMetadata) {\n\tif (metadata.metadata?.vscode) {\n\t\tdelete metadata.metadata.vscode;\n\t}\n}\n\nfunction createCodeCellFromNotebookCell(cell: NotebookCellData, preferredLanguage: string | undefined): nbformat.ICodeCell {\n\tconst cellMetadata: CellMetadata = JSON.parse(JSON.stringify(getCellMetadata({ cell })));\n\tcellMetadata.metadata = cellMetadata.metadata || {}; // This cannot be empty.\n\tif (cell.languageId !== preferredLanguage) {\n\t\tsetVSCodeCellLanguageId(cellMetadata, cell.languageId);\n\t} else {\n\t\t// cell current language is the same as the preferred cell language in the document, flush the vscode custom language id metadata\n\t\tremoveVSCodeCellLanguageId(cellMetadata);\n\t}\n\n\tconst codeCell: nbformat.ICodeCell = {\n\t\tcell_type: 'code',\n\t\t// Metadata should always contain the execution_count.\n\t\t// When ever execution summary data changes we will update the metadata to contain the execution count.\n\t\t// Failing to do so means we have a problem.\n\t\t// Also do not read the value of executionSummary here, as its possible user reverted changes to metadata\n\t\t// & in that case execution summary could contain the data, but metadata will not.\n\t\t// In such cases we do not want to re-set the metadata with the value from execution summary (remember, user reverted that).\n\t\texecution_count: cellMetadata.execution_count ?? null,\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\toutputs: (cell.outputs || []).map(translateCellDisplayOutput),\n\t\tmetadata: cellMetadata.metadata\n\t};\n\tif (cellMetadata?.id) {\n\t\tcodeCell.id = cellMetadata.id;\n\t}\n\treturn codeCell;\n}\n\nfunction createRawCellFromNotebookCell(cell: NotebookCellData): nbformat.IRawCell {\n\tconst cellMetadata = getCellMetadata({ cell });\n\tconst rawCell: any = {\n\t\tcell_type: 'raw',\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\tmetadata: cellMetadata?.metadata || {} // This cannot be empty.\n\t};\n\tif (cellMetadata?.attachments) {\n\t\trawCell.attachments = cellMetadata.attachments;\n\t}\n\tif (cellMetadata?.id) {\n\t\trawCell.id = cellMetadata.id;\n\t}\n\treturn rawCell;\n}\n\n/**\n * Splits the source of a cell into an array of strings, each representing a line.\n * Also normalizes line endings to use LF (`\\n`) instead of CRLF (`\\r\\n`).\n * Same is done in deserializer as well.\n */\nfunction splitCellSourceIntoMultilineString(source: string): string[] {\n\treturn splitMultilineString(source.replace(/\\r\\n/g, '\\n'));\n}\n\nfunction splitMultilineString(source: nbformat.MultilineString): string[] {\n\tif (Array.isArray(source)) {\n\t\treturn source as string[];\n\t}\n\tconst str = source.toString();\n\tif (str.length > 0) {\n\t\t// Each line should be a separate entry, but end with a \\n if not last entry\n\t\tconst arr = str.split('\\n');\n\t\treturn arr\n\t\t\t.map((s, i) => {\n\t\t\t\tif (i < arr.length - 1) {\n\t\t\t\t\treturn `${s}\\n`;\n\t\t\t\t}\n\t\t\t\treturn s;\n\t\t\t})\n\t\t\t.filter(s => s.length > 0); // Skip last one if empty (it's the only one that could be length 0)\n\t}\n\treturn [];\n}\n\nfunction translateCellDisplayOutput(output: NotebookCellOutput): JupyterOutput {\n\tconst customMetadata = output.metadata as CellOutputMetadata | undefined;\n\tlet result: JupyterOutput;\n\t// Possible some other extension added some output (do best effort to translate & save in ipynb).\n\t// In which case metadata might not contain `outputType`.\n\tconst outputType = customMetadata?.outputType as nbformat.OutputType;\n\tswitch (outputType) {\n\t\tcase 'error': {\n\t\t\tresult = translateCellErrorOutput(output);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'stream': {\n\t\t\tresult = convertStreamOutput(output);\n\t\t\tbreak;\n\t\t}\n\t\tcase 'display_data': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'display_data',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {} // This can never be undefined.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'execute_result': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'execute_result',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {}, // This can never be undefined.\n\t\t\t\texecution_count:\n\t\t\t\t\ttypeof customMetadata?.executionCount === 'number' ? customMetadata?.executionCount : null // This can never be undefined, only a number or `null`.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tcase 'update_display_data': {\n\t\t\tresult = {\n\t\t\t\toutput_type: 'update_display_data',\n\t\t\t\tdata: output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {}),\n\t\t\t\tmetadata: customMetadata?.metadata || {} // This can never be undefined.\n\t\t\t};\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tconst isError =\n\t\t\t\toutput.items.length === 1 && output.items.every((item) => item.mime === CellOutputMimeTypes.error);\n\t\t\tconst isStream = output.items.every(\n\t\t\t\t(item) => item.mime === CellOutputMimeTypes.stderr || item.mime === CellOutputMimeTypes.stdout\n\t\t\t);\n\n\t\t\tif (isError) {\n\t\t\t\treturn translateCellErrorOutput(output);\n\t\t\t}\n\n\t\t\t// In the case of .NET & other kernels, we need to ensure we save ipynb correctly.\n\t\t\t// Hence if we have stream output, save the output as Jupyter `stream` else `display_data`\n\t\t\t// Unless we already know its an unknown output type.\n\t\t\tconst outputType: nbformat.OutputType =\n\t\t\t\t<nbformat.OutputType>customMetadata?.outputType || (isStream ? 'stream' : 'display_data');\n\t\t\tlet unknownOutput: nbformat.IUnrecognizedOutput | nbformat.IDisplayData | nbformat.IStream;\n\t\t\tif (outputType === 'stream') {\n\t\t\t\t// If saving as `stream` ensure the mandatory properties are set.\n\t\t\t\tunknownOutput = convertStreamOutput(output);\n\t\t\t} else if (outputType === 'display_data') {\n\t\t\t\t// If saving as `display_data` ensure the mandatory properties are set.\n\t\t\t\tconst displayData: nbformat.IDisplayData = {\n\t\t\t\t\tdata: {},\n\t\t\t\t\tmetadata: {},\n\t\t\t\t\toutput_type: 'display_data'\n\t\t\t\t};\n\t\t\t\tunknownOutput = displayData;\n\t\t\t} else {\n\t\t\t\tunknownOutput = {\n\t\t\t\t\toutput_type: outputType\n\t\t\t\t};\n\t\t\t}\n\t\t\tif (customMetadata?.metadata) {\n\t\t\t\tunknownOutput.metadata = customMetadata.metadata;\n\t\t\t}\n\t\t\tif (output.items.length > 0) {\n\t\t\t\tunknownOutput.data = output.items.reduce((prev: any, curr) => {\n\t\t\t\t\tprev[curr.mime] = convertOutputMimeToJupyterOutput(curr.mime, curr.data as Uint8Array);\n\t\t\t\t\treturn prev;\n\t\t\t\t}, {});\n\t\t\t}\n\t\t\tresult = unknownOutput;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Account for transient data as well\n\t// `transient.display_id` is used to update cell output in other cells, at least thats one use case we know of.\n\tif (result && customMetadata && customMetadata.transient) {\n\t\tresult.transient = customMetadata.transient;\n\t}\n\treturn result;\n}\n\nfunction translateCellErrorOutput(output: NotebookCellOutput): nbformat.IError {\n\t// it should have at least one output item\n\tconst firstItem = output.items[0];\n\t// Bug in VS Code.\n\tif (!firstItem.data) {\n\t\treturn {\n\t\t\toutput_type: 'error',\n\t\t\tename: '',\n\t\t\tevalue: '',\n\t\t\ttraceback: []\n\t\t};\n\t}\n\tconst originalError: undefined | nbformat.IError = output.metadata?.originalError;\n\tconst value: Error = JSON.parse(textDecoder.decode(firstItem.data));\n\treturn {\n\t\toutput_type: 'error',\n\t\tename: value.name,\n\t\tevalue: value.message,\n\t\t// VS Code needs an `Error` object which requires a `stack` property as a string.\n\t\t// Its possible the format could change when converting from `traceback` to `string` and back again to `string`\n\t\t// When .NET stores errors in output (with their .NET kernel),\n\t\t// stack is empty, hence store the message instead of stack (so that somethign gets displayed in ipynb).\n\t\ttraceback: originalError?.traceback || splitMultilineString(value.stack || value.message || '')\n\t};\n}\n\n\nfunction getOutputStreamType(output: NotebookCellOutput): string | undefined {\n\tif (output.items.length > 0) {\n\t\treturn output.items[0].mime === CellOutputMimeTypes.stderr ? 'stderr' : 'stdout';\n\t}\n\n\treturn;\n}\n\ntype JupyterOutput =\n\t| nbformat.IUnrecognizedOutput\n\t| nbformat.IExecuteResult\n\t| nbformat.IDisplayData\n\t| nbformat.IStream\n\t| nbformat.IError;\n\nfunction convertStreamOutput(output: NotebookCellOutput): JupyterOutput {\n\tconst outputs: string[] = [];\n\toutput.items\n\t\t.filter((opit) => opit.mime === CellOutputMimeTypes.stderr || opit.mime === CellOutputMimeTypes.stdout)\n\t\t.map((opit) => textDecoder.decode(opit.data))\n\t\t.forEach(value => {\n\t\t\t// Ensure each line is a separate entry in an array (ending with \\n).\n\t\t\tconst lines = value.split('\\n');\n\t\t\t// If the last item in `outputs` is not empty and the first item in `lines` is not empty, then concate them.\n\t\t\t// As they are part of the same line.\n\t\t\tif (outputs.length && lines.length && lines[0].length > 0) {\n\t\t\t\toutputs[outputs.length - 1] = `${outputs[outputs.length - 1]}${lines.shift()!}`;\n\t\t\t}\n\t\t\tfor (const line of lines) {\n\t\t\t\toutputs.push(line);\n\t\t\t}\n\t\t});\n\n\tfor (let index = 0; index < (outputs.length - 1); index++) {\n\t\toutputs[index] = `${outputs[index]}\\n`;\n\t}\n\n\t// Skip last one if empty (it's the only one that could be length 0)\n\tif (outputs.length && outputs[outputs.length - 1].length === 0) {\n\t\toutputs.pop();\n\t}\n\n\tconst streamType = getOutputStreamType(output) || 'stdout';\n\n\treturn {\n\t\toutput_type: 'stream',\n\t\tname: streamType,\n\t\ttext: outputs\n\t};\n}\n\nfunction convertOutputMimeToJupyterOutput(mime: string, value: Uint8Array) {\n\tif (!value) {\n\t\treturn '';\n\t}\n\ttry {\n\t\tif (mime === CellOutputMimeTypes.error) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn JSON.parse(stringValue);\n\t\t} else if (mime.startsWith('text/') || textMimeTypes.includes(mime)) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn splitMultilineString(stringValue);\n\t\t} else if (mime.startsWith('image/') && mime !== 'image/svg+xml') {\n\t\t\t// Images in Jupyter are stored in base64 encoded format.\n\t\t\t// VS Code expects bytes when rendering images.\n\t\t\tif (typeof Buffer !== 'undefined' && typeof Buffer.from === 'function') {\n\t\t\t\treturn Buffer.from(value).toString('base64');\n\t\t\t} else {\n\t\t\t\treturn btoa(value.reduce((s: string, b: number) => s + String.fromCharCode(b), ''));\n\t\t\t}\n\t\t} else if (mime.toLowerCase().includes('json')) {\n\t\t\tconst stringValue = textDecoder.decode(value);\n\t\t\treturn stringValue.length > 0 ? JSON.parse(stringValue) : stringValue;\n\t\t} else if (mime === 'image/svg+xml') {\n\t\t\treturn splitMultilineString(textDecoder.decode(value));\n\t\t} else {\n\t\t\treturn textDecoder.decode(value);\n\t\t}\n\t} catch (ex) {\n\t\treturn '';\n\t}\n}\n\nexport function createMarkdownCellFromNotebookCell(cell: NotebookCellData): nbformat.IMarkdownCell {\n\tconst cellMetadata = getCellMetadata({ cell });\n\tconst markdownCell: any = {\n\t\tcell_type: 'markdown',\n\t\tsource: splitCellSourceIntoMultilineString(cell.value),\n\t\tmetadata: cellMetadata?.metadata || {} // This cannot be empty.\n\t};\n\tif (cellMetadata?.attachments) {\n\t\tmarkdownCell.attachments = cellMetadata.attachments;\n\t}\n\tif (cellMetadata?.id) {\n\t\tmarkdownCell.id = cellMetadata.id;\n\t}\n\treturn markdownCell;\n}\n\nexport function pruneCell(cell: nbformat.ICell): nbformat.ICell {\n\t// Source is usually a single string on input. Convert back to an array\n\tconst result: nbformat.ICell = {\n\t\t...cell,\n\t\tsource: splitMultilineString(cell.source)\n\t};\n\n\t// Remove outputs and execution_count from non code cells\n\tif (result.cell_type !== 'code') {\n\t\tdelete (result as Record<string, unknown>).outputs;\n\t\tdelete (result as Record<string, unknown>).execution_count;\n\t} else {\n\t\t// Clean outputs from code cells\n\t\tresult.outputs = result.outputs ? (result.outputs as nbformat.IOutput[]).map(fixupOutput) : [];\n\t}\n\n\treturn result;\n}\nconst dummyStreamObj: nbformat.IStream = {\n\toutput_type: 'stream',\n\tname: 'stdout',\n\ttext: ''\n};\nconst dummyErrorObj: nbformat.IError = {\n\toutput_type: 'error',\n\tename: '',\n\tevalue: '',\n\ttraceback: ['']\n};\nconst dummyDisplayObj: nbformat.IDisplayData = {\n\toutput_type: 'display_data',\n\tdata: {},\n\tmetadata: {}\n};\nconst dummyExecuteResultObj: nbformat.IExecuteResult = {\n\toutput_type: 'execute_result',\n\tname: '',\n\texecution_count: 0,\n\tdata: {},\n\tmetadata: {}\n};\nconst AllowedCellOutputKeys = {\n\t['stream']: new Set(Object.keys(dummyStreamObj)),\n\t['error']: new Set(Object.keys(dummyErrorObj)),\n\t['display_data']: new Set(Object.keys(dummyDisplayObj)),\n\t['execute_result']: new Set(Object.keys(dummyExecuteResultObj))\n};\n\nfunction fixupOutput(output: nbformat.IOutput): nbformat.IOutput {\n\tlet allowedKeys: Set<string>;\n\tswitch (output.output_type) {\n\t\tcase 'stream':\n\t\tcase 'error':\n\t\tcase 'execute_result':\n\t\tcase 'display_data':\n\t\t\tallowedKeys = AllowedCellOutputKeys[output.output_type];\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn output;\n\t}\n\tconst result = { ...output };\n\tfor (const k of Object.keys(output)) {\n\t\tif (!allowedKeys.has(k)) {\n\t\t\tdelete result[k];\n\t\t}\n\t}\n\treturn result;\n}\n\n\nexport function serializeNotebookToString(data: NotebookData): string {\n\tconst notebookContent = getNotebookMetadata(data);\n\t// use the preferred language from document metadata or the first cell language as the notebook preferred cell language\n\tconst preferredCellLanguage = notebookContent.metadata?.language_info?.name ?? data.cells.find(cell => cell.kind === 2)?.languageId;\n\n\tnotebookContent.cells = data.cells\n\t\t.map(cell => createJupyterCellFromNotebookCell(cell, preferredCellLanguage))\n\t\t.map(pruneCell);\n\n\tconst indentAmount = data.metadata && typeof data.metadata.indentAmount === 'string' ?\n\t\tdata.metadata.indentAmount :\n\t\t' ';\n\n\treturn serializeNotebookToJSON(notebookContent, indentAmount);\n}\nfunction serializeNotebookToJSON(notebookContent: Partial<nbformat.INotebookContent>, indentAmount: string): string {\n\t// ipynb always ends with a trailing new line (we add this so that SCMs do not show unnecessary changes, resulting from a missing trailing new line).\n\tconst sorted = sortObjectPropertiesRecursively(notebookContent);\n\n\treturn JSON.stringify(sorted, undefined, indentAmount) + '\\n';\n}\n\nexport function getNotebookMetadata(document: NotebookDocument | NotebookData) {\n\tconst existingContent: Partial<nbformat.INotebookContent> = document.metadata || {};\n\tconst notebookContent: Partial<nbformat.INotebookContent> = {};\n\tnotebookContent.cells = existingContent.cells || [];\n\tnotebookContent.nbformat = existingContent.nbformat || defaultNotebookFormat.major;\n\tnotebookContent.nbformat_minor = existingContent.nbformat_minor ?? defaultNotebookFormat.minor;\n\tnotebookContent.metadata = existingContent.metadata || {};\n\treturn notebookContent;\n}\n", "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { serializeNotebookToString } from './serializers';\nimport type { NotebookData } from 'vscode';\n\nonmessage = (e) => {\n\tconst data = e.data as { id: string; data: NotebookData };\n\tconst json = serializeNotebookToString(data.data);\n\tconst bytes = new TextEncoder().encode(json);\n\tpostMessage({ id: data.id, data: bytes });\n};\n"],
5
+ "mappings": "aA4FO,SAASA,EAAgCC,EAAMC,EAA+G,CACpK,QAAWC,KAAKD,EACf,GAAI,EAAEC,KAAKF,GACV,MAAO,GAGT,MAAO,EACR,CC5FO,IAAMG,EAAwB,CAAE,MAAO,EAAG,MAAO,CAAE,EAMnD,IAAMC,EAAyB,EAU/B,IAAMC,EAAgB,CAAC,aAAc,gBAAiB,aAAc,uCAA4B,sCAA0B,ECbjI,IAAMC,EAAc,IAAI,YAEjB,SAASC,EACfC,EACAC,EACkE,CAClE,IAAIC,EACJ,OAAIF,EAAQ,OAASG,EACpBD,EAAOE,EAAmCJ,CAAO,EACvCA,EAAQ,aAAe,MACjCE,EAAOG,EAA8BL,CAAO,EAE5CE,EAAOI,EAA+BN,EAASC,CAAiB,EAE1DC,CACR,CAQO,SAASK,EAAgCC,EAAe,CAC9D,OAAI,MAAM,QAAQA,CAAG,EACbA,EAAI,IAAID,CAA+B,EAEtBC,GAAQ,MAAQ,OAAOA,GAAQ,UAAY,OAAO,KAAKA,CAAG,EAAE,OAAS,EAE5F,OAAO,KAAKA,CAAG,EACb,KAAK,EACL,OAAgC,CAACC,EAAWC,KAC5CD,EAAUC,CAAI,EAAIH,EAAgCC,EAAIE,CAAI,CAAC,EACpDD,GACL,CAAC,CAAC,EAGDD,CACR,CAEO,SAASG,EAAgBC,EAA0G,CACzI,GAAIC,EAAOD,EAAS,CAAE,KAAM,EAAK,CAAC,EAAG,CACpC,IAAMV,EAAOU,EAAQ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D,CAAC,EAC7D,OAAAA,EAAgB,MAAQS,EAAgB,OAAS,CAAC,EAClDT,EAAgB,SAAWS,EAAgB,UAAYC,EAAsB,MAC7EV,EAAgB,eAAiBS,EAAgB,gBAAkBC,EAAsB,MACzFV,EAAgB,SAAWS,EAAgB,UAAY,CAAC,EACjDT,CACR,CCneA,UAAaW,GAAM,CAClB,IAAMC,EAAOD,EAAE,KACTE,EAAOC,EAA0BF,EAAK,IAAI,EAC1CG,EAAQ,IAAI,YAAY,EAAE,OAAOF,CAAI,EAC3C,YAAY,CAAE,GAAID,EAAK,GAAI,KAAMG,CAAM,CAAC,CACzC",
6
+ "names": ["hasKey", "x", "key", "k", "defaultNotebookFormat", "NotebookCellKindMarkup", "textMimeTypes", "textDecoder", "createJupyterCellFromNotebookCell", "vscCell", "preferredLanguage", "cell", "NotebookCellKindMarkup", "createMarkdownCellFromNotebookCell", "createRawCellFromNotebookCell", "createCodeCellFromNotebookCell", "sortObjectPropertiesRecursively", "obj", "sortedObj", "prop", "getCellMetadata", "options", "hasKey", "metadata", "setVSCodeCellLanguageId", "metadata", "languageId", "removeVSCodeCellLanguageId", "createCodeCellFromNotebookCell", "cell", "preferredLanguage", "cellMetadata", "getCellMetadata", "codeCell", "splitCellSourceIntoMultilineString", "translateCellDisplayOutput", "createRawCellFromNotebookCell", "rawCell", "source", "splitMultilineString", "str", "arr", "s", "i", "output", "customMetadata", "result", "translateCellErrorOutput", "convertStreamOutput", "prev", "curr", "convertOutputMimeToJupyterOutput", "isError", "item", "isStream", "outputType", "unknownOutput", "firstItem", "originalError", "value", "textDecoder", "getOutputStreamType", "outputs", "opit", "lines", "line", "index", "mime", "stringValue", "textMimeTypes", "b", "createMarkdownCellFromNotebookCell", "markdownCell", "pruneCell", "fixupOutput", "dummyStreamObj", "dummyErrorObj", "dummyDisplayObj", "dummyExecuteResultObj", "AllowedCellOutputKeys", "allowedKeys", "k", "serializeNotebookToString", "data", "notebookContent", "getNotebookMetadata", "preferredCellLanguage", "createJupyterCellFromNotebookCell", "indentAmount", "serializeNotebookToJSON", "sorted", "sortObjectPropertiesRecursively", "document", "existingContent", "defaultNotebookFormat", "e", "data", "json", "serializeNotebookToString", "bytes"]
7
+ }
@@ -1 +1 @@
1
- {"name":"ipynb","displayName":"%displayName%","description":"%description%","publisher":"vscode","version":"1.0.0","license":"MIT","icon":"media/icon.png","engines":{"vscode":"^1.57.0"},"enabledApiProposals":["diffContentOptions"],"activationEvents":["onNotebook:jupyter-notebook","onNotebookSerializer:interactive","onNotebookSerializer:repl"],"extensionKind":["workspace","ui"],"main":"./dist/ipynbMain.node.js","browser":"./dist/browser/ipynbMain.browser.js","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":[{"properties":{"ipynb.pasteImagesAsAttachments.enabled":{"type":"boolean","scope":"resource","markdownDescription":"%ipynb.pasteImagesAsAttachments.enabled%","default":true},"ipynb.experimental.serialization":{"type":"boolean","scope":"resource","markdownDescription":"%ipynb.experimental.serialization%","default":true,"tags":["experimental"]}}}],"commands":[{"command":"ipynb.newUntitledIpynb","title":"%newUntitledIpynb.title%","shortTitle":"%newUntitledIpynb.shortTitle%","category":"Create"},{"command":"ipynb.openIpynbInNotebookEditor","title":"%openIpynbInNotebookEditor.title%"},{"command":"ipynb.cleanInvalidImageAttachment","title":"%cleanInvalidImageAttachment.title%"},{"command":"notebook.cellOutput.copy","title":"%copyCellOutput.title%","category":"Notebook"},{"command":"notebook.cellOutput.addToChat","title":"%addCellOutputToChat.title%","category":"Notebook","enablement":"chatIsEnabled"},{"command":"notebook.cellOutput.openInTextEditor","title":"%openCellOutput.title%","category":"Notebook"}],"notebooks":[{"type":"jupyter-notebook","displayName":"Jupyter Notebook","selector":[{"filenamePattern":"*.ipynb"}],"priority":"default"}],"notebookRenderer":[{"id":"vscode.markdown-it-cell-attachment-renderer","displayName":"%markdownAttachmentRenderer.displayName%","entrypoint":{"extends":"vscode.markdown-it-renderer","path":"./notebook-out/cellAttachmentRenderer.js"}}],"menus":{"file/newFile":[{"command":"ipynb.newUntitledIpynb","group":"notebook"}],"commandPalette":[{"command":"ipynb.newUntitledIpynb"},{"command":"ipynb.openIpynbInNotebookEditor","when":"false"},{"command":"ipynb.cleanInvalidImageAttachment","when":"false"},{"command":"notebook.cellOutput.copy","when":"notebookCellHasOutputs"},{"command":"notebook.cellOutput.openInTextEditor","when":"false"}],"webview/context":[{"command":"notebook.cellOutput.copy","when":"webviewId == 'notebook.output' && webviewSection == 'image'","group":"context@1"},{"command":"notebook.cellOutput.copy","when":"webviewId == 'notebook.output' && webviewSection == 'text'"},{"command":"notebook.cellOutput.addToChat","when":"webviewId == 'notebook.output' && (webviewSection == 'text' || webviewSection == 'image')","group":"context@2"},{"command":"notebook.cellOutput.openInTextEditor","when":"webviewId == 'notebook.output' && webviewSection == 'text'"}]}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}}
1
+ {"name":"ipynb","displayName":"%displayName%","description":"%description%","publisher":"vscode","version":"10.0.0","license":"MIT","icon":"media/icon.png","engines":{"vscode":"^1.57.0"},"enabledApiProposals":["diffContentOptions"],"activationEvents":["onNotebook:jupyter-notebook","onNotebookSerializer:interactive","onNotebookSerializer:repl"],"extensionKind":["workspace","ui"],"main":"./dist/ipynbMain.node.js","browser":"./dist/browser/ipynbMain.browser.js","capabilities":{"virtualWorkspaces":true,"untrustedWorkspaces":{"supported":true}},"contributes":{"configuration":[{"properties":{"ipynb.pasteImagesAsAttachments.enabled":{"type":"boolean","scope":"resource","markdownDescription":"%ipynb.pasteImagesAsAttachments.enabled%","default":true},"ipynb.experimental.serialization":{"type":"boolean","scope":"resource","markdownDescription":"%ipynb.experimental.serialization%","default":true,"tags":["experimental"]}}}],"commands":[{"command":"ipynb.newUntitledIpynb","title":"%newUntitledIpynb.title%","shortTitle":"%newUntitledIpynb.shortTitle%","category":"Create"},{"command":"ipynb.openIpynbInNotebookEditor","title":"%openIpynbInNotebookEditor.title%"},{"command":"ipynb.cleanInvalidImageAttachment","title":"%cleanInvalidImageAttachment.title%"},{"command":"notebook.cellOutput.copy","title":"%copyCellOutput.title%","category":"Notebook"},{"command":"notebook.cellOutput.addToChat","title":"%addCellOutputToChat.title%","category":"Notebook","enablement":"chatIsEnabled"},{"command":"notebook.cellOutput.openInTextEditor","title":"%openCellOutput.title%","category":"Notebook"}],"notebooks":[{"type":"jupyter-notebook","displayName":"Jupyter Notebook","selector":[{"filenamePattern":"*.ipynb"}],"priority":"default"}],"notebookRenderer":[{"id":"vscode.markdown-it-cell-attachment-renderer","displayName":"%markdownAttachmentRenderer.displayName%","entrypoint":{"extends":"vscode.markdown-it-renderer","path":"./notebook-out/cellAttachmentRenderer.js"}}],"menus":{"file/newFile":[{"command":"ipynb.newUntitledIpynb","group":"notebook"}],"commandPalette":[{"command":"ipynb.newUntitledIpynb"},{"command":"ipynb.openIpynbInNotebookEditor","when":"false"},{"command":"ipynb.cleanInvalidImageAttachment","when":"false"},{"command":"notebook.cellOutput.copy","when":"notebookCellHasOutputs"},{"command":"notebook.cellOutput.openInTextEditor","when":"false"}],"webview/context":[{"command":"notebook.cellOutput.copy","when":"webviewId == 'notebook.output' && webviewSection == 'image'","group":"context@1"},{"command":"notebook.cellOutput.copy","when":"webviewId == 'notebook.output' && webviewSection == 'text'"},{"command":"notebook.cellOutput.addToChat","when":"webviewId == 'notebook.output' && (webviewSection == 'text' || webviewSection == 'image')","group":"context@2"},{"command":"notebook.cellOutput.openInTextEditor","when":"webviewId == 'notebook.output' && webviewSection == 'text'"}]}},"repository":{"type":"git","url":"https://github.com/microsoft/vscode.git"}}