1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5982],{95982:(e,t,i)=>{i.d(t,{X_:()=>a});var s=(e=>(e.UNKNOWN="UNKNOWN",e.INVALID_INPUT="INVALID_INPUT",e.UNSUPPORTED_FORMAT="UNSUPPORTED_FORMAT",e.CORRUPTED_DOCUMENT="CORRUPTED_DOCUMENT",e.PASSWORD_REQUIRED="PASSWORD_REQUIRED",e.WASM_NOT_INITIALIZED="WASM_NOT_INITIALIZED",e.CONVERSION_FAILED="CONVERSION_FAILED",e.LOAD_FAILED="LOAD_FAILED",e))(s||{}),r=class extends Error{code;details;constructor(e,t,i){super(t),this.name="ConversionError",this.code=e,this.details=i}},n={pdf:"writer_pdf_Export",docx:"MS Word 2007 XML",doc:"MS Word 97",odt:"writer8",rtf:"Rich Text Format",txt:"Text",html:"HTML (StarWriter)",xlsx:"Calc MS Excel 2007 XML",xls:"MS Excel 97",ods:"calc8",csv:"Text - txt - csv (StarCalc)",pptx:"Impress MS PowerPoint 2007 XML",ppt:"MS PowerPoint 97",odp:"impress8",png:"writer_png_Export",jpg:"writer_jpg_Export",svg:"writer_svg_Export"},o={pdf:"application/pdf",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",doc:"application/msword",odt:"application/vnd.oasis.opendocument.text",rtf:"application/rtf",txt:"text/plain",html:"text/html",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xls:"application/vnd.ms-excel",ods:"application/vnd.oasis.opendocument.spreadsheet",csv:"text/csv",pptx:"application/vnd.openxmlformats-officedocument.presentationml.presentation",ppt:"application/vnd.ms-powerpoint",odp:"application/vnd.oasis.opendocument.presentation",png:"image/png",jpg:"image/jpeg",svg:"image/svg+xml"};new TextEncoder,new TextDecoder;var a=class{worker=null;initialized=!1;initializing=!1;messageId=0;pendingRequests=new Map;options;constructor(e={}){let t=function(e="/wasm/"){let t=e.endsWith("/")?e:`${e}/`;return{sofficeJs:`${t}soffice.js`,sofficeWasm:`${t}soffice.wasm`,sofficeData:`${t}soffice.data`,sofficeWorkerJs:`${t}soffice.worker.js`}}();this.options={verbose:!1,browserWorkerJs:"/dist/browser.worker.global.js",...t,...e}}async initialize(){if(!this.initialized){if(this.initializing){for(;this.initializing;)await new Promise(e=>setTimeout(e,100));return}this.initializing=!0,this.emitProgress("loading",0,"Starting worker...");try{this.worker=new Worker(this.options.browserWorkerJs),this.worker.onmessage=e=>this.handleWorkerMessage(e),this.worker.onerror=e=>{console.error("[WorkerConverter] Worker error:",e),this.options.onError?.(new r("WASM_NOT_INITIALIZED",e.message))},await new Promise((e,t)=>{let i=setTimeout(()=>t(Error("Worker load timeout")),1e4),s=t=>{"loaded"===t.data.type&&(clearTimeout(i),this.worker?.removeEventListener("message",s),e())};this.worker.addEventListener("message",s)}),await this.sendMessage("init",{sofficeJs:this.options.sofficeJs,sofficeWasm:this.options.sofficeWasm,sofficeData:this.options.sofficeData,sofficeWorkerJs:this.options.sofficeWorkerJs,enableProgressTracking:this.options.enableProgressTracking,verbose:this.options.verbose,fonts:this.options.fonts}),this.initialized=!0,this.emitProgress("complete",100,"Ready"),this.options.onReady?.()}catch(t){let e=t instanceof r?t:new r("WASM_NOT_INITIALIZED",String(t));throw this.options.onError?.(e),e}finally{this.initializing=!1}}}handleWorkerMessage(e){let t=e.data;if("progress"===t.type){let e=t.progress;e&&this.emitProgress("converting",e.percent,e.message);return}let i=this.pendingRequests.get(t.id);i&&(this.pendingRequests.delete(t.id),"error"===t.type?i.reject(new r("CONVERSION_FAILED",t.error??"Unknown error")):"result"===t.type?i.resolve(t.data):"ready"===t.type?i.resolve(void 0):"pageCount"===t.type?i.resolve(t.pageCount):"previews"===t.type?i.resolve(t.previews):"singlePagePreview"===t.type||"fullQualityPagePreview"===t.type?i.resolve(t.preview):"documentInfo"===t.type?i.resolve(t.documentInfo):"lokInfo"===t.type?i.resolve(t.lokInfo):"editResult"===t.type?i.resolve(t.editResult):"pageRectangles"===t.type?i.resolve(t.pageRectangles):"testLokOperations"===t.type?i.resolve(t.testLokOperationsResult):"editorSession"===t.type?i.resolve(t.editorSession):"editorOperationResult"===t.type?i.resolve(t.editorOperationResult):"documentClosed"===t.type&&i.resolve(t.data))}sendMessage(e,t={}){return new Promise((i,s)=>{if(!this.worker)return void s(Error("Worker not initialized"));let r=++this.messageId;if(this.pendingRequests.set(r,{resolve:i,reject:s}),t.inputData instanceof Uint8Array){let i=new Uint8Array(t.inputData.length);i.set(t.inputData);let s={type:e,id:r,...t,inputData:i};this.worker.postMessage(s,[i.buffer])}else{let i={type:e,id:r,...t};this.worker.postMessage(i)}})}async convert(e,t,i="document"){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let s=Date.now(),a=e instanceof Uint8Array?e:new Uint8Array(e);if(0===a.length)throw new r("INVALID_INPUT","Empty document");let d=this.getExt(i)||t.inputFormat||"docx",p=t.outputFormat;if(!n[p])throw new r("UNSUPPORTED_FORMAT",`Unsupported: ${p}`);let c="";if("pdf"===p&&t.pdf){let e=[];t.pdf.pdfaLevel&&e.push(`SelectPdfVersion=${{"PDF/A-1b":1,"PDF/A-2b":2,"PDF/A-3b":3}[t.pdf.pdfaLevel]||0}`),void 0!==t.pdf.quality&&e.push(`Quality=${t.pdf.quality}`),c=e.join(",")}let l=await this.sendMessage("convert",{inputData:a,inputExt:d,outputFormat:p,filterOptions:c,password:t.password}),h=i.includes(".")?i.substring(0,i.lastIndexOf(".")):i,u=l.length>=2&&80===l[0]&&75===l[1],g=["png","jpg","jpeg","svg"].includes(p.toLowerCase());return u&&g?{data:l,mimeType:"application/zip",filename:`${h}_pages.zip`,duration:Date.now()-s}:{data:l,mimeType:o[p],filename:`${h}.${p}`,duration:Date.now()-s}}async convertFile(e,t){let i=await e.arrayBuffer();return this.convert(new Uint8Array(i),t,e.name)}async convertFromUrl(e,t){let i=await fetch(e);if(!i.ok)throw Error(`Fetch failed: ${i.statusText}`);let s=await i.arrayBuffer(),r=e.split("/").pop()||"document";return this.convert(new Uint8Array(s),t,r)}download(e,t){let i=new Blob([new Uint8Array(e.data).buffer],{type:e.mimeType}),s=URL.createObjectURL(i),r=document.createElement("a");r.href=s,r.download=t||e.filename,r.click(),setTimeout(()=>URL.revokeObjectURL(s),1e3)}createBlobUrl(e){let t=new Blob([new Uint8Array(e.data).buffer],{type:e.mimeType});return URL.createObjectURL(t)}preview(e){return window.open(this.createBlobUrl(e),"_blank")}async getPageCount(e,t){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let i=e instanceof Uint8Array?e:new Uint8Array(e),s=t.inputFormat||"docx";return await this.sendMessage("getPageCount",{inputData:i,inputExt:s})}async renderPreviews(e,t,i=256){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let s=e instanceof Uint8Array?e:new Uint8Array(e),n=t.inputFormat||"docx";return await this.sendMessage("renderPreviews",{inputData:s,inputExt:n,maxWidth:i})}
1async renderSinglePage(e,t,i,s=256){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let n=e instanceof Uint8Array?e:new Uint8Array(e),o=t.inputFormat||"docx";return await this.sendMessage("renderSinglePage",{inputData:n,inputExt:o,pageIndex:i,maxWidth:s})}async renderPageViaConvert(e,t,i,s=256){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let n=e instanceof Uint8Array?e:new Uint8Array(e),o=t.inputFormat||"pdf";return await this.sendMessage("renderPageViaConvert",{inputData:n,inputExt:o,pageIndex:i,maxWidth:s})}async getDocumentInfo(e,t){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let i=e instanceof Uint8Array?e:new Uint8Array(e),s=t.inputFormat||"docx";return await this.sendMessage("getDocumentInfo",{inputData:i,inputExt:s})}async getLokInfo(e,t){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let i=e instanceof Uint8Array?e:new Uint8Array(e),s=t.inputFormat||"docx";return await this.sendMessage("getLokInfo",{inputData:i,inputExt:s})}async renderPageRectangles(e,t,i=256){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let s=e instanceof Uint8Array?e:new Uint8Array(e),n=t.inputFormat||"docx";return await this.sendMessage("renderPageRectangles",{inputData:s,inputExt:n,maxWidth:i})}async editText(e,t,i){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let s=e instanceof Uint8Array?e:new Uint8Array(e),n=t.inputFormat||"docx";return await this.sendMessage("editText",{inputData:s,inputExt:n,findText:i.findText,replaceText:i.replaceText,insertText:i.insertText})}async testLokOperations(e,t){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let i=e instanceof Uint8Array?e:new Uint8Array(e),s=t.inputFormat||"docx";return await this.sendMessage("testLokOperations",{inputData:i,inputExt:s})}async openDocument(e,t){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let i=e instanceof Uint8Array?e:new Uint8Array(e),s=t.inputFormat||"docx",n=await this.sendMessage("openDocument",{inputData:i,inputExt:s});return new d(this,n.sessionId,n.documentType,n.pageCount)}async _sendEditorOperation(e,t,i=[]){return await this.sendMessage("editorOperation",{sessionId:e,editorMethod:t,editorArgs:i})}async _closeDocument(e){return await this.sendMessage("closeDocument",{sessionId:e})}async renderPage(e,t,i,s,r){return this.renderSinglePage(e,t,i,s)}async renderPagePreviews(e,t,i){let s=i?.width??256;return this.renderPreviews(e,t,s)}async renderPageFullQuality(e,t,i,s){if(!this.initialized||!this.worker)throw new r("WASM_NOT_INITIALIZED","Not initialized");let n=e instanceof Uint8Array?e:new Uint8Array(e),o=t.inputFormat||"docx";return await this.sendMessage("renderPageFullQuality",{inputData:n,inputExt:o,pageIndex:i,dpi:s?.dpi??150,maxDimension:s?.maxDimension,editMode:s?.editMode??!1})}async editorOperation(e,t,i){return await this._sendEditorOperation(e,t,i??[])}async closeDocument(e){return this._closeDocument(e)}async destroy(){if(this.worker){try{await this.sendMessage("destroy")}catch{}this.worker.terminate(),this.worker=null}this.initialized=!1,this.pendingRequests.clear()}isReady(){return this.initialized&&null!==this.worker}static getSupportedOutputFormats(){return Object.keys(n)}getExt(e){let t=e.split(".");return t.length>1&&t.pop()?.toLowerCase()||null}emitProgress(e,t,i){this.options.onProgress?.({phase:e,percent:t,message:i})}},d=class{converter;_sessionId;_documentType;_pageCount;_closed=!1;constructor(e,t,i,s){this.converter=e,this._sessionId=t,this._documentType=i,this._pageCount=s}get sessionId(){return this._sessionId}get documentType(){return this._documentType}get pageCount(){return this._pageCount}get isOpen(){return!this._closed}async getStructure(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getStructure")}async undo(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"undo")}async redo(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"redo")}async find(e,t){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"find",[e,t])}async findAndReplaceAll(e,t,i){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"findAndReplaceAll",[e,t,i])}async getSelection(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getSelection")}async clearSelection(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"clearSelection")}async getStateChanges(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getStateChanges")}
1async flushAndPollState(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"flushAndPollState")}async getFormat(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getFormat")}async getSelectionFormat(){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getSelectionFormat")}async getParagraph(e){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getParagraph",[e])}async getParagraphs(e,t){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"getParagraphs",[e,t])}async insertParagraph(e,t){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"insertParagraph",[e,t])}async replaceParagraph(e,t){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"replaceParagraph",[e,t])}async deleteParagraph(e){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"deleteParagraph",[e])}async formatText(e,t){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"formatText",[e,t])}async replaceText(e,t,i){return this.assertOpen(),this.converter._sendEditorOperation(this._sessionId,"replaceText",[e,t,i])}async close(){return this.assertOpen(),this._closed=!0,this.converter._closeDocument(this._sessionId)}assertOpen(){if(this._closed)throw Error("Document session is closed")}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.