@zakodium/nmrium-core 0.7.0 → 0.7.2
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/dist/nmrium-core.d.ts +62 -25
- package/dist/nmrium-core.js +3 -3
- package/package.json +2 -2
package/dist/nmrium-core.d.ts
CHANGED
|
@@ -118,6 +118,31 @@ declare interface AnalysisPreferences extends AnalysisOptions {
|
|
|
118
118
|
|
|
119
119
|
export declare type AutoProcessingFilterEntry = Omit<Filter1DOptions | Filter2DOptions, 'value'>;
|
|
120
120
|
|
|
121
|
+
export declare interface AxisPreferences {
|
|
122
|
+
primaryTicks: {
|
|
123
|
+
textStyle: TextStyle;
|
|
124
|
+
};
|
|
125
|
+
secondaryTicks: {
|
|
126
|
+
enabled: boolean;
|
|
127
|
+
};
|
|
128
|
+
gridlines1D: AxisPreferencesGridlines;
|
|
129
|
+
gridlines2D: AxisPreferencesGridlines;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare interface AxisPreferencesGridline {
|
|
133
|
+
enabled: boolean;
|
|
134
|
+
lineStyle: LineStyle;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export declare interface AxisPreferencesGridlines {
|
|
138
|
+
primary: AxisPreferencesGridline;
|
|
139
|
+
secondary: AxisPreferencesGridline;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare type AxisUnit = (typeof axisUnits)[number];
|
|
143
|
+
|
|
144
|
+
export declare const axisUnits: readonly ["ppm", "hz", "pt", "s"];
|
|
145
|
+
|
|
121
146
|
declare interface BaseExportSettings {
|
|
122
147
|
useDefaultSettings: boolean;
|
|
123
148
|
dpi: number;
|
|
@@ -197,24 +222,11 @@ export declare interface ContourItem {
|
|
|
197
222
|
numberOfLayers: number;
|
|
198
223
|
}
|
|
199
224
|
|
|
200
|
-
export declare interface
|
|
225
|
+
export declare interface ContourLevel {
|
|
201
226
|
positive: ContourItem;
|
|
202
227
|
negative: ContourItem;
|
|
203
228
|
}
|
|
204
229
|
|
|
205
|
-
declare interface ContourOptions_2 {
|
|
206
|
-
positive: {
|
|
207
|
-
contourLevels: [number, number];
|
|
208
|
-
numberOfLayers: number;
|
|
209
|
-
};
|
|
210
|
-
negative: {
|
|
211
|
-
contourLevels: [number, number];
|
|
212
|
-
numberOfLayers: number;
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export declare type ContoursLevels = Record<string, Level>;
|
|
217
|
-
|
|
218
230
|
export declare interface CoreReadReturn {
|
|
219
231
|
/**
|
|
220
232
|
* Common state representation between NMRium component and NMRium apps
|
|
@@ -237,7 +249,7 @@ export declare interface CoreReadReturn {
|
|
|
237
249
|
containsNmrium: boolean;
|
|
238
250
|
}
|
|
239
251
|
|
|
240
|
-
export declare const CURRENT_EXPORT_VERSION:
|
|
252
|
+
export declare const CURRENT_EXPORT_VERSION: 14;
|
|
241
253
|
|
|
242
254
|
export declare type CustomWorkspaces = Record<string, InnerWorkspace>;
|
|
243
255
|
|
|
@@ -311,7 +323,6 @@ export declare interface Display1D extends Display {
|
|
|
311
323
|
export declare interface Display2D extends Color2D, Display {
|
|
312
324
|
isPositiveVisible: boolean;
|
|
313
325
|
isNegativeVisible: boolean;
|
|
314
|
-
contourOptions: ContourOptions_2;
|
|
315
326
|
}
|
|
316
327
|
|
|
317
328
|
declare interface DisplayPreferences {
|
|
@@ -459,9 +470,34 @@ export declare type Layout = 'portrait' | 'landscape';
|
|
|
459
470
|
|
|
460
471
|
export declare type LegendField = JpathLegendField | PredefinedLegendField;
|
|
461
472
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
473
|
+
/**
|
|
474
|
+
SVG text styles that can be controlled by the user.
|
|
475
|
+
It is a copy of `react-science/ui#SVGStyledLineUserConfig`
|
|
476
|
+
*/
|
|
477
|
+
export declare interface LineStyle {
|
|
478
|
+
/**
|
|
479
|
+
* Line color.
|
|
480
|
+
* @default '#000000'
|
|
481
|
+
*/
|
|
482
|
+
stroke?: string;
|
|
483
|
+
/**
|
|
484
|
+
* Line opacity.
|
|
485
|
+
* Range: [0, 1]
|
|
486
|
+
* @default 1
|
|
487
|
+
*/
|
|
488
|
+
strokeOpacity?: number;
|
|
489
|
+
/**
|
|
490
|
+
* Line width.
|
|
491
|
+
* Range: [0, ∞)
|
|
492
|
+
* @default 1
|
|
493
|
+
*/
|
|
494
|
+
strokeWidth?: number;
|
|
495
|
+
/**
|
|
496
|
+
* Line stroke pattern.
|
|
497
|
+
* The `stroke-dasharray` attribute is computed from it and `strokeWidth`
|
|
498
|
+
* @default 'solid'
|
|
499
|
+
*/
|
|
500
|
+
strokeDasharray?: 'solid' | 'dashed' | 'dotted' | 'dashed-dot';
|
|
465
501
|
}
|
|
466
502
|
|
|
467
503
|
declare interface LoadersPreferences {
|
|
@@ -526,7 +562,7 @@ export declare interface MultipleSpectraAnalysisPreferences {
|
|
|
526
562
|
|
|
527
563
|
export declare class NMRiumCore {
|
|
528
564
|
#private;
|
|
529
|
-
readonly version:
|
|
565
|
+
readonly version: 14;
|
|
530
566
|
registerPlugin(plugin: NMRiumPlugin): void;
|
|
531
567
|
registerPlugins(plugins: NMRiumPlugin[]): void;
|
|
532
568
|
private getPlugin;
|
|
@@ -1206,6 +1242,8 @@ export declare interface SpectraColors {
|
|
|
1206
1242
|
indicatorLineColor: string;
|
|
1207
1243
|
}
|
|
1208
1244
|
|
|
1245
|
+
export declare type SpectraContourLevels = Record<string, ContourLevel>;
|
|
1246
|
+
|
|
1209
1247
|
declare type SpectraPredictionOptions = Record<Experiment, boolean>;
|
|
1210
1248
|
|
|
1211
1249
|
export declare interface SpectraPreferences {
|
|
@@ -1415,9 +1453,7 @@ export declare interface ViewState {
|
|
|
1415
1453
|
*/
|
|
1416
1454
|
showSimilarityTree: boolean;
|
|
1417
1455
|
};
|
|
1418
|
-
|
|
1419
|
-
levels: ContoursLevels;
|
|
1420
|
-
};
|
|
1456
|
+
spectraContourLevels: SpectraContourLevels;
|
|
1421
1457
|
/**
|
|
1422
1458
|
* options to control spectra vertical alignment
|
|
1423
1459
|
* @default 'bottom'
|
|
@@ -1435,8 +1471,8 @@ export declare interface ViewState {
|
|
|
1435
1471
|
|
|
1436
1472
|
export declare interface WheelOptions {
|
|
1437
1473
|
shiftKey: boolean;
|
|
1438
|
-
|
|
1439
|
-
|
|
1474
|
+
contourLevel: ContourLevel;
|
|
1475
|
+
currentContourLevel: ContourLevel;
|
|
1440
1476
|
}
|
|
1441
1477
|
|
|
1442
1478
|
export declare type Workspace = WorkspaceMeta & Required<WorkspacePreferences>;
|
|
@@ -1479,6 +1515,7 @@ export declare interface WorkspacePreferences {
|
|
|
1479
1515
|
peaksLabel?: PeaksLabel;
|
|
1480
1516
|
acsExportSettings?: ACSExportSettings;
|
|
1481
1517
|
defaultMoleculeSettings?: MoleculeView;
|
|
1518
|
+
axis?: AxisPreferences;
|
|
1482
1519
|
}
|
|
1483
1520
|
|
|
1484
1521
|
/**
|
package/dist/nmrium-core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Ce={NORMAL:"NORMAL",FORMULA:"FORMULA"};var Ae={RELATIVE:"relative",ABSOLUTE:"absolute",MIN:"min",MAX:"max"};var we=[{name:"pixels",unit:"px"},{name:"inches",unit:"in"},{name:"feet",unit:"ft"},{name:"yards",unit:"yd"},{name:"centimeters",unit:"cm"},{name:"millimeters",unit:"mm"},{name:"meters",unit:"m"},{name:"points",unit:"pt"},{name:"picas",unit:"pc"}];var N=13;var Fe=[{key:"CT",description:"CT from NMR Solutions"}];import{isAnyArray as Ee}from"is-any-array";import{xMultiply as B}from"ml-spectra-processing";var Te=crypto.randomUUID.bind(crypto),x=Te;function O(e){let{id:t=x(),meta:o,peaks:r={},filters:i=[],info:n={},ranges:c={},integrals:s={},selector:l,sourceId:a,dependentVariables:p=[],...m}=e,u={id:t,meta:o,filters:i},{data:f=Le(p[0]?.components??[])}=e;if(Array.isArray(n.nucleus)&&(n.nucleus=n.nucleus[0]),u.data={x:[],re:[],im:[],...f},"scaleFactor"in n){let{scaleFactor:g}=n,{re:S,im:y}=u.data;B(S,g,{output:S}),y&&B(y,g,{output:y})}l&&(u.selector=l),a&&(u.sourceId=a,u.fileCollectionId=a);let d=Ee(f.im);if(u.info={phc0:0,phc1:0,nucleus:"1H",isFid:!1,isComplex:d,dimension:1,name:n?.name||t,...n},n.isFid&&n.reverse&&d){let{im:g}=u.data;B(g,-1,{output:g}),u.info.reverse=!1}return u.display={isVisible:!0,isPeaksMarkersVisible:!0,isRealSpectrumVisible:!0,isVisibleInDomain:!0,...e.display},u.peaks={values:[],options:{},...r},u.ranges={values:[],options:{sum:null,isSumConstant:!0,sumAuto:!0},...c},u.integrals={values:[],options:{},...s},{...m,...u}}function Le(e){let t=e[0]?.data?.x||[],o=e[0]?.data?.re||e[0]?.data?.y||[],r=e[0]?.data?.im||e[1]?.data?.y||null;return t.length>0&&t[0]>t[1]&&(t.reverse(),o.reverse(),r&&r.reverse()),{x:t,re:o,im:r}}import{matrixToArray as ze,xMinMaxValues as ke,xNoiseSanPlot as Ue}from"ml-spectra-processing";var K={z:[[]],minX:0,minY:0,maxX:0,maxY:0},Ve={re:K,im:K},je={rr:K};function M(e){let{id:t=x(),meta:o={},dependentVariables:r=[],info:i={},filters:n=[],zones:c=[],sourceId:s,...l}=e,a={id:t,meta:o,filters:n};s&&(a.sourceId=s,a.fileCollectionId=s),a.info={nucleus:["1H","1H"],isFid:!1,isComplex:!1,name:i?.name||x(),...i},a.originalInfo=structuredClone(a.info),a.display={isPositiveVisible:!0,isNegativeVisible:!0,isVisible:!0,dimension:2,...e.display};let{data:p=r[0]?.components??{}}=e;if(a.data={...a.info.isFid?Ve:je,...p},a.originalData=structuredClone(a.data),!("spectrumSize"in i)){let m=i.isFid?"re":"rr",u=a.data[m].z.length,f=u>0?a.data[m].z[0].length:0;a.info.spectrumSize=[f,u]}if(!i.isFid){let m=a.data.rr,u=ze(m.z),{positive:f,negative:d}=Ue(u),{min:g,max:S}=ke(u);a.data.rr={...m,minZ:g,maxZ:S},a.info.noise={positive:f,negative:d}}return a.zones={values:[],options:{},...c},{...l,...a}}import{xSequentialFillFromTo as Be}from"ml-spectra-processing";import{isAnyArray as _e}from"is-any-array";function W(e,t=0){if(_e(e)){let o=e.at(t);if(o!==void 0)return o;throw new RangeError("An array with a index out of boundaries")}return e}var Ke=new Set(["t1ir","T1"]);function se(e){let t=[];for(let o of e){let{info:{pulseSequence:r,isFid:i}}=o,{data:n,info:c,meta:{vdlistValues:s=[]}={}}=o;if(!(r&&Ke.has(r))||s.length===0){t.push(o);continue}let a=i?"re":"rr",p={};for(let y in c)p[y]=W(c[y]);let{z:m,maxX:u,minX:f}=n[a],d=Be({from:f,to:u,size:m[0].length}),[g,S]=Xe(o);for(let y=0;y<s.length;y++){let P={re:d,x:d};for(let h in n)P[We(h)]=n[h].z.at(g*(y+S));t.push(O({data:P,info:{...p,name:`${p.name}_${s[y]}`,dimension:1,vd:s[y]}}))}}return t}function We(e){return["rr","re"].includes(e)?"re":["im","ri","ir","ii"].includes(e)?"im":"x"}function Xe(e){let{meta:{PAGE:t}}=e,o=!0;if(t){let r=i=>Number.parseFloat(i.replace(/[F|T]1=/,""));o=r(t[0])>r(t[2])}return o?[-1,1]:[1,0]}var Ye=2,Ze=1;function $e(e){let{spectra:t=[],molecules:o}=e,r=[];for(let i of t){let{info:n}=i;switch(n.dimension){case Ze:r.push(O(i));break;case Ye:r.push(M(i));break;default:throw new Error("dimension does not supported")}}return{molecules:o,spectra:se(r)}}function Ge(e){return e}function b(e,t){return JSON.parse(JSON.stringify(e),function(r,i){if(r in t){this[t[r]]=i;return}return i})}function X(e){if(e?.version===1)return e;let t={...e,version:1},o={j:"js",signal:"signals",integral:"integration",peak:"peaks",diaID:"diaIDs"};for(let r of t.spectra){if(r.ranges){let i=b(r.ranges,o);r.ranges=Array.isArray(i)?{values:i}:i}else if(r.zones){let i=b(r.zones,o);r.zones=Array.isArray(i)?{values:i}:i}r.peaks&&(r.peaks=Array.isArray(r.peaks)?{values:r.peaks}:r.peaks),r.integrals&&(r.integrals=Array.isArray(r.integrals)?{values:r.integrals}:r.integrals)}return t}function Y(e){if(e?.version===2)return e;let t={...e,version:2},o={peaks:{delta:"x",originDelta:"originalX",intensity:"y"},ranges:{atomIDs:"atoms",intensity:"y"}};for(let r of t.spectra)r.peaks?r.peaks=b(r.peaks,o.peaks):r.ranges?r.ranges=b(r.ranges,o.ranges):r.zones&&(r.zones.values=Je(r.zones.values));return t}function Je(e){return e.map(t=>(t.signals&&(t.signals=t.signals.map(o=>{if(o.x&&o.y){let{x:{fromTo:r,...i},y:{fromTo:n,...c}}=o;o={...o,x:{...i,...r},y:{...c,...n}}}else{let{fromTo:r,deltaX:i,resolutionX:n,nucleusX:c,deltaY:s,resolutionY:l,nucleusY:a,shiftX:p,shiftY:m,...u}=o;o={...u,x:{from:r[0].from,to:r[0].to,delta:i,resolution:n,nucleus:c},y:{from:r[1].from,to:r[1].to,delta:s,resolution:l,nucleus:a}}}return o},[])),t),[])}var qe={name:"apodization",label:"Apodization",value:{lineBroadening:1,gaussBroadening:0,lineBroadeningCenter:0}};function Z(e){if(e?.version===3)return e;let t={...e,version:3};for(let o of t.spectra)if(Array.isArray(o?.filters)&&o?.filters.length>0){let r=o.filters.findIndex(i=>i.name==="lineBroadening");if(r!==-1){let i={...o.filters[r],...qe};o.filters[r]=o.filters[r-1],o.filters[r-1]=i}}return t}function $(e){if(e?.version===4)return e;let{version:t,...o}=e,r=[],i={};for(let{source:s,...l}of o.spectra){let a={},{info:p={},display:m={}}=l;if(p?.dimension===2&&!s?.jcampURL)if(p.isFt)a.data={rr:l.data};else continue;if(s?.jcampURL){let{jcampURL:d,jcampSpectrumIndex:g}=s,S=d.match(/(?<baseURL>^\w+:\/{2}\w+\/)(?<relativePath>.*)/);i[d]||(i[d]={baseURL:S?.groups.baseURL||"",relativePath:S?.groups.relativePath||d.replace(/^\.\//,"")}),a.sourceSelector={files:[i[d].relativePath]},g!==void 0&&(a.sourceSelector.jcamp={index:g})}a.filters=He(l.filters);let{name:u,...f}=m;u&&(a.info={...p,name:u}),a.display=f,r.push({...l,...a})}let n={data:{...o,spectra:r},version:4},c={entries:Object.values(i)};return c.entries.length>0&&(n.data.source=c),n}function He(e=[]){let t=[];for(let o of e){let{name:r,value:i}=o;switch(r){case"zeroFilling":t.push({...o,value:{nbPoints:i}});break;case"shiftX":case"shift2DX":case"shift2DY":t.push({...o,value:{shift:i}});break;default:t.push({...o})}}return t}function G(e){if(e?.version===5)return e;let t={...e,version:5},o={originFrom:"originalFrom",originTo:"originalTo",originDelta:"originalDelta",originX:"originalX",originY:"originalY",originZ:"originalZ"};for(let r of t?.data?.spectra||[])for(let i of["peaks","ranges","zones"])r?.[i]&&(r[i]=b(r[i],o));return t}function J(e){if(e?.version===6)return e;let t={...e,version:6};for(let o of t?.data?.spectra||[]){let{digitalFilter:r,fft:i,phaseCorrection:n}=Qe(o);i?.flag&&r?.flag&&n&&Math.floor(r.value.digitalFilterValue)%2>0&&(n.value.ph0-=180)}return t}function Qe(e,t=["phaseCorrection","fft","digitalFilter"]){let{filters:o=[]}=e,r={};for(let i of t)r[i]=o.find(n=>n.name===i);return r}function C(e,t="localStorage"){if(e?.version===7)return e;if(t==="nmrium")return ae(e);let o={...e,version:7};for(let r in e.workspaces)o.workspaces[r]=ae(o.workspaces[r]);return o}function ae(e){let{formatting:{nuclei:t,panels:o}={nuclei:null,panels:null},version:r,...i}=e,n={...i};return t&&(n.nuclei=et(t)),o&&(n.panels=o),n}function et(e){let t=[],o={name:"nucleus",ppm:"ppmFormat",hz:"hzFormat"};for(let r in e)t.push(b(e[r],o));return t}function q(e){if(e?.version===7)return e;let t={...e,version:7};return t?.settings&&(t.settings=C(t.settings,"nmrium")),t}function A(e,t="localStorage"){if(e?.version===8)return e;if(t==="nmrium")return le(e);let o={...e,version:8};for(let r in e.workspaces)o.workspaces[r]=le(o.workspaces[r]);return o}function le(e){let{version:t,...o}=e,r={...o};return r.display.panels=tt(e),r}function tt(e){let t={},o=e.display.panels;for(let r of Object.keys(o)){let{display:i,open:n}=o[r];t[r]={display:i,visible:i,open:n}}return t}function H(e){if(e?.version===8)return e;let t={...e,version:8};t?.settings&&(t.settings=A(t.settings,"nmrium"));for(let o of t?.data?.spectra||[]){let{filters:r=[]}=o;for(let s=0;s<r.length;s++){let{flag:l,isDeleteAllow:a,label:p,...m}=r[s];r[s]={...m,enabled:l}}let i=r.findIndex(s=>s.name==="apodization");if(i!==-1){let s=r[i],{lineBroadening:l,gaussBroadening:a,lineBroadeningCenter:p}=s.value;s.value={exponential:{apply:!0,options:{lineBroadening:a>0?-l:l}}},a>0&&(s.value.gaussian={apply:!0,options:{lineBroadening:.6*a,lineBroadeningCenter:p}}),r[i]=s}let n=r.findIndex(s=>s.name==="apodizationDimension1"),c=r.findIndex(s=>s.name==="apodizationDimension2");if(n!==-1){let s=r[n],{shapes:l}=s.value.compose;s.value=ce(l)}if(c!==-1){let s=r[c],{shapes:l}=s.value.compose;s.value=ce(l)}}return t}function ce(e){let t={};for(let{shape:o}of e){let{kind:r,options:i}=o;if(r==="sineBell"){let{exponent:n,offset:c}=i,s=n===2?"sineSquare":"sineBell";t[s]={apply:!0,options:{offset:c}}}}return t}function Q(e){let{version:t,plugins:o,...r}=e;return t===9?e:{version:9,plugins:{},...r}}function ee(e){if(e?.version>=10)return e;let t={...e,version:10};if(e.data){let{source:o,spectra:r,...i}=e.data,n=o?x():void 0,c=o?[{...o,id:n}]:[];t.data={...i,sources:c,spectra:o?r?.map(s=>({...s,sourceId:n})):r}}return t}function te(e){let{version:t}=e;if(t>=11)return e;let o={...e,version:11};return e?.view?.molecules&&(o.view=rt(e.view)),o}function rt(e){let{molecules:t,...o}=e,r={};for(let[i,n]of Object.entries(t)){let{showAtomNumber:c,...s}=n;r[i]={...s,atomAnnotation:"none",showLabel:!1}}return{molecules:r,...o}}function re(e){if(e?.version>=12)return e;let t={...e,version:12};if(t.data){let o=e.data.spectra??[],r=e.data.molecules??[];for(let i of o){let{sourceId:n,fileCollectionId:c,sourceSelector:s}=i;delete i.sourceId,delete i.fileCollectionId,delete i.sourceSelector,s&&(i.selector={...s,root:c??n})}for(let i of r){let{sourceId:n,fileCollectionId:c,sourceSelector:s}=i;delete i.sourceId,delete i.fileCollectionId,delete i.sourceSelector,s&&(i.selector={...s,root:c??n})}}return t}function oe(e){if(e?.version>=13)return e;let t={...e,version:13};if(t.data){let o=e.data.spectra??[];for(let r of o){let i=r.ranges?.values??[];for(let n of i){let{diaIDs:c,assignment:s,nbAtoms:l,signals:a=[]}=n,p=a.some(m=>m.diaIDs&&m.diaIDs.length>0);for(let m of a)!p&&c&&l&&(m.diaIDs=c,m.nbAtoms=l),!m.assignment&&s&&(m.assignment=s);delete n.diaIDs,delete n.assignment,delete n.nbAtoms}}}return t}function I(e,t){e.plugins||(e.plugins={});let o=e.plugins;for(let r of t.values()){if(!r.shouldSerialize){delete o[r.id];continue}o[r.id]||(o[r.id]={id:r.id,version:r.version}),o[r.id].id=r.id,o[r.id].version=r.version}}var ot=[X,Y,Z,$,G,J,q,H,Q,ee,te,re,oe];function ue(e,t,o){let r=structuredClone(e),i=Object.entries(e?.plugins??{});for(let[s,{version:l}]of i){let a=o.get(s);if(!(a&&a.version>=l)){if(a){console.warn(`Plugin "${a.id}" is loaded with a version older (${a.version}) than the one used to save the state (${l}).
|
|
1
|
+
var Ae={NORMAL:"NORMAL",FORMULA:"FORMULA"};var we={RELATIVE:"relative",ABSOLUTE:"absolute",MIN:"min",MAX:"max"};var Fe=[{name:"pixels",unit:"px"},{name:"inches",unit:"in"},{name:"feet",unit:"ft"},{name:"yards",unit:"yd"},{name:"centimeters",unit:"cm"},{name:"millimeters",unit:"mm"},{name:"meters",unit:"m"},{name:"points",unit:"pt"},{name:"picas",unit:"pc"}];var Te=["ppm","hz","pt","s"];var b=14;var Ee=[{key:"CT",description:"CT from NMR Solutions"}];import{isAnyArray as ke}from"is-any-array";import{xMultiply as B}from"ml-spectra-processing";var Le=crypto.randomUUID.bind(crypto),x=Le;function O(e){let{id:t=x(),meta:o,peaks:r={},filters:i=[],info:n={},ranges:c={},integrals:s={},selector:l,sourceId:a,dependentVariables:p=[],...m}=e,u={id:t,meta:o,filters:i},{data:f=ze(p[0]?.components??[])}=e;if(Array.isArray(n.nucleus)&&(n.nucleus=n.nucleus[0]),u.data={x:[],re:[],im:[],...f},"scaleFactor"in n){let{scaleFactor:g}=n,{re:S,im:y}=u.data;B(S,g,{output:S}),y&&B(y,g,{output:y})}l&&(u.selector=l),a&&(u.sourceId=a,u.fileCollectionId=a);let d=ke(f.im);if(u.info={phc0:0,phc1:0,nucleus:"1H",isFid:!1,isComplex:d,dimension:1,name:n?.name||t,...n},n.isFid&&n.reverse&&d){let{im:g}=u.data;B(g,-1,{output:g}),u.info.reverse=!1}return u.display={isVisible:!0,isPeaksMarkersVisible:!0,isRealSpectrumVisible:!0,isVisibleInDomain:!0,...e.display},u.peaks={values:[],options:{},...r},u.ranges={values:[],options:{sum:null,isSumConstant:!0,sumAuto:!0},...c},u.integrals={values:[],options:{},...s},{...m,...u}}function ze(e){let t=e[0]?.data?.x||[],o=e[0]?.data?.re||e[0]?.data?.y||[],r=e[0]?.data?.im||e[1]?.data?.y||null;return t.length>0&&t[0]>t[1]&&(t.reverse(),o.reverse(),r&&r.reverse()),{x:t,re:o,im:r}}import{matrixToArray as Ue,xMinMaxValues as Ve,xNoiseSanPlot as je}from"ml-spectra-processing";var K={z:[[]],minX:0,minY:0,maxX:0,maxY:0},_e={re:K,im:K},Be={rr:K};function M(e){let{id:t=x(),meta:o={},dependentVariables:r=[],info:i={},filters:n=[],zones:c=[],sourceId:s,...l}=e,a={id:t,meta:o,filters:n};s&&(a.sourceId=s,a.fileCollectionId=s),a.info={nucleus:["1H","1H"],isFid:!1,isComplex:!1,name:i?.name||x(),...i},a.originalInfo=structuredClone(a.info),a.display={isPositiveVisible:!0,isNegativeVisible:!0,isVisible:!0,dimension:2,...e.display};let{data:p=r[0]?.components??{}}=e;if(a.data={...a.info.isFid?_e:Be,...p},a.originalData=structuredClone(a.data),!("spectrumSize"in i)){let m=i.isFid?"re":"rr",u=a.data[m].z.length,f=u>0?a.data[m].z[0].length:0;a.info.spectrumSize=[f,u]}if(!i.isFid){let m=a.data.rr,u=Ue(m.z),{positive:f,negative:d}=je(u),{min:g,max:S}=Ve(u);a.data.rr={...m,minZ:g,maxZ:S},a.info.noise={positive:f,negative:d}}return a.zones={values:[],options:{},...c},{...l,...a}}import{xSequentialFillFromTo as We}from"ml-spectra-processing";import{isAnyArray as Ke}from"is-any-array";function W(e,t=0){if(Ke(e)){let o=e.at(t);if(o!==void 0)return o;throw new RangeError("An array with a index out of boundaries")}return e}var Xe=new Set(["t1ir","T1"]);function ae(e){let t=[];for(let o of e){let{info:{pulseSequence:r,isFid:i}}=o,{data:n,info:c,meta:{vdlistValues:s=[]}={}}=o;if(!(r&&Xe.has(r))||s.length===0){t.push(o);continue}let a=i?"re":"rr",p={};for(let y in c)p[y]=W(c[y]);let{z:m,maxX:u,minX:f}=n[a],d=We({from:f,to:u,size:m[0].length}),[g,S]=Ze(o);for(let y=0;y<s.length;y++){let P={re:d,x:d};for(let h in n)P[Ye(h)]=n[h].z.at(g*(y+S));t.push(O({data:P,info:{...p,name:`${p.name}_${s[y]}`,dimension:1,vd:s[y]}}))}}return t}function Ye(e){return["rr","re"].includes(e)?"re":["im","ri","ir","ii"].includes(e)?"im":"x"}function Ze(e){let{meta:{PAGE:t}}=e,o=!0;if(t){let r=i=>Number.parseFloat(i.replace(/[F|T]1=/,""));o=r(t[0])>r(t[2])}return o?[-1,1]:[1,0]}var Ge=2,$e=1;function Je(e){let{spectra:t=[],molecules:o}=e,r=[];for(let i of t){let{info:n}=i;switch(n.dimension){case $e:r.push(O(i));break;case Ge:r.push(M(i));break;default:throw new Error("dimension does not supported")}}return{molecules:o,spectra:ae(r)}}function qe(e){return e}function N(e,t){return JSON.parse(JSON.stringify(e),function(r,i){if(r in t){this[t[r]]=i;return}return i})}function X(e){if(e?.version===1)return e;let t={...e,version:1},o={j:"js",signal:"signals",integral:"integration",peak:"peaks",diaID:"diaIDs"};for(let r of t.spectra){if(r.ranges){let i=N(r.ranges,o);r.ranges=Array.isArray(i)?{values:i}:i}else if(r.zones){let i=N(r.zones,o);r.zones=Array.isArray(i)?{values:i}:i}r.peaks&&(r.peaks=Array.isArray(r.peaks)?{values:r.peaks}:r.peaks),r.integrals&&(r.integrals=Array.isArray(r.integrals)?{values:r.integrals}:r.integrals)}return t}function Y(e){if(e?.version===2)return e;let t={...e,version:2},o={peaks:{delta:"x",originDelta:"originalX",intensity:"y"},ranges:{atomIDs:"atoms",intensity:"y"}};for(let r of t.spectra)r.peaks?r.peaks=N(r.peaks,o.peaks):r.ranges?r.ranges=N(r.ranges,o.ranges):r.zones&&(r.zones.values=He(r.zones.values));return t}function He(e){return e.map(t=>(t.signals&&(t.signals=t.signals.map(o=>{if(o.x&&o.y){let{x:{fromTo:r,...i},y:{fromTo:n,...c}}=o;o={...o,x:{...i,...r},y:{...c,...n}}}else{let{fromTo:r,deltaX:i,resolutionX:n,nucleusX:c,deltaY:s,resolutionY:l,nucleusY:a,shiftX:p,shiftY:m,...u}=o;o={...u,x:{from:r[0].from,to:r[0].to,delta:i,resolution:n,nucleus:c},y:{from:r[1].from,to:r[1].to,delta:s,resolution:l,nucleus:a}}}return o},[])),t),[])}var Qe={name:"apodization",label:"Apodization",value:{lineBroadening:1,gaussBroadening:0,lineBroadeningCenter:0}};function Z(e){if(e?.version===3)return e;let t={...e,version:3};for(let o of t.spectra)if(Array.isArray(o?.filters)&&o?.filters.length>0){let r=o.filters.findIndex(i=>i.name==="lineBroadening");if(r!==-1){let i={...o.filters[r],...Qe};o.filters[r]=o.filters[r-1],o.filters[r-1]=i}}return t}function G(e){if(e?.version===4)return e;let{version:t,...o}=e,r=[],i={};for(let{source:s,...l}of o.spectra){let a={},{info:p={},display:m={}}=l;if(p?.dimension===2&&!s?.jcampURL)if(p.isFt)a.data={rr:l.data};else continue;if(s?.jcampURL){let{jcampURL:d,jcampSpectrumIndex:g}=s,S=d.match(/(?<baseURL>^\w+:\/{2}\w+\/)(?<relativePath>.*)/);i[d]||(i[d]={baseURL:S?.groups.baseURL||"",relativePath:S?.groups.relativePath||d.replace(/^\.\//,"")}),a.sourceSelector={files:[i[d].relativePath]},g!==void 0&&(a.sourceSelector.jcamp={index:g})}a.filters=et(l.filters);let{name:u,...f}=m;u&&(a.info={...p,name:u}),a.display=f,r.push({...l,...a})}let n={data:{...o,spectra:r},version:4},c={entries:Object.values(i)};return c.entries.length>0&&(n.data.source=c),n}function et(e=[]){let t=[];for(let o of e){let{name:r,value:i}=o;switch(r){case"zeroFilling":t.push({...o,value:{nbPoints:i}});break;case"shiftX":case"shift2DX":case"shift2DY":t.push({...o,value:{shift:i}});break;default:t.push({...o})}}return t}function $(e){if(e?.version===5)return e;let t={...e,version:5},o={originFrom:"originalFrom",originTo:"originalTo",originDelta:"originalDelta",originX:"originalX",originY:"originalY",originZ:"originalZ"};for(let r of t?.data?.spectra||[])for(let i of["peaks","ranges","zones"])r?.[i]&&(r[i]=N(r[i],o));return t}function J(e){if(e?.version===6)return e;let t={...e,version:6};for(let o of t?.data?.spectra||[]){let{digitalFilter:r,fft:i,phaseCorrection:n}=tt(o);i?.flag&&r?.flag&&n&&Math.floor(r.value.digitalFilterValue)%2>0&&(n.value.ph0-=180)}return t}function tt(e,t=["phaseCorrection","fft","digitalFilter"]){let{filters:o=[]}=e,r={};for(let i of t)r[i]=o.find(n=>n.name===i);return r}function C(e,t="localStorage"){if(e?.version===7)return e;if(t==="nmrium")return le(e);let o={...e,version:7};for(let r in e.workspaces)o.workspaces[r]=le(o.workspaces[r]);return o}function le(e){let{formatting:{nuclei:t,panels:o}={nuclei:null,panels:null},version:r,...i}=e,n={...i};return t&&(n.nuclei=rt(t)),o&&(n.panels=o),n}function rt(e){let t=[],o={name:"nucleus",ppm:"ppmFormat",hz:"hzFormat"};for(let r in e)t.push(N(e[r],o));return t}function q(e){if(e?.version===7)return e;let t={...e,version:7};return t?.settings&&(t.settings=C(t.settings,"nmrium")),t}function A(e,t="localStorage"){if(e?.version===8)return e;if(t==="nmrium")return ce(e);let o={...e,version:8};for(let r in e.workspaces)o.workspaces[r]=ce(o.workspaces[r]);return o}function ce(e){let{version:t,...o}=e,r={...o};return r.display.panels=ot(e),r}function ot(e){let t={},o=e.display.panels;for(let r of Object.keys(o)){let{display:i,open:n}=o[r];t[r]={display:i,visible:i,open:n}}return t}function H(e){if(e?.version===8)return e;let t={...e,version:8};t?.settings&&(t.settings=A(t.settings,"nmrium"));for(let o of t?.data?.spectra||[]){let{filters:r=[]}=o;for(let s=0;s<r.length;s++){let{flag:l,isDeleteAllow:a,label:p,...m}=r[s];r[s]={...m,enabled:l}}let i=r.findIndex(s=>s.name==="apodization");if(i!==-1){let s=r[i],{lineBroadening:l,gaussBroadening:a,lineBroadeningCenter:p}=s.value;s.value={exponential:{apply:!0,options:{lineBroadening:a>0?-l:l}}},a>0&&(s.value.gaussian={apply:!0,options:{lineBroadening:.6*a,lineBroadeningCenter:p}}),r[i]=s}let n=r.findIndex(s=>s.name==="apodizationDimension1"),c=r.findIndex(s=>s.name==="apodizationDimension2");if(n!==-1){let s=r[n],{shapes:l}=s.value.compose;s.value=ue(l)}if(c!==-1){let s=r[c],{shapes:l}=s.value.compose;s.value=ue(l)}}return t}function ue(e){let t={};for(let{shape:o}of e){let{kind:r,options:i}=o;if(r==="sineBell"){let{exponent:n,offset:c}=i,s=n===2?"sineSquare":"sineBell";t[s]={apply:!0,options:{offset:c}}}}return t}function Q(e){let{version:t,plugins:o,...r}=e;return t===9?e:{version:9,plugins:{},...r}}function ee(e){if(e?.version>=10)return e;let t={...e,version:10};if(e.data){let{source:o,spectra:r,...i}=e.data,n=o?x():void 0,c=o?[{...o,id:n}]:[];t.data={...i,sources:c,spectra:o?r?.map(s=>({...s,sourceId:n})):r}}return t}function te(e){let{version:t}=e;if(t>=11)return e;let o={...e,version:11};return e?.view?.molecules&&(o.view=it(e.view)),o}function it(e){let{molecules:t,...o}=e,r={};for(let[i,n]of Object.entries(t)){let{showAtomNumber:c,...s}=n;r[i]={...s,atomAnnotation:"none",showLabel:!1}}return{molecules:r,...o}}function re(e){if(e?.version>=12)return e;let t={...e,version:12};if(t.data){let o=e.data.spectra??[],r=e.data.molecules??[];for(let i of o){let{sourceId:n,fileCollectionId:c,sourceSelector:s}=i;delete i.sourceId,delete i.fileCollectionId,delete i.sourceSelector,s&&(i.selector={...s,root:c??n})}for(let i of r){let{sourceId:n,fileCollectionId:c,sourceSelector:s}=i;delete i.sourceId,delete i.fileCollectionId,delete i.sourceSelector,s&&(i.selector={...s,root:c??n})}}return t}function oe(e){if(e?.version>=13)return e;let t={...e,version:13};if(t.data){let o=e.data.spectra??[];for(let r of o){let i=r.ranges?.values??[];for(let n of i){let{diaIDs:c,assignment:s,nbAtoms:l,signals:a=[]}=n,p=a.some(m=>m.diaIDs&&m.diaIDs.length>0);for(let m of a)!p&&c&&l&&(m.diaIDs=c,m.nbAtoms=l),!m.assignment&&s&&(m.assignment=s);delete n.diaIDs,delete n.assignment,delete n.nbAtoms}}}return t}function ie(e){if(e?.version>=14)return e;let t={...e,version:14};if(e?.data?.spectra){let o=e.data.spectra??[],r={};for(let i of o){let{display:n={}}=i;if(!("contourOptions"in n))continue;let{contourOptions:c}=n;r[i.id]=c,delete i.display.contourOptions}Object.keys(r).length>0&&(t.view={...e.view,spectraContourLevels:r}),t.view&&delete t.view.zoom}return t}function I(e,t){e.plugins||(e.plugins={});let o=e.plugins;for(let r of t.values()){if(!r.shouldSerialize){delete o[r.id];continue}o[r.id]||(o[r.id]={id:r.id,version:r.version}),o[r.id].id=r.id,o[r.id].version=r.version}}var nt=[X,Y,Z,G,$,J,q,H,Q,ee,te,re,oe,ie];function pe(e,t,o){let r=structuredClone(e),i=Object.entries(e?.plugins??{});for(let[s,{version:l}]of i){let a=o.get(s);if(!(a&&a.version>=l)){if(a){console.warn(`Plugin "${a.id}" is loaded with a version older (${a.version}) than the one used to save the state (${l}).
|
|
2
2
|
NMRium may fail to load the state.
|
|
3
3
|
Please update the plugin to the latest version.`);continue}console.warn(`Plugin "${s}@${l}" is not registered. NMRium may fail to load the state.
|
|
4
|
-
Please consider open this file with the plugin installed.`)}}let n=new Set,c=()=>{let s=r.version;for(let l of o.values())for(let a of l.migrations){if(n.has(a)||s<a.minCore||a.maxCore&&s>a.maxCore)continue;if((r.plugins?.[l.id]?.version||0)===l.version)break;r=a.up(r),n.add(a)}};for(let s=e?.version||0;s<t;s++){let l=ot[s];r=l(r),c()}return c(),I(r,o),r}var it=["topbar.right","topbar.about_us.modal"],nt=[],eo=[...it,...nt],st={},ie={};at(st,ie);function at(e,t){for(let[o,r]of Object.entries(e))t[r]||(t[r]=[]),t[r]?.push(o)}function*pe(e){let{slot:t,plugins:o,supportedToDeprecatedSlots:r=ie}=e,i=r[t];for(let[n,c]of o.entries()){let s=c.ui;if(!s)continue;let l=s[t];if(l){yield[n,l];continue}if(i)for(let a of i){let p=c.ui?.[a];if(p){yield[n,p],console.warn(`Plugin ${c.id} used deprecated slot "${a}". Please update this plugin to use "${t}" instead.`);break}}}}import{FileCollection as ye}from"file-collection";var me={SDF:"sdf",MOL:"mol",NMRIUM:"nmrium",NMRIUM_ARCHIVE:"nmrium.zip",JSON:"json",JCAMP:"jcamp",DX:"dx",JDX:"jdx",JDF:"jdf",NMREDATA:"nmredata",SMILES:"smiles",SMI:"smi"};function w(e){return e.includes(".")?e.replace(/^.*\./,"").toLowerCase():""}function T(e,t={},o){let{data:r,...i}=e;if(!r)return e;let{spectra:n=[]}=r,{keep1D:c=!0,keep2D:s=!0,onlyReal:l}=t,a=l?"ft":t.dataSelection||"both",p=[];for(let m of n){if(!m.info){p.push(m);continue}let{isFid:u,dimension:f,name:d}=m.info;if(!F(f===1&&!c,d,o)&&!F(f===2&&!s,d,o)&&!F(u&&a==="ft",d,o)&&!F(!u&&a==="fid",d,o))if(l&&!u)if(m.info.isComplex=!1,lt(m)){let{rr:g}=m.data;p.push({...m,data:{rr:g}})}else{let{re:g,x:S}=m.data;p.push({...m,data:{re:g,x:S}})}else p.push(m)}return{data:{...r,spectra:p},...i}}function F(e,t,o){return e?(o?.warn(`Skipping ${t} because it didn't match the import filters.`),!0):!1}function lt(e){let{info:t}=e;return t?.dimension===2}function E(e){let{nmriumState:t,plugins:o,options:r}=e;for(let i of o.values()){let n=i.onReadProcess?.onProcessing;n&&n(t,r)}}async function L(e,t,o={}){let{selector:r,converter:i,logger:n}=o,c=[],s=[];for(let u of t.values()){let{onReadProcess:f}=u;f&&(f?.onFiles&&c.push(u),f?.supportedExtensions?.length&&f?.onFile&&s.push(u))}let l=await Promise.allSettled(c.map(u=>u.onReadProcess.onFiles(e,o))),a=[],p=await Promise.allSettled(e.files.flatMap(u=>{let f=w(u.name).toLowerCase();return s.flatMap(d=>{let{supportedExtensions:g,onFile:S}=d.onReadProcess;return g.includes(f)?(a.push({file:u,plugin:d}),S(u,{logger:n,selector:r,converter:i})):[]})})),m={spectra:[],molecules:[]};for(let u=0;u<l.length;u++){let f=l[u];switch(f.status){case"fulfilled":{let{spectra:d=[],molecules:g=[]}=f.value||{};m.spectra.push(...d),m.molecules.push(...g);break}case"rejected":{let d=f.reason,g=c[u];o.logger?.error(`Load file collection with plugin ${g.id}@${g.version} fails with: ${d}`);break}}}for(let u=0;u<p.length;u++){let f=p[u];switch(f.status){case"fulfilled":{let{spectra:d=[],molecules:g=[]}=f.value||{};m.spectra.push(...d),m.molecules.push(...g);break}case"rejected":{let d=f.reason,{file:g,plugin:S}=a[u];o.logger?.error(`Load file ${g.relativePath} with plugin ${S.id}@${S.version} fails with: ${d}`);break}}}return m}import{FileCollection as Se}from"file-collection";import{FileCollection as ge}from"file-collection";import fe from"lodash.merge";import{xIsEquallySpaced as ct}from"ml-spectra-processing";async function z(e){let{input:t,spectraResult:o,unserializedSpectrum:r,options:i,plugins:n,migrator:c}=e,l=(await D({input:t,migrator:c,plugins:n,options:{...i,selector:r.selector}}))?.state?.data?.spectra??[],a=l.pop();if(a){o.push(de(r,a));for(let p of l)o.push(de(r,ut(p)))}}function de(e,t){let{data:o,...r}=e;if(!t.selector?.root&&e.selector?.root&&(t.selector??=e.selector,t.selector.root=e.selector.root),"ranges"in t){let{data:i,...n}=t;return{...fe(n,r),data:i}}else if("zones"in t){let{data:i,...n}=t;return{...fe(n,r),data:i}}else return t}function ut(e){return{...e,id:x()}}function k(e){let{spectrum:t,spectraResult:o,logger:r}=e,{dimension:i}=t.info;if(i===1){if(!ct(t.data)){r?.error('The ".nmrium" file is corrupted; the X-axis values are not equally distant.');return}o.push(O(t))}else i===2&&o.push(M(t))}async function U(e){let{input:t,moleculesResult:o,unserializedMolecule:r,options:i,plugins:n,migrator:c}=e,{selector:s}=r,a=(await D({input:t,migrator:c,plugins:n,options:{...i,selector:s}}))?.state?.data?.molecules??[];for(let p of a)!p.selector?.root&&s?.root&&(p.selector??=s,p.selector.root=s.root),o.push({...r,...p})}function V(e){let{molecule:t,moleculesResult:o}=e;o.push(t)}async function j(e){let{nmriumObjectInput:t,options:o={},migrator:r,plugins:i,fromSourceOptions:n}=e,c=r(t),{data:s,...l}=c,a=new ge;if(!s)return{state:l,aggregator:a,containsNmrium:!0};let p={data:{...s,spectra:[],molecules:[]},...l},m=p.data,{sources:u=[],spectra:f,molecules:d}=m,g=await Promise.all(u.map(async P=>{let h=await ge.fromSource(P,{unzip:{zipExtensions:["zip","nmredata"]}},n);if(!P.baseURL)for(let R of P.entries)R.baseURL||(R.baseURL=n?.baseURL);return[P.id,h]})),S=new Map(g),y=[];for(let P of s.spectra){let h=P.selector?.root??"",R=S.get(h);if(!R){k({spectrum:P,spectraResult:f,logger:o.logger});continue}y.push(z({input:R,spectraResult:f,unserializedSpectrum:P,migrator:r,plugins:i,options:o}))}for(let P of s.molecules??[]){let h=P.selector?.root??"",R=S.get(h);if(!R){V({molecule:P,moleculesResult:d,logger:o.logger});continue}y.push(U({input:R,unserializedMolecule:P,moleculesResult:d,migrator:r,plugins:i,options:o}))}await Promise.allSettled(y);for(let[P,h]of S.entries())a.appendFileCollection(h,P);return{state:p,aggregator:a,containsNmrium:!0}}async function _(e){let{file:t,options:o={},migrator:r,plugins:i,fromSourceOptions:n}=e,c="byteLength"in t?t:await t.arrayBuffer(),s=Se.isZip(c)?await pt(c):new TextDecoder("utf-8").decode(c);return j({nmriumObjectInput:JSON.parse(s),plugins:i,migrator:r,options:o,fromSourceOptions:n})}async function pt(e){let t=await Se.fromZip(e);if(t.files.length===0)throw new Error("compressed nmrium file is corrupted");return t.files[0].text()}async function D(e){let{options:t={},input:o,migrator:r,plugins:i,fromSourceOptions:n}=e,{selectorRoot:c=x()}=t,s=dt(await mt(o),t.selector?.files),l=gt(s);if(l)return await _({file:l,migrator:r,plugins:i,options:t,fromSourceOptions:n});let a=await L(s,i,t),p=T({version:13,data:a},t?.selector?.general,t.logger),{onLoadProcessing:m,experimentalFeatures:u}=t,f={...m,autoProcessing:m?.autoProcessing??!1,experimentalFeatures:u};E({nmriumState:p,plugins:i,options:f}),St(p,c);let d=new ye().appendFileCollection(s,c);return{state:p,aggregator:d,containsNmrium:!1}}function mt(e){return Array.isArray(e)?Promise.reject(new Error("For a set of fileCollectionItems pass a FileCollection instance")):ft(e)?Promise.resolve(e):new ye().appendExtendedSource({...e,uuid:x()})}function ft(e){return typeof e=="object"&&"files"in e}function dt(e,t){if(!t)return e;let o=new Set(t);return e.filter(r=>o.has(r.relativePath))}function gt(e){return e.files.find(t=>w(t.name).toLowerCase()===me.NMRIUM)}function St(e,t){for(let o of e.data?.spectra??[])o.selector?.root||(o.selector??={root:t},o.selector.root||=t);for(let o of e.data?.molecules??[])o.selector?.root||(o.selector??={root:t},o.selector.root||=t)}import{FileCollection as Pt}from"file-collection";async function Pe(e){let t={},o=[];for(let r of e.sources)switch(r.relativePath){case"META-INF/NMRIUM_ARCHIVE":t.archive=r;break;case"META-INF/VERSION":o.push(r.text().then(i=>{t.version=Number.parseInt(i,10)}));break;case"state.json":o.push(r.text().then(i=>{t.state=JSON.parse(i)}));break;default:}return await Promise.all(o),t}function xe(e){if(!e.archive)throw new Error("Not a valid NMRium archive");if(typeof e.version!="number"||Number.isNaN(e.version))throw new Error("Not a valid NMRium archive, no version specified");if(e.version===0)throw new Error("NMRium Archive generated behind experimental flag are not supported.");if(!e.state)throw new Error("NMRium Archive corrupted, state.json is missing")}function he(e){return e.filter(t=>!yt(t.relativePath))}function yt(e){return e.startsWith("META-INF/")||e==="state.json"||e==="index.txt"}async function Ne(e){let{options:t,plugins:o,migrator:r}=e,i=await Pt.fromIum(e.input),n=await Pe(i);xe(n);let c=he(i),s=r(n.state),l={...s,data:{...s.data,spectra:[],molecules:[]}},a=l.data.spectra,p=l.data.molecules,m=s.data?.spectra??[],u=s.data?.molecules??[],f=xt(i),d=[];for(let g of m)d.push(ht({subRoots:f,unserializedSpectrum:g,spectraResult:a,options:t,plugins:o,migrator:r}));for(let g of u)d.push(Nt({subRoots:f,unserializedMolecule:g,moleculesResult:p,options:t,plugins:o,migrator:r}));return await Promise.allSettled(d),{state:l,aggregator:c,containsNmrium:!0}}function xt(e){let t=new Map;return{get(o){let r=t.get(o);return r||(r=e.subroot(o),t.set(o,r)),r},[Symbol("debug")]:{ium:e,views:t}}}async function ht(e){let{subRoots:t}=e,{unserializedSpectrum:o,spectraResult:r}=e,{options:i,plugins:n,migrator:c}=e,{selector:s}=o,l=await be({subRoots:t,selector:s});if(!l)return k({spectrum:o,spectraResult:r,logger:i?.logger});await z({input:l,unserializedSpectrum:o,spectraResult:r,options:i,plugins:n,migrator:c})}async function Nt(e){let{subRoots:t}=e,{unserializedMolecule:o,moleculesResult:r}=e,{options:i,plugins:n,migrator:c}=e,{selector:s}=o,l=await be({subRoots:t,selector:s});if(!l)return V({molecule:o,moleculesResult:r,logger:i?.logger});await U({input:l,unserializedMolecule:o,moleculesResult:r,options:i,plugins:n,migrator:c})}async function be(e){let{subRoots:t,selector:o}=e;if(!o)return;let{root:r}=o;if(r)return t.get(r)}import{FileCollection as Re}from"file-collection";async function Oe(e){let{source:t,plugins:o,options:r={}}=e,{converter:i,...n}=r,{selectorRoot:c=x()}=r,s={...t,id:c},l={spectra:[],molecules:[]},a=await Re.fromSource(s,{unzip:{zipExtensions:["zip","nmredata"]}}),{spectra:p=[],molecules:m=[]}=await L(a,o,{converter:{...i,bruker:{keepFiles:!0,...Reflect.get(i??{},"bruker")}},...n});l.spectra.push(...p),l.molecules.push(...m);for(let S of l.spectra)S.selector??={root:c},S.selector.root=c;for(let S of l.molecules)S.selector??={root:c},S.selector.root=c;l.sources??=[],l.sources.push(s);let u=T({version:13,data:l},r?.selector?.general),{onLoadProcessing:f}=n,d={filters:f?.filters,autoProcessing:f?.autoProcessing??!1,experimentalFeatures:r.experimentalFeatures};E({nmriumState:u,plugins:o,options:d});let g=new Re().appendFileCollection(a,c);return{state:u,aggregator:g,containsNmrium:!1}}function v(e,t){let o={};for(let r in e)t.includes(r)||(o[r]=e[r]);return o}var bt=["data","originalData","info","originalInfo","meta","customInfo"],Rt=["data","originalData","info","originalInfo","meta","customInfo"],Ot=["selector","originalData","originalInfo"];function Ie(e,t,o={}){let{version:r,data:i}=e;if(i.actionType)return e;let n={version:r,plugins:e.plugins},{includeData:c,forceRawSpectra:s=[]}=o;c!=="noData"&&(n.data=It({...i},c,s));let{includeSettings:l,includeView:a}=o;return l&&(n.settings=e.settings),a&&(n.view=e.view),I(n,t),n}function It(e,t="rawData",o){let{spectra:r}=e;switch(t){case"dataSource":return Dt(e);case"selfContained":case"selfContainedExternalDatasource":return vt(e,o);case"rawData":return{...v(e,["sources"]),spectra:r.map(De)};default:return e}}function Dt(e){let{spectra:t}=e;if(!e.sources)throw new Error("sources property should exists for dataSource serialization");return{...e,spectra:t.map(Mt)}}function vt(e,t){let{spectra:o,sources:r,...i}=e;return{...i,spectra:o.map(n=>Ct(n,t))}}function Mt(e){return v(e,bt)}function Ct(e,t){return!("selector"in e)||t?.includes(e.id)?De(e):v(e,Rt)}function De(e){let{data:t,info:o,originalData:r,originalInfo:i}=e,n=v(e,Ot);return n.data=r||t,n.info=i||o,n}import{FileCollection as At}from"file-collection";async function ve(e,t){let{state:o,aggregator:r,externalData:i="embedded",includeData:n=!0,includeSettings:c,includeView:s}=t,{spectra:l,molecules:a}=o.data,p=new At({filter:{ignoreDotfiles:!1}});return n&&p.appendFileCollection(r),p.toIum({includeData:i==="embedded",mimetype:"chemical/x-nmrium+zip",*getExtraFiles(m){yield{relativePath:"META-INF/NMRIUM_ARCHIVE",data:""},yield{relativePath:"META-INF/VERSION",data:"1"},yield{relativePath:"state.json",data:wt(e,o,r,{externalData:i,includeData:n,includeView:s,includeSettings:c})},yield{relativePath:"index.txt",data:Ft({aggregator:r,spectra:l,molecules:a,index:m})}}})}function wt(e,t,o,r){let{includeData:i,includeView:n,includeSettings:c,externalData:s="embedded"}=r,l="noData";i&&(l=s==="embedded"?"selfContained":"selfContainedExternalDatasource");let a=[];if(l!=="noData")for(let u of t.data?.spectra??[]){let f=u.selector?.root;f&&o.subroot(f).files.length>0||a.push(u.id)}let p=e(t,{includeData:l,includeView:n,includeSettings:c,forceRawSpectra:a}),m=JSON.stringify(p,(u,f)=>ArrayBuffer.isView(f)?Array.from(f):f,2);return new Blob([m],{type:"application/json"})}function Ft(e){let{aggregator:t,spectra:o,molecules:r,index:i}=e,n=new Map,c=new Map(i.sources.map(l=>[l.uuid,l]));for(let l of o){let a=l.selector?.root;a&&(n.has(a)||n.set(a,t.subroot(a)))}for(let l of r){let a=l.selector?.root;a&&(n.has(a)||n.set(a,t.subroot(a)))}let s=[];for(let[l,a]of n.entries()){let p=new Map(a.sources.map(u=>[u.uuid,u])),m=`data/${l}/`;s.push(m);for(let u of a.files){let f=c.get(u.sourceUUID),d=p.get(u.sourceUUID),g=f?.baseURL?.startsWith("ium:/")?"embedded":"linked",y=i.paths[u.sourceUUID]?.replace(m,""),P=u.relativePath.replace(d?.relativePath??"",""),h=y?y+P:u.relativePath;s.push(` ${h} (${g})`)}s.push(`
|
|
4
|
+
Please consider open this file with the plugin installed.`)}}let n=new Set,c=()=>{let s=r.version;for(let l of o.values())for(let a of l.migrations){if(n.has(a)||s<a.minCore||a.maxCore&&s>a.maxCore)continue;if((r.plugins?.[l.id]?.version||0)===l.version)break;r=a.up(r),n.add(a)}};for(let s=e?.version||0;s<t;s++){let l=nt[s];r=l(r),c()}return c(),I(r,o),r}var st=["topbar.right","topbar.about_us.modal"],at=[],so=[...st,...at],lt={},ne={};ct(lt,ne);function ct(e,t){for(let[o,r]of Object.entries(e))t[r]||(t[r]=[]),t[r]?.push(o)}function*me(e){let{slot:t,plugins:o,supportedToDeprecatedSlots:r=ne}=e,i=r[t];for(let[n,c]of o.entries()){let s=c.ui;if(!s)continue;let l=s[t];if(l){yield[n,l];continue}if(i)for(let a of i){let p=c.ui?.[a];if(p){yield[n,p],console.warn(`Plugin ${c.id} used deprecated slot "${a}". Please update this plugin to use "${t}" instead.`);break}}}}import{FileCollection as Pe}from"file-collection";var fe={SDF:"sdf",MOL:"mol",NMRIUM:"nmrium",NMRIUM_ARCHIVE:"nmrium.zip",JSON:"json",JCAMP:"jcamp",DX:"dx",JDX:"jdx",JDF:"jdf",NMREDATA:"nmredata",SMILES:"smiles",SMI:"smi"};function w(e){return e.includes(".")?e.replace(/^.*\./,"").toLowerCase():""}function T(e,t={},o){let{data:r,...i}=e;if(!r)return e;let{spectra:n=[]}=r,{keep1D:c=!0,keep2D:s=!0,onlyReal:l}=t,a=l?"ft":t.dataSelection||"both",p=[];for(let m of n){if(!m.info){p.push(m);continue}let{isFid:u,dimension:f,name:d}=m.info;if(!F(f===1&&!c,d,o)&&!F(f===2&&!s,d,o)&&!F(u&&a==="ft",d,o)&&!F(!u&&a==="fid",d,o))if(l&&!u)if(m.info.isComplex=!1,ut(m)){let{rr:g}=m.data;p.push({...m,data:{rr:g}})}else{let{re:g,x:S}=m.data;p.push({...m,data:{re:g,x:S}})}else p.push(m)}return{data:{...r,spectra:p},...i}}function F(e,t,o){return e?(o?.warn(`Skipping ${t} because it didn't match the import filters.`),!0):!1}function ut(e){let{info:t}=e;return t?.dimension===2}function E(e){let{nmriumState:t,plugins:o,options:r}=e;for(let i of o.values()){let n=i.onReadProcess?.onProcessing;n&&n(t,r)}}async function L(e,t,o={}){let{selector:r,converter:i,logger:n}=o,c=[],s=[];for(let u of t.values()){let{onReadProcess:f}=u;f&&(f?.onFiles&&c.push(u),f?.supportedExtensions?.length&&f?.onFile&&s.push(u))}let l=await Promise.allSettled(c.map(u=>u.onReadProcess.onFiles(e,o))),a=[],p=await Promise.allSettled(e.files.flatMap(u=>{let f=w(u.name).toLowerCase();return s.flatMap(d=>{let{supportedExtensions:g,onFile:S}=d.onReadProcess;return g.includes(f)?(a.push({file:u,plugin:d}),S(u,{logger:n,selector:r,converter:i})):[]})})),m={spectra:[],molecules:[]};for(let u=0;u<l.length;u++){let f=l[u];switch(f.status){case"fulfilled":{let{spectra:d=[],molecules:g=[]}=f.value||{};m.spectra.push(...d),m.molecules.push(...g);break}case"rejected":{let d=f.reason,g=c[u];o.logger?.error(`Load file collection with plugin ${g.id}@${g.version} fails with: ${d}`);break}}}for(let u=0;u<p.length;u++){let f=p[u];switch(f.status){case"fulfilled":{let{spectra:d=[],molecules:g=[]}=f.value||{};m.spectra.push(...d),m.molecules.push(...g);break}case"rejected":{let d=f.reason,{file:g,plugin:S}=a[u];o.logger?.error(`Load file ${g.relativePath} with plugin ${S.id}@${S.version} fails with: ${d}`);break}}}return m}import{FileCollection as ye}from"file-collection";import{FileCollection as Se}from"file-collection";import de from"lodash.merge";import{xIsEquallySpaced as pt}from"ml-spectra-processing";async function k(e){let{input:t,spectraResult:o,unserializedSpectrum:r,options:i,plugins:n,migrator:c}=e,l=(await v({input:t,migrator:c,plugins:n,options:{...i,selector:r.selector}}))?.state?.data?.spectra??[],a=l.pop();if(a){o.push(ge(r,a));for(let p of l)o.push(ge(r,mt(p)))}}function ge(e,t){let{data:o,...r}=e;if(!t.selector?.root&&e.selector?.root&&(t.selector??=e.selector,t.selector.root=e.selector.root),"ranges"in t){let{data:i,...n}=t;return{...de(n,r),data:i}}else if("zones"in t){let{data:i,...n}=t;return{...de(n,r),data:i}}else return t}function mt(e){return{...e,id:x()}}function z(e){let{spectrum:t,spectraResult:o,logger:r}=e,{dimension:i}=t.info;if(i===1){if(!pt(t.data)){r?.error('The ".nmrium" file is corrupted; the X-axis values are not equally distant.');return}o.push(O(t))}else i===2&&o.push(M(t))}async function U(e){let{input:t,moleculesResult:o,unserializedMolecule:r,options:i,plugins:n,migrator:c}=e,{selector:s}=r,a=(await v({input:t,migrator:c,plugins:n,options:{...i,selector:s}}))?.state?.data?.molecules??[];for(let p of a)!p.selector?.root&&s?.root&&(p.selector??=s,p.selector.root=s.root),o.push({...r,...p})}function V(e){let{molecule:t,moleculesResult:o}=e;o.push(t)}async function j(e){let{nmriumObjectInput:t,options:o={},migrator:r,plugins:i,fromSourceOptions:n}=e,c=r(t),{data:s,...l}=c,a=new Se;if(!s)return{state:l,aggregator:a,containsNmrium:!0};let p={data:{...s,spectra:[],molecules:[]},...l},m=p.data,{sources:u=[],spectra:f,molecules:d}=m,g=await Promise.all(u.map(async P=>{let h=await Se.fromSource(P,{unzip:{zipExtensions:["zip","nmredata"]}},n);if(!P.baseURL)for(let R of P.entries)R.baseURL||(R.baseURL=n?.baseURL);return[P.id,h]})),S=new Map(g),y=[];for(let P of s.spectra){let h=P.selector?.root??"",R=S.get(h);if(!R){z({spectrum:P,spectraResult:f,logger:o.logger});continue}y.push(k({input:R,spectraResult:f,unserializedSpectrum:P,migrator:r,plugins:i,options:o}))}for(let P of s.molecules??[]){let h=P.selector?.root??"",R=S.get(h);if(!R){V({molecule:P,moleculesResult:d,logger:o.logger});continue}y.push(U({input:R,unserializedMolecule:P,moleculesResult:d,migrator:r,plugins:i,options:o}))}await Promise.allSettled(y);for(let[P,h]of S.entries())a.appendFileCollection(h,P);return{state:p,aggregator:a,containsNmrium:!0}}async function _(e){let{file:t,options:o={},migrator:r,plugins:i,fromSourceOptions:n}=e,c="byteLength"in t?t:await t.arrayBuffer(),s=ye.isZip(c)?await ft(c):new TextDecoder("utf-8").decode(c);return j({nmriumObjectInput:JSON.parse(s),plugins:i,migrator:r,options:o,fromSourceOptions:n})}async function ft(e){let t=await ye.fromZip(e);if(t.files.length===0)throw new Error("compressed nmrium file is corrupted");return t.files[0].text()}async function v(e){let{options:t={},input:o,migrator:r,plugins:i,fromSourceOptions:n}=e,{selectorRoot:c=x()}=t,s=St(await dt(o),t.selector?.files),l=yt(s);if(l)return await _({file:l,migrator:r,plugins:i,options:t,fromSourceOptions:n});let a=await L(s,i,t),p=T({version:14,data:a},t?.selector?.general,t.logger),{onLoadProcessing:m,experimentalFeatures:u}=t,f={...m,autoProcessing:m?.autoProcessing??!1,experimentalFeatures:u};E({nmriumState:p,plugins:i,options:f}),Pt(p,c);let d=new Pe().appendFileCollection(s,c);return{state:p,aggregator:d,containsNmrium:!1}}function dt(e){return Array.isArray(e)?Promise.reject(new Error("For a set of fileCollectionItems pass a FileCollection instance")):gt(e)?Promise.resolve(e):new Pe().appendExtendedSource({...e,uuid:x()})}function gt(e){return typeof e=="object"&&"files"in e}function St(e,t){if(!t)return e;let o=new Set(t);return e.filter(r=>o.has(r.relativePath))}function yt(e){return e.files.find(t=>w(t.name).toLowerCase()===fe.NMRIUM)}function Pt(e,t){for(let o of e.data?.spectra??[])o.selector?.root||(o.selector??={root:t},o.selector.root||=t);for(let o of e.data?.molecules??[])o.selector?.root||(o.selector??={root:t},o.selector.root||=t)}import{FileCollection as ht}from"file-collection";async function xe(e){let t={},o=[];for(let r of e.sources)switch(r.relativePath){case"META-INF/NMRIUM_ARCHIVE":t.archive=r;break;case"META-INF/VERSION":o.push(r.text().then(i=>{t.version=Number.parseInt(i,10)}));break;case"state.json":o.push(r.text().then(i=>{t.state=JSON.parse(i)}));break;default:}return await Promise.all(o),t}function he(e){if(!e.archive)throw new Error("Not a valid NMRium archive");if(typeof e.version!="number"||Number.isNaN(e.version))throw new Error("Not a valid NMRium archive, no version specified");if(e.version===0)throw new Error("NMRium Archive generated behind experimental flag are not supported.");if(!e.state)throw new Error("NMRium Archive corrupted, state.json is missing")}function be(e){return e.filter(t=>!xt(t.relativePath))}function xt(e){return e.startsWith("META-INF/")||e==="state.json"||e==="index.txt"}async function Ne(e){let{options:t,plugins:o,migrator:r}=e,i=await ht.fromIum(e.input),n=await xe(i);he(n);let c=be(i),s=r(n.state),l={...s,data:{...s.data,spectra:[],molecules:[]}},a=l.data.spectra,p=l.data.molecules,m=s.data?.spectra??[],u=s.data?.molecules??[],f=bt(i),d=[];for(let g of m)d.push(Nt({subRoots:f,unserializedSpectrum:g,spectraResult:a,options:t,plugins:o,migrator:r}));for(let g of u)d.push(Rt({subRoots:f,unserializedMolecule:g,moleculesResult:p,options:t,plugins:o,migrator:r}));return await Promise.allSettled(d),{state:l,aggregator:c,containsNmrium:!0}}function bt(e){let t=new Map;return{get(o){let r=t.get(o);return r||(r=e.subroot(o),t.set(o,r)),r},[Symbol("debug")]:{ium:e,views:t}}}async function Nt(e){let{subRoots:t}=e,{unserializedSpectrum:o,spectraResult:r}=e,{options:i,plugins:n,migrator:c}=e,{selector:s}=o,l=await Re({subRoots:t,selector:s});if(!l)return z({spectrum:o,spectraResult:r,logger:i?.logger});await k({input:l,unserializedSpectrum:o,spectraResult:r,options:i,plugins:n,migrator:c})}async function Rt(e){let{subRoots:t}=e,{unserializedMolecule:o,moleculesResult:r}=e,{options:i,plugins:n,migrator:c}=e,{selector:s}=o,l=await Re({subRoots:t,selector:s});if(!l)return V({molecule:o,moleculesResult:r,logger:i?.logger});await U({input:l,unserializedMolecule:o,moleculesResult:r,options:i,plugins:n,migrator:c})}async function Re(e){let{subRoots:t,selector:o}=e;if(!o)return;let{root:r}=o;if(r)return t.get(r)}import{FileCollection as Oe}from"file-collection";async function Ie(e){let{source:t,plugins:o,options:r={}}=e,{converter:i,...n}=r,{selectorRoot:c=x()}=r,s={...t,id:c},l={spectra:[],molecules:[]},a=await Oe.fromSource(s,{unzip:{zipExtensions:["zip","nmredata"]}}),{spectra:p=[],molecules:m=[]}=await L(a,o,{converter:{...i,bruker:{keepFiles:!0,...Reflect.get(i??{},"bruker")}},...n});l.spectra.push(...p),l.molecules.push(...m);for(let S of l.spectra)S.selector??={root:c},S.selector.root=c;for(let S of l.molecules)S.selector??={root:c},S.selector.root=c;l.sources??=[],l.sources.push(s);let u=T({version:14,data:l},r?.selector?.general),{onLoadProcessing:f}=n,d={filters:f?.filters,autoProcessing:f?.autoProcessing??!1,experimentalFeatures:r.experimentalFeatures};E({nmriumState:u,plugins:o,options:d});let g=new Oe().appendFileCollection(a,c);return{state:u,aggregator:g,containsNmrium:!1}}function D(e,t){let o={};for(let r in e)t.includes(r)||(o[r]=e[r]);return o}var Ot=["data","originalData","info","originalInfo","meta","customInfo"],It=["data","originalData","info","originalInfo","meta","customInfo"],vt=["selector","originalData","originalInfo"];function ve(e,t,o={}){let{version:r,data:i}=e;if(i.actionType)return e;let n={version:r,plugins:e.plugins},{includeData:c,forceRawSpectra:s=[]}=o;c!=="noData"&&(n.data=Dt({...i},c,s));let{includeSettings:l,includeView:a}=o;return l&&(n.settings=e.settings),a&&(n.view=e.view),I(n,t),n}function Dt(e,t="rawData",o){let{spectra:r}=e;switch(t){case"dataSource":return Mt(e);case"selfContained":case"selfContainedExternalDatasource":return Ct(e,o);case"rawData":return{...D(e,["sources"]),spectra:r.map(De)};default:return e}}function Mt(e){let{spectra:t}=e;if(!e.sources)throw new Error("sources property should exists for dataSource serialization");return{...e,spectra:t.map(At)}}function Ct(e,t){let{spectra:o,sources:r,...i}=e;return{...i,spectra:o.map(n=>wt(n,t))}}function At(e){return D(e,Ot)}function wt(e,t){return!("selector"in e)||t?.includes(e.id)?De(e):D(e,It)}function De(e){let{data:t,info:o,originalData:r,originalInfo:i}=e,n=D(e,vt);return n.data=r||t,n.info=i||o,n}import{FileCollection as Ft}from"file-collection";async function Me(e,t){let{state:o,aggregator:r,externalData:i="embedded",includeData:n=!0,includeSettings:c,includeView:s}=t,{spectra:l,molecules:a}=o.data,p=new Ft({filter:{ignoreDotfiles:!1}});return n&&p.appendFileCollection(r),p.toIum({includeData:i==="embedded",mimetype:"chemical/x-nmrium+zip",*getExtraFiles(m){yield{relativePath:"META-INF/NMRIUM_ARCHIVE",data:""},yield{relativePath:"META-INF/VERSION",data:"1"},yield{relativePath:"state.json",data:Tt(e,o,r,{externalData:i,includeData:n,includeView:s,includeSettings:c})},yield{relativePath:"index.txt",data:Et({aggregator:r,spectra:l,molecules:a,index:m})}}})}function Tt(e,t,o,r){let{includeData:i,includeView:n,includeSettings:c,externalData:s="embedded"}=r,l="noData";i&&(l=s==="embedded"?"selfContained":"selfContainedExternalDatasource");let a=[];if(l!=="noData")for(let u of t.data?.spectra??[]){let f=u.selector?.root;f&&o.subroot(f).files.length>0||a.push(u.id)}let p=e(t,{includeData:l,includeView:n,includeSettings:c,forceRawSpectra:a}),m=JSON.stringify(p,(u,f)=>ArrayBuffer.isView(f)?Array.from(f):f,2);return new Blob([m],{type:"application/json"})}function Et(e){let{aggregator:t,spectra:o,molecules:r,index:i}=e,n=new Map,c=new Map(i.sources.map(l=>[l.uuid,l]));for(let l of o){let a=l.selector?.root;a&&(n.has(a)||n.set(a,t.subroot(a)))}for(let l of r){let a=l.selector?.root;a&&(n.has(a)||n.set(a,t.subroot(a)))}let s=[];for(let[l,a]of n.entries()){let p=new Map(a.sources.map(u=>[u.uuid,u])),m=`data/${l}/`;s.push(m);for(let u of a.files){let f=c.get(u.sourceUUID),d=p.get(u.sourceUUID),g=f?.baseURL?.startsWith("ium:/")?"embedded":"linked",y=i.paths[u.sourceUUID]?.replace(m,""),P=u.relativePath.replace(d?.relativePath??"",""),h=y?y+P:u.relativePath;s.push(` ${h} (${g})`)}s.push(`
|
|
5
5
|
`)}return s.join(`
|
|
6
|
-
`)}var
|
|
6
|
+
`)}var se=class{version=14;#e=new Map;registerPlugin(t){if(this.#e.has(t.id)){console.warn(`Plugin ${t.id} is already registered. skip.`),console.debug("Plugin already registered:",this.#e.get(t.id)),console.debug("Plugin to register:",t);return}this.#e.set(t.id,t)}registerPlugins(t){for(let o of t)this.registerPlugin(o)}getPlugin(t){return this.#e.get(t)}migrate(t){return pe(t,this.version,this.#e)}read(t,o={},r){return v({input:t,options:o,fromSourceOptions:r,migrator:this.migrate.bind(this),plugins:this.#e})}readNMRiumArchive(t,o={}){return Ne({input:t,options:o,plugins:this.#e,migrator:this.migrate.bind(this)})}readNMRiumObject(t,o,r){return j({nmriumObjectInput:t,options:o,fromSourceOptions:r,plugins:this.#e,migrator:this.migrate.bind(this)})}readNMRiumFile(t,o={},r){return _({file:t,options:o,fromSourceOptions:r,plugins:this.#e,migrator:this.migrate.bind(this)})}readFromWebSource(t,o){return Ie({source:t,options:o,plugins:this.#e})}serializeNmriumState(t,o){return ve(t,this.#e,o)}serializeNmriumArchive(t){let o=this.serializeNmriumState.bind(this);return Me(o,t)}serializePlugins(){let t={plugins:{}};return I(t,this.#e),t.plugins}slot(t){return me({slot:t,plugins:this.#e})}};function Lt(e,t){if(t>14)return 0;let o=-1;for(let r=0;r<e.length;r++)if(e[r].version>t){o=r;break}return o}var Ce=[{version:6,fun:C},{version:7,fun:A}];function kt(e){let{version:t}=e||{},o=Lt(Ce,t);if(o===-1)return{...e,version:14};let r=Ce.slice(o);for(let i of r)e=i.fun(e);return e}export{Ae as ANALYSIS_COLUMN_TYPES,we as ANALYSIS_COLUMN_VALUES_KEYS,b as CURRENT_EXPORT_VERSION,Ee as EXTERNAL_API_KEYS,se as NMRiumCore,Te as axisUnits,qe as defineNMRiumPlugin,Je as formatSpectra,x as generateID,W as getOneIfArray,kt as migrateSettings,Fe as units};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakodium/nmrium-core",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "The core of NMRium: types, state, state migration and plugin system.",
|
|
5
5
|
"author": "Zakodium Sàrl",
|
|
6
6
|
"license": "CC-BY-NC-SA-4.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"volta": {
|
|
48
48
|
"extends": "../../../package.json"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "84856d26abf1da37fdb9e8f28c5d358ddd8ccebc"
|
|
51
51
|
}
|