@betteroffice/xlsx 0.0.4 → 0.0.5
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/generated/xlsx_wasm_bg.wasm +0 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
Binary file
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,10 @@ interface EditResult {
|
|
|
60
60
|
applied: boolean;
|
|
61
61
|
sheetInfo: SheetInfo;
|
|
62
62
|
changed?: string[];
|
|
63
|
+
limitedCells?: string[];
|
|
64
|
+
}
|
|
65
|
+
interface CalculationStatus {
|
|
66
|
+
limitedCells: string[];
|
|
63
67
|
}
|
|
64
68
|
/**
|
|
65
69
|
* The editable view of one cell: A1 address, the exact string the user would
|
|
@@ -126,6 +130,7 @@ declare class StaleProposalError extends Error {
|
|
|
126
130
|
*/
|
|
127
131
|
interface WorkbookHandle {
|
|
128
132
|
sheetInfo(): SheetInfo;
|
|
133
|
+
calculationStatus(): CalculationStatus;
|
|
129
134
|
displayList(viewport: Viewport): DisplayList;
|
|
130
135
|
setActiveSheet(index: number): void;
|
|
131
136
|
/**
|
|
@@ -215,4 +220,4 @@ declare function openWorkbook(bytes: Uint8Array): WorkbookHandle;
|
|
|
215
220
|
*/
|
|
216
221
|
declare function wasmVersion(): string;
|
|
217
222
|
|
|
218
|
-
export { type CellEdit, type CellInputEdit, DisplayList, type EditResult, type Proposal, type ProposalCell, type ProposalEdit, type SheetInfo, StaleProposalError, type Viewport, type WasmInitInput, type WorkbookHandle, initWasm, isPngExportAvailable, isProposalsAvailable, isWasmAvailable, openWorkbook, paintDisplayList, wasmVersion };
|
|
223
|
+
export { type CalculationStatus, type CellEdit, type CellInputEdit, DisplayList, type EditResult, type Proposal, type ProposalCell, type ProposalEdit, type SheetInfo, StaleProposalError, type Viewport, type WasmInitInput, type WorkbookHandle, initWasm, isPngExportAvailable, isProposalsAvailable, isWasmAvailable, openWorkbook, paintDisplayList, wasmVersion };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-VVLZGZMW.js';export{t as buildA11yGrid,o as cellAtPoint,k as cellCount,p as cellRect,f as clampScroll,l as extendTo,s as fromTsv,m as moveFocus,i as normalizeRange,j as rangeContains,q as rangeRect,h as selectionAt,n as selectionKeyReducer,r as toTsv,c as totalExtent,b as trackCount,g as uniformOffsets,e as visibleCells,d as visibleRange}from'./chunk-VVLZGZMW.js';var Q={left:"left",center:"center",right:"right"},Z={dashed:[4,2],dotted:[1,2]};function ee(n,e,t){n.save(),n.setTransform(t,0,0,t,0,0),n.clearRect(0,0,e.width,e.height);for(let r of e.commands)te(n,r);n.restore();}function te(n,e){switch(e.op){case "fillRect":n.fillStyle=e.color,n.fillRect(e.x,e.y,e.w,e.h);return;case "line":ne(n,e);return;case "text":re(n,e);return}}function ne(n,e){if(n.strokeStyle=e.color,e.style==="double"){let t=Math.max(e.width*.8,.8),r=Math.abs(e.y1-e.y2)<=Math.abs(e.x1-e.x2),[o,s]=r?[0,t]:[t,0];n.lineWidth=Math.max(e.width*.6,.5),E(n,e.x1-o,e.y1-s,e.x2-o,e.y2-s),E(n,e.x1+o,e.y1+s,e.x2+o,e.y2+s);return}n.lineWidth=e.width,n.save(),n.setLineDash(e.style?Z[e.style]:[]),E(n,e.x1,e.y1,e.x2,e.y2),n.restore();}function E(n,e,t,r,o){n.beginPath(),n.moveTo(e,t),n.lineTo(r,o),n.stroke();}function re(n,e){n.save(),e.clip&&(n.beginPath(),n.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),n.clip()),n.fillStyle=e.color,n.font=oe(e),n.textAlign=Q[e.align??"left"],n.textBaseline="alphabetic",n.fillText(e.text,e.x,e.y),(e.underline||e.strike)&&se(n,e),n.restore();}function oe(n){let e=n.italic?"italic ":"",t=n.bold?"bold ":"",r=n.fontFamily??"sans-serif";return `${e}${t}${n.fontSize}px ${r}`}function se(n,e){let t=n.measureText(e.text).width,r=e.align??"left",o=r==="right"?e.x-t:r==="center"?e.x-t/2:e.x,s=Math.max(e.fontSize*.05,.5);n.fillStyle=e.color,e.underline&&n.fillRect(o,e.y+e.fontSize*.1,t,s),e.strike&&n.fillRect(o,e.y-e.fontSize*.26,t,s);}var g=class n{static __wrap(e){let t=Object.create(n.prototype);return t.__wbg_ptr=e,A.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,A.unregister(this),e}free(){let e=this.__destroy_into_raw();i.__wbg_xlsxdocument_free(e,0);}acceptProposalJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_acceptProposalJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}applyOpsJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_applyOpsJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}cellJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_cellJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}displayListJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_displayListJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}editCellJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_editCellJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}editCellsJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_editCellsJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}listProposalsJson(){let e,t;try{let s=i.xlsxdocument_listProposalsJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,c(s[2]);return e=r,t=o,d(r,o)}finally{i.__wbindgen_free(e,t,1);}}static open(e){let t=le(e,i.__wbindgen_malloc),r=_,o=i.xlsxdocument_open(t,r);if(o[2])throw c(o[1]);return n.__wrap(o[0])}proposeJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_proposeJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}rangeCellsJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_rangeCellsJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}redoJson(){let e,t;try{let s=i.xlsxdocument_redoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,c(s[2]);return e=r,t=o,d(r,o)}finally{i.__wbindgen_free(e,t,1);}}rejectProposalJson(e){let t,r;try{let a=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),f=_,l=i.xlsxdocument_rejectProposalJson(this.__wbg_ptr,a,f);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,c(l[2]);return t=o,r=s,d(o,s)}finally{i.__wbindgen_free(t,r,1);}}renderPng(e){let t=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),r=_,o=i.xlsxdocument_renderPng(this.__wbg_ptr,t,r);if(o[3])throw c(o[2]);var s=P(o[0],o[1]).slice();return i.__wbindgen_free(o[0],o[1]*1,1),s}renderRangePng(e){let t=p(e,i.__wbindgen_malloc,i.__wbindgen_realloc),r=_,o=i.xlsxdocument_renderRangePng(this.__wbg_ptr,t,r);if(o[3])throw c(o[2]);var s=P(o[0],o[1]).slice();return i.__wbindgen_free(o[0],o[1]*1,1),s}saveBytes(){let e=i.xlsxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw c(e[2]);var t=P(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*1,1),t}setActiveSheet(e){let t=i.xlsxdocument_setActiveSheet(this.__wbg_ptr,e);if(t[1])throw c(t[0])}sheetInfoJson(){let e,t;try{let s=i.xlsxdocument_sheetInfoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,c(s[2]);return e=r,t=o,d(r,o)}finally{i.__wbindgen_free(e,t,1);}}undoJson(){let e,t;try{let s=i.xlsxdocument_undoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,c(s[2]);return e=r,t=o,d(r,o)}finally{i.__wbindgen_free(e,t,1);}}static version(){let e,t;try{let r=i.xlsxdocument_version();return e=r[0],t=r[1],d(r[0],r[1])}finally{i.__wbindgen_free(e,t,1);}}};Symbol.dispose&&(g.prototype[Symbol.dispose]=g.prototype.free);function ie(){return {__proto__:null,"./xlsx_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_344f42d3211c4765:function(e,t){throw new Error(d(e,t))},__wbg_now_86c0d4ba3fa605b8:function(){return Date.now()},__wbindgen_cast_0000000000000001:function(e,t){return d(e,t)},__wbindgen_init_externref_table:function(){let e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,true),e.set(t+3,false);}}}}var A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>i.__wbg_xlsxdocument_free(n,1));function P(n,e){return n=n>>>0,b().subarray(n/1,n/1+e)}function d(n,e){return fe(n>>>0,e)}var y=null;function b(){return (y===null||y.byteLength===0)&&(y=new Uint8Array(i.memory.buffer)),y}function le(n,e){let t=e(n.length*1,1)>>>0;return b().set(n,t/1),_=n.length,t}function p(n,e,t){if(t===void 0){let f=h.encode(n),l=e(f.length,1)>>>0;return b().subarray(l,l+f.length).set(f),_=f.length,l}let r=n.length,o=e(r,1)>>>0,s=b(),a=0;for(;a<r;a++){let f=n.charCodeAt(a);if(f>127)break;s[o+a]=f;}if(a!==r){a!==0&&(n=n.slice(a)),o=t(o,r,r=a+n.length*3,1)>>>0;let f=b().subarray(o+a,o+r),l=h.encodeInto(n,f);a+=l.written,o=t(o,r,a,1)>>>0;}return _=a,o}function c(n){let e=i.__wbindgen_externrefs.get(n);return i.__externref_table_dealloc(n),e}var v=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});v.decode();var ae=2146435072,R=0;function fe(n,e){return R+=e,R>=ae&&(v=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),v.decode(),R=e),v.decode(b().subarray(n,n+e))}var h=new TextEncoder;"encodeInto"in h||(h.encodeInto=function(n,e){let t=h.encode(n);return e.set(t),{read:n.length,written:t.length}});var _=0,i;function _e(n,e){return i=n.exports,y=null,i.__wbindgen_start(),i}async function pe(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(o){if(n.ok&&t(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await n.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(n,e);return r instanceof WebAssembly.Instance?{instance:r,module:n}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}async function I(n){if(i!==void 0)return i;if(n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),n===void 0)throw new Error("xlsx-wasm requires an explicit module or URL");let e=ie();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await pe(await n,e);return _e(t)}var C=class extends Error{constructor(t){super(`stale: ${t.join(", ")}`);a(this,"cells");this.name="StaleProposalError",this.cells=t;}},T="stale: ";function ue(n){let e=n.slice(T.length).split(",").map(t=>t.trim()).filter(t=>t.length>0);return new C(e)}var J=false,x;function ge(n=new URL("./generated/xlsx_wasm_bg.wasm",import.meta.url)){return J?Promise.resolve():x||(x=I({module_or_path:n}).then(()=>{J=true;},e=>{throw x=void 0,u(e)}),x)}function O(){if(!J)throw new Error("xlsx wasm is not initialized; call initWasm() first")}function u(n){return n instanceof Error?n:new Error(typeof n=="string"?n:String(n))}function be(){return typeof WebAssembly=="object"}function we(){return typeof g.prototype.renderPng=="function"}function ye(){return typeof g.prototype.proposeJson=="function"}function he(n){O();let e;try{e=g.open(n);}catch(t){throw u(t)}return {sheetInfo(){try{return JSON.parse(e.sheetInfoJson())}catch(t){throw u(t)}},displayList(t){try{return JSON.parse(e.displayListJson(JSON.stringify(t)))}catch(r){throw u(r)}},setActiveSheet(t){try{e.setActiveSheet(t);}catch(r){throw u(r)}},editCell(t,r,o,s){return m(()=>e.editCellJson(JSON.stringify({sheet:t,row:r,col:o,input:s})))},editCells(t,r){return m(()=>e.editCellsJson(JSON.stringify({sheet:t,edits:r})))},applyOps(t){return m(()=>e.applyOpsJson(JSON.stringify({ops:t})))},undo(){return m(()=>e.undoJson())},redo(){return m(()=>e.redoJson())},cell(t,r,o){return w(()=>e.cellJson(JSON.stringify({sheet:t,row:r,col:o})))},rangeCells(t,r){return w(()=>e.rangeCellsJson(JSON.stringify({sheet:t,range:r}))).cells},renderPng(t){let r=e.renderPng;if(typeof r!="function")throw new Error("png export not in this build");try{return r.call(e,JSON.stringify(t))}catch(o){throw u(o)}},renderRangePng(t){let r=e.renderRangePng;if(typeof r!="function")throw new Error("png export not in this build");try{return r.call(e,JSON.stringify(t??{}))}catch(o){throw u(o)}},save(){try{return e.saveBytes()}catch(t){throw u(t)}},propose(t,r,o){let s=e.proposeJson;if(typeof s!="function")throw new Error("proposals not in this build");return w(()=>s.call(e,JSON.stringify({agentId:t,note:r,edits:o})))},listProposals(){let t=e.listProposalsJson;return typeof t!="function"?[]:w(()=>t.call(e)).proposals},acceptProposal(t,r){let o=e.acceptProposalJson;if(typeof o!="function")throw new Error("proposals not in this build");try{return JSON.parse(o.call(e,JSON.stringify({id:t,force:r?.force??!1})))}catch(s){let a=s instanceof Error?s.message:typeof s=="string"?s:String(s);throw a.startsWith(T)?ue(a):u(s)}},rejectProposal(t){let r=e.rejectProposalJson;return typeof r!="function"?false:w(()=>r.call(e,JSON.stringify({id:t}))).removed},isProposalsAvailable(){return typeof e.proposeJson=="function"},dispose(){e.free();}}}function w(n){try{return JSON.parse(n())}catch(e){throw u(e)}}function m(n){return w(n)}function xe(){return O(),g.version()}export{C as StaleProposalError,ge as initWasm,we as isPngExportAvailable,ye as isProposalsAvailable,be as isWasmAvailable,he as openWorkbook,ee as paintDisplayList,xe as wasmVersion};
|
|
1
|
+
import {a}from'./chunk-VVLZGZMW.js';export{t as buildA11yGrid,o as cellAtPoint,k as cellCount,p as cellRect,f as clampScroll,l as extendTo,s as fromTsv,m as moveFocus,i as normalizeRange,j as rangeContains,q as rangeRect,h as selectionAt,n as selectionKeyReducer,r as toTsv,c as totalExtent,b as trackCount,g as uniformOffsets,e as visibleCells,d as visibleRange}from'./chunk-VVLZGZMW.js';var Q={left:"left",center:"center",right:"right"},Z={dashed:[4,2],dotted:[1,2]};function ee(n,e,t){n.save(),n.setTransform(t,0,0,t,0,0),n.clearRect(0,0,e.width,e.height);for(let r of e.commands)te(n,r);n.restore();}function te(n,e){switch(e.op){case "fillRect":n.fillStyle=e.color,n.fillRect(e.x,e.y,e.w,e.h);return;case "line":ne(n,e);return;case "text":re(n,e);return}}function ne(n,e){if(n.strokeStyle=e.color,e.style==="double"){let t=Math.max(e.width*.8,.8),r=Math.abs(e.y1-e.y2)<=Math.abs(e.x1-e.x2),[o,s]=r?[0,t]:[t,0];n.lineWidth=Math.max(e.width*.6,.5),S(n,e.x1-o,e.y1-s,e.x2-o,e.y2-s),S(n,e.x1+o,e.y1+s,e.x2+o,e.y2+s);return}n.lineWidth=e.width,n.save(),n.setLineDash(e.style?Z[e.style]:[]),S(n,e.x1,e.y1,e.x2,e.y2),n.restore();}function S(n,e,t,r,o){n.beginPath(),n.moveTo(e,t),n.lineTo(r,o),n.stroke();}function re(n,e){n.save(),e.clip&&(n.beginPath(),n.rect(e.clip.x,e.clip.y,e.clip.w,e.clip.h),n.clip()),n.fillStyle=e.color,n.font=oe(e),n.textAlign=Q[e.align??"left"],n.textBaseline="alphabetic",n.fillText(e.text,e.x,e.y),(e.underline||e.strike)&&se(n,e),n.restore();}function oe(n){let e=n.italic?"italic ":"",t=n.bold?"bold ":"",r=n.fontFamily??"sans-serif";return `${e}${t}${n.fontSize}px ${r}`}function se(n,e){let t=n.measureText(e.text).width,r=e.align??"left",o=r==="right"?e.x-t:r==="center"?e.x-t/2:e.x,s=Math.max(e.fontSize*.05,.5);n.fillStyle=e.color,e.underline&&n.fillRect(o,e.y+e.fontSize*.1,t,s),e.strike&&n.fillRect(o,e.y-e.fontSize*.26,t,s);}var g=class n{static __wrap(e){let t=Object.create(n.prototype);return t.__wbg_ptr=e,A.register(t,t.__wbg_ptr,t),t}__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,A.unregister(this),e}free(){let e=this.__destroy_into_raw();i.__wbg_xlsxdocument_free(e,0);}acceptProposalJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_acceptProposalJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}applyOpsJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_applyOpsJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}calculationStatusJson(){let e,t;try{let s=i.xlsxdocument_calculationStatusJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,f(s[2]);return e=r,t=o,u(r,o)}finally{i.__wbindgen_free(e,t,1);}}cellJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_cellJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}displayListJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_displayListJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}editCellJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_editCellJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}editCellsJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_editCellsJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}listProposalsJson(){let e,t;try{let s=i.xlsxdocument_listProposalsJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,f(s[2]);return e=r,t=o,u(r,o)}finally{i.__wbindgen_free(e,t,1);}}static open(e){let t=le(e,i.__wbindgen_malloc),r=d,o=i.xlsxdocument_open(t,r);if(o[2])throw f(o[1]);return n.__wrap(o[0])}proposeJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_proposeJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}rangeCellsJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_rangeCellsJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}redoJson(){let e,t;try{let s=i.xlsxdocument_redoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,f(s[2]);return e=r,t=o,u(r,o)}finally{i.__wbindgen_free(e,t,1);}}rejectProposalJson(e){let t,r;try{let a=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),c=d,l=i.xlsxdocument_rejectProposalJson(this.__wbg_ptr,a,c);var o=l[0],s=l[1];if(l[3])throw o=0,s=0,f(l[2]);return t=o,r=s,u(o,s)}finally{i.__wbindgen_free(t,r,1);}}renderPng(e){let t=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),r=d,o=i.xlsxdocument_renderPng(this.__wbg_ptr,t,r);if(o[3])throw f(o[2]);var s=J(o[0],o[1]).slice();return i.__wbindgen_free(o[0],o[1]*1,1),s}renderRangePng(e){let t=_(e,i.__wbindgen_malloc,i.__wbindgen_realloc),r=d,o=i.xlsxdocument_renderRangePng(this.__wbg_ptr,t,r);if(o[3])throw f(o[2]);var s=J(o[0],o[1]).slice();return i.__wbindgen_free(o[0],o[1]*1,1),s}saveBytes(){let e=i.xlsxdocument_saveBytes(this.__wbg_ptr);if(e[3])throw f(e[2]);var t=J(e[0],e[1]).slice();return i.__wbindgen_free(e[0],e[1]*1,1),t}setActiveSheet(e){let t=i.xlsxdocument_setActiveSheet(this.__wbg_ptr,e);if(t[1])throw f(t[0])}sheetInfoJson(){let e,t;try{let s=i.xlsxdocument_sheetInfoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,f(s[2]);return e=r,t=o,u(r,o)}finally{i.__wbindgen_free(e,t,1);}}undoJson(){let e,t;try{let s=i.xlsxdocument_undoJson(this.__wbg_ptr);var r=s[0],o=s[1];if(s[3])throw r=0,o=0,f(s[2]);return e=r,t=o,u(r,o)}finally{i.__wbindgen_free(e,t,1);}}static version(){let e,t;try{let r=i.xlsxdocument_version();return e=r[0],t=r[1],u(r[0],r[1])}finally{i.__wbindgen_free(e,t,1);}}};Symbol.dispose&&(g.prototype[Symbol.dispose]=g.prototype.free);function ie(){return {__proto__:null,"./xlsx_wasm_bg.js":{__proto__:null,__wbg___wbindgen_throw_344f42d3211c4765:function(e,t){throw new Error(u(e,t))},__wbg_now_86c0d4ba3fa605b8:function(){return Date.now()},__wbindgen_cast_0000000000000001:function(e,t){return u(e,t)},__wbindgen_init_externref_table:function(){let e=i.__wbindgen_externrefs,t=e.grow(4);e.set(0,void 0),e.set(t+0,void 0),e.set(t+1,null),e.set(t+2,true),e.set(t+3,false);}}}}var A=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(n=>i.__wbg_xlsxdocument_free(n,1));function J(n,e){return n=n>>>0,w().subarray(n/1,n/1+e)}function u(n,e){return ce(n>>>0,e)}var y=null;function w(){return (y===null||y.byteLength===0)&&(y=new Uint8Array(i.memory.buffer)),y}function le(n,e){let t=e(n.length*1,1)>>>0;return w().set(n,t/1),d=n.length,t}function _(n,e,t){if(t===void 0){let c=h.encode(n),l=e(c.length,1)>>>0;return w().subarray(l,l+c.length).set(c),d=c.length,l}let r=n.length,o=e(r,1)>>>0,s=w(),a=0;for(;a<r;a++){let c=n.charCodeAt(a);if(c>127)break;s[o+a]=c;}if(a!==r){a!==0&&(n=n.slice(a)),o=t(o,r,r=a+n.length*3,1)>>>0;let c=w().subarray(o+a,o+r),l=h.encodeInto(n,c);a+=l.written,o=t(o,r,a,1)>>>0;}return d=a,o}function f(n){let e=i.__wbindgen_externrefs.get(n);return i.__externref_table_dealloc(n),e}var v=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true});v.decode();var ae=2146435072,E=0;function ce(n,e){return E+=e,E>=ae&&(v=new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}),v.decode(),E=e),v.decode(w().subarray(n,n+e))}var h=new TextEncoder;"encodeInto"in h||(h.encodeInto=function(n,e){let t=h.encode(n);return e.set(t),{read:n.length,written:t.length}});var d=0,i;function de(n,e){return i=n.exports,y=null,i.__wbindgen_start(),i}async function _e(n,e){if(typeof Response=="function"&&n instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(n,e)}catch(o){if(n.ok&&t(n.type)&&n.headers.get("Content-Type")!=="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let r=await n.arrayBuffer();return await WebAssembly.instantiate(r,e)}else {let r=await WebAssembly.instantiate(n,e);return r instanceof WebAssembly.Instance?{instance:r,module:n}:r}function t(r){switch(r){case "basic":case "cors":case "default":return true}return false}}async function I(n){if(i!==void 0)return i;if(n!==void 0&&(Object.getPrototypeOf(n)===Object.prototype?{module_or_path:n}=n:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),n===void 0)throw new Error("xlsx-wasm requires an explicit module or URL");let e=ie();(typeof n=="string"||typeof Request=="function"&&n instanceof Request||typeof URL=="function"&&n instanceof URL)&&(n=fetch(n));let{instance:t,module:r}=await _e(await n,e);return de(t)}var C=class extends Error{constructor(t){super(`stale: ${t.join(", ")}`);a(this,"cells");this.name="StaleProposalError",this.cells=t;}},T="stale: ";function pe(n){let e=n.slice(T.length).split(",").map(t=>t.trim()).filter(t=>t.length>0);return new C(e)}var P=false,x;function ge(n=new URL("./generated/xlsx_wasm_bg.wasm",import.meta.url)){return P?Promise.resolve():x||(x=I({module_or_path:n}).then(()=>{P=true;},e=>{throw x=void 0,p(e)}),x)}function O(){if(!P)throw new Error("xlsx wasm is not initialized; call initWasm() first")}function p(n){return n instanceof Error?n:new Error(typeof n=="string"?n:String(n))}function be(){return typeof WebAssembly=="object"}function we(){return typeof g.prototype.renderPng=="function"}function ye(){return typeof g.prototype.proposeJson=="function"}function he(n){O();let e;try{e=g.open(n);}catch(t){throw p(t)}return {sheetInfo(){try{return JSON.parse(e.sheetInfoJson())}catch(t){throw p(t)}},calculationStatus(){let t=e.calculationStatusJson;return typeof t!="function"?{limitedCells:[]}:b(()=>t.call(e))},displayList(t){try{return JSON.parse(e.displayListJson(JSON.stringify(t)))}catch(r){throw p(r)}},setActiveSheet(t){try{e.setActiveSheet(t);}catch(r){throw p(r)}},editCell(t,r,o,s){return m(()=>e.editCellJson(JSON.stringify({sheet:t,row:r,col:o,input:s})))},editCells(t,r){return m(()=>e.editCellsJson(JSON.stringify({sheet:t,edits:r})))},applyOps(t){return m(()=>e.applyOpsJson(JSON.stringify({ops:t})))},undo(){return m(()=>e.undoJson())},redo(){return m(()=>e.redoJson())},cell(t,r,o){return b(()=>e.cellJson(JSON.stringify({sheet:t,row:r,col:o})))},rangeCells(t,r){return b(()=>e.rangeCellsJson(JSON.stringify({sheet:t,range:r}))).cells},renderPng(t){let r=e.renderPng;if(typeof r!="function")throw new Error("png export not in this build");try{return r.call(e,JSON.stringify(t))}catch(o){throw p(o)}},renderRangePng(t){let r=e.renderRangePng;if(typeof r!="function")throw new Error("png export not in this build");try{return r.call(e,JSON.stringify(t??{}))}catch(o){throw p(o)}},save(){try{return e.saveBytes()}catch(t){throw p(t)}},propose(t,r,o){let s=e.proposeJson;if(typeof s!="function")throw new Error("proposals not in this build");return b(()=>s.call(e,JSON.stringify({agentId:t,note:r,edits:o})))},listProposals(){let t=e.listProposalsJson;return typeof t!="function"?[]:b(()=>t.call(e)).proposals},acceptProposal(t,r){let o=e.acceptProposalJson;if(typeof o!="function")throw new Error("proposals not in this build");try{return JSON.parse(o.call(e,JSON.stringify({id:t,force:r?.force??!1})))}catch(s){let a=s instanceof Error?s.message:typeof s=="string"?s:String(s);throw a.startsWith(T)?pe(a):p(s)}},rejectProposal(t){let r=e.rejectProposalJson;return typeof r!="function"?false:b(()=>r.call(e,JSON.stringify({id:t}))).removed},isProposalsAvailable(){return typeof e.proposeJson=="function"},dispose(){e.free();}}}function b(n){try{return JSON.parse(n())}catch(e){throw p(e)}}function m(n){return b(n)}function xe(){return O(),g.version()}export{C as StaleProposalError,ge as initWasm,we as isPngExportAvailable,ye as isProposalsAvailable,be as isWasmAvailable,he as openWorkbook,ee as paintDisplayList,xe as wasmVersion};
|