@sheetxl/scripting-react 0.8.0-beta.2 → 0.8.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +8 -7
- package/browser/esm/{CjmZ474x4bpyM84G.mjs → ByZ1oruplQvcyzml.mjs} +3 -3
- package/browser/esm/{MkaRYDR2k57n-olj.mjs → _0P-3FrZVqtnVTn9.mjs} +162 -160
- package/browser/esm/{rgUbThqZfKTH25kz.mjs → fA_y6YIyxaaB0y76.mjs} +45 -45
- package/browser/esm/index.mjs +440 -315
- package/node/esm/index.mjs +458 -336
- package/package.json +12 -12
- package/types/src/mergeImports.d.ts +64 -0
- package/browser/cjs/BAh9DnP6CTFXt1HI.cjs +0 -1
- package/browser/cjs/Bf_pmg4C0o1aKVy-.cjs +0 -2
- package/browser/cjs/CsWMPekp2nRo3bHt.cjs +0 -11
- package/browser/cjs/index.cjs +0 -9
package/package.json
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/scripting-react",
|
|
3
3
|
"description": "Scripting React - Monaco based script editor and scripting UI for SheetXL.",
|
|
4
|
-
"version": "0.8.0-beta.
|
|
5
|
-
"license": "SEE LICENSE IN
|
|
4
|
+
"version": "0.8.0-beta.20",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./types/index.d.ts",
|
|
10
10
|
"browser": "./browser/esm/index.mjs",
|
|
11
11
|
"node": "./node/esm/index.mjs",
|
|
12
|
-
"
|
|
13
|
-
"require": "./browser/cjs/index.cjs"
|
|
12
|
+
"default": "./browser/esm/index.mjs"
|
|
14
13
|
}
|
|
15
14
|
},
|
|
16
15
|
"types": "./types/index.d.ts",
|
|
17
16
|
"module": "./browser/esm/index.mjs",
|
|
18
|
-
"main": "./browser/
|
|
17
|
+
"main": "./browser/esm/index.mjs",
|
|
19
18
|
"sideEffects": [
|
|
20
19
|
"*.css",
|
|
21
20
|
"**/*.css"
|
|
@@ -41,12 +40,13 @@
|
|
|
41
40
|
],
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@monaco-editor/react": "^4.7.0",
|
|
44
|
-
"@sheetxl/react": "^0.8.0-beta.
|
|
45
|
-
"@sheetxl/scripting": "^0.8.0-beta.
|
|
46
|
-
"@sheetxl/sdk": "^0.8.0-beta.
|
|
47
|
-
"@sheetxl/utils": "^0.8.0-beta.
|
|
48
|
-
"@sheetxl/utils-react": "^0.8.0-beta.
|
|
43
|
+
"@sheetxl/react": "^0.8.0-beta.20",
|
|
44
|
+
"@sheetxl/scripting": "^0.8.0-beta.20",
|
|
45
|
+
"@sheetxl/sdk": "^0.8.0-beta.20",
|
|
46
|
+
"@sheetxl/utils": "^0.8.0-beta.20",
|
|
47
|
+
"@sheetxl/utils-react": "^0.8.0-beta.20",
|
|
49
48
|
"clsx": "^2.1.1",
|
|
49
|
+
"monaco-editor": "~0.55.1",
|
|
50
50
|
"monaco-editor-auto-typings": "^0.4.6",
|
|
51
51
|
"path-browserify": "^1.0.1",
|
|
52
52
|
"react-merge-refs": "^3.0.2"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"react-dom": "^19.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/react": "^19.
|
|
60
|
-
"@types/react-dom": "^19.
|
|
59
|
+
"@types/react": "^19.3.0",
|
|
60
|
+
"@types/react-dom": "^19.3.0"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single `import` statement from the leading import block of a script.
|
|
3
|
+
*/
|
|
4
|
+
export interface ImportStatement {
|
|
5
|
+
/** Offset of the `import` keyword. */
|
|
6
|
+
start: number;
|
|
7
|
+
/** Offset just past the statement, including its `;` when it has one. */
|
|
8
|
+
end: number;
|
|
9
|
+
/** The statement as written. */
|
|
10
|
+
text: string;
|
|
11
|
+
/** The module specifier, unquoted. */
|
|
12
|
+
module: string;
|
|
13
|
+
/** The quote character the module specifier was written with. */
|
|
14
|
+
quote: string;
|
|
15
|
+
/** Whether this is an `import type` statement. */
|
|
16
|
+
typeOnly: boolean;
|
|
17
|
+
/** A default or namespace binding (`Foo`, `* as Foo`), or `''`. */
|
|
18
|
+
binding: string;
|
|
19
|
+
/** The specifiers between the braces, whitespace-normalized; `null` when there are no braces. */
|
|
20
|
+
names: string[] | null;
|
|
21
|
+
/** Offset just past the `{`. Only meaningful when {@link names} is not `null`. */
|
|
22
|
+
namesStart: number;
|
|
23
|
+
/** Offset of the `}`. Only meaningful when {@link names} is not `null`. */
|
|
24
|
+
namesEnd: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ImportInsert {
|
|
27
|
+
/** Offset into the existing source. */
|
|
28
|
+
offset: number;
|
|
29
|
+
text: string;
|
|
30
|
+
}
|
|
31
|
+
export interface MergedImports {
|
|
32
|
+
/** The snippet with its import statements removed. */
|
|
33
|
+
body: string;
|
|
34
|
+
/** Insertions into the existing source that bring in whatever the snippet imports, by ascending offset. */
|
|
35
|
+
inserts: ImportInsert[];
|
|
36
|
+
/** Offset just past the existing source's last leading import, or `0` if it has none. */
|
|
37
|
+
importsEnd: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Reads the leading import block of a script.
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* Only the leading block is read: whitespace and comments are skipped and the scan stops at the
|
|
44
|
+
* first thing that is not an import statement. Text further down is never inspected, so an
|
|
45
|
+
* `import` inside a string, a comment, or a template literal cannot be mistaken for one.
|
|
46
|
+
*/
|
|
47
|
+
export declare const scanImports: (source: string) => ImportStatement[];
|
|
48
|
+
/**
|
|
49
|
+
* Separates a snippet's imports from its body and works out how to fold them into a script that
|
|
50
|
+
* may already import some of the same things.
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* Named imports (`import { A, B } from 'm'`) merge per name: a name the script already imports
|
|
54
|
+
* from that module is dropped, and the rest join the script's existing import of that module, or
|
|
55
|
+
* become a new statement after its last import when it has none. `import type` statements are
|
|
56
|
+
* merged among themselves, and a type the script already imports as a value is dropped.
|
|
57
|
+
*
|
|
58
|
+
* Any other form (default, namespace, side-effect) is added whole unless the script already has
|
|
59
|
+
* the same statement.
|
|
60
|
+
*
|
|
61
|
+
* A name that is already bound to a different module is not detected.
|
|
62
|
+
*/
|
|
63
|
+
export declare const mergeImports: (source: string, snippet: string) => MergedImports;
|
|
64
|
+
//# sourceMappingURL=mergeImports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(o,s,c)=>(c=o==null?{}:e(i(o)),((e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c,l=r(i),u=0,d=l.length;u<d;u++)c=l[u],a.call(e,c)||c===o||t(e,c,{get:(e=>i[e]).bind(null,c),enumerable:!(s=n(i,c))||s.enumerable});return e})(!s&&o&&o.__esModule?c:t(c,`default`,{value:o,enumerable:!0}),o));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./BAh9DnP6CTFXt1HI.cjs");var t=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DummySourceCache=void 0,e.DummySourceCache=function(){function e(){}return e.prototype.getFile=function(e){return Promise.resolve(void 0)},e.prototype.isFileAvailable=function(e){return Promise.resolve(!1)},e.prototype.storeFile=function(e,t){return Promise.resolve(void 0)},e.prototype.clear=function(){return Promise.resolve(void 0)},e}()}),n=e.t(e=>{var t=e&&e.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.JsDelivrSourceResolver=void 0,e.JsDelivrSourceResolver=function(){function e(){}return e.prototype.resolvePackageJson=function(e,r,i){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,this.resolveFile(`https://cdn.jsdelivr.net/npm/${e}${r?`@${r}`:``}${i?`/${i}`:``}/package.json`)];case 1:return[2,t.sent()]}})})},e.prototype.resolveSourceFile=function(e,r,i){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,this.resolveFile(`https://cdn.jsdelivr.net/npm/${e}${r?`@${r}`:``}/${i}`)];case 1:return[2,t.sent()]}})})},e.prototype.resolveFile=function(e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e,{method:`GET`})];case 1:return(t=n.sent()).ok?[4,t.text()]:[3,3];case 2:return[2,n.sent()];case 3:if(t.status===404)return[2,``];throw Error(`Error other than 404 while fetching from Unpkg at ${e}`);case 4:return[2]}})})},e}()}),r=e.t((e,t)=>{function n(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}function r(e,t){for(var n,r=``,i=0,a=-1,o=0,s=0;s<=e.length;++s){if(s<e.length)n=e.charCodeAt(s);else{if(n===47)break;n=47}if(n===47){if(a!==s-1&&o!==1)if(a!==s-1&&o===2){if(r.length<2||i!==2||r.charCodeAt(r.length-1)!==46||r.charCodeAt(r.length-2)!==46){if(r.length>2){var c=r.lastIndexOf(`/`);if(c!==r.length-1){c===-1?(r=``,i=0):i=(r=r.slice(0,c)).length-1-r.lastIndexOf(`/`),a=s,o=0;continue}}else if(r.length===2||r.length===1){r=``,i=0,a=s,o=0;continue}}t&&(r.length>0?r+=`/..`:r=`..`,i=2)}else r.length>0?r+=`/`+e.slice(a+1,s):r=e.slice(a+1,s),i=s-a-1;a=s,o=0}else n===46&&o!==-1?++o:o=-1}return r}var i={resolve:function(){for(var e,t=``,i=!1,a=arguments.length-1;a>=-1&&!i;a--){var o;a>=0?o=arguments[a]:(e===void 0&&(e=`/`),o=e),n(o),o.length!==0&&(t=o+`/`+t,i=o.charCodeAt(0)===47)}return t=r(t,!i),i?t.length>0?`/`+t:`/`:t.length>0?t:`.`},normalize:function(e){if(n(e),e.length===0)return`.`;var t=e.charCodeAt(0)===47,i=e.charCodeAt(e.length-1)===47;return(e=r(e,!t)).length!==0||t||(e=`.`),e.length>0&&i&&(e+=`/`),t?`/`+e:e},isAbsolute:function(e){return n(e),e.length>0&&e.charCodeAt(0)===47},join:function(){if(arguments.length===0)return`.`;for(var e,t=0;t<arguments.length;++t){var r=arguments[t];n(r),r.length>0&&(e===void 0?e=r:e+=`/`+r)}return e===void 0?`.`:i.normalize(e)},relative:function(e,t){if(n(e),n(t),e===t||(e=i.resolve(e))===(t=i.resolve(t)))return``;for(var r=1;r<e.length&&e.charCodeAt(r)===47;++r);for(var a=e.length,o=a-r,s=1;s<t.length&&t.charCodeAt(s)===47;++s);for(var c=t.length-s,l=o<c?o:c,u=-1,d=0;d<=l;++d){if(d===l){if(c>l){if(t.charCodeAt(s+d)===47)return t.slice(s+d+1);if(d===0)return t.slice(s+d)}else o>l&&(e.charCodeAt(r+d)===47?u=d:d===0&&(u=0));break}var f=e.charCodeAt(r+d);if(f!==t.charCodeAt(s+d))break;f===47&&(u=d)}var p=``;for(d=r+u+1;d<=a;++d)d!==a&&e.charCodeAt(d)!==47||(p.length===0?p+=`..`:p+=`/..`);return p.length>0?p+t.slice(s+u):(s+=u,t.charCodeAt(s)===47&&++s,t.slice(s))},_makeLong:function(e){return e},dirname:function(e){if(n(e),e.length===0)return`.`;for(var t=e.charCodeAt(0),r=t===47,i=-1,a=!0,o=e.length-1;o>=1;--o)if((t=e.charCodeAt(o))===47){if(!a){i=o;break}}else a=!1;return i===-1?r?`/`:`.`:r&&i===1?`//`:e.slice(0,i)},basename:function(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);n(e);var r,i=0,a=-1,o=!0;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;var s=t.length-1,c=-1;for(r=e.length-1;r>=0;--r){var l=e.charCodeAt(r);if(l===47){if(!o){i=r+1;break}}else c===-1&&(o=!1,c=r+1),s>=0&&(l===t.charCodeAt(s)?--s===-1&&(a=r):(s=-1,a=c))}return i===a?a=c:a===-1&&(a=e.length),e.slice(i,a)}for(r=e.length-1;r>=0;--r)if(e.charCodeAt(r)===47){if(!o){i=r+1;break}}else a===-1&&(o=!1,a=r+1);return a===-1?``:e.slice(i,a)},extname:function(e){n(e);for(var t=-1,r=0,i=-1,a=!0,o=0,s=e.length-1;s>=0;--s){var c=e.charCodeAt(s);if(c!==47)i===-1&&(a=!1,i=s+1),c===46?t===-1?t=s:o!==1&&(o=1):t!==-1&&(o=-1);else if(!a){r=s+1;break}}return t===-1||i===-1||o===0||o===1&&t===i-1&&t===r+1?``:e.slice(t,i)},format:function(e){if(typeof e!=`object`||!e)throw TypeError(`The "pathObject" argument must be of type Object. Received type `+typeof e);return function(e,t){var n=t.dir||t.root,r=t.base||(t.name||``)+(t.ext||``);return n?n===t.root?n+r:n+e+r:r}(`/`,e)},parse:function(e){n(e);var t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;var r,i=e.charCodeAt(0),a=i===47;a?(t.root=`/`,r=1):r=0;for(var o=-1,s=0,c=-1,l=!0,u=e.length-1,d=0;u>=r;--u)if((i=e.charCodeAt(u))!==47)c===-1&&(l=!1,c=u+1),i===46?o===-1?o=u:d!==1&&(d=1):o!==-1&&(d=-1);else if(!l){s=u+1;break}return o===-1||c===-1||d===0||d===1&&o===c-1&&o===s+1?c!==-1&&(t.base=t.name=s===0&&a?e.slice(1,c):e.slice(s,c)):(s===0&&a?(t.name=e.slice(1,o),t.base=e.slice(1,c)):(t.name=e.slice(s,o),t.base=e.slice(s,c)),t.ext=e.slice(o,c)),s>0?t.dir=e.slice(0,s-1):a&&(t.dir=`/`),t},sep:`/`,delimiter:`:`,win32:null,posix:null};i.posix=i,t.exports=i}),i=e.t(e=>{var t=e&&e.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),n=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!=="default"&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},a=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(t===void 0||t-->0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o},o=e&&e.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))};Object.defineProperty(e,"__esModule",{value:!0}),e.DependencyParser=void 0;var s=i(r());e.DependencyParser=function(){function e(){this.REGEX_CLEAN=/[\n|\r]/g,this.REGEX_DETECT_IMPORT=/(?:(?:(?:import)|(?:export))(?:.)*?from\s+["']([^"']+)["'])|(?:((?:require|import))(?:\s+)?\(["']([^"']+)["']\))|(?:\/+\s+<reference\s+path=["']([^"']+)["']\s+\/>)/g,this.REGEX_NODE_MODULE=/^node:([\w\W\/]+)$/}return e.prototype.parseDependencies=function(e,t){var n=this;return o([],a(e.matchAll(this.REGEX_DETECT_IMPORT)),!1).map(function(e){return e[1]??e[2]??e[3]}).filter(function(e){return!!e}).map(function(e){return n.resolvePath(e,t)})},e.prototype.resolvePath=function(e,t){var n=e.match(this.REGEX_NODE_MODULE);if(n)return{kind:`relative-in-package`,packageName:`@types/node`,importPath:`${n[1]}.d.ts`,sourcePath:``};if(typeof t==`string`){if(e.startsWith(`.`))return{kind:`relative`,importPath:e,sourcePath:t};if(e.startsWith(`@`)){var r=e.split(`/`);return{kind:`package`,packageName:`${r[0]}/${r[1]}`,importPath:r.slice(2).join(`/`)}}return{kind:`package`,packageName:(r=e.split(`/`))[0],importPath:r.slice(1).join(`/`)}}switch(t.kind){case`package`:throw Error(`TODO?`);case`relative`:throw Error(`TODO2?`);case`relative-in-package`:return e.startsWith(`.`)?{kind:`relative-in-package`,packageName:t.packageName,sourcePath:s.join(t.sourcePath,t.importPath),importPath:e}:e.startsWith(`@`)?(r=e.split(`/`),{kind:`package`,packageName:`${r[0]}/${r[1]}`,importPath:r.slice(2).join(`/`)}):{kind:`package`,packageName:(r=e.split(`/`))[0],importPath:r.slice(1).join(`/`)}}},e}()}),a=e.t(e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.importResourcePathToString=void 0;var n=t(r());e.importResourcePathToString=function(e){switch(e.kind){case`package`:return n.default.join(e.packageName,e.importPath??``,`package.json`);case`relative`:return n.default.join(e.sourcePath,e.importPath);case`relative-in-package`:return n.default.join(e.packageName,e.sourcePath,e.importPath)}}}),o=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.invokeUpdate=void 0,e.invokeUpdate=function(e,t){var n,r=`${e.type}: `;switch(e.type){case`CodeChanged`:case`ResolveNewImports`:r+=``;break;case`LookedUpTypeFile`:r+=`"${e.path}" was ${e.success?`sucessfully`:`not sucessfully`} looked up`;break;case`AttemptedLookUpFile`:r+=`"${e.path}" was ${e.success?`sucessfully`:`not sucessfully`} attempted to looked up`;break;case`LookedUpPackage`:r+=`package.json for package "${e.package}" was ${e.success?`sucessfully`:`not sucessfully`} looked up${e.definitelyTyped?` (found in definitely typed repo)`:``}`;break;case`LoadedFromCache`:r+=`"${e.importPath}" was loaded from cache`;break;case`StoredToCache`:r+=`"${e.importPath}" was stored to cache`}r.endsWith(`: `)&&(r=r.slice(void 0,-2)),(n=t.onUpdate)==null||n.call(t,e,r)}}),s=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.RecursionDepth=void 0,e.RecursionDepth=function(){function e(e,t,n){t===void 0&&(t=0),n===void 0&&(n=0),this.options=e,this.fileRecursionDepth=t,this.packageRecursionDepth=n}return e.prototype.nextPackage=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth+1)},e.prototype.nextFile=function(){return new e(this.options,this.fileRecursionDepth+1,this.packageRecursionDepth)},e.prototype.same=function(){return new e(this.options,this.fileRecursionDepth,this.packageRecursionDepth)},e.prototype.shouldStop=function(){return this.options.fileRecursionDepth>0&&this.fileRecursionDepth>=this.options.fileRecursionDepth||this.options.packageRecursionDepth>0&&this.packageRecursionDepth>=this.options.packageRecursionDepth},e}()}),c=e.t(e=>{var t=e&&e.__assign||function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},t.apply(this,arguments)},n=e&&e.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),c=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),l=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.prototype.hasOwnProperty.call(e,r)&&n(t,e,r);return c(t,e),t},u=e&&e.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},d=e&&e.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},f=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)},p=e&&e.__read||function(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(t===void 0||t-->0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(e,"__esModule",{value:!0}),e.ImportResolver=void 0;var m=i(),h=a(),g=l(r()),_=o(),v=s();e.ImportResolver=function(){function e(e){var t,n;if(this.options=e,this.loadedFiles=[],this.dependencyParser=new m.DependencyParser,this.cache=e.sourceCache,this.sourceResolver=e.sourceResolver,this.newImportsResolved=!1,this.monaco=e.monaco,e.preloadPackages&&e.versions){this.versions=e.versions;try{for(var r=f(Object.entries(e.versions)),i=r.next();!i.done;i=r.next()){var a=p(i.value,2),o=a[0];a[1],this.resolveImport({kind:`package`,packageName:o,importPath:``},new v.RecursionDepth(this.options)).catch(function(e){console.error(e)})}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}}return e.prototype.wereNewImportsResolved=function(){return this.newImportsResolved},e.prototype.resetNewImportsResolved=function(){this.newImportsResolved=!1},e.prototype.resolveImportsInFile=function(e,t,n){var r,i;return u(this,void 0,void 0,function(){var a,o,s,c,l,u,p,m;return d(this,function(d){switch(d.label){case 0:if(n.shouldStop())return[2];a=this.dependencyParser.parseDependencies(e,t),d.label=1;case 1:d.trys.push([1,8,9,10]),o=f(a),s=o.next(),d.label=2;case 2:if(s.done)return[3,7];c=s.value,d.label=3;case 3:return d.trys.push([3,5,,6]),[4,this.resolveImport(c,n)];case 4:return d.sent(),[3,6];case 5:return l=d.sent(),this.options.onError?(i=(r=this.options).onError)==null||i.call(r,l.message??l):console.error(l),[3,6];case 6:return s=o.next(),[3,2];case 7:return[3,10];case 8:return u=d.sent(),p={error:u},[3,10];case 9:try{s&&!s.done&&(m=o.return)&&m.call(o)}finally{if(p)throw p.error}return[7];case 10:return[2]}})})},e.prototype.resolveImport=function(e,t){return u(this,void 0,void 0,function(){var n,r;return d(this,function(i){switch(i.label){case 0:if(n=this.hashImportResourcePath(e),this.loadedFiles.includes(n))return[2];switch(this.loadedFiles.push(n),e.kind){case`package`:return[3,1];case`relative`:return[3,5];case`relative-in-package`:return[3,6]}return[3,8];case 1:return[4,this.resolveImportFromPackageRoot(e)];case 2:return(r=i.sent())?[4,this.resolveImportInPackage(r,t.nextPackage().nextFile())]:[3,4];case 3:case 7:return[2,i.sent()];case 4:return[3,8];case 5:throw Error(`Not implemented yet`);case 6:return[4,this.resolveImportInPackage(e,t.nextFile())];case 8:return[2]}})})},e.prototype.resolveImportInPackage=function(e,t){return u(this,void 0,void 0,function(){var n,r,i;return d(this,function(a){switch(a.label){case 0:return[4,this.loadSourceFileContents(e)];case 1:return(n=a.sent())?(r=n.source,i=n.at,this.createModel(r,this.monaco.Uri.parse(this.options.fileRootPath+g.join(`node_modules/${e.packageName}`,i))),[4,this.resolveImportsInFile(r,{kind:`relative-in-package`,packageName:e.packageName,sourcePath:g.dirname(i),importPath:``},t)]):[3,3];case 2:a.sent(),a.label=3;case 3:return[2]}})})},e.prototype.resolveImportFromPackageRoot=function(e){var t;return u(this,void 0,void 0,function(){var n,r,i,a,o,s,c,l,u;return d(this,function(d){switch(d.label){case 0:return n={type:`LookedUpPackage`,package:e.packageName,definitelyTyped:!1,success:!1},!this.options.onlySpecifiedPackages||this.versions?.[e.packageName]||this.versions?.[`@types/`+e.packageName]?(r=(t=e.importPath?.length)!=null&&t,i=r?`/${e.importPath}`:``,[4,this.resolvePackageJson(e.packageName,this.versions?.[e.packageName],r?e.importPath:void 0)]):((0,_.invokeUpdate)(n,this.options),[2]);case 1:return(a=d.sent())||!r?[3,3]:[4,this.resolvePackageJson(e.packageName,this.versions?.[e.packageName])];case 2:a=d.sent(),i=``,d.label=3;case 3:return a?(o=JSON.parse(a)).typings||o.types?(u=o.typings||o.types,this.createModel(a,this.monaco.Uri.parse(`${this.options.fileRootPath}node_modules/${e.packageName}${i}/package.json`)),(0,_.invokeUpdate)({type:`LookedUpPackage`,package:e.packageName,definitelyTyped:!1,success:!0},this.options),this.setVersion(e.packageName,o.version),[2,{kind:`relative-in-package`,packageName:e.packageName,sourcePath:``,importPath:g.join(e.importPath??``,u.startsWith(`./`)?u.slice(2):u)}]):[3,4]:[3,7];case 4:return s=`@types/${e.packageName.startsWith(`@`)?e.packageName.slice(1).replace(/\//,`__`):e.packageName}`,[4,this.resolvePackageJson(s,this.versions?.[s])];case 5:if(c=d.sent()){if((l=JSON.parse(c)).typings||l.types)return u=l.typings||l.types,this.createModel(c,this.monaco.Uri.parse(`${this.options.fileRootPath}node_modules/${s}/package.json`)),(0,_.invokeUpdate)({type:`LookedUpPackage`,package:s,definitelyTyped:!0,success:!0},this.options),this.setVersion(s,l.version),[2,{kind:`relative-in-package`,packageName:s,sourcePath:``,importPath:g.join(e.importPath??``,u.startsWith(`./`)?u.slice(2):u)}];(0,_.invokeUpdate)(n,this.options)}else(0,_.invokeUpdate)(n,this.options);d.label=6;case 6:return[3,8];case 7:(0,_.invokeUpdate)(n,this.options),d.label=8;case 8:return[2]}})})},e.prototype.loadSourceFileContents=function(e){return u(this,void 0,void 0,function(){var t,n,r,i,a,o,s,c,l,u,p,m,h,v,y,b;return d(this,function(d){switch(d.label){case 0:return t=g.join(e.packageName,e.sourcePath,e.importPath),n={type:`LookedUpTypeFile`,path:t,definitelyTyped:!1,success:!1},r=e.packageName,i=this.getVersion(e.packageName),(a=[`.d.ts`,`/index.d.ts`,`.ts`,`.tsx`,`/index.ts`,`/index.tsx`]).map(function(t){return e.importPath.endsWith(t)}).reduce(function(e,t){return e||t},!1)?[4,this.resolveSourceFile(r,i,g.join(e.sourcePath,e.importPath))]:[3,2];case 1:return(v=d.sent())?[2,{source:v,at:g.join(e.sourcePath,e.importPath)}]:[3,9];case 2:d.trys.push([2,7,8,9]),o=f(a),s=o.next(),d.label=3;case 3:return s.done?[3,6]:(c=s.value,l=g.join(e.sourcePath,e.importPath),h=(c===`.d.ts`&&l.endsWith(`.js`)?l.slice(0,-3):l)+c,[4,this.resolveSourceFile(r,i,h)]);case 4:if(v=d.sent(),(0,_.invokeUpdate)({type:`AttemptedLookUpFile`,path:g.join(r,h),success:!!v},this.options),v)return(0,_.invokeUpdate)({type:`LookedUpTypeFile`,path:g.join(r,h),success:!0},this.options),[2,{source:v,at:h}];d.label=5;case 5:return s=o.next(),[3,3];case 6:return[3,9];case 7:return u=d.sent(),y={error:u},[3,9];case 8:try{s&&!s.done&&(b=o.return)&&b.call(o)}finally{if(y)throw y.error}return[7];case 9:return[4,this.resolvePackageJson(r,i,g.join(e.sourcePath,e.importPath))];case 10:return(p=d.sent())&&(m=JSON.parse(p).types)?(h=g.join(e.sourcePath,e.importPath,m),[4,this.resolveSourceFile(r,i,h)]):[3,12];case 11:if(v=d.sent())return(0,_.invokeUpdate)({type:`LookedUpTypeFile`,path:g.join(r,h),success:!0},this.options),[2,{source:v,at:h}];d.label=12;case 12:return(0,_.invokeUpdate)(n,this.options),[2,null]}})})},e.prototype.getVersion=function(e){return this.versions?.[e]},e.prototype.setVersions=function(e){var t,n;this.versions=e,(n=(t=this.options).onUpdateVersions)==null||n.call(t,e)},e.prototype.setVersion=function(e,n){var r;this.setVersions(t(t({},this.versions),((r={})[e]=n,r)))},e.prototype.createModel=function(e,t){t=t.with({path:t.path.replace(`@types/`,``)}),this.monaco.editor.getModel(t)||(this.monaco.editor.createModel(e,`typescript`,t),this.newImportsResolved=!0)},e.prototype.hashImportResourcePath=function(e){return(0,h.importResourcePathToString)(e)},e.prototype.resolvePackageJson=function(e,t,n){return u(this,void 0,void 0,function(){var r,i,a,o;return d(this,function(s){switch(s.label){case 0:return r=g.join(e+(t?`@${t}`:``),n??``,`package.json`),i=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(r)]:[3,2];case 1:return i=s.sent(),[3,4];case 2:return[4,this.cache.getFile(r)];case 3:a=s.sent(),i=a!==void 0,s.label=4;case 4:return i?a==null?[3,5]:(o=a,[3,7]):[3,8];case 5:return[4,this.cache.getFile(r)];case 6:o=s.sent(),s.label=7;case 7:return[2,o];case 8:return[4,this.sourceResolver.resolvePackageJson(e,t,n)];case 9:return(a=s.sent())&&this.cache.storeFile(r,a),[2,a]}})})},e.prototype.resolveSourceFile=function(e,t,n){return u(this,void 0,void 0,function(){var r,i,a,o;return d(this,function(s){switch(s.label){case 0:return r=g.join(e+(t?`@${t}`:``),n),i=!1,a=void 0,this.cache.isFileAvailable?[4,this.cache.isFileAvailable(r)]:[3,2];case 1:return i=s.sent(),[3,4];case 2:return[4,this.cache.getFile(r)];case 3:a=s.sent(),i=a!==void 0,s.label=4;case 4:return i?((0,_.invokeUpdate)({type:`LoadedFromCache`,importPath:r},this.options),a==null?[3,5]:(o=a,[3,7])):[3,8];case 5:return[4,this.cache.getFile(r)];case 6:o=s.sent(),s.label=7;case 7:return[2,o];case 8:return[4,this.sourceResolver.resolveSourceFile(e,t,n)];case 9:return(a=s.sent())&&((0,_.invokeUpdate)({type:`StoredToCache`,importPath:r},this.options),this.cache.storeFile(r,a)),[2,a]}})})},e}()}),l=e.t(e=>{var i=e&&e.__assign||function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)},a=e&&e.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),l=e&&e.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),u=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)n!=="default"&&Object.prototype.hasOwnProperty.call(e,n)&&a(t,e,n);return l(t,e),t},d=e&&e.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},f=e&&e.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},p=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.AutoTypingsCore=void 0;var m=t(),h=n(),g=c(),_=u(r()),v=o(),y=s();e.AutoTypingsCore=function(){function e(e,t){var n=this;this.editor=e,this.options=t,this.disposables=[],this.importResolver=new g.ImportResolver(t);var r=e.onDidChangeModelContent(function(e){n.debouncedResolveContents()});this.disposables.push(r),this.resolveContents(),t.dontAdaptEditorOptions||t.monaco.languages.typescript.typescriptDefaults.setCompilerOptions(i(i({},t.monaco.languages.typescript.typescriptDefaults.getCompilerOptions()),{moduleResolution:t.monaco.languages.typescript.ModuleResolutionKind.NodeJs,allowSyntheticDefaultImports:!0,rootDir:t.fileRootPath}))}return e.create=function(t,n){return d(this,void 0,void 0,function(){var r;return f(this,function(a){if(n?.shareCache&&n.sourceCache&&!e.sharedCache&&(e.sharedCache=n.sourceCache),!(r=n?.monaco))throw Error(`monacoInstance not found, you can specify the monaco instance via options.monaco`);return[2,new e(t,i(i({fileRootPath:`inmemory://model/`,onlySpecifiedPackages:!1,preloadPackages:!1,shareCache:!1,dontAdaptEditorOptions:!1,dontRefreshModelValueAfterResolvement:!1,sourceCache:e.sharedCache??new m.DummySourceCache,sourceResolver:n?.sourceResolver??new h.JsDelivrSourceResolver,debounceDuration:4e3,fileRecursionDepth:10,packageRecursionDepth:3},n),{monaco:r}))]})})},e.prototype.dispose=function(){var e,t;try{for(var n=p(this.disposables),r=n.next();!r.done;r=n.next())r.value.dispose()}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.setVersions=function(e){this.importResolver.setVersions(e),this.options.versions=e},e.prototype.clearCache=function(){return d(this,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return[4,this.options.sourceCache.clear()];case 1:return e.sent(),[2]}})})},e.prototype.debouncedResolveContents=function(){var e=this;this.isResolving||((0,v.invokeUpdate)({type:`CodeChanged`},this.options),this.options.debounceDuration<=0?this.resolveContents():(this.debounceTimer!==void 0&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(function(){return d(e,void 0,void 0,function(){return f(this,function(e){switch(e.label){case 0:return[4,this.resolveContents()];case 1:return e.sent(),this.debounceTimer=void 0,[2]}})})},this.options.debounceDuration)))},e.prototype.resolveContents=function(){return d(this,void 0,void 0,function(){var e,t,n,r;return f(this,function(i){switch(i.label){case 0:if(this.isResolving=!0,(0,v.invokeUpdate)({type:`ResolveNewImports`},this.options),!(e=this.editor.getModel()))throw Error(`No model`);t=e.getLinesContent(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.importResolver.resolveImportsInFile(t.join(`
|
|
2
|
-
`),_.dirname(e.uri.toString()),new y.RecursionDepth(this.options))];case 2:return i.sent(),[3,4];case 3:if(n=i.sent(),!this.options.onError)throw n;return this.options.onError(n.message??n),[3,4];case 4:return this.importResolver.wereNewImportsResolved()&&(this.options.dontRefreshModelValueAfterResolvement||(r=this.editor.getPosition(),e.setValue(e.getValue()),r&&this.editor.setPosition(r)),this.importResolver.resetNewImportsResolved()),this.isResolving=!1,[2]}})})},e}()}),u=e.t(e=>{var t,n=e&&e.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)},function(e,n){if(typeof n!=`function`&&n!==null)throw TypeError(`Class extends value `+String(n)+` is not a constructor or null`);function r(){this.constructor=e}t(e,n),e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.AutoTypings=void 0,e.AutoTypings=function(e){function t(t,n){return e.call(this,t,n)||this}return n(t,e),t}(l().AutoTypingsCore)}),d=e.t(e=>{var t=e&&e.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}},r=e&&e.__values||function(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)};Object.defineProperty(e,"__esModule",{value:!0}),e.LocalStorageCache=void 0,e.LocalStorageCache=function(){function e(){this.localCache={}}return e.prototype.getFile=function(r){return t(this,void 0,void 0,function(){return n(this,function(t){try{return[2,localStorage.getItem(e.LOCALSTORAGE_PREFIX+r)??void 0]}catch{return[2,this.localCache[r]]}})})},e.prototype.storeFile=function(r,i){return t(this,void 0,void 0,function(){return n(this,function(t){this.localCache[r]=i;try{localStorage.setItem(e.LOCALSTORAGE_PREFIX+r,i)}catch{}return[2]})})},e.prototype.clear=function(){return t(this,void 0,void 0,function(){var t,i,a,o,s,c,l;return n(this,function(n){for(this.localCache={},t=[],i=0;i<localStorage.length;i++)(s=localStorage.key(i))?.startsWith(e.LOCALSTORAGE_PREFIX)&&t.push(s);try{for(a=r(t),o=a.next();!o.done;o=a.next())s=o.value,localStorage.removeItem(s)}catch(e){c={error:e}}finally{try{o&&!o.done&&(l=a.return)&&l.call(a)}finally{if(c)throw c.error}}return[2]})})},e.LOCALSTORAGE_PREFIX=`__autotyper_cache_`,e}()}),f=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0})}),p=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0})}),m=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0})}),h=e.t(e=>{Object.defineProperty(e,"__esModule",{value:!0})}),g=e.t(e=>{var t=e&&e.__awaiter||function(e,t,n,r){return new(n||=Promise)(function(i,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},n=e&&e.__generator||function(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw TypeError(`Generator is already executing.`);for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(i=o.trys,!((i=i.length>0&&i[i.length-1])||a[0]!==6&&a[0]!==2)){o=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(a[0]===6&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.UnpkgSourceResolver=void 0,e.UnpkgSourceResolver=function(){function e(){}return e.prototype.resolvePackageJson=function(e,r,i){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,this.resolveFile(`https://unpkg.com/${e}${r?`@${r}`:``}${i?`/${i}`:``}/package.json`)];case 1:return[2,t.sent()]}})})},e.prototype.resolveSourceFile=function(e,r,i){return t(this,void 0,void 0,function(){return n(this,function(t){switch(t.label){case 0:return[4,this.resolveFile(`https://unpkg.com/${e}${r?`@${r}`:``}/${i}`)];case 1:return[2,t.sent()]}})})},e.prototype.resolveFile=function(e){return t(this,void 0,void 0,function(){var t;return n(this,function(n){switch(n.label){case 0:return[4,fetch(e,{method:`GET`})];case 1:return(t=n.sent()).ok?[4,t.text()]:[3,3];case 2:return[2,n.sent()];case 3:if(t.status===404)return[2,``];throw Error(`Error other than 404 while fetching from Unpkg at ${e}`);case 4:return[2]}})})},e}()}),_=e.t(e=>{var t=e&&e.__createBinding||(Object.create?function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!(`get`in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),r=e&&e.__exportStar||function(e,n){for(var r in e)r==="default"||Object.prototype.hasOwnProperty.call(n,r)||t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),r(u(),e),r(a(),e),r(d(),e),r(f(),e),r(p(),e),r(m(),e),r(h(),e),r(g(),e),r(n(),e)}),v=e.t((e,t)=>{t.exports=_()});Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return v()}});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const e=require("./BAh9DnP6CTFXt1HI.cjs");let t=require("react");function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e,t,n){return(t=function(e){var t=function(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}(e,`string`);return typeof t==`symbol`?t:t+``}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?i(Object(n),!0).forEach(function(t){r(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?s(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e){return function t(){for(var n=this,r=arguments.length,i=Array(r),a=0;a<r;a++)i[a]=arguments[a];return i.length>=e.length?e.apply(this,i):function(){for(var e=arguments.length,r=Array(e),a=0;a<e;a++)r[a]=arguments[a];return t.apply(n,[].concat(i,r))}}}function u(e){return{}.toString.call(e).includes(`Object`)}function d(e){return typeof e==`function`}t=e.n(t,1);var f=l(function(e,t){throw Error(e[t]||e.default)})({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),p={changes:function(e,t){return u(t)||f(`changeType`),Object.keys(t).some(function(t){return n=e,r=t,!Object.prototype.hasOwnProperty.call(n,r);var n,r})&&f(`changeField`),t},selector:function(e){d(e)||f(`selectorType`)},handler:function(e){d(e)||u(e)||f(`handlerType`),u(e)&&Object.values(e).some(function(e){return!d(e)})&&f(`handlersType`)},initial:function(e){var t;e||f(`initialIsRequired`),u(e)||f(`initialType`),t=e,Object.keys(t).length||f(`initialContent`)}};function m(e,t){return d(t)?t(e.current):t}function h(e,t){return e.current=c(c({},e.current),t),t}function g(e,t,n){return d(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var _={create:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};p.initial(e),p.handler(t);var n={current:e},r=l(g)(n,t),i=l(h)(n),a=l(p.changes)(e),o=l(m)(n);return[function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return p.selector(e),e(n.current)},function(e){(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(r,i,a,o)(e)}]}},v,y={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
2
|
-
You are using deprecated way of configuration.
|
|
3
|
-
|
|
4
|
-
Instead of using
|
|
5
|
-
monaco.config({ urls: { monacoBase: '...' } })
|
|
6
|
-
use
|
|
7
|
-
monaco.config({ paths: { vs: '...' } })
|
|
8
|
-
|
|
9
|
-
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
10
|
-
`},b=(v=function(e,t){throw Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return r.length>=v.length?v.apply(this,r):function(){for(var n=arguments.length,i=Array(n),a=0;a<n;a++)i[a]=arguments[a];return e.apply(t,[].concat(r,i))}})(y),x={config:function(e){var t;return e||b(`configIsRequired`),t=e,{}.toString.call(t).includes(`Object`)||b(`configType`),e.urls?(console.warn(y.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function S(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],S(e[n],t[n]))}),a(a({},e),t)}var C={type:`cancelation`,msg:`operation is manually canceled`};function w(e){var t=!1,n=new Promise(function(n,r){e.then(function(e){return t?r(C):n(e)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var T,E,D=[`monaco`],O=(T=_.create({config:{paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}},isInitialized:!1,resolve:null,reject:null,monaco:null}),E=2,function(e){if(Array.isArray(e))return e}(T)||function(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}(T,E)||function(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}(T,E)||function(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()),k=O[0],A=O[1];function j(e){return document.body.appendChild(e)}function M(e){var t,n,r=k(function(e){return{config:e.config,reject:e.reject}}),i=(t=`${r.config.paths.vs}/loader.js`,n=document.createElement(`script`),t&&(n.src=t),n);return i.onload=function(){return e()},i.onerror=r.reject,i}function N(){var e=k(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t([`vs/editor/editor.main`],function(t){var n=t.m||t;P(n),e.resolve(n)},function(t){e.reject(t)})}function P(e){k().monaco||A({monaco:e})}var F=new Promise(function(e,t){return A({resolve:e,reject:t})}),I={config:function(e){var t=x.config(e),n=t.monaco,r=function(e,t){if(e==null)return{};var n,r,i=function(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(t,D);A(function(e){return{config:S(e.config,r),monaco:n}})},init:function(){var e=k(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(A({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),w(F);if(window.monaco&&window.monaco.editor)return P(window.monaco),e.resolve(window.monaco),w(F);(function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}})(j,M)(N)}return w(F)},__getMonacoInstance:function(){return k(function(e){return e.monaco})}},L={display:`flex`,position:`relative`,textAlign:`initial`},R={width:`100%`},z={display:`none`},B={container:{display:`flex`,height:`100%`,width:`100%`,justifyContent:`center`,alignItems:`center`}},V=function({children:e}){return t.default.createElement(`div`,{style:B.container},e)},H=(0,t.memo)(function({width:e,height:n,isEditorReady:r,loading:i,_ref:a,className:o,wrapperProps:s}){return t.default.createElement(`section`,{style:{...L,width:e,height:n},...s},!r&&t.default.createElement(V,null,i),t.default.createElement(`div`,{ref:a,style:{...R,...!r&&z},className:o}))}),U=function(e){(0,t.useEffect)(e,[])},W=function(e,n,r=!0){let i=(0,t.useRef)(!0);(0,t.useEffect)(i.current||!r?()=>{i.current=!1}:e,n)};function G(){}function K(e,t,n,r){return function(e,t){return e.editor.getModel(q(e,t))}(e,r)||function(e,t,n,r){return e.editor.createModel(t,n,r?q(e,r):void 0)}(e,t,n,r)}function q(e,t){return e.Uri.parse(t)}var J=(0,t.memo)(function({original:e,modified:n,language:r,originalLanguage:i,modifiedLanguage:a,originalModelPath:o,modifiedModelPath:s,keepCurrentOriginalModel:c=!1,keepCurrentModifiedModel:l=!1,theme:u=`light`,loading:d=`Loading...`,options:f={},height:p=`100%`,width:m=`100%`,className:h,wrapperProps:g={},beforeMount:_=G,onMount:v=G}){let[y,b]=(0,t.useState)(!1),[x,S]=(0,t.useState)(!0),C=(0,t.useRef)(null),w=(0,t.useRef)(null),T=(0,t.useRef)(null),E=(0,t.useRef)(v),D=(0,t.useRef)(_),O=(0,t.useRef)(!1);U(()=>{let e=I.init();return e.then(e=>(w.current=e)&&S(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>C.current?function(){let e=C.current?.getModel();c||e?.original?.dispose(),l||e?.modified?.dispose(),C.current?.dispose()}():e.cancel()}),W(()=>{if(C.current&&w.current){let t=C.current.getOriginalEditor(),n=K(w.current,e||``,i||r||`text`,o||``);n!==t.getModel()&&t.setModel(n)}},[o],y),W(()=>{if(C.current&&w.current){let e=C.current.getModifiedEditor(),t=K(w.current,n||``,a||r||`text`,s||``);t!==e.getModel()&&e.setModel(t)}},[s],y),W(()=>{let e=C.current.getModifiedEditor();e.getOption(w.current.editor.EditorOption.readOnly)?e.setValue(n||``):n!==e.getValue()&&(e.executeEdits(``,[{range:e.getModel().getFullModelRange(),text:n||``,forceMoveMarkers:!0}]),e.pushUndoStop())},[n],y),W(()=>{C.current?.getModel()?.original.setValue(e||``)},[e],y),W(()=>{let{original:e,modified:t}=C.current.getModel();w.current.editor.setModelLanguage(e,i||r||`text`),w.current.editor.setModelLanguage(t,a||r||`text`)},[r,i,a],y),W(()=>{w.current?.editor.setTheme(u)},[u],y),W(()=>{C.current?.updateOptions(f)},[f],y);let k=(0,t.useCallback)(()=>{if(!w.current)return;D.current(w.current);let t=K(w.current,e||``,i||r||`text`,o||``),c=K(w.current,n||``,a||r||`text`,s||``);C.current?.setModel({original:t,modified:c})},[r,n,a,e,i,o,s]),A=(0,t.useCallback)(()=>{!O.current&&T.current&&(C.current=w.current.editor.createDiffEditor(T.current,{automaticLayout:!0,...f}),k(),w.current?.editor.setTheme(u),b(!0),O.current=!0)},[f,u,k]);return(0,t.useEffect)(()=>{y&&E.current(C.current,w.current)},[y]),(0,t.useEffect)(()=>{!x&&!y&&A()},[x,y,A]),t.default.createElement(H,{width:m,height:p,isEditorReady:y,loading:d,_ref:T,className:h,wrapperProps:g})}),Y=function(){let[e,n]=(0,t.useState)(I.__getMonacoInstance());return U(()=>{let t;return e||(t=I.init(),t.then(e=>{n(e)})),()=>t?.cancel()}),e},X=function(e){let n=(0,t.useRef)();return(0,t.useEffect)(()=>{n.current=e},[e]),n.current},Z=new Map,Q=(0,t.memo)(function({defaultValue:e,defaultLanguage:n,defaultPath:r,value:i,language:a,path:o,theme:s=`light`,line:c,loading:l=`Loading...`,options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:p=!1,width:m=`100%`,height:h=`100%`,className:g,wrapperProps:_={},beforeMount:v=G,onMount:y=G,onChange:b,onValidate:x=G}){let[S,C]=(0,t.useState)(!1),[w,T]=(0,t.useState)(!0),E=(0,t.useRef)(null),D=(0,t.useRef)(null),O=(0,t.useRef)(null),k=(0,t.useRef)(y),A=(0,t.useRef)(v),j=(0,t.useRef)(),M=(0,t.useRef)(i),N=X(o),P=(0,t.useRef)(!1),F=(0,t.useRef)(!1);U(()=>{let e=I.init();return e.then(e=>(E.current=e)&&T(!1)).catch(e=>e?.type!==`cancelation`&&console.error(`Monaco initialization: error:`,e)),()=>D.current?(j.current?.dispose(),p?f&&Z.set(o,D.current.saveViewState()):D.current.getModel()?.dispose(),void D.current.dispose()):e.cancel()}),W(()=>{let t=K(E.current,e||i||``,n||a||``,o||r||``);t!==D.current?.getModel()&&(f&&Z.set(N,D.current?.saveViewState()),D.current?.setModel(t),f&&D.current?.restoreViewState(Z.get(o)))},[o],S),W(()=>{D.current?.updateOptions(u)},[u],S),W(()=>{!D.current||i===void 0||(D.current.getOption(E.current.editor.EditorOption.readOnly)?D.current.setValue(i):i!==D.current.getValue()&&(F.current=!0,D.current.executeEdits(``,[{range:D.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),D.current.pushUndoStop(),F.current=!1))},[i],S),W(()=>{let e=D.current?.getModel();e&&a&&E.current?.editor.setModelLanguage(e,a)},[a],S),W(()=>{c!==void 0&&D.current?.revealLine(c)},[c],S),W(()=>{E.current?.editor.setTheme(s)},[s],S);let L=(0,t.useCallback)(()=>{if(O.current&&E.current&&!P.current){A.current(E.current);let t=o||r,l=K(E.current,i||e||``,n||a||``,t||``);D.current=E.current?.editor.create(O.current,{model:l,automaticLayout:!0,...u},d),f&&D.current.restoreViewState(Z.get(t)),E.current.editor.setTheme(s),c!==void 0&&D.current.revealLine(c),C(!0),P.current=!0}},[e,n,r,i,a,o,u,d,f,s,c]);return(0,t.useEffect)(()=>{S&&k.current(D.current,E.current)},[S]),(0,t.useEffect)(()=>{!w&&!S&&L()},[w,S,L]),M.current=i,(0,t.useEffect)(()=>{S&&b&&(j.current?.dispose(),j.current=D.current?.onDidChangeModelContent(e=>{F.current||b(D.current.getValue(),e)}))},[S,b]),(0,t.useEffect)(()=>{if(S){let e=E.current.editor.onDidChangeMarkers(e=>{let t=D.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=E.current.editor.getModelMarkers({resource:t});x?.(e)}});return()=>{e?.dispose()}}return()=>{}},[S,x]),t.default.createElement(H,{width:m,height:h,isEditorReady:S,loading:l,_ref:O,className:g,wrapperProps:_})}),$=Q;exports.DiffEditor=J,exports.Editor=Q,exports.default=$,exports.loader=I,exports.useMonaco=Y;
|
package/browser/cjs/index.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`._script-editor_1kuph_5{& .monaco-editor{position:absolute;& .margin-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;width:16px;height:16px;display:block}& .formula{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 12.106007,8.1692949 c 0.124174,-0.1578352 0.181773,-0.3565642 0.283755,-0.5271169 0.10273,-0.1715492 0.04413,-0.2027176 -0.129161,-0.2014713 -0.685452,0.00576 -1.371152,-0.00277 -2.056604,0.00501 C 10.021228,7.4479573 9.9586414,7.407817 9.9935503,7.2080883 10.145401,6.3413623 10.291269,5.4736396 10.51219,4.6213758 10.642847,4.1167002 10.782479,3.6117747 11.061498,3.1622046 11.339518,2.7138809 11.726751,2.5974365 12.2035,2.829328 c 0.398455,0.1934923 0.722604,0.4827333 0.990152,0.8340617 0.116944,0.1535968 0.27079,0.2740306 0.449073,0.1715499 0.343348,-0.1974819 0.644807,-0.4383502 0.819599,-0.826332 0.100985,-0.2244112 0.157836,-0.476001 0.04039,-0.7058977 C 14.339646,1.9840253 14.038187,1.7618584 13.707056,1.6394296 13.156999,1.4362128 12.562559,1.4840872 12.017239,1.6758341 11.38789,1.8970037 10.783727,2.2625445 10.259602,2.6724688 10.066109,2.8238217 9.8783519,2.9839017 9.7013165,3.1547035 9.0502751,3.7823067 8.5657962,4.529097 8.2246919,5.3651534 7.9823276,5.9595939 7.7888351,6.5660026 7.6913412,7.2015842 7.673637,7.318528 7.6357391,7.423253 7.5065759,7.4432009 7.3472438,7.4678879 7.1592376,7.4436995 6.9974121,7.4441728 6.6351128,7.4451447 6.2598478,7.3676233 5.9915515,7.6815496 5.8721151,7.8211835 5.7461952,7.9840062 5.6439635,8.1371045 c -0.1009847,0.1518511 -0.093255,0.3002122 0.085027,0.367535 0.1957362,0.073561 0.4528118,0.026182 0.6530361,0.0197 0.2645558,-0.00847 0.5291116,0.00501 0.7936674,-7.476e-4 0.1820229,-0.00374 0.2413669,0.030421 0.2064588,0.2358807 C 7.3487406,8.9587006 7.3095941,9.1492003 7.2804197,9.3464333 7.1804317,10.024404 7.0667304,10.700629 6.9525298,11.376606 6.7936963,12.314146 6.6371075,13.252434 6.4655575,14.188478 6.3017374,15.082631 6.1855427,15.985013 5.983074,16.873433 5.8249883,17.568607 5.7240037,18.277248 5.5556954,18.969682 5.4145655,19.550158 5.293882,20.143601 4.9722259,20.665731 4.7380909,21.045734 4.3959882,21.206312 3.9663652,21.104829 3.5778849,21.012322 3.2115961,20.866205 2.8951763,20.608631 2.6862246,20.438328 2.4473513,20.31141 2.1920214,20.458026 1.9519014,20.595915 1.7791048,20.851743 1.646453,21.088123 1.2205704,21.847879 1.915497,22.569984 2.6655289,22.684434 3.1692071,22.760986 3.666153,22.580208 4.1087416,22.356046 4.6996913,22.056582 5.2103511,21.635437 5.6387269,21.13874 5.9898058,20.731558 6.3575906,20.343327 6.6500737,19.890016 6.8450616,19.58756 7.0238427,19.274881 7.1866655,18.954471 7.7639005,17.817206 8.1227091,16.589926 8.4189318,15.354418 8.5613081,14.760227 8.716401,14.169777 8.8478064,13.572843 9.0268365,12.760724 9.1741996,11.934891 9.3083481,11.114294 9.3749255,10.707112 9.4310263,10.300679 9.5160532,9.8967389 9.5861222,9.5636133 9.6442168,9.2185186 9.6890985,8.8814035 9.7414633,8.4891827 9.990308,8.5136187 10.329668,8.4762164 c 0.286249,-0.03167 0.574492,-0.046376 0.861739,-0.067571 0.230395,-0.016703 0.494951,0.00396 0.711881,-0.088019 0.07754,-0.032911 0.147613,-0.080788 0.202719,-0.1513533 z\\"/><path d=\\"M 22.473802,7.8481382 C 22.426924,7.6912996 22.341898,7.5501696 22.231437,7.4294861 22.130452,7.3192756 21.987827,7.1749046 21.851933,7.1098255 21.411589,6.8988785 20.817398,7.0838898 20.436149,7.3422154 20.23343,7.479854 20.052405,7.6519026 19.871131,7.8167201 19.691352,7.9802913 19.517061,8.1488492 19.35723,8.3321177 19.025101,8.7128687 18.724639,9.1210479 18.436396,9.5354601 18.296263,9.7374301 17.901549,10.472252 17.781115,10.399942 17.654198,10.323892 17.495365,9.5905657 17.435023,9.3843566 17.351243,9.0978583 17.29539,8.8016361 17.161741,8.5323425 16.97922,8.1643081 16.865268,7.7623629 16.608941,7.4307332 16.325934,7.0639457 16.001036,6.9584722 15.558946,7.092371 c -0.43436,0.1314054 -0.78469,0.4049374 -1.128539,0.6819608 -0.503927,0.4056851 -0.879442,0.926319 -1.256951,1.4439609 -0.28226,0.387483 -0.284753,0.3857373 0.04488,0.7380631 0.206458,0.2211702 0.202718,0.2184272 0.389229,-0.00847 0.2663,-0.3251469 0.524872,-0.6595196 0.882433,-0.8934057 0.261315,-0.1713009 0.417904,-0.1368908 0.57948,0.1326518 0.07929,0.1326517 0.146866,0.2752777 0.200225,0.4208957 0.335619,0.9141014 0.590201,1.8541344 0.89191,2.7784594 0.03815,0.117691 -0.01122,0.193991 -0.06707,0.278519 -0.356565,0.538837 -0.719363,1.074182 -1.123054,1.578607 -0.320409,0.401198 -0.643312,0.803891 -1.073932,1.097621 -0.187757,0.128912 -0.40768,0.217679 -0.635831,0.156839 -0.233887,-0.06283 -0.37377,-0.27478 -0.587459,-0.373521 -0.006,-0.003 -0.01272,-0.0052 -0.01895,-0.0079 -0.09974,-0.04064 -0.249845,-0.0389 -0.353074,-0.01571 -0.454059,0.102482 -0.697669,0.614139 -0.790177,1.023813 -0.08379,0.371776 -0.0013,0.778209 0.261315,1.062463 0.228899,0.24785 0.572248,0.351327 0.901634,0.356315 0.189003,0.0028 0.39995,-0.04663 0.57549,-0.11445 0.670241,-0.262062 1.181649,-0.887172 1.605038,-1.441717 0.285501,-0.374517 0.550555,-0.763994 0.829573,-1.143499 0.230645,-0.313677 0.68595,-1.247726 0.81586,-1.250718 0.07854,-0.0017 0.09924,0.185762 0.114199,0.241117 0.03341,0.123675 0.06658,0.247351 0.102232,0.370279 0.167561,0.578481 0.343848,1.156464 0.525122,1.730458 0.120934,0.384242 0.315921,0.782697 0.560779,1.103356 0.07431,0.09749 0.167311,0.190749 0.26306,0.266799 0.371276,0.296972 0.838799,0.27453 1.266177,0.123177 0.191498,-0.06757 0.370029,-0.163071 0.539335,-0.275527 0.781948,-0.519886 1.340732,-1.244235 1.868598,-2.002495 0.124423,-0.178781 0.107467,-0.278769 -0.03441,-0.428127 -0.367286,-0.386237 -0.357062,-0.389727 -0.705149,0.01995 -0.261066,0.306446 -0.527117,0.612643 -0.879442,0.818851 -0.245855,0.144621 -0.413416,0.103229 -0.592696,-0.118439 -0.14861,-0.183518 -0.246353,-0.396709 -0.33138,-0.614886 -0.349831,-0.901136 -0.588954,-1.838675 -0.885177,-2.757515 -0.21743,-0.674231 -0.223414,-0.680464 0.20945,-1.248723 0.447575,-0.587708 0.875703,-1.1968602 1.462163,-1.6613914 0.431119,-0.3416031 0.73183,-0.3226534 1.129037,0.059094 0.0788,0.075801 0.207456,0.1388856 0.316919,0.1476127 0.369781,0.029674 0.691187,-0.3024566 0.880939,-0.5792304 0.188006,-0.2727835 0.259319,-0.6183768 0.163072,-0.9392845 z\\"/></svg>")}& .macro{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 7.3808594,2.8925781 c 0.6501558,0 1.3048608,0.1705676 1.8886719,0.5078125 l 9.2343747,5.3242188 c 1.167878,0.6758404 1.882813,1.9216266 1.882813,3.2675786 0,1.306438 -0.674828,2.517089 -1.783203,3.205078 L 9.2617188,20.595703 C 8.1035923,21.277644 6.6635531,21.275631 5.4960937,20.589844 4.3295773,19.917617 3.6132812,18.67473 3.6132813,17.330078 V 6.6660156 c 0,-1.3461361 0.7160606,-2.5932648 1.8828124,-3.265625 C 6.0817308,3.0628871 6.7318751,2.8925781 7.3808594,2.8925781 Z M 7.375,5.1835937 C 7.1238145,5.188954 6.883074,5.2521559 6.6601562,5.3691406 l -0.00781,0.00586 -0.00781,0.00391 C 6.1849913,5.6446615 5.9023438,6.1366335 5.9023437,6.6660156 V 17.330078 c 0,0.524949 0.2791508,1.016586 0.7363282,1.275391 0.4554716,0.266714 1.013907,0.272881 1.4785156,0.0098 l 9.2441405,-5.34375 c 0.450764,-0.263898 0.736328,-0.74603 0.736328,-1.27539 0,-0.52882 -0.290494,-1.018444 -0.742187,-1.277344 L 8.1171875,5.3789062 C 7.8951499,5.2512094 7.6461047,5.183439 7.375,5.1835937 Z\\"/></svg>")}& .autorun{cursor:pointer;background-image:url("data:image/svg+xml;utf8,<svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" fill=\\"grey\\"><path d=\\"m 11.999964,1.7500508 c -0.462401,0 -0.923676,0.3281109 -0.924272,0.9260918 V 13.159721 c -0.0012,1.23176 1.847315,1.231936 1.848545,0 V 2.6761426 c 5.97e-4,-0.598201 -0.461872,-0.9260918 -0.924273,-0.9260918 z m 5.998674,2.6454569 c -0.728133,0.068914 -1.207022,1.0512547 -0.5149,1.63931 1.880223,1.6037705 2.962848,3.9512403 2.962038,6.4226023 -4.23e-4,4.655627 -3.790565,8.443993 -8.445812,8.443993 -4.6552096,0 -8.443993,-3.789762 -8.443993,-8.445813 C 3.5560359,10.008191 4.6172167,7.6804932 6.4634264,6.0784841 7.4240529,5.2735715 6.1821863,3.8462722 5.2535029,4.6829783 -1.9571321,10.940557 2.4945266,22.78839 12.039992,22.749957 21.585452,22.711525 25.944958,10.82919 18.684564,4.6302147 18.515847,4.4852865 18.331563,4.4098479 18.146012,4.3955077 c -0.05049,-0.0039 -0.09883,-0.00459 -0.147374,0 z\\"/></svg>")}}}/*$vite$:1*/`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();
|
|
2
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./BAh9DnP6CTFXt1HI.cjs");let t=require("react");t=e.n(t,1);let n=require("react-dom/client"),r=require("@sheetxl/utils"),i=require("@sheetxl/scripting"),a=require("@sheetxl/sdk"),o=require("@sheetxl/utils-react"),s=require("react/jsx-runtime"),c=require("@sheetxl/react");function l(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=l(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function u(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=l(e))&&(r&&(r+=` `),r+=t);return r}function d(e,t){if(typeof e==`function`)return e(t);e&&(e.current=t)}var f=parseInt(t.version.split(`.`)[0],10)>=19?function(e){return t=>{let n=[];for(let r of e){let e=d(r,t),i=typeof e==`function`;n.push(i?e:()=>d(r,null))}return()=>{for(let e of n)e()}}}:function(e){return t=>{for(let n of e)d(n,t)}},p={defaultToken:`invalid`,tokenPostfix:`.ts`,keywords:`abstract.any.as.asserts.bigint.boolean.break.case.catch.class.continue.const.constructor.debugger.declare.default.delete.do.else.enum.export.extends.false.finally.for.from.function.get.if.implements.import.in.infer.instanceof.interface.is.keyof.let.module.namespace.never.new.null.number.object.out.package.private.protected.public.override.readonly.require.global.return.satisfies.set.static.string.super.switch.symbol.this.throw.true.try.type.typeof.undefined.unique.unknown.var.void.while.with.yield.async.await.of`.split(`.`),operators:`<=.>=.==.!=.===.!==.=>.+.-.**.*./.%.++.--.<<.</.>>.>>>.&.|.^.!.~.&&.||.??.?.:.=.+=.-=.*=.**=./=.%=.<<=.>>=.>>>=.&=.|=.^=.@`.split(`.`),symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/[{}]/,`delimiter.bracket`],{include:`common`}],common:[[/#?[a-z_$][\w$]*/,{cases:{"@keywords":`keyword`,"@default":`identifier`}}],[/[A-Z][\w\$]*/,`type.identifier`],{include:`@whitespace`},[/\/(?=([^\\\/]|\\.)+\/([dgimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,{token:`regexp`,bracket:`@open`,next:`@regexp`}],[/[()\[\]]/,`@brackets`],[/[<>](?!@symbols)/,`@brackets`],[/!(?=([^=]|$))/,`delimiter`],[/@symbols/,{cases:{"@operators":`delimiter`,"@default":``}}],[/(@digits)[eE]([\-+]?(@digits))?/,`number.float`],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/,`number.float`],[/0[xX](@hexdigits)n?/,`number.hex`],[/0[oO]?(@octaldigits)n?/,`number.octal`],[/0[bB](@binarydigits)n?/,`number.binary`],[/(@digits)n?/,`number`],[/[;,.]/,`delimiter`],[/"([^"\\]|\\.)*$/,`string.invalid`],[/'([^'\\]|\\.)*$/,`string.invalid`],[/"/,`string`,`@string_double`],[/'/,`string`,`@string_single`],[/`/,`string`,`@string_backtick`]],whitespace:[[/[ \t\r\n]+/,``],[/\/\*\*(?!\/)/,`comment.doc`,`@jsdoc`],[/\/\*/,`comment`,`@comment`],[/\/\/.*$/,`comment`]],comment:[[/[^\/*]+/,`comment`],[/\*\//,`comment`,`@pop`],[/[\/*]/,`comment`]],jsdoc:[[/@(?:param|arg|argument|property|prop|template|typedef)\b/,{token:`comment.doc.tag`,next:`@jsdoc_param`}],[/@\w+/,`comment.doc.tag`],[/\{/,{token:`comment.doc.type`,next:`@jsdoc_type`}],[/[^\/*@{]+/,`comment.doc`],[/\*\//,`comment.doc`,`@pop`],[/[\/*]/,`comment.doc`]],jsdoc_type:[[/[^{}]+/,`comment.doc.type`],[/\{/,`comment.doc.type`,`@push`],[/\}/,`comment.doc.type`,`@pop`]],jsdoc_param:[[/\s+/,`comment.doc`],[/\{/,{token:`comment.doc.type`,next:`@jsdoc_type`}],[/\[[^\]]*\]/,{token:`comment.doc.name`,next:`@pop`}],[/[\w$][\w$.]*/,{token:`comment.doc.name`,next:`@pop`}],[/(?=\*\/)/,{token:`comment.doc`,next:`@pop`}],[/./,{token:`comment.doc`,next:`@pop`}]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,[`regexp.escape.control`,`regexp.escape.control`,`regexp.escape.control`]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,[`regexp.escape.control`,{token:`regexp.escape.control`,next:`@regexrange`}]],[/(\()(\?:|\?=|\?!)/,[`regexp.escape.control`,`regexp.escape.control`]],[/[()]/,`regexp.escape.control`],[/@regexpctl/,`regexp.escape.control`],[/[^\\\/]/,`regexp`],[/@regexpesc/,`regexp.escape`],[/\\\./,`regexp.invalid`],[/(\/)([dgimsuy]*)/,[{token:`regexp`,bracket:`@close`,next:`@pop`},`keyword.other`]]],regexrange:[[/-/,`regexp.escape.control`],[/\^/,`regexp.invalid`],[/@regexpesc/,`regexp.escape`],[/[^\]]/,`regexp`],[/\]/,{token:`regexp.escape.control`,next:`@pop`,bracket:`@close`}]],string_double:[[/[^\\"]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/"/,`string`,`@pop`]],string_single:[[/[^\\']+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/'/,`string`,`@pop`]],string_backtick:[[/\$\{/,{token:`delimiter.bracket`,next:`@bracketCounting`}],[/[^\\`$]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/`/,`string`,`@pop`]],bracketCounting:[[/\{/,`delimiter.bracket`,`@bracketCounting`],[/\}/,`delimiter.bracket`,`@pop`],{include:`common`}]}},ee={lightbulb:{enabled:!1},tabSize:2,acceptSuggestionOnCommitCharacter:!0,acceptSuggestionOnEnter:`on`,accessibilitySupport:`auto`,automaticLayout:!0,autoIndent:!1,codeLens:!0,colorDecorators:!0,contextmenu:!0,cursorBlinking:`blink`,cursorSmoothCaretAnimation:!1,cursorStyle:`line`,disableLayerHinting:!1,disableMonospaceOptimizations:!1,dragAndDrop:!0,glyphMargin:!0,fixedOverflowWidgets:!1,folding:!0,foldingStrategy:`auto`,fontLigatures:!1,formatOnPaste:!0,formatOnType:!1,hideCursorInOverviewRuler:!1,highlightActiveIndentGuide:!0,links:!0,lineDecorationsWidth:8,lineNumbersMinChars:3,mouseWheelZoom:!1,multiCursorMergeOverlapping:!0,multiCursorModifier:`alt`,overviewRulerBorder:!0,overviewRulerLanes:2,quickSuggestions:!0,quickSuggestionsDelay:100,readOnly:!1,renderControlCharacters:!1,renderFinalNewline:!0,renderIndentGuides:!0,renderLineHighlight:`all`,renderWhitespace:`none`,revealHorizontalRightPadding:30,roundedSelection:!0,rulers:[],scrollBeyondLastColumn:5,scrollBeyondLastLine:!0,selectOnLineNumbers:!0,selectionClipboard:!0,selectionHighlight:!0,showLightbulbIconMode:!1,showFoldingControls:`mouseover`,smoothScrolling:!0,suggestOnTriggerCharacters:!0,wordBasedSuggestions:!0,wordSeparators:`~!@#$%^&*()-=+[{]}|;:'",.<>/?`,wordWrap:`off`,wordWrapBreakAfterCharacters:` })]?|&,;`,wordWrapBreakBeforeCharacters:`{([+`,wordWrapBreakObtrusiveCharacters:`.`,wordWrapColumn:80,wordWrapMinified:!0,wrappingIndent:`none`},te=`_script-editor_1kuph_5`,ne=e=>{let t=e?.getModules();return t&&t.getByName(a.IScript.DEFAULT_MODULE),a.IScript.DEFAULT_MODULE},m=e=>e?.getModules()?.getByName(ne(e))??null,h,g=(0,r.defineLazyModule)(`scripting-react:monaco`,async()=>(function(){if(typeof window>`u`)return;let e=window;if(e.__sxlDefineShim)return;e.__sxlDefineShim=!0;let t=[],n=null,r=(...e)=>{typeof n==`function`?n(...e):t.push(e)};Object.defineProperty(e,"define",{configurable:!1,enumerable:!0,get:()=>typeof n==`function`?n:r,set(e){if(typeof e==`function`)for(n=e;t.length;)try{e(...t.shift())}catch{}}})}(),Promise.resolve().then(()=>require("./CsWMPekp2nRo3bHt.cjs"))),{prefetch:!1}),_=({error:e})=>{let t=(0,o.useLazyRetry)(),n=(0,o.useTranslator)();return(0,s.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,gap:`8px`,flex:`1 1 100%`},children:[(0,s.jsx)(`span`,{children:e instanceof Error?e.message:String(e)}),t?(0,s.jsx)(`button`,{type:`button`,onClick:t,children:n(`scriptEditor.retry`)}):null]})},re=(0,o.lazyComponent)(g.load,{renderError:e=>(0,s.jsx)(_,{error:e})}),v=[`define`,`require`],ie=!1,y=`@0.8.0-beta.2`;y!==`@local`&&y!==`@0.0.0`||(y=``);var b=`https://cdn.jsdelivr.net/npm/@sheetxl/sdk${y}/types/scripting.d.ts`,x=e=>{try{e.languages.setMonarchTokensProvider(`typescript`,p)}catch{}},S=!1;function C(e,t){let n=null,r=e.length;for(let i=0;!n&&i<r;i++){let r=e[i];r.getName()===t.text&&(n=r)}return n?n.getContext():`formula`}function w(e,t,n,r,i=[]){if(r.kind===`function`&&r.kindModifiers===`export`){let t=r.spans[0].start,a=e.getPositionAt(t);i.push({name:r.text,type:C(n,r),lineNumber:a.lineNumber})}if(r.childItems)for(let a of r.childItems)w(e,t,n,a,i);return i}function T(e,t,n=`function`,r){let i=e.spans,a=i.length;for(let o=0;o<a;o++){let a=i[o];if(a.start<=t&&t<a.start+a.length){if(e.kind===n&&(!r||e.kindModifiers===r))return e;for(let i of e.childItems||[]){let e=T(i,t,n,r);if(e)return e}}return null}}function ae(e){return e.kind===`comment`}var E=null,D=null,O=null,k=null,A=!1,j=!1,M=!1,N={current:null},P=(e,t)=>{D={editor:e,monaco:t},O&&(k=O(e,t))},oe=e=>{M||(M=!0,e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!1,diagnosticCodesToIgnore:[2307]}),e.languages.typescript.typescriptDefaults.setEagerModelSync(!0),e.languages.json.jsonDefaults.setDiagnosticsOptions({validate:!0}),x(e),(e=>{S||(S=!0,e.languages.registerCompletionItemProvider(`typescript`,{triggerCharacters:[`@`],provideCompletionItems:(t,n)=>{let r=t.getValueInRange({startLineNumber:n.lineNumber,startColumn:1,endLineNumber:n.lineNumber,endColumn:n.column}),a=/(?:^|\s)@(\w*)$/.exec(r);if(!a||!((e,t)=>{let n=e.getValueInRange({startLineNumber:1,startColumn:1,endLineNumber:t.lineNumber,endColumn:t.column});return n.lastIndexOf(`/*`)>n.lastIndexOf(`*/`)})(t,n))return{suggestions:[]};let o=a[1],s=new e.Range(n.lineNumber,n.column-o.length,n.lineNumber,n.column);return{suggestions:i.DocTags.map(t=>({label:`@${t.name}`,kind:e.languages.CompletionItemKind.Keyword,detail:t.group===`sheetxl`?`SheetXL`:`JSDoc`,documentation:{value:t.description},insertText:t.snippet??t.name,insertTextRules:t.snippet?e.languages.CompletionItemInsertTextRule.InsertAsSnippet:void 0,range:s}))}}}))})(e),e.editor.defineTheme(`extended`,{base:`vs`,inherit:!0,rules:[{token:`comment.doc`,foreground:`008000`},{token:`comment.doc.tag`,foreground:`0000FF`},{token:`comment.doc.type`,foreground:`267F99`},{token:`comment.doc.name`,foreground:`001080`}],colors:{}}),e.editor.defineTheme(`extended-dark`,{base:`vs-dark`,inherit:!0,rules:[{token:`comment.doc`,foreground:`6A9955`},{token:`comment.doc.tag`,foreground:`569CD6`},{token:`comment.doc.type`,foreground:`4EC9B0`},{token:`comment.doc.name`,foreground:`9CDCFE`}],colors:{}}),(async()=>{let t=!1;try{let n=await(async()=>await(await fetch(b)).text())(),r=e.Uri.parse(`inmemory://model/"sheetxl-models".d.ts`),i=e.editor.getModel(r);i?t=!0:i=e.editor.createModel(n,`typescript`,r),e.editor.setModelMarkers(i,`default`,[])}catch(e){console.warn(`cant load types`,e)}try{if(e.languages.registerLinkProvider(`*`,{provideLinks:(t,n)=>{let r=[],i={links:r},a=t.getLinesContent(),o=a.length;for(let n=1;n<=o;n++){let i=a[n-1],o=e.editor.tokenize(i,`typescript`),s=o[0].length;for(let a=0;a<s;a++){let s=o[0]?.[a];if(s&&s.type.startsWith(`string`)){let c=s.offset,l=o[0]?.[a+1]?.offset??i.length,u=new e.Range(n,c+1,n,l+1),d=t.getValueInRange(u),f=d[0];f!=="`"&&f!==`'`&&f!==`"`||(c++,d=d.substring(1));let p=d[d.length-1];p!=="`"&&p!==`'`&&p!==`"`||(c++,d=d.substring(0,d.length-1));try{N.current?.getRanges(d)&&r.push({range:{endColumn:l,endLineNumber:n,startColumn:c,startLineNumber:n},tooltip:`Goto range '${d}'`,url:`/range/${d}`})}catch{}}}}return i}}),e.editor.registerLinkOpener({open(e){if(e?.path?.startsWith(`/range/`)){try{N.current?.getRanges(e.path.substring(7))?.select()}catch(e){console.warn(`invalid range`,e)}return!0}return!1}}),!t){let t=e.languages.typescript.typescriptDefaults.getCompilerOptions();e.languages.typescript.typescriptDefaults.setCompilerOptions({...t,target:e.languages.typescript.ScriptTarget.ES2020,lib:[`webworker`,`es2020`,`esnext.asynciterable`],strict:!0,downlevelIteration:!0,moduleResolution:e.languages.typescript.ModuleResolutionKind.NodeJs,allowSyntheticDefaultImports:!0,baseUrl:`inmemory://model/`,allowNonTsExtensions:!0})}}finally{(()=>{let t=e.languages.typescript.typescriptDefaults.getDiagnosticsOptions();e.languages.typescript.typescriptDefaults.setDiagnosticsOptions({...t,noSemanticValidation:!1})})()}})())},se=e=>{let t=!1,n=e?e.length:0;for(let r=0;!t&&r<n;r++)e[r].severity===8&&(t=!0)},ce=()=>{let[e,n]=(0,t.useState)(()=>E.props);return(0,t.useEffect)(()=>(E&&(E.setProps=n),()=>{E&&(E.setProps=null)}),[]),(0,s.jsx)(`div`,{style:{display:`flex`,flex:`1 1 100%`,width:`100%`,height:`100%`},children:(0,s.jsx)(t.Suspense,{children:(0,s.jsx)(re,{theme:e.theme,options:e.options,language:`typescript`,value:e.value,onValidate:e.onValidate,beforeMount:e.beforeMount,onMount:P})})})},F=(0,t.memo)((0,t.forwardRef)((i,a)=>{let{className:l,style:d,readOnly:p=!1,darkMode:g,loadingPanel:_,autoFocus:re=!0,frame:y,scripts:b,onStatusChange:S,...C}=i,M=(0,o.useTranslator)(),P=(0,t.useRef)(null),[F,I]=(0,t.useState)(!1),L=(0,c.useWorkbook)(),[R]=(0,o.useCommands)([`insertFunction`]),[z,le]=(0,t.useState)({message:`Loading`,cursor:``,dirty:!1}),[B,V]=(0,t.useState)({loading:!1,compiling:!1,errors:[],warnings:[]}),H=(0,o.useCallbackRef)(e=>{le(t=>{let n={...t,...e};return r.CommonUtils.deepEqual(n,t)?t:(I(n.dirty??!1),n)})},[S]);(0,t.useEffect)(()=>{S?.(z)},[S,z]);let U=(0,o.useNotifier)(),ue=(0,o.useCallbackRef)(async e=>{let t=null,n=null;try{e&&(n=await U.showBusy(M(`scriptEditor.saving`)),t=await b.createModule({source:e})),b.addModule(ne(b),t,{replace:!0}),n?.()}catch(e){n?.(),console.warn(`Unable to compile`,e),U.showError(e)}return t},[b]),W=(0,o.useCallbackRef)(async()=>{if(!P.current||p)return;let e=P.current.editor,t;if(z.dirty){let n=e.getValue();await ue(n),t=m(b);let r=t?.getSource(),i=e.getValue(),a=(r?.length??0)!==n.length||r!==i;H({dirty:a})}else t=m(b);return t},[z,b]);(0,t.useEffect)(()=>{let e=y?.addListener({onBeforeHide:async()=>(await W(),!0)});return()=>{e?.()}},[y]),(0,t.useEffect)(()=>{if(b)return b.addListeners({onBeforeSearch:()=>W()})},[b]),(0,c.useModelListener)(L,{onBeforeSave:async()=>{await W()},onLoad:()=>{let e=P.current?.editor;e&&e.setValue(m(b)?.getSource()??``)}});let G=(0,o.useCallbackRef)(async e=>{if(!b)return;let t=typeof e==`string`?{functionName:e}:e??{},n=null;if(t?.declaration||t?.functionName){let e=t.declaration?t.declaration.getName():t.functionName;(await b.searchFunctions({name:e})).length>0&&(n=e)}if(n)try{await b.executeMacro(n)}catch(e){U.showError(e)}},[b,U]),[K,de]=(0,t.useState)(!1),fe=(0,o.useCallbackRef)(async()=>{if(!P.current)return null;let e=P.current,t=e.editor;if(!t)return null;let n=await(async(e,t,n=`export`)=>{let r=e.getModel();if(!r)return null;let i=await(await(await t.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()),a=null,o=e.getSelection();if(!o)return null;let s=o.startLineNumber===o.endLineNumber&&o.startColumn===o.endColumn?r.getLineCount():Math.min(o.endLineNumber,r.getLineCount());for(let e=o.startLineNumber;!a&&e<=s;e++){let t=T(i,r.getOffsetAt({lineNumber:e,column:1}),`function`,n);t&&(a=t.text)}return a})(t,e.monaco);return H({message:(n??``).toUpperCase()}),n?{source:t.getValue(),name:n}:null},[]);(0,o.useCallbackRef)(r.TimerUtils.debounce(W,200),[]);let pe=(0,o.useCallbackRef)(async(e,t,n)=>{V(e=>({...e,compiling:!0}));let i=null;try{if(i=await b.createModule({source:n?.getValue(),declarationsOnly:!0}),!i)return}catch{}let a=i?i.getDiagnostics():r.CommonUtils.EmptyArray;(function(e,t,n){let r=(n??[]).map(n=>{let r=e.getPositionAt(n.start),i=e.getPositionAt(n.start+Math.max(n.length,1));return{message:`${n.message} (${n.code})`,code:n.code,severity:n.severity===`warning`?t.MarkerSeverity.Warning:t.MarkerSeverity.Error,startLineNumber:r.lineNumber,startColumn:r.column,endLineNumber:i.lineNumber,endColumn:i.column}});t.editor.setModelMarkers(e,`sheetxl`,r)})(e,t,a),async function(e,t,n,r){let i=w(e,t,r,await(await(await t.languages.typescript.getTypeScriptWorker())(e.uri)).getNavigationTree(e.uri.toString())).map(e=>{let n=null,r=null;return e.type===`formula`?(n=`formula.margin-icon`,r=M(`scriptEditor.glyph.formula`)):e.type===`macro`?(n=`macro.margin-icon`,r=M(`scriptEditor.glyph.macro`)):e.type===`autoRun`&&(n=`autorun.margin-icon`,r=M(`scriptEditor.glyph.autoRun`)),{range:new t.Range(e.lineNumber,1,e.lineNumber,1),options:{isWholeLine:!1,glyphMarginClassName:n,glyphMarginHoverMessage:{value:r},stickiness:t.editor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}});Y.current&&Y.current.clear(),Y.current=n.createDecorationsCollection(i)}(e,t,n,i?i.getFunctions().getItems():r.CommonUtils.EmptyArray),V(e=>({...e,compiling:!1,errors:a.filter(e=>e.severity===`error`).map(e=>`${e.code}: ${e.message}`),warnings:a.filter(e=>e.severity===`warning`).map(e=>`${e.code}: ${e.message}`)}))},[b]),q=(0,o.useCallbackRef)(r.TimerUtils.debounce(pe,580),[]),J=(0,o.useCallbackRef)(async e=>{if(!P.current)return;let t=P.current.editor.getPosition(),n={cursor:t?t.toString():``};e!==void 0&&(n.message=e),H(n)},[]);(0,t.useEffect)(()=>{},[B]);let me=(0,t.useRef)(null),he=(0,o.useCallbackRef)(async()=>{await W(),y?.close()},[y]),ge=(0,o.useCallbackRef)(e=>{let t=P.current?.editor;return!!t&&(t.focus(e),!0)},[z]),_e=(0,o.useCallbackRef)(async()=>{let e=P.current?.editor,t=e?.getModel(),n=e?.getSelection();if(!t||!n)return;let r=n.isEmpty()?t.getLineContent(n.positionLineNumber)+`
|
|
3
|
-
`:t.getValueInRange(n);try{await navigator.clipboard?.writeText(r)}catch{}},[]),ve=(0,o.useCallbackRef)(async()=>{let e=P.current,t=e?.editor,n=t?.getModel(),r=t?.getSelection();if(!n||!r)return;let i=r.isEmpty()?new e.monaco.Range(r.positionLineNumber,1,r.positionLineNumber+1,1):r,a=n.getValueInRange(i);try{await navigator.clipboard?.writeText(a)}catch{return}t.pushUndoStop(),t.executeEdits(`cut`,[{range:i,text:``,forceMoveMarkers:!0}]),t.pushUndoStop(),t.focus()},[]),ye=(0,o.useCallbackRef)(async()=>{let e=P.current?.editor;if(!e)return;let t;try{t=await navigator.clipboard?.readText()}catch{return}if(!t)return;let n=e.getSelection();e.pushUndoStop(),e.executeEdits(`paste`,[{range:n,text:t,forceMoveMarkers:!0}]),e.pushUndoStop(),e.focus()},[]),Y=(0,t.useRef)(null),be=(0,o.useCallbackRef)((t,n)=>{P.current={monaco:n,editor:t},N.current=L??null;let r=t.getModel(),i=[];de(!0);let a=m(b)?.getSource()??``;return t.getValue()!==a&&t.setValue(a),A?(J(``),q(r,n,t),x(n)):(A=!0,J(`Loading Types`),Promise.resolve().then(()=>e.n(require("./Bf_pmg4C0o1aKVy-.cjs").default,1)).then(async e=>{J(``),e.AutoTypings.create(t,{shareCache:!0,dontAdaptEditorOptions:!0,monaco:n,onUpdate:(e,t)=>{if(e.type===`LookedUpPackage`&&e.success!==void 0){let e=n.languages.typescript.typescriptDefaults.getDiagnosticsOptions();n.languages.typescript.typescriptDefaults.setDiagnosticsOptions({...e,diagnosticCodesToIgnore:[]})}},onError:e=>{e===`Not implemented yet`&&(e=`Compile Errors`),console.warn(`Error compiling types`,e)}}).then(e=>{me.current=e,q(t.getModel(),n,t),(()=>{if(ie)return;let e=(e,t)=>{try{if(t===void 0)try{delete globalThis[e]}catch{try{globalThis[e]=void 0}catch{}}else globalThis[e]=t}catch{}},t=v.length;for(let n=0;n<t;n++){let t=v[n];e(t,h[t])}h=void 0,ie=!0})(),x(n)})}).catch(e=>{A=!1,J(``),console.warn(`Auto typings could not be loaded:`,e)})),j||(j=!0,function(e,t){t.languages.registerInlayHintsProvider(`typescript`,{provideInlayHints(e,n,r){let i=[];for(let n=1;n<e.getLineCount()+1;n++){let r={startLineNumber:n,startColumn:1,endLineNumber:n,endColumn:e.getLineLength(n)+1},a=e.getValueInRange(r).indexOf(`hint`);a!==-1&&i.push({kind:t.languages.InlayHintKind.Type,position:{lineNumber:r.startLineNumber,column:a+4+1},label:`[hint]`})}return{hints:i,dispose:()=>{}}}})}(0,n)),i.push(t.addAction({id:`executeScript`,label:`Execute`,keybindings:[n.KeyCode.F8],run:async e=>{let t=await fe();G(t)}})),i.push(t.addAction({id:`saveScript`,label:`Save Script`,keybindings:[n.KeyMod.CtrlCmd|n.KeyCode.KeyS],run:e=>{W()}})),i.push(t.onMouseDown(async e=>{if(e.target.type===n.editor.MouseTargetType.GUTTER_GLYPH_MARGIN){e.event.browserEvent.preventDefault();let t=e.target.position.lineNumber,i=await(await(await n.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()),a=await W();if(!a)return;let o=a.getFunctions().getItems(),s=w(r,n,o,i).find(e=>e.lineNumber===t);if(s){let t=e.event.browserEvent.button;if(t===0){if(s.type===`macro`||s.type===`autoRun`)G({functionName:s.name});else if(s.type===`formula`){let e=o?.find(e=>e.getName()===s.name);e&&R?.execute(e)}}else t===2&&(console.log(`Context menu for function:`,s.name),e.event.browserEvent.preventDefault())}}})),i.push(t.onDidChangeModelContent(()=>{H({dirty:!0}),q(r,n,t)})),i.push(n.editor.onDidChangeMarkers(e=>{e.some(e=>e.toString()===r.uri.toString())})),i.push(r.onDidChangeContent(e=>{let n=m(b)?.getSource(),r=t.getValue(),i=(n?.length??0)!==r.length||n!==r;H({dirty:i})})),i.push(t.onDidChangeCursorPosition(e=>{J()})),()=>{for(let e of i)try{e.dispose()}catch{}}},[b,L]),xe=(0,t.useMemo)(()=>K?null:_||(0,s.jsx)(`div`,{style:{position:`absolute`,width:`100%`,height:`100%`},children:M(`scriptEditor.loading`)}),[K,_]),X=(0,t.useMemo)(()=>({...ee,fixedOverflowWidgets:!1,contextmenu:!1,readOnly:p}),[p]),Se=(0,t.useRef)(null);(0,t.useEffect)(()=>{let e={theme:g?`extended-dark`:`extended`,options:X,value:m(b)?.getSource()??``,beforeMount:oe,onValidate:se},t=(e=>{if(E)return E;if(!h){h={};let e=v.length;for(let t=0;t<e;t++){let e=v[t];h[e]=globalThis[e]}}let t=document.createElement(`div`);t.style.display=`none`;let r=document.createElement(`div`);r.style.width=`100%`,r.style.height=`100%`,r.style.display=`flex`,r.style.flex=`1 1 100%`,t.appendChild(r),document.body.appendChild(t);let i=(0,n.createRoot)(r);return E={root:i,hostEl:r,stashEl:t,props:e,setProps:null},i.render((0,s.jsx)(ce,{})),E})(e);return t.props=e,t.setProps?.(e),O=(e,t)=>be(e,t),Se.current?.appendChild(t.hostEl),D&&(k=be(D.editor,D.monaco)),()=>{k?.(),k=null,O=null,P.current=null,E?.stashEl.appendChild(E.hostEl)}},[]),(0,t.useEffect)(()=>{if(!E)return;let e={...E.props,theme:g?`extended-dark`:`extended`,options:X};E.props=e,E.setProps?.(e)},[g,X]),(0,t.useEffect)(()=>{let e=P.current,t=e?.editor;if(!t)return;N.current=L??null;let n=m(b)?.getSource()??``;t.getValue()!==n&&(t.setValue(n),q(t.getModel(),e.monaco,t),H({dirty:!1}))},[b,L]);let Ce=(0,s.jsxs)(`div`,{style:{display:`flex`,flex:`1 1 100%`,width:`100%`,flexDirection:`row`,position:`relative`,boxSizing:`border-box`},children:[(0,s.jsx)(`div`,{ref:Se,style:{display:`flex`,flex:`1 1 100%`,width:`100%`,position:`relative`}}),xe]}),Z=(0,o.useImperativeElement)(a,()=>({isScriptEditorElement:()=>!0,showCommandPalette:()=>{P.current?.editor&&P.current.editor.trigger(`keyboard`,`editor.action.quickCommand`,null)},getScripts:()=>b,focus:e=>{ge(e)},close:()=>he(),insertSnippet:e=>P.current?.editor?(async(e,t,n)=>{let r=e.getModel();if(!r)return;let i=await(await(await t.languages.typescript.getTypeScriptWorker())(r.uri)).getNavigationTree(r.uri.toString()),a=e.getPosition(),o={...a};o.lineNumber=1,o.column=1;let s=!1;for(let e=a.lineNumber;e>=1;e--)if(r.getLineContent(e).trim()===``){let t=T(i,r.getOffsetAt({lineNumber:e,column:1}),`function`);if(!t||ae(t)){s=!0,o.lineNumber=e+1;break}{let n=t.spans[0].start;e=r.getPositionAt(n).lineNumber,o.lineNumber=e}}let c=n,l=!1;!s&&!c.startsWith(`
|
|
4
|
-
`)&&o.lineNumber>1&&(c=`
|
|
5
|
-
`+c,l=!0);let u=!1;r.getLineCount()>1&&(c.endsWith(`
|
|
6
|
-
|
|
7
|
-
`)||(c+=`
|
|
8
|
-
|
|
9
|
-
`,u=!0));let d=[{range:new t.Range(o.lineNumber,o.column,o.lineNumber,o.column),text:`${c}`}],f=null;r.pushEditOperations([],d,e=>(f=e[0].range,l&&f.startLineNumber++,u&&f.endLineNumber--,[new t.Selection(f.startLineNumber,f.startColumn,f.endLineNumber,f.endColumn)])),e.setSelection({startLineNumber:f.endLineNumber,startColumn:f.endColumn,endLineNumber:f.startLineNumber,endColumn:f.startColumn})})(P.current.editor,P.current.monaco,e):Promise.resolve(),saveSource:async()=>{await W()},runAction:e=>{let t=P.current?.editor;t&&(t.focus(),t.trigger(`source`,e,null))},copy:()=>_e(),cut:()=>ve(),paste:()=>ye()}),[L]),[Q,we]=(0,t.useState)(null),Te=(0,o.useCallbackRef)(e=>{e!==null&&we(e)},[]),$=o.Command.useCommandScope();return(0,t.useEffect)(()=>{if(!$||!Q)return;let e=$.contribution();return function(e,t){let n=t.scriptEditor,i=t;e.updateCommand(`scriptingHelp`,{callback:()=>{window?.open(`https://www.sheetxl.com/docs/guides/concepts/scripting`)}}),e.updateCommand(`showScriptingCommands`,{callback:()=>{n.showCommandPalette()}});let a=i?.readOnly?[(0,r.messageKey)(`reason.scriptsReadOnly`)]:[];e.updateCommand(`insertScript`,{disabledReasons:a,callback:e=>n.insertSnippet(e??``)}),e.updateCommand(`saveScripts`,{disabledReasons:[...a,...i?.isDirty?[]:[(0,r.messageKey)(`reason.noChangesToSave`)]],callback:async()=>{await n.saveSource()}}),e.updateCommand(`copy`,{callback:()=>n.copy()}),e.updateCommand(`cut`,{callback:()=>n.cut()}),e.updateCommand(`paste`,{callback:()=>n.paste()}),e.updateCommand(`selectAll`,{callback:()=>n.runAction(`editor.action.selectAll`)}),e.updateCommand(`find`,{callback:()=>n.runAction(`actions.find`)}),e.updateCommand(`findReplace`,{callback:()=>n.runAction(`editor.action.startFindReplaceAction`)}),e.updateCommand(`goto`,{callback:()=>n.runAction(`editor.action.gotoLine`)})}(e,{scriptEditor:Q,isDirty:F,readOnly:p}),()=>{e.remove()}},[$,Q,F,p]),(0,t.useEffect)(()=>(re&&requestAnimationFrame(()=>{Z.current?.focus()}),()=>{P.current?.editor&&requestAnimationFrame(()=>{Z.current?.contains(document.activeElement)&&Z.current?.focus()})}),[]),(0,s.jsx)(`div`,{className:u(`script-editor`,te,l),style:{display:`flex`,flexDirection:`row`,flex:`1 1 100%`,position:`relative`,...d},ref:f([Z,Te]),...C,children:Ce})})),I=null,L=()=>I,R=(0,t.memo)(e=>{let{scope:n,data:r}=e,{workbook:i}=r,a=(0,o.useNotifier)(),s=(0,c.useTaskPaneArea)(),l=s.getOpen(),u=(0,o.useCallbackRef)(async e=>{if(!i)return;let t=null,n=i.getScripts();if(e?.declaration||e?.functionName){let r=e.declaration?e.declaration.getName():e.functionName;(await n.searchFunctions({name:r})).length>0&&(t=r)}if(t)try{await n.executeMacro(t)}catch(e){a.showError(e);return}},[i,a]),d=(0,o.useCallbackRef)(()=>{let e=L();e?i&&e({workbook:i}):s.getOpen().includes(`scriptEditor`)?s.close(`scriptEditor`):s.activate(`scriptEditor`,{})},[i,s]),f=l.includes(`scriptEditor`);return(0,t.useEffect)(()=>{if(!n)return;let e=n.contribution();return e.updateCommand(`showScriptEditor`,{callback:()=>{d()},state:f}),e.updateCommand(`executeScript`,{callback:e=>u(e??{})}),()=>{e.remove()}},[n,f,i,u,d]),(0,c.useModelListener)(i,{onLoad:()=>{i?.getScripts().start()}}),null});R.displayName=`WorkbookScriptCommands`;var z={"reason.noChangesToSave":`No changes to save`,"reason.scriptsReadOnly":`Scripts can't be changed while the workbook structure is protected.`,"scriptEditor.glyph.autoRun":`Auto Run`,"scriptEditor.glyph.formula":`Formula`,"scriptEditor.glyph.macro":`Macro`,"scriptEditor.loading":`Loading...`,"scriptEditor.retry":`Retry`,"scriptEditor.saving":`Saving Scripts...`},le=[{sourceId:`groups`,catalog:{scope:`ui`,label:`Interface`,tag:`en`,version:1,commands:{customFunctionOptions:{label:`Custom`,description:`Insert a custom function.`},scriptEditor:{label:`Script (Typescript)`,icon:`ScriptRun`},scriptsOptions:{label:`Macros`,description:`Run or manage macros.`}}}},{sourceId:`scriptEditor`,catalog:{scope:`scriptEditor`,label:`Script Editor`,tag:`en`,version:1,commands:{scriptingHelp:{label:`Scripting Help`,description:`Open Documentation For Scripting.`,groupLabels:{scriptsOptions:`Help`},icon:`Help`},showScriptingCommands:{label:`Scripting Command Palette`,description:`Show commands for scripting.`,groupLabels:{scriptsOptions:`Command Palette`},icon:`Keyboard`,shortcut:`F1`},insertScript:{label:`Insert Script`,description:`Inserts a script from a set of templates.`,icon:`ScriptInsert`},saveScripts:{label:`Save Script`,description:`Save the current scripts.`,icon:`ScriptSave`}}}},{sourceId:`workbookScript`,catalog:{scope:`workbook`,label:`Workbook`,tag:`en`,version:1,commands:{showScriptEditor:{label:`Scripts`,description:`Show the script editor.`,groupLabels:{scriptsOptions:`Script Editor…`},icon:`ScriptRun`,shortcut:[`alt+F11`]},executeScript:{label:`Run Script`,description:`Run the last executed script.`,icon:`ScriptRun`,shortcut:`F8`}}}}],{DefaultCommandCatalogService:B}=o.Command,V=!1,H=e=>{let{model:t,entryKey:n,frame:r,ref:i,...a}=e;return(0,s.jsx)(F,{ref:i,frame:r,scripts:t?.getScripts(),...a})};exports.ScriptEditor=F,exports.ScriptingReactPlugin=()=>{c.DefaultTaskPaneRegistry.registerTaskPane({key:`scriptEditor`,getTitle:()=>`Script (Typescript)`,getIcon:()=>`ScriptRun`,component:H,keepMounted:!0},!0),function(){if(V)return;V=!0;let e=B;e.registerFromManifest(`@sheetxl/scripting-react`,{}.url,{messages:z,catalogs:le}),e.prefetch()}(),o.Command.DefaultCommandRegistry.registerDynamic(`workbook`,R)},exports.WorkbookScriptCommands=R,exports.getScriptEditorOpener=L,exports.setScriptEditorOpener=e=>{I=e};
|