UNPKG

@embedpdf/pdfium

Version:

PDFium WebAssembly for the web platform. This package provides a powerful JavaScript interface to PDFium, enabling high-quality PDF rendering and manipulation directly in web applications.

1 lines 551 kB
{"version":3,"file":"index.cjs","sources":["../src/vendor/pdfium.cjs","../src/vendor/functions.ts","../src/base.ts","../src/index.cjs.ts"],"sourcesContent":["\nvar createPdfium = (() => {\n var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;\n if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;\n return (\nfunction(moduleArg = {}) {\n var moduleRtn;\n\n// include: shell.js\n// The Module object: Our interface to the outside world. We import\n// and export values on it. There are various ways Module can be used:\n// 1. Not defined. We create it here\n// 2. A function parameter, function(moduleArg) => Promise<Module>\n// 3. pre-run appended it, var Module = {}; ..generated code..\n// 4. External script tag defines var Module.\n// We need to check if Module already exists (e.g. case 3 above).\n// Substitution will be replaced with actual code on later stage of the build,\n// this way Closure Compiler will not mangle it (e.g. case 4. above).\n// Note that if you want to run closure, and also to use Module\n// after the generated code, you will need to define var Module = {};\n// before the code. Then that object will be used in the code, and you\n// can continue to use Module afterwards as well.\nvar Module = moduleArg;\n\n// Set up the promise that indicates the Module is initialized\nvar readyPromiseResolve, readyPromiseReject;\nvar readyPromise = new Promise((resolve, reject) => {\n readyPromiseResolve = resolve;\n readyPromiseReject = reject;\n});\n[\"_FORM_CanRedo\",\"_FORM_CanUndo\",\"_FORM_DoDocumentAAction\",\"_FORM_DoDocumentJSAction\",\"_FORM_DoDocumentOpenAction\",\"_FORM_DoPageAAction\",\"_FORM_ForceToKillFocus\",\"_FORM_GetFocusedAnnot\",\"_FORM_GetFocusedText\",\"_FORM_GetSelectedText\",\"_FORM_IsIndexSelected\",\"_FORM_OnAfterLoadPage\",\"_FORM_OnBeforeClosePage\",\"_FORM_OnChar\",\"_FORM_OnFocus\",\"_FORM_OnKeyDown\",\"_FORM_OnKeyUp\",\"_FORM_OnLButtonDoubleClick\",\"_FORM_OnLButtonDown\",\"_FORM_OnLButtonUp\",\"_FORM_OnMouseMove\",\"_FORM_OnMouseWheel\",\"_FORM_OnRButtonDown\",\"_FORM_OnRButtonUp\",\"_FORM_Redo\",\"_FORM_ReplaceAndKeepSelection\",\"_FORM_ReplaceSelection\",\"_FORM_SelectAllText\",\"_FORM_SetFocusedAnnot\",\"_FORM_SetIndexSelected\",\"_FORM_Undo\",\"_FPDF_AddInstalledFont\",\"_FPDF_CloseDocument\",\"_FPDF_ClosePage\",\"_FPDF_CloseXObject\",\"_FPDF_CopyViewerPreferences\",\"_FPDF_CountNamedDests\",\"_FPDF_CreateClipPath\",\"_FPDF_CreateNewDocument\",\"_FPDF_DestroyClipPath\",\"_FPDF_DestroyLibrary\",\"_FPDF_DeviceToPage\",\"_FPDF_DocumentHasValidCrossReferenceTable\",\"_FPDF_FFLDraw\",\"_FPDF_FreeDefaultSystemFontInfo\",\"_FPDF_GetDefaultSystemFontInfo\",\"_FPDF_GetDefaultTTFMap\",\"_FPDF_GetDefaultTTFMapCount\",\"_FPDF_GetDefaultTTFMapEntry\",\"_FPDF_GetDocPermissions\",\"_FPDF_GetDocUserPermissions\",\"_FPDF_GetFileIdentifier\",\"_FPDF_GetFileVersion\",\"_FPDF_GetFormType\",\"_FPDF_GetLastError\",\"_FPDF_GetMetaText\",\"_FPDF_GetNamedDest\",\"_FPDF_GetNamedDestByName\",\"_FPDF_GetPageAAction\",\"_FPDF_GetPageBoundingBox\",\"_FPDF_GetPageCount\",\"_FPDF_GetPageHeight\",\"_FPDF_GetPageHeightF\",\"_FPDF_GetPageLabel\",\"_FPDF_GetPageSizeByIndex\",\"_FPDF_GetPageSizeByIndexF\",\"_FPDF_GetPageWidth\",\"_FPDF_GetPageWidthF\",\"_FPDF_GetSecurityHandlerRevision\",\"_FPDF_GetSignatureCount\",\"_FPDF_GetSignatureObject\",\"_FPDF_GetTrailerEnds\",\"_FPDF_GetXFAPacketContent\",\"_FPDF_GetXFAPacketCount\",\"_FPDF_GetXFAPacketName\",\"_FPDF_ImportNPagesToOne\",\"_FPDF_ImportPages\",\"_FPDF_ImportPagesByIndex\",\"_FPDF_InitLibrary\",\"_FPDF_InitLibraryWithConfig\",\"_FPDF_LoadCustomDocument\",\"_FPDF_LoadDocument\",\"_FPDF_LoadMemDocument\",\"_FPDF_LoadMemDocument64\",\"_FPDF_LoadPage\",\"_FPDF_LoadXFA\",\"_FPDF_MovePages\",\"_FPDF_NewFormObjectFromXObject\",\"_FPDF_NewXObjectFromPage\",\"_FPDF_PageToDevice\",\"_FPDF_RemoveFormFieldHighlight\",\"_FPDF_RenderPage_Close\",\"_FPDF_RenderPage_Continue\",\"_FPDF_RenderPageBitmap\",\"_FPDF_RenderPageBitmap_Start\",\"_FPDF_RenderPageBitmapWithColorScheme_Start\",\"_FPDF_RenderPageBitmapWithMatrix\",\"_FPDF_SaveAsCopy\",\"_FPDF_SaveWithVersion\",\"_FPDF_SetFormFieldHighlightAlpha\",\"_FPDF_SetFormFieldHighlightColor\",\"_FPDF_SetSandBoxPolicy\",\"_FPDF_SetSystemFontInfo\",\"_FPDF_StructElement_Attr_CountChildren\",\"_FPDF_StructElement_Attr_GetBlobValue\",\"_FPDF_StructElement_Attr_GetBooleanValue\",\"_FPDF_StructElement_Attr_GetChildAtIndex\",\"_FPDF_StructElement_Attr_GetCount\",\"_FPDF_StructElement_Attr_GetName\",\"_FPDF_StructElement_Attr_GetNumberValue\",\"_FPDF_StructElement_Attr_GetStringValue\",\"_FPDF_StructElement_Attr_GetType\",\"_FPDF_StructElement_Attr_GetValue\",\"_FPDF_StructElement_CountChildren\",\"_FPDF_StructElement_GetActualText\",\"_FPDF_StructElement_GetAltText\",\"_FPDF_StructElement_GetAttributeAtIndex\",\"_FPDF_StructElement_GetAttributeCount\",\"_FPDF_StructElement_GetChildAtIndex\",\"_FPDF_StructElement_GetChildMarkedContentID\",\"_FPDF_StructElement_GetID\",\"_FPDF_StructElement_GetLang\",\"_FPDF_StructElement_GetMarkedContentID\",\"_FPDF_StructElement_GetMarkedContentIdAtIndex\",\"_FPDF_StructElement_GetMarkedContentIdCount\",\"_FPDF_StructElement_GetObjType\",\"_FPDF_StructElement_GetParent\",\"_FPDF_StructElement_GetStringAttribute\",\"_FPDF_StructElement_GetTitle\",\"_FPDF_StructElement_GetType\",\"_FPDF_StructTree_Close\",\"_FPDF_StructTree_CountChildren\",\"_FPDF_StructTree_GetChildAtIndex\",\"_FPDF_StructTree_GetForPage\",\"_FPDF_VIEWERREF_GetDuplex\",\"_FPDF_VIEWERREF_GetName\",\"_FPDF_VIEWERREF_GetNumCopies\",\"_FPDF_VIEWERREF_GetPrintPageRange\",\"_FPDF_VIEWERREF_GetPrintPageRangeCount\",\"_FPDF_VIEWERREF_GetPrintPageRangeElement\",\"_FPDF_VIEWERREF_GetPrintScaling\",\"_FPDFAction_GetDest\",\"_FPDFAction_GetFilePath\",\"_FPDFAction_GetType\",\"_FPDFAction_GetURIPath\",\"_FPDFAnnot_AddFileAttachment\",\"_FPDFAnnot_AddInkStroke\",\"_FPDFAnnot_AppendAttachmentPoints\",\"_FPDFAnnot_AppendObject\",\"_FPDFAnnot_CountAttachmentPoints\",\"_FPDFAnnot_GetAP\",\"_FPDFAnnot_GetAttachmentPoints\",\"_FPDFAnnot_GetBorder\",\"_FPDFAnnot_GetColor\",\"_FPDFAnnot_GetFileAttachment\",\"_FPDFAnnot_GetFlags\",\"_FPDFAnnot_GetFocusableSubtypes\",\"_FPDFAnnot_GetFocusableSubtypesCount\",\"_FPDFAnnot_GetFontColor\",\"_FPDFAnnot_GetFontSize\",\"_FPDFAnnot_GetFormAdditionalActionJavaScript\",\"_FPDFAnnot_GetFormControlCount\",\"_FPDFAnnot_GetFormControlIndex\",\"_FPDFAnnot_GetFormFieldAlternateName\",\"_FPDFAnnot_GetFormFieldAtPoint\",\"_FPDFAnnot_GetFormFieldExportValue\",\"_FPDFAnnot_GetFormFieldFlags\",\"_FPDFAnnot_GetFormFieldName\",\"_FPDFAnnot_GetFormFieldType\",\"_FPDFAnnot_GetFormFieldValue\",\"_FPDFAnnot_GetInkListCount\",\"_FPDFAnnot_GetInkListPath\",\"_FPDFAnnot_GetLine\",\"_FPDFAnnot_GetLink\",\"_FPDFAnnot_GetLinkedAnnot\",\"_FPDFAnnot_GetNumberValue\",\"_FPDFAnnot_GetObject\",\"_FPDFAnnot_GetObjectCount\",\"_FPDFAnnot_GetOptionCount\",\"_FPDFAnnot_GetOptionLabel\",\"_FPDFAnnot_GetRect\",\"_FPDFAnnot_GetStringValue\",\"_FPDFAnnot_GetSubtype\",\"_FPDFAnnot_GetValueType\",\"_FPDFAnnot_GetVertices\",\"_FPDFAnnot_HasAttachmentPoints\",\"_FPDFAnnot_HasKey\",\"_FPDFAnnot_IsChecked\",\"_FPDFAnnot_IsObjectSupportedSubtype\",\"_FPDFAnnot_IsOptionSelected\",\"_FPDFAnnot_IsSupportedSubtype\",\"_FPDFAnnot_RemoveInkList\",\"_FPDFAnnot_RemoveObject\",\"_FPDFAnnot_SetAP\",\"_FPDFAnnot_SetAttachmentPoints\",\"_FPDFAnnot_SetBorder\",\"_FPDFAnnot_SetColor\",\"_FPDFAnnot_SetFlags\",\"_FPDFAnnot_SetFocusableSubtypes\",\"_FPDFAnnot_SetFormFieldFlags\",\"_FPDFAnnot_SetRect\",\"_FPDFAnnot_SetStringValue\",\"_FPDFAnnot_SetURI\",\"_FPDFAnnot_UpdateObject\",\"_FPDFAttachment_GetFile\",\"_FPDFAttachment_GetName\",\"_FPDFAttachment_GetStringValue\",\"_FPDFAttachment_GetSubtype\",\"_FPDFAttachment_GetValueType\",\"_FPDFAttachment_HasKey\",\"_FPDFAttachment_SetFile\",\"_FPDFAttachment_SetStringValue\",\"_FPDFAvail_Create\",\"_FPDFAvail_Destroy\",\"_FPDFAvail_GetDocument\",\"_FPDFAvail_GetFirstPageNum\",\"_FPDFAvail_IsDocAvail\",\"_FPDFAvail_IsFormAvail\",\"_FPDFAvail_IsLinearized\",\"_FPDFAvail_IsPageAvail\",\"_FPDFBitmap_Create\",\"_FPDFBitmap_CreateEx\",\"_FPDFBitmap_Destroy\",\"_FPDFBitmap_FillRect\",\"_FPDFBitmap_GetBuffer\",\"_FPDFBitmap_GetFormat\",\"_FPDFBitmap_GetHeight\",\"_FPDFBitmap_GetStride\",\"_FPDFBitmap_GetWidth\",\"_FPDFBookmark_Find\",\"_FPDFBookmark_GetAction\",\"_FPDFBookmark_GetCount\",\"_FPDFBookmark_GetDest\",\"_FPDFBookmark_GetFirstChild\",\"_FPDFBookmark_GetNextSibling\",\"_FPDFBookmark_GetTitle\",\"_FPDFCatalog_IsTagged\",\"_FPDFCatalog_SetLanguage\",\"_FPDFClipPath_CountPaths\",\"_FPDFClipPath_CountPathSegments\",\"_FPDFClipPath_GetPathSegment\",\"_FPDFDest_GetDestPageIndex\",\"_FPDFDest_GetLocationInPage\",\"_FPDFDest_GetView\",\"_FPDFDoc_AddAttachment\",\"_FPDFDoc_CloseJavaScriptAction\",\"_FPDFDoc_DeleteAttachment\",\"_FPDFDOC_ExitFormFillEnvironment\",\"_FPDFDoc_GetAttachment\",\"_FPDFDoc_GetAttachmentCount\",\"_FPDFDoc_GetJavaScriptAction\",\"_FPDFDoc_GetJavaScriptActionCount\",\"_FPDFDoc_GetPageMode\",\"_FPDFDOC_InitFormFillEnvironment\",\"_FPDFFont_Close\",\"_FPDFFont_GetAscent\",\"_FPDFFont_GetBaseFontName\",\"_FPDFFont_GetDescent\",\"_FPDFFont_GetFamilyName\",\"_FPDFFont_GetFlags\",\"_FPDFFont_GetFontData\",\"_FPDFFont_GetGlyphPath\",\"_FPDFFont_GetGlyphWidth\",\"_FPDFFont_GetIsEmbedded\",\"_FPDFFont_GetItalicAngle\",\"_FPDFFont_GetWeight\",\"_FPDFFormObj_CountObjects\",\"_FPDFFormObj_GetObject\",\"_FPDFGlyphPath_CountGlyphSegments\",\"_FPDFGlyphPath_GetGlyphPathSegment\",\"_FPDFImageObj_GetBitmap\",\"_FPDFImageObj_GetIccProfileDataDecoded\",\"_FPDFImageObj_GetImageDataDecoded\",\"_FPDFImageObj_GetImageDataRaw\",\"_FPDFImageObj_GetImageFilter\",\"_FPDFImageObj_GetImageFilterCount\",\"_FPDFImageObj_GetImageMetadata\",\"_FPDFImageObj_GetImagePixelSize\",\"_FPDFImageObj_GetRenderedBitmap\",\"_FPDFImageObj_LoadJpegFile\",\"_FPDFImageObj_LoadJpegFileInline\",\"_FPDFImageObj_SetBitmap\",\"_FPDFImageObj_SetMatrix\",\"_FPDFJavaScriptAction_GetName\",\"_FPDFJavaScriptAction_GetScript\",\"_FPDFLink_CloseWebLinks\",\"_FPDFLink_CountQuadPoints\",\"_FPDFLink_CountRects\",\"_FPDFLink_CountWebLinks\",\"_FPDFLink_Enumerate\",\"_FPDFLink_GetAction\",\"_FPDFLink_GetAnnot\",\"_FPDFLink_GetAnnotRect\",\"_FPDFLink_GetDest\",\"_FPDFLink_GetLinkAtPoint\",\"_FPDFLink_GetLinkZOrderAtPoint\",\"_FPDFLink_GetQuadPoints\",\"_FPDFLink_GetRect\",\"_FPDFLink_GetTextRange\",\"_FPDFLink_GetURL\",\"_FPDFLink_LoadWebLinks\",\"_FPDFPage_CloseAnnot\",\"_FPDFPage_CountObjects\",\"_FPDFPage_CreateAnnot\",\"_FPDFPage_Delete\",\"_FPDFPage_Flatten\",\"_FPDFPage_FormFieldZOrderAtPoint\",\"_FPDFPage_GenerateContent\",\"_FPDFPage_GetAnnot\",\"_FPDFPage_GetAnnotCount\",\"_FPDFPage_GetAnnotIndex\",\"_FPDFPage_GetArtBox\",\"_FPDFPage_GetBleedBox\",\"_FPDFPage_GetCropBox\",\"_FPDFPage_GetDecodedThumbnailData\",\"_FPDFPage_GetMediaBox\",\"_FPDFPage_GetObject\",\"_FPDFPage_GetRawThumbnailData\",\"_FPDFPage_GetRotation\",\"_FPDFPage_GetThumbnailAsBitmap\",\"_FPDFPage_GetTrimBox\",\"_FPDFPage_HasFormFieldAtPoint\",\"_FPDFPage_HasTransparency\",\"_FPDFPage_InsertClipPath\",\"_FPDFPage_InsertObject\",\"_FPDFPage_New\",\"_FPDFPage_RemoveAnnot\",\"_FPDFPage_RemoveObject\",\"_FPDFPage_SetArtBox\",\"_FPDFPage_SetBleedBox\",\"_FPDFPage_SetCropBox\",\"_FPDFPage_SetMediaBox\",\"_FPDFPage_SetRotation\",\"_FPDFPage_SetTrimBox\",\"_FPDFPage_TransformAnnots\",\"_FPDFPage_TransFormWithClip\",\"_FPDFPageObj_AddMark\",\"_FPDFPageObj_CountMarks\",\"_FPDFPageObj_CreateNewPath\",\"_FPDFPageObj_CreateNewRect\",\"_FPDFPageObj_CreateTextObj\",\"_FPDFPageObj_Destroy\",\"_FPDFPageObj_GetBounds\",\"_FPDFPageObj_GetClipPath\",\"_FPDFPageObj_GetDashArray\",\"_FPDFPageObj_GetDashCount\",\"_FPDFPageObj_GetDashPhase\",\"_FPDFPageObj_GetFillColor\",\"_FPDFPageObj_GetIsActive\",\"_FPDFPageObj_GetLineCap\",\"_FPDFPageObj_GetLineJoin\",\"_FPDFPageObj_GetMark\",\"_FPDFPageObj_GetMarkedContentID\",\"_FPDFPageObj_GetMatrix\",\"_FPDFPageObj_GetRotatedBounds\",\"_FPDFPageObj_GetStrokeColor\",\"_FPDFPageObj_GetStrokeWidth\",\"_FPDFPageObj_GetType\",\"_FPDFPageObj_HasTransparency\",\"_FPDFPageObj_NewImageObj\",\"_FPDFPageObj_NewTextObj\",\"_FPDFPageObj_RemoveMark\",\"_FPDFPageObj_SetBlendMode\",\"_FPDFPageObj_SetDashArray\",\"_FPDFPageObj_SetDashPhase\",\"_FPDFPageObj_SetFillColor\",\"_FPDFPageObj_SetIsActive\",\"_FPDFPageObj_SetLineCap\",\"_FPDFPageObj_SetLineJoin\",\"_FPDFPageObj_SetMatrix\",\"_FPDFPageObj_SetStrokeColor\",\"_FPDFPageObj_SetStrokeWidth\",\"_FPDFPageObj_Transform\",\"_FPDFPageObj_TransformClipPath\",\"_FPDFPageObj_TransformF\",\"_FPDFPageObjMark_CountParams\",\"_FPDFPageObjMark_GetName\",\"_FPDFPageObjMark_GetParamBlobValue\",\"_FPDFPageObjMark_GetParamIntValue\",\"_FPDFPageObjMark_GetParamKey\",\"_FPDFPageObjMark_GetParamStringValue\",\"_FPDFPageObjMark_GetParamValueType\",\"_FPDFPageObjMark_RemoveParam\",\"_FPDFPageObjMark_SetBlobParam\",\"_FPDFPageObjMark_SetIntParam\",\"_FPDFPageObjMark_SetStringParam\",\"_FPDFPath_BezierTo\",\"_FPDFPath_Close\",\"_FPDFPath_CountSegments\",\"_FPDFPath_GetDrawMode\",\"_FPDFPath_GetPathSegment\",\"_FPDFPath_LineTo\",\"_FPDFPath_MoveTo\",\"_FPDFPath_SetDrawMode\",\"_FPDFPathSegment_GetClose\",\"_FPDFPathSegment_GetPoint\",\"_FPDFPathSegment_GetType\",\"_FPDFSignatureObj_GetByteRange\",\"_FPDFSignatureObj_GetContents\",\"_FPDFSignatureObj_GetDocMDPPermission\",\"_FPDFSignatureObj_GetReason\",\"_FPDFSignatureObj_GetSubFilter\",\"_FPDFSignatureObj_GetTime\",\"_FPDFText_ClosePage\",\"_FPDFText_CountChars\",\"_FPDFText_CountRects\",\"_FPDFText_FindClose\",\"_FPDFText_FindNext\",\"_FPDFText_FindPrev\",\"_FPDFText_FindStart\",\"_FPDFText_GetBoundedText\",\"_FPDFText_GetCharAngle\",\"_FPDFText_GetCharBox\",\"_FPDFText_GetCharIndexAtPos\",\"_FPDFText_GetCharIndexFromTextIndex\",\"_FPDFText_GetCharOrigin\",\"_FPDFText_GetFillColor\",\"_FPDFText_GetFontInfo\",\"_FPDFText_GetFontSize\",\"_FPDFText_GetFontWeight\",\"_FPDFText_GetLooseCharBox\",\"_FPDFText_GetMatrix\",\"_FPDFText_GetRect\",\"_FPDFText_GetSchCount\",\"_FPDFText_GetSchResultIndex\",\"_FPDFText_GetStrokeColor\",\"_FPDFText_GetText\",\"_FPDFText_GetTextIndexFromCharIndex\",\"_FPDFText_GetTextObject\",\"_FPDFText_GetUnicode\",\"_FPDFText_HasUnicodeMapError\",\"_FPDFText_IsGenerated\",\"_FPDFText_IsHyphen\",\"_FPDFText_LoadCidType2Font\",\"_FPDFText_LoadFont\",\"_FPDFText_LoadPage\",\"_FPDFText_LoadStandardFont\",\"_FPDFText_SetCharcodes\",\"_FPDFText_SetText\",\"_FPDFTextObj_GetFont\",\"_FPDFTextObj_GetFontSize\",\"_FPDFTextObj_GetRenderedBitmap\",\"_FPDFTextObj_GetText\",\"_FPDFTextObj_GetTextRenderMode\",\"_FPDFTextObj_SetTextRenderMode\",\"_PDFiumExt_CloseFileWriter\",\"_PDFiumExt_CloseFormFillInfo\",\"_PDFiumExt_ExitFormFillEnvironment\",\"_PDFiumExt_GetFileWriterData\",\"_PDFiumExt_GetFileWriterSize\",\"_PDFiumExt_Init\",\"_PDFiumExt_InitFormFillEnvironment\",\"_PDFiumExt_OpenFileWriter\",\"_PDFiumExt_OpenFormFillInfo\",\"_PDFiumExt_SaveAsCopy\",\"_malloc\",\"_free\",\"_memory\",\"___indirect_function_table\",\"onRuntimeInitialized\"].forEach((prop) => {\n if (!Object.getOwnPropertyDescriptor(readyPromise, prop)) {\n Object.defineProperty(readyPromise, prop, {\n get: () => abort('You are getting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),\n set: () => abort('You are setting ' + prop + ' on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js'),\n });\n }\n});\n\n// Determine the runtime environment we are in. You can customize this by\n// setting the ENVIRONMENT setting at compile time (see settings.js).\n\n// Attempt to auto-detect the environment\nvar ENVIRONMENT_IS_WEB = typeof window == 'object';\nvar ENVIRONMENT_IS_WORKER = typeof importScripts == 'function';\n// N.b. Electron.js environment is simultaneously a NODE-environment, but\n// also a web environment.\nvar ENVIRONMENT_IS_NODE = typeof process == 'object' && typeof process.versions == 'object' && typeof process.versions.node == 'string' && process.type != 'renderer';\nvar ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;\n\nif (ENVIRONMENT_IS_NODE) {\n // `require()` is no-op in an ESM module, use `createRequire()` to construct\n // the require()` function. This is only necessary for multi-environment\n // builds, `-sENVIRONMENT=node` emits a static import declaration instead.\n // TODO: Swap all `require()`'s with `import()`'s?\n\n}\n\n// --pre-jses are emitted after the Module integration code, so that they can\n// refer to Module (if they choose; they can also define Module)\n\n\n// Sometimes an existing Module object exists with properties\n// meant to overwrite the default module functionality. Here\n// we collect those properties and reapply _after_ we configure\n// the current environment's defaults to avoid having to be so\n// defensive during initialization.\nvar moduleOverrides = Object.assign({}, Module);\n\nvar arguments_ = [];\nvar thisProgram = './this.program';\nvar quit_ = (status, toThrow) => {\n throw toThrow;\n};\n\n// `/` should be present at the end if `scriptDirectory` is not empty\nvar scriptDirectory = '';\nfunction locateFile(path) {\n if (Module['locateFile']) {\n return Module['locateFile'](path, scriptDirectory);\n }\n return scriptDirectory + path;\n}\n\n// Hooks that are implemented differently in different runtime environments.\nvar readAsync, readBinary;\n\nif (ENVIRONMENT_IS_NODE) {\n if (typeof process == 'undefined' || !process.release || process.release.name !== 'node') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');\n\n var nodeVersion = process.versions.node;\n var numericVersion = nodeVersion.split('.').slice(0, 3);\n numericVersion = (numericVersion[0] * 10000) + (numericVersion[1] * 100) + (numericVersion[2].split('-')[0] * 1);\n var minVersion = 160000;\n if (numericVersion < 160000) {\n throw new Error('This emscripten-generated code requires node v16.0.0 (detected v' + nodeVersion + ')');\n }\n\n // These modules will usually be used on Node.js. Load them eagerly to avoid\n // the complexity of lazy-loading.\n var fs = require('fs');\n var nodePath = require('path');\n\n scriptDirectory = __dirname + '/';\n\n// include: node_shell_read.js\nreadBinary = (filename) => {\n // We need to re-wrap `file://` strings to URLs. Normalizing isn't\n // necessary in that case, the path should already be absolute.\n filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);\n var ret = fs.readFileSync(filename);\n assert(ret.buffer);\n return ret;\n};\n\nreadAsync = (filename, binary = true) => {\n // See the comment in the `readBinary` function.\n filename = isFileURI(filename) ? new URL(filename) : nodePath.normalize(filename);\n return new Promise((resolve, reject) => {\n fs.readFile(filename, binary ? undefined : 'utf8', (err, data) => {\n if (err) reject(err);\n else resolve(binary ? data.buffer : data);\n });\n });\n};\n// end include: node_shell_read.js\n if (!Module['thisProgram'] && process.argv.length > 1) {\n thisProgram = process.argv[1].replace(/\\\\/g, '/');\n }\n\n arguments_ = process.argv.slice(2);\n\n // MODULARIZE will export the module in the proper place outside, we don't need to export here\n\n quit_ = (status, toThrow) => {\n process.exitCode = status;\n throw toThrow;\n };\n\n} else\nif (ENVIRONMENT_IS_SHELL) {\n\n if ((typeof process == 'object' && typeof require === 'function') || typeof window == 'object' || typeof importScripts == 'function') throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');\n\n readBinary = (f) => {\n if (typeof readbuffer == 'function') {\n return new Uint8Array(readbuffer(f));\n }\n let data = read(f, 'binary');\n assert(typeof data == 'object');\n return data;\n };\n\n readAsync = (f) => {\n return new Promise((resolve, reject) => {\n setTimeout(() => resolve(readBinary(f)));\n });\n };\n\n globalThis.clearTimeout ??= (id) => {};\n\n // spidermonkey lacks setTimeout but we use it above in readAsync.\n globalThis.setTimeout ??= (f) => (typeof f == 'function') ? f() : abort();\n\n // v8 uses `arguments_` whereas spidermonkey uses `scriptArgs`\n arguments_ = globalThis.arguments || globalThis.scriptArgs;\n\n if (typeof quit == 'function') {\n quit_ = (status, toThrow) => {\n // Unlike node which has process.exitCode, d8 has no such mechanism. So we\n // have no way to set the exit code and then let the program exit with\n // that code when it naturally stops running (say, when all setTimeouts\n // have completed). For that reason, we must call `quit` - the only way to\n // set the exit code - but quit also halts immediately. To increase\n // consistency with node (and the web) we schedule the actual quit call\n // using a setTimeout to give the current stack and any exception handlers\n // a chance to run. This enables features such as addOnPostRun (which\n // expected to be able to run code after main returns).\n setTimeout(() => {\n if (!(toThrow instanceof ExitStatus)) {\n let toLog = toThrow;\n if (toThrow && typeof toThrow == 'object' && toThrow.stack) {\n toLog = [toThrow, toThrow.stack];\n }\n err(`exiting due to exception: ${toLog}`);\n }\n quit(status);\n });\n throw toThrow;\n };\n }\n\n if (typeof print != 'undefined') {\n // Prefer to use print/printErr where they exist, as they usually work better.\n globalThis.console ??= /** @type{!Console} */({});\n console.log = /** @type{!function(this:Console, ...*): undefined} */ (print);\n console.warn = console.error = /** @type{!function(this:Console, ...*): undefined} */ (globalThis.printErr ?? print);\n }\n\n} else\n\n// Note that this includes Node.js workers when relevant (pthreads is enabled).\n// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and\n// ENVIRONMENT_IS_NODE.\nif (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {\n if (ENVIRONMENT_IS_WORKER) { // Check worker, not web, since window could be polyfilled\n scriptDirectory = self.location.href;\n } else if (typeof document != 'undefined' && document.currentScript) { // web\n scriptDirectory = document.currentScript.src;\n }\n // When MODULARIZE, this JS may be executed later, after document.currentScript\n // is gone, so we saved it, and we use it here instead of any other info.\n if (_scriptName) {\n scriptDirectory = _scriptName;\n }\n // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.\n // otherwise, slice off the final part of the url to find the script directory.\n // if scriptDirectory does not contain a slash, lastIndexOf will return -1,\n // and scriptDirectory will correctly be replaced with an empty string.\n // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),\n // they are removed because they could contain a slash.\n if (scriptDirectory.startsWith('blob:')) {\n scriptDirectory = '';\n } else {\n scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, '').lastIndexOf('/')+1);\n }\n\n if (!(typeof window == 'object' || typeof importScripts == 'function')) throw new Error('not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)');\n\n {\n// include: web_or_worker_shell_read.js\nif (ENVIRONMENT_IS_WORKER) {\n readBinary = (url) => {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', url, false);\n xhr.responseType = 'arraybuffer';\n xhr.send(null);\n return new Uint8Array(/** @type{!ArrayBuffer} */(xhr.response));\n };\n }\n\n readAsync = (url) => {\n assert(!isFileURI(url), \"readAsync does not work with file:// URLs\");\n return fetch(url, { credentials: 'same-origin' })\n .then((response) => {\n if (response.ok) {\n return response.arrayBuffer();\n }\n return Promise.reject(new Error(response.status + ' : ' + response.url));\n })\n };\n// end include: web_or_worker_shell_read.js\n }\n} else\n{\n throw new Error('environment detection error');\n}\n\nvar out = Module['print'] || console.log.bind(console);\nvar err = Module['printErr'] || console.error.bind(console);\n\n// Merge back in the overrides\nObject.assign(Module, moduleOverrides);\n// Free the object hierarchy contained in the overrides, this lets the GC\n// reclaim data used.\nmoduleOverrides = null;\ncheckIncomingModuleAPI();\n\n// Emit code to handle expected values on the Module object. This applies Module.x\n// to the proper local x. This has two benefits: first, we only emit it if it is\n// expected to arrive, and second, by using a local everywhere else that can be\n// minified.\n\nif (Module['arguments']) arguments_ = Module['arguments'];legacyModuleProp('arguments', 'arguments_');\n\nif (Module['thisProgram']) thisProgram = Module['thisProgram'];legacyModuleProp('thisProgram', 'thisProgram');\n\n// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message\n// Assertions on removed incoming Module JS APIs.\nassert(typeof Module['memoryInitializerPrefixURL'] == 'undefined', 'Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead');\nassert(typeof Module['pthreadMainPrefixURL'] == 'undefined', 'Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead');\nassert(typeof Module['cdInitializerPrefixURL'] == 'undefined', 'Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead');\nassert(typeof Module['filePackagePrefixURL'] == 'undefined', 'Module.filePackagePrefixURL option was removed, use Module.locateFile instead');\nassert(typeof Module['read'] == 'undefined', 'Module.read option was removed');\nassert(typeof Module['readAsync'] == 'undefined', 'Module.readAsync option was removed (modify readAsync in JS)');\nassert(typeof Module['readBinary'] == 'undefined', 'Module.readBinary option was removed (modify readBinary in JS)');\nassert(typeof Module['setWindowTitle'] == 'undefined', 'Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)');\nassert(typeof Module['TOTAL_MEMORY'] == 'undefined', 'Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY');\nlegacyModuleProp('asm', 'wasmExports');\nlegacyModuleProp('readAsync', 'readAsync');\nlegacyModuleProp('readBinary', 'readBinary');\nlegacyModuleProp('setWindowTitle', 'setWindowTitle');\nvar IDBFS = 'IDBFS is no longer included by default; build with -lidbfs.js';\nvar PROXYFS = 'PROXYFS is no longer included by default; build with -lproxyfs.js';\nvar WORKERFS = 'WORKERFS is no longer included by default; build with -lworkerfs.js';\nvar FETCHFS = 'FETCHFS is no longer included by default; build with -lfetchfs.js';\nvar ICASEFS = 'ICASEFS is no longer included by default; build with -licasefs.js';\nvar JSFILEFS = 'JSFILEFS is no longer included by default; build with -ljsfilefs.js';\nvar OPFS = 'OPFS is no longer included by default; build with -lopfs.js';\n\nvar NODEFS = 'NODEFS is no longer included by default; build with -lnodefs.js';\n\n// end include: shell.js\n\n// include: preamble.js\n// === Preamble library stuff ===\n\n// Documentation for the public APIs defined in this file must be updated in:\n// site/source/docs/api_reference/preamble.js.rst\n// A prebuilt local version of the documentation is available at:\n// site/build/text/docs/api_reference/preamble.js.txt\n// You can also build docs locally as HTML or other formats in site/\n// An online HTML version (which may be of a different version of Emscripten)\n// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html\n\nvar wasmBinary = Module['wasmBinary'];legacyModuleProp('wasmBinary', 'wasmBinary');\n\nif (typeof WebAssembly != 'object') {\n err('no native wasm support detected');\n}\n\n// Wasm globals\n\nvar wasmMemory;\n\n//========================================\n// Runtime essentials\n//========================================\n\n// whether we are quitting the application. no code should run after this.\n// set in exit() and abort()\nvar ABORT = false;\n\n// set by exit() and abort(). Passed to 'onExit' handler.\n// NOTE: This is also used as the process return code code in shell environments\n// but only when noExitRuntime is false.\nvar EXITSTATUS;\n\n// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we\n// don't define it at all in release modes. This matches the behaviour of\n// MINIMAL_RUNTIME.\n// TODO(sbc): Make this the default even without STRICT enabled.\n/** @type {function(*, string=)} */\nfunction assert(condition, text) {\n if (!condition) {\n abort('Assertion failed' + (text ? ': ' + text : ''));\n }\n}\n\n// We used to include malloc/free by default in the past. Show a helpful error in\n// builds with assertions.\n\n// Memory management\n\nvar HEAP,\n/** @type {!Int8Array} */\n HEAP8,\n/** @type {!Uint8Array} */\n HEAPU8,\n/** @type {!Int16Array} */\n HEAP16,\n/** @type {!Uint16Array} */\n HEAPU16,\n/** @type {!Int32Array} */\n HEAP32,\n/** @type {!Uint32Array} */\n HEAPU32,\n/** @type {!Float32Array} */\n HEAPF32,\n/** @type {!Float64Array} */\n HEAPF64;\n\n// include: runtime_shared.js\nfunction updateMemoryViews() {\n var b = wasmMemory.buffer;\n Module['HEAP8'] = HEAP8 = new Int8Array(b);\n Module['HEAP16'] = HEAP16 = new Int16Array(b);\n Module['HEAPU8'] = HEAPU8 = new Uint8Array(b);\n Module['HEAPU16'] = HEAPU16 = new Uint16Array(b);\n Module['HEAP32'] = HEAP32 = new Int32Array(b);\n Module['HEAPU32'] = HEAPU32 = new Uint32Array(b);\n Module['HEAPF32'] = HEAPF32 = new Float32Array(b);\n Module['HEAPF64'] = HEAPF64 = new Float64Array(b);\n}\n\n// end include: runtime_shared.js\nassert(!Module['STACK_SIZE'], 'STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time')\n\nassert(typeof Int32Array != 'undefined' && typeof Float64Array !== 'undefined' && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined,\n 'JS engine does not provide full typed array support');\n\n// If memory is defined in wasm, the user can't provide it, or set INITIAL_MEMORY\nassert(!Module['wasmMemory'], 'Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally');\nassert(!Module['INITIAL_MEMORY'], 'Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically');\n\n// include: runtime_stack_check.js\n// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.\nfunction writeStackCookie() {\n var max = _emscripten_stack_get_end();\n assert((max & 3) == 0);\n // If the stack ends at address zero we write our cookies 4 bytes into the\n // stack. This prevents interference with SAFE_HEAP and ASAN which also\n // monitor writes to address zero.\n if (max == 0) {\n max += 4;\n }\n // The stack grow downwards towards _emscripten_stack_get_end.\n // We write cookies to the final two words in the stack and detect if they are\n // ever overwritten.\n HEAPU32[((max)>>2)] = 0x02135467;\n HEAPU32[(((max)+(4))>>2)] = 0x89BACDFE;\n // Also test the global address 0 for integrity.\n HEAPU32[((0)>>2)] = 1668509029;\n}\n\nfunction checkStackCookie() {\n if (ABORT) return;\n var max = _emscripten_stack_get_end();\n // See writeStackCookie().\n if (max == 0) {\n max += 4;\n }\n var cookie1 = HEAPU32[((max)>>2)];\n var cookie2 = HEAPU32[(((max)+(4))>>2)];\n if (cookie1 != 0x02135467 || cookie2 != 0x89BACDFE) {\n abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);\n }\n // Also test the global address 0 for integrity.\n if (HEAPU32[((0)>>2)] != 0x63736d65 /* 'emsc' */) {\n abort('Runtime error: The application has corrupted its heap memory area (address zero)!');\n }\n}\n// end include: runtime_stack_check.js\nvar __ATPRERUN__ = []; // functions called before the runtime is initialized\nvar __ATINIT__ = []; // functions called during startup\nvar __ATEXIT__ = []; // functions called during shutdown\nvar __ATPOSTRUN__ = []; // functions called after the main() is called\n\nvar runtimeInitialized = false;\n\nfunction preRun() {\n var preRuns = Module['preRun'];\n if (preRuns) {\n if (typeof preRuns == 'function') preRuns = [preRuns];\n preRuns.forEach(addOnPreRun);\n }\n callRuntimeCallbacks(__ATPRERUN__);\n}\n\nfunction initRuntime() {\n assert(!runtimeInitialized);\n runtimeInitialized = true;\n\n checkStackCookie();\n\n \nif (!Module['noFSInit'] && !FS.initialized)\n FS.init();\nFS.ignorePermissions = false;\n\nTTY.init();\n callRuntimeCallbacks(__ATINIT__);\n}\n\nfunction postRun() {\n checkStackCookie();\n\n var postRuns = Module['postRun'];\n if (postRuns) {\n if (typeof postRuns == 'function') postRuns = [postRuns];\n postRuns.forEach(addOnPostRun);\n }\n\n callRuntimeCallbacks(__ATPOSTRUN__);\n}\n\nfunction addOnPreRun(cb) {\n __ATPRERUN__.unshift(cb);\n}\n\nfunction addOnInit(cb) {\n __ATINIT__.unshift(cb);\n}\n\nfunction addOnExit(cb) {\n}\n\nfunction addOnPostRun(cb) {\n __ATPOSTRUN__.unshift(cb);\n}\n\n// include: runtime_math.js\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/imul\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/fround\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc\n\nassert(Math.imul, 'This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');\nassert(Math.fround, 'This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');\nassert(Math.clz32, 'This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');\nassert(Math.trunc, 'This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill');\n// end include: runtime_math.js\n// A counter of dependencies for calling run(). If we need to\n// do asynchronous work before running, increment this and\n// decrement it. Incrementing must happen in a place like\n// Module.preRun (used by emcc to add file preloading).\n// Note that you can add dependencies in preRun, even though\n// it happens right before run - run will be postponed until\n// the dependencies are met.\nvar runDependencies = 0;\nvar runDependencyWatcher = null;\nvar dependenciesFulfilled = null; // overridden to take different actions when all run dependencies are fulfilled\nvar runDependencyTracking = {};\n\nfunction getUniqueRunDependency(id) {\n var orig = id;\n while (1) {\n if (!runDependencyTracking[id]) return id;\n id = orig + Math.random();\n }\n}\n\nfunction addRunDependency(id) {\n runDependencies++;\n\n Module['monitorRunDependencies']?.(runDependencies);\n\n if (id) {\n assert(!runDependencyTracking[id]);\n runDependencyTracking[id] = 1;\n if (runDependencyWatcher === null && typeof setInterval != 'undefined') {\n // Check for missing dependencies every few seconds\n runDependencyWatcher = setInterval(() => {\n if (ABORT) {\n clearInterval(runDependencyWatcher);\n runDependencyWatcher = null;\n return;\n }\n var shown = false;\n for (var dep in runDependencyTracking) {\n if (!shown) {\n shown = true;\n err('still waiting on run dependencies:');\n }\n err(`dependency: ${dep}`);\n }\n if (shown) {\n err('(end of list)');\n }\n }, 10000);\n }\n } else {\n err('warning: run dependency added without ID');\n }\n}\n\nfunction removeRunDependency(id) {\n runDependencies--;\n\n Module['monitorRunDependencies']?.(runDependencies);\n\n if (id) {\n assert(runDependencyTracking[id]);\n delete runDependencyTracking[id];\n } else {\n err('warning: run dependency removed without ID');\n }\n if (runDependencies == 0) {\n if (runDependencyWatcher !== null) {\n clearInterval(runDependencyWatcher);\n runDependencyWatcher = null;\n }\n if (dependenciesFulfilled) {\n var callback = dependenciesFulfilled;\n dependenciesFulfilled = null;\n callback(); // can add another dependenciesFulfilled\n }\n }\n}\n\n/** @param {string|number=} what */\nfunction abort(what) {\n Module['onAbort']?.(what);\n\n what = 'Aborted(' + what + ')';\n // TODO(sbc): Should we remove printing and leave it up to whoever\n // catches the exception?\n err(what);\n\n ABORT = true;\n\n // Use a wasm runtime error, because a JS error might be seen as a foreign\n // exception, which means we'd run destructors on it. We need the error to\n // simply make the program stop.\n // FIXME This approach does not work in Wasm EH because it currently does not assume\n // all RuntimeErrors are from traps; it decides whether a RuntimeError is from\n // a trap or not based on a hidden field within the object. So at the moment\n // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that\n // allows this in the wasm spec.\n\n // Suppress closure compiler warning here. Closure compiler's builtin extern\n // definition for WebAssembly.RuntimeError claims it takes no arguments even\n // though it can.\n // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.\n /** @suppress {checkTypes} */\n var e = new WebAssembly.RuntimeError(what);\n\n readyPromiseReject(e);\n // Throw the error whether or not MODULARIZE is set because abort is used\n // in code paths apart from instantiation where an exception is expected\n // to be thrown when abort is called.\n throw e;\n}\n\n// include: memoryprofiler.js\n// end include: memoryprofiler.js\n// include: URIUtils.js\n// Prefix of data URIs emitted by SINGLE_FILE and related options.\nvar dataURIPrefix = 'data:application/octet-stream;base64,';\n\n/**\n * Indicates whether filename is a base64 data URI.\n * @noinline\n */\nvar isDataURI = (filename) => filename.startsWith(dataURIPrefix);\n\n/**\n * Indicates whether filename is delivered via file protocol (as opposed to http/https)\n * @noinline\n */\nvar isFileURI = (filename) => filename.startsWith('file://');\n// end include: URIUtils.js\nfunction createExportWrapper(name, nargs) {\n return (...args) => {\n assert(runtimeInitialized, `native function \\`${name}\\` called before runtime initialization`);\n var f = wasmExports[name];\n assert(f, `exported native function \\`${name}\\` not found`);\n // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.\n assert(args.length <= nargs, `native function \\`${name}\\` called with ${args.length} args but expects ${nargs}`);\n return f(...args);\n };\n}\n\n// include: runtime_exceptions.js\n// end include: runtime_exceptions.js\nfunction findWasmBinary() {\n var f = 'pdfium.wasm';\n if (!isDataURI(f)) {\n return locateFile(f);\n }\n return f;\n}\n\nvar wasmBinaryFile;\n\nfunction getBinarySync(file) {\n if (file == wasmBinaryFile && wasmBinary) {\n return new Uint8Array(wasmBinary);\n }\n if (readBinary) {\n return readBinary(file);\n }\n throw 'both async and sync fetching of the wasm failed';\n}\n\nfunction getBinaryPromise(binaryFile) {\n // If we don't have the binary yet, load it asynchronously using readAsync.\n if (!wasmBinary\n ) {\n // Fetch the binary using readAsync\n return readAsync(binaryFile).then(\n (response) => new Uint8Array(/** @type{!ArrayBuffer} */(response)),\n // Fall back to getBinarySync if readAsync fails\n () => getBinarySync(binaryFile)\n );\n }\n\n // Otherwise, getBinarySync should be able to get it synchronously\n return Promise.resolve().then(() => getBinarySync(binaryFile));\n}\n\nfunction instantiateArrayBuffer(binaryFile, imports, receiver) {\n return getBinaryPromise(binaryFile).then((binary) => {\n return WebAssembly.instantiate(binary, imports);\n }).then(receiver, (reason) => {\n err(`failed to asynchronously prepare wasm: ${reason}`);\n\n // Warn on some common problems.\n if (isFileURI(wasmBinaryFile)) {\n err(`warning: Loading from a file URI (${wasmBinaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);\n }\n abort(reason);\n });\n}\n\nfunction instantiateAsync(binary, binaryFile, imports, callback) {\n if (!binary &&\n typeof WebAssembly.instantiateStreaming == 'function' &&\n !isDataURI(binaryFile) &&\n // Avoid instantiateStreaming() on Node.js environment for now, as while\n // Node.js v18.1.0 implements it, it does not have a full fetch()\n // implementation yet.\n //\n // Reference:\n // https://github.com/emscripten-core/emscripten/pull/16917\n !ENVIRONMENT_IS_NODE &&\n typeof fetch == 'function') {\n return fetch(binaryFile, { credentials: 'same-origin' }).then((response) => {\n // Suppress closure warning here since the upstream definition for\n // instantiateStreaming only allows Promise<Repsponse> rather than\n // an actual Response.\n // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure is fixed.\n /** @suppress {checkTypes} */\n var result = WebAssembly.instantiateStreaming(response, imports);\n\n return result.then(\n callback,\n function(reason) {\n // We expect the most common failure cause to be a bad MIME type for the binary,\n // in which case falling back to ArrayBuffer instantiation should work.\n err(`wasm streaming compile failed: ${reason}`);\n err('falling back to ArrayBuffer instantiation');\n return instantiateArrayBuffer(binaryFile, imports, callback);\n });\n });\n }\n return instantiateArrayBuffer(binaryFile, imports, callback);\n}\n\nfunction getWasmImports() {\n // prepare imports\n return {\n 'env': wasmImports,\n 'wasi_snapshot_preview1': wasmImports,\n }\n}\n\n// Create the wasm instance.\n// Receives the wasm imports, returns the exports.\nfunction createWasm() {\n var info = getWasmImports();\n // Load the wasm module and create an instance of using native support in the JS engine.\n // handle a generated wasm instance, receiving its exports and\n // performing other necessary setup\n /** @param {WebAssembly.Module=} module*/\n function receiveInstance(instance, module) {\n wasmExports = instance.exports;\n\n Module['wasmExports'] = wasmExports;\n\n wasmMemory = wasmExports['memory'];\n \n assert(wasmMemory, 'memory not found in wasm exports');\n updateMemoryViews();\n\n wasmTable = wasmExports['__indirect_function_table'];\n \n assert(wasmTable, 'table not found in wasm exports');\n\n addOnInit(wasmExports['__wasm_call_ctors']);\n\n removeRunDependency('wasm-instantiate');\n return wasmExports;\n }\n // wait for the pthread pool (if any)\n addRunDependency('wasm-instantiate');\n\n // Prefer streaming instantiation if available.\n // Async compilation can be confusing when an error on the page overwrites Module\n // (for example, if the order of elements is wrong, and the one defining Module is\n // later), so we save Module and check it later.\n var trueModule = Module;\n function receiveInstantiationResult(result) {\n // 'result' is a ResultObject object which has both the module and instance.\n // receiveInstance() will swap in the exports (to Module.asm) so they can be called\n assert(Module === trueModule, 'the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?');\n trueModule = null;\n // TODO: Due to Closure regression https://github.com/google/closure-compiler/issues/3193, the above line no longer optimizes out down to the following line.\n // When the regression is fixed, can restore the above PTHREADS-enabled path.\n receiveInstance(result['instance']);\n }\n\n // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback\n // to manually instantiate the Wasm module themselves. This allows pages to\n // run the instantiation parallel to any other async startup actions they are\n // performing.\n // Also pthreads and wasm workers initialize the wasm instance through this\n // path.\n if (Module['instantiateWasm']) {\n try {\n return Module['instantiateWasm'](info, receiveInstance);\n } catch(e) {\n err(`Module.instantiateWasm callback failed with error: ${e}`);\n // If instantiation fails, reject the module ready promise.\n readyPromiseReject(e);\n }\n }\n\n wasmBinaryFile ??= findWasmBinary();\n\n // If instantiation fails, reject the module ready promise.\n instantiateAsync(wasmBinary, wasmBinaryFile, info, receiveInstantiationResult).catch(readyPromiseReject);\n return {}; // no exports yet; we'll fill them in later\n}\n\n// Globals used by JS i64 conversions (see makeSetValue)\nvar tempDouble;\nvar tempI64;\n\n// include: runtime_debug.js\n// Endianness check\n(() => {\n var h16 = new Int16Array(1);\n var h8 = new Int8Array(h16.buffer);\n h16[0] = 0x6373;\n if (h8[0] !== 0x73 || h8[1] !== 0x63) throw 'Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)';\n})();\n\nif (Module['ENVIRONMENT']) {\n throw new Error('Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)');\n}\n\nfunction legacyModuleProp(prop, newName, incoming=true) {\n if (!Object.getOwnPropertyDescriptor(Module, prop)) {\n Object.defineProperty(Module, prop, {\n configurable: true,\n get() {\n let extra = incoming ? ' (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)' : '';\n abort(`\\`Module.${prop}\\` has been replaced by \\`${newName}\\`` + extra);\n\n }\n });\n }\n}\n\nfunction ignoredModuleProp(prop) {\n if (Object.getOwnPropertyDescriptor(Module, prop)) {\n abort(`\\`Module.${prop}\\` was supplied but \\`${prop}\\` not included in INCOMING_MODULE_JS_API`);\n }\n}\n\n// forcing the filesystem exports a few things by default\nfunction isExportedByForceFilesystem(name) {\n return name === 'FS_createPath' ||\n name === 'FS_createDataFile' ||\n name === 'FS_createPreloadedFile' ||\n name === 'FS_unlink' ||\n name === 'addRunDependency' ||\n // The old FS has some functionality that WasmFS lacks.\n name === 'FS_createLazyFile' ||\n name === 'FS_createDevice' ||\n name === 'removeRunDependency';\n}\n\n/**\n * Intercept access to a global symbol. This enables us to give informative\n * warnings/errors when folks attempt to use symbols they did not include in\n * their build, or no symbols that no longer exist.\n */\nfunction hookGlobalSymbolAccess(sym, func) {\n // In MODULARIZE mode the generated code runs inside a function scope and not\n // the global scope, and JavaScript does not provide access to function scopes\n // so we cannot dynamically modify the scrope using `defineProperty` in this\n // case.\n //\n // In this mode we simply ignore requests for `hookGlobalSymbolAccess`. Since\n // this is a debug-only feature, skipping it is not major issue.\n}\n\nfunction missingGlobal(sym, msg) {\n hookGlobalSymbolAccess(sym, () => {\n warnOnce(`\\`${sym}\\` is not longer defined by emscripten. ${msg}`);\n });\n}\n\nmissingGlobal('buffer', 'Please use HEAP8.buffer or wasmMemory.buffer');\nmissingGlobal('asm', 'Please use wasmExports instead');\n\nfunction missingLibrarySymbol(sym) {\n hookGlobalSymbolAccess(sym, () => {\n // Can't `abort()` here because it would break code that does runtime\n // checks. e.g. `if (typeof SDL === 'undefined')`.\n var msg = `\\`${sym}\\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;\n // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in\n // library.js, which means $name for a JS name with no prefix, or name\n // for a JS name like _name.\n var librarySymbol = sym;\n if (!librarySymbol.startsWith('_')) {\n librarySymbol = '$' + sym;\n }\n msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;\n if (isExportedByForceFilesystem(sym)) {\n msg += '. Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you';\n }\n warnOn